diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c47898bd369acb9aac3aede2d57cab2b7d6856fc..863575f84f31bc91b6b6253eda911c9d9c4dafc4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -10,6 +10,7 @@ default:
             - runner_system_failure
 
 stages:
+    - lint
     - build
     - build:cuda
     - build:gcc
@@ -488,3 +489,58 @@ deploy documentation:
     tags:
         - docker
         - deploy_key
+
+clang-format:
+    stage: lint
+#    only:
+#        changes:
+#            - Documentation/**/*.{h,hpp,cpp,cu}
+#            - src/**/*.{h,hpp,cpp,cu}
+    script:
+        # TODO: replace "src/TNL" with "src"
+        - ./scripts/run-clang-format.py
+                --color always
+                --style file
+                --exclude "src/3rdparty/*"
+                --recursive
+                src/TNL Documentation
+    interruptible: true
+    # TODO: remove to enforce formatting
+    allow_failure: true
+
+clang-tidy:
+    stage: lint
+#    only:
+#        changes:
+#            - Documentation/**/*.{h,hpp,cpp,cu}
+#            - src/**/*.{h,hpp,cpp,cu}
+    variables:
+        CXX: clang++
+        CC: clang
+    script:
+        # configure only to generate compile_commands.json
+        # TODO: set BUILD_EXAMPLES=yes to modernize examples
+        - cmake -B "./builddir/$CI_JOB_NAME" -S . -G Ninja
+                -DCMAKE_BUILD_TYPE=Debug
+                -DWITH_OPENMP=yes
+                -DWITH_MPI=yes
+                -DWITH_CUDA=no
+                -DBUILD_TESTS=yes
+                -DBUILD_MATRIX_TESTS=yes
+                -DBUILD_DOC=yes
+                -DBUILD_BENCHMARKS=yes
+                -DBUILD_EXAMPLES=no
+                -DBUILD_TOOLS=yes
+                -DBUILD_PYTHON=yes
+                -DWITH_CI_FLAGS=yes
+        # cmake creates compile_commands.json only on the second run, WTF!?
+        - cmake -B "./builddir/$CI_JOB_NAME" -S . -G Ninja
+        - ls -lah "./builddir/$CI_JOB_NAME"
+        # run-clang-tidy is weird compared to run-clang-format.py:
+        # - clang-tidy is not executed on header files, but on source files
+        # - the positional arguments are regexes filtering sources from the compile_commands.json
+        # - the -header-filter option (or HeaderFilterRegex in the config) allows to filter header files
+        - run-clang-tidy -p "./builddir/$CI_JOB_NAME" ".*"
+    interruptible: true
+    # TODO: remove to enforce
+    allow_failure: true
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d74bbb48f398388b2004358e75e5d6c87787d7f0..9d2c2b30973c0485dce51b23816c913f222ea812 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -318,7 +318,7 @@ endif()
 set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin )
 set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib )
 include_directories( src )
-include_directories( src/3rdparty )
+include_directories( SYSTEM src/3rdparty )
 
 # Add all subdirectories
 add_subdirectory( src )
@@ -331,6 +331,10 @@ if( ${BUILD_DOC} )
    add_subdirectory( Documentation/Tutorials )
 endif()
 
+# export compile_commands.json so it can be used by Clang tools
+# https://clang.llvm.org/docs/JSONCompilationDatabase.html
+set( CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "" )
+
 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Template Numerical Library")
 set(CPACK_PACKAGE_VENDOR "MMG")
 #set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
diff --git a/Documentation/.clang-format b/Documentation/.clang-format
new file mode 120000
index 0000000000000000000000000000000000000000..ef1c8aefd945c7c4c963c237128b14408b1f4736
--- /dev/null
+++ b/Documentation/.clang-format
@@ -0,0 +1 @@
+../src/.clang-format
\ No newline at end of file
diff --git a/scripts/p-clang-format b/scripts/p-clang-format
new file mode 100755
index 0000000000000000000000000000000000000000..f7c56b3e7395ff3789f82723d88713355a35b0e3
--- /dev/null
+++ b/scripts/p-clang-format
@@ -0,0 +1,112 @@
+#!/bin/bash
+# Copyright (c) 2017, Medicine Yeh
+# MIT License
+
+# Upstream page: https://github.com/MedicineYeh/p-clang-format
+# Local modifications:
+#   - https://github.com/MedicineYeh/p-clang-format/pull/2
+#   - CUDA_CHEVRON_* hack to protect "<<<" and ">>>" from clang-format
+#     (see https://github.com/llvm/llvm-project/issues/52881)
+
+# Turn on this to replace any pragma
+#REPLACE_ANY_PRAGMA=1
+
+function replace_all()
+{
+    local prefix="$1"
+    local keywords=("${!2}")
+    local pattern="$3"
+    local file_pathes=("${!4}")
+
+    # echo "Keywords     : ${keywords[*]}"
+    # echo "Pattern      : ${pattern}"
+    # echo "File Path    : ${file_pathes[*]}"
+
+    for file_path in "${file_pathes[@]}"; do
+        [[ ! -r "$file_path" ]] && continue
+        for w in "${keywords[@]}"; do
+            # echo "Replace '${prefix}$w' in '$file_path'"
+            sed -i "s/${prefix}${w}/${pattern}${prefix}${w}/g" "${file_path}"
+        done
+
+        # HACK: protect "<<<" and ">>>" from clang-format
+        sed -i "s/<<</CUDA_CHEVRON_OPEN/g" "${file_path}"
+        sed -i "s/>>>/CUDA_CHEVRON_CLOSE/g" "${file_path}"
+    done
+}
+
+function re_replace_all()
+{
+    local prefix="$1"
+    local keywords=("${!2}")
+    local pattern="$3"
+    local file_pathes=("${!4}")
+
+    # echo "Keywords     : ${keywords[*]}"
+    # echo "Anti-Pattern : ${pattern}"
+    # echo "File Path    : ${file_pathes[*]}"
+
+    for file_path in "${file_pathes[@]}"; do
+        [[ ! -r "$file_path" ]] && continue
+        for w in "${keywords[@]}"; do
+            # echo "Re:replace '${prefix}$w' in '$file_path'"
+            sed -i "s/${pattern}${prefix}${w}/${prefix}${w}/g" "${file_path}"
+        done
+
+        # HACK: unprotect "<<<" and ">>>"
+        sed -i "s/CUDA_CHEVRON_OPEN/<<</g" "${file_path}"
+        sed -i "s/CUDA_CHEVRON_CLOSE/>>>/g" "${file_path}"
+    done
+}
+
+function format()
+{
+    clang-format "$@"
+}
+
+function main()
+{
+    # This is the pattern for replacing to comments
+    local comment_pattern="\/\/"
+    # This is the pattern for replacing comments back to original string
+    local re_comment_pattern="\/\/ *"
+    # The path of files
+    local file_pathes=()
+    # Define the keywords of pragma to be escaped from formatting
+    local pragma_prefix="#pragma "
+    local pragma_key_words=()
+    # Loop specific
+    pragma_key_words+=(omp simd loop unroll ivdep vector)
+    # Memory specific
+    pragma_key_words+=(alloc_section)
+    # Misc.
+    pragma_key_words+=("cilk grainsize" offload)
+
+    # Turn on the following line to indent any pragma
+    [[ "$REPLACE_ANY_PRAGMA" == "1" ]] && pragma_key_words=("")
+
+    # Find all files in the arguments
+    for var in "$@"; do
+        if [[ ! "$var" =~ ^-.* ]]; then
+            file_pathes+=("$var")
+        fi
+    done
+
+    # Create and trap a temporary file
+    tmpfile=$(mktemp --tmpdir="${TMPDIR:-/tmp}" p-clang-format.XXXXXXXXXX)
+    trap 'rm -f -- "$tmpfile"' INT TERM HUP EXIT
+    # Append the temporary file to file_pathes so pragmas will be replaced in it
+    # (this handles the case when the user did not specify -i to edit files in-place)
+    file_pathes+=("$tmpfile")
+
+    # Replace "#pragma" -> "//#pragma" in the files
+    replace_all "$pragma_prefix" "pragma_key_words[@]" "$comment_pattern" "file_pathes[@]"
+    # Run clang-format and redirect its output to the $tmpfile
+    format "$@" > "$tmpfile"
+    # Replace "//#pragma" -> "#pragma" in the files
+    re_replace_all "$pragma_prefix" "pragma_key_words[@]" "$re_comment_pattern" "file_pathes[@]"
+    # Show the clang-format's stdout after replacement
+    cat "$tmpfile"
+}
+
+main "$@"
diff --git a/scripts/run-clang-format.py b/scripts/run-clang-format.py
new file mode 100755
index 0000000000000000000000000000000000000000..235c21c58ccac039e5b069cb30574ba2921afc9d
--- /dev/null
+++ b/scripts/run-clang-format.py
@@ -0,0 +1,417 @@
+#!/usr/bin/env python
+"""A wrapper script around clang-format, suitable for linting multiple files
+and to use for continuous integration.
+
+This is an alternative API for the clang-format command line.
+It runs over multiple files and directories in parallel.
+A diff output is produced and a sensible exit code is returned.
+
+Upstream page: https://github.com/Sarcasm/run-clang-format
+Local modifications:
+    - DEFAULT_CLANG_FORMAT_EXECUTABLE, p-clang-format
+"""
+
+from __future__ import print_function, unicode_literals
+
+import argparse
+import codecs
+import difflib
+import fnmatch
+import io
+import errno
+import multiprocessing
+import os
+import signal
+import subprocess
+import sys
+import traceback
+
+from functools import partial
+
+try:
+    from subprocess import DEVNULL  # py3k
+except ImportError:
+    DEVNULL = open(os.devnull, "wb")
+
+
+DEFAULT_EXTENSIONS = 'c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx'
+DEFAULT_CLANG_FORMAT_IGNORE = '.clang-format-ignore'
+# use a wrapper script which formats #pragmas nicely
+_p_clang_format = os.path.join(os.path.dirname(__file__), "p-clang-format")
+if os.path.isfile(_p_clang_format):
+    DEFAULT_CLANG_FORMAT_EXECUTABLE = _p_clang_format
+else:
+    DEFAULT_CLANG_FORMAT_EXECUTABLE = 'clang-format'
+
+
+class ExitStatus:
+    SUCCESS = 0
+    DIFF = 1
+    TROUBLE = 2
+
+def excludes_from_file(ignore_file):
+    excludes = []
+    try:
+        with io.open(ignore_file, 'r', encoding='utf-8') as f:
+            for line in f:
+                if line.startswith('#'):
+                    # ignore comments
+                    continue
+                pattern = line.rstrip()
+                if not pattern:
+                    # allow empty lines
+                    continue
+                excludes.append(pattern)
+    except EnvironmentError as e:
+        if e.errno != errno.ENOENT:
+            raise
+    return excludes;
+
+def list_files(files, recursive=False, extensions=None, exclude=None):
+    if extensions is None:
+        extensions = []
+    if exclude is None:
+        exclude = []
+
+    out = []
+    for file in files:
+        if recursive and os.path.isdir(file):
+            for dirpath, dnames, fnames in os.walk(file):
+                fpaths = [os.path.join(dirpath, fname) for fname in fnames]
+                for pattern in exclude:
+                    # os.walk() supports trimming down the dnames list
+                    # by modifying it in-place,
+                    # to avoid unnecessary directory listings.
+                    dnames[:] = [
+                        x for x in dnames
+                        if
+                        not fnmatch.fnmatch(os.path.join(dirpath, x), pattern)
+                    ]
+                    fpaths = [
+                        x for x in fpaths if not fnmatch.fnmatch(x, pattern)
+                    ]
+                for f in fpaths:
+                    ext = os.path.splitext(f)[1][1:]
+                    if ext in extensions:
+                        out.append(f)
+        else:
+            out.append(file)
+    return out
+
+
+def make_diff(file, original, reformatted):
+    return list(
+        difflib.unified_diff(
+            original,
+            reformatted,
+            fromfile='{}\t(original)'.format(file),
+            tofile='{}\t(reformatted)'.format(file),
+            n=3))
+
+
+class DiffError(Exception):
+    def __init__(self, message, errs=None):
+        super(DiffError, self).__init__(message)
+        self.errs = errs or []
+
+
+class UnexpectedError(Exception):
+    def __init__(self, message, exc=None):
+        super(UnexpectedError, self).__init__(message)
+        self.formatted_traceback = traceback.format_exc()
+        self.exc = exc
+
+
+def run_clang_format_diff_wrapper(args, file):
+    try:
+        ret = run_clang_format_diff(args, file)
+        return ret
+    except DiffError:
+        raise
+    except Exception as e:
+        raise UnexpectedError('{}: {}: {}'.format(file, e.__class__.__name__,
+                                                  e), e)
+
+
+def run_clang_format_diff(args, file):
+    try:
+        with io.open(file, 'r', encoding='utf-8') as f:
+            original = f.readlines()
+    except IOError as exc:
+        raise DiffError(str(exc))
+
+    if args.in_place:
+        invocation = [args.clang_format_executable, '-i', file]
+    else:
+        invocation = [args.clang_format_executable, file]
+
+    if args.style:
+        invocation.extend(['--style', args.style])
+
+    if args.dry_run:
+        print(" ".join(invocation))
+        return [], []
+
+    # Use of utf-8 to decode the process output.
+    #
+    # Hopefully, this is the correct thing to do.
+    #
+    # It's done due to the following assumptions (which may be incorrect):
+    # - clang-format will returns the bytes read from the files as-is,
+    #   without conversion, and it is already assumed that the files use utf-8.
+    # - if the diagnostics were internationalized, they would use utf-8:
+    #   > Adding Translations to Clang
+    #   >
+    #   > Not possible yet!
+    #   > Diagnostic strings should be written in UTF-8,
+    #   > the client can translate to the relevant code page if needed.
+    #   > Each translation completely replaces the format string
+    #   > for the diagnostic.
+    #   > -- http://clang.llvm.org/docs/InternalsManual.html#internals-diag-translation
+    #
+    # It's not pretty, due to Python 2 & 3 compatibility.
+    encoding_py3 = {}
+    if sys.version_info[0] >= 3:
+        encoding_py3['encoding'] = 'utf-8'
+
+    try:
+        proc = subprocess.Popen(
+            invocation,
+            stdout=subprocess.PIPE,
+            stderr=subprocess.PIPE,
+            universal_newlines=True,
+            **encoding_py3)
+    except OSError as exc:
+        raise DiffError(
+            "Command '{}' failed to start: {}".format(
+                subprocess.list2cmdline(invocation), exc
+            )
+        )
+    proc_stdout = proc.stdout
+    proc_stderr = proc.stderr
+    if sys.version_info[0] < 3:
+        # make the pipes compatible with Python 3,
+        # reading lines should output unicode
+        encoding = 'utf-8'
+        proc_stdout = codecs.getreader(encoding)(proc_stdout)
+        proc_stderr = codecs.getreader(encoding)(proc_stderr)
+    # hopefully the stderr pipe won't get full and block the process
+    outs = list(proc_stdout.readlines())
+    errs = list(proc_stderr.readlines())
+    proc.wait()
+    if proc.returncode:
+        raise DiffError(
+            "Command '{}' returned non-zero exit status {}".format(
+                subprocess.list2cmdline(invocation), proc.returncode
+            ),
+            errs,
+        )
+    if args.in_place:
+        return [], errs
+    return make_diff(file, original, outs), errs
+
+
+def bold_red(s):
+    return '\x1b[1m\x1b[31m' + s + '\x1b[0m'
+
+
+def colorize(diff_lines):
+    def bold(s):
+        return '\x1b[1m' + s + '\x1b[0m'
+
+    def cyan(s):
+        return '\x1b[36m' + s + '\x1b[0m'
+
+    def green(s):
+        return '\x1b[32m' + s + '\x1b[0m'
+
+    def red(s):
+        return '\x1b[31m' + s + '\x1b[0m'
+
+    for line in diff_lines:
+        if line[:4] in ['--- ', '+++ ']:
+            yield bold(line)
+        elif line.startswith('@@ '):
+            yield cyan(line)
+        elif line.startswith('+'):
+            yield green(line)
+        elif line.startswith('-'):
+            yield red(line)
+        else:
+            yield line
+
+
+def print_diff(diff_lines, use_color):
+    if use_color:
+        diff_lines = colorize(diff_lines)
+    if sys.version_info[0] < 3:
+        sys.stdout.writelines((l.encode('utf-8') for l in diff_lines))
+    else:
+        sys.stdout.writelines(diff_lines)
+
+
+def print_trouble(prog, message, use_colors):
+    error_text = 'error:'
+    if use_colors:
+        error_text = bold_red(error_text)
+    print("{}: {} {}".format(prog, error_text, message), file=sys.stderr)
+
+
+def main():
+    parser = argparse.ArgumentParser(description=__doc__)
+    parser.add_argument(
+        '--clang-format-executable',
+        metavar='EXECUTABLE',
+        help='path to the clang-format executable',
+        default=DEFAULT_CLANG_FORMAT_EXECUTABLE)
+    parser.add_argument(
+        '--extensions',
+        help='comma separated list of file extensions (default: {})'.format(
+            DEFAULT_EXTENSIONS),
+        default=DEFAULT_EXTENSIONS)
+    parser.add_argument(
+        '-r',
+        '--recursive',
+        action='store_true',
+        help='run recursively over directories')
+    parser.add_argument(
+        '-d',
+        '--dry-run',
+        action='store_true',
+        help='just print the list of files')
+    parser.add_argument(
+        '-i',
+        '--in-place',
+        action='store_true',
+        help='format file instead of printing differences')
+    parser.add_argument('files', metavar='file', nargs='+')
+    parser.add_argument(
+        '-q',
+        '--quiet',
+        action='store_true',
+        help="disable output, useful for the exit code")
+    parser.add_argument(
+        '-j',
+        metavar='N',
+        type=int,
+        default=0,
+        help='run N clang-format jobs in parallel'
+        ' (default number of cpus + 1)')
+    parser.add_argument(
+        '--color',
+        default='auto',
+        choices=['auto', 'always', 'never'],
+        help='show colored diff (default: auto)')
+    parser.add_argument(
+        '-e',
+        '--exclude',
+        metavar='PATTERN',
+        action='append',
+        default=[],
+        help='exclude paths matching the given glob-like pattern(s)'
+        ' from recursive search')
+    parser.add_argument(
+        '--style',
+        help='formatting style to apply (LLVM, Google, Chromium, Mozilla, WebKit)')
+
+    args = parser.parse_args()
+
+    # use default signal handling, like diff return SIGINT value on ^C
+    # https://bugs.python.org/issue14229#msg156446
+    signal.signal(signal.SIGINT, signal.SIG_DFL)
+    try:
+        signal.SIGPIPE
+    except AttributeError:
+        # compatibility, SIGPIPE does not exist on Windows
+        pass
+    else:
+        signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+
+    colored_stdout = False
+    colored_stderr = False
+    if args.color == 'always':
+        colored_stdout = True
+        colored_stderr = True
+    elif args.color == 'auto':
+        colored_stdout = sys.stdout.isatty()
+        colored_stderr = sys.stderr.isatty()
+
+    version_invocation = [args.clang_format_executable, str("--version")]
+    try:
+        subprocess.check_call(version_invocation, stdout=DEVNULL)
+    except subprocess.CalledProcessError as e:
+        print_trouble(parser.prog, str(e), use_colors=colored_stderr)
+        return ExitStatus.TROUBLE
+    except OSError as e:
+        print_trouble(
+            parser.prog,
+            "Command '{}' failed to start: {}".format(
+                subprocess.list2cmdline(version_invocation), e
+            ),
+            use_colors=colored_stderr,
+        )
+        return ExitStatus.TROUBLE
+
+    retcode = ExitStatus.SUCCESS
+
+    excludes = excludes_from_file(DEFAULT_CLANG_FORMAT_IGNORE)
+    excludes.extend(args.exclude)
+
+    files = list_files(
+        args.files,
+        recursive=args.recursive,
+        exclude=excludes,
+        extensions=args.extensions.split(','))
+
+    if not files:
+        return
+
+    njobs = args.j
+    if njobs == 0:
+        njobs = multiprocessing.cpu_count() + 1
+    njobs = min(len(files), njobs)
+
+    if njobs == 1:
+        # execute directly instead of in a pool,
+        # less overhead, simpler stacktraces
+        it = (run_clang_format_diff_wrapper(args, file) for file in files)
+        pool = None
+    else:
+        pool = multiprocessing.Pool(njobs)
+        it = pool.imap_unordered(
+            partial(run_clang_format_diff_wrapper, args), files)
+        pool.close()
+    while True:
+        try:
+            outs, errs = next(it)
+        except StopIteration:
+            break
+        except DiffError as e:
+            print_trouble(parser.prog, str(e), use_colors=colored_stderr)
+            retcode = ExitStatus.TROUBLE
+            sys.stderr.writelines(e.errs)
+        except UnexpectedError as e:
+            print_trouble(parser.prog, str(e), use_colors=colored_stderr)
+            sys.stderr.write(e.formatted_traceback)
+            retcode = ExitStatus.TROUBLE
+            # stop at the first unexpected error,
+            # something could be very wrong,
+            # don't process all files unnecessarily
+            if pool:
+                pool.terminate()
+            break
+        else:
+            sys.stderr.writelines(errs)
+            if outs == []:
+                continue
+            if not args.quiet:
+                print_diff(outs, use_color=colored_stdout)
+            if retcode == ExitStatus.SUCCESS:
+                retcode = ExitStatus.DIFF
+    if pool:
+        pool.join()
+    return retcode
+
+
+if __name__ == '__main__':
+    sys.exit(main())
diff --git a/src/.clang-format b/src/.clang-format
new file mode 100644
index 0000000000000000000000000000000000000000..b774752240fc4a9c5188e5d3ab97864634cae911
--- /dev/null
+++ b/src/.clang-format
@@ -0,0 +1,162 @@
+# Documentation: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
+---
+Language: Cpp
+Standard: c++14
+#BasedOnStyle: Mozilla
+
+# max line length
+ColumnLimit: 128
+
+IndentWidth: 3
+ContinuationIndentWidth: 3
+IndentAccessModifiers: false
+AccessModifierOffset: -3
+IndentCaseLabels: true
+IndentCaseBlocks: true
+IndentGotoLabels: false
+IndentPPDirectives: BeforeHash
+IndentExternBlock: NoIndent
+IndentWrappedFunctionNames: false
+
+NamespaceIndentation: None
+FixNamespaceComments: true
+CompactNamespaces: false
+#ShortnamespaceLines: 10  # Clang 14
+
+EmptyLineAfterAccessModifier: Never
+EmptyLineBeforeAccessModifier: LogicalBlock
+KeepEmptyLinesAtTheStartOfBlocks: false
+MaxEmptyLinesToKeep: 1
+
+SpacesInParentheses: true
+SpacesInSquareBrackets: true
+SpacesInAngles: Always
+SpacesInConditionalStatement: true
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+
+SpaceAfterCStyleCast: true
+SpaceAfterLogicalNot: true
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
+BitFieldColonSpacing: Both
+SpaceBeforeParens: Never
+SpaceBeforeRangeBasedForLoopColon: true
+SpaceBeforeSquareBrackets: false
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeCaseColon: false
+SpaceBeforeCpp11BracedList: false
+SpaceInEmptyBlock: false
+SpaceInEmptyParentheses: false
+
+SpacesBeforeTrailingComments: 2
+Cpp11BracedListStyle: false
+
+#PackConstructorInitializers: Never  # Clang 14
+AllowAllConstructorInitializersOnNextLine: false  # deprecated
+ConstructorInitializerAllOnOneLineOrOnePerLine: false  # deprecated
+ConstructorInitializerIndentWidth: 0
+
+AlwaysBreakAfterReturnType: All
+AlwaysBreakBeforeMultilineStrings: false
+BreakBeforeBraces: Custom
+BraceWrapping:
+  AfterCaseLabel:  false
+  AfterClass:      true
+  AfterControlStatement: MultiLine
+  AfterEnum:       true
+  AfterFunction:   true
+  AfterNamespace:  false
+  AfterStruct:     true
+  AfterUnion:      true
+  AfterExternBlock: true
+  BeforeLambdaBody: true
+  BeforeCatch:     true
+  BeforeElse:      true
+  BeforeWhile:     false
+  IndentBraces:    false
+  SplitEmptyFunction: false
+  SplitEmptyRecord: false
+  SplitEmptyNamespace: true
+
+BreakBeforeBinaryOperators: NonAssignment
+BreakBeforeTernaryOperators: true
+BreakInheritanceList: BeforeColon
+BreakConstructorInitializers: BeforeColon
+#BreakBeforeConceptDeclarations: true
+#BreakStringLiterals: true
+
+AlwaysBreakTemplateDeclarations: Yes
+SpaceAfterTemplateKeyword: false
+
+AlignAfterOpenBracket: Align
+AlignArrayOfStructures: None
+AlignConsecutiveMacros: None
+AlignConsecutiveAssignments: None
+AlignConsecutiveBitFields: None
+AlignConsecutiveDeclarations: None
+AlignEscapedNewlines: Left
+AlignOperands:   AlignAfterOperator
+AlignTrailingComments: true
+
+DerivePointerAlignment: false
+PointerAlignment: Left
+ReferenceAlignment: Pointer
+
+# statement macros are typically formatted on their own lines
+StatementMacros:
+  - __global__
+  - __host__
+  - __device__
+  - __cuda_callable__
+
+AllowAllArgumentsOnNextLine: true
+AllowAllParametersOfDeclarationOnNextLine: false
+AllowShortEnumsOnASingleLine: true
+AllowShortBlocksOnASingleLine: Never
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: Inline
+AllowShortLambdasOnASingleLine: Empty
+AllowShortIfStatementsOnASingleLine: Never
+AllowShortLoopsOnASingleLine: false
+BinPackArguments: false
+BinPackParameters: false
+
+#CommentPragmas:  '^ IWYU pragma:'
+
+#IncludeBlocks:   Preserve
+#IncludeCategories:
+#  - Regex:           '^"(llvm|llvm-c|clang|clang-c)/'
+#    Priority:        2
+#    SortPriority:    0
+#    CaseSensitive:   false
+#  - Regex:           '^(<|"(gtest|gmock|isl|json)/)'
+#    Priority:        3
+#    SortPriority:    0
+#    CaseSensitive:   false
+#  - Regex:           '.*'
+#    Priority:        1
+#    SortPriority:    0
+#    CaseSensitive:   false
+#IncludeIsMainRegex: '(Test)?$'
+#IncludeIsMainSourceRegex: ''
+#PenaltyBreakAssignment: 2
+#PenaltyBreakBeforeFirstCallParameter: 19
+#PenaltyBreakComment: 300
+#PenaltyBreakFirstLessLess: 120
+#PenaltyBreakString: 1000
+#PenaltyBreakTemplateDeclaration: 10
+PenaltyExcessCharacter: 500
+#PenaltyIndentedWhitespace: 0
+#PPIndentWidth:   -1
+#SortIncludes:    CaseSensitive
+#SortUsingDeclarations: true
+
+# FIXME: sorting includes causes a lot of breakage due to cyclic inclusion problems
+SortIncludes: Never
+
+# NOTE: disabling this option breaks indentation of comments, see https://github.com/llvm/llvm-project/issues/53425
+ReflowComments:  true
+
+...
+# vim: ft=yaml
diff --git a/src/.clang-tidy b/src/.clang-tidy
new file mode 100644
index 0000000000000000000000000000000000000000..ba7983218be5f62fa2619121ae9bdec0e1be46dd
--- /dev/null
+++ b/src/.clang-tidy
@@ -0,0 +1,38 @@
+# Documentation: https://clang.llvm.org/extra/clang-tidy/
+---
+HeaderFilterRegex: '.*'
+AnalyzeTemporaryDtors: false
+FormatStyle:      file
+User:             user
+Checks:           'readability-*,
+                  -readability-else-after-return,
+                  -readability-named-parameter,
+                  modernize-*,
+                  -modernize-avoid-c-arrays,
+                  -modernize-use-trailing-return-type,
+                  -modernize-raw-string-literal,
+                  performance-*,
+                  mpi-*'
+WarningsAsErrors: 'performance-*,mpi-*'
+CheckOptions:
+  - key:             readability-braces-around-statements.ShortStatementLines
+    value:           99
+  - key:             readability-function-size.LineThreshold
+    value:           64
+  - key:             readability-function-size.ParameterThreshold
+    value:           15
+  - key:             readability-magic-numbers.IgnoreAllFloatingPointValues
+    value:           true
+  - key:             readability-magic-numbers.IgnorePowersOf2IntegerValues
+    value:           true
+
+  - key:             modernize-use-default-member-init.UseAssignment
+    value:           true
+  - key:             modernize-use-auto.MinTypeNameLength
+    value:           10
+
+  - key:             cppcoreguidelines-pro-type-member-init.UseAssignment
+    value:           true
+
+...
+# vim: ft=yaml
diff --git a/src/Benchmarks/BLAS/VectorOperations.h b/src/Benchmarks/BLAS/VectorOperations.h
index 43c3b9c8859f6be555255be78cd6f90ac7bce7a4..dfe8bd2668f44cbb4ecbb4b65b232edb9826fa93 100644
--- a/src/Benchmarks/BLAS/VectorOperations.h
+++ b/src/Benchmarks/BLAS/VectorOperations.h
@@ -22,7 +22,7 @@ struct VectorOperations< Devices::Host >
                           const Scalar1 alpha,
                           const Scalar2 thisMultiplicator = 1.0 )
    {
-      typedef typename Vector1::IndexType Index;
+      using Index = typename Vector1::IndexType;
 
       TNL_ASSERT_GT( x.getSize(), 0, "Vector size must be positive." );
       TNL_ASSERT_EQ( x.getSize(), y.getSize(), "The vector sizes must be the same." );
@@ -51,7 +51,7 @@ struct VectorOperations< Devices::Host >
                            const Scalar2 multiplicator2,
                            const Scalar3 thisMultiplicator = 1.0 )
    {
-      typedef typename Vector1::IndexType Index;
+      using Index = typename Vector1::IndexType;
 
       TNL_ASSERT_GT( v.getSize(), 0, "Vector size must be positive." );
       TNL_ASSERT_EQ( v.getSize(), v1.getSize(), "The vector sizes must be the same." );
diff --git a/src/Benchmarks/BLAS/array-operations.h b/src/Benchmarks/BLAS/array-operations.h
index 99b934c7b63f25aeade83d59edcb10b355ffd31b..a0c339722ad54b741e66b5e272c4c97c559f60cd 100644
--- a/src/Benchmarks/BLAS/array-operations.h
+++ b/src/Benchmarks/BLAS/array-operations.h
@@ -23,8 +23,10 @@ benchmarkArrayOperations( Benchmark<> & benchmark,
 
    double datasetSize = (double) size * sizeof( Real ) / oneGB;
 
-   HostArray hostArray, hostArray2;
-   CudaArray deviceArray, deviceArray2;
+   HostArray hostArray;
+   HostArray hostArray2;
+   CudaArray deviceArray;
+   CudaArray deviceArray2;
    hostArray.setSize( size );
    hostArray2.setSize( size );
 #ifdef HAVE_CUDA
diff --git a/src/Benchmarks/BLAS/gemv.h b/src/Benchmarks/BLAS/gemv.h
index e5fb88cbe4fa2fda77dd0f3a97d3bcd725e107f4..4080ef566c490f6c48d3fdd9cfb002f4215251fa 100644
--- a/src/Benchmarks/BLAS/gemv.h
+++ b/src/Benchmarks/BLAS/gemv.h
@@ -32,8 +32,11 @@ benchmarkGemv( Benchmark<> & benchmark, int rows, int columns )
    HostMatrix hostMatrix;
    RowMajorCudaMatrix rowMajorCudaMatrix;
    ColumnMajorCudaMatrix columnMajorCudaMatrix;
-   HostVector inHostVector, outHostVector;
-   CudaVector inCudaVector, outCudaVector1, outCudaVector2;
+   HostVector inHostVector;
+   HostVector outHostVector;
+   CudaVector inCudaVector;
+   CudaVector outCudaVector1;
+   CudaVector outCudaVector2;
 
    hostMatrix.setDimensions( rows, columns );
    inHostVector.setSize( columns );
diff --git a/src/Benchmarks/BLAS/triad.h b/src/Benchmarks/BLAS/triad.h
index f5fc2609cdeb53fbcb1f19cad85cddd90c791c50..4e0de12adfb9daca3c3ac86d1299a83d0b70c79f 100644
--- a/src/Benchmarks/BLAS/triad.h
+++ b/src/Benchmarks/BLAS/triad.h
@@ -32,8 +32,12 @@ benchmarkTriad( Benchmark<> & benchmark,
       using HostArray = Containers::Array< Real, Devices::Host, Index, HostAllocator >;
       using CudaArray = Containers::Array< Real, Devices::Cuda, Index, CudaAllocator >;
 
-      HostArray a_h, b_h, c_h;
-      CudaArray a_d, b_d, c_d;
+      HostArray a_h;
+      HostArray b_h;
+      HostArray c_h;
+      CudaArray a_d;
+      CudaArray b_d;
+      CudaArray c_d;
       a_h.setSize( size );
       b_h.setSize( size );
       c_h.setSize( size );
@@ -76,8 +80,12 @@ benchmarkTriad( Benchmark<> & benchmark,
       using HostArray = Containers::Array< Real, Devices::Host, Index, CudaHostAllocator >;
       using CudaArray = Containers::Array< Real, Devices::Cuda, Index, CudaAllocator >;
 
-      HostArray a_h, b_h, c_h;
-      CudaArray a_d, b_d, c_d;
+      HostArray a_h;
+      HostArray b_h;
+      HostArray c_h;
+      CudaArray a_d;
+      CudaArray b_d;
+      CudaArray c_d;
       a_h.setSize( size );
       b_h.setSize( size );
       c_h.setSize( size );
@@ -119,7 +127,9 @@ benchmarkTriad( Benchmark<> & benchmark,
    {
       using HostArray = Containers::Array< Real, Devices::Host, Index, CudaHostAllocator >;
 
-      HostArray a_h, b_h, c_h;
+      HostArray a_h;
+      HostArray b_h;
+      HostArray c_h;
       a_h.setSize( size );
       b_h.setSize( size );
       c_h.setSize( size );
@@ -150,7 +160,9 @@ benchmarkTriad( Benchmark<> & benchmark,
    {
       using Array = Containers::Array< Real, Devices::Host, Index, CudaManagedAllocator >;
 
-      Array a, b, c;
+      Array a;
+      Array b;
+      Array c;
       a.setSize( size );
       b.setSize( size );
       c.setSize( size );
diff --git a/src/Benchmarks/BLAS/vector-operations.h b/src/Benchmarks/BLAS/vector-operations.h
index d5c7f3726e997f49c1267195e990a98fb9653e0f..df242012f480142d7fc2ec6a9555e70105fe3d0e 100644
--- a/src/Benchmarks/BLAS/vector-operations.h
+++ b/src/Benchmarks/BLAS/vector-operations.h
@@ -2,7 +2,7 @@
 
 #pragma once
 
-#include <stdlib.h> // srand48
+#include <cstdlib>  // srand48
 #include <numeric>  // std::partial_sum
 
 #include <TNL/Benchmarks/Benchmarks.h>
@@ -39,8 +39,14 @@ benchmarkVectorOperations( Benchmark<> & benchmark,
 
    double datasetSize = (double) size * sizeof( Real ) / oneGB;
 
-   HostVector hostVector( size ), hostVector2( size ), hostVector3( size ), hostVector4( size );
-   CudaVector deviceVector, deviceVector2, deviceVector3, deviceVector4;
+   HostVector hostVector( size );
+   HostVector hostVector2( size );
+   HostVector hostVector3( size );
+   HostVector hostVector4( size );
+   CudaVector deviceVector;
+   CudaVector deviceVector2;
+   CudaVector deviceVector3;
+   CudaVector deviceVector4;
 #ifdef HAVE_CUDA
    deviceVector.setSize( size );
    deviceVector2.setSize( size );
@@ -48,12 +54,16 @@ benchmarkVectorOperations( Benchmark<> & benchmark,
    deviceVector4.setSize( size );
 #endif
 
-   HostView hostView( hostVector ), hostView2( hostVector2 ), hostView3( hostVector3 ), hostView4( hostVector4 );
+   HostView hostView( hostVector );
+   HostView hostView2( hostVector2 );
+   HostView hostView3( hostVector3 );
+   HostView hostView4( hostVector4 );
 #ifdef HAVE_CUDA
    CudaView deviceView( deviceVector ), deviceView2( deviceVector2 ), deviceView3( deviceVector3 ), deviceView4( deviceVector4 );
 #endif
 
-   Real resultHost, resultDevice;
+   Real resultHost;
+   Real resultDevice;
 
 #ifdef HAVE_CUDA
    cublasHandle_t cublasHandle;
diff --git a/src/Benchmarks/HeatEquation/BenchmarkLaplace.h b/src/Benchmarks/HeatEquation/BenchmarkLaplace.h
index 0c2fd92e309b53964a017b498dfd76ddf595e0bf..96a8d89d049bda6e3eb814ae4f50d9fe29ba66f1 100644
--- a/src/Benchmarks/HeatEquation/BenchmarkLaplace.h
+++ b/src/Benchmarks/HeatEquation/BenchmarkLaplace.h
@@ -25,12 +25,12 @@ class BenchmarkLaplace< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, In
                               Index >
 {
    public:
-      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
-      typedef typename MeshType::CoordinatesType CoordinatesType;
-      typedef Real RealType;
-      typedef Device DeviceType;
-      typedef Index IndexType;
-      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      using MeshType = Meshes::Grid< 1, MeshReal, Device, MeshIndex >;
+      using CoordinatesType = typename MeshType::CoordinatesType;
+      using RealType = Real;
+      using DeviceType = Device;
+      using IndexType = Index;
+      using MeshFunctionType = Functions::MeshFunction< MeshType >;
       enum { Dimension = MeshType::getMeshDimension() };
 
       template< typename MeshFunction, typename MeshEntity >
@@ -71,12 +71,12 @@ class BenchmarkLaplace< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real, Ind
                               Index >
 {
    public:
-      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
-      typedef typename MeshType::CoordinatesType CoordinatesType;
-      typedef Real RealType;
-      typedef Device DeviceType;
-      typedef Index IndexType;
-      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      using MeshType = Meshes::Grid< 2, MeshReal, Device, MeshIndex >;
+      using CoordinatesType = typename MeshType::CoordinatesType;
+      using RealType = Real;
+      using DeviceType = Device;
+      using IndexType = Index;
+      using MeshFunctionType = Functions::MeshFunction< MeshType >;
       enum { Dimension = MeshType::getMeshDimension() };
 
       template< typename MeshFunction, typename MeshEntity >
@@ -132,12 +132,12 @@ class BenchmarkLaplace< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, Ind
                               Index >
 {
    public:
-      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
-      typedef typename MeshType::CoordinatesType CoordinatesType;
-      typedef Real RealType;
-      typedef Device DeviceType;
-      typedef Index IndexType;
-      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+      using MeshType = Meshes::Grid< 3, MeshReal, Device, MeshIndex >;
+      using CoordinatesType = typename MeshType::CoordinatesType;
+      using RealType = Real;
+      using DeviceType = Device;
+      using IndexType = Index;
+      using MeshFunctionType = Functions::MeshFunction< MeshType >;
       enum { Dimension = MeshType::getMeshDimension() };
 
       template< typename MeshFunction, typename MeshEntity >
diff --git a/src/Benchmarks/HeatEquation/DirichletBoundaryConditions.h b/src/Benchmarks/HeatEquation/DirichletBoundaryConditions.h
index 393a571e76ed15b4b1cda56510a9fef64b16daf6..23001e928967a4b4e157584d58248ce10d63b545 100644
--- a/src/Benchmarks/HeatEquation/DirichletBoundaryConditions.h
+++ b/src/Benchmarks/HeatEquation/DirichletBoundaryConditions.h
@@ -21,16 +21,15 @@ class DirichletBoundaryConditions
                               Index >
 {
    public:
-
-      typedef Mesh MeshType;
-      typedef Function FunctionType;
-      typedef Real RealType;
-      typedef typename MeshType::DeviceType DeviceType;
-      typedef Index IndexType;
-      
-      typedef Pointers::SharedPointer<  Mesh > MeshPointer;
-      typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
-      typedef typename MeshType::PointType PointType;
+      using MeshType = Mesh;
+      using FunctionType = Function;
+      using RealType = Real;
+      using DeviceType = typename MeshType::DeviceType;
+      using IndexType = Index;
+
+      using MeshPointer = Pointers::SharedPointer< Mesh >;
+      using DofVectorType = Containers::Vector< RealType, DeviceType, IndexType >;
+      using PointType = typename MeshType::PointType;
 
       static constexpr int getMeshDimension() { return MeshType::getMeshDimension(); }
 
diff --git a/src/Benchmarks/HeatEquation/HeatEquationBenchmarkProblem.h b/src/Benchmarks/HeatEquation/HeatEquationBenchmarkProblem.h
index 6389161cc84dfc49494acfacece5b0f5abab9731..f4286f8b4fb43ccf681233f23f17400f8adcf97b 100644
--- a/src/Benchmarks/HeatEquation/HeatEquationBenchmarkProblem.h
+++ b/src/Benchmarks/HeatEquation/HeatEquationBenchmarkProblem.h
@@ -20,16 +20,15 @@ class HeatEquationBenchmarkProblem:
                       typename DifferentialOperator::IndexType >
 {
    public:
-
-      typedef typename DifferentialOperator::RealType RealType;
-      typedef typename Mesh::DeviceType DeviceType;
-      typedef typename DifferentialOperator::IndexType IndexType;
-      typedef Functions::MeshFunctionView< Mesh > MeshFunctionViewType;
-      typedef Pointers::SharedPointer< MeshFunctionViewType, DeviceType > MeshFunctionViewPointer;
-      typedef PDEProblem< Mesh, RealType, DeviceType, IndexType > BaseType;
-      typedef Pointers::SharedPointer< DifferentialOperator > DifferentialOperatorPointer;
-      typedef Pointers::SharedPointer< BoundaryCondition > BoundaryConditionPointer;
-      typedef Pointers::SharedPointer< RightHandSide, DeviceType > RightHandSidePointer;
+      using RealType = typename DifferentialOperator::RealType;
+      using DeviceType = typename Mesh::DeviceType;
+      using IndexType = typename DifferentialOperator::IndexType;
+      using MeshFunctionViewType = Functions::MeshFunctionView< Mesh >;
+      using MeshFunctionViewPointer = Pointers::SharedPointer< MeshFunctionViewType, DeviceType >;
+      using BaseType = PDEProblem< Mesh, RealType, DeviceType, IndexType >;
+      using DifferentialOperatorPointer = Pointers::SharedPointer< DifferentialOperator >;
+      using BoundaryConditionPointer = Pointers::SharedPointer< BoundaryCondition >;
+      using RightHandSidePointer = Pointers::SharedPointer< RightHandSide, DeviceType >;
 
       using typename BaseType::MeshType;
       using typename BaseType::MeshPointer;
diff --git a/src/Benchmarks/HeatEquation/HeatEquationBenchmarkProblem_impl.h b/src/Benchmarks/HeatEquation/HeatEquationBenchmarkProblem_impl.h
index 9283a8c026dac05e525fbd1bb9b0de617b0d70d1..4647fa28eb0f0638e0ef7b8a732e77d3e25c9ad5 100644
--- a/src/Benchmarks/HeatEquation/HeatEquationBenchmarkProblem_impl.h
+++ b/src/Benchmarks/HeatEquation/HeatEquationBenchmarkProblem_impl.h
@@ -144,7 +144,7 @@ HeatEquationBenchmarkProblem< Mesh, BoundaryCondition, RightHandSide, Differenti
 setupLinearSystem( Matrix& matrix )
 {
    const IndexType dofs = this->getDofs();
-   typedef typename Matrix::RowsCapacitiesType RowsCapacitiesTypeType;
+   using RowsCapacitiesTypeType = typename Matrix::RowsCapacitiesType;
    RowsCapacitiesTypeType rowLengths;
    if( ! rowLengths.setSize( dofs ) )
       return false;
diff --git a/src/Benchmarks/HeatEquation/HeatEquationBenchmarkRhs.h b/src/Benchmarks/HeatEquation/HeatEquationBenchmarkRhs.h
index b2fef66caada72c2c098a1c937635b0ccae1a108..ce12f61ce5232dee28519361529d481ee92a14ad 100644
--- a/src/Benchmarks/HeatEquation/HeatEquationBenchmarkRhs.h
+++ b/src/Benchmarks/HeatEquation/HeatEquationBenchmarkRhs.h
@@ -5,9 +5,8 @@ template< typename Mesh, typename Real >class HeatEquationBenchmarkRhs
   : public Functions::Domain< Mesh::getMeshDimension(), Functions::MeshDomain > 
  {
    public:
-
-      typedef Mesh MeshType;
-      typedef Real RealType;
+      using MeshType = Mesh;
+      using RealType = Real;
 
       bool setup( const Config::ParameterContainer& parameters,
                   const String& prefix = "" )
diff --git a/src/Benchmarks/HeatEquation/TestGridEntity.h b/src/Benchmarks/HeatEquation/TestGridEntity.h
index 747a0d2665d981a12ddb00ba0639360b0d552585..41acf11f4d1a8ce42cb0690b46fa0aa79a37a60b 100644
--- a/src/Benchmarks/HeatEquation/TestGridEntity.h
+++ b/src/Benchmarks/HeatEquation/TestGridEntity.h
@@ -41,13 +41,12 @@ template< int Dimension,
 class TestGridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension >
 {
    public:
-      
-      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::PointType PointType;
+      using GridType = Meshes::Grid< Dimension, Real, Device, Index >;
+      using MeshType = GridType;
+      using RealType = typename GridType::RealType;
+      using IndexType = typename GridType::IndexType;
+      using CoordinatesType = typename GridType::CoordinatesType;
+      using PointType = typename GridType::PointType;
       //typedef Config ConfigType;
       
       static const int meshDimension = GridType::meshDimension;
@@ -57,12 +56,11 @@ class TestGridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension
       constexpr static int getDimensions() { return entityDimension; };
       
       constexpr static int getDimension() { return meshDimension; };
-      
-      
-      typedef Containers::StaticVector< meshDimension, IndexType > EntityOrientationType;
-      typedef Containers::StaticVector< meshDimension, IndexType > EntityBasisType;
-      typedef TestNeighborGridEntitiesStorage< TestGridEntity > NeighborGridEntitiesStorageType;
-      
+
+      using EntityOrientationType = Containers::StaticVector< meshDimension, IndexType >;
+      using EntityBasisType = Containers::StaticVector< meshDimension, IndexType >;
+      using NeighborGridEntitiesStorageType = TestNeighborGridEntitiesStorage< TestGridEntity >;
+
       __cuda_callable__ inline
       TestGridEntity( const GridType& grid )
       : grid( grid ),
diff --git a/src/Benchmarks/HeatEquation/Tuning/ExplicitUpdater.h b/src/Benchmarks/HeatEquation/Tuning/ExplicitUpdater.h
index b21ba7a494761cac617bf951904a60fb79908173..c9e04890dc8af2e66b9044474a4d4419e116e693 100644
--- a/src/Benchmarks/HeatEquation/Tuning/ExplicitUpdater.h
+++ b/src/Benchmarks/HeatEquation/Tuning/ExplicitUpdater.h
@@ -54,22 +54,19 @@ template< typename Mesh,
 class ExplicitUpdater
 {
    public:
-      typedef Mesh MeshType;
-      typedef Pointers::SharedPointer<  MeshType > MeshPointer;
-      typedef typename MeshFunction::RealType RealType;
-      typedef typename MeshFunction::DeviceType DeviceType;
-      typedef typename MeshFunction::IndexType IndexType;
-      typedef ExplicitUpdaterTraverserUserData< RealType,
-                                                MeshFunction,
-                                                DifferentialOperator,
-                                                BoundaryConditions,
-                                                RightHandSide > TraverserUserData;
-      typedef Pointers::SharedPointer<  DifferentialOperator, DeviceType > DifferentialOperatorPointer;
-      typedef Pointers::SharedPointer<  BoundaryConditions, DeviceType > BoundaryConditionsPointer;
-      typedef Pointers::SharedPointer<  RightHandSide, DeviceType > RightHandSidePointer;
-      typedef Pointers::SharedPointer<  MeshFunction, DeviceType > MeshFunctionPointer;
-      typedef Pointers::SharedPointer<  TraverserUserData, DeviceType > TraverserUserDataPointer;
-      
+      using MeshType = Mesh;
+      using MeshPointer = Pointers::SharedPointer< MeshType >;
+      using RealType = typename MeshFunction::RealType;
+      using DeviceType = typename MeshFunction::DeviceType;
+      using IndexType = typename MeshFunction::IndexType;
+      using TraverserUserData =
+         ExplicitUpdaterTraverserUserData< RealType, MeshFunction, DifferentialOperator, BoundaryConditions, RightHandSide >;
+      using DifferentialOperatorPointer = Pointers::SharedPointer< DifferentialOperator, DeviceType >;
+      using BoundaryConditionsPointer = Pointers::SharedPointer< BoundaryConditions, DeviceType >;
+      using RightHandSidePointer = Pointers::SharedPointer< RightHandSide, DeviceType >;
+      using MeshFunctionPointer = Pointers::SharedPointer< MeshFunction, DeviceType >;
+      using TraverserUserDataPointer = Pointers::SharedPointer< TraverserUserData, DeviceType >;
+
       void setDifferentialOperator( const DifferentialOperatorPointer& differentialOperatorPointer )
       {
          this->userDataPointer->differentialOperator = &differentialOperatorPointer.template getData< DeviceType >();
@@ -165,8 +162,7 @@ class ExplicitUpdater
       class TraverserInteriorEntitiesProcessor
       {
          public:
-
-            typedef typename MeshType::PointType PointType;
+            using PointType = typename MeshType::PointType;
 
             template< typename EntityType >
             __cuda_callable__
@@ -174,7 +170,7 @@ class ExplicitUpdater
                                               TraverserUserData& userData,
                                               const EntityType& entity )
             {
-               typedef Functions::FunctionAdapter< MeshType, RightHandSide > FunctionAdapter;
+               using FunctionAdapter = Functions::FunctionAdapter< MeshType, RightHandSide >;
                ( *userData.fu )( entity )  = 
                   ( *userData.differentialOperator )( *userData.u, entity, userData.time );
                // TODO: fix the right hand side here !!!
@@ -188,7 +184,7 @@ class ExplicitUpdater
                                               const IndexType& entityIndex,
                                               const typename MeshType::CoordinatesType& coordinates )
             {
-               typedef Functions::FunctionAdapter< MeshType, RightHandSide > FunctionAdapter;
+               using FunctionAdapter = Functions::FunctionAdapter< MeshType, RightHandSide >;
                userData.real_fu[ entityIndex ] = 
                        ( *userData.differentialOperator )( mesh, userData.real_u, entityIndex, coordinates, userData.time );
                // TODO: fix the right hand side here !!!
diff --git a/src/Benchmarks/HeatEquation/Tuning/GridTraverser.h b/src/Benchmarks/HeatEquation/Tuning/GridTraverser.h
index b127a953da78f669de4f0549232d0bca33140b4a..75afe5e8c0dac0cd448cc44327d18360faf489b0 100644
--- a/src/Benchmarks/HeatEquation/Tuning/GridTraverser.h
+++ b/src/Benchmarks/HeatEquation/Tuning/GridTraverser.h
@@ -23,14 +23,13 @@ template< typename Real,
 class GridTraverser< Meshes::Grid< 2, Real, Devices::Host, Index >, Cell >
 {
    public:
-      
-      typedef Meshes::Grid< 2, Real, Devices::Host, Index > GridType;
-      typedef Pointers::SharedPointer<  GridType > GridPointer;
-      typedef Real RealType;
-      typedef Devices::Host DeviceType;
-      typedef Index IndexType;
-      typedef typename GridType::CoordinatesType CoordinatesType;
- 
+      using GridType = Meshes::Grid< 2, Real, Devices::Host, Index >;
+      using GridPointer = Pointers::SharedPointer< GridType >;
+      using RealType = Real;
+      using DeviceType = Devices::Host;
+      using IndexType = Index;
+      using CoordinatesType = typename GridType::CoordinatesType;
+
       template<
          typename GridEntity,
          typename EntitiesProcessor,
@@ -62,14 +61,13 @@ template< typename Real,
 class GridTraverser< Meshes::Grid< 2, Real, Devices::Cuda, Index >, Cell >
 {
    public:
-      
-      typedef Meshes::Grid< 2, Real, Devices::Cuda, Index > GridType;
-      typedef Pointers::SharedPointer<  GridType > GridPointer;
-      typedef Real RealType;
-      typedef Devices::Cuda DeviceType;
-      typedef Index IndexType;
-      typedef typename GridType::CoordinatesType CoordinatesType;
- 
+      using GridType = Meshes::Grid< 2, Real, Devices::Cuda, Index >;
+      using GridPointer = Pointers::SharedPointer< GridType >;
+      using RealType = Real;
+      using DeviceType = Devices::Cuda;
+      using IndexType = Index;
+      using CoordinatesType = typename GridType::CoordinatesType;
+
       template<
          typename GridEntity,
          typename EntitiesProcessor,
diff --git a/src/Benchmarks/HeatEquation/Tuning/SimpleCell.h b/src/Benchmarks/HeatEquation/Tuning/SimpleCell.h
index 4406a8542a0ab39d69e1fadbfd4d65047e7d496b..87cfbfabbb36bd12221fca4352c5add375d74a4e 100644
--- a/src/Benchmarks/HeatEquation/Tuning/SimpleCell.h
+++ b/src/Benchmarks/HeatEquation/Tuning/SimpleCell.h
@@ -9,17 +9,15 @@ template< typename Grid, typename Config = Meshes::GridEntityNoStencilStorage >
 class SimpleCell
 {
    public:
- 
-      typedef Grid GridType;
-      typedef GridType MeshType;
-      typedef typename GridType::RealType RealType;
-      typedef typename GridType::IndexType IndexType;
-      typedef typename GridType::CoordinatesType CoordinatesType;
-      typedef typename GridType::PointType PointType;
-      typedef Meshes::NeighborGridEntitiesStorage< SimpleCell, Config >
-         NeighborGridEntitiesStorageType;
-      typedef Config ConfigType;
-      
+      using GridType = Grid;
+      using MeshType = GridType;
+      using RealType = typename GridType::RealType;
+      using IndexType = typename GridType::IndexType;
+      using CoordinatesType = typename GridType::CoordinatesType;
+      using PointType = typename GridType::PointType;
+      using NeighborGridEntitiesStorageType = Meshes::NeighborGridEntitiesStorage< SimpleCell, Config >;
+      using ConfigType = Config;
+
       constexpr static int getMeshDimension() { return GridType::getMeshDimension(); };
  
       constexpr static int getEntityDimension() { return getMeshDimension(); };
diff --git a/src/Benchmarks/HeatEquation/Tuning/Traverser_Grid2D.h b/src/Benchmarks/HeatEquation/Tuning/Traverser_Grid2D.h
index 538940297d3cb66ff6db24d55db228d8719d7ba3..87ea028fc763827bfbea837a3737066ef8d273b7 100644
--- a/src/Benchmarks/HeatEquation/Tuning/Traverser_Grid2D.h
+++ b/src/Benchmarks/HeatEquation/Tuning/Traverser_Grid2D.h
@@ -38,9 +38,9 @@ template< typename Real,
 class Traverser< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 2 >
 {
    public:
-      typedef Meshes::Grid< 2, Real, Device, Index > GridType;
-      typedef Pointers::SharedPointer<  GridType > GridPointer;
-      typedef typename GridType::CoordinatesType CoordinatesType;
+      using GridType = Meshes::Grid< 2, Real, Device, Index >;
+      using GridPointer = Pointers::SharedPointer< GridType >;
+      using CoordinatesType = typename GridType::CoordinatesType;
 
       template< typename UserData,
                 typename EntitiesProcessor >
diff --git a/src/Benchmarks/HeatEquation/tnl-benchmark-heat-equation.h b/src/Benchmarks/HeatEquation/tnl-benchmark-heat-equation.h
index 8ed3472e5fabd276371ed5984f8b29d8f6dfbf95..532bfa4a10e10a4513ff574bbb34f8662b05416f 100644
--- a/src/Benchmarks/HeatEquation/tnl-benchmark-heat-equation.h
+++ b/src/Benchmarks/HeatEquation/tnl-benchmark-heat-equation.h
@@ -9,7 +9,7 @@
 #include "HeatEquationBenchmarkRhs.h"
 #include "HeatEquationBenchmarkBuildConfigTag.h"
 
-typedef HeatEquationBenchmarkBuildConfigTag BuildConfig;
+using BuildConfig = HeatEquationBenchmarkBuildConfigTag;
 
 /****
  * Uncoment the following (and comment the previous line) for the complete build.
@@ -53,31 +53,32 @@ template< typename Real,
 class HeatEquationBenchmarkSetter
 {
    public:
-
-      typedef Real RealType;
-      typedef Device DeviceType;
-      typedef Index IndexType;
+      using RealType = Real;
+      using DeviceType = Device;
+      using IndexType = Index;
 
       static bool run( const Config::ParameterContainer & parameters )
       {
           enum { Dimension = MeshType::getMeshDimension() };
-          typedef BenchmarkLaplace< MeshType, Real, Index > ApproximateOperator;
-          typedef HeatEquationBenchmarkRhs< MeshType, Real > RightHandSide;
-          typedef Containers::StaticVector < MeshType::getMeshDimension(), Real > Point;
+          using ApproximateOperator = BenchmarkLaplace< MeshType, Real, Index >;
+          using RightHandSide = HeatEquationBenchmarkRhs< MeshType, Real >;
+          using Point = Containers::StaticVector< MeshType::getMeshDimension(), Real >;
 
-         /****
-          * Resolve the template arguments of your solver here.
-          * The following code is for the Dirichlet and the Neumann boundary conditions.
-          * Both can be constant or defined as descrete values of Vector.
-          */
+          /****
+           * Resolve the template arguments of your solver here.
+           * The following code is for the Dirichlet and the Neumann boundary conditions.
+           * Both can be constant or defined as descrete values of Vector.
+           */
           String boundaryConditionsType = parameters.getParameter< String >( "boundary-conditions-type" );
           if( parameters.checkParameter( "boundary-conditions-constant" ) )
           {
-             typedef Functions::Analytic::Constant< Dimension, Real > Constant;
+             using Constant = Functions::Analytic::Constant< Dimension, Real >;
              if( boundaryConditionsType == "dirichlet" )
              {
-                typedef Operators::DirichletBoundaryConditions< MeshType, Constant, MeshType::getMeshDimension(), Real, Index > BoundaryConditions;
-                typedef HeatEquationBenchmarkProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
+                using BoundaryConditions =
+                   Operators::DirichletBoundaryConditions< MeshType, Constant, MeshType::getMeshDimension(), Real, Index >;
+                using Problem =
+                   HeatEquationBenchmarkProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator >;
                 SolverStarter solverStarter;
                 return solverStarter.template run< Problem >( parameters );
              }
diff --git a/src/Benchmarks/HeatEquation/tnl-benchmark-simple-heat-equation.h b/src/Benchmarks/HeatEquation/tnl-benchmark-simple-heat-equation.h
index 6bfce808e9515f432d1f2f00d909d0f2f6a50d14..cf83a45ca10a418c6f1882ab620c1dca6e1361f1 100644
--- a/src/Benchmarks/HeatEquation/tnl-benchmark-simple-heat-equation.h
+++ b/src/Benchmarks/HeatEquation/tnl-benchmark-simple-heat-equation.h
@@ -2,7 +2,7 @@
 #define	TNL_BENCHMARK_SIMPLE_HEAT_EQUATION_H
 
 #include <iostream>
-#include <stdio.h>
+#include <cstdio>
 #include <TNL/Config/parseCommandLine.h>
 #include <TNL/Timer.h>
 #include <TNL/Devices/Cuda.h>
@@ -537,8 +537,8 @@ bool solveHeatEquationHost( const Config::ParameterContainer& parameters,
    /****
     * Saving the result
     */
-   typedef Meshes::Grid< 2, Real, Devices::Host, Index > GridType;
-   typedef typename GridType::PointType PointType;
+   using GridType = Meshes::Grid< 2, Real, Devices::Host, Index >;
+   using PointType = typename GridType::PointType;
    Pointers::SharedPointer<  GridType > gridPointer;
    gridPointer->setDimensions( gridXSize, gridYSize );
    gridPointer->setDomain( PointType( 0.0, 0.0 ), PointType( domainXSize, domainYSize ) );
@@ -579,7 +579,9 @@ int main( int argc, char* argv[] )
    if( ! parseCommandLine( argc, argv, config, parameters ) )
       return EXIT_FAILURE;
 
-   Timer timer, computationTimer, updateTimer;
+   Timer timer;
+   Timer computationTimer;
+   Timer updateTimer;
 
    String device = parameters.getParameter< String >( "device" );
    if( device == "host" &&
diff --git a/src/Benchmarks/LinearSolvers/tnl-benchmark-linear-solvers.h b/src/Benchmarks/LinearSolvers/tnl-benchmark-linear-solvers.h
index 600f8686fd9a40e072221001dd86ac057a32085c..4a9744c793aac632c2c694978216b3f8394f1f40 100644
--- a/src/Benchmarks/LinearSolvers/tnl-benchmark-linear-solvers.h
+++ b/src/Benchmarks/LinearSolvers/tnl-benchmark-linear-solvers.h
@@ -173,7 +173,7 @@ benchmarkIterativeSolvers( Benchmark<>& benchmark,
       if( solvers.count( "gmres" ) ) {
          for( auto variant : gmresVariants ) {
             benchmark.setOperation(variant + "-GMRES (Jacobi)");
-            parameters.template setParameter< String >( "gmres-variant", variant.c_str() );
+            parameters.template setParameter< String >( "gmres-variant", variant );
             benchmarkSolver< GMRES, Diagonal >( benchmark, parameters, matrixPointer, x0, b );
             #ifdef HAVE_CUDA
             benchmarkSolver< GMRES, Diagonal >( benchmark, parameters, cudaMatrixPointer, cuda_x0, cuda_b );
@@ -223,7 +223,7 @@ benchmarkIterativeSolvers( Benchmark<>& benchmark,
       if( solvers.count( "gmres" ) ) {
          for( auto variant : gmresVariants ) {
             benchmark.setOperation(variant + "-GMRES (ILU0)");
-            parameters.template setParameter< String >( "gmres-variant", variant.c_str() );
+            parameters.template setParameter< String >( "gmres-variant", variant );
             benchmarkSolver< GMRES, ILU0 >( benchmark, parameters, matrixPointer, x0, b );
             #ifdef HAVE_CUDA
             benchmarkSolver< GMRES, ILU0 >( benchmark, parameters, cudaMatrixPointer, cuda_x0, cuda_b );
@@ -272,7 +272,7 @@ benchmarkIterativeSolvers( Benchmark<>& benchmark,
       if( solvers.count( "gmres" ) ) {
          for( auto variant : gmresVariants ) {
             benchmark.setOperation(variant + "-GMRES (ILUT)");
-            parameters.template setParameter< String >( "gmres-variant", variant.c_str() );
+            parameters.template setParameter< String >( "gmres-variant", variant );
             benchmarkSolver< GMRES, ILUT >( benchmark, parameters, matrixPointer, x0, b );
             #ifdef HAVE_CUDA
             benchmarkSolver< GMRES, ILUT >( benchmark, parameters, cudaMatrixPointer, cuda_x0, cuda_b );
diff --git a/src/Benchmarks/ODESolvers/Euler.h b/src/Benchmarks/ODESolvers/Euler.h
index c5b12187e933d689c4fb47c782a8749e2baeb1cc..48b55d4b7fd374d3786a88a0adcd219382a9ec82 100644
--- a/src/Benchmarks/ODESolvers/Euler.h
+++ b/src/Benchmarks/ODESolvers/Euler.h
@@ -16,13 +16,12 @@ template< typename Problem,
 class Euler : public Solvers::ODE::ExplicitSolver< Problem, SolverMonitor >
 {
    public:
-
-   typedef Problem  ProblemType;
-   typedef typename Problem::DofVectorType DofVectorType;
-   typedef typename Problem::RealType RealType;
-   typedef typename Problem::DeviceType DeviceType;
-   typedef typename Problem::IndexType IndexType;
-   typedef Pointers::SharedPointer<  DofVectorType, DeviceType > DofVectorPointer;
+   using ProblemType = Problem;
+   using DofVectorType = typename Problem::DofVectorType;
+   using RealType = typename Problem::RealType;
+   using DeviceType = typename Problem::DeviceType;
+   using IndexType = typename Problem::IndexType;
+   using DofVectorPointer = Pointers::SharedPointer< DofVectorType, DeviceType >;
    using VectorOperations = CommonVectorOperations< DeviceType >;
 
 
diff --git a/src/Benchmarks/ODESolvers/Merson.h b/src/Benchmarks/ODESolvers/Merson.h
index cf86a241ddcbc667afbe05d013a72a3fd9580217..6bcdf64fa36aa974a1e788e68f2ca7c59f9dfcd3 100644
--- a/src/Benchmarks/ODESolvers/Merson.h
+++ b/src/Benchmarks/ODESolvers/Merson.h
@@ -14,13 +14,12 @@ template< class Problem,
 class Merson : public Solvers::ODE::ExplicitSolver< Problem, SolverMonitor >
 {
    public:
-
-   typedef Problem ProblemType;
-   typedef typename Problem :: DofVectorType DofVectorType;
-   typedef typename Problem :: RealType RealType;
-   typedef typename Problem :: DeviceType DeviceType;
-   typedef typename Problem :: IndexType IndexType;
-   typedef Pointers::SharedPointer<  DofVectorType, DeviceType > DofVectorPointer;
+   using ProblemType = Problem;
+   using DofVectorType = typename Problem::DofVectorType;
+   using RealType = typename Problem::RealType;
+   using DeviceType = typename Problem::DeviceType;
+   using IndexType = typename Problem::IndexType;
+   using DofVectorPointer = Pointers::SharedPointer< DofVectorType, DeviceType >;
    using VectorOperations = CommonVectorOperations< DeviceType >;
    
    Merson();
diff --git a/src/Benchmarks/Sorting/timer.h b/src/Benchmarks/Sorting/timer.h
index 880eb03e79d82a50acd4148028e5498b09272ed8..10017e264e2a8c6538b7c27332549f29e75bdc5e 100644
--- a/src/Benchmarks/Sorting/timer.h
+++ b/src/Benchmarks/Sorting/timer.h
@@ -4,14 +4,20 @@
 #include <chrono>
 #include <functional>
 #include <iostream>
+#include <utility>
 
 struct TIMER
 {
     std::function<void(double)> f;
     std::chrono::high_resolution_clock::time_point begin;
 
-    TIMER(std::function<void(double)> func = [](double res){std::cout << res << std::endl;})
-        : f(func), begin(std::chrono::high_resolution_clock::now()) {}
+    TIMER( std::function< void( double ) > func =
+              []( double res )
+           {
+              std::cout << res << std::endl;
+           } )
+    : f( std::move( func ) ), begin( std::chrono::high_resolution_clock::now() )
+    {}
 
     ~TIMER()
     {
diff --git a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/AdEllpack.h b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/AdEllpack.h
index 8c4535fed0cfa0fb879022710e10236c9a08932d..c2cafdde7b1a502cba7f0ca20582f167b8213e69 100644
--- a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/AdEllpack.h
+++ b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/AdEllpack.h
@@ -195,15 +195,15 @@ public:
              typename = typename Enabler< Device2 >::type >
     AdEllpack& operator=( const AdEllpack< Real2, Device2, Index2 >& matrix );
 
-    void save( File& file ) const;
+    void save( File& file ) const override;
 
-    void load( File& file );
+    void load( File& file ) override;
 
     void save( const String& fileName ) const;
 
     void load( const String& fileName );
 
-    void print( std::ostream& str ) const;
+    void print( std::ostream& str ) const override;
 
     bool balanceLoad( const RealType average,
                       ConstRowsCapacitiesTypeView rowLengths,
diff --git a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/BiEllpack.h b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/BiEllpack.h
index 6dc53a566b31def8915a729602508ac5376cb72e..3ac5a58ccd571298e8daefe2d9b975a0820c8465 100644
--- a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/BiEllpack.h
+++ b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/BiEllpack.h
@@ -54,7 +54,7 @@ public:
 	BiEllpack();
 
 	void setDimensions( const IndexType rows,
-	                    const IndexType columns );
+	                    const IndexType columns ) override;
 
    void setCompressedRowLengths( ConstRowsCapacitiesTypeView rowLengths );
 
@@ -151,17 +151,17 @@ public:
                  typename = typename Enabler< Device2 >::type >
         BiEllpack& operator=( const BiEllpack< Real2, Device2, Index2 >& matrix );
 
-	void save( File& file ) const;
+	void save( File& file ) const override;
 
-	void load( File& file );
+	void load( File& file ) override;
 
 	void save( const String& fileName ) const;
 
 	void load( const String& fileName );
 
-	void print( std::ostream& str ) const;
+	void print( std::ostream& str ) const override;
 
-        void printValues() const;
+   void printValues() const;
 
 	void performRowBubbleSort( Containers::Vector< Index, Device, Index >& tempRowLengths );
 	void computeColumnSizes( Containers::Vector< Index, Device, Index >& tempRowLengths );
diff --git a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/CSR.h b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/CSR.h
index 43a392412380037c7434dbd4b78ebf41c948c661..597199c144c9d36f4b3ec376578136b2306f4024 100644
--- a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/CSR.h
+++ b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/CSR.h
@@ -142,12 +142,12 @@ public:
 
    CSR();
 
-   static String getSerializationType();
+   static std::string getSerializationType();
 
-   virtual String getSerializationTypeVirtual() const;
+   std::string getSerializationTypeVirtual() const override;
 
    void setDimensions( const IndexType rows,
-                       const IndexType columns );
+                       const IndexType columns ) override;
 
    void setCompressedRowLengths( ConstRowsCapacitiesTypeView rowLengths );
 
@@ -271,15 +271,15 @@ public:
              typename = typename Enabler< Device2 >::type >
    CSR& operator=( const CSR< Real2, Device2, Index2, KernelType2 >& matrix );
 
-   void save( File& file ) const;
+   void save( File& file ) const override;
 
-   void load( File& file );
+   void load( File& file ) override;
 
    void save( const String& fileName ) const;
 
    void load( const String& fileName );
 
-   void print( std::ostream& str ) const;
+   void print( std::ostream& str ) const override;
 
    //void setCudaKernelType( const SPMVCudaKernel kernel );
 
diff --git a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/CSR_impl.h b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/CSR_impl.h
index 4d2e5abfe21fa2a0dc88d5ca9f15b6462e84eea3..cb9e73ba14eb46a5975fda4f77afa23a5361dea4 100644
--- a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/CSR_impl.h
+++ b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/CSR_impl.h
@@ -43,20 +43,20 @@ template< typename Real,
           typename Device,
           typename Index,
           CSRKernel KernelType >
-String CSR< Real, Device, Index, KernelType >::getSerializationType()
+std::string CSR< Real, Device, Index, KernelType >::getSerializationType()
 {
-   return String( "Matrices::CSR< ") +
+   return "Matrices::CSR< "+
           TNL::getType< Real>() +
           ", [any_device], " +
-          String( TNL::getType< Index >() ) +
-          String( " >" );
+          TNL::getType< Index >() +
+          " >";
 }
 
 template< typename Real,
           typename Device,
           typename Index,
           CSRKernel KernelType >
-String CSR< Real, Device, Index, KernelType >::getSerializationTypeVirtual() const
+std::string CSR< Real, Device, Index, KernelType >::getSerializationTypeVirtual() const
 {
    return this->getSerializationType();
 }
diff --git a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/ChunkedEllpack.h b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/ChunkedEllpack.h
index 0689d9ba9b76dc95333a111c9c09d9f0dec14d45..0f6e7d323d5d0e079c19dc233ef55dc7f6abf84a 100644
--- a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/ChunkedEllpack.h
+++ b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/ChunkedEllpack.h
@@ -87,12 +87,12 @@ public:
 
    ChunkedEllpack();
 
-   static String getSerializationType();
+   static std::string getSerializationType();
 
-   virtual String getSerializationTypeVirtual() const;
+   std::string getSerializationTypeVirtual() const override;
 
    void setDimensions( const IndexType rows,
-                       const IndexType columns );
+                       const IndexType columns ) override;
 
    void setCompressedRowLengths( ConstRowsCapacitiesTypeView rowLengths );
 
@@ -239,15 +239,15 @@ public:
              typename = typename Enabler< Device2 >::type >
    ChunkedEllpack& operator=( const ChunkedEllpack< Real2, Device2, Index2 >& matrix );
 
-   void save( File& file ) const;
+   void save( File& file ) const override;
 
-   void load( File& file );
+   void load( File& file ) override;
 
    void save( const String& fileName ) const;
 
    void load( const String& fileName );
 
-   void print( std::ostream& str ) const;
+   void print( std::ostream& str ) const override;
 
    void printStructure( std::ostream& str,
                         const String& = "" ) const;
diff --git a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/ChunkedEllpack_impl.h b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/ChunkedEllpack_impl.h
index bd427769bbc099f67f84b9f8671f5c7e733bbbba..7b5b932ee262e75ee57e347fd8d6002699f6189f 100644
--- a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/ChunkedEllpack_impl.h
+++ b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/ChunkedEllpack_impl.h
@@ -33,19 +33,19 @@ ChunkedEllpack< Real, Device, Index >::ChunkedEllpack()
 template< typename Real,
           typename Device,
           typename Index >
-String ChunkedEllpack< Real, Device, Index >::getSerializationType()
+std::string ChunkedEllpack< Real, Device, Index >::getSerializationType()
 {
-   return String( "Matrices::ChunkedEllpack< ") +
+   return "Matrices::ChunkedEllpack< " +
           getType< Real >() +
-          String( ", [any device], " ) +
-          String( TNL::getType< Index >() ) +
-          String( " >" );
+          ", [any device], " +
+          TNL::getType< Index >() +
+          " >";
 }
 
 template< typename Real,
           typename Device,
           typename Index >
-String ChunkedEllpack< Real, Device, Index >::getSerializationTypeVirtual() const
+std::string ChunkedEllpack< Real, Device, Index >::getSerializationTypeVirtual() const
 {
    return this->getSerializationType();
 }
diff --git a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/Ellpack.h b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/Ellpack.h
index 19ace6d47d0a7a3ec534ded72a229a38499c36aa..24eb6743d88275b97bab77091b30915a2392c156 100644
--- a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/Ellpack.h
+++ b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/Ellpack.h
@@ -46,12 +46,12 @@ public:
 
    Ellpack();
 
-   static String getSerializationType();
+   static std::string getSerializationType();
 
-   virtual String getSerializationTypeVirtual() const;
+   std::string getSerializationTypeVirtual() const override;
 
    void setDimensions( const IndexType rows,
-                       const IndexType columns );
+                       const IndexType columns ) override;
 
    void setCompressedRowLengths( ConstRowsCapacitiesTypeView rowLengths );
 
@@ -184,15 +184,15 @@ public:
              typename = typename Enabler< Device2 >::type >
    Ellpack& operator=( const Ellpack< Real2, Device2, Index2 >& matrix );
 
-   void save( File& file ) const;
+   void save( File& file ) const override;
 
-   void load( File& file );
+   void load( File& file ) override;
 
    void save( const String& fileName ) const;
 
    void load( const String& fileName );
 
-   void print( std::ostream& str ) const;
+   void print( std::ostream& str ) const override;
 
 protected:
 
diff --git a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/Ellpack_impl.h b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/Ellpack_impl.h
index 5d020d07917d6d42d010859ab190c2aa7d063f73..2868ae757c55854cd0cfdc049f68eb03af469112 100644
--- a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/Ellpack_impl.h
+++ b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/Ellpack_impl.h
@@ -22,19 +22,19 @@ Ellpack< Real, Device, Index > :: Ellpack()
 template< typename Real,
           typename Device,
           typename Index >
-String Ellpack< Real, Device, Index >::getSerializationType()
+std::string Ellpack< Real, Device, Index >::getSerializationType()
 {
-   return String( "Matrices::Ellpack< " ) +
-          String( TNL::getType< Real >() ) +
+   return "Matrices::Ellpack< " +
+          TNL::getType< Real >() +
           ", [any device], " +
           getType< Index >() +
-          String( " >" );
+          " >";
 }
 
 template< typename Real,
           typename Device,
           typename Index >
-String Ellpack< Real, Device, Index >::getSerializationTypeVirtual() const
+std::string Ellpack< Real, Device, Index >::getSerializationTypeVirtual() const
 {
    return this->getSerializationType();
 }
diff --git a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/Multidiagonal.h b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/Multidiagonal.h
index 201bf7d5220af962b5dfe613d27b4caa51b65f7f..7e9667b2b91c29e9500b07092ec7bfd199175f92 100644
--- a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/Multidiagonal.h
+++ b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/Multidiagonal.h
@@ -44,12 +44,12 @@ public:
 
    Multidiagonal();
 
-   static String getSerializationType();
+   static std::string getSerializationType();
 
-   virtual String getSerializationTypeVirtual() const;
+   std::string getSerializationTypeVirtual() const override;
 
    void setDimensions( const IndexType rows,
-                       const IndexType columns );
+                       const IndexType columns ) override;
 
    void setCompressedRowLengths( ConstRowsCapacitiesTypeView rowLengths );
 
@@ -187,15 +187,15 @@ public:
              typename = typename Enabler< Device2 >::type >
    Multidiagonal& operator=( const Multidiagonal< Real2, Device2, Index2 >& matrix );
 
-   void save( File& file ) const;
+   void save( File& file ) const override;
 
-   void load( File& file );
+   void load( File& file ) override;
 
    void save( const String& fileName ) const;
 
    void load( const String& fileName );
 
-   void print( std::ostream& str ) const;
+   void print( std::ostream& str ) const override;
 
 protected:
 
diff --git a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/Multidiagonal_impl.h b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/Multidiagonal_impl.h
index f67e52a1c540c9adec8348390296d1299e555fad..274de5223c268032410029da3ee89d586872b2e9 100644
--- a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/Multidiagonal_impl.h
+++ b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/Multidiagonal_impl.h
@@ -24,21 +24,21 @@ Multidiagonal< Real, Device, Index > :: Multidiagonal()
 template< typename Real,
           typename Device,
           typename Index >
-String Multidiagonal< Real, Device, Index >::getSerializationType()
+std::string Multidiagonal< Real, Device, Index >::getSerializationType()
 {
-   return String( "Matrices::Multidiagonal< ") +
+   return "Matrices::Multidiagonal< " +
           getType< Real >() +
-          String( ", " ) +
-          String( Device :: getDeviceType() ) +
-          String( ", " ) +
-          String( TNL::getType< Index >() ) +
-          String( " >" );
+          ", " +
+          Device :: getDeviceType() +
+          ", " +
+          TNL::getType< Index >() +
+          " >";
 }
 
 template< typename Real,
           typename Device,
           typename Index >
-String Multidiagonal< Real, Device, Index >::getSerializationTypeVirtual() const
+std::string Multidiagonal< Real, Device, Index >::getSerializationTypeVirtual() const
 {
    return this->getSerializationType();
 }
diff --git a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/SlicedEllpack.h b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/SlicedEllpack.h
index 3d4742a7682b71390a0917223752943ba2b34a1f..a5c89b7e6a87ebdfaf66565e14cd8737d35aa77f 100644
--- a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/SlicedEllpack.h
+++ b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/SlicedEllpack.h
@@ -76,12 +76,12 @@ public:
 
    SlicedEllpack();
 
-   static String getSerializationType();
+   static std::string getSerializationType();
 
-   virtual String getSerializationTypeVirtual() const;
+   std::string getSerializationTypeVirtual() const override;
 
    void setDimensions( const IndexType rows,
-                       const IndexType columns );
+                       const IndexType columns ) override;
 
    void setCompressedRowLengths( ConstRowsCapacitiesTypeView rowLengths );
 
@@ -203,15 +203,15 @@ public:
              typename = typename Enabler< Device2 >::type >
    SlicedEllpack& operator=( const SlicedEllpack< Real2, Device2, Index2, SliceSize >& matrix );
 
-   void save( File& file ) const;
+   void save( File& file ) const override;
 
-   void load( File& file );
+   void load( File& file ) override;
 
    void save( const String& fileName ) const;
 
    void load( const String& fileName );
 
-   void print( std::ostream& str ) const;
+   void print( std::ostream& str ) const override;
 
 protected:
 
diff --git a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/SlicedEllpack_impl.h b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/SlicedEllpack_impl.h
index e1f913ab7014d47c4a8ae4790ac0cf45deeccb25..708549c6e7df40c927df52d29de53d0912e12368 100644
--- a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/SlicedEllpack_impl.h
+++ b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/SlicedEllpack_impl.h
@@ -24,20 +24,20 @@ template< typename Real,
           typename Device,
           typename Index,
           int SliceSize >
-String SlicedEllpack< Real, Device, Index, SliceSize >::getSerializationType()
+std::string SlicedEllpack< Real, Device, Index, SliceSize >::getSerializationType()
 {
-   return String( "Matrices::SlicedEllpack< ") +
+   return "Matrices::SlicedEllpack< " +
           TNL::getType< Real >() +
           ", [any_device], " +
-          String( TNL::getType< Index >() ) +
-          String( " >" );
+          TNL::getType< Index >() +
+          " >";
 }
 
 template< typename Real,
           typename Device,
           typename Index,
           int SliceSize >
-String SlicedEllpack< Real, Device, Index, SliceSize >::getSerializationTypeVirtual() const
+std::string SlicedEllpack< Real, Device, Index, SliceSize >::getSerializationTypeVirtual() const
 {
    return this->getSerializationType();
 }
diff --git a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/Sparse.h b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/Sparse.h
index 7eda2cb88c7b7683050bca4fb0f88206b3177b6b..d9c9162b6cbbfdbed0fe2ff8fd2a7d2b0510b58e 100644
--- a/src/Benchmarks/SpMV/ReferenceFormats/Legacy/Sparse.h
+++ b/src/Benchmarks/SpMV/ReferenceFormats/Legacy/Sparse.h
@@ -39,9 +39,9 @@ class Sparse : public TNL::Matrices::Matrix< Real, Device, Index >
 
    void reset();
 
-   void save( File& file ) const;
+   void save( File& file ) const override;
 
-   void load( File& file );
+   void load( File& file ) override;
 
    void printStructure( std::ostream& str ) const;
 
diff --git a/src/TNL/Algorithms/AtomicOperations.h b/src/TNL/Algorithms/AtomicOperations.h
index d8db393662587cce3f070d3c45665c5e279b1cd4..456839b5ea2ba69fcb333c814a6d6ff3af4f5d11 100644
--- a/src/TNL/Algorithms/AtomicOperations.h
+++ b/src/TNL/Algorithms/AtomicOperations.h
@@ -9,7 +9,7 @@
 #pragma once
 
 #ifdef HAVE_CUDA
-#include <cuda.h>
+   #include <cuda.h>
 #endif
 #include <TNL/Devices/Sequential.h>
 #include <TNL/Devices/Host.h>
@@ -19,7 +19,8 @@ namespace TNL {
 namespace Algorithms {
 
 template< typename Device >
-struct AtomicOperations{};
+struct AtomicOperations
+{};
 
 template<>
 struct AtomicOperations< Devices::Host >
@@ -30,9 +31,10 @@ struct AtomicOperations< Devices::Host >
    TNL_NVCC_HD_WARNING_DISABLE
    template< typename Value >
    __cuda_callable__
-   static void add( Value& v, const Value& a )
+   static void
+   add( Value& v, const Value& a )
    {
-#pragma omp atomic update
+      #pragma omp atomic update
       v += a;
    }
 };
@@ -46,7 +48,8 @@ struct AtomicOperations< Devices::Sequential >
    TNL_NVCC_HD_WARNING_DISABLE
    template< typename Value >
    __cuda_callable__
-   static void add( Value& v, const Value& a )
+   static void
+   add( Value& v, const Value& a )
    {
       v += a;
    }
@@ -57,54 +60,56 @@ struct AtomicOperations< Devices::Cuda >
 {
    template< typename Value >
    __cuda_callable__
-   static void add( Value& v, const Value& a )
+   static void
+   add( Value& v, const Value& a )
    {
 #ifdef HAVE_CUDA
       atomicAdd( &v, a );
-#endif // HAVE_CUDA
+#endif  // HAVE_CUDA
    }
 
 #ifdef HAVE_CUDA
    __device__
-   static void add( double& v, const double& a )
+   static void
+   add( double& v, const double& a )
    {
-#if __CUDA_ARCH__ < 600
-      unsigned long long int* v_as_ull = ( unsigned long long int* ) &v;
+   #if __CUDA_ARCH__ < 600
+      unsigned long long int* v_as_ull = (unsigned long long int*) &v;
       unsigned long long int old = *v_as_ull, assumed;
 
-      do
-      {
+      do {
          assumed = old;
-         old = atomicCAS( v_as_ull,
-                          assumed,
-                          __double_as_longlong( a + __longlong_as_double( assumed ) ) ) ;
+         old = atomicCAS( v_as_ull, assumed, __double_as_longlong( a + __longlong_as_double( assumed ) ) );
 
-      // Note: uses integer comparison to avoid hang in case of NaN (since NaN != NaN)
-      }
-      while( assumed != old );
-#else // __CUDA_ARCH__ < 600
+         // Note: uses integer comparison to avoid hang in case of NaN (since NaN != NaN)
+      } while( assumed != old );
+   #else   // __CUDA_ARCH__ < 600
       atomicAdd( &v, a );
-#endif //__CUDA_ARCH__ < 600
+   #endif  //__CUDA_ARCH__ < 600
    }
-#else // HAVE_CUDA
-   static void add( double& v, const double& a ){}
-#endif // HAVE_CUDA
+#else   // HAVE_CUDA
+   static void
+   add( double& v, const double& a )
+   {}
+#endif  // HAVE_CUDA
 
    __cuda_callable__
-   static void add( long int& v, const long int& a )
+   static void
+   add( long int& v, const long int& a )
    {
 #ifdef HAVE_CUDA
       TNL_ASSERT_TRUE( false, "Atomic add for long int is not supported on CUDA." );
-#endif // HAVE_CUDA
+#endif  // HAVE_CUDA
    }
 
    __cuda_callable__
-   static void add( short int& v, const short int& a )
+   static void
+   add( short int& v, const short int& a )
    {
 #ifdef HAVE_CUDA
       TNL_ASSERT_TRUE( false, "Atomic add for short int is not supported on CUDA." );
-#endif // HAVE_CUDA
+#endif  // HAVE_CUDA
    }
 };
-} //namespace Algorithms
-} //namespace TNL
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/CudaReductionBuffer.h b/src/TNL/Algorithms/CudaReductionBuffer.h
index 59fe6c6c78325fac2f2bc5ed2b1724bfa03afefb..bbcf9aca4424c2b48bba6410899b4387f512d67b 100644
--- a/src/TNL/Algorithms/CudaReductionBuffer.h
+++ b/src/TNL/Algorithms/CudaReductionBuffer.h
@@ -8,7 +8,7 @@
 
 #pragma once
 
-#include <stdlib.h>
+#include <cstdlib>  // std::atexit
 
 #include <TNL/Cuda/CheckDevice.h>
 #include <TNL/Exceptions/CudaBadAlloc.h>
@@ -19,72 +19,76 @@ namespace Algorithms {
 
 class CudaReductionBuffer
 {
-   public:
-      inline static CudaReductionBuffer& getInstance()
-      {
-         static CudaReductionBuffer instance;
-         return instance;
-      }
+public:
+   inline static CudaReductionBuffer&
+   getInstance()
+   {
+      static CudaReductionBuffer instance;
+      return instance;
+   }
 
-      inline void setSize( size_t size )
-      {
+   inline void
+   setSize( std::size_t size )
+   {
 #ifdef HAVE_CUDA
-         if( size > this->size )
-         {
-            this->free();
-            if( cudaMalloc( ( void** ) &this->data, size ) != cudaSuccess ) {
-               this->data = 0;
-               throw Exceptions::CudaBadAlloc();
-            }
-            this->size = size;
+      if( size > this->size ) {
+         this->free();
+         if( cudaMalloc( (void**) &this->data, size ) != cudaSuccess ) {
+            this->data = 0;
+            throw Exceptions::CudaBadAlloc();
          }
+         this->size = size;
+      }
 #else
-         throw Exceptions::CudaSupportMissing();
+      throw Exceptions::CudaSupportMissing();
 #endif
-      }
+   }
 
-      template< typename Type >
-      Type* getData()
-      {
-         return ( Type* ) this->data;
-      }
+   template< typename Type >
+   Type*
+   getData()
+   {
+      return (Type*) this->data;
+   }
 
-   private:
-      // stop the compiler generating methods of copy the object
-      CudaReductionBuffer( CudaReductionBuffer const& copy );            // Not Implemented
-      CudaReductionBuffer& operator=( CudaReductionBuffer const& copy ); // Not Implemented
+   // copy-constructor and copy-assignment are meaningless for a singleton class
+   CudaReductionBuffer( CudaReductionBuffer const& copy ) = delete;
+   CudaReductionBuffer&
+   operator=( CudaReductionBuffer const& copy ) = delete;
 
-      // private constructor of the singleton
-      inline CudaReductionBuffer( size_t size = 0 )
-      {
+private:
+   // private constructor of the singleton
+   inline CudaReductionBuffer( std::size_t size = 0 )
+   {
 #ifdef HAVE_CUDA
-         setSize( size );
-         atexit( CudaReductionBuffer::free_atexit );
+      setSize( size );
+      std::atexit( CudaReductionBuffer::free_atexit );
 #endif
-      }
+   }
 
-      inline static void free_atexit( void )
-      {
-         CudaReductionBuffer::getInstance().free();
-      }
+   inline static void
+   free_atexit()
+   {
+      CudaReductionBuffer::getInstance().free();
+   }
 
-   protected:
-      inline void free( void )
-      {
+protected:
+   inline void
+   free()
+   {
 #ifdef HAVE_CUDA
-         if( data )
-         {
-            cudaFree( data );
-            data = nullptr;
-            TNL_CHECK_CUDA_DEVICE;
-         }
-#endif
+      if( data ) {
+         cudaFree( data );
+         data = nullptr;
+         TNL_CHECK_CUDA_DEVICE;
       }
+#endif
+   }
 
-      void* data = nullptr;
+   void* data = nullptr;
 
-      size_t size = 0;
+   std::size_t size = 0;
 };
 
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/MemoryOperations.h b/src/TNL/Algorithms/MemoryOperations.h
index 2263215fb58a64b4c95a874a66904141ac268b4e..e91d0ba13e6076b8fe74a11568232726fceedf0d 100644
--- a/src/TNL/Algorithms/MemoryOperations.h
+++ b/src/TNL/Algorithms/MemoryOperations.h
@@ -22,182 +22,149 @@ struct MemoryOperations< Devices::Sequential >
 {
    template< typename Element, typename Index >
    __cuda_callable__
-   static void construct( Element* data,
-                          const Index size );
+   static void
+   construct( Element* data, Index size );
 
    // note that args are passed by reference to the constructor, not via
    // std::forward since move-semantics does not apply for the construction of
    // multiple elements
    template< typename Element, typename Index, typename... Args >
    __cuda_callable__
-   static void construct( Element* data,
-                          const Index size,
-                          const Args&... args );
+   static void
+   construct( Element* data, Index size, const Args&... args );
 
    template< typename Element, typename Index >
    __cuda_callable__
-   static void destruct( Element* data,
-                         const Index size );
+   static void
+   destruct( Element* data, Index size );
 
    template< typename Element >
    __cuda_callable__
-   static void setElement( Element* data,
-                           const Element& value );
+   static void
+   setElement( Element* data, const Element& value );
 
    template< typename Element >
    __cuda_callable__
-   static Element getElement( const Element* data );
+   static Element
+   getElement( const Element* data );
 
    template< typename Element, typename Index >
    __cuda_callable__
-   static void set( Element* data,
-                    const Element& value,
-                    const Index size );
+   static void
+   set( Element* data, const Element& value, Index size );
 
-   template< typename DestinationElement,
-             typename SourceElement,
-             typename Index >
+   template< typename DestinationElement, typename SourceElement, typename Index >
    __cuda_callable__
-   static void copy( DestinationElement* destination,
-                     const SourceElement* source,
-                     const Index size );
-
-   template< typename DestinationElement,
-             typename Index,
-             typename SourceIterator >
-   static void copyFromIterator( DestinationElement* destination,
-                                 Index destinationSize,
-                                 SourceIterator first,
-                                 SourceIterator last );
-
-   template< typename Element1,
-             typename Element2,
-             typename Index >
+   static void
+   copy( DestinationElement* destination, const SourceElement* source, Index size );
+
+   template< typename DestinationElement, typename Index, typename SourceIterator >
+   static void
+   copyFromIterator( DestinationElement* destination, Index destinationSize, SourceIterator first, SourceIterator last );
+
+   template< typename Element1, typename Element2, typename Index >
    __cuda_callable__
-   static bool compare( const Element1* destination,
-                        const Element2* source,
-                        const Index size );
+   static bool
+   compare( const Element1* destination, const Element2* source, Index size );
 };
 
 template<>
 struct MemoryOperations< Devices::Host >
 {
    template< typename Element, typename Index >
-   static void construct( Element* data,
-                          const Index size );
+   static void
+   construct( Element* data, Index size );
 
    // note that args are passed by reference to the constructor, not via
    // std::forward since move-semantics does not apply for the construction of
    // multiple elements
    template< typename Element, typename Index, typename... Args >
-   static void construct( Element* data,
-                          const Index size,
-                          const Args&... args );
+   static void
+   construct( Element* data, Index size, const Args&... args );
 
    template< typename Element, typename Index >
-   static void destruct( Element* data,
-                         const Index size );
+   static void
+   destruct( Element* data, Index size );
 
    // this is __cuda_callable__ only to silence nvcc warnings
    TNL_NVCC_HD_WARNING_DISABLE
    template< typename Element >
    __cuda_callable__
-   static void setElement( Element* data,
-                           const Element& value );
+   static void
+   setElement( Element* data, const Element& value );
 
    // this is __cuda_callable__ only to silence nvcc warnings
    TNL_NVCC_HD_WARNING_DISABLE
    template< typename Element >
    __cuda_callable__
-   static Element getElement( const Element* data );
+   static Element
+   getElement( const Element* data );
 
    template< typename Element, typename Index >
-   static void set( Element* data,
-                    const Element& value,
-                    const Index size );
-
-   template< typename DestinationElement,
-             typename SourceElement,
-             typename Index >
-   static void copy( DestinationElement* destination,
-                     const SourceElement* source,
-                     const Index size );
-
-   template< typename DestinationElement,
-             typename Index,
-             typename SourceIterator >
-   static void copyFromIterator( DestinationElement* destination,
-                                 Index destinationSize,
-                                 SourceIterator first,
-                                 SourceIterator last );
-
-   template< typename Element1,
-             typename Element2,
-             typename Index >
-   static bool compare( const Element1* destination,
-                        const Element2* source,
-                        const Index size );
+   static void
+   set( Element* data, const Element& value, Index size );
+
+   template< typename DestinationElement, typename SourceElement, typename Index >
+   static void
+   copy( DestinationElement* destination, const SourceElement* source, Index size );
+
+   template< typename DestinationElement, typename Index, typename SourceIterator >
+   static void
+   copyFromIterator( DestinationElement* destination, Index destinationSize, SourceIterator first, SourceIterator last );
+
+   template< typename Element1, typename Element2, typename Index >
+   static bool
+   compare( const Element1* destination, const Element2* source, Index size );
 };
 
 template<>
 struct MemoryOperations< Devices::Cuda >
 {
    template< typename Element, typename Index >
-   static void construct( Element* data,
-                          const Index size );
+   static void
+   construct( Element* data, Index size );
 
    // note that args are passed by value to the constructor, not via
    // std::forward or even by reference, since move-semantics does not apply for
    // the construction of multiple elements and pass-by-reference cannot be used
    // with CUDA kernels
    template< typename Element, typename Index, typename... Args >
-   static void construct( Element* data,
-                          const Index size,
-                          const Args&... args );
+   static void
+   construct( Element* data, Index size, const Args&... args );
 
    template< typename Element, typename Index >
-   static void destruct( Element* data,
-                         const Index size );
+   static void
+   destruct( Element* data, Index size );
 
    template< typename Element >
    __cuda_callable__
-   static void setElement( Element* data,
-                           const Element& value );
+   static void
+   setElement( Element* data, const Element& value );
 
    template< typename Element >
    __cuda_callable__
-   static Element getElement( const Element* data );
+   static Element
+   getElement( const Element* data );
 
    template< typename Element, typename Index >
-   static void set( Element* data,
-                    const Element& value,
-                    const Index size );
-
-   template< typename DestinationElement,
-             typename SourceElement,
-             typename Index >
-   static void copy( DestinationElement* destination,
-                     const SourceElement* source,
-                     const Index size );
-
-   template< typename DestinationElement,
-             typename Index,
-             typename SourceIterator >
-   static void copyFromIterator( DestinationElement* destination,
-                                 Index destinationSize,
-                                 SourceIterator first,
-                                 SourceIterator last );
-
-   template< typename Element1,
-             typename Element2,
-             typename Index >
-   static bool compare( const Element1* destination,
-                        const Element2* source,
-                        const Index size );
+   static void
+   set( Element* data, const Element& value, Index size );
+
+   template< typename DestinationElement, typename SourceElement, typename Index >
+   static void
+   copy( DestinationElement* destination, const SourceElement* source, Index size );
+
+   template< typename DestinationElement, typename Index, typename SourceIterator >
+   static void
+   copyFromIterator( DestinationElement* destination, Index destinationSize, SourceIterator first, SourceIterator last );
+
+   template< typename Element1, typename Element2, typename Index >
+   static bool
+   compare( const Element1* destination, const Element2* source, Index size );
 };
 
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace Algorithms
+}  // namespace TNL
 
 #include <TNL/Algorithms/MemoryOperationsSequential.hpp>
 #include <TNL/Algorithms/MemoryOperationsHost.hpp>
diff --git a/src/TNL/Algorithms/MemoryOperationsCuda.hpp b/src/TNL/Algorithms/MemoryOperationsCuda.hpp
index fcf10fcbe82e34f79541f57a2a0a01393c8fdb3f..e4b573f705f7e389617ea193b2a8254da492b88f 100644
--- a/src/TNL/Algorithms/MemoryOperationsCuda.hpp
+++ b/src/TNL/Algorithms/MemoryOperationsCuda.hpp
@@ -21,59 +21,51 @@ namespace Algorithms {
 
 template< typename Element, typename Index >
 void
-MemoryOperations< Devices::Cuda >::
-construct( Element* data,
-           const Index size )
+MemoryOperations< Devices::Cuda >::construct( Element* data, Index size )
 {
    TNL_ASSERT_TRUE( data, "Attempted to create elements through a nullptr." );
-   auto kernel = [data] __cuda_callable__ ( Index i )
+   auto kernel = [ data ] __cuda_callable__( Index i )
    {
       // placement-new
-      ::new( (void*) (data + i) ) Element();
+      ::new( (void*) ( data + i ) ) Element();
    };
    ParallelFor< Devices::Cuda >::exec( (Index) 0, size, kernel );
 }
 
 template< typename Element, typename Index, typename... Args >
 void
-MemoryOperations< Devices::Cuda >::
-construct( Element* data,
-           const Index size,
-           const Args&... args )
+MemoryOperations< Devices::Cuda >::construct( Element* data, Index size, const Args&... args )
 {
    TNL_ASSERT_TRUE( data, "Attempted to create elements through a nullptr." );
    // NOTE: nvcc does not allow __cuda_callable__ lambdas with a variadic capture
-   auto kernel = [data] __cuda_callable__ ( Index i, Args... args )
+   auto kernel = [ data ] __cuda_callable__( Index i, Args... args )
    {
       // placement-new
       // (note that args are passed by value to the constructor, not via
       // std::forward or even by reference, since move-semantics does not apply for
       // the construction of multiple elements and pass-by-reference cannot be used
       // with CUDA kernels)
-      ::new( (void*) (data + i) ) Element( args... );
+      ::new( (void*) ( data + i ) ) Element( args... );
    };
    ParallelFor< Devices::Cuda >::exec( (Index) 0, size, kernel, args... );
 }
 
 template< typename Element, typename Index >
 void
-MemoryOperations< Devices::Cuda >::
-destruct( Element* data,
-          const Index size )
+MemoryOperations< Devices::Cuda >::destruct( Element* data, Index size )
 {
    TNL_ASSERT_TRUE( data, "Attempted to destroy data through a nullptr." );
-   auto kernel = [data] __cuda_callable__ ( Index i )
+   auto kernel = [ data ] __cuda_callable__( Index i )
    {
-      (data + i)->~Element();
+      ( data + i )->~Element();
    };
    ParallelFor< Devices::Cuda >::exec( (Index) 0, size, kernel );
 }
 
 template< typename Element >
-__cuda_callable__ void
-MemoryOperations< Devices::Cuda >::
-setElement( Element* data,
-            const Element& value )
+__cuda_callable__
+void
+MemoryOperations< Devices::Cuda >::setElement( Element* data, const Element& value )
 {
    TNL_ASSERT_TRUE( data, "Attempted to set data through a nullptr." );
 #ifdef __CUDA_ARCH__
@@ -88,9 +80,9 @@ setElement( Element* data,
 }
 
 template< typename Element >
-__cuda_callable__ Element
-MemoryOperations< Devices::Cuda >::
-getElement( const Element* data )
+__cuda_callable__
+Element
+MemoryOperations< Devices::Cuda >::getElement( const Element* data )
 {
    TNL_ASSERT_TRUE( data, "Attempted to get data through a nullptr." );
 #ifdef __CUDA_ARCH__
@@ -104,53 +96,44 @@ getElement( const Element* data )
 
 template< typename Element, typename Index >
 void
-MemoryOperations< Devices::Cuda >::
-set( Element* data,
-     const Element& value,
-     const Index size )
+MemoryOperations< Devices::Cuda >::set( Element* data, const Element& value, Index size )
 {
-   if( size == 0 ) return;
+   if( size == 0 )
+      return;
    TNL_ASSERT_TRUE( data, "Attempted to set data through a nullptr." );
-   auto kernel = [data, value] __cuda_callable__ ( Index i )
+   auto kernel = [ data, value ] __cuda_callable__( Index i )
    {
       data[ i ] = value;
    };
    ParallelFor< Devices::Cuda >::exec( (Index) 0, size, kernel );
 }
 
-template< typename DestinationElement,
-          typename SourceElement,
-          typename Index >
+template< typename DestinationElement, typename SourceElement, typename Index >
 void
-MemoryOperations< Devices::Cuda >::
-copy( DestinationElement* destination,
-      const SourceElement* source,
-      const Index size )
+MemoryOperations< Devices::Cuda >::copy( DestinationElement* destination, const SourceElement* source, Index size )
 {
-   if( size == 0 ) return;
+   if( size == 0 )
+      return;
    TNL_ASSERT_TRUE( destination, "Attempted to copy data to a nullptr." );
    TNL_ASSERT_TRUE( source, "Attempted to copy data from a nullptr." );
 
    // our ParallelFor kernel is faster than cudaMemcpy
-   auto kernel = [destination, source] __cuda_callable__ ( Index i )
+   auto kernel = [ destination, source ] __cuda_callable__( Index i )
    {
       destination[ i ] = source[ i ];
    };
    ParallelFor< Devices::Cuda >::exec( (Index) 0, size, kernel );
 }
 
-template< typename DestinationElement,
-          typename Index,
-          typename SourceIterator >
+template< typename DestinationElement, typename Index, typename SourceIterator >
 void
-MemoryOperations< Devices::Cuda >::
-copyFromIterator( DestinationElement* destination,
-                  Index destinationSize,
-                  SourceIterator first,
-                  SourceIterator last )
+MemoryOperations< Devices::Cuda >::copyFromIterator( DestinationElement* destination,
+                                                     Index destinationSize,
+                                                     SourceIterator first,
+                                                     SourceIterator last )
 {
    using BaseType = typename std::remove_cv< DestinationElement >::type;
-   const int buffer_size = TNL::min( Cuda::getTransferBufferSize() / sizeof(BaseType), destinationSize );
+   const int buffer_size = TNL::min( Cuda::getTransferBufferSize() / sizeof( BaseType ), destinationSize );
    std::unique_ptr< BaseType[] > buffer{ new BaseType[ buffer_size ] };
    Index copiedElements = 0;
    while( copiedElements < destinationSize && first != last ) {
@@ -164,22 +147,21 @@ copyFromIterator( DestinationElement* destination,
       throw std::length_error( "Source iterator is larger than the destination array." );
 }
 
-template< typename Element1,
-          typename Element2,
-          typename Index >
+template< typename Element1, typename Element2, typename Index >
 bool
-MemoryOperations< Devices::Cuda >::
-compare( const Element1* destination,
-         const Element2* source,
-         const Index size )
+MemoryOperations< Devices::Cuda >::compare( const Element1* destination, const Element2* source, Index size )
 {
-   if( size == 0 ) return true;
+   if( size == 0 )
+      return true;
    TNL_ASSERT_TRUE( destination, "Attempted to compare data through a nullptr." );
    TNL_ASSERT_TRUE( source, "Attempted to compare data through a nullptr." );
 
-   auto fetch = [=] __cuda_callable__ ( Index i ) -> bool { return destination[ i ] == source[ i ]; };
-   return reduce< Devices::Cuda >( ( Index ) 0, size, fetch, std::logical_and<>{}, true );
+   auto fetch = [ = ] __cuda_callable__( Index i ) -> bool
+   {
+      return destination[ i ] == source[ i ];
+   };
+   return reduce< Devices::Cuda >( (Index) 0, size, fetch, std::logical_and<>{}, true );
 }
 
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/MemoryOperationsHost.hpp b/src/TNL/Algorithms/MemoryOperationsHost.hpp
index e50e70a90c22456e33eff8267d42f13fae1aa12f..1fd350f1b55be62f9e48985da717a9b715612711 100644
--- a/src/TNL/Algorithms/MemoryOperationsHost.hpp
+++ b/src/TNL/Algorithms/MemoryOperationsHost.hpp
@@ -19,68 +19,58 @@ namespace Algorithms {
 
 template< typename Element, typename Index >
 void
-MemoryOperations< Devices::Host >::
-construct( Element* data,
-           const Index size )
+MemoryOperations< Devices::Host >::construct( Element* data, Index size )
 {
    TNL_ASSERT_TRUE( data, "Attempted to create elements through a nullptr." );
-   auto kernel = [data]( Index i )
+   auto kernel = [ data ]( Index i )
    {
       // placement-new
-      ::new( (void*) (data + i) ) Element();
+      ::new( (void*) ( data + i ) ) Element();
    };
    ParallelFor< Devices::Host >::exec( (Index) 0, size, kernel );
 }
 
 template< typename Element, typename Index, typename... Args >
 void
-MemoryOperations< Devices::Host >::
-construct( Element* data,
-           const Index size,
-           const Args&... args )
+MemoryOperations< Devices::Host >::construct( Element* data, Index size, const Args&... args )
 {
    TNL_ASSERT_TRUE( data, "Attempted to create elements through a nullptr." );
-   auto kernel = [data, &args...]( Index i )
+   auto kernel = [ data, &args... ]( Index i )
    {
       // placement-new
       // (note that args are passed by reference to the constructor, not via
       // std::forward since move-semantics does not apply for the construction
       // of multiple elements)
-      ::new( (void*) (data + i) ) Element( args... );
+      ::new( (void*) ( data + i ) ) Element( args... );
    };
    ParallelFor< Devices::Host >::exec( (Index) 0, size, kernel );
 }
 
 template< typename Element, typename Index >
 void
-MemoryOperations< Devices::Host >::
-destruct( Element* data,
-          const Index size )
+MemoryOperations< Devices::Host >::destruct( Element* data, Index size )
 {
    TNL_ASSERT_TRUE( data, "Attempted to destroy data through a nullptr." );
-   auto kernel = [data]( Index i )
+   auto kernel = [ data ]( Index i )
    {
-      (data + i)->~Element();
+      ( data + i )->~Element();
    };
    ParallelFor< Devices::Host >::exec( (Index) 0, size, kernel );
 }
 
 template< typename Element >
-__cuda_callable__ // only to avoid nvcc warning
+__cuda_callable__  // only to avoid nvcc warning
 void
-MemoryOperations< Devices::Host >::
-setElement( Element* data,
-            const Element& value )
+MemoryOperations< Devices::Host >::setElement( Element* data, const Element& value )
 {
    TNL_ASSERT_TRUE( data, "Attempted to set data through a nullptr." );
    *data = value;
 }
 
 template< typename Element >
-__cuda_callable__ // only to avoid nvcc warning
+__cuda_callable__  // only to avoid nvcc warning
 Element
-MemoryOperations< Devices::Host >::
-getElement( const Element* data )
+MemoryOperations< Devices::Host >::getElement( const Element* data )
 {
    TNL_ASSERT_TRUE( data, "Attempted to get data through a nullptr." );
    return *data;
@@ -88,36 +78,30 @@ getElement( const Element* data )
 
 template< typename Element, typename Index >
 void
-MemoryOperations< Devices::Host >::
-set( Element* data,
-     const Element& value,
-     const Index size )
+MemoryOperations< Devices::Host >::set( Element* data, const Element& value, Index size )
 {
-   if( size == 0 ) return;
+   if( size == 0 )
+      return;
    TNL_ASSERT_TRUE( data, "Attempted to set data through a nullptr." );
-   auto kernel = [data, value]( Index i )
+   auto kernel = [ data, value ]( Index i )
    {
       data[ i ] = value;
    };
    ParallelFor< Devices::Host >::exec( (Index) 0, size, kernel );
 }
 
-template< typename DestinationElement,
-          typename SourceElement,
-          typename Index >
+template< typename DestinationElement, typename SourceElement, typename Index >
 void
-MemoryOperations< Devices::Host >::
-copy( DestinationElement* destination,
-      const SourceElement* source,
-      const Index size )
+MemoryOperations< Devices::Host >::copy( DestinationElement* destination, const SourceElement* source, Index size )
 {
-   if( size == 0 ) return;
+   if( size == 0 )
+      return;
    TNL_ASSERT_TRUE( destination, "Attempted to copy data to a nullptr." );
    TNL_ASSERT_TRUE( source, "Attempted to copy data from a nullptr." );
 
    // our ParallelFor version is faster than std::copy iff we use more than 1 thread
    if( Devices::Host::isOMPEnabled() && Devices::Host::getMaxThreadsCount() > 1 ) {
-      auto kernel = [destination, source]( Index i )
+      auto kernel = [ destination, source ]( Index i )
       {
          destination[ i ] = source[ i ];
       };
@@ -129,35 +113,31 @@ copy( DestinationElement* destination,
    }
 }
 
-template< typename DestinationElement,
-          typename Index,
-          typename SourceIterator >
+template< typename DestinationElement, typename Index, typename SourceIterator >
 void
-MemoryOperations< Devices::Host >::
-copyFromIterator( DestinationElement* destination,
-                  Index destinationSize,
-                  SourceIterator first,
-                  SourceIterator last )
+MemoryOperations< Devices::Host >::copyFromIterator( DestinationElement* destination,
+                                                     Index destinationSize,
+                                                     SourceIterator first,
+                                                     SourceIterator last )
 {
    MemoryOperations< Devices::Sequential >::copyFromIterator( destination, destinationSize, first, last );
 }
 
-template< typename DestinationElement,
-          typename SourceElement,
-          typename Index >
+template< typename Element1, typename Element2, typename Index >
 bool
-MemoryOperations< Devices::Host >::
-compare( const DestinationElement* destination,
-         const SourceElement* source,
-         const Index size )
+MemoryOperations< Devices::Host >::compare( const Element1* destination, const Element2* source, Index size )
 {
-   if( size == 0 ) return true;
+   if( size == 0 )
+      return true;
    TNL_ASSERT_TRUE( destination, "Attempted to compare data through a nullptr." );
    TNL_ASSERT_TRUE( source, "Attempted to compare data through a nullptr." );
 
    if( Devices::Host::isOMPEnabled() && Devices::Host::getMaxThreadsCount() > 1 ) {
-      auto fetch = [destination, source] ( Index i ) -> bool { return destination[ i ] == source[ i ]; };
-      return reduce< Devices::Host >( ( Index ) 0, size, fetch, std::logical_and<>{}, true );
+      auto fetch = [ destination, source ]( Index i ) -> bool
+      {
+         return destination[ i ] == source[ i ];
+      };
+      return reduce< Devices::Host >( (Index) 0, size, fetch, std::logical_and<>{}, true );
    }
    else {
       // sequential algorithm can return as soon as it finds a mismatch
@@ -165,5 +145,5 @@ compare( const DestinationElement* destination,
    }
 }
 
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/MemoryOperationsSequential.hpp b/src/TNL/Algorithms/MemoryOperationsSequential.hpp
index bd077093c245e3cf2a3789cc38208c6e3c427395..85a8906a451eed40f1cf7bbebfddea0a3b61a58a 100644
--- a/src/TNL/Algorithms/MemoryOperationsSequential.hpp
+++ b/src/TNL/Algorithms/MemoryOperationsSequential.hpp
@@ -14,23 +14,18 @@ namespace Algorithms {
 template< typename Element, typename Index >
 __cuda_callable__
 void
-MemoryOperations< Devices::Sequential >::
-construct( Element* data,
-           const Index size )
+MemoryOperations< Devices::Sequential >::construct( Element* data, Index size )
 {
    TNL_ASSERT_TRUE( data, "Attempted to create elements through a nullptr." );
    for( Index i = 0; i < size; i++ )
       // placement-new
-      ::new( (void*) (data + i) ) Element();
+      ::new( (void*) ( data + i ) ) Element();
 }
 
 template< typename Element, typename Index, typename... Args >
 __cuda_callable__
 void
-MemoryOperations< Devices::Sequential >::
-construct( Element* data,
-           const Index size,
-           const Args&... args )
+MemoryOperations< Devices::Sequential >::construct( Element* data, Index size, const Args&... args )
 {
    TNL_ASSERT_TRUE( data, "Attempted to create elements through a nullptr." );
    for( Index i = 0; i < size; i++ )
@@ -38,27 +33,23 @@ construct( Element* data,
       // (note that args are passed by reference to the constructor, not via
       // std::forward since move-semantics does not apply for the construction
       // of multiple elements)
-      ::new( (void*) (data + i) ) Element( args... );
+      ::new( (void*) ( data + i ) ) Element( args... );
 }
 
 template< typename Element, typename Index >
 __cuda_callable__
 void
-MemoryOperations< Devices::Sequential >::
-destruct( Element* data,
-          const Index size )
+MemoryOperations< Devices::Sequential >::destruct( Element* data, Index size )
 {
    TNL_ASSERT_TRUE( data, "Attempted to destroy elements through a nullptr." );
    for( Index i = 0; i < size; i++ )
-      (data + i)->~Element();
+      ( data + i )->~Element();
 }
 
 template< typename Element >
 __cuda_callable__
 void
-MemoryOperations< Devices::Sequential >::
-setElement( Element* data,
-            const Element& value )
+MemoryOperations< Devices::Sequential >::setElement( Element* data, const Element& value )
 {
    TNL_ASSERT_TRUE( data, "Attempted to set data through a nullptr." );
    *data = value;
@@ -67,8 +58,7 @@ setElement( Element* data,
 template< typename Element >
 __cuda_callable__
 Element
-MemoryOperations< Devices::Sequential >::
-getElement( const Element* data )
+MemoryOperations< Devices::Sequential >::getElement( const Element* data )
 {
    TNL_ASSERT_TRUE( data, "Attempted to get data through a nullptr." );
    return *data;
@@ -77,28 +67,22 @@ getElement( const Element* data )
 template< typename Element, typename Index >
 __cuda_callable__
 void
-MemoryOperations< Devices::Sequential >::
-set( Element* data,
-     const Element& value,
-     const Index size )
+MemoryOperations< Devices::Sequential >::set( Element* data, const Element& value, Index size )
 {
-   if( size == 0 ) return;
+   if( size == 0 )
+      return;
    TNL_ASSERT_TRUE( data, "Attempted to set data through a nullptr." );
    for( Index i = 0; i < size; i++ )
       data[ i ] = value;
 }
 
-template< typename DestinationElement,
-          typename SourceElement,
-          typename Index >
+template< typename DestinationElement, typename SourceElement, typename Index >
 __cuda_callable__
 void
-MemoryOperations< Devices::Sequential >::
-copy( DestinationElement* destination,
-      const SourceElement* source,
-      const Index size )
+MemoryOperations< Devices::Sequential >::copy( DestinationElement* destination, const SourceElement* source, Index size )
 {
-   if( size == 0 ) return;
+   if( size == 0 )
+      return;
    TNL_ASSERT_TRUE( destination, "Attempted to copy data to a nullptr." );
    TNL_ASSERT_TRUE( source, "Attempted to copy data from a nullptr." );
 
@@ -106,15 +90,12 @@ copy( DestinationElement* destination,
       destination[ i ] = source[ i ];
 }
 
-template< typename DestinationElement,
-          typename Index,
-          typename SourceIterator >
+template< typename DestinationElement, typename Index, typename SourceIterator >
 void
-MemoryOperations< Devices::Sequential >::
-copyFromIterator( DestinationElement* destination,
-                  Index destinationSize,
-                  SourceIterator first,
-                  SourceIterator last )
+MemoryOperations< Devices::Sequential >::copyFromIterator( DestinationElement* destination,
+                                                           Index destinationSize,
+                                                           SourceIterator first,
+                                                           SourceIterator last )
 {
    Index i = 0;
    while( i < destinationSize && first != last )
@@ -123,17 +104,13 @@ copyFromIterator( DestinationElement* destination,
       throw std::length_error( "Source iterator is larger than the destination array." );
 }
 
-template< typename Element1,
-          typename Element2,
-          typename Index >
+template< typename Element1, typename Element2, typename Index >
 __cuda_callable__
 bool
-MemoryOperations< Devices::Sequential >::
-compare( const Element1* destination,
-         const Element2* source,
-         const Index size )
+MemoryOperations< Devices::Sequential >::compare( const Element1* destination, const Element2* source, Index size )
 {
-   if( size == 0 ) return true;
+   if( size == 0 )
+      return true;
    TNL_ASSERT_TRUE( destination, "Attempted to compare data through a nullptr." );
    TNL_ASSERT_TRUE( source, "Attempted to compare data through a nullptr." );
 
@@ -143,5 +120,5 @@ compare( const Element1* destination,
    return true;
 }
 
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/MultiDeviceMemoryOperations.h b/src/TNL/Algorithms/MultiDeviceMemoryOperations.h
index 4338be51f773c8f950bfea3ae7fb9dbbd9de327a..94468f4d406153fd3675ac9a76e863f995484791 100644
--- a/src/TNL/Algorithms/MultiDeviceMemoryOperations.h
+++ b/src/TNL/Algorithms/MultiDeviceMemoryOperations.h
@@ -12,28 +12,21 @@
 namespace TNL {
 namespace Algorithms {
 
-template< typename DestinationDevice,
-          typename SourceDevice = DestinationDevice >
+template< typename DestinationDevice, typename SourceDevice = DestinationDevice >
 struct MultiDeviceMemoryOperations
 {
-   template< typename DestinationElement,
-             typename SourceElement,
-             typename Index >
-   static void copy( DestinationElement* destination,
-                     const SourceElement* source,
-                     const Index size )
+   template< typename DestinationElement, typename SourceElement, typename Index >
+   static void
+   copy( DestinationElement* destination, const SourceElement* source, Index size )
    {
       // use DestinationDevice, unless it is void
       using Device = std::conditional_t< std::is_void< DestinationDevice >::value, SourceDevice, DestinationDevice >;
       MemoryOperations< Device >::copy( destination, source, size );
    }
 
-   template< typename DestinationElement,
-             typename SourceElement,
-             typename Index >
-   static bool compare( const DestinationElement* destination,
-                        const SourceElement* source,
-                        const Index size )
+   template< typename DestinationElement, typename SourceElement, typename Index >
+   static bool
+   compare( const DestinationElement* destination, const SourceElement* source, Index size )
    {
       // use DestinationDevice, unless it is void
       using Device = std::conditional_t< std::is_void< DestinationDevice >::value, SourceDevice, DestinationDevice >;
@@ -41,113 +34,84 @@ struct MultiDeviceMemoryOperations
    }
 };
 
-
 template< typename DeviceType >
 struct MultiDeviceMemoryOperations< Devices::Cuda, DeviceType >
 {
-   template< typename DestinationElement,
-             typename SourceElement,
-             typename Index >
-   static void copy( DestinationElement* destination,
-                     const SourceElement* source,
-                     const Index size );
+   template< typename DestinationElement, typename SourceElement, typename Index >
+   static void
+   copy( DestinationElement* destination, const SourceElement* source, Index size );
 
-   template< typename DestinationElement,
-             typename SourceElement,
-             typename Index >
-   static bool compare( const DestinationElement* destination,
-                        const SourceElement* source,
-                        const Index size );
+   template< typename DestinationElement, typename SourceElement, typename Index >
+   static bool
+   compare( const DestinationElement* destination, const SourceElement* source, Index size );
 };
 
 template< typename DeviceType >
 struct MultiDeviceMemoryOperations< DeviceType, Devices::Cuda >
 {
-   template< typename DestinationElement,
-             typename SourceElement,
-             typename Index >
-   static void copy( DestinationElement* destination,
-                     const SourceElement* source,
-                     const Index size );
+   template< typename DestinationElement, typename SourceElement, typename Index >
+   static void
+   copy( DestinationElement* destination, const SourceElement* source, Index size );
 
-   template< typename Element1,
-             typename Element2,
-             typename Index >
-   static bool compare( const Element1* destination,
-                        const Element2* source,
-                        const Index size );
+   template< typename Element1, typename Element2, typename Index >
+   static bool
+   compare( const Element1* destination, const Element2* source, Index size );
 };
 
-
 // CUDA <-> CUDA to disambiguate from partial specializations below
 template<>
 struct MultiDeviceMemoryOperations< Devices::Cuda, Devices::Cuda >
 {
-   template< typename DestinationElement,
-             typename SourceElement,
-             typename Index >
-   static void copy( DestinationElement* destination,
-                     const SourceElement* source,
-                     const Index size )
+   template< typename DestinationElement, typename SourceElement, typename Index >
+   static void
+   copy( DestinationElement* destination, const SourceElement* source, Index size )
    {
       MemoryOperations< Devices::Cuda >::copy( destination, source, size );
    }
 
-   template< typename DestinationElement,
-             typename SourceElement,
-             typename Index >
-   static bool compare( const DestinationElement* destination,
-                        const SourceElement* source,
-                        const Index size )
+   template< typename DestinationElement, typename SourceElement, typename Index >
+   static bool
+   compare( const DestinationElement* destination, const SourceElement* source, Index size )
    {
       return MemoryOperations< Devices::Cuda >::compare( destination, source, size );
    }
 };
 
-
 /****
  * Operations CUDA -> Host
  */
 template< typename DeviceType >
-   template< typename DestinationElement,
-             typename SourceElement,
-             typename Index >
+template< typename DestinationElement, typename SourceElement, typename Index >
 void
-MultiDeviceMemoryOperations< DeviceType, Devices::Cuda >::
-copy( DestinationElement* destination,
-      const SourceElement* source,
-      const Index size )
+MultiDeviceMemoryOperations< DeviceType, Devices::Cuda >::copy( DestinationElement* destination,
+                                                                const SourceElement* source,
+                                                                Index size )
 {
-   if( size == 0 ) return;
+   if( size == 0 )
+      return;
    TNL_ASSERT_TRUE( destination, "Attempted to copy data to a nullptr." );
    TNL_ASSERT_TRUE( source, "Attempted to copy data from a nullptr." );
 #ifdef HAVE_CUDA
-   if( std::is_same< std::remove_cv_t<DestinationElement>, std::remove_cv_t<SourceElement> >::value )
-   {
-      if( cudaMemcpy( destination,
-                      source,
-                      size * sizeof( DestinationElement ),
-                      cudaMemcpyDeviceToHost ) != cudaSuccess )
+   if( std::is_same< std::remove_cv_t< DestinationElement >, std::remove_cv_t< SourceElement > >::value ) {
+      if( cudaMemcpy( destination, source, size * sizeof( DestinationElement ), cudaMemcpyDeviceToHost ) != cudaSuccess )
          std::cerr << "Transfer of data from CUDA device to host failed." << std::endl;
       TNL_CHECK_CUDA_DEVICE;
    }
-   else
-   {
+   else {
       using BaseType = std::remove_cv_t< SourceElement >;
-      const int buffer_size = TNL::min( Cuda::getTransferBufferSize() / sizeof(BaseType), size );
+      const int buffer_size = TNL::min( Cuda::getTransferBufferSize() / sizeof( BaseType ), size );
       std::unique_ptr< BaseType[] > buffer{ new BaseType[ buffer_size ] };
       Index i = 0;
-      while( i < size )
-      {
+      while( i < size ) {
          if( cudaMemcpy( (void*) buffer.get(),
                          (void*) &source[ i ],
-                         TNL::min( size - i, buffer_size ) * sizeof(SourceElement),
-                         cudaMemcpyDeviceToHost ) != cudaSuccess )
+                         TNL::min( size - i, buffer_size ) * sizeof( SourceElement ),
+                         cudaMemcpyDeviceToHost )
+             != cudaSuccess )
             std::cerr << "Transfer of data from CUDA device to host failed." << std::endl;
          TNL_CHECK_CUDA_DEVICE;
          int j = 0;
-         while( j < buffer_size && i + j < size )
-         {
+         while( j < buffer_size && i + j < size ) {
             destination[ i + j ] = buffer[ j ];
             j++;
          }
@@ -159,18 +123,15 @@ copy( DestinationElement* destination,
 #endif
 }
 
-
 template< typename DeviceType >
-   template< typename Element1,
-             typename Element2,
-             typename Index >
+template< typename Element1, typename Element2, typename Index >
 bool
-MultiDeviceMemoryOperations< DeviceType, Devices::Cuda >::
-compare( const Element1* destination,
-         const Element2* source,
-         const Index size )
+MultiDeviceMemoryOperations< DeviceType, Devices::Cuda >::compare( const Element1* destination,
+                                                                   const Element2* source,
+                                                                   Index size )
 {
-   if( size == 0 ) return true;
+   if( size == 0 )
+      return true;
    /***
     * Here, destination is on host and source is on CUDA device.
     */
@@ -178,16 +139,14 @@ compare( const Element1* destination,
    TNL_ASSERT_TRUE( source, "Attempted to compare data through a nullptr." );
    TNL_ASSERT_GE( size, (Index) 0, "Array size must be non-negative." );
 #ifdef HAVE_CUDA
-   const int buffer_size = TNL::min( Cuda::getTransferBufferSize() / sizeof(Element2), size );
+   const int buffer_size = TNL::min( Cuda::getTransferBufferSize() / sizeof( Element2 ), size );
    std::unique_ptr< Element2[] > host_buffer{ new Element2[ buffer_size ] };
    Index compared = 0;
-   while( compared < size )
-   {
+   while( compared < size ) {
       const int transfer = TNL::min( size - compared, buffer_size );
-      if( cudaMemcpy( (void*) host_buffer.get(),
-                      (void*) &source[ compared ],
-                      transfer * sizeof(Element2),
-                      cudaMemcpyDeviceToHost ) != cudaSuccess )
+      if( cudaMemcpy(
+             (void*) host_buffer.get(), (void*) &source[ compared ], transfer * sizeof( Element2 ), cudaMemcpyDeviceToHost )
+          != cudaSuccess )
          std::cerr << "Transfer of data from CUDA device to host failed." << std::endl;
       TNL_CHECK_CUDA_DEVICE;
       if( ! MemoryOperations< Devices::Host >::compare( &destination[ compared ], host_buffer.get(), transfer ) )
@@ -204,46 +163,36 @@ compare( const Element1* destination,
  * Operations Host -> CUDA
  */
 template< typename DeviceType >
-   template< typename DestinationElement,
-             typename SourceElement,
-             typename Index >
+template< typename DestinationElement, typename SourceElement, typename Index >
 void
-MultiDeviceMemoryOperations< Devices::Cuda, DeviceType >::
-copy( DestinationElement* destination,
-      const SourceElement* source,
-      const Index size )
+MultiDeviceMemoryOperations< Devices::Cuda, DeviceType >::copy( DestinationElement* destination,
+                                                                const SourceElement* source,
+                                                                Index size )
 {
-   if( size == 0 ) return;
+   if( size == 0 )
+      return;
    TNL_ASSERT_TRUE( destination, "Attempted to copy data to a nullptr." );
    TNL_ASSERT_TRUE( source, "Attempted to copy data from a nullptr." );
    TNL_ASSERT_GE( size, (Index) 0, "Array size must be non-negative." );
 #ifdef HAVE_CUDA
-   if( std::is_same< std::remove_cv_t<DestinationElement>, std::remove_cv_t<SourceElement> >::value )
-   {
-      if( cudaMemcpy( destination,
-                      source,
-                      size * sizeof( DestinationElement ),
-                      cudaMemcpyHostToDevice ) != cudaSuccess )
+   if( std::is_same< std::remove_cv_t< DestinationElement >, std::remove_cv_t< SourceElement > >::value ) {
+      if( cudaMemcpy( destination, source, size * sizeof( DestinationElement ), cudaMemcpyHostToDevice ) != cudaSuccess )
          std::cerr << "Transfer of data from host to CUDA device failed." << std::endl;
       TNL_CHECK_CUDA_DEVICE;
    }
-   else
-   {
-      const int buffer_size = TNL::min( Cuda::getTransferBufferSize() / sizeof(DestinationElement), size );
+   else {
+      const int buffer_size = TNL::min( Cuda::getTransferBufferSize() / sizeof( DestinationElement ), size );
       std::unique_ptr< DestinationElement[] > buffer{ new DestinationElement[ buffer_size ] };
       Index i = 0;
-      while( i < size )
-      {
+      while( i < size ) {
          int j = 0;
-         while( j < buffer_size && i + j < size )
-         {
+         while( j < buffer_size && i + j < size ) {
             buffer[ j ] = source[ i + j ];
             j++;
          }
-         if( cudaMemcpy( (void*) &destination[ i ],
-                         (void*) buffer.get(),
-                         j * sizeof( DestinationElement ),
-                         cudaMemcpyHostToDevice ) != cudaSuccess )
+         if( cudaMemcpy(
+                (void*) &destination[ i ], (void*) buffer.get(), j * sizeof( DestinationElement ), cudaMemcpyHostToDevice )
+             != cudaSuccess )
             std::cerr << "Transfer of data from host to CUDA device failed." << std::endl;
          TNL_CHECK_CUDA_DEVICE;
          i += j;
@@ -255,21 +204,19 @@ copy( DestinationElement* destination,
 }
 
 template< typename DeviceType >
-   template< typename Element1,
-             typename Element2,
-             typename Index >
+template< typename Element1, typename Element2, typename Index >
 bool
-MultiDeviceMemoryOperations< Devices::Cuda, DeviceType >::
-compare( const Element1* hostData,
-         const Element2* deviceData,
-         const Index size )
+MultiDeviceMemoryOperations< Devices::Cuda, DeviceType >::compare( const Element1* destination,
+                                                                   const Element2* source,
+                                                                   Index size )
 {
-   if( size == 0 ) return true;
-   TNL_ASSERT_TRUE( hostData, "Attempted to compare data through a nullptr." );
-   TNL_ASSERT_TRUE( deviceData, "Attempted to compare data through a nullptr." );
+   if( size == 0 )
+      return true;
+   TNL_ASSERT_TRUE( destination, "Attempted to compare data through a nullptr." );
+   TNL_ASSERT_TRUE( source, "Attempted to compare data through a nullptr." );
    TNL_ASSERT_GE( size, (Index) 0, "Array size must be non-negative." );
-   return MultiDeviceMemoryOperations< DeviceType, Devices::Cuda >::compare( deviceData, hostData, size );
+   return MultiDeviceMemoryOperations< DeviceType, Devices::Cuda >::compare( source, destination, size );
 }
 
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Multireduction.h b/src/TNL/Algorithms/Multireduction.h
index f48cd35fefd94d7d68a8058232201fb425bf8132..cb70b52aa041bc7a07fe3b58c430c52b998b5d04 100644
--- a/src/TNL/Algorithms/Multireduction.h
+++ b/src/TNL/Algorithms/Multireduction.h
@@ -38,17 +38,9 @@ struct Multireduction< Devices::Sequential >
     *    n: number of datasets to be reduced
     *    result: output array of size = n
     */
-   template< typename Result,
-             typename DataFetcher,
-             typename Reduction,
-             typename Index >
+   template< typename Result, typename DataFetcher, typename Reduction, typename Index >
    static constexpr void
-   reduce( const Result identity,
-           DataFetcher dataFetcher,
-           const Reduction reduction,
-           const Index size,
-           const int n,
-           Result* result );
+   reduce( Result identity, DataFetcher dataFetcher, Reduction reduction, Index size, int n, Result* result );
 };
 
 template<>
@@ -69,17 +61,9 @@ struct Multireduction< Devices::Host >
     *    n: number of datasets to be reduced
     *    result: output array of size = n
     */
-   template< typename Result,
-             typename DataFetcher,
-             typename Reduction,
-             typename Index >
+   template< typename Result, typename DataFetcher, typename Reduction, typename Index >
    static void
-   reduce( const Result identity,
-           DataFetcher dataFetcher,
-           const Reduction reduction,
-           const Index size,
-           const int n,
-           Result* result );
+   reduce( Result identity, DataFetcher dataFetcher, Reduction reduction, Index size, int n, Result* result );
 };
 
 template<>
@@ -100,20 +84,12 @@ struct Multireduction< Devices::Cuda >
     *    n: number of datasets to be reduced
     *    hostResult: output array of size = n
     */
-   template< typename Result,
-             typename DataFetcher,
-             typename Reduction,
-             typename Index >
+   template< typename Result, typename DataFetcher, typename Reduction, typename Index >
    static void
-   reduce( const Result identity,
-           DataFetcher dataFetcher,
-           const Reduction reduction,
-           const Index size,
-           const int n,
-           Result* hostResult );
+   reduce( Result identity, DataFetcher dataFetcher, Reduction reduction, Index size, int n, Result* hostResult );
 };
 
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace Algorithms
+}  // namespace TNL
 
 #include "Multireduction.hpp"
diff --git a/src/TNL/Algorithms/Multireduction.hpp b/src/TNL/Algorithms/Multireduction.hpp
index 080038777a81a48fc59e10ac65012e92e1bd8e42..250c22b1aa2b26d0f0f4a9ce8ac0bb4a51baaad9 100644
--- a/src/TNL/Algorithms/Multireduction.hpp
+++ b/src/TNL/Algorithms/Multireduction.hpp
@@ -18,25 +18,20 @@
 #include <TNL/Algorithms/detail/CudaMultireductionKernel.h>
 
 #ifdef CUDA_REDUCTION_PROFILING
-#include <TNL/Timer.h>
-#include <iostream>
+   #include <TNL/Timer.h>
+   #include <iostream>
 #endif
 
 namespace TNL {
 namespace Algorithms {
 
-template< typename Result,
-          typename DataFetcher,
-          typename Reduction,
-          typename Index >
-void constexpr
-Multireduction< Devices::Sequential >::
-reduce( const Result identity,
-        DataFetcher dataFetcher,
-        const Reduction reduction,
-        const Index size,
-        const int n,
-        Result* result )
+template< typename Result, typename DataFetcher, typename Reduction, typename Index >
+void constexpr Multireduction< Devices::Sequential >::reduce( Result identity,
+                                                              DataFetcher dataFetcher,
+                                                              Reduction reduction,
+                                                              Index size,
+                                                              int n,
+                                                              Result* result )
 {
    TNL_ASSERT_GT( size, 0, "The size of datasets must be positive." );
    TNL_ASSERT_GT( n, 0, "The number of datasets must be positive." );
@@ -57,7 +52,7 @@ reduce( const Result identity,
          for( int k = 0; k < n; k++ ) {
             Result* _r = r + 4 * k;
             for( int i = 0; i < block_size; i += 4 ) {
-               _r[ 0 ] = reduction( _r[ 0 ], dataFetcher( offset + i,     k ) );
+               _r[ 0 ] = reduction( _r[ 0 ], dataFetcher( offset + i, k ) );
                _r[ 1 ] = reduction( _r[ 1 ], dataFetcher( offset + i + 1, k ) );
                _r[ 2 ] = reduction( _r[ 2 ], dataFetcher( offset + i + 2, k ) );
                _r[ 3 ] = reduction( _r[ 3 ], dataFetcher( offset + i + 3, k ) );
@@ -102,18 +97,14 @@ reduce( const Result identity,
    }
 }
 
-template< typename Result,
-          typename DataFetcher,
-          typename Reduction,
-          typename Index >
+template< typename Result, typename DataFetcher, typename Reduction, typename Index >
 void
-Multireduction< Devices::Host >::
-reduce( const Result identity,
-        DataFetcher dataFetcher,
-        const Reduction reduction,
-        const Index size,
-        const int n,
-        Result* result )
+Multireduction< Devices::Host >::reduce( Result identity,
+                                         DataFetcher dataFetcher,
+                                         Reduction reduction,
+                                         Index size,
+                                         int n,
+                                         Result* result )
 {
    TNL_ASSERT_GT( size, 0, "The size of datasets must be positive." );
    TNL_ASSERT_GT( n, 0, "The number of datasets must be positive." );
@@ -124,7 +115,7 @@ reduce( const Result identity,
 
    if( Devices::Host::isOMPEnabled() && blocks >= 2 ) {
       const int threads = TNL::min( blocks, Devices::Host::getMaxThreadsCount() );
-#pragma omp parallel num_threads(threads)
+      #pragma omp parallel num_threads(threads)
       {
          // first thread initializes the result array
          #pragma omp single nowait
@@ -145,7 +136,7 @@ reduce( const Result identity,
             for( int k = 0; k < n; k++ ) {
                Result* _r = r + 4 * k;
                for( int i = 0; i < block_size; i += 4 ) {
-                  _r[ 0 ] = reduction( _r[ 0 ], dataFetcher( offset + i,     k ) );
+                  _r[ 0 ] = reduction( _r[ 0 ], dataFetcher( offset + i, k ) );
                   _r[ 1 ] = reduction( _r[ 1 ], dataFetcher( offset + i + 1, k ) );
                   _r[ 2 ] = reduction( _r[ 2 ], dataFetcher( offset + i + 2, k ) );
                   _r[ 3 ] = reduction( _r[ 3 ], dataFetcher( offset + i + 3, k ) );
@@ -184,59 +175,59 @@ reduce( const Result identity,
       Multireduction< Devices::Sequential >::reduce( identity, dataFetcher, reduction, size, n, result );
 }
 
-template< typename Result,
-          typename DataFetcher,
-          typename Reduction,
-          typename Index >
+template< typename Result, typename DataFetcher, typename Reduction, typename Index >
 void
-Multireduction< Devices::Cuda >::
-reduce( const Result identity,
-        DataFetcher dataFetcher,
-        const Reduction reduction,
-        const Index size,
-        const int n,
-        Result* hostResult )
+Multireduction< Devices::Cuda >::reduce( Result identity,
+                                         DataFetcher dataFetcher,
+                                         Reduction reduction,
+                                         Index size,
+                                         int n,
+                                         Result* hostResult )
 {
    TNL_ASSERT_GT( size, 0, "The size of datasets must be positive." );
    TNL_ASSERT_GT( n, 0, "The number of datasets must be positive." );
 
-   #ifdef CUDA_REDUCTION_PROFILING
-      Timer timer;
-      timer.reset();
-      timer.start();
-   #endif
+#ifdef CUDA_REDUCTION_PROFILING
+   Timer timer;
+   timer.reset();
+   timer.start();
+#endif
 
    // start the reduction on the GPU
    Result* deviceAux1 = nullptr;
    const int reducedSize = detail::CudaMultireductionKernelLauncher( identity, dataFetcher, reduction, size, n, deviceAux1 );
 
-   #ifdef CUDA_REDUCTION_PROFILING
-      timer.stop();
-      std::cout << "   Multireduction of " << n << " datasets on GPU to size " << reducedSize << " took " << timer.getRealTime() << " sec. " << std::endl;
-      timer.reset();
-      timer.start();
-   #endif
+#ifdef CUDA_REDUCTION_PROFILING
+   timer.stop();
+   std::cout << "   Multireduction of " << n << " datasets on GPU to size " << reducedSize << " took " << timer.getRealTime()
+             << " sec. " << std::endl;
+   timer.reset();
+   timer.start();
+#endif
 
    // transfer the reduced data from device to host
    std::unique_ptr< Result[] > resultArray{ new Result[ n * reducedSize ] };
    MultiDeviceMemoryOperations< void, Devices::Cuda >::copy( resultArray.get(), deviceAux1, n * reducedSize );
 
-   #ifdef CUDA_REDUCTION_PROFILING
-      timer.stop();
-      std::cout << "   Transferring data to CPU took " << timer.getRealTime() << " sec. " << std::endl;
-      timer.reset();
-      timer.start();
-   #endif
+#ifdef CUDA_REDUCTION_PROFILING
+   timer.stop();
+   std::cout << "   Transferring data to CPU took " << timer.getRealTime() << " sec. " << std::endl;
+   timer.reset();
+   timer.start();
+#endif
 
    // finish the reduction on the host
-   auto dataFetcherFinish = [&] ( int i, int k ) { return resultArray[ i + k * reducedSize ]; };
+   auto dataFetcherFinish = [ & ]( int i, int k )
+   {
+      return resultArray[ i + k * reducedSize ];
+   };
    Multireduction< Devices::Sequential >::reduce( identity, dataFetcherFinish, reduction, reducedSize, n, hostResult );
 
-   #ifdef CUDA_REDUCTION_PROFILING
-      timer.stop();
-      std::cout << "   Multireduction of small data set on CPU took " << timer.getRealTime() << " sec. " << std::endl;
-   #endif
+#ifdef CUDA_REDUCTION_PROFILING
+   timer.stop();
+   std::cout << "   Multireduction of small data set on CPU took " << timer.getRealTime() << " sec. " << std::endl;
+#endif
 };
 
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/ParallelFor.h b/src/TNL/Algorithms/ParallelFor.h
index 06f3a0901ec8b0ee93142c1695d2cb5ecc92a02f..aa417a67817b2de04208d1b617279fe07ced1e7c 100644
--- a/src/TNL/Algorithms/ParallelFor.h
+++ b/src/TNL/Algorithms/ParallelFor.h
@@ -12,7 +12,7 @@
 #include <TNL/Cuda/CheckDevice.h>
 #include <TNL/Cuda/DeviceInfo.h>
 #include <TNL/Cuda/LaunchHelpers.h>
-#include <TNL/Exceptions/CudaSupportMissing.h>
+#include <TNL/Cuda/KernelLaunch.h>
 #include <TNL/Math.h>
 
 /****
@@ -45,8 +45,11 @@ namespace Algorithms {
  *
  * Only parallel for-loops in CUDA are affected by this mode.
  */
-enum ParallelForMode { SynchronousMode, AsynchronousMode };
-
+enum ParallelForMode
+{
+   SynchronousMode,
+   AsynchronousMode
+};
 
 /**
  * \brief Parallel for loop for one dimensional interval of indices.
@@ -56,8 +59,7 @@ enum ParallelForMode { SynchronousMode, AsynchronousMode };
  *    \ref TNL::Devices::Sequential.
  * \tparam Mode defines synchronous/asynchronous mode on parallel devices.
  */
-template< typename Device = Devices::Sequential,
-          ParallelForMode Mode = SynchronousMode >
+template< typename Device = Devices::Sequential, ParallelForMode Mode = SynchronousMode >
 struct ParallelFor
 {
    /**
@@ -80,10 +82,9 @@ struct ParallelFor
     * \include ParallelForExample.out
     *
     */
-   template< typename Index,
-             typename Function,
-             typename... FunctionArgs >
-   static void exec( Index start, Index end, Function f, FunctionArgs... args )
+   template< typename Index, typename Function, typename... FunctionArgs >
+   static void
+   exec( Index start, Index end, Function f, FunctionArgs... args )
    {
       for( Index i = start; i < end; i++ )
          f( i, args... );
@@ -98,8 +99,7 @@ struct ParallelFor
  *    \ref TNL::Devices::Sequential.
  * \tparam Mode defines synchronous/asynchronous mode on parallel devices.
  */
-template< typename Device = Devices::Sequential,
-          ParallelForMode Mode = SynchronousMode >
+template< typename Device = Devices::Sequential, ParallelForMode Mode = SynchronousMode >
 struct ParallelFor2D
 {
    /**
@@ -132,14 +132,13 @@ struct ParallelFor2D
     * \include ParallelForExample-2D.out
     *
     */
-   template< typename Index,
-             typename Function,
-             typename... FunctionArgs >
-   static void exec( Index startX, Index startY, Index endX, Index endY, Function f, FunctionArgs... args )
+   template< typename Index, typename Function, typename... FunctionArgs >
+   static void
+   exec( Index startX, Index startY, Index endX, Index endY, Function f, FunctionArgs... args )
    {
       for( Index j = startY; j < endY; j++ )
-      for( Index i = startX; i < endX; i++ )
-         f( i, j, args... );
+         for( Index i = startX; i < endX; i++ )
+            f( i, j, args... );
    }
 };
 
@@ -151,8 +150,7 @@ struct ParallelFor2D
  *    \ref TNL::Devices::Sequential.
  * \tparam Mode defines synchronous/asynchronous mode on parallel devices.
  */
-template< typename Device = Devices::Sequential,
-          ParallelForMode Mode = SynchronousMode >
+template< typename Device = Devices::Sequential, ParallelForMode Mode = SynchronousMode >
 struct ParallelFor3D
 {
    /**
@@ -187,31 +185,28 @@ struct ParallelFor3D
     * \include ParallelForExample-3D.out
     *
     */
-   template< typename Index,
-             typename Function,
-             typename... FunctionArgs >
-   static void exec( Index startX, Index startY, Index startZ, Index endX, Index endY, Index endZ, Function f, FunctionArgs... args )
+   template< typename Index, typename Function, typename... FunctionArgs >
+   static void
+   exec( Index startX, Index startY, Index startZ, Index endX, Index endY, Index endZ, Function f, FunctionArgs... args )
    {
       for( Index k = startZ; k < endZ; k++ )
-      for( Index j = startY; j < endY; j++ )
-      for( Index i = startX; i < endX; i++ )
-         f( i, j, k, args... );
+         for( Index j = startY; j < endY; j++ )
+            for( Index i = startX; i < endX; i++ )
+               f( i, j, k, args... );
    }
 };
 
 template< ParallelForMode Mode >
 struct ParallelFor< Devices::Host, Mode >
 {
-   template< typename Index,
-             typename Function,
-             typename... FunctionArgs >
-   static void exec( Index start, Index end, Function f, FunctionArgs... args )
+   template< typename Index, typename Function, typename... FunctionArgs >
+   static void
+   exec( Index start, Index end, Function f, FunctionArgs... args )
    {
 #ifdef HAVE_OPENMP
       // Benchmarks show that this is significantly faster compared
       // to '#pragma omp parallel for if( Devices::Host::isOMPEnabled() && end - start > 512 )'
-      if( Devices::Host::isOMPEnabled() && end - start > 512 )
-      {
+      if( Devices::Host::isOMPEnabled() && end - start > 512 ) {
          #pragma omp parallel for
          for( Index i = start; i < end; i++ )
             f( i, args... );
@@ -227,20 +222,18 @@ struct ParallelFor< Devices::Host, Mode >
 template< ParallelForMode Mode >
 struct ParallelFor2D< Devices::Host, Mode >
 {
-   template< typename Index,
-             typename Function,
-             typename... FunctionArgs >
-   static void exec( Index startX, Index startY, Index endX, Index endY, Function f, FunctionArgs... args )
+   template< typename Index, typename Function, typename... FunctionArgs >
+   static void
+   exec( Index startX, Index startY, Index endX, Index endY, Function f, FunctionArgs... args )
    {
 #ifdef HAVE_OPENMP
       // Benchmarks show that this is significantly faster compared
       // to '#pragma omp parallel for if( Devices::Host::isOMPEnabled() )'
-      if( Devices::Host::isOMPEnabled() )
-      {
+      if( Devices::Host::isOMPEnabled() ) {
          #pragma omp parallel for
          for( Index j = startY; j < endY; j++ )
-         for( Index i = startX; i < endX; i++ )
-            f( i, j, args... );
+            for( Index i = startX; i < endX; i++ )
+               f( i, j, args... );
       }
       else
          ParallelFor2D< Devices::Sequential >::exec( startX, startY, endX, endY, f, args... );
@@ -253,21 +246,19 @@ struct ParallelFor2D< Devices::Host, Mode >
 template< ParallelForMode Mode >
 struct ParallelFor3D< Devices::Host, Mode >
 {
-   template< typename Index,
-             typename Function,
-             typename... FunctionArgs >
-   static void exec( Index startX, Index startY, Index startZ, Index endX, Index endY, Index endZ, Function f, FunctionArgs... args )
+   template< typename Index, typename Function, typename... FunctionArgs >
+   static void
+   exec( Index startX, Index startY, Index startZ, Index endX, Index endY, Index endZ, Function f, FunctionArgs... args )
    {
 #ifdef HAVE_OPENMP
       // Benchmarks show that this is significantly faster compared
       // to '#pragma omp parallel for if( Devices::Host::isOMPEnabled() )'
-      if( Devices::Host::isOMPEnabled() )
-      {
+      if( Devices::Host::isOMPEnabled() ) {
          #pragma omp parallel for collapse(2)
          for( Index k = startZ; k < endZ; k++ )
-         for( Index j = startY; j < endY; j++ )
-         for( Index i = startX; i < endX; i++ )
-            f( i, j, k, args... );
+            for( Index j = startY; j < endY; j++ )
+               for( Index i = startX; i < endX; i++ )
+                  f( i, j, k, args... );
       }
       else
          ParallelFor3D< Devices::Sequential >::exec( startX, startY, startZ, endX, endY, endZ, f, args... );
@@ -277,41 +268,45 @@ struct ParallelFor3D< Devices::Host, Mode >
    }
 };
 
-#ifdef HAVE_CUDA
-template< bool gridStrideX = true,
-          typename Index,
-          typename Function,
-          typename... FunctionArgs >
-__global__ void
+template< bool gridStrideX = true, typename Index, typename Function, typename... FunctionArgs >
+__global__
+void
 ParallelForKernel( Index start, Index end, Function f, FunctionArgs... args )
 {
+#ifdef HAVE_CUDA
    Index i = start + blockIdx.x * blockDim.x + threadIdx.x;
    while( i < end ) {
       f( i, args... );
-      if( gridStrideX ) i += blockDim.x * gridDim.x;
-      else break;
+      if( gridStrideX )
+         i += blockDim.x * gridDim.x;
+      else
+         break;
    }
+#endif
 }
 
-template< bool gridStrideX = true,
-          bool gridStrideY = true,
-          typename Index,
-          typename Function,
-          typename... FunctionArgs >
-__global__ void
+template< bool gridStrideX = true, bool gridStrideY = true, typename Index, typename Function, typename... FunctionArgs >
+__global__
+void
 ParallelFor2DKernel( Index startX, Index startY, Index endX, Index endY, Function f, FunctionArgs... args )
 {
+#ifdef HAVE_CUDA
    Index j = startY + blockIdx.y * blockDim.y + threadIdx.y;
    Index i = startX + blockIdx.x * blockDim.x + threadIdx.x;
    while( j < endY ) {
       while( i < endX ) {
          f( i, j, args... );
-         if( gridStrideX ) i += blockDim.x * gridDim.x;
-         else break;
+         if( gridStrideX )
+            i += blockDim.x * gridDim.x;
+         else
+            break;
       }
-      if( gridStrideY ) j += blockDim.y * gridDim.y;
-      else break;
+      if( gridStrideY )
+         j += blockDim.y * gridDim.y;
+      else
+         break;
    }
+#endif
 }
 
 template< bool gridStrideX = true,
@@ -320,9 +315,18 @@ template< bool gridStrideX = true,
           typename Index,
           typename Function,
           typename... FunctionArgs >
-__global__ void
-ParallelFor3DKernel( Index startX, Index startY, Index startZ, Index endX, Index endY, Index endZ, Function f, FunctionArgs... args )
+__global__
+void
+ParallelFor3DKernel( Index startX,
+                     Index startY,
+                     Index startZ,
+                     Index endX,
+                     Index endY,
+                     Index endZ,
+                     Function f,
+                     FunctionArgs... args )
 {
+#ifdef HAVE_CUDA
    Index k = startZ + blockIdx.z * blockDim.z + threadIdx.z;
    Index j = startY + blockIdx.y * blockDim.y + threadIdx.y;
    Index i = startX + blockIdx.x * blockDim.x + threadIdx.x;
@@ -330,209 +334,210 @@ ParallelFor3DKernel( Index startX, Index startY, Index startZ, Index endX, Index
       while( j < endY ) {
          while( i < endX ) {
             f( i, j, k, args... );
-            if( gridStrideX ) i += blockDim.x * gridDim.x;
-            else break;
+            if( gridStrideX )
+               i += blockDim.x * gridDim.x;
+            else
+               break;
          }
-         if( gridStrideY ) j += blockDim.y * gridDim.y;
-         else break;
+         if( gridStrideY )
+            j += blockDim.y * gridDim.y;
+         else
+            break;
       }
-      if( gridStrideZ ) k += blockDim.z * gridDim.z;
-      else break;
+      if( gridStrideZ )
+         k += blockDim.z * gridDim.z;
+      else
+         break;
    }
-}
 #endif
+}
 
 template< ParallelForMode Mode >
 struct ParallelFor< Devices::Cuda, Mode >
 {
-   template< typename Index,
-             typename Function,
-             typename... FunctionArgs >
-   static void exec( Index start, Index end, Function f, FunctionArgs... args )
+   template< typename Index, typename Function, typename... FunctionArgs >
+   static void
+   exec( Index start, Index end, Function f, FunctionArgs... args )
    {
-#ifdef HAVE_CUDA
-      if( end > start ) {
-         dim3 blockSize( 256 );
-         dim3 gridSize;
-         gridSize.x = TNL::min( Cuda::getMaxGridSize(), Cuda::getNumberOfBlocks( end - start, blockSize.x ) );
-
-         if( (std::size_t) blockSize.x * gridSize.x >= (std::size_t) end - start )
-            ParallelForKernel< false ><<< gridSize, blockSize >>>( start, end, f, args... );
-         else {
-            // decrease the grid size and align to the number of multiprocessors
-            const int desGridSize = 32 * Cuda::DeviceInfo::getCudaMultiprocessors( Cuda::DeviceInfo::getActiveDevice() );
-            gridSize.x = TNL::min( desGridSize, Cuda::getNumberOfBlocks( end - start, blockSize.x ) );
-            ParallelForKernel< true ><<< gridSize, blockSize >>>( start, end, f, args... );
-         }
+      if( end <= start )
+         return;
 
-         if( Mode == SynchronousMode )
-         {
-            cudaStreamSynchronize(0);
-            TNL_CHECK_CUDA_DEVICE;
-         }
+      Cuda::LaunchConfiguration launch_config;
+      launch_config.blockSize.x = 256;
+      launch_config.gridSize.x =
+         TNL::min( Cuda::getMaxGridSize(), Cuda::getNumberOfBlocks( end - start, launch_config.blockSize.x ) );
+
+      constexpr bool synchronous = Mode == SynchronousMode;
+
+      if( (std::size_t) launch_config.blockSize.x * launch_config.gridSize.x >= (std::size_t) end - start ) {
+         constexpr auto kernel = ParallelForKernel< false, Index, Function, FunctionArgs... >;
+         Cuda::launchKernel< synchronous >( kernel, 0, launch_config, start, end, f, args... );
+      }
+      else {
+         // decrease the grid size and align to the number of multiprocessors
+         const int desGridSize = 32 * Cuda::DeviceInfo::getCudaMultiprocessors( Cuda::DeviceInfo::getActiveDevice() );
+         launch_config.gridSize.x = TNL::min( desGridSize, Cuda::getNumberOfBlocks( end - start, launch_config.blockSize.x ) );
+         constexpr auto kernel = ParallelForKernel< true, Index, Function, FunctionArgs... >;
+         Cuda::launchKernel< synchronous >( kernel, 0, launch_config, start, end, f, args... );
       }
-#else
-      throw Exceptions::CudaSupportMissing();
-#endif
    }
 };
 
 template< ParallelForMode Mode >
 struct ParallelFor2D< Devices::Cuda, Mode >
 {
-   template< typename Index,
-             typename Function,
-             typename... FunctionArgs >
-   static void exec( Index startX, Index startY, Index endX, Index endY, Function f, FunctionArgs... args )
+   template< typename Index, typename Function, typename... FunctionArgs >
+   static void
+   exec( Index startX, Index startY, Index endX, Index endY, Function f, FunctionArgs... args )
    {
-#ifdef HAVE_CUDA
-      if( endX > startX && endY > startY ) {
-         const Index sizeX = endX - startX;
-         const Index sizeY = endY - startY;
-
-         dim3 blockSize;
-         if( sizeX >= sizeY * sizeY ) {
-            blockSize.x = TNL::min( 256, sizeX );
-            blockSize.y = 1;
-         }
-         else if( sizeY >= sizeX * sizeX ) {
-            blockSize.x = 1;
-            blockSize.y = TNL::min( 256, sizeY );
-         }
-         else {
-            blockSize.x = TNL::min( 32, sizeX );
-            blockSize.y = TNL::min( 8, sizeY );
-         }
-         dim3 gridSize;
-         gridSize.x = TNL::min( Cuda::getMaxGridSize(), Cuda::getNumberOfBlocks( sizeX, blockSize.x ) );
-         gridSize.y = TNL::min( Cuda::getMaxGridSize(), Cuda::getNumberOfBlocks( sizeY, blockSize.y ) );
-
-         dim3 gridCount;
-         gridCount.x = roundUpDivision( sizeX, blockSize.x * gridSize.x );
-         gridCount.y = roundUpDivision( sizeY, blockSize.y * gridSize.y );
-
-         if( gridCount.x == 1 && gridCount.y == 1 )
-            ParallelFor2DKernel< false, false ><<< gridSize, blockSize >>>
-               ( startX, startY, endX, endY, f, args... );
-         else if( gridCount.x == 1 && gridCount.y > 1 )
-            ParallelFor2DKernel< false, true ><<< gridSize, blockSize >>>
-               ( startX, startY, endX, endY, f, args... );
-         else if( gridCount.x > 1 && gridCount.y == 1 )
-            ParallelFor2DKernel< true, false ><<< gridSize, blockSize >>>
-               ( startX, startY, endX, endY, f, args... );
-         else
-            ParallelFor2DKernel< true, true ><<< gridSize, blockSize >>>
-               ( startX, startY, endX, endY, f, args... );
+      if( endX <= startX || endY <= startY )
+         return;
 
-         if( Mode == SynchronousMode )
-         {
-            cudaStreamSynchronize(0);
-            TNL_CHECK_CUDA_DEVICE;
-         }
+      const Index sizeX = endX - startX;
+      const Index sizeY = endY - startY;
+
+      Cuda::LaunchConfiguration launch_config;
+      if( sizeX >= sizeY * sizeY ) {
+         launch_config.blockSize.x = TNL::min( 256, sizeX );
+         launch_config.blockSize.y = 1;
+      }
+      else if( sizeY >= sizeX * sizeX ) {
+         launch_config.blockSize.x = 1;
+         launch_config.blockSize.y = TNL::min( 256, sizeY );
+      }
+      else {
+         launch_config.blockSize.x = TNL::min( 32, sizeX );
+         launch_config.blockSize.y = TNL::min( 8, sizeY );
+      }
+      launch_config.gridSize.x =
+         TNL::min( Cuda::getMaxGridSize(), Cuda::getNumberOfBlocks( sizeX, launch_config.blockSize.x ) );
+      launch_config.gridSize.y =
+         TNL::min( Cuda::getMaxGridSize(), Cuda::getNumberOfBlocks( sizeY, launch_config.blockSize.y ) );
+
+      constexpr bool synchronous = Mode == SynchronousMode;
+
+      dim3 gridCount;
+      gridCount.x = roundUpDivision( sizeX, launch_config.blockSize.x * launch_config.gridSize.x );
+      gridCount.y = roundUpDivision( sizeY, launch_config.blockSize.y * launch_config.gridSize.y );
+
+      if( gridCount.x == 1 && gridCount.y == 1 ) {
+         constexpr auto kernel = ParallelFor2DKernel< false, false, Index, Function, FunctionArgs... >;
+         Cuda::launchKernel< synchronous >( kernel, 0, launch_config, startX, startY, endX, endY, f, args... );
+      }
+      else if( gridCount.x == 1 && gridCount.y > 1 ) {
+         constexpr auto kernel = ParallelFor2DKernel< false, true, Index, Function, FunctionArgs... >;
+         Cuda::launchKernel< synchronous >( kernel, 0, launch_config, startX, startY, endX, endY, f, args... );
+      }
+      else if( gridCount.x > 1 && gridCount.y == 1 ) {
+         constexpr auto kernel = ParallelFor2DKernel< true, false, Index, Function, FunctionArgs... >;
+         Cuda::launchKernel< synchronous >( kernel, 0, launch_config, startX, startY, endX, endY, f, args... );
+      }
+      else {
+         constexpr auto kernel = ParallelFor2DKernel< true, true, Index, Function, FunctionArgs... >;
+         Cuda::launchKernel< synchronous >( kernel, 0, launch_config, startX, startY, endX, endY, f, args... );
       }
-#else
-      throw Exceptions::CudaSupportMissing();
-#endif
    }
 };
 
 template< ParallelForMode Mode >
 struct ParallelFor3D< Devices::Cuda, Mode >
 {
-   template< typename Index,
-             typename Function,
-             typename... FunctionArgs >
-   static void exec( Index startX, Index startY, Index startZ, Index endX, Index endY, Index endZ, Function f, FunctionArgs... args )
+   template< typename Index, typename Function, typename... FunctionArgs >
+   static void
+   exec( Index startX, Index startY, Index startZ, Index endX, Index endY, Index endZ, Function f, FunctionArgs... args )
    {
-#ifdef HAVE_CUDA
-      if( endX > startX && endY > startY && endZ > startZ ) {
-         const Index sizeX = endX - startX;
-         const Index sizeY = endY - startY;
-         const Index sizeZ = endZ - startZ;
-
-         dim3 blockSize;
-         if( sizeX >= sizeY * sizeY * sizeZ * sizeZ ) {
-            blockSize.x = TNL::min( 256, sizeX );
-            blockSize.y = 1;
-            blockSize.z = 1;
-         }
-         else if( sizeY >= sizeX * sizeX * sizeZ * sizeZ ) {
-            blockSize.x = 1;
-            blockSize.y = TNL::min( 256, sizeY );
-            blockSize.z = 1;
-         }
-         else if( sizeZ >= sizeX * sizeX * sizeY * sizeY ) {
-            blockSize.x = TNL::min( 2, sizeX );
-            blockSize.y = TNL::min( 2, sizeY );
-            // CUDA allows max 64 for blockSize.z
-            blockSize.z = TNL::min( 64, sizeZ );
-         }
-         else if( sizeX >= sizeZ * sizeZ && sizeY >= sizeZ * sizeZ ) {
-            blockSize.x = TNL::min( 32, sizeX );
-            blockSize.y = TNL::min( 8, sizeY );
-            blockSize.z = 1;
-         }
-         else if( sizeX >= sizeY * sizeY && sizeZ >= sizeY * sizeY ) {
-            blockSize.x = TNL::min( 32, sizeX );
-            blockSize.y = 1;
-            blockSize.z = TNL::min( 8, sizeZ );
-         }
-         else if( sizeY >= sizeX * sizeX && sizeZ >= sizeX * sizeX ) {
-            blockSize.x = 1;
-            blockSize.y = TNL::min( 32, sizeY );
-            blockSize.z = TNL::min( 8, sizeZ );
-         }
-         else {
-            blockSize.x = TNL::min( 16, sizeX );
-            blockSize.y = TNL::min( 4, sizeY );
-            blockSize.z = TNL::min( 4, sizeZ );
-         }
-         dim3 gridSize;
-         gridSize.x = TNL::min( Cuda::getMaxGridSize(), Cuda::getNumberOfBlocks( sizeX, blockSize.x ) );
-         gridSize.y = TNL::min( Cuda::getMaxGridSize(), Cuda::getNumberOfBlocks( sizeY, blockSize.y ) );
-         gridSize.z = TNL::min( Cuda::getMaxGridSize(), Cuda::getNumberOfBlocks( sizeZ, blockSize.z ) );
-
-         dim3 gridCount;
-         gridCount.x = roundUpDivision( sizeX, blockSize.x * gridSize.x );
-         gridCount.y = roundUpDivision( sizeY, blockSize.y * gridSize.y );
-         gridCount.z = roundUpDivision( sizeZ, blockSize.z * gridSize.z );
-
-         if( gridCount.x == 1 && gridCount.y == 1 && gridCount.z == 1 )
-            ParallelFor3DKernel< false, false, false ><<< gridSize, blockSize >>>
-               ( startX, startY, startZ, endX, endY, endZ, f, args... );
-         else if( gridCount.x == 1 && gridCount.y == 1 && gridCount.z > 1 )
-            ParallelFor3DKernel< false, false, true ><<< gridSize, blockSize >>>
-               ( startX, startY, startZ, endX, endY, endZ, f, args... );
-         else if( gridCount.x == 1 && gridCount.y > 1 && gridCount.z == 1 )
-            ParallelFor3DKernel< false, true, false ><<< gridSize, blockSize >>>
-               ( startX, startY, startZ, endX, endY, endZ, f, args... );
-         else if( gridCount.x > 1 && gridCount.y == 1 && gridCount.z == 1 )
-            ParallelFor3DKernel< true, false, false ><<< gridSize, blockSize >>>
-               ( startX, startY, startZ, endX, endY, endZ, f, args... );
-         else if( gridCount.x == 1 && gridCount.y > 1 && gridCount.z > 1 )
-            ParallelFor3DKernel< false, true, true ><<< gridSize, blockSize >>>
-               ( startX, startY, startZ, endX, endY, endZ, f, args... );
-         else if( gridCount.x > 1 && gridCount.y > 1 && gridCount.z == 1 )
-            ParallelFor3DKernel< true, true, false ><<< gridSize, blockSize >>>
-               ( startX, startY, startZ, endX, endY, endZ, f, args... );
-         else if( gridCount.x > 1 && gridCount.y == 1 && gridCount.z > 1 )
-            ParallelFor3DKernel< true, false, true ><<< gridSize, blockSize >>>
-               ( startX, startY, startZ, endX, endY, endZ, f, args... );
-         else
-            ParallelFor3DKernel< true, true, true ><<< gridSize, blockSize >>>
-               ( startX, startY, startZ, endX, endY, endZ, f, args... );
+      if( endX <= startX || endY <= startY || endZ <= startZ )
+         return;
 
-         if( Mode == SynchronousMode )
-         {
-            cudaStreamSynchronize(0);
-            TNL_CHECK_CUDA_DEVICE;
-         }
+      const Index sizeX = endX - startX;
+      const Index sizeY = endY - startY;
+      const Index sizeZ = endZ - startZ;
+
+      Cuda::LaunchConfiguration launch_config;
+      if( sizeX >= sizeY * sizeY * sizeZ * sizeZ ) {
+         launch_config.blockSize.x = TNL::min( 256, sizeX );
+         launch_config.blockSize.y = 1;
+         launch_config.blockSize.z = 1;
+      }
+      else if( sizeY >= sizeX * sizeX * sizeZ * sizeZ ) {
+         launch_config.blockSize.x = 1;
+         launch_config.blockSize.y = TNL::min( 256, sizeY );
+         launch_config.blockSize.z = 1;
+      }
+      else if( sizeZ >= sizeX * sizeX * sizeY * sizeY ) {
+         launch_config.blockSize.x = TNL::min( 2, sizeX );
+         launch_config.blockSize.y = TNL::min( 2, sizeY );
+         // CUDA allows max 64 for launch_config.blockSize.z
+         launch_config.blockSize.z = TNL::min( 64, sizeZ );
+      }
+      else if( sizeX >= sizeZ * sizeZ && sizeY >= sizeZ * sizeZ ) {
+         launch_config.blockSize.x = TNL::min( 32, sizeX );
+         launch_config.blockSize.y = TNL::min( 8, sizeY );
+         launch_config.blockSize.z = 1;
+      }
+      else if( sizeX >= sizeY * sizeY && sizeZ >= sizeY * sizeY ) {
+         launch_config.blockSize.x = TNL::min( 32, sizeX );
+         launch_config.blockSize.y = 1;
+         launch_config.blockSize.z = TNL::min( 8, sizeZ );
+      }
+      else if( sizeY >= sizeX * sizeX && sizeZ >= sizeX * sizeX ) {
+         launch_config.blockSize.x = 1;
+         launch_config.blockSize.y = TNL::min( 32, sizeY );
+         launch_config.blockSize.z = TNL::min( 8, sizeZ );
+      }
+      else {
+         launch_config.blockSize.x = TNL::min( 16, sizeX );
+         launch_config.blockSize.y = TNL::min( 4, sizeY );
+         launch_config.blockSize.z = TNL::min( 4, sizeZ );
+      }
+      launch_config.gridSize.x =
+         TNL::min( Cuda::getMaxGridSize(), Cuda::getNumberOfBlocks( sizeX, launch_config.blockSize.x ) );
+      launch_config.gridSize.y =
+         TNL::min( Cuda::getMaxGridSize(), Cuda::getNumberOfBlocks( sizeY, launch_config.blockSize.y ) );
+      launch_config.gridSize.z =
+         TNL::min( Cuda::getMaxGridSize(), Cuda::getNumberOfBlocks( sizeZ, launch_config.blockSize.z ) );
+
+      constexpr bool synchronous = Mode == SynchronousMode;
+
+      dim3 gridCount;
+      gridCount.x = roundUpDivision( sizeX, launch_config.blockSize.x * launch_config.gridSize.x );
+      gridCount.y = roundUpDivision( sizeY, launch_config.blockSize.y * launch_config.gridSize.y );
+      gridCount.z = roundUpDivision( sizeZ, launch_config.blockSize.z * launch_config.gridSize.z );
+
+      if( gridCount.x == 1 && gridCount.y == 1 && gridCount.z == 1 ) {
+         constexpr auto kernel = ParallelFor3DKernel< false, false, false, Index, Function, FunctionArgs... >;
+         Cuda::launchKernel< synchronous >( kernel, 0, launch_config, startX, startY, startZ, endX, endY, endZ, f, args... );
+      }
+      else if( gridCount.x == 1 && gridCount.y == 1 && gridCount.z > 1 ) {
+         constexpr auto kernel = ParallelFor3DKernel< false, false, true, Index, Function, FunctionArgs... >;
+         Cuda::launchKernel< synchronous >( kernel, 0, launch_config, startX, startY, startZ, endX, endY, endZ, f, args... );
+      }
+      else if( gridCount.x == 1 && gridCount.y > 1 && gridCount.z == 1 ) {
+         constexpr auto kernel = ParallelFor3DKernel< false, true, false, Index, Function, FunctionArgs... >;
+         Cuda::launchKernel< synchronous >( kernel, 0, launch_config, startX, startY, startZ, endX, endY, endZ, f, args... );
+      }
+      else if( gridCount.x > 1 && gridCount.y == 1 && gridCount.z == 1 ) {
+         constexpr auto kernel = ParallelFor3DKernel< true, false, false, Index, Function, FunctionArgs... >;
+         Cuda::launchKernel< synchronous >( kernel, 0, launch_config, startX, startY, startZ, endX, endY, endZ, f, args... );
+      }
+      else if( gridCount.x == 1 && gridCount.y > 1 && gridCount.z > 1 ) {
+         constexpr auto kernel = ParallelFor3DKernel< false, true, true, Index, Function, FunctionArgs... >;
+         Cuda::launchKernel< synchronous >( kernel, 0, launch_config, startX, startY, startZ, endX, endY, endZ, f, args... );
+      }
+      else if( gridCount.x > 1 && gridCount.y > 1 && gridCount.z == 1 ) {
+         constexpr auto kernel = ParallelFor3DKernel< true, true, false, Index, Function, FunctionArgs... >;
+         Cuda::launchKernel< synchronous >( kernel, 0, launch_config, startX, startY, startZ, endX, endY, endZ, f, args... );
+      }
+      else if( gridCount.x > 1 && gridCount.y == 1 && gridCount.z > 1 ) {
+         constexpr auto kernel = ParallelFor3DKernel< true, false, true, Index, Function, FunctionArgs... >;
+         Cuda::launchKernel< synchronous >( kernel, 0, launch_config, startX, startY, startZ, endX, endY, endZ, f, args... );
+      }
+      else {
+         constexpr auto kernel = ParallelFor3DKernel< true, true, true, Index, Function, FunctionArgs... >;
+         Cuda::launchKernel< synchronous >( kernel, 0, launch_config, startX, startY, startZ, endX, endY, endZ, f, args... );
       }
-#else
-      throw Exceptions::CudaSupportMissing();
-#endif
    }
 };
 
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/SegmentedScan.h b/src/TNL/Algorithms/SegmentedScan.h
index c330436889a88e3224f2233ae5f6add65714e4b9..b610e52bdeef20162fbe232ac1ddb5fe4ceb938a 100644
--- a/src/TNL/Algorithms/SegmentedScan.h
+++ b/src/TNL/Algorithms/SegmentedScan.h
@@ -58,8 +58,7 @@ namespace Algorithms {
  *
  * **Note: Segmented scan is not implemented for CUDA yet.**
  */
-template< typename Device,
-          detail::ScanType Type = detail::ScanType::Inclusive >
+template< typename Device, detail::ScanType Type = detail::ScanType::Inclusive >
 struct SegmentedScan;
 
 template< detail::ScanType Type >
@@ -95,9 +94,7 @@ struct SegmentedScan< Devices::Sequential, Type >
     *
     * \include SegmentedScanExample.out
     */
-   template< typename Vector,
-             typename Reduction,
-             typename Flags >
+   template< typename Vector, typename Reduction, typename Flags >
    static void
    perform( Vector& v,
             Flags& flags,
@@ -140,9 +137,7 @@ struct SegmentedScan< Devices::Host, Type >
     *
     * \include SegmentedScanExample.out
     */
-   template< typename Vector,
-             typename Reduction,
-             typename Flags >
+   template< typename Vector, typename Reduction, typename Flags >
    static void
    perform( Vector& v,
             Flags& flags,
@@ -187,9 +182,7 @@ struct SegmentedScan< Devices::Cuda, Type >
     *
     * **Note: Segmented scan is not implemented for CUDA yet.**
     */
-   template< typename Vector,
-             typename Reduction,
-             typename Flags >
+   template< typename Vector, typename Reduction, typename Flags >
    static void
    perform( Vector& v,
             Flags& flags,
@@ -199,7 +192,7 @@ struct SegmentedScan< Devices::Cuda, Type >
             const typename Vector::ValueType identity );
 };
 
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace Algorithms
+}  // namespace TNL
 
 #include <TNL/Algorithms/SegmentedScan.hpp>
diff --git a/src/TNL/Algorithms/SegmentedScan.hpp b/src/TNL/Algorithms/SegmentedScan.hpp
index 170b6997ee5146bc30d437f229698d00e8238150..50b8b33fb902850cb3e3f9a3cbd129ade12be3e5 100644
--- a/src/TNL/Algorithms/SegmentedScan.hpp
+++ b/src/TNL/Algorithms/SegmentedScan.hpp
@@ -16,33 +16,28 @@ namespace TNL {
 namespace Algorithms {
 
 template< detail::ScanType Type >
-   template< typename Vector,
-             typename Reduction,
-             typename Flags >
+template< typename Vector, typename Reduction, typename Flags >
 void
-SegmentedScan< Devices::Sequential, Type >::
-perform( Vector& v,
-         Flags& flags,
-         const typename Vector::IndexType begin,
-         const typename Vector::IndexType end,
-         const Reduction& reduction,
-         const typename Vector::ValueType identity )
+SegmentedScan< Devices::Sequential, Type >::perform( Vector& v,
+                                                     Flags& flags,
+                                                     const typename Vector::IndexType begin,
+                                                     const typename Vector::IndexType end,
+                                                     const Reduction& reduction,
+                                                     const typename Vector::ValueType identity )
 {
    using ValueType = typename Vector::ValueType;
    using IndexType = typename Vector::IndexType;
 
-   if( Type == detail::ScanType::Inclusive )
-   {
+   if( Type == detail::ScanType::Inclusive ) {
       for( IndexType i = begin + 1; i < end; i++ )
          if( ! flags[ i ] )
             v[ i ] = reduction( v[ i ], v[ i - 1 ] );
    }
-   else // Exclusive scan
+   else  // Exclusive scan
    {
       ValueType aux( v[ begin ] );
       v[ begin ] = identity;
-      for( IndexType i = begin + 1; i < end; i++ )
-      {
+      for( IndexType i = begin + 1; i < end; i++ ) {
          ValueType x = v[ i ];
          if( flags[ i ] )
             aux = identity;
@@ -53,17 +48,14 @@ perform( Vector& v,
 }
 
 template< detail::ScanType Type >
-   template< typename Vector,
-             typename Reduction,
-             typename Flags >
+template< typename Vector, typename Reduction, typename Flags >
 void
-SegmentedScan< Devices::Host, Type >::
-perform( Vector& v,
-         Flags& flags,
-         const typename Vector::IndexType begin,
-         const typename Vector::IndexType end,
-         const Reduction& reduction,
-         const typename Vector::ValueType identity )
+SegmentedScan< Devices::Host, Type >::perform( Vector& v,
+                                               Flags& flags,
+                                               const typename Vector::IndexType begin,
+                                               const typename Vector::IndexType end,
+                                               const Reduction& reduction,
+                                               const typename Vector::ValueType identity )
 {
 #ifdef HAVE_OPENMP
    // TODO: parallelize with OpenMP
@@ -74,17 +66,14 @@ perform( Vector& v,
 }
 
 template< detail::ScanType Type >
-   template< typename Vector,
-             typename Reduction,
-             typename Flags >
+template< typename Vector, typename Reduction, typename Flags >
 void
-SegmentedScan< Devices::Cuda, Type >::
-perform( Vector& v,
-         Flags& flags,
-         const typename Vector::IndexType begin,
-         const typename Vector::IndexType end,
-         const Reduction& reduction,
-         const typename Vector::ValueType identity )
+SegmentedScan< Devices::Cuda, Type >::perform( Vector& v,
+                                               Flags& flags,
+                                               const typename Vector::IndexType begin,
+                                               const typename Vector::IndexType end,
+                                               const Reduction& reduction,
+                                               const typename Vector::ValueType identity )
 {
 #ifdef HAVE_CUDA
    using ValueType = typename Vector::ValueType;
@@ -96,5 +85,5 @@ perform( Vector& v,
 #endif
 }
 
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/BiEllpack.h b/src/TNL/Algorithms/Segments/BiEllpack.h
index 3cec8ccff3e41ec8dd964fc0ecc8bc37c6378c66..820fdbef5956eb852b89bada56d5e4ab0699c991 100644
--- a/src/TNL/Algorithms/Segments/BiEllpack.h
+++ b/src/TNL/Algorithms/Segments/BiEllpack.h
@@ -11,188 +11,231 @@
 #include <TNL/Algorithms/Segments/BiEllpackView.h>
 #include <TNL/Algorithms/Segments/SegmentView.h>
 
-namespace TNL
-{
-   namespace Algorithms
-   {
-      namespace Segments
-      {
-
-template <typename Device,
-            typename Index,
-            typename IndexAllocator = typename Allocators::Default<Device>::template Allocator<Index>,
-            ElementsOrganization Organization = Algorithms::Segments::DefaultElementsOrganization<Device>::getOrganization(),
-            int WarpSize = 32>
+namespace TNL {
+namespace Algorithms {
+namespace Segments {
+
+template< typename Device,
+          typename Index,
+          typename IndexAllocator = typename Allocators::Default< Device >::template Allocator< Index >,
+          ElementsOrganization Organization = Algorithms::Segments::DefaultElementsOrganization< Device >::getOrganization(),
+          int WarpSize = 32 >
 class BiEllpack
 {
-   public:
-      using DeviceType = Device;
-      using IndexType = std::remove_const_t<Index>;
-      using OffsetsContainer = Containers::Vector< IndexType, DeviceType, IndexType, IndexAllocator>;
-      static constexpr ElementsOrganization getOrganization() { return Organization; }
-      using ViewType = BiEllpackView< Device, Index, Organization, WarpSize >;
-      template <typename Device_, typename Index_>
-      using ViewTemplate = BiEllpackView<Device_, Index_, Organization, WarpSize >;
-      using ConstViewType = typename ViewType::ConstViewType;
-      using SegmentViewType = typename ViewType::SegmentViewType;
-
-      static constexpr bool havePadding() { return true; };
-
-      BiEllpack() = default;
-
-      template< typename SizesContainer >
-      BiEllpack( const SizesContainer& sizes );
-
-      template< typename ListIndex >
-      BiEllpack( const std::initializer_list< ListIndex >& segmentsSizes );
-
-      BiEllpack( const BiEllpack& segments ) = default;
-
-      BiEllpack( BiEllpack&& segments ) = default;
-
-      static String getSerializationType();
-
-      static String getSegmentsType();
-
-      ViewType getView();
-
-      const ConstViewType getConstView() const;
-
-      /**
-       * \brief Number of segments.
-       */
-      __cuda_callable__
-            IndexType
-            getSegmentsCount() const;
-
-      /**
-       * \brief Set sizes of particular segments.
-       */
-      template <typename SizesHolder = OffsetsContainer>
-      void setSegmentsSizes(const SizesHolder &sizes);
-
-      void reset();
-
-      IndexType getSegmentSize(const IndexType segmentIdx) const;
-
-      /**
-       * \brief Number segments.
-       */
-      __cuda_callable__
-            IndexType
-            getSize() const;
-
-      __cuda_callable__
-            IndexType
-            getStorageSize() const;
-
-      __cuda_callable__
-            IndexType
-            getGlobalIndex(const IndexType segmentIdx, const IndexType localIdx) const;
-
-      __cuda_callable__
-            SegmentViewType
-            getSegmentView(const IndexType segmentIdx) const;
-
-      /***
-       * \brief Go over all segments and for each segment element call
-       * function 'f' with arguments 'args'. The return type of 'f' is bool.
-       * When its true, the for-loop continues. Once 'f' returns false, the for-loop
-       * is terminated.
-       */
-      template< typename Function >
-      void forElements( IndexType first, IndexType last, Function&& f ) const;
-
-      template <typename Function>
-      void forAllElements(Function&& f ) const;
-
-      template <typename Function>
-      void forSegments(IndexType begin, IndexType end, Function&& f ) const;
-
-      template <typename Function>
-      void forAllSegments( Function&& f ) const;
-
-      /***
-       * \brief Go over all segments and perform a reduction in each of them.
-       */
-      template <typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
-      void reduceSegments(IndexType first, IndexType last, Fetch &fetch, const Reduction &reduction, ResultKeeper &keeper, const Real &zero ) const;
-
-      template <typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
-      void reduceAllSegments(Fetch &fetch, const Reduction &reduction, ResultKeeper &keeper, const Real &zero ) const;
-
-      BiEllpack &operator=(const BiEllpack &source) = default;
-
-      template <typename Device_, typename Index_, typename IndexAllocator_, ElementsOrganization Organization_>
-      BiEllpack &operator=(const BiEllpack<Device_, Index_, IndexAllocator_, Organization_, WarpSize> &source);
-
-      void save(File &file) const;
-
-      void load(File &file);
-
-      template< typename Fetch >
-      SegmentsPrinter< BiEllpack, Fetch > print( Fetch&& fetch ) const;
-
-      void printStructure(std::ostream &str) const;
-
-      // TODO: nvcc needs this public because of lambda function used inside
-      template <typename SizesHolder = OffsetsContainer>
-      void performRowBubbleSort(const SizesHolder &segmentsSize);
-
-      // TODO: the same as  above
-      template <typename SizesHolder = OffsetsContainer>
-      void computeColumnSizes(const SizesHolder &segmentsSizes);
-
-   protected:
-      static constexpr int getWarpSize() { return WarpSize; };
-
-      static constexpr int getLogWarpSize() { return std::log2(WarpSize); };
+public:
+   using DeviceType = Device;
+   using IndexType = std::remove_const_t< Index >;
+   using OffsetsContainer = Containers::Vector< IndexType, DeviceType, IndexType, IndexAllocator >;
+   static constexpr ElementsOrganization
+   getOrganization()
+   {
+      return Organization;
+   }
+   using ViewType = BiEllpackView< Device, Index, Organization, WarpSize >;
+   template< typename Device_, typename Index_ >
+   using ViewTemplate = BiEllpackView< Device_, Index_, Organization, WarpSize >;
+   using ConstViewType = typename ViewType::ConstViewType;
+   using SegmentViewType = typename ViewType::SegmentViewType;
+
+   static constexpr bool
+   havePadding()
+   {
+      return true;
+   };
+
+   BiEllpack() = default;
+
+   template< typename SizesContainer >
+   BiEllpack( const SizesContainer& sizes );
+
+   template< typename ListIndex >
+   BiEllpack( const std::initializer_list< ListIndex >& segmentsSizes );
+
+   BiEllpack( const BiEllpack& segments ) = default;
+
+   BiEllpack( BiEllpack&& segments ) noexcept = default;
+
+   static std::string
+   getSerializationType();
+
+   static String
+   getSegmentsType();
+
+   ViewType
+   getView();
+
+   const ConstViewType
+   getConstView() const;
+
+   /**
+    * \brief Number of segments.
+    */
+   __cuda_callable__
+   IndexType
+   getSegmentsCount() const;
+
+   /**
+    * \brief Set sizes of particular segments.
+    */
+   template< typename SizesHolder = OffsetsContainer >
+   void
+   setSegmentsSizes( const SizesHolder& sizes );
+
+   void
+   reset();
+
+   IndexType
+   getSegmentSize( IndexType segmentIdx ) const;
+
+   /**
+    * \brief Number segments.
+    */
+   __cuda_callable__
+   IndexType
+   getSize() const;
+
+   __cuda_callable__
+   IndexType
+   getStorageSize() const;
+
+   __cuda_callable__
+   IndexType
+   getGlobalIndex( IndexType segmentIdx, IndexType localIdx ) const;
+
+   __cuda_callable__
+   SegmentViewType
+   getSegmentView( IndexType segmentIdx ) const;
+
+   /***
+    * \brief Go over all segments and for each segment element call
+    * function 'f' with arguments 'args'. The return type of 'f' is bool.
+    * When its true, the for-loop continues. Once 'f' returns false, the for-loop
+    * is terminated.
+    */
+   template< typename Function >
+   void
+   forElements( IndexType first, IndexType last, Function&& f ) const;
+
+   template< typename Function >
+   void
+   forAllElements( Function&& f ) const;
+
+   template< typename Function >
+   void
+   forSegments( IndexType begin, IndexType end, Function&& f ) const;
+
+   template< typename Function >
+   void
+   forAllSegments( Function&& f ) const;
+
+   /***
+    * \brief Go over all segments and perform a reduction in each of them.
+    */
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+   void
+   reduceSegments( IndexType first,
+                   IndexType last,
+                   Fetch& fetch,
+                   const Reduction& reduction,
+                   ResultKeeper& keeper,
+                   const Real& zero ) const;
+
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+   void
+   reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
+
+   BiEllpack&
+   operator=( const BiEllpack& source ) = default;
+
+   template< typename Device_, typename Index_, typename IndexAllocator_, ElementsOrganization Organization_ >
+   BiEllpack&
+   operator=( const BiEllpack< Device_, Index_, IndexAllocator_, Organization_, WarpSize >& source );
+
+   void
+   save( File& file ) const;
+
+   void
+   load( File& file );
+
+   template< typename Fetch >
+   SegmentsPrinter< BiEllpack, Fetch >
+   print( Fetch&& fetch ) const;
+
+   void
+   printStructure( std::ostream& str ) const;
+
+   // TODO: nvcc needs this public because of lambda function used inside
+   template< typename SizesHolder = OffsetsContainer >
+   void
+   performRowBubbleSort( const SizesHolder& segmentsSize );
+
+   // TODO: the same as  above
+   template< typename SizesHolder = OffsetsContainer >
+   void
+   computeColumnSizes( const SizesHolder& segmentsSizes );
+
+protected:
+   static constexpr int
+   getWarpSize()
+   {
+      return WarpSize;
+   };
 
-      template <typename SizesHolder = OffsetsContainer>
-      void verifyRowPerm(const SizesHolder &segmentsSizes);
+   static constexpr int
+   getLogWarpSize()
+   {
+      return std::log2( WarpSize );
+   };
 
-      template <typename SizesHolder = OffsetsContainer>
-      void verifyRowLengths(const SizesHolder &segmentsSizes);
+   template< typename SizesHolder = OffsetsContainer >
+   void
+   verifyRowPerm( const SizesHolder& segmentsSizes );
 
-      IndexType getStripLength(const IndexType stripIdx) const;
+   template< typename SizesHolder = OffsetsContainer >
+   void
+   verifyRowLengths( const SizesHolder& segmentsSizes );
 
-      IndexType getGroupLength(const IndexType strip, const IndexType group) const;
+   IndexType
+   getStripLength( IndexType stripIdx ) const;
 
-      IndexType size = 0, storageSize = 0;
+   IndexType
+   getGroupLength( IndexType strip, IndexType group ) const;
 
-      IndexType virtualRows = 0;
+   IndexType size = 0, storageSize = 0;
 
-      OffsetsContainer rowPermArray;
+   IndexType virtualRows = 0;
 
-      OffsetsContainer groupPointers;
+   OffsetsContainer rowPermArray;
 
-      // TODO: Replace later
-      __cuda_callable__ Index power(const IndexType number, const IndexType exponent) const
-      {
-         if (exponent >= 0)
-         {
-            IndexType result = 1;
-            for (IndexType i = 0; i < exponent; i++)
-               result *= number;
-            return result;
-         }
-         return 0;
-      };
+   OffsetsContainer groupPointers;
 
-      template <typename Device_, typename Index_, typename IndexAllocator_, ElementsOrganization Organization_, int WarpSize_>
-      friend class BiEllpack;
+   // TODO: Replace later
+   __cuda_callable__
+   Index
+   power( const IndexType number, const IndexType exponent ) const
+   {
+      if( exponent >= 0 ) {
+         IndexType result = 1;
+         for( IndexType i = 0; i < exponent; i++ )
+            result *= number;
+         return result;
+      }
+      return 0;
+   };
+
+   template< typename Device_, typename Index_, typename IndexAllocator_, ElementsOrganization Organization_, int WarpSize_ >
+   friend class BiEllpack;
 };
 
-template <typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-std::ostream& operator<<( std::ostream& str, const BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >& segments ) { return printSegments( segments, str ); }
-
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+std::ostream&
+operator<<( std::ostream& str, const BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >& segments )
+{
+   return printSegments( segments, str );
+}
 
-      } // namespace Segments
-   }    // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
 
 #include <TNL/Algorithms/Segments/BiEllpack.hpp>
diff --git a/src/TNL/Algorithms/Segments/BiEllpack.hpp b/src/TNL/Algorithms/Segments/BiEllpack.hpp
index 6a8b47915d771766d04476430204e4deb7461216..96a205defa7ca29413f9be589e22e1c190db2f4d 100644
--- a/src/TNL/Algorithms/Segments/BiEllpack.hpp
+++ b/src/TNL/Algorithms/Segments/BiEllpack.hpp
@@ -6,7 +6,6 @@
 
 #pragma once
 
-#include <math.h>
 #include <TNL/Containers/Vector.h>
 #include <TNL/Algorithms/ParallelFor.h>
 #include <TNL/Algorithms/scan.h>
@@ -14,148 +13,109 @@
 #include <TNL/Algorithms/Segments/Ellpack.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
-
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-   template< typename SizesContainer >
-BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-BiEllpack( const SizesContainer& segmentsSizes )
+namespace Algorithms {
+namespace Segments {
+
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+template< typename SizesContainer >
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::BiEllpack( const SizesContainer& segmentsSizes )
 {
    this->setSegmentsSizes( segmentsSizes );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-   template< typename ListIndex >
-BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-BiEllpack( const std::initializer_list< ListIndex >& segmentsSizes )
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+template< typename ListIndex >
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::BiEllpack(
+   const std::initializer_list< ListIndex >& segmentsSizes )
 {
    this->setSegmentsSizes( Containers::Vector< IndexType, DeviceType, IndexType >( segmentsSizes ) );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-String
-BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-getSerializationType()
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+std::string
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::getSerializationType()
 {
-   // FIXME: the serialized data DEPEND on the Organization and WarpSize parameters, so it should be reflected in the serialization type
+   // FIXME: the serialized data DEPEND on the Organization and WarpSize parameters, so it should be reflected in the
+   // serialization type
    return "BiEllpack< [any_device], " + TNL::getSerializationType< IndexType >() + " >";
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
 String
-BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-getSegmentsType()
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::getSegmentsType()
 {
    return ViewType::getSegmentsType();
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
 typename BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::ViewType
-BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-getView()
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::getView()
 {
    return ViewType( size, storageSize, virtualRows, rowPermArray.getView(), groupPointers.getView() );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-auto BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-getConstView() const -> const ConstViewType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+auto
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::getConstView() const -> const ConstViewType
 {
    return ConstViewType( size, storageSize, virtualRows, rowPermArray.getConstView(), groupPointers.getConstView() );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-auto BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-getSegmentsCount() const -> IndexType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+auto
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::getSegmentsCount() const -> IndexType
 {
    return this->size;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-   template< typename SizesHolder >
-void BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-performRowBubbleSort( const SizesHolder& segmentsSizes )
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+template< typename SizesHolder >
+void
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::performRowBubbleSort( const SizesHolder& segmentsSizes )
 {
    if( segmentsSizes.getSize() == 0 )
       return;
 
-   this->rowPermArray.forAllElements( [] __cuda_callable__ ( const IndexType idx, IndexType& value ) { value = idx; } );
+   this->rowPermArray.forAllElements(
+      [] __cuda_callable__( const IndexType idx, IndexType& value )
+      {
+         value = idx;
+      } );
 
-   //if( std::is_same< DeviceType, Devices::Host >::value )
+   // if( std::is_same< DeviceType, Devices::Host >::value )
    {
       IndexType strips = this->virtualRows / getWarpSize();
-      for( IndexType i = 0; i < strips; i++ )
-      {
+      for( IndexType i = 0; i < strips; i++ ) {
          IndexType begin = i * getWarpSize();
          IndexType end = ( i + 1 ) * getWarpSize() - 1;
-         if(this->getSize() - 1 < end)
+         if( this->getSize() - 1 < end )
             end = this->getSize() - 1;
          bool sorted = false;
          IndexType permIndex1, permIndex2, offset = 0;
-         while( !sorted )
-         {
+         while( ! sorted ) {
             sorted = true;
-            for( IndexType j = begin + offset; j < end - offset; j++ )
-            {
-               for( IndexType k = begin; k < end + 1; k++ )
-               {
+            for( IndexType j = begin + offset; j < end - offset; j++ ) {
+               for( IndexType k = begin; k < end + 1; k++ ) {
                   if( this->rowPermArray.getElement( k ) == j )
                      permIndex1 = k;
                   if( this->rowPermArray.getElement( k ) == j + 1 )
                      permIndex2 = k;
                }
-               if( segmentsSizes.getElement( permIndex1 ) < segmentsSizes.getElement( permIndex2 ) )
-               {
+               if( segmentsSizes.getElement( permIndex1 ) < segmentsSizes.getElement( permIndex2 ) ) {
                   IndexType temp = this->rowPermArray.getElement( permIndex1 );
                   this->rowPermArray.setElement( permIndex1, this->rowPermArray.getElement( permIndex2 ) );
                   this->rowPermArray.setElement( permIndex2, temp );
                   sorted = false;
                }
             }
-            for( IndexType j = end - 1 - offset; j > begin + offset; j-- )
-            {
-               for( IndexType k = begin; k < end + 1; k++ )
-               {
+            for( IndexType j = end - 1 - offset; j > begin + offset; j-- ) {
+               for( IndexType k = begin; k < end + 1; k++ ) {
                   if( this->rowPermArray.getElement( k ) == j )
                      permIndex1 = k;
                   if( this->rowPermArray.getElement( k ) == j - 1 )
                      permIndex2 = k;
                }
-               if( segmentsSizes.getElement( permIndex2 ) < segmentsSizes.getElement( permIndex1 ) )
-               {
+               if( segmentsSizes.getElement( permIndex2 ) < segmentsSizes.getElement( permIndex1 ) ) {
                   IndexType temp = this->rowPermArray.getElement( permIndex1 );
                   this->rowPermArray.setElement( permIndex1, this->rowPermArray.getElement( permIndex2 ) );
                   this->rowPermArray.setElement( permIndex2, temp );
@@ -168,29 +128,25 @@ performRowBubbleSort( const SizesHolder& segmentsSizes )
    }
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-   template< typename SizesHolder >
-void BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-computeColumnSizes( const SizesHolder& segmentsSizes )
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+template< typename SizesHolder >
+void
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::computeColumnSizes( const SizesHolder& segmentsSizes )
 {
    IndexType numberOfStrips = this->virtualRows / getWarpSize();
    auto groupPointersView = this->groupPointers.getView();
    auto segmentsPermutationView = this->rowPermArray.getView();
    auto segmentsSizesView = segmentsSizes.getConstView();
    const IndexType size = this->getSize();
-   auto createGroups = [=] __cuda_callable__ ( const IndexType strip ) mutable {
+   auto createGroups = [ = ] __cuda_callable__( const IndexType strip ) mutable
+   {
       IndexType firstSegment = strip * getWarpSize();
       IndexType groupBegin = strip * ( getLogWarpSize() + 1 );
       IndexType emptyGroups = 0;
 
       ////
       // The last strip can be shorter
-      if( strip == numberOfStrips - 1 )
-      {
+      if( strip == numberOfStrips - 1 ) {
          IndexType segmentsCount = size - firstSegment;
          while( segmentsCount <= TNL::pow( 2, getLogWarpSize() - 1 - emptyGroups ) - 1 )
             emptyGroups++;
@@ -199,8 +155,7 @@ computeColumnSizes( const SizesHolder& segmentsSizes )
       }
 
       IndexType allocatedColumns = 0;
-      for( IndexType groupIdx = emptyGroups; groupIdx < getLogWarpSize(); groupIdx++ )
-      {
+      for( IndexType groupIdx = emptyGroups; groupIdx < getLogWarpSize(); groupIdx++ ) {
          IndexType segmentIdx = TNL::pow( 2, getLogWarpSize() - 1 - groupIdx ) - 1;
          IndexType permSegm = 0;
          while( segmentsPermutationView[ permSegm + firstSegment ] != segmentIdx + firstSegment )
@@ -212,45 +167,36 @@ computeColumnSizes( const SizesHolder& segmentsSizes )
          groupPointersView[ groupIdx + groupBegin ] = groupSize;
       }
    };
-   Algorithms::ParallelFor< DeviceType >::exec( ( IndexType ) 0, this->virtualRows / getWarpSize(), createGroups );
+   Algorithms::ParallelFor< DeviceType >::exec( (IndexType) 0, this->virtualRows / getWarpSize(), createGroups );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-   template< typename SizesHolder >
-void BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-verifyRowPerm( const SizesHolder& segmentsSizes )
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+template< typename SizesHolder >
+void
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::verifyRowPerm( const SizesHolder& segmentsSizes )
 {
    bool ok = true;
    IndexType numberOfStrips = this->virtualRows / getWarpSize();
-   for( IndexType strip = 0; strip < numberOfStrips; strip++ )
-   {
+   for( IndexType strip = 0; strip < numberOfStrips; strip++ ) {
       IndexType begin = strip * getWarpSize();
       IndexType end = ( strip + 1 ) * getWarpSize();
       if( this->getSize() < end )
          end = this->getSize();
-      for( IndexType i = begin; i < end - 1; i++ )
-      {
+      for( IndexType i = begin; i < end - 1; i++ ) {
          IndexType permIndex1, permIndex2;
          bool first = false;
          bool second = false;
-         for( IndexType j = begin; j < end; j++ )
-         {
-            if( this->rowPermArray.getElement( j ) == i )
-            {
+         for( IndexType j = begin; j < end; j++ ) {
+            if( this->rowPermArray.getElement( j ) == i ) {
                permIndex1 = j;
                first = true;
             }
-            if( this->rowPermArray.getElement( j ) == i + 1 )
-            {
+            if( this->rowPermArray.getElement( j ) == i + 1 ) {
                permIndex2 = j;
                second = true;
             }
          }
-         if( !first || !second )
+         if( ! first || ! second )
             std::cout << "Wrong permutation!" << std::endl;
          if( segmentsSizes.getElement( permIndex1 ) >= segmentsSizes.getElement( permIndex2 ) )
             continue;
@@ -258,22 +204,17 @@ verifyRowPerm( const SizesHolder& segmentsSizes )
             ok = false;
       }
    }
-   if( !ok )
+   if( ! ok )
       throw( std::logic_error( "Segments permutation verification failed." ) );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-   template< typename SizesHolder >
-void BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-verifyRowLengths( const SizesHolder& segmentsSizes )
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+template< typename SizesHolder >
+void
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::verifyRowLengths( const SizesHolder& segmentsSizes )
 {
    std::cerr << "segmentsSizes = " << segmentsSizes << std::endl;
-   for( IndexType segmentIdx = 0; segmentIdx < this->getSize(); segmentIdx++ )
-   {
+   for( IndexType segmentIdx = 0; segmentIdx < this->getSize(); segmentIdx++ ) {
       const IndexType strip = segmentIdx / getWarpSize();
       const IndexType stripLength = this->getStripLength( strip );
       const IndexType groupBegin = ( getLogWarpSize() + 1 ) * strip;
@@ -281,15 +222,13 @@ verifyRowLengths( const SizesHolder& segmentsSizes )
       const IndexType begin = this->groupPointers.getElement( groupBegin ) * getWarpSize() + rowStripPerm * stripLength;
       IndexType elementPtr = begin;
       IndexType rowLength = 0;
-      const IndexType groupsCount = detail::BiEllpack< Index, Device, Organization, WarpSize >::getActiveGroupsCount( this->rowPermArray.getConstView(), segmentIdx );
-      for( IndexType group = 0; group < groupsCount; group++ )
-      {
+      const IndexType groupsCount = detail::BiEllpack< Index, Device, Organization, WarpSize >::getActiveGroupsCount(
+         this->rowPermArray.getConstView(), segmentIdx );
+      for( IndexType group = 0; group < groupsCount; group++ ) {
          std::cerr << "groupIdx = " << group << " groupLength = " << this->getGroupLength( strip, group ) << std::endl;
-         for( IndexType i = 0; i < this->getGroupLength( strip, group ); i++ )
-         {
+         for( IndexType i = 0; i < this->getGroupLength( strip, group ); i++ ) {
             IndexType biElementPtr = elementPtr;
-            for( IndexType j = 0; j < this->power( 2, group ); j++ )
-            {
+            for( IndexType j = 0; j < this->power( 2, group ); j++ ) {
                rowLength++;
                biElementPtr += this->power( 2, getLogWarpSize() - group ) * stripLength;
             }
@@ -301,18 +240,12 @@ verifyRowLengths( const SizesHolder& segmentsSizes )
    }
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-   template< typename SizesHolder >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+template< typename SizesHolder >
 void
-BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-setSegmentsSizes( const SizesHolder& segmentsSizes )
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::setSegmentsSizes( const SizesHolder& segmentsSizes )
 {
-   if( std::is_same< DeviceType, Devices::Host >::value )
-   {
+   if( std::is_same< DeviceType, Devices::Host >::value ) {
       this->size = segmentsSizes.getSize();
       if( this->size % WarpSize != 0 )
          this->virtualRows = this->size + getWarpSize() - ( this->size % getWarpSize() );
@@ -329,12 +262,15 @@ setSegmentsSizes( const SizesHolder& segmentsSizes )
       inplaceExclusiveScan( this->groupPointers );
 
       this->verifyRowPerm( segmentsSizes );
-      //this->verifyRowLengths( segmentsSizes ); // TODO: I am not sure what this test is doing.
-      this->storageSize =  getWarpSize() * this->groupPointers.getElement( strips * ( getLogWarpSize() + 1 ) );
+      // this->verifyRowLengths( segmentsSizes ); // TODO: I am not sure what this test is doing.
+      this->storageSize = getWarpSize() * this->groupPointers.getElement( strips * ( getLogWarpSize() + 1 ) );
    }
-   else
-   {
-      BiEllpack< Devices::Host, Index, typename Allocators::Default< Devices::Host >::template Allocator< IndexType >, Organization > hostSegments;
+   else {
+      BiEllpack< Devices::Host,
+                 Index,
+                 typename Allocators::Default< Devices::Host >::template Allocator< IndexType >,
+                 Organization >
+         hostSegments;
       Containers::Vector< IndexType, Devices::Host, IndexType > hostSegmentsSizes;
       hostSegmentsSizes = segmentsSizes;
       hostSegments.setSegmentsSizes( hostSegmentsSizes );
@@ -342,14 +278,9 @@ setSegmentsSizes( const SizesHolder& segmentsSizes )
    }
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
 void
-BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-reset()
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::reset()
 {
    this->size = 0;
    this->storageSize = 0;
@@ -358,155 +289,114 @@ reset()
    groupPointers.reset();
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-auto BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-getSegmentSize( const IndexType segmentIdx ) const -> IndexType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+auto
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::getSegmentSize( const IndexType segmentIdx ) const
+   -> IndexType
 {
    return detail::BiEllpack< IndexType, DeviceType, Organization >::getSegmentSize(
-      rowPermArray.getConstView(),
-      groupPointers.getConstView(),
-      segmentIdx );
+      rowPermArray.getConstView(), groupPointers.getConstView(), segmentIdx );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-__cuda_callable__ auto BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-getSize() const -> IndexType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+__cuda_callable__
+auto
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::getSize() const -> IndexType
 {
    return this->size;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-__cuda_callable__ auto BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-getStorageSize() const -> IndexType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+__cuda_callable__
+auto
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::getStorageSize() const -> IndexType
 {
    return this->storageSize;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-__cuda_callable__ auto BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-getGlobalIndex( const IndexType segmentIdx, const IndexType localIdx ) const -> IndexType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+__cuda_callable__
+auto
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::getGlobalIndex( const IndexType segmentIdx,
+                                                                                    const IndexType localIdx ) const
+   -> IndexType
 {
-      return detail::BiEllpack< IndexType, DeviceType, Organization >::getGlobalIndex(
-         rowPermArray.getConstView(),
-         groupPointers.getConstView(),
-         segmentIdx,
-         localIdx );
+   return detail::BiEllpack< IndexType, DeviceType, Organization >::getGlobalIndex(
+      rowPermArray.getConstView(), groupPointers.getConstView(), segmentIdx, localIdx );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-__cuda_callable__ auto BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType
-{
-}
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+__cuda_callable__
+auto
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::getSegmentView( const IndexType segmentIdx ) const
+   -> SegmentViewType
+{}
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-   template< typename Function >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+template< typename Function >
 void
-BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-forElements( IndexType first, IndexType last, Function&& f ) const
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::forElements( IndexType first,
+                                                                                 IndexType last,
+                                                                                 Function&& f ) const
 {
    this->getConstView().forElements( first, last, f );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-   template< typename Function >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+template< typename Function >
 void
-BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-forAllElements( Function&& f ) const
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::forAllElements( Function&& f ) const
 {
    this->forElements( 0, this->getSegmentsCount(), f );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-   template< typename Function >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+template< typename Function >
 void
-BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-forSegments( IndexType begin, IndexType end, Function&& f ) const
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::forSegments( IndexType begin,
+                                                                                 IndexType end,
+                                                                                 Function&& f ) const
 {
    this->getConstView().forSegments( begin, end, f );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-   template< typename Function >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+template< typename Function >
 void
-BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-forAllSegments( Function&& f ) const
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::forAllSegments( Function&& f ) const
 {
    this->getConstView().forAllSegments( f );
 }
 
-
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
 void
-BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-reduceSegments( IndexType first, IndexType last, Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::reduceSegments( IndexType first,
+                                                                                    IndexType last,
+                                                                                    Fetch& fetch,
+                                                                                    const Reduction& reduction,
+                                                                                    ResultKeeper& keeper,
+                                                                                    const Real& zero ) const
 {
    this->getConstView().reduceSegments( first, last, fetch, reduction, keeper, zero );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
 void
-BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::reduceAllSegments( Fetch& fetch,
+                                                                                       const Reduction& reduction,
+                                                                                       ResultKeeper& keeper,
+                                                                                       const Real& zero ) const
 {
    this->reduceSegments( 0, this->getSegmentsCount(), fetch, reduction, keeper, zero );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-   template< typename Device_, typename Index_, typename IndexAllocator_, ElementsOrganization Organization_ >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+template< typename Device_, typename Index_, typename IndexAllocator_, ElementsOrganization Organization_ >
 BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >&
-BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-operator=( const BiEllpack< Device_, Index_, IndexAllocator_, Organization_, WarpSize >& source )
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::operator=(
+   const BiEllpack< Device_, Index_, IndexAllocator_, Organization_, WarpSize >& source )
 {
    this->size = source.size;
    this->storageSize = source.storageSize;
@@ -516,86 +406,60 @@ operator=( const BiEllpack< Device_, Index_, IndexAllocator_, Organization_, War
    return *this;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
 void
-BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-save( File& file ) const
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::save( File& file ) const
 {
    file.save( &this->size );
    file.save( &this->storageSize );
    file.save( &this->virtualRows );
-   file << this->rowPermArray
-        << this->groupPointers;
+   file << this->rowPermArray << this->groupPointers;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
 void
-BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-load( File& file )
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::load( File& file )
 {
    file.load( &this->size );
    file.load( &this->storageSize );
    file.load( &this->virtualRows );
-   file >> this->rowPermArray
-        >> this->groupPointers;
+   file >> this->rowPermArray >> this->groupPointers;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-      template< typename Fetch >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+template< typename Fetch >
 auto
-BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-print( Fetch&& fetch ) const -> SegmentsPrinter< BiEllpack, Fetch >
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::print( Fetch&& fetch ) const
+   -> SegmentsPrinter< BiEllpack, Fetch >
 {
    return SegmentsPrinter< BiEllpack, Fetch >( *this, fetch );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
 void
-BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-printStructure( std::ostream& str ) const
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::printStructure( std::ostream& str ) const
 {
    this->view.printStructure( str );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-auto BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-getStripLength( const IndexType stripIdx ) const -> IndexType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+auto
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::getStripLength( const IndexType stripIdx ) const
+   -> IndexType
 {
-   return detail::BiEllpack< Index, Device, Organization, WarpSize >::getStripLength( this->groupPointers.getConstView(), stripIdx );
+   return detail::BiEllpack< Index, Device, Organization, WarpSize >::getStripLength( this->groupPointers.getConstView(),
+                                                                                      stripIdx );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int WarpSize >
-auto BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
-getGroupLength( const IndexType strip, const IndexType group ) const -> IndexType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int WarpSize >
+auto
+BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::getGroupLength( const IndexType strip,
+                                                                                    const IndexType group ) const -> IndexType
 {
    return this->groupPointers.getElement( strip * ( getLogWarpSize() + 1 ) + group + 1 )
-           - this->groupPointers.getElement( strip * ( getLogWarpSize() + 1 ) + group );
+        - this->groupPointers.getElement( strip * ( getLogWarpSize() + 1 ) + group );
 }
 
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/BiEllpackSegmentView.h b/src/TNL/Algorithms/Segments/BiEllpackSegmentView.h
index 84b95e8930579cb40ffa5693278cb82ed0e72b59..b09e04f03256cf6a37bb11fed4e432c89cda0b45 100644
--- a/src/TNL/Algorithms/Segments/BiEllpackSegmentView.h
+++ b/src/TNL/Algorithms/Segments/BiEllpackSegmentView.h
@@ -6,89 +6,98 @@
 
 #pragma once
 
-#include <math.h>
 #include <TNL/Algorithms/Segments/ElementsOrganization.h>
 #include <TNL/Containers/StaticVector.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
-template< typename Index,
-          ElementsOrganization Organization,
-          int WarpSize = 32 >
+template< typename Index, ElementsOrganization Organization, int WarpSize = 32 >
 class BiEllpackSegmentView
 {
-   public:
-
-      static constexpr int getWarpSize() { return WarpSize; };
-
-      static constexpr int getLogWarpSize() { static_assert( WarpSize == 32, "nvcc does not allow constexpr log2" ); return 5; }// TODO: return std::log2( WarpSize ); };
-
-      static constexpr int getGroupsCount() { return getLogWarpSize() + 1; };
-
-      using IndexType = Index;
-      using GroupsWidthType = Containers::StaticVector< getGroupsCount(), IndexType >;
-
-
-      /**
-       * \brief Constructor.
-       *
-       * \param offset is offset of the first group of the strip the segment belongs to.
-       * \param size is the segment size
-       * \param inStripIdx is index of the segment within its strip.
-       * \param groupsWidth is a static vector containing widths of the strip groups
-       */
-      __cuda_callable__
-      BiEllpackSegmentView( const IndexType segmentIdx,
-                            const IndexType offset,
-                            const IndexType inStripIdx,
-                            const GroupsWidthType& groupsWidth )
-      : segmentIdx( segmentIdx ), groupOffset( offset ), inStripIdx( inStripIdx ), segmentSize( TNL::sum( groupsWidth ) ), groupsWidth( groupsWidth ){};
-
-      __cuda_callable__
-      IndexType getSize() const
-      {
-         return this->segmentSize;
-      };
-
-      __cuda_callable__
-      IndexType getGlobalIndex( IndexType localIdx ) const
-      {
-         //std::cerr << "SegmentView: localIdx = " << localIdx << " groupWidth = " << groupsWidth << std::endl;
-         IndexType groupIdx( 0 ), offset( groupOffset ), groupHeight( getWarpSize() );
-         while( localIdx >= groupsWidth[ groupIdx ] )
-         {
-            //std::cerr << "ROW: groupIdx = " << groupIdx << " groupWidth = " << groupsWidth[ groupIdx ]
-            //          << " groupSize = " << groupsWidth[ groupIdx ] * groupHeight << std::endl;
-            localIdx -= groupsWidth[ groupIdx ];
-            offset += groupsWidth[ groupIdx++ ] * groupHeight;
-            groupHeight /= 2;
-         }
-         TNL_ASSERT_LE( groupIdx, TNL::log2( getWarpSize() - inStripIdx + 1 ), "Local index exceeds segment bounds." );
-         if( Organization == RowMajorOrder )
-         {
-            //std::cerr << " offset = " << offset << " inStripIdx = " << inStripIdx << " localIdx = " << localIdx 
-            //          << " return = " << offset + inStripIdx * groupsWidth[ groupIdx ] + localIdx << std::endl;
-            return offset + inStripIdx * groupsWidth[ groupIdx ] + localIdx;
-         }
-         else
-            return offset + inStripIdx + localIdx * groupHeight;
-      };
-
-      __cuda_callable__
-      const IndexType& getSegmentIndex() const
-      {
-         return this->segmentIdx;
-      };
-
-      protected:
-
-         IndexType segmentIdx, groupOffset, inStripIdx, segmentSize;
-
-         GroupsWidthType groupsWidth;
+public:
+   static constexpr int
+   getWarpSize()
+   {
+      return WarpSize;
+   };
+
+   static constexpr int
+   getLogWarpSize()
+   {
+      static_assert( WarpSize == 32, "nvcc does not allow constexpr log2" );
+      return 5;
+   }  // TODO: return std::log2( WarpSize ); };
+
+   static constexpr int
+   getGroupsCount()
+   {
+      return getLogWarpSize() + 1;
+   };
+
+   using IndexType = Index;
+   using GroupsWidthType = Containers::StaticVector< getGroupsCount(), IndexType >;
+
+   /**
+    * \brief Constructor.
+    *
+    * \param offset is offset of the first group of the strip the segment belongs to.
+    * \param size is the segment size
+    * \param inStripIdx is index of the segment within its strip.
+    * \param groupsWidth is a static vector containing widths of the strip groups
+    */
+   __cuda_callable__
+   BiEllpackSegmentView( const IndexType segmentIdx,
+                         const IndexType offset,
+                         const IndexType inStripIdx,
+                         const GroupsWidthType& groupsWidth )
+   : segmentIdx( segmentIdx ), groupOffset( offset ), inStripIdx( inStripIdx ), segmentSize( TNL::sum( groupsWidth ) ),
+     groupsWidth( groupsWidth ){};
+
+   __cuda_callable__
+   IndexType
+   getSize() const
+   {
+      return this->segmentSize;
+   };
+
+   __cuda_callable__
+   IndexType
+   getGlobalIndex( IndexType localIdx ) const
+   {
+      // std::cerr << "SegmentView: localIdx = " << localIdx << " groupWidth = " << groupsWidth << std::endl;
+      IndexType groupIdx( 0 ), offset( groupOffset ), groupHeight( getWarpSize() );
+      while( localIdx >= groupsWidth[ groupIdx ] ) {
+         // std::cerr << "ROW: groupIdx = " << groupIdx << " groupWidth = " << groupsWidth[ groupIdx ]
+         //           << " groupSize = " << groupsWidth[ groupIdx ] * groupHeight << std::endl;
+         localIdx -= groupsWidth[ groupIdx ];
+         offset += groupsWidth[ groupIdx++ ] * groupHeight;
+         groupHeight /= 2;
+      }
+      TNL_ASSERT_LE( groupIdx, TNL::log2( getWarpSize() - inStripIdx + 1 ), "Local index exceeds segment bounds." );
+      if( Organization == RowMajorOrder ) {
+         // std::cerr << " offset = " << offset << " inStripIdx = " << inStripIdx << " localIdx = " << localIdx
+         //           << " return = " << offset + inStripIdx * groupsWidth[ groupIdx ] + localIdx << std::endl;
+         return offset + inStripIdx * groupsWidth[ groupIdx ] + localIdx;
+      }
+      else
+         return offset + inStripIdx + localIdx * groupHeight;
+   };
+
+   __cuda_callable__
+   const IndexType&
+   getSegmentIndex() const
+   {
+      return this->segmentIdx;
+   };
+
+protected:
+   IndexType segmentIdx, groupOffset, inStripIdx, segmentSize;
+
+   GroupsWidthType groupsWidth;
 };
 
-      } //namespace Segments
-   } //namespace Algorithms
-} //namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/BiEllpackView.h b/src/TNL/Algorithms/Segments/BiEllpackView.h
index 5eb74b2420121f3fd7c0e82c8abe261bc7a72bb0..259c9a7106eae9afbe9ec22ef793229fc0975da8 100644
--- a/src/TNL/Algorithms/Segments/BiEllpackView.h
+++ b/src/TNL/Algorithms/Segments/BiEllpackView.h
@@ -15,9 +15,8 @@
 #include <TNL/Algorithms/Segments/SegmentsPrinting.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
-
+namespace Algorithms {
+namespace Segments {
 
 template< typename Device,
           typename Index,
@@ -25,195 +24,226 @@ template< typename Device,
           int WarpSize = 32 >
 class BiEllpackView
 {
-   public:
-
-      using DeviceType = Device;
-      using IndexType = std::remove_const_t< Index >;
-      using OffsetsView = typename Containers::VectorView< Index, DeviceType, IndexType >;
-      using ConstOffsetsView = typename OffsetsView::ConstViewType;
-      using ViewType = BiEllpackView;
-      template< typename Device_, typename Index_ >
-      using ViewTemplate = BiEllpackView< Device_, Index_, Organization, WarpSize >;
-      using ConstViewType = BiEllpackView< Device, std::add_const_t< Index >, Organization, WarpSize >;
-      using SegmentViewType = BiEllpackSegmentView< IndexType, Organization, WarpSize >;
-
-      static constexpr bool havePadding() { return true; };
-
-      __cuda_callable__
-      BiEllpackView() = default;
-
-      __cuda_callable__
-      BiEllpackView( const IndexType size,
-                     const IndexType storageSize,
-                     const IndexType virtualRows,
-                     const OffsetsView& rowPermArray,
-                     const OffsetsView& groupPointers );
-
-      __cuda_callable__
-      BiEllpackView( const IndexType size,
-                     const IndexType storageSize,
-                     const IndexType virtualRows,
-                     const OffsetsView&& rowPermArray,
-                     const OffsetsView&& groupPointers );
-
-      __cuda_callable__
-      BiEllpackView( const BiEllpackView& chunked_ellpack_view ) = default;
-
-      __cuda_callable__
-      BiEllpackView( BiEllpackView&& chunked_ellpack_view ) = default;
-
-      static String getSerializationType();
-
-      static String getSegmentsType();
-
-      __cuda_callable__
-      ViewType getView();
-
-      __cuda_callable__
-      const ConstViewType getConstView() const;
-
-      /**
-       * \brief Number of segments.
-       */
-      __cuda_callable__
-      IndexType getSegmentsCount() const;
-
-      /***
-       * \brief Returns size of the segment number \r segmentIdx
-       */
-      __cuda_callable__
-      IndexType getSegmentSize( const IndexType segmentIdx ) const;
-
-      /***
-       * \brief Returns number of elements managed by all segments.
-       */
-      __cuda_callable__
-      IndexType getSize() const;
-
-      /***
-       * \brief Returns number of elements that needs to be allocated.
-       */
-      __cuda_callable__
-      IndexType getStorageSize() const;
-
-      __cuda_callable__
-      IndexType getGlobalIndex( const Index segmentIdx, const Index localIdx ) const;
-
-      __cuda_callable__
-      SegmentViewType getSegmentView( const IndexType segmentIdx ) const;
-
-      /***
-       * \brief Go over all segments and for each segment element call
-       * function 'f' with arguments 'args'. The return type of 'f' is bool.
-       * When its true, the for-loop continues. Once 'f' returns false, the for-loop
-       * is terminated.
-       */
-      template< typename Function >
-      void forElements( IndexType first, IndexType last, Function&& f ) const;
-
-      template< typename Function >
-      void forAllElements( Function&& f ) const;
-
-      template< typename Function >
-      void forSegments( IndexType begin, IndexType end, Function&& f ) const;
-
-      template< typename Function >
-      void forAllSegments( Function&& f ) const;
-
-      /***
-       * \brief Go over all segments and perform a reduction in each of them.
-       */
-      template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
-      void reduceSegments( IndexType first, IndexType last, Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
-
-      template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
-      void reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
-
-      BiEllpackView& operator=( const BiEllpackView& view );
-
-      void save( File& file ) const;
-
-      void load( File& file );
-
-      template< typename Fetch >
-      SegmentsPrinter< BiEllpackView, Fetch > print( Fetch&& fetch ) const;
-
-      void printStructure( std::ostream& str ) const;
-
-   protected:
-
-      static constexpr int getWarpSize() { return WarpSize; };
-
-      static constexpr int getLogWarpSize() { return std::log2( WarpSize ); };
-
-      IndexType size = 0, storageSize = 0;
-
-      IndexType virtualRows = 0;
-
-      OffsetsView rowPermArray;
-
-      OffsetsView groupPointers;
+public:
+   using DeviceType = Device;
+   using IndexType = std::remove_const_t< Index >;
+   using OffsetsView = typename Containers::VectorView< Index, DeviceType, IndexType >;
+   using ConstOffsetsView = typename OffsetsView::ConstViewType;
+   using ViewType = BiEllpackView;
+   template< typename Device_, typename Index_ >
+   using ViewTemplate = BiEllpackView< Device_, Index_, Organization, WarpSize >;
+   using ConstViewType = BiEllpackView< Device, std::add_const_t< Index >, Organization, WarpSize >;
+   using SegmentViewType = BiEllpackSegmentView< IndexType, Organization, WarpSize >;
+
+   static constexpr bool
+   havePadding()
+   {
+      return true;
+   };
+
+   __cuda_callable__
+   BiEllpackView() = default;
+
+   __cuda_callable__
+   BiEllpackView( IndexType size,
+                  IndexType storageSize,
+                  IndexType virtualRows,
+                  const OffsetsView& rowPermArray,
+                  const OffsetsView& groupPointers );
+
+   __cuda_callable__
+   BiEllpackView( IndexType size,
+                  IndexType storageSize,
+                  IndexType virtualRows,
+                  const OffsetsView&& rowPermArray,
+                  const OffsetsView&& groupPointers );
+
+   __cuda_callable__
+   BiEllpackView( const BiEllpackView& chunked_ellpack_view ) = default;
+
+   __cuda_callable__
+   BiEllpackView( BiEllpackView&& chunked_ellpack_view ) noexcept = default;
+
+   static std::string
+   getSerializationType();
+
+   static String
+   getSegmentsType();
+
+   __cuda_callable__
+   ViewType
+   getView();
+
+   __cuda_callable__
+   const ConstViewType
+   getConstView() const;
+
+   /**
+    * \brief Number of segments.
+    */
+   __cuda_callable__
+   IndexType
+   getSegmentsCount() const;
+
+   /***
+    * \brief Returns size of the segment number \r segmentIdx
+    */
+   __cuda_callable__
+   IndexType
+   getSegmentSize( IndexType segmentIdx ) const;
+
+   /***
+    * \brief Returns number of elements managed by all segments.
+    */
+   __cuda_callable__
+   IndexType
+   getSize() const;
+
+   /***
+    * \brief Returns number of elements that needs to be allocated.
+    */
+   __cuda_callable__
+   IndexType
+   getStorageSize() const;
+
+   __cuda_callable__
+   IndexType
+   getGlobalIndex( Index segmentIdx, Index localIdx ) const;
+
+   __cuda_callable__
+   SegmentViewType
+   getSegmentView( IndexType segmentIdx ) const;
+
+   /***
+    * \brief Go over all segments and for each segment element call
+    * function 'f' with arguments 'args'. The return type of 'f' is bool.
+    * When its true, the for-loop continues. Once 'f' returns false, the for-loop
+    * is terminated.
+    */
+   template< typename Function >
+   void
+   forElements( IndexType first, IndexType last, Function&& f ) const;
+
+   template< typename Function >
+   void
+   forAllElements( Function&& f ) const;
+
+   template< typename Function >
+   void
+   forSegments( IndexType begin, IndexType end, Function&& f ) const;
+
+   template< typename Function >
+   void
+   forAllSegments( Function&& f ) const;
+
+   /***
+    * \brief Go over all segments and perform a reduction in each of them.
+    */
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+   void
+   reduceSegments( IndexType first,
+                   IndexType last,
+                   Fetch& fetch,
+                   const Reduction& reduction,
+                   ResultKeeper& keeper,
+                   const Real& zero ) const;
+
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+   void
+   reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
+
+   BiEllpackView&
+   operator=( const BiEllpackView& view );
+
+   void
+   save( File& file ) const;
+
+   void
+   load( File& file );
+
+   template< typename Fetch >
+   SegmentsPrinter< BiEllpackView, Fetch >
+   print( Fetch&& fetch ) const;
+
+   void
+   printStructure( std::ostream& str ) const;
+
+protected:
+   static constexpr int
+   getWarpSize()
+   {
+      return WarpSize;
+   };
+
+   static constexpr int
+   getLogWarpSize()
+   {
+      return std::log2( WarpSize );
+   };
+
+   IndexType size = 0, storageSize = 0;
+
+   IndexType virtualRows = 0;
+
+   OffsetsView rowPermArray;
+
+   OffsetsView groupPointers;
 
 #ifdef HAVE_CUDA
-      template< typename Fetch,
-                typename Reduction,
-                typename ResultKeeper,
-                typename Real,
-                int BlockDim >
-      __device__
-      void reduceSegmentsKernelWithAllParameters( IndexType gridIdx,
-                                                     IndexType first,
-                                                     IndexType last,
-                                                     Fetch fetch,
-                                                     Reduction reduction,
-                                                     ResultKeeper keeper,
-                                                     Real zero ) const;
-
-      template< typename Fetch,
-                typename Reduction,
-                typename ResultKeeper,
-                typename Real_,
-                int BlockDim >
-      __device__
-      void reduceSegmentsKernel( IndexType gridIdx,
-                                    IndexType first,
-                                    IndexType last,
-                                    Fetch fetch,
-                                    Reduction reduction,
-                                    ResultKeeper keeper,
-                                    Real_ zero ) const;
-
-      template< typename View_,
-                typename Index_,
-                typename Fetch_,
-                typename Reduction_,
-                typename ResultKeeper_,
-                typename Real_,
-                int BlockDim >
-      friend __global__
-      void BiEllpackreduceSegmentsKernel( View_ chunkedEllpack,
-                                             Index_ gridIdx,
-                                             Index_ first,
-                                             Index_ last,
-                                             Fetch_ fetch,
-                                             Reduction_ reduction,
-                                             ResultKeeper_ keeper,
-                                             Real_ zero );
-
-      template< typename Index_, typename Fetch_, int BlockDim_, int WarpSize_, bool B_ >
-      friend struct detail::BiEllpackreduceSegmentsDispatcher;
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real, int BlockDim >
+   __device__
+   void
+   reduceSegmentsKernelWithAllParameters( IndexType gridIdx,
+                                          IndexType first,
+                                          IndexType last,
+                                          Fetch fetch,
+                                          Reduction reduction,
+                                          ResultKeeper keeper,
+                                          Real zero ) const;
+
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real_, int BlockDim >
+   __device__
+   void
+   reduceSegmentsKernel( IndexType gridIdx,
+                         IndexType first,
+                         IndexType last,
+                         Fetch fetch,
+                         Reduction reduction,
+                         ResultKeeper keeper,
+                         Real_ zero ) const;
+
+   template< typename View_,
+             typename Index_,
+             typename Fetch_,
+             typename Reduction_,
+             typename ResultKeeper_,
+             typename Real_,
+             int BlockDim >
+   friend __global__
+   void
+   BiEllpackreduceSegmentsKernel( View_ chunkedEllpack,
+                                  Index_ gridIdx,
+                                  Index_ first,
+                                  Index_ last,
+                                  Fetch_ fetch,
+                                  Reduction_ reduction,
+                                  ResultKeeper_ keeper,
+                                  Real_ zero );
+
+   template< typename Index_, typename Fetch_, int BlockDim_, int WarpSize_, bool B_ >
+   friend struct detail::BiEllpackreduceSegmentsDispatcher;
 #endif
 };
 
-template <typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
-std::ostream& operator<<( std::ostream& str, const BiEllpackView< Device, Index, Organization, WarpSize >& segments ) { return printSegments( str, segments ); }
-
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
+std::ostream&
+operator<<( std::ostream& str, const BiEllpackView< Device, Index, Organization, WarpSize >& segments )
+{
+   return printSegments( str, segments );
+}
 
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
 
 #include <TNL/Algorithms/Segments/BiEllpackView.hpp>
diff --git a/src/TNL/Algorithms/Segments/BiEllpackView.hpp b/src/TNL/Algorithms/Segments/BiEllpackView.hpp
index 5c50b974bbc391d1908be893b0362ffce7b536d3..05112c6bd49225a07346d0ff31cfb6543c3cd3ed 100644
--- a/src/TNL/Algorithms/Segments/BiEllpackView.hpp
+++ b/src/TNL/Algorithms/Segments/BiEllpackView.hpp
@@ -14,251 +14,176 @@
 #include <TNL/Cuda/SharedMemory.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
 __cuda_callable__
-BiEllpackView< Device, Index, Organization, WarpSize >::
-BiEllpackView( const IndexType size,
-               const IndexType storageSize,
-               const IndexType virtualRows,
-               const OffsetsView& rowPermArray,
-               const OffsetsView& groupPointers )
-: size( size ),
-  storageSize( storageSize ),
-  virtualRows( virtualRows ),
-  rowPermArray( rowPermArray ),
+BiEllpackView< Device, Index, Organization, WarpSize >::BiEllpackView( const IndexType size,
+                                                                       const IndexType storageSize,
+                                                                       const IndexType virtualRows,
+                                                                       const OffsetsView& rowPermArray,
+                                                                       const OffsetsView& groupPointers )
+: size( size ), storageSize( storageSize ), virtualRows( virtualRows ), rowPermArray( rowPermArray ),
   groupPointers( groupPointers )
-{
-}
+{}
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
 __cuda_callable__
-BiEllpackView< Device, Index, Organization, WarpSize >::
-BiEllpackView( const IndexType size,
-               const IndexType storageSize,
-               const IndexType virtualRows,
-               const OffsetsView&& rowPermArray,
-               const OffsetsView&& groupPointers )
-: size( size ),
-  storageSize( storageSize ),
-  virtualRows( virtualRows ),
-  rowPermArray( std::move( rowPermArray ) ),
+BiEllpackView< Device, Index, Organization, WarpSize >::BiEllpackView( const IndexType size,
+                                                                       const IndexType storageSize,
+                                                                       const IndexType virtualRows,
+                                                                       const OffsetsView&& rowPermArray,
+                                                                       const OffsetsView&& groupPointers )
+: size( size ), storageSize( storageSize ), virtualRows( virtualRows ), rowPermArray( std::move( rowPermArray ) ),
   groupPointers( std::move( groupPointers ) )
-{
-}
+{}
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
-String
-BiEllpackView< Device, Index, Organization, WarpSize >::
-getSerializationType()
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
+std::string
+BiEllpackView< Device, Index, Organization, WarpSize >::getSerializationType()
 {
-   // FIXME: the serialized data DEPEND on the Organization and WarpSize parameters, so it should be reflected in the serialization type
+   // FIXME: the serialized data DEPEND on the Organization and WarpSize parameters, so it should be reflected in the
+   // serialization type
    return "BiEllpack< [any_device], " + TNL::getSerializationType< IndexType >() + " >";
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
 String
-BiEllpackView< Device, Index, Organization, WarpSize >::
-getSegmentsType()
+BiEllpackView< Device, Index, Organization, WarpSize >::getSegmentsType()
 {
    return "BiEllpack";
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
 __cuda_callable__
 typename BiEllpackView< Device, Index, Organization, WarpSize >::ViewType
-BiEllpackView< Device, Index, Organization, WarpSize >::
-getView()
+BiEllpackView< Device, Index, Organization, WarpSize >::getView()
 {
    return ViewType( size, storageSize, virtualRows, rowPermArray.getView(), groupPointers.getView() );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
-__cuda_callable__ auto BiEllpackView< Device, Index, Organization, WarpSize >::
-getConstView() const -> const ConstViewType
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
+__cuda_callable__
+auto
+BiEllpackView< Device, Index, Organization, WarpSize >::getConstView() const -> const ConstViewType
 {
    BiEllpackView* this_ptr = const_cast< BiEllpackView* >( this );
-   return ConstViewType( size,
-                         storageSize,
-                         virtualRows,
-                         this_ptr->rowPermArray.getView(),
-                         this_ptr->groupPointers.getView() );
+   return ConstViewType( size, storageSize, virtualRows, this_ptr->rowPermArray.getView(), this_ptr->groupPointers.getView() );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
-__cuda_callable__ auto BiEllpackView< Device, Index, Organization, WarpSize >::
-getSegmentsCount() const -> IndexType
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
+__cuda_callable__
+auto
+BiEllpackView< Device, Index, Organization, WarpSize >::getSegmentsCount() const -> IndexType
 {
    return this->size;
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
-__cuda_callable__ auto BiEllpackView< Device, Index, Organization, WarpSize >::
-getSegmentSize( const IndexType segmentIdx ) const -> IndexType
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
+__cuda_callable__
+auto
+BiEllpackView< Device, Index, Organization, WarpSize >::getSegmentSize( const IndexType segmentIdx ) const -> IndexType
 {
-   if( std::is_same< DeviceType, Devices::Cuda >::value )
-   {
+   if( std::is_same< DeviceType, Devices::Cuda >::value ) {
 #ifdef __CUDA_ARCH__
       return detail::BiEllpack< IndexType, DeviceType, Organization, WarpSize >::getSegmentSizeDirect(
-         rowPermArray,
-         groupPointers,
-         segmentIdx );
+         rowPermArray, groupPointers, segmentIdx );
 #else
       return detail::BiEllpack< IndexType, DeviceType, Organization, WarpSize >::getSegmentSize(
-         rowPermArray,
-         groupPointers,
-         segmentIdx );
+         rowPermArray, groupPointers, segmentIdx );
 #endif
    }
    else
       return detail::BiEllpack< IndexType, DeviceType, Organization, WarpSize >::getSegmentSizeDirect(
-         rowPermArray,
-         groupPointers,
-         segmentIdx );
+         rowPermArray, groupPointers, segmentIdx );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
-__cuda_callable__ auto BiEllpackView< Device, Index, Organization, WarpSize >::
-getSize() const -> IndexType
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
+__cuda_callable__
+auto
+BiEllpackView< Device, Index, Organization, WarpSize >::getSize() const -> IndexType
 {
    return this->size;
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
-__cuda_callable__ auto BiEllpackView< Device, Index, Organization, WarpSize >::
-getStorageSize() const -> IndexType
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
+__cuda_callable__
+auto
+BiEllpackView< Device, Index, Organization, WarpSize >::getStorageSize() const -> IndexType
 {
    return this->storageSize;
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
-__cuda_callable__ auto BiEllpackView< Device, Index, Organization, WarpSize >::
-getGlobalIndex( const Index segmentIdx, const Index localIdx ) const -> IndexType
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
+__cuda_callable__
+auto
+BiEllpackView< Device, Index, Organization, WarpSize >::getGlobalIndex( const Index segmentIdx, const Index localIdx ) const
+   -> IndexType
 {
-   if( std::is_same< DeviceType, Devices::Cuda >::value )
-   {
+   if( std::is_same< DeviceType, Devices::Cuda >::value ) {
 #ifdef __CUDA_ARCH__
       return detail::BiEllpack< IndexType, DeviceType, Organization, WarpSize >::getGlobalIndexDirect(
-         rowPermArray,
-         groupPointers,
-         segmentIdx,
-         localIdx );
+         rowPermArray, groupPointers, segmentIdx, localIdx );
 #else
       return detail::BiEllpack< IndexType, DeviceType, Organization, WarpSize >::getGlobalIndex(
-         rowPermArray,
-         groupPointers,
-         segmentIdx,
-         localIdx );
+         rowPermArray, groupPointers, segmentIdx, localIdx );
 #endif
    }
    else
       return detail::BiEllpack< IndexType, DeviceType, Organization, WarpSize >::getGlobalIndexDirect(
-         rowPermArray,
-         groupPointers,
-         segmentIdx,
-         localIdx );
+         rowPermArray, groupPointers, segmentIdx, localIdx );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
 __cuda_callable__
 auto
-BiEllpackView< Device, Index, Organization, WarpSize >::
-getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType
+BiEllpackView< Device, Index, Organization, WarpSize >::getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType
 {
-   if( std::is_same< DeviceType, Devices::Cuda >::value )
-   {
+   if( std::is_same< DeviceType, Devices::Cuda >::value ) {
 #ifdef __CUDA_ARCH__
       return detail::BiEllpack< IndexType, DeviceType, Organization, WarpSize >::getSegmentViewDirect(
-         rowPermArray,
-         groupPointers,
-         segmentIdx );
+         rowPermArray, groupPointers, segmentIdx );
 #else
       return detail::BiEllpack< IndexType, DeviceType, Organization, WarpSize >::getSegmentView(
-         rowPermArray,
-         groupPointers,
-         segmentIdx );
+         rowPermArray, groupPointers, segmentIdx );
 #endif
    }
    else
       return detail::BiEllpack< IndexType, DeviceType, Organization, WarpSize >::getSegmentViewDirect(
-         rowPermArray,
-         groupPointers,
-         segmentIdx );
+         rowPermArray, groupPointers, segmentIdx );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
-   template< typename Function >
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
+template< typename Function >
 void
-BiEllpackView< Device, Index, Organization, WarpSize >::
-forElements( IndexType first, IndexType last, Function&& f ) const
+BiEllpackView< Device, Index, Organization, WarpSize >::forElements( IndexType first, IndexType last, Function&& f ) const
 {
    const auto segmentsPermutationView = this->rowPermArray.getConstView();
    const auto groupPointersView = this->groupPointers.getConstView();
-   auto work = [=] __cuda_callable__ ( IndexType segmentIdx ) mutable {
+   auto work = [ = ] __cuda_callable__( IndexType segmentIdx ) mutable
+   {
       const IndexType strip = segmentIdx / getWarpSize();
       const IndexType firstGroupInStrip = strip * ( getLogWarpSize() + 1 );
       const IndexType rowStripPerm = segmentsPermutationView[ segmentIdx ] - strip * getWarpSize();
-      const IndexType groupsCount = detail::BiEllpack< IndexType, DeviceType, Organization, getWarpSize() >::getActiveGroupsCountDirect( segmentsPermutationView, segmentIdx );
+      const IndexType groupsCount =
+         detail::BiEllpack< IndexType, DeviceType, Organization, getWarpSize() >::getActiveGroupsCountDirect(
+            segmentsPermutationView, segmentIdx );
       IndexType groupHeight = getWarpSize();
-      //printf( "segmentIdx = %d strip = %d firstGroupInStrip = %d rowStripPerm = %d groupsCount = %d \n", segmentIdx, strip, firstGroupInStrip, rowStripPerm, groupsCount );
+      // printf( "segmentIdx = %d strip = %d firstGroupInStrip = %d rowStripPerm = %d groupsCount = %d \n", segmentIdx, strip,
+      // firstGroupInStrip, rowStripPerm, groupsCount );
       IndexType localIdx( 0 );
-      for( IndexType groupIdx = firstGroupInStrip; groupIdx < firstGroupInStrip + groupsCount; groupIdx++ )
-      {
+      for( IndexType groupIdx = firstGroupInStrip; groupIdx < firstGroupInStrip + groupsCount; groupIdx++ ) {
          IndexType groupOffset = groupPointersView[ groupIdx ];
          const IndexType groupSize = groupPointersView[ groupIdx + 1 ] - groupOffset;
-         //printf( "groupSize = %d \n", groupSize );
-         if( groupSize )
-         {
+         // printf( "groupSize = %d \n", groupSize );
+         if( groupSize ) {
             const IndexType groupWidth = groupSize / groupHeight;
-            for( IndexType i = 0; i < groupWidth; i++ )
-            {
-               if( Organization == RowMajorOrder )
-               {
+            for( IndexType i = 0; i < groupWidth; i++ ) {
+               if( Organization == RowMajorOrder ) {
                   f( segmentIdx, localIdx, groupOffset + rowStripPerm * groupWidth + i );
                }
-               else
-               {
+               else {
                   /*printf( "segmentIdx = %d localIdx = %d globalIdx = %d groupIdx = %d groupSize = %d groupWidth = %d\n",
                      segmentIdx, localIdx, groupOffset + rowStripPerm + i * groupHeight,
                      groupIdx, groupSize, groupWidth );*/
@@ -270,101 +195,94 @@ forElements( IndexType first, IndexType last, Function&& f ) const
          groupHeight /= 2;
       }
    };
-   Algorithms::ParallelFor< DeviceType >::exec( first, last , work );
+   Algorithms::ParallelFor< DeviceType >::exec( first, last, work );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
-   template< typename Function >
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
+template< typename Function >
 void
-BiEllpackView< Device, Index, Organization, WarpSize >::
-forAllElements( Function&& f ) const
+BiEllpackView< Device, Index, Organization, WarpSize >::forAllElements( Function&& f ) const
 {
    this->forElements( 0, this->getSegmentsCount(), f );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
-   template< typename Function >
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
+template< typename Function >
 void
-BiEllpackView< Device, Index, Organization, WarpSize >::
-forSegments( IndexType begin, IndexType end, Function&& function ) const
+BiEllpackView< Device, Index, Organization, WarpSize >::forSegments( IndexType begin, IndexType end, Function&& function ) const
 {
    auto view = this->getConstView();
-   auto f = [=] __cuda_callable__ ( IndexType segmentIdx ) mutable {
+   auto f = [ = ] __cuda_callable__( IndexType segmentIdx ) mutable
+   {
       auto segment = view.getSegmentView( segmentIdx );
       function( segment );
    };
    TNL::Algorithms::ParallelFor< DeviceType >::exec( begin, end, f );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
-   template< typename Function >
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
+template< typename Function >
 void
-BiEllpackView< Device, Index, Organization, WarpSize >::
-forAllSegments( Function&& f ) const
+BiEllpackView< Device, Index, Organization, WarpSize >::forAllSegments( Function&& f ) const
 {
    this->forSegments( 0, this->getSegmentsCount(), f );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
-   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
 void
-BiEllpackView< Device, Index, Organization, WarpSize >::
-reduceSegments( IndexType first, IndexType last, Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const
+BiEllpackView< Device, Index, Organization, WarpSize >::reduceSegments( IndexType first,
+                                                                        IndexType last,
+                                                                        Fetch& fetch,
+                                                                        const Reduction& reduction,
+                                                                        ResultKeeper& keeper,
+                                                                        const Real& zero ) const
 {
    using RealType = typename detail::FetchLambdaAdapter< Index, Fetch >::ReturnType;
    if( this->getStorageSize() == 0 )
       return;
    if( std::is_same< DeviceType, Devices::Host >::value )
-      for( IndexType segmentIdx = 0; segmentIdx < this->getSize(); segmentIdx++ )
-      {
+      for( IndexType segmentIdx = 0; segmentIdx < this->getSize(); segmentIdx++ ) {
          const IndexType stripIdx = segmentIdx / getWarpSize();
          const IndexType groupIdx = stripIdx * ( getLogWarpSize() + 1 );
          const IndexType inStripIdx = rowPermArray[ segmentIdx ] - stripIdx * getWarpSize();
-         const IndexType groupsCount = detail::BiEllpack< IndexType, DeviceType, Organization, getWarpSize() >::getActiveGroupsCount( rowPermArray, segmentIdx );
+         const IndexType groupsCount =
+            detail::BiEllpack< IndexType, DeviceType, Organization, getWarpSize() >::getActiveGroupsCount( rowPermArray,
+                                                                                                           segmentIdx );
          IndexType globalIdx = groupPointers[ groupIdx ];
          IndexType groupHeight = getWarpSize();
          IndexType localIdx( 0 );
          RealType aux( zero );
          bool compute( true );
-         //std::cerr << "segmentIdx = " << segmentIdx
-         //          << " stripIdx = " << stripIdx
-         //          << " inStripIdx = " << inStripIdx
-         //          << " groupIdx = " << groupIdx
-         //         << " groupsCount = " << groupsCount
-         //          << std::endl;
-         for( IndexType group = 0; group < groupsCount && compute; group++ )
-         {
-            const IndexType groupSize = detail::BiEllpack< IndexType, DeviceType, Organization, getWarpSize() >::getGroupSize( groupPointers, stripIdx, group );
+         // std::cerr << "segmentIdx = " << segmentIdx
+         //           << " stripIdx = " << stripIdx
+         //           << " inStripIdx = " << inStripIdx
+         //           << " groupIdx = " << groupIdx
+         //          << " groupsCount = " << groupsCount
+         //           << std::endl;
+         for( IndexType group = 0; group < groupsCount && compute; group++ ) {
+            const IndexType groupSize = detail::BiEllpack< IndexType, DeviceType, Organization, getWarpSize() >::getGroupSize(
+               groupPointers, stripIdx, group );
             IndexType groupWidth = groupSize / groupHeight;
             const IndexType globalIdxBack = globalIdx;
-            //std::cerr << "  groupSize = " << groupSize
-            //          << " groupWidth = " << groupWidth
-            //          << std::endl;
+            // std::cerr << "  groupSize = " << groupSize
+            //           << " groupWidth = " << groupWidth
+            //           << std::endl;
             if( Organization == RowMajorOrder )
                globalIdx += inStripIdx * groupWidth;
             else
                globalIdx += inStripIdx;
-            for( IndexType j = 0; j < groupWidth && compute; j++ )
-            {
-               //std::cerr << "    segmentIdx = " << segmentIdx << " groupIdx = " << groupIdx
-               //         << " groupWidth = " << groupWidth << " groupHeight = " << groupHeight
-               //          << " localIdx = " << localIdx << " globalIdx = " << globalIdx
-               //          << " fetch = " << detail::FetchLambdaAdapter< IndexType, Fetch >::call( fetch, segmentIdx, localIdx++, globalIdx, compute ) << std::endl;
-               aux = reduction( aux, detail::FetchLambdaAdapter< IndexType, Fetch >::call( fetch, segmentIdx, localIdx++, globalIdx, compute ) );
+            for( IndexType j = 0; j < groupWidth && compute; j++ ) {
+               // std::cerr << "    segmentIdx = " << segmentIdx << " groupIdx = " << groupIdx
+               //          << " groupWidth = " << groupWidth << " groupHeight = " << groupHeight
+               //           << " localIdx = " << localIdx << " globalIdx = " << globalIdx
+               //           << " fetch = " << detail::FetchLambdaAdapter< IndexType, Fetch >::call( fetch, segmentIdx,
+               //           localIdx++, globalIdx, compute ) << std::endl;
+               aux = reduction(
+                  aux,
+                  detail::FetchLambdaAdapter< IndexType, Fetch >::call( fetch, segmentIdx, localIdx++, globalIdx, compute ) );
                if( Organization == RowMajorOrder )
-                  globalIdx ++;
+                  globalIdx++;
                else
                   globalIdx += groupHeight;
             }
@@ -373,8 +291,7 @@ reduceSegments( IndexType first, IndexType last, Fetch& fetch, const Reduction&
          }
          keeper( segmentIdx, aux );
       }
-   if( std::is_same< DeviceType, Devices::Cuda >::value )
-   {
+   if( std::is_same< DeviceType, Devices::Cuda >::value ) {
 #ifdef HAVE_CUDA
       constexpr int BlockDim = 256;
       dim3 cudaBlockSize = BlockDim;
@@ -385,41 +302,35 @@ reduceSegments( IndexType first, IndexType last, Fetch& fetch, const Reduction&
       if( Organization == ColumnMajorOrder )
          sharedMemory = cudaBlockSize.x * sizeof( RealType );
 
-      //printStructure( std::cerr );
-      for( IndexType gridIdx = 0; gridIdx < cudaGrids; gridIdx++ )
-      {
+      // printStructure( std::cerr );
+      for( IndexType gridIdx = 0; gridIdx < cudaGrids; gridIdx++ ) {
          dim3 cudaGridSize = Cuda::getMaxGridSize();
          if( gridIdx == cudaGrids - 1 )
             cudaGridSize.x = cudaBlocks % Cuda::getMaxGridSize();
-         detail::BiEllpackreduceSegmentsKernel< ViewType, IndexType, Fetch, Reduction, ResultKeeper, Real, BlockDim  >
-            <<< cudaGridSize, cudaBlockSize, sharedMemory >>>
-            ( *this, gridIdx, first, last, fetch, reduction, keeper, zero );
+         detail::BiEllpackreduceSegmentsKernel< ViewType, IndexType, Fetch, Reduction, ResultKeeper, Real, BlockDim >
+            <<< cudaGridSize, cudaBlockSize,
+            sharedMemory >>>( *this, gridIdx, first, last, fetch, reduction, keeper, zero );
       }
-      cudaStreamSynchronize(0);
+      cudaStreamSynchronize( 0 );
       TNL_CHECK_CUDA_DEVICE;
 #endif
    }
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
-   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
 void
-BiEllpackView< Device, Index, Organization, WarpSize >::
-reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const
+BiEllpackView< Device, Index, Organization, WarpSize >::reduceAllSegments( Fetch& fetch,
+                                                                           const Reduction& reduction,
+                                                                           ResultKeeper& keeper,
+                                                                           const Real& zero ) const
 {
    this->reduceSegments( 0, this->getSegmentsCount(), fetch, reduction, keeper, zero );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
 BiEllpackView< Device, Index, Organization, WarpSize >&
-BiEllpackView< Device, Index, Organization, WarpSize >::
-operator=( const BiEllpackView& source )
+BiEllpackView< Device, Index, Organization, WarpSize >::operator=( const BiEllpackView& source )
 {
    this->size = source.size;
    this->storageSize = source.storageSize;
@@ -429,50 +340,35 @@ operator=( const BiEllpackView& source )
    return *this;
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
 void
-BiEllpackView< Device, Index, Organization, WarpSize >::
-save( File& file ) const
+BiEllpackView< Device, Index, Organization, WarpSize >::save( File& file ) const
 {
    file.save( &this->size );
    file.save( &this->storageSize );
    file.save( &this->virtualRows );
-   file << this->rowPermArray
-        << this->groupPointers;
+   file << this->rowPermArray << this->groupPointers;
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
-      template< typename Fetch >
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
+template< typename Fetch >
 auto
-BiEllpackView< Device, Index, Organization, WarpSize >::
-print( Fetch&& fetch ) const -> SegmentsPrinter< BiEllpackView, Fetch >
+BiEllpackView< Device, Index, Organization, WarpSize >::print( Fetch&& fetch ) const -> SegmentsPrinter< BiEllpackView, Fetch >
 {
    return SegmentsPrinter< BiEllpackView, Fetch >( *this, fetch );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
 void
-BiEllpackView< Device, Index, Organization, WarpSize >::
-printStructure( std::ostream& str ) const
+BiEllpackView< Device, Index, Organization, WarpSize >::printStructure( std::ostream& str ) const
 {
    const IndexType stripsCount = roundUpDivision( this->getSize(), getWarpSize() );
-   for( IndexType stripIdx = 0; stripIdx < stripsCount; stripIdx++ )
-   {
+   for( IndexType stripIdx = 0; stripIdx < stripsCount; stripIdx++ ) {
       str << "Strip: " << stripIdx << std::endl;
       const IndexType firstGroupIdx = stripIdx * ( getLogWarpSize() + 1 );
       const IndexType lastGroupIdx = firstGroupIdx + getLogWarpSize() + 1;
       IndexType groupHeight = getWarpSize();
-      for( IndexType groupIdx = firstGroupIdx; groupIdx < lastGroupIdx; groupIdx ++ )
-      {
+      for( IndexType groupIdx = firstGroupIdx; groupIdx < lastGroupIdx; groupIdx++ ) {
          const IndexType groupSize = groupPointers.getElement( groupIdx + 1 ) - groupPointers.getElement( groupIdx );
          const IndexType groupWidth = groupSize / groupHeight;
          str << "\tGroup: " << groupIdx << " size = " << groupSize << " width = " << groupWidth << " height = " << groupHeight
@@ -483,25 +379,17 @@ printStructure( std::ostream& str ) const
 }
 
 #ifdef HAVE_CUDA
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
-   template< typename Fetch,
-             typename Reduction,
-             typename ResultKeeper,
-             typename Real,
-             int BlockDim >
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real, int BlockDim >
 __device__
 void
-BiEllpackView< Device, Index, Organization, WarpSize >::
-reduceSegmentsKernelWithAllParameters( IndexType gridIdx,
-                                          IndexType first,
-                                          IndexType last,
-                                          Fetch fetch,
-                                          Reduction reduction,
-                                          ResultKeeper keeper,
-                                          Real zero ) const
+BiEllpackView< Device, Index, Organization, WarpSize >::reduceSegmentsKernelWithAllParameters( IndexType gridIdx,
+                                                                                               IndexType first,
+                                                                                               IndexType last,
+                                                                                               Fetch fetch,
+                                                                                               Reduction reduction,
+                                                                                               ResultKeeper keeper,
+                                                                                               Real zero ) const
 {
    using RealType = decltype( fetch( IndexType(), IndexType(), IndexType(), std::declval< bool& >() ) );
    const IndexType segmentIdx = ( gridIdx * Cuda::getMaxGridSize() + blockIdx.x ) * blockDim.x + threadIdx.x + first;
@@ -511,24 +399,25 @@ reduceSegmentsKernelWithAllParameters( IndexType gridIdx,
    const IndexType strip = segmentIdx / getWarpSize();
    const IndexType firstGroupInStrip = strip * ( getLogWarpSize() + 1 );
    const IndexType rowStripPerm = rowPermArray[ segmentIdx ] - strip * getWarpSize();
-   const IndexType groupsCount = detail::BiEllpack< IndexType, DeviceType, Organization, getWarpSize() >::getActiveGroupsCountDirect( rowPermArray, segmentIdx );
+   const IndexType groupsCount =
+      detail::BiEllpack< IndexType, DeviceType, Organization, getWarpSize() >::getActiveGroupsCountDirect( rowPermArray,
+                                                                                                           segmentIdx );
    IndexType groupHeight = getWarpSize();
    bool compute( true );
    IndexType localIdx( 0 );
    RealType result( zero );
-   for( IndexType groupIdx = firstGroupInStrip; groupIdx < firstGroupInStrip + groupsCount && compute; groupIdx++ )
-   {
+   for( IndexType groupIdx = firstGroupInStrip; groupIdx < firstGroupInStrip + groupsCount && compute; groupIdx++ ) {
       IndexType groupOffset = groupPointers[ groupIdx ];
       const IndexType groupSize = groupPointers[ groupIdx + 1 ] - groupOffset;
-      if( groupSize )
-      {
+      if( groupSize ) {
          const IndexType groupWidth = groupSize / groupHeight;
-         for( IndexType i = 0; i < groupWidth; i++ )
-         {
+         for( IndexType i = 0; i < groupWidth; i++ ) {
             if( Organization == RowMajorOrder )
-               result = reduction( result, fetch( segmentIdx, localIdx, groupOffset + rowStripPerm * groupWidth + i, compute ) );
+               result =
+                  reduction( result, fetch( segmentIdx, localIdx, groupOffset + rowStripPerm * groupWidth + i, compute ) );
             else
-               result = reduction( result, fetch( segmentIdx, localIdx, groupOffset + rowStripPerm + i * groupHeight, compute ) );
+               result =
+                  reduction( result, fetch( segmentIdx, localIdx, groupOffset + rowStripPerm + i * groupHeight, compute ) );
             localIdx++;
          }
       }
@@ -537,25 +426,17 @@ reduceSegmentsKernelWithAllParameters( IndexType gridIdx,
    keeper( segmentIdx, result );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int WarpSize >
-   template< typename Fetch,
-             typename Reduction,
-             typename ResultKeeper,
-             typename Real,
-             int BlockDim >
+template< typename Device, typename Index, ElementsOrganization Organization, int WarpSize >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real, int BlockDim >
 __device__
 void
-BiEllpackView< Device, Index, Organization, WarpSize >::
-reduceSegmentsKernel( IndexType gridIdx,
-                         IndexType first,
-                         IndexType last,
-                         Fetch fetch,
-                         Reduction reduction,
-                         ResultKeeper keeper,
-                         Real zero ) const
+BiEllpackView< Device, Index, Organization, WarpSize >::reduceSegmentsKernel( IndexType gridIdx,
+                                                                              IndexType first,
+                                                                              IndexType last,
+                                                                              Fetch fetch,
+                                                                              Reduction reduction,
+                                                                              ResultKeeper keeper,
+                                                                              Real zero ) const
 {
    using RealType = decltype( fetch( IndexType(), std::declval< bool& >() ) );
    Index segmentIdx = ( gridIdx * Cuda::getMaxGridSize() + blockIdx.x ) * blockDim.x + threadIdx.x + first;
@@ -569,8 +450,8 @@ reduceSegmentsKernel( IndexType gridIdx,
 
    const int warpIdx = threadIdx.x / WarpSize;
    const int warpsCount = BlockDim / WarpSize;
-   constexpr int groupsInStrip = 6; //getLogWarpSize() + 1;
-   //IndexType firstGroupIdx = strip * groupsInStrip;
+   constexpr int groupsInStrip = 6;  // getLogWarpSize() + 1;
+   // IndexType firstGroupIdx = strip * groupsInStrip;
    IndexType firstGroupInBlock = 8 * ( strip / 8 ) * groupsInStrip;
    IndexType groupHeight = getWarpSize();
 
@@ -582,18 +463,17 @@ reduceSegmentsKernel( IndexType gridIdx,
 
    /////
    // Fetch group pointers to shared memory
-   //bool b1 = ( threadIdx.x <= warpsCount * groupsInStrip );
-   //bool b2 = ( firstGroupIdx + threadIdx.x % groupsInStrip < this->groupPointers.getSize() );
-   //printf( "tid = %d warpsCount * groupsInStrip = %d firstGroupIdx + threadIdx.x = %d this->groupPointers.getSize() = %d read = %d %d\n",
+   // bool b1 = ( threadIdx.x <= warpsCount * groupsInStrip );
+   // bool b2 = ( firstGroupIdx + threadIdx.x % groupsInStrip < this->groupPointers.getSize() );
+   // printf( "tid = %d warpsCount * groupsInStrip = %d firstGroupIdx + threadIdx.x = %d this->groupPointers.getSize() = %d read
+   // = %d %d\n",
    //   threadIdx.x, warpsCount * groupsInStrip,
    //   firstGroupIdx + threadIdx.x,
    //   this->groupPointers.getSize(), ( int ) b1, ( int ) b2 );
-   if( threadIdx.x <= warpsCount * groupsInStrip &&
-      firstGroupInBlock + threadIdx.x < this->groupPointers.getSize() )
-   {
+   if( threadIdx.x <= warpsCount * groupsInStrip && firstGroupInBlock + threadIdx.x < this->groupPointers.getSize() ) {
       sharedGroupPointers[ threadIdx.x ] = this->groupPointers[ firstGroupInBlock + threadIdx.x ];
-      //printf( " sharedGroupPointers[ %d ] = %d \n",
-      //   threadIdx.x, sharedGroupPointers[ threadIdx.x ] );
+      // printf( " sharedGroupPointers[ %d ] = %d \n",
+      //    threadIdx.x, sharedGroupPointers[ threadIdx.x ] );
    }
    const IndexType sharedGroupOffset = warpIdx * groupsInStrip;
    __syncthreads();
@@ -601,56 +481,49 @@ reduceSegmentsKernel( IndexType gridIdx,
    /////
    // Perform the reduction
    bool compute( true );
-   if( Organization == RowMajorOrder )
-   {
-      for( IndexType group = 0; group < getLogWarpSize() + 1; group++ )
-      {
+   if( Organization == RowMajorOrder ) {
+      for( IndexType group = 0; group < getLogWarpSize() + 1; group++ ) {
          IndexType groupBegin = sharedGroupPointers[ sharedGroupOffset + group ];
          IndexType groupEnd = sharedGroupPointers[ sharedGroupOffset + group + 1 ];
          TNL_ASSERT_LT( groupBegin, this->getStorageSize(), "" );
-         //if( groupBegin >= this->getStorageSize() )
-         //   printf( "tid = %d sharedGroupOffset + group + 1 = %d strip = %d group = %d groupBegin = %d groupEnd = %d this->getStorageSize() = %d\n",
-         //      threadIdx.x, sharedGroupOffset + group + 1, strip, group, groupBegin, groupEnd, this->getStorageSize() );
+         // if( groupBegin >= this->getStorageSize() )
+         //    printf( "tid = %d sharedGroupOffset + group + 1 = %d strip = %d group = %d groupBegin = %d groupEnd = %d
+         //    this->getStorageSize() = %d\n",
+         //       threadIdx.x, sharedGroupOffset + group + 1, strip, group, groupBegin, groupEnd, this->getStorageSize() );
          TNL_ASSERT_LT( groupEnd, this->getStorageSize(), "" );
-         if( groupEnd - groupBegin > 0 )
-         {
-            if( inWarpIdx < groupHeight )
-            {
+         if( groupEnd - groupBegin > 0 ) {
+            if( inWarpIdx < groupHeight ) {
                const IndexType groupWidth = ( groupEnd - groupBegin ) / groupHeight;
                IndexType globalIdx = groupBegin + inWarpIdx * groupWidth;
-               for( IndexType i = 0; i < groupWidth && compute; i++ )
-               {
+               for( IndexType i = 0; i < groupWidth && compute; i++ ) {
                   TNL_ASSERT_LT( globalIdx, this->getStorageSize(), "" );
                   results[ threadIdx.x ] = reduction( results[ threadIdx.x ], fetch( globalIdx++, compute ) );
-                  //if( strip == 1 )
-                  //  printf( "tid = %d i = %d groupHeight = %d groupWidth = %d globalIdx = %d fetch = %f results = %f \n",
-                  //      threadIdx.x, i,
-                  //      groupHeight, groupWidth,
-                  //      globalIdx, fetch( globalIdx, compute ), results[ threadIdx.x ] );
+                  // if( strip == 1 )
+                  //   printf( "tid = %d i = %d groupHeight = %d groupWidth = %d globalIdx = %d fetch = %f results = %f \n",
+                  //       threadIdx.x, i,
+                  //       groupHeight, groupWidth,
+                  //       globalIdx, fetch( globalIdx, compute ), results[ threadIdx.x ] );
                }
             }
          }
          groupHeight >>= 1;
       }
    }
-   else
-   {
+   else {
       RealType* temp = Cuda::getSharedMemory< RealType >();
-      for( IndexType group = 0; group < getLogWarpSize() + 1; group++ )
-      {
+      for( IndexType group = 0; group < getLogWarpSize() + 1; group++ ) {
          IndexType groupBegin = sharedGroupPointers[ sharedGroupOffset + group ];
          IndexType groupEnd = sharedGroupPointers[ sharedGroupOffset + group + 1 ];
-         //if( threadIdx.x < 36 && strip == 1 )
-         //   printf( " tid = %d strip = %d group = %d groupBegin = %d groupEnd = %d \n", threadIdx.x, strip, group, groupBegin, groupEnd );
-         if( groupEnd - groupBegin > 0 )
-         {
+         // if( threadIdx.x < 36 && strip == 1 )
+         //    printf( " tid = %d strip = %d group = %d groupBegin = %d groupEnd = %d \n", threadIdx.x, strip, group,
+         //    groupBegin, groupEnd );
+         if( groupEnd - groupBegin > 0 ) {
             temp[ threadIdx.x ] = zero;
             IndexType globalIdx = groupBegin + inWarpIdx;
-            while( globalIdx < groupEnd )
-            {
+            while( globalIdx < groupEnd ) {
                temp[ threadIdx.x ] = reduction( temp[ threadIdx.x ], fetch( globalIdx, compute ) );
-               //if( strip == 1 )
-               //   printf( "tid %d fetch %f temp %f \n", threadIdx.x, fetch( globalIdx, compute ), temp[ threadIdx.x ] );
+               // if( strip == 1 )
+               //    printf( "tid %d fetch %f temp %f \n", threadIdx.x, fetch( globalIdx, compute ), temp[ threadIdx.x ] );
                globalIdx += getWarpSize();
             }
             // TODO: reduction via templates
@@ -664,19 +537,19 @@ reduceSegmentsKernel( IndexType gridIdx,
 
             __syncwarp();
             if( group > 0 && inWarpIdx < 16 )
-                  temp[ threadIdx.x ] = reduction( temp[ threadIdx.x ], temp[ threadIdx.x + 16 ] );
+               temp[ threadIdx.x ] = reduction( temp[ threadIdx.x ], temp[ threadIdx.x + 16 ] );
             __syncwarp();
             if( group > 1 && inWarpIdx < 8 )
-                  temp[ threadIdx.x ] = reduction( temp[ threadIdx.x ], temp[ threadIdx.x + 8 ] );
+               temp[ threadIdx.x ] = reduction( temp[ threadIdx.x ], temp[ threadIdx.x + 8 ] );
             __syncwarp();
             if( group > 2 && inWarpIdx < 4 )
-                  temp[ threadIdx.x ] = reduction( temp[ threadIdx.x ], temp[ threadIdx.x + 4 ] );
+               temp[ threadIdx.x ] = reduction( temp[ threadIdx.x ], temp[ threadIdx.x + 4 ] );
             __syncwarp();
             if( group > 3 && inWarpIdx < 2 )
-                  temp[ threadIdx.x ] = reduction( temp[ threadIdx.x ], temp[ threadIdx.x + 2 ] );
+               temp[ threadIdx.x ] = reduction( temp[ threadIdx.x ], temp[ threadIdx.x + 2 ] );
             __syncwarp();
             if( group > 4 && inWarpIdx < 1 )
-                  temp[ threadIdx.x ] = reduction( temp[ threadIdx.x ], temp[ threadIdx.x + 1 ] );
+               temp[ threadIdx.x ] = reduction( temp[ threadIdx.x ], temp[ threadIdx.x + 1 ] );
             __syncwarp();
 
             if( inWarpIdx < groupHeight )
@@ -691,12 +564,13 @@ reduceSegmentsKernel( IndexType gridIdx,
 
    /////
    // Store the results
-   //if( strip == 1 )
-   //   printf( "Adding %f at %d \n", results[ this->rowPermArray[ warpStart + inWarpIdx ] & ( blockDim.x - 1 ) ], warpStart + inWarpIdx );
+   // if( strip == 1 )
+   //   printf( "Adding %f at %d \n", results[ this->rowPermArray[ warpStart + inWarpIdx ] & ( blockDim.x - 1 ) ], warpStart +
+   //   inWarpIdx );
    keeper( warpStart + inWarpIdx, results[ this->rowPermArray[ warpStart + inWarpIdx ] & ( blockDim.x - 1 ) ] );
 }
 #endif
 
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/CSR.h b/src/TNL/Algorithms/Segments/CSR.h
index 7c8b1e0c22dfad8228a096cdf4960781a70f3d1b..8712354186453a685855e1e43dfb07baa91d179d 100644
--- a/src/TNL/Algorithms/Segments/CSR.h
+++ b/src/TNL/Algorithms/Segments/CSR.h
@@ -14,8 +14,8 @@
 #include <TNL/Algorithms/Segments/ElementsOrganization.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
 /**
  * \brief Data structure for CSR segments format.
@@ -39,479 +39,521 @@ template< typename Device,
           typename IndexAllocator = typename Allocators::Default< Device >::template Allocator< Index > >
 class CSR
 {
-   public:
-
-      /**
-       * \brief The device where the segments are operating.
-       */
-      using DeviceType = Device;
-
-      /**
-       * \brief The type used for indexing of segments elements.
-       */
-      using IndexType = std::remove_const_t< Index >;
-
-      /**
-       * \brief Type of kernel used for reduction operations.
-       */
-      using KernelType = Kernel;
-
-      /**
-       * \brief Type of container storing offsets of particular rows.
-       */
-      using OffsetsContainer = Containers::Vector< Index, DeviceType, IndexType, IndexAllocator >;
-
-      /**
-       * \brief Templated view type.
-       *
-       * \tparam Device_ is alternative device type for the view.
-       * \tparam Index_ is alternative index type for the view.
-       */
-      template< typename Device_, typename Index_ >
-      using ViewTemplate = CSRView< Device_, Index_, KernelType >;
-
-      /**
-       * \brief Type of segments view.1
-       */
-      using ViewType = CSRView< Device, Index, KernelType >;
-
-      /**
-       * \brief Type of constant segments view.
-       */
-      using ConstViewType = CSRView< Device, std::add_const_t< IndexType >, KernelType >;
-
-      /**
-       * \brief Accessor type fro one particular segment.
-       */
-      using SegmentViewType = SegmentView< IndexType, RowMajorOrder >;
-
-      /**
-       * \brief This functions says that CSR format is always organised in row-major order.
-       */
-      static constexpr ElementsOrganization getOrganization() { return RowMajorOrder; }
-
-      /**
-       * \brief This function says that CSR format does not use padding elements.
-       */
-      static constexpr bool havePadding() { return false; };
-
-      /**
-       * \brief Construct with no parameters to create empty segments.
-       */
-      CSR();
-
-      /**
-       * \brief Construct with segments sizes.
-       *
-       * The number of segments is given by the size of \e segmentsSizes. Particular elements
-       * of this container define sizes of particular segments.
-       *
-       * \tparam SizesContainer is a type of container for segments sizes.  It can be \ref TNL::Containers::Array or
-       *  \ref TNL::Containers::Vector for example.
-       * \param sizes is an instance of the container with the segments sizes.
-       *
-       * See the following example:
-       *
-       * \includelineno Algorithms/Segments/SegmentsExample_CSR_constructor_1.cpp
-       *
-       * The result looks as follows:
-       *
-       * \include SegmentsExample_CSR_constructor_1.out
-       */
-      template< typename SizesContainer >
-      CSR( const SizesContainer& segmentsSizes );
-
-      /**
-       * \brief Construct with segments sizes in initializer list..
-       *
-       * The number of segments is given by the size of \e segmentsSizes. Particular elements
-       * of this initializer list define sizes of particular segments.
-       *
-       * \tparam ListIndex is a type of indexes of the initializer list.
-       * \param sizes is an instance of the container with the segments sizes.
-       *
-       * See the following example:
-       *
-       * \includelineno Algorithms/Segments/SegmentsExample_CSR_constructor_2.cpp
-       *
-       * The result looks as follows:
-       *
-       * \include SegmentsExample_CSR_constructor_2.out
-       */
-      template< typename ListIndex >
-      CSR( const std::initializer_list< ListIndex >& segmentsSizes );
-
-      /**
-       * \brief Copy constructor.
-       *
-       * \param segments are the source segments.
-       */
-      CSR( const CSR& segments ) = default;
-
-      /**
-       * \brief Move constructor.
-       *
-       * \param segments  are the source segments.
-       */
-      CSR( CSR&& segments ) = default;
-
-      /**
-       * \brief Returns string with serialization type.
-       *
-       * The string has a form `Algorithms::Segments::CSR< IndexType,  [any_device], [any_kernel], [any_allocator] >`.
-       *
-       * \return \ref String with the serialization type.
-       *
-       * \par Example
-       * \include Algorithms/Segments/SegmentsExample_CSR_getSerializationType.cpp
-       * \par Output
-       * \include SegmentsExample_CSR_getSerializationType.out
-       */
-      static String getSerializationType();
-
-      /**
-       * \brief Returns string with segments type.
-       *
-       * The string has a form `CSR< KernelType >`.
-       *
-       * \return \ref String with the segments type.
-       *
-       * \par Example
-       * \include Algorithms/Segments/SegmentsExample_CSR_getSegmentsType.cpp
-       * \par Output
-       * \include SegmentsExample_CSR_getSegmentsType.out
-       */
-      static String getSegmentsType();
-
-      /**
-       * \brief Set sizes of particular segments.
-       *
-       * \tparam SizesContainer is a container with segments sizes. It can be \ref TNL::Containers::Array or
-       *  \ref TNL::Containers::Vector for example.
-       *
-       * \param segmentsSizes is an instance of the container with segments sizes.
-       */
-      template< typename SizesContainer >
-      void setSegmentsSizes( const SizesContainer& segmentsSizes );
-
-      /**
-       * \brief Reset the segments to empty states.
-       *
-       * It means that there is no segment in the CSR segments.
-       */
-      void reset();
-
-      /**
-       * \brief Getter of a view object.
-       *
-       * \return View for this instance of CSR segments which can by used for example in
-       *  lambda functions running in GPU kernels.
-       */
-      ViewType getView();
-
-      /**
-       * \brief Getter of a view object for constants instances.
-       *
-       * \return View for this instance of CSR segments which can by used for example in
-       *  lambda functions running in GPU kernels.
-       */
-      const ConstViewType getConstView() const;
-
-      /**
-       * \brief Getter of number of segments.
-       *
-       * \return number of segments within this object.
-       */
-      __cuda_callable__
-      IndexType getSegmentsCount() const;
-
-      /**
-       * \brief Returns size of particular segment.
-       *
-       * \return size of the segment number \e segmentIdx.
-       */
-      __cuda_callable__
-      IndexType getSegmentSize( const IndexType segmentIdx ) const;
-
-      /***
-       * \brief Returns number of elements managed by all segments.
-       *
-       * \return number of elements managed by all segments.
-       */
-      __cuda_callable__
-      IndexType getSize() const;
-
-      /**
-       * \brief Returns number of elements that needs to be allocated by a container connected to this segments.
-       *
-       * \return size of container connected to this segments.
-       */
-      __cuda_callable__
-      IndexType getStorageSize() const;
-
-      /**
-       * \brief Computes the global index of an element managed by the segments.
-       *
-       * The global index serves as a refernce on the element in its container.
-       *
-       * \param segmentIdx is index of a segment with the element.
-       * \param localIdx is tha local index of the element within the segment.
-       * \return global index of the element.
-       */
-      __cuda_callable__
-      IndexType getGlobalIndex( const Index segmentIdx, const Index localIdx ) const;
-
-      /**
-       * \brief Returns segment view (i.e. segment accessor) of segment with given index.
-       *
-       * \param segmentIdx is index of the request segment.
-       * \return segment view of given segment.
-       *
-       * \par Example
-       * \include Algorithms/Segments/SegmentsExample_CSR_getSegmentView.cpp
-       * \par Output
-       * \include SegmentsExample_CSR_getSegmentView.out
-       */
-      __cuda_callable__
-      SegmentViewType getSegmentView( const IndexType segmentIdx ) const;
-
-      /**
-       * \brief Returns reference on constant vector with row offsets used in the CSR format.
-       *
-       * \return reference on constant vector with row offsets used in the CSR format.
-       */
-      const OffsetsContainer& getOffsets() const;
-
-      /**
-       * \brief Returns reference on vector with row offsets used in the CSR format.
-       *
-       * \return reference on vector with row offsets used in the CSR format.
-       */
-      OffsetsContainer& getOffsets();
-
-      /**
-       * \brief Iterate over all elements of given segments in parallel and call given lambda function.
-       *
-       * \tparam Function is a type of the lambda function to be performed on each element.
-       * \param begin defines begining of an interval [ \e begin, \e end ) of segments on
-       *    elements of which we want to apply the lambda function.
-       * \param end defines end of an interval [ \e begin, \e end ) of segments on
-       *    elements of which we want to apply the lambda function.
-       * \param function is the lambda function to be applied on the elements of the segments.
-       *
-       * Declaration of the lambda function \e function is supposed to be
-       *
-       * ```
-       * auto f = [=] __cuda_callable__ ( IndexType segmentIdx, IndexType localIdx, IndexType globalIdx ) {...}
-       * ```
-       * where \e segmentIdx is index of segment where given element belong to, \e localIdx is rank of the element
-       * within the segment and \e globalIdx is index of the element within the related container.
-       *
-       * \par Example
-       * \include Algorithms/Segments/SegmentsExample_CSR_forElements.cpp
-       * \par Output
-       * \include SegmentsExample_CSR_forElements.out
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function&& function ) const;
-
-      /**
-       * \brief Call \ref TNL::Algorithms::Segments::CSR::forElements for all elements of the segments.
-       *
-       * See \ref TNL::Algorithms::Segments::CSR::forElements for more details.
-       */
-      template< typename Function >
-      void forAllElements( Function&& function ) const;
-
-      /**
-       * \brief Iterate over all segments in parallel and call given lambda function.
-       *
-       * \tparam Function is a type of the lambda function to be performed on each segment.
-       * \param begin defines begining of an interval [ \e begin, \e end ) of segments on
-       *    elements of which we want to apply the lambda function.
-       * \param end defines end of an interval [ \e begin, \e end ) of segments on
-       *    elements of which we want to apply the lambda function.
-       * \param function is the lambda function to be applied on the elements of the segments.
-       *
-       *  Declaration of the lambda function \e function is supposed to be
-       *
-       * ```
-       * auto f = [=] __cuda_callable__ ( const SegmentView& segment ) {...}
-       * ```
-       * where \e segment represents given segment (see \ref TNL::Algorithms::Segments::SegmentView).
-       * Its type is given by \ref SegmentViewType.
-       *
-       * \par Example
-       * \include Algorithms/Segments/SegmentsExample_CSR_forSegments.cpp
-       * \par Output
-       * \include SegmentsExample_CSR_forSegments.out
-       */
-      template< typename Function >
-      void forSegments( IndexType begin, IndexType end, Function&& function ) const;
-
-      /**
-       * \brief Call \ref TNL::Algorithms::Segments::CSR::forSegments for all segments.
-       *
-       * See \ref TNL::Algorithms::Segments::CSR::forSegments for more details.
-       */
-      template< typename Function >
-      void forAllSegments( Function&& function ) const;
-
-      /**
-       * \brief Call \ref TNL::Algorithms::Segments::CSR::forSegments sequentially for particular segments.
-       *
-       * With this method, the given segments are processed sequentially one-by-one. This is usefull for example
-       * for printing of segments based data structures or for debugging reasons.
-       *
-       * \param begin defines begining of an interval [ \e begin, \e end ) of segments on
-       *    elements of which we want to apply the lambda function.
-       * \param end defines end of an interval [ \e begin, \e end ) of segments on
-       *    elements of which we want to apply the lambda function.
-       * \param function is the lambda function to be applied on the elements of the segments.
-       *
-       * See \ref TNL::Algorithms::Segments::CSR::forSegments for more details.
-       *
-       * \par Example
-       * \include Algorithms/Segments/SegmentsExample_CSR_sequentialForSegments.cpp
-       * \par Output
-       * \include SegmentsExample_CSR_sequentialForSegments.out
-       */
-      template< typename Function >
-      void sequentialForSegments( IndexType begin, IndexType end, Function&& function ) const;
-
-      /**
-       * \brief Call \ref TNL::Algorithms::Segments::CSR::sequentialForSegments for all segments.
-       *
-       * See \ref TNL::Algorithms::Segments::CSR::sequentialForSegments for more details.
-       */
-      template< typename Function >
-      void sequentialForAllSegments( Function&& f ) const;
-
-      /**
-       * \brief Compute reduction in each segment.
-       *
-       * \tparam Fetch is type of lambda function for data fetching.
-       * \tparam Reduce is a reduction operation.
-       * \tparam Keep is lambda function for storing results from particular segments.
-       *
-       * \param begin defines begining of an interval [ \e begin, \e end ) of segments in
-       *    which we want to perform the reduction.
-       * \param end defines and of an interval [ \e begin, \e end ) of segments in
-       *    which we want to perform the reduction.
-       * \param fetch is a lambda function for fetching of data. It is suppos have one of the
-       *  following forms:
-       * 1. Full form
-       *  ```
-       *  auto fetch = [=] __cuda_callable__ ( IndexType segmentIdx, IndexType localIdx, IndexType globalIdx, bool& compute ) { ... }
-       *  ```
-       * 2. Brief form
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType globalIdx, bool& compute ) { ... }
-       * ```
-       * where for both variants \e segmentIdx is segment index, \e localIdx is a rank of element in the segment, \e globalIdx is index of the element
-       * in related container and \e compute is a boolean variable which serves for stopping the reduction if it is set to \e false. It is however,
-       * only a hint and the real behaviour depends on type of kernel used ofr the redcution.
-       * Some kernels are optimized so that they can be significantly faster with the brief variant of the \e fetch lambda function.
-       * \param reduce is a lambda function representing the reduction opeartion. It is supposed to be defined as:
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const Value& a, const Value& b ) -> Value { ... }
-       * ```
-       *
-       * where \e a and \e b are values to be reduced and the lambda function returns result of the reduction.
-       * \param keep is a lambda function for saving results from particular segments. It is supposed to be defined as:
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( IndexType segmentIdx, const Value& value ) { ... }
-       * ```
-       *
-       * where \e segmentIdx is an index of the segment and \e value is the result of the reduction in given segment to be stored.
-       *
-       * \par Example
-       * \include Algorithms/Segments/SegmentsExample_CSR_reduceSegments.cpp
-       * \par Output
-       * \include SegmentsExample_CSR_reduceSegments.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename Value >
-      void reduceSegments( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const Value& zero ) const;
-
-      /**
-       * \brief Call \ref TNL::Algorithms::Segments::CSR::reduceSegments for all segments.
-       *
-       * See \ref TNL::Algorithms::Segments::CSR::reduceSegments for more details.
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename Value >
-      void reduceAllSegments( Fetch& fetch, const Reduce& reduce, Keep& keep, const Value& zero ) const;
-
-      /**
-       * \brief Assignment operator.
-       *
-       * It makes a deep copy of the source segments.
-       *
-       * \param source are the CSR segments to be assigned.
-       * \return reference to this instance.
-       */
-      CSR& operator=( const CSR& source ) = default;
-
-      /**
-       * \brief Assignment operator with CSR segments with different template parameters.
-       *
-       * It makes a deep copy of the source segments.
-       *
-       * \tparam Device_ is device type of the source segments.
-       * \tparam Index_ is the index type of the source segments.
-       * \tparam Kernel_ is the kernel type of the source segments.
-       * \tparam IndexAllocator_ is the index allocator of the source segments.
-       * \param source is the source segments object.
-       * \return reference to this instance.
-       */
-      template< typename Device_, typename Index_, typename Kernel_, typename IndexAllocator_ >
-      CSR& operator=( const CSR< Device_, Index_, Kernel_, IndexAllocator_ >& source );
-
-      /**
-       * \brief Method for saving the segments to a file in a binary form.
-       *
-       * \param file is the target file.
-       */
-      void save( File& file ) const;
-
-      /**
-       * \brief Method for loading the segments from a file in a binary form.
-       *
-       * \param file is the source file.
-       */
-      void load( File& file );
-
-      /**
-       * \brief Return simple proxy object for insertion to output stream.
-       *
-       * The proxy object serves for wrapping segments with lambda function mediating access to data managed by the segments.
-       *
-       * \tparam Fetch is type of lambda function for data access.
-       * \param fetch is an instance of lambda function for data access. It is supposed to be defined as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType globalIdx ) -> ValueType { return data_view[ globalIdx ]; };
-       * ```
-       * \return Proxy object for insertion to output stream.
-       *
-       * \par Example
-       * \include Algorithms/Segments/SegmentsPrintingExample-2.cpp
-       * \par Output
-       * \include SegmentsPrintingExample-2.out
-       */
-      template< typename Fetch >
-      SegmentsPrinter< CSR, Fetch > print( Fetch&& fetch ) const;
-
-      KernelType& getKernel() { return kernel; }
-
-      const KernelType& getKernel() const { return kernel; }
-
-   protected:
-
-      OffsetsContainer offsets;
-
-      KernelType kernel;
+public:
+   /**
+    * \brief The device where the segments are operating.
+    */
+   using DeviceType = Device;
+
+   /**
+    * \brief The type used for indexing of segments elements.
+    */
+   using IndexType = std::remove_const_t< Index >;
+
+   /**
+    * \brief Type of kernel used for reduction operations.
+    */
+   using KernelType = Kernel;
+
+   /**
+    * \brief Type of container storing offsets of particular rows.
+    */
+   using OffsetsContainer = Containers::Vector< Index, DeviceType, IndexType, IndexAllocator >;
+
+   /**
+    * \brief Templated view type.
+    *
+    * \tparam Device_ is alternative device type for the view.
+    * \tparam Index_ is alternative index type for the view.
+    */
+   template< typename Device_, typename Index_ >
+   using ViewTemplate = CSRView< Device_, Index_, KernelType >;
+
+   /**
+    * \brief Type of segments view.1
+    */
+   using ViewType = CSRView< Device, Index, KernelType >;
+
+   /**
+    * \brief Type of constant segments view.
+    */
+   using ConstViewType = CSRView< Device, std::add_const_t< IndexType >, KernelType >;
+
+   /**
+    * \brief Accessor type fro one particular segment.
+    */
+   using SegmentViewType = SegmentView< IndexType, RowMajorOrder >;
+
+   /**
+    * \brief This functions says that CSR format is always organised in row-major order.
+    */
+   static constexpr ElementsOrganization
+   getOrganization()
+   {
+      return RowMajorOrder;
+   }
+
+   /**
+    * \brief This function says that CSR format does not use padding elements.
+    */
+   static constexpr bool
+   havePadding()
+   {
+      return false;
+   };
+
+   /**
+    * \brief Construct with no parameters to create empty segments.
+    */
+   CSR() = default;
+
+   /**
+    * \brief Construct with segments sizes.
+    *
+    * The number of segments is given by the size of \e segmentsSizes. Particular elements
+    * of this container define sizes of particular segments.
+    *
+    * \tparam SizesContainer is a type of container for segments sizes.  It can be \ref TNL::Containers::Array or
+    *  \ref TNL::Containers::Vector for example.
+    * \param sizes is an instance of the container with the segments sizes.
+    *
+    * See the following example:
+    *
+    * \includelineno Algorithms/Segments/SegmentsExample_CSR_constructor_1.cpp
+    *
+    * The result looks as follows:
+    *
+    * \include SegmentsExample_CSR_constructor_1.out
+    */
+   template< typename SizesContainer >
+   CSR( const SizesContainer& segmentsSizes );
+
+   /**
+    * \brief Construct with segments sizes in initializer list..
+    *
+    * The number of segments is given by the size of \e segmentsSizes. Particular elements
+    * of this initializer list define sizes of particular segments.
+    *
+    * \tparam ListIndex is a type of indexes of the initializer list.
+    * \param sizes is an instance of the container with the segments sizes.
+    *
+    * See the following example:
+    *
+    * \includelineno Algorithms/Segments/SegmentsExample_CSR_constructor_2.cpp
+    *
+    * The result looks as follows:
+    *
+    * \include SegmentsExample_CSR_constructor_2.out
+    */
+   template< typename ListIndex >
+   CSR( const std::initializer_list< ListIndex >& segmentsSizes );
+
+   /**
+    * \brief Copy constructor.
+    *
+    * \param segments are the source segments.
+    */
+   CSR( const CSR& segments ) = default;
+
+   /**
+    * \brief Move constructor.
+    *
+    * \param segments  are the source segments.
+    */
+   CSR( CSR&& segments ) noexcept = default;
+
+   /**
+    * \brief Returns string with serialization type.
+    *
+    * The string has a form `Algorithms::Segments::CSR< IndexType,  [any_device], [any_kernel], [any_allocator] >`.
+    *
+    * \return String with the serialization type.
+    *
+    * \par Example
+    * \include Algorithms/Segments/SegmentsExample_CSR_getSerializationType.cpp
+    * \par Output
+    * \include SegmentsExample_CSR_getSerializationType.out
+    */
+   static std::string
+   getSerializationType();
+
+   /**
+    * \brief Returns string with segments type.
+    *
+    * The string has a form `CSR< KernelType >`.
+    *
+    * \return \ref String with the segments type.
+    *
+    * \par Example
+    * \include Algorithms/Segments/SegmentsExample_CSR_getSegmentsType.cpp
+    * \par Output
+    * \include SegmentsExample_CSR_getSegmentsType.out
+    */
+   static String
+   getSegmentsType();
+
+   /**
+    * \brief Set sizes of particular segments.
+    *
+    * \tparam SizesContainer is a container with segments sizes. It can be \ref TNL::Containers::Array or
+    *  \ref TNL::Containers::Vector for example.
+    *
+    * \param segmentsSizes is an instance of the container with segments sizes.
+    */
+   template< typename SizesContainer >
+   void
+   setSegmentsSizes( const SizesContainer& segmentsSizes );
+
+   /**
+    * \brief Reset the segments to empty states.
+    *
+    * It means that there is no segment in the CSR segments.
+    */
+   void
+   reset();
+
+   /**
+    * \brief Getter of a view object.
+    *
+    * \return View for this instance of CSR segments which can by used for example in
+    *  lambda functions running in GPU kernels.
+    */
+   ViewType
+   getView();
+
+   /**
+    * \brief Getter of a view object for constants instances.
+    *
+    * \return View for this instance of CSR segments which can by used for example in
+    *  lambda functions running in GPU kernels.
+    */
+   const ConstViewType
+   getConstView() const;
+
+   /**
+    * \brief Getter of number of segments.
+    *
+    * \return number of segments within this object.
+    */
+   __cuda_callable__
+   IndexType
+   getSegmentsCount() const;
+
+   /**
+    * \brief Returns size of particular segment.
+    *
+    * \return size of the segment number \e segmentIdx.
+    */
+   __cuda_callable__
+   IndexType
+   getSegmentSize( IndexType segmentIdx ) const;
+
+   /***
+    * \brief Returns number of elements managed by all segments.
+    *
+    * \return number of elements managed by all segments.
+    */
+   __cuda_callable__
+   IndexType
+   getSize() const;
+
+   /**
+    * \brief Returns number of elements that needs to be allocated by a container connected to this segments.
+    *
+    * \return size of container connected to this segments.
+    */
+   __cuda_callable__
+   IndexType
+   getStorageSize() const;
+
+   /**
+    * \brief Computes the global index of an element managed by the segments.
+    *
+    * The global index serves as a refernce on the element in its container.
+    *
+    * \param segmentIdx is index of a segment with the element.
+    * \param localIdx is tha local index of the element within the segment.
+    * \return global index of the element.
+    */
+   __cuda_callable__
+   IndexType
+   getGlobalIndex( Index segmentIdx, Index localIdx ) const;
+
+   /**
+    * \brief Returns segment view (i.e. segment accessor) of segment with given index.
+    *
+    * \param segmentIdx is index of the request segment.
+    * \return segment view of given segment.
+    *
+    * \par Example
+    * \include Algorithms/Segments/SegmentsExample_CSR_getSegmentView.cpp
+    * \par Output
+    * \include SegmentsExample_CSR_getSegmentView.out
+    */
+   __cuda_callable__
+   SegmentViewType
+   getSegmentView( IndexType segmentIdx ) const;
+
+   /**
+    * \brief Returns reference on constant vector with row offsets used in the CSR format.
+    *
+    * \return reference on constant vector with row offsets used in the CSR format.
+    */
+   const OffsetsContainer&
+   getOffsets() const;
+
+   /**
+    * \brief Returns reference on vector with row offsets used in the CSR format.
+    *
+    * \return reference on vector with row offsets used in the CSR format.
+    */
+   OffsetsContainer&
+   getOffsets();
+
+   /**
+    * \brief Iterate over all elements of given segments in parallel and call given lambda function.
+    *
+    * \tparam Function is a type of the lambda function to be performed on each element.
+    * \param begin defines begining of an interval [ \e begin, \e end ) of segments on
+    *    elements of which we want to apply the lambda function.
+    * \param end defines end of an interval [ \e begin, \e end ) of segments on
+    *    elements of which we want to apply the lambda function.
+    * \param function is the lambda function to be applied on the elements of the segments.
+    *
+    * Declaration of the lambda function \e function is supposed to be
+    *
+    * ```
+    * auto f = [=] __cuda_callable__ ( IndexType segmentIdx, IndexType localIdx, IndexType globalIdx ) {...}
+    * ```
+    * where \e segmentIdx is index of segment where given element belong to, \e localIdx is rank of the element
+    * within the segment and \e globalIdx is index of the element within the related container.
+    *
+    * \par Example
+    * \include Algorithms/Segments/SegmentsExample_CSR_forElements.cpp
+    * \par Output
+    * \include SegmentsExample_CSR_forElements.out
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function&& function ) const;
+
+   /**
+    * \brief Call \ref TNL::Algorithms::Segments::CSR::forElements for all elements of the segments.
+    *
+    * See \ref TNL::Algorithms::Segments::CSR::forElements for more details.
+    */
+   template< typename Function >
+   void
+   forAllElements( Function&& function ) const;
+
+   /**
+    * \brief Iterate over all segments in parallel and call given lambda function.
+    *
+    * \tparam Function is a type of the lambda function to be performed on each segment.
+    * \param begin defines begining of an interval [ \e begin, \e end ) of segments on
+    *    elements of which we want to apply the lambda function.
+    * \param end defines end of an interval [ \e begin, \e end ) of segments on
+    *    elements of which we want to apply the lambda function.
+    * \param function is the lambda function to be applied on the elements of the segments.
+    *
+    *  Declaration of the lambda function \e function is supposed to be
+    *
+    * ```
+    * auto f = [=] __cuda_callable__ ( const SegmentView& segment ) {...}
+    * ```
+    * where \e segment represents given segment (see \ref TNL::Algorithms::Segments::SegmentView).
+    * Its type is given by \ref SegmentViewType.
+    *
+    * \par Example
+    * \include Algorithms/Segments/SegmentsExample_CSR_forSegments.cpp
+    * \par Output
+    * \include SegmentsExample_CSR_forSegments.out
+    */
+   template< typename Function >
+   void
+   forSegments( IndexType begin, IndexType end, Function&& function ) const;
+
+   /**
+    * \brief Call \ref TNL::Algorithms::Segments::CSR::forSegments for all segments.
+    *
+    * See \ref TNL::Algorithms::Segments::CSR::forSegments for more details.
+    */
+   template< typename Function >
+   void
+   forAllSegments( Function&& function ) const;
+
+   /**
+    * \brief Call \ref TNL::Algorithms::Segments::CSR::forSegments sequentially for particular segments.
+    *
+    * With this method, the given segments are processed sequentially one-by-one. This is usefull for example
+    * for printing of segments based data structures or for debugging reasons.
+    *
+    * \param begin defines begining of an interval [ \e begin, \e end ) of segments on
+    *    elements of which we want to apply the lambda function.
+    * \param end defines end of an interval [ \e begin, \e end ) of segments on
+    *    elements of which we want to apply the lambda function.
+    * \param function is the lambda function to be applied on the elements of the segments.
+    *
+    * See \ref TNL::Algorithms::Segments::CSR::forSegments for more details.
+    *
+    * \par Example
+    * \include Algorithms/Segments/SegmentsExample_CSR_sequentialForSegments.cpp
+    * \par Output
+    * \include SegmentsExample_CSR_sequentialForSegments.out
+    */
+   template< typename Function >
+   void
+   sequentialForSegments( IndexType begin, IndexType end, Function&& function ) const;
+
+   /**
+    * \brief Call \ref TNL::Algorithms::Segments::CSR::sequentialForSegments for all segments.
+    *
+    * See \ref TNL::Algorithms::Segments::CSR::sequentialForSegments for more details.
+    */
+   template< typename Function >
+   void
+   sequentialForAllSegments( Function&& f ) const;
+
+   /**
+    * \brief Compute reduction in each segment.
+    *
+    * \tparam Fetch is type of lambda function for data fetching.
+    * \tparam Reduce is a reduction operation.
+    * \tparam Keep is lambda function for storing results from particular segments.
+    *
+    * \param begin defines begining of an interval [ \e begin, \e end ) of segments in
+    *    which we want to perform the reduction.
+    * \param end defines and of an interval [ \e begin, \e end ) of segments in
+    *    which we want to perform the reduction.
+    * \param fetch is a lambda function for fetching of data. It is suppos have one of the
+    *  following forms:
+    * 1. Full form
+    *  ```
+    *  auto fetch = [=] __cuda_callable__ ( IndexType segmentIdx, IndexType localIdx, IndexType globalIdx, bool& compute ) { ...
+    * }
+    *  ```
+    * 2. Brief form
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType globalIdx, bool& compute ) { ... }
+    * ```
+    * where for both variants \e segmentIdx is segment index, \e localIdx is a rank of element in the segment, \e globalIdx is
+    * index of the element in related container and \e compute is a boolean variable which serves for stopping the reduction if
+    * it is set to \e false. It is however, only a hint and the real behaviour depends on type of kernel used ofr the redcution.
+    * Some kernels are optimized so that they can be significantly faster with the brief variant of the \e fetch lambda
+    * function. \param reduce is a lambda function representing the reduction opeartion. It is supposed to be defined as:
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const Value& a, const Value& b ) -> Value { ... }
+    * ```
+    *
+    * where \e a and \e b are values to be reduced and the lambda function returns result of the reduction.
+    * \param keep is a lambda function for saving results from particular segments. It is supposed to be defined as:
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( IndexType segmentIdx, const Value& value ) { ... }
+    * ```
+    *
+    * where \e segmentIdx is an index of the segment and \e value is the result of the reduction in given segment to be stored.
+    *
+    * \par Example
+    * \include Algorithms/Segments/SegmentsExample_CSR_reduceSegments.cpp
+    * \par Output
+    * \include SegmentsExample_CSR_reduceSegments.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename Value >
+   void
+   reduceSegments( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const Value& zero ) const;
+
+   /**
+    * \brief Call \ref TNL::Algorithms::Segments::CSR::reduceSegments for all segments.
+    *
+    * See \ref TNL::Algorithms::Segments::CSR::reduceSegments for more details.
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename Value >
+   void
+   reduceAllSegments( Fetch& fetch, const Reduce& reduce, Keep& keep, const Value& zero ) const;
+
+   /**
+    * \brief Assignment operator.
+    *
+    * It makes a deep copy of the source segments.
+    *
+    * \param source are the CSR segments to be assigned.
+    * \return reference to this instance.
+    */
+   CSR&
+   operator=( const CSR& source ) = default;
+
+   /**
+    * \brief Assignment operator with CSR segments with different template parameters.
+    *
+    * It makes a deep copy of the source segments.
+    *
+    * \tparam Device_ is device type of the source segments.
+    * \tparam Index_ is the index type of the source segments.
+    * \tparam Kernel_ is the kernel type of the source segments.
+    * \tparam IndexAllocator_ is the index allocator of the source segments.
+    * \param source is the source segments object.
+    * \return reference to this instance.
+    */
+   template< typename Device_, typename Index_, typename Kernel_, typename IndexAllocator_ >
+   CSR&
+   operator=( const CSR< Device_, Index_, Kernel_, IndexAllocator_ >& source );
+
+   /**
+    * \brief Method for saving the segments to a file in a binary form.
+    *
+    * \param file is the target file.
+    */
+   void
+   save( File& file ) const;
+
+   /**
+    * \brief Method for loading the segments from a file in a binary form.
+    *
+    * \param file is the source file.
+    */
+   void
+   load( File& file );
+
+   /**
+    * \brief Return simple proxy object for insertion to output stream.
+    *
+    * The proxy object serves for wrapping segments with lambda function mediating access to data managed by the segments.
+    *
+    * \tparam Fetch is type of lambda function for data access.
+    * \param fetch is an instance of lambda function for data access. It is supposed to be defined as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType globalIdx ) -> ValueType { return data_view[ globalIdx ]; };
+    * ```
+    * \return Proxy object for insertion to output stream.
+    *
+    * \par Example
+    * \include Algorithms/Segments/SegmentsPrintingExample-2.cpp
+    * \par Output
+    * \include SegmentsPrintingExample-2.out
+    */
+   template< typename Fetch >
+   SegmentsPrinter< CSR, Fetch >
+   print( Fetch&& fetch ) const;
+
+   KernelType&
+   getKernel()
+   {
+      return kernel;
+   }
+
+   const KernelType&
+   getKernel() const
+   {
+      return kernel;
+   }
+
+protected:
+   OffsetsContainer offsets;
+
+   KernelType kernel;
 };
 
 /**
@@ -525,11 +567,12 @@ class CSR
  * \param segments are the source segments.
  * \return reference to the output stream.
  */
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
-std::ostream& operator<<( std::ostream& str, const CSR< Device, Index, Kernel, IndexAllocator >& segments ) { return printSegments( segments, str ); }
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
+std::ostream&
+operator<<( std::ostream& str, const CSR< Device, Index, Kernel, IndexAllocator >& segments )
+{
+   return printSegments( segments, str );
+}
 
 template< typename Device,
           typename Index,
@@ -561,8 +604,8 @@ template< typename Device,
           typename IndexAllocator = typename Allocators::Default< Device >::template Allocator< Index > >
 using CSRDefault = CSRScalar< Device, Index, IndexAllocator >;
 
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
 
 #include <TNL/Algorithms/Segments/CSR.hpp>
diff --git a/src/TNL/Algorithms/Segments/CSR.hpp b/src/TNL/Algorithms/Segments/CSR.hpp
index c025cb19ac90ebc3429a303ee05e7de964d41d00..a94a90e9aab8afe3ac9d2332edbfbb308df81fb2 100644
--- a/src/TNL/Algorithms/Segments/CSR.hpp
+++ b/src/TNL/Algorithms/Segments/CSR.hpp
@@ -12,164 +12,109 @@
 #include <TNL/Algorithms/Segments/detail/CSR.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
-
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
-CSR< Device, Index, Kernel, IndexAllocator >::
-CSR()
-{
-}
-
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
-   template< typename SizesContainer >
-CSR< Device, Index, Kernel, IndexAllocator >::
-CSR( const SizesContainer& segmentsSizes )
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
+template< typename SizesContainer >
+CSR< Device, Index, Kernel, IndexAllocator >::CSR( const SizesContainer& segmentsSizes )
 {
    this->setSegmentsSizes( segmentsSizes );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
-   template< typename ListIndex >
-CSR< Device, Index, Kernel, IndexAllocator >::
-CSR( const std::initializer_list< ListIndex >& segmentsSizes )
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
+template< typename ListIndex >
+CSR< Device, Index, Kernel, IndexAllocator >::CSR( const std::initializer_list< ListIndex >& segmentsSizes )
 {
    this->setSegmentsSizes( Containers::Vector< IndexType, DeviceType, IndexType >( segmentsSizes ) );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
-String
-CSR< Device, Index, Kernel, IndexAllocator >::
-getSerializationType()
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
+std::string
+CSR< Device, Index, Kernel, IndexAllocator >::getSerializationType()
 {
-   return "CSR< [any_device], " +
-      TNL::getSerializationType< IndexType >() + ", " +
-      // FIXME: the serialized data do not depend on the the kernel type so it should not be in the serialization type
-      TNL::getSerializationType< KernelType >() + " >";
+   return "CSR< [any_device], " + TNL::getSerializationType< IndexType >() + ", " +
+          // FIXME: the serialized data do not depend on the the kernel type so it should not be in the serialization type
+          TNL::getSerializationType< KernelType >() + " >";
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
 String
-CSR< Device, Index, Kernel, IndexAllocator >::
-getSegmentsType()
+CSR< Device, Index, Kernel, IndexAllocator >::getSegmentsType()
 {
    return ViewType::getSegmentsType();
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
-   template< typename SizesHolder >
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
+template< typename SizesHolder >
 void
-CSR< Device, Index, Kernel, IndexAllocator >::
-setSegmentsSizes( const SizesHolder& sizes )
+CSR< Device, Index, Kernel, IndexAllocator >::setSegmentsSizes( const SizesHolder& sizes )
 {
    detail::CSR< Device, Index >::setSegmentsSizes( sizes, this->offsets );
    this->kernel.init( this->offsets );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
 void
-CSR< Device, Index, Kernel, IndexAllocator >::
-reset()
+CSR< Device, Index, Kernel, IndexAllocator >::reset()
 {
    this->offsets.setSize( 1 );
    this->offsets = 0;
    this->kernel.reset();
 }
 
-
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
 typename CSR< Device, Index, Kernel, IndexAllocator >::ViewType
-CSR< Device, Index, Kernel, IndexAllocator >::
-getView()
+CSR< Device, Index, Kernel, IndexAllocator >::getView()
 {
    return ViewType( this->offsets.getView(), this->kernel.getView() );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
 auto
-CSR< Device, Index, Kernel, IndexAllocator >::
-getConstView() const -> const ConstViewType
+CSR< Device, Index, Kernel, IndexAllocator >::getConstView() const -> const ConstViewType
 {
    return ConstViewType( this->offsets.getConstView(), this->kernel.getConstView() );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
-__cuda_callable__ auto CSR< Device, Index, Kernel, IndexAllocator >::
-getSegmentsCount() const -> IndexType
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
+__cuda_callable__
+auto
+CSR< Device, Index, Kernel, IndexAllocator >::getSegmentsCount() const -> IndexType
 {
    return this->offsets.getSize() - 1;
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
-__cuda_callable__ auto CSR< Device, Index, Kernel, IndexAllocator >::
-getSegmentSize( const IndexType segmentIdx ) const -> IndexType
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
+__cuda_callable__
+auto
+CSR< Device, Index, Kernel, IndexAllocator >::getSegmentSize( const IndexType segmentIdx ) const -> IndexType
 {
    return detail::CSR< Device, Index >::getSegmentSize( this->offsets, segmentIdx );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
-__cuda_callable__ auto CSR< Device, Index, Kernel, IndexAllocator >::
-getSize() const -> IndexType
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
+__cuda_callable__
+auto
+CSR< Device, Index, Kernel, IndexAllocator >::getSize() const -> IndexType
 {
    return this->getStorageSize();
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
-__cuda_callable__ auto CSR< Device, Index, Kernel, IndexAllocator >::
-getStorageSize() const -> IndexType
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
+__cuda_callable__
+auto
+CSR< Device, Index, Kernel, IndexAllocator >::getStorageSize() const -> IndexType
 {
    return detail::CSR< Device, Index >::getStorageSize( this->offsets );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
-__cuda_callable__ auto CSR< Device, Index, Kernel, IndexAllocator >::
-getGlobalIndex( const Index segmentIdx, const Index localIdx ) const -> IndexType
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
+__cuda_callable__
+auto
+CSR< Device, Index, Kernel, IndexAllocator >::getGlobalIndex( const Index segmentIdx, const Index localIdx ) const -> IndexType
 {
-   if( ! std::is_same< DeviceType, Devices::Host >::value )
-   {
+   if( ! std::is_same< DeviceType, Devices::Host >::value ) {
 #ifdef __CUDA_ARCH__
       return offsets[ segmentIdx ] + localIdx;
 #else
@@ -179,185 +124,133 @@ getGlobalIndex( const Index segmentIdx, const Index localIdx ) const -> IndexTyp
    return offsets[ segmentIdx ] + localIdx;
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
 __cuda_callable__
 auto
-CSR< Device, Index, Kernel, IndexAllocator >::
-getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType
+CSR< Device, Index, Kernel, IndexAllocator >::getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType
 {
    return SegmentViewType( segmentIdx, offsets[ segmentIdx ], offsets[ segmentIdx + 1 ] - offsets[ segmentIdx ] );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
 auto
-CSR< Device, Index, Kernel, IndexAllocator >::
-getOffsets() const -> const OffsetsContainer&
+CSR< Device, Index, Kernel, IndexAllocator >::getOffsets() const -> const OffsetsContainer&
 {
    return this->offsets;
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
 auto
-CSR< Device, Index, Kernel, IndexAllocator >::
-getOffsets() -> OffsetsContainer&
+CSR< Device, Index, Kernel, IndexAllocator >::getOffsets() -> OffsetsContainer&
 {
    return this->offsets;
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
-   template< typename Function >
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
+template< typename Function >
 void
-CSR< Device, Index, Kernel, IndexAllocator >::
-forElements( IndexType begin, IndexType end, Function&& f ) const
+CSR< Device, Index, Kernel, IndexAllocator >::forElements( IndexType begin, IndexType end, Function&& f ) const
 {
    this->getConstView().forElements( begin, end, f );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
-   template< typename Function >
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
+template< typename Function >
 void
-CSR< Device, Index, Kernel, IndexAllocator >::
-forAllElements( Function&& f ) const
+CSR< Device, Index, Kernel, IndexAllocator >::forAllElements( Function&& f ) const
 {
    this->forElements( 0, this->getSegmentsCount(), f );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
-   template< typename Function >
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
+template< typename Function >
 void
-CSR< Device, Index, Kernel, IndexAllocator >::
-forSegments( IndexType begin, IndexType end, Function&& f ) const
+CSR< Device, Index, Kernel, IndexAllocator >::forSegments( IndexType begin, IndexType end, Function&& f ) const
 {
    this->getConstView().forSegments( begin, end, f );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
-   template< typename Function >
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
+template< typename Function >
 void
-CSR< Device, Index, Kernel, IndexAllocator >::
-forAllSegments( Function&& f ) const
+CSR< Device, Index, Kernel, IndexAllocator >::forAllSegments( Function&& f ) const
 {
    this->getConstView().forAllSegments( f );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
-   template< typename Function >
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
+template< typename Function >
 void
-CSR< Device, Index, Kernel, IndexAllocator >::
-sequentialForSegments( IndexType begin, IndexType end, Function&& f ) const
+CSR< Device, Index, Kernel, IndexAllocator >::sequentialForSegments( IndexType begin, IndexType end, Function&& f ) const
 {
    this->getConstView().sequentialForSegments( begin, end, f );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
-   template< typename Function >
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
+template< typename Function >
 void
-CSR< Device, Index, Kernel, IndexAllocator >::
-sequentialForAllSegments( Function&& f ) const
+CSR< Device, Index, Kernel, IndexAllocator >::sequentialForAllSegments( Function&& f ) const
 {
    this->getConstView().sequentialForAllSegments( f );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
-   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
 void
-CSR< Device, Index, Kernel, IndexAllocator >::
-reduceSegments( IndexType first, IndexType last, Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const
+CSR< Device, Index, Kernel, IndexAllocator >::reduceSegments( IndexType first,
+                                                              IndexType last,
+                                                              Fetch& fetch,
+                                                              const Reduction& reduction,
+                                                              ResultKeeper& keeper,
+                                                              const Real& zero ) const
 {
    this->getConstView().reduceSegments( first, last, fetch, reduction, keeper, zero );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
-   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
 void
-CSR< Device, Index, Kernel, IndexAllocator >::
-reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const
+CSR< Device, Index, Kernel, IndexAllocator >::reduceAllSegments( Fetch& fetch,
+                                                                 const Reduction& reduction,
+                                                                 ResultKeeper& keeper,
+                                                                 const Real& zero ) const
 {
    this->reduceSegments( 0, this->getSegmentsCount(), fetch, reduction, keeper, zero );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
-   template< typename Device_, typename Index_, typename Kernel_, typename IndexAllocator_ >
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
+template< typename Device_, typename Index_, typename Kernel_, typename IndexAllocator_ >
 CSR< Device, Index, Kernel, IndexAllocator >&
-CSR< Device, Index, Kernel, IndexAllocator >::
-operator=( const CSR< Device_, Index_, Kernel_, IndexAllocator_ >& source )
+CSR< Device, Index, Kernel, IndexAllocator >::operator=( const CSR< Device_, Index_, Kernel_, IndexAllocator_ >& source )
 {
    this->offsets = source.offsets;
    this->kernel = kernel;
    return *this;
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
 void
-CSR< Device, Index, Kernel, IndexAllocator >::
-save( File& file ) const
+CSR< Device, Index, Kernel, IndexAllocator >::save( File& file ) const
 {
    file << this->offsets;
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
 void
-CSR< Device, Index, Kernel, IndexAllocator >::
-load( File& file )
+CSR< Device, Index, Kernel, IndexAllocator >::load( File& file )
 {
    file >> this->offsets;
    this->kernel.init( this->offsets );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel,
-          typename IndexAllocator >
-      template< typename Fetch >
+template< typename Device, typename Index, typename Kernel, typename IndexAllocator >
+template< typename Fetch >
 auto
-CSR< Device, Index, Kernel, IndexAllocator >::
-print( Fetch&& fetch ) const -> SegmentsPrinter< CSR, Fetch >
+CSR< Device, Index, Kernel, IndexAllocator >::print( Fetch&& fetch ) const -> SegmentsPrinter< CSR, Fetch >
 {
    return SegmentsPrinter< CSR, Fetch >( *this, fetch );
 }
 
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/CSRView.h b/src/TNL/Algorithms/Segments/CSRView.h
index 91f89b4a6ef77979cf70b127318b5ac57130791f..e4d98a1641de3ac3f01dfad374c9779f7c15d427 100644
--- a/src/TNL/Algorithms/Segments/CSRView.h
+++ b/src/TNL/Algorithms/Segments/CSRView.h
@@ -18,171 +18,200 @@
 #include <TNL/Algorithms/Segments/SegmentsPrinting.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
-template< typename Device,
-          typename Index,
-          typename Kernel = CSRScalarKernel< Index, Device > >
+template< typename Device, typename Index, typename Kernel = CSRScalarKernel< Index, Device > >
 class CSRView
 {
-   public:
-
-      using DeviceType = Device;
-      using IndexType = std::remove_const_t< Index >;
-      using KernelType = Kernel;
-      using OffsetsView = typename Containers::VectorView< Index, DeviceType, IndexType >;
-      using ConstOffsetsView = typename Containers::Vector< Index, DeviceType, IndexType >::ConstViewType;
-      using KernelView = typename Kernel::ViewType;
-      using ViewType = CSRView;
-      template< typename Device_, typename Index_ >
-      using ViewTemplate = CSRView< Device_, Index_, Kernel >;
-      using ConstViewType = CSRView< Device, std::add_const_t< Index >, Kernel >;
-      using SegmentViewType = SegmentView< IndexType, RowMajorOrder >;
-
-      static constexpr bool havePadding() { return false; };
-
-      __cuda_callable__
-      CSRView();
-
-      __cuda_callable__
-      CSRView( const OffsetsView& offsets, const KernelView& kernel );
-
-      __cuda_callable__
-      CSRView( OffsetsView&& offsets, KernelView&& kernel );
-
-      __cuda_callable__
-      CSRView( const CSRView& csr_view ) = default;
-
-      __cuda_callable__
-      CSRView( CSRView&& csr_view ) = default;
-
-      static String getSerializationType();
-
-      static String getSegmentsType();
-
-      __cuda_callable__
-      ViewType getView();
-
-      __cuda_callable__
-      const ConstViewType getConstView() const;
-
-      /**
-       * \brief Number segments.
-       */
-      __cuda_callable__
-      IndexType getSegmentsCount() const;
-
-      /***
-       * \brief Returns size of the segment number \r segmentIdx
-       */
-      __cuda_callable__
-      IndexType getSegmentSize( const IndexType segmentIdx ) const;
-
-      /***
-       * \brief Returns number of elements managed by all segments.
-       */
-      __cuda_callable__
-      IndexType getSize() const;
-
-      /***
-       * \brief Returns number of elements that needs to be allocated.
-       */
-      __cuda_callable__
-      IndexType getStorageSize() const;
-
-      __cuda_callable__
-      IndexType getGlobalIndex( const Index segmentIdx, const Index localIdx ) const;
-
-      __cuda_callable__
-      SegmentViewType getSegmentView( const IndexType segmentIdx ) const;
-
-      /***
-       * \brief Go over all segments and for each segment element call
-       * function 'f'. The return type of 'f' is bool.
-       * When its true, the for-loop continues. Once 'f' returns false, the for-loop
-       * is terminated.
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function&& f ) const;
-
-      template< typename Function >
-      void forAllElements( Function&& f ) const;
-
-      template< typename Function >
-      void forSegments( IndexType begin, IndexType end, Function&& f ) const;
-
-      template< typename Function >
-      void forAllSegments( Function&& f ) const;
-
-      template< typename Function >
-      void sequentialForSegments( IndexType begin, IndexType end, Function&& f ) const;
-
-      template< typename Function >
-      void sequentialForAllSegments( Function&& f ) const;
-
-      /***
-       * \brief Go over all segments and perform a reduction in each of them.
-       */
-      template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
-      void reduceSegments( IndexType first, IndexType last, Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
-
-      template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
-      void reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
-
-      CSRView& operator=( const CSRView& view );
-
-      void save( File& file ) const;
-
-      void load( File& file );
-
-      template< typename Fetch >
-      SegmentsPrinter< CSRView, Fetch > print( Fetch&& fetch ) const;
-
-      KernelType& getKernel() { return kernel; }
-
-      const KernelType& getKernel() const { return kernel; }
-
-   protected:
-
-      OffsetsView offsets;
-
-      KernelView kernel;
+public:
+   using DeviceType = Device;
+   using IndexType = std::remove_const_t< Index >;
+   using KernelType = Kernel;
+   using OffsetsView = typename Containers::VectorView< Index, DeviceType, IndexType >;
+   using ConstOffsetsView = typename Containers::Vector< Index, DeviceType, IndexType >::ConstViewType;
+   using KernelView = typename Kernel::ViewType;
+   using ViewType = CSRView;
+   template< typename Device_, typename Index_ >
+   using ViewTemplate = CSRView< Device_, Index_, Kernel >;
+   using ConstViewType = CSRView< Device, std::add_const_t< Index >, Kernel >;
+   using SegmentViewType = SegmentView< IndexType, RowMajorOrder >;
+
+   static constexpr bool
+   havePadding()
+   {
+      return false;
+   };
+
+   __cuda_callable__
+   CSRView() = default;
+
+   __cuda_callable__
+   CSRView( const OffsetsView& offsets, const KernelView& kernel );
+
+   __cuda_callable__
+   CSRView( OffsetsView&& offsets, KernelView&& kernel );
+
+   __cuda_callable__
+   CSRView( const CSRView& csr_view ) = default;
+
+   __cuda_callable__
+   CSRView( CSRView&& csr_view ) noexcept = default;
+
+   static std::string
+   getSerializationType();
+
+   static String
+   getSegmentsType();
+
+   __cuda_callable__
+   ViewType
+   getView();
+
+   __cuda_callable__
+   const ConstViewType
+   getConstView() const;
+
+   /**
+    * \brief Number segments.
+    */
+   __cuda_callable__
+   IndexType
+   getSegmentsCount() const;
+
+   /***
+    * \brief Returns size of the segment number \r segmentIdx
+    */
+   __cuda_callable__
+   IndexType
+   getSegmentSize( IndexType segmentIdx ) const;
+
+   /***
+    * \brief Returns number of elements managed by all segments.
+    */
+   __cuda_callable__
+   IndexType
+   getSize() const;
+
+   /***
+    * \brief Returns number of elements that needs to be allocated.
+    */
+   __cuda_callable__
+   IndexType
+   getStorageSize() const;
+
+   __cuda_callable__
+   IndexType
+   getGlobalIndex( Index segmentIdx, Index localIdx ) const;
+
+   __cuda_callable__
+   SegmentViewType
+   getSegmentView( IndexType segmentIdx ) const;
+
+   /***
+    * \brief Go over all segments and for each segment element call
+    * function 'f'. The return type of 'f' is bool.
+    * When its true, the for-loop continues. Once 'f' returns false, the for-loop
+    * is terminated.
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function&& f ) const;
+
+   template< typename Function >
+   void
+   forAllElements( Function&& f ) const;
+
+   template< typename Function >
+   void
+   forSegments( IndexType begin, IndexType end, Function&& f ) const;
+
+   template< typename Function >
+   void
+   forAllSegments( Function&& f ) const;
+
+   template< typename Function >
+   void
+   sequentialForSegments( IndexType begin, IndexType end, Function&& f ) const;
+
+   template< typename Function >
+   void
+   sequentialForAllSegments( Function&& f ) const;
+
+   /***
+    * \brief Go over all segments and perform a reduction in each of them.
+    */
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+   void
+   reduceSegments( IndexType first,
+                   IndexType last,
+                   Fetch& fetch,
+                   const Reduction& reduction,
+                   ResultKeeper& keeper,
+                   const Real& zero ) const;
+
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+   void
+   reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
+
+   CSRView&
+   operator=( const CSRView& view );
+
+   void
+   save( File& file ) const;
+
+   void
+   load( File& file );
+
+   template< typename Fetch >
+   SegmentsPrinter< CSRView, Fetch >
+   print( Fetch&& fetch ) const;
+
+   KernelType&
+   getKernel()
+   {
+      return kernel;
+   }
+
+   const KernelType&
+   getKernel() const
+   {
+      return kernel;
+   }
+
+protected:
+   OffsetsView offsets;
+
+   KernelView kernel;
 };
 
+template< typename Device, typename Index, typename Kernel >
+std::ostream&
+operator<<( std::ostream& str, const CSRView< Device, Index, Kernel >& segments )
+{
+   return printSegments( str, segments );
+}
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
-std::ostream& operator<<( std::ostream& str, const CSRView< Device, Index, Kernel >& segments ) { return printSegments( str, segments ); }
-
-template< typename Device,
-          typename Index >
+template< typename Device, typename Index >
 using CSRViewScalar = CSRView< Device, Index, CSRScalarKernel< Index, Device > >;
 
-template< typename Device,
-          typename Index >
+template< typename Device, typename Index >
 using CSRViewVector = CSRView< Device, Index, CSRVectorKernel< Index, Device > >;
 
-template< typename Device,
-          typename Index,
-          int ThreadsInBlock = 256 >
+template< typename Device, typename Index, int ThreadsInBlock = 256 >
 using CSRViewHybrid = CSRView< Device, Index, CSRHybridKernel< Index, Device, ThreadsInBlock > >;
 
-template< typename Device,
-          typename Index >
+template< typename Device, typename Index >
 using CSRViewLight = CSRView< Device, Index, CSRLightKernel< Index, Device > >;
 
-template< typename Device,
-          typename Index >
+template< typename Device, typename Index >
 using CSRViewAdaptive = CSRView< Device, Index, CSRAdaptiveKernel< Index, Device > >;
 
-template< typename Device,
-          typename Index >
+template< typename Device, typename Index >
 using CSRViewDefault = CSRViewScalar< Device, Index >;
 
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
 
 #include <TNL/Algorithms/Segments/CSRView.hpp>
diff --git a/src/TNL/Algorithms/Segments/CSRView.hpp b/src/TNL/Algorithms/Segments/CSRView.hpp
index 86025b09cc3bcec0ab15b2e0719834e28d3086ee..61610d54b1ad7f611d32ff5fc9f17a0fe58b7ed0 100644
--- a/src/TNL/Algorithms/Segments/CSRView.hpp
+++ b/src/TNL/Algorithms/Segments/CSRView.hpp
@@ -13,130 +13,91 @@
 #include <TNL/Algorithms/Segments/detail/LambdaAdapter.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
-
-template< typename Device,
-          typename Index,
-          typename Kernel >
-__cuda_callable__
-CSRView< Device, Index, Kernel >::
-CSRView()
-{
-}
-
-template< typename Device,
-          typename Index,
-          typename Kernel >
+template< typename Device, typename Index, typename Kernel >
 __cuda_callable__
-CSRView< Device, Index, Kernel >::
-CSRView( const OffsetsView& offsets_view,
-         const KernelView& kernel_view )
-   : offsets( offsets_view ), kernel( kernel_view )
-{
-}
+CSRView< Device, Index, Kernel >::CSRView( const OffsetsView& offsets_view, const KernelView& kernel_view )
+: offsets( offsets_view ), kernel( kernel_view )
+{}
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
+template< typename Device, typename Index, typename Kernel >
 __cuda_callable__
-CSRView< Device, Index, Kernel >::
-CSRView( OffsetsView&& offsets_view,
-         KernelView&& kernel_view )
-   : offsets( std::move( offsets_view ) ), kernel( std::move( kernel_view ) )
-{
-}
+CSRView< Device, Index, Kernel >::CSRView( OffsetsView&& offsets_view, KernelView&& kernel_view )
+: offsets( std::move( offsets_view ) ), kernel( std::move( kernel_view ) )
+{}
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
-String
-CSRView< Device, Index, Kernel >::
-getSerializationType()
+template< typename Device, typename Index, typename Kernel >
+std::string
+CSRView< Device, Index, Kernel >::getSerializationType()
 {
-   return "CSR< [any_device], " +
-      TNL::getSerializationType< IndexType >() + ", " +
-      // FIXME: the serialized data do not depend on the the kernel type so it should not be in the serialization type
-      TNL::getSerializationType< KernelType >() + " >";
+   return "CSR< [any_device], " + TNL::getSerializationType< IndexType >() + ", " +
+          // FIXME: the serialized data do not depend on the the kernel type so it should not be in the serialization type
+          TNL::getSerializationType< KernelType >() + " >";
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
+template< typename Device, typename Index, typename Kernel >
 String
-CSRView< Device, Index, Kernel >::
-getSegmentsType()
+CSRView< Device, Index, Kernel >::getSegmentsType()
 {
    return "CSR< " + KernelType::getKernelType() + " >";
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
+template< typename Device, typename Index, typename Kernel >
 __cuda_callable__
 typename CSRView< Device, Index, Kernel >::ViewType
-CSRView< Device, Index, Kernel >::
-getView()
+CSRView< Device, Index, Kernel >::getView()
 {
    return ViewType( this->offsets, this->kernel );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
+template< typename Device, typename Index, typename Kernel >
 __cuda_callable__
 auto
-CSRView< Device, Index, Kernel >::
-getConstView() const -> const ConstViewType
+CSRView< Device, Index, Kernel >::getConstView() const -> const ConstViewType
 {
    return ConstViewType( this->offsets.getConstView(), this->kernel.getConstView() );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
-__cuda_callable__ auto CSRView< Device, Index, Kernel >::
-getSegmentsCount() const -> IndexType
+template< typename Device, typename Index, typename Kernel >
+__cuda_callable__
+auto
+CSRView< Device, Index, Kernel >::getSegmentsCount() const -> IndexType
 {
    return this->offsets.getSize() - 1;
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
-__cuda_callable__ auto CSRView< Device, Index, Kernel >::
-getSegmentSize( const IndexType segmentIdx ) const -> IndexType
+template< typename Device, typename Index, typename Kernel >
+__cuda_callable__
+auto
+CSRView< Device, Index, Kernel >::getSegmentSize( const IndexType segmentIdx ) const -> IndexType
 {
    return detail::CSR< Device, Index >::getSegmentSize( this->offsets, segmentIdx );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
-__cuda_callable__ auto CSRView< Device, Index, Kernel >::
-getSize() const -> IndexType
+template< typename Device, typename Index, typename Kernel >
+__cuda_callable__
+auto
+CSRView< Device, Index, Kernel >::getSize() const -> IndexType
 {
    return this->getStorageSize();
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
-__cuda_callable__ auto CSRView< Device, Index, Kernel >::
-getStorageSize() const -> IndexType
+template< typename Device, typename Index, typename Kernel >
+__cuda_callable__
+auto
+CSRView< Device, Index, Kernel >::getStorageSize() const -> IndexType
 {
    return detail::CSR< Device, Index >::getStorageSize( this->offsets );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
-__cuda_callable__ auto CSRView< Device, Index, Kernel >::
-getGlobalIndex( const Index segmentIdx, const Index localIdx ) const -> IndexType
+template< typename Device, typename Index, typename Kernel >
+__cuda_callable__
+auto
+CSRView< Device, Index, Kernel >::getGlobalIndex( const Index segmentIdx, const Index localIdx ) const -> IndexType
 {
-   if( ! std::is_same< DeviceType, Devices::Host >::value )
-   {
+   if( ! std::is_same< DeviceType, Devices::Host >::value ) {
 #ifdef __CUDA_ARCH__
       return offsets[ segmentIdx ] + localIdx;
 #else
@@ -146,167 +107,138 @@ getGlobalIndex( const Index segmentIdx, const Index localIdx ) const -> IndexTyp
    return offsets[ segmentIdx ] + localIdx;
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
+template< typename Device, typename Index, typename Kernel >
 __cuda_callable__
 auto
-CSRView< Device, Index, Kernel >::
-getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType
+CSRView< Device, Index, Kernel >::getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType
 {
    return SegmentViewType( segmentIdx, offsets[ segmentIdx ], offsets[ segmentIdx + 1 ] - offsets[ segmentIdx ], 1 );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
-   template< typename Function >
+template< typename Device, typename Index, typename Kernel >
+template< typename Function >
 void
-CSRView< Device, Index, Kernel >::
-forElements( IndexType begin, IndexType end, Function&& f ) const
+CSRView< Device, Index, Kernel >::forElements( IndexType begin, IndexType end, Function&& f ) const
 {
    const auto offsetsView = this->offsets;
-   auto l = [=] __cuda_callable__ ( const IndexType segmentIdx ) mutable {
+   auto l = [ = ] __cuda_callable__( const IndexType segmentIdx ) mutable
+   {
       const IndexType begin = offsetsView[ segmentIdx ];
       const IndexType end = offsetsView[ segmentIdx + 1 ];
       IndexType localIdx( 0 );
-      for( IndexType globalIdx = begin; globalIdx < end; globalIdx++  )
+      for( IndexType globalIdx = begin; globalIdx < end; globalIdx++ )
          f( segmentIdx, localIdx++, globalIdx );
    };
    Algorithms::ParallelFor< Device >::exec( begin, end, l );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
-   template< typename Function >
+template< typename Device, typename Index, typename Kernel >
+template< typename Function >
 void
-CSRView< Device, Index, Kernel >::
-forAllElements( Function&& f ) const
+CSRView< Device, Index, Kernel >::forAllElements( Function&& f ) const
 {
    this->forElements( 0, this->getSegmentsCount(), f );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
-   template< typename Function >
+template< typename Device, typename Index, typename Kernel >
+template< typename Function >
 void
-CSRView< Device, Index, Kernel >::
-forSegments( IndexType begin, IndexType end, Function&& function ) const
+CSRView< Device, Index, Kernel >::forSegments( IndexType begin, IndexType end, Function&& function ) const
 {
    auto view = this->getConstView();
-   auto f = [=] __cuda_callable__ ( IndexType segmentIdx ) mutable {
+   auto f = [ = ] __cuda_callable__( IndexType segmentIdx ) mutable
+   {
       auto segment = view.getSegmentView( segmentIdx );
       function( segment );
    };
    TNL::Algorithms::ParallelFor< DeviceType >::exec( begin, end, f );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
-   template< typename Function >
+template< typename Device, typename Index, typename Kernel >
+template< typename Function >
 void
-CSRView< Device, Index, Kernel >::
-forAllSegments( Function&& f ) const
+CSRView< Device, Index, Kernel >::forAllSegments( Function&& f ) const
 {
    this->forSegments( 0, this->getSegmentsCount(), f );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
-   template< typename Function >
+template< typename Device, typename Index, typename Kernel >
+template< typename Function >
 void
-CSRView< Device, Index, Kernel >::
-sequentialForSegments( IndexType begin, IndexType end, Function&& function ) const
+CSRView< Device, Index, Kernel >::sequentialForSegments( IndexType begin, IndexType end, Function&& function ) const
 {
    for( IndexType i = begin; i < end; i++ )
       forSegments( i, i + 1, function );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
-   template< typename Function >
+template< typename Device, typename Index, typename Kernel >
+template< typename Function >
 void
-CSRView< Device, Index, Kernel >::
-sequentialForAllSegments( Function&& f ) const
+CSRView< Device, Index, Kernel >::sequentialForAllSegments( Function&& f ) const
 {
    this->sequentialForSegments( 0, this->getSegmentsCount(), f );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
-   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+template< typename Device, typename Index, typename Kernel >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
 void
-CSRView< Device, Index, Kernel >::
-reduceSegments( IndexType first, IndexType last, Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const
+CSRView< Device, Index, Kernel >::reduceSegments( IndexType first,
+                                                  IndexType last,
+                                                  Fetch& fetch,
+                                                  const Reduction& reduction,
+                                                  ResultKeeper& keeper,
+                                                  const Real& zero ) const
 {
    if( std::is_same< DeviceType, TNL::Devices::Host >::value )
-      TNL::Algorithms::Segments::CSRScalarKernel< IndexType, DeviceType >::reduceSegments( offsets, first, last, fetch, reduction, keeper, zero );
+      TNL::Algorithms::Segments::CSRScalarKernel< IndexType, DeviceType >::reduceSegments(
+         offsets, first, last, fetch, reduction, keeper, zero );
    else
       kernel.reduceSegments( offsets, first, last, fetch, reduction, keeper, zero );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
-   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+template< typename Device, typename Index, typename Kernel >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
 void
-CSRView< Device, Index, Kernel >::
-reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const
+CSRView< Device, Index, Kernel >::reduceAllSegments( Fetch& fetch,
+                                                     const Reduction& reduction,
+                                                     ResultKeeper& keeper,
+                                                     const Real& zero ) const
 {
    this->reduceSegments( 0, this->getSegmentsCount(), fetch, reduction, keeper, zero );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
+template< typename Device, typename Index, typename Kernel >
 CSRView< Device, Index, Kernel >&
-CSRView< Device, Index, Kernel >::
-operator=( const CSRView& view )
+CSRView< Device, Index, Kernel >::operator=( const CSRView& view )
 {
    this->offsets.bind( view.offsets );
    this->kernel = view.kernel;
    return *this;
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
+template< typename Device, typename Index, typename Kernel >
 void
-CSRView< Device, Index, Kernel >::
-save( File& file ) const
+CSRView< Device, Index, Kernel >::save( File& file ) const
 {
    file << this->offsets;
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
+template< typename Device, typename Index, typename Kernel >
 void
-CSRView< Device, Index, Kernel >::
-load( File& file )
+CSRView< Device, Index, Kernel >::load( File& file )
 {
    file >> this->offsets;
    this->kernel.init( this->offsets );
 }
 
-template< typename Device,
-          typename Index,
-          typename Kernel >
-      template< typename Fetch >
+template< typename Device, typename Index, typename Kernel >
+template< typename Fetch >
 auto
-CSRView< Device, Index, Kernel >::
-print( Fetch&& fetch ) const -> SegmentsPrinter< CSRView, Fetch >
+CSRView< Device, Index, Kernel >::print( Fetch&& fetch ) const -> SegmentsPrinter< CSRView, Fetch >
 {
    return SegmentsPrinter< CSRView, Fetch >( *this, fetch );
 }
 
-
-      } // namespace Segments
-   }  // namespace Containers
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/ChunkedEllpack.h b/src/TNL/Algorithms/Segments/ChunkedEllpack.h
index 194fac7f96c7fade5b1861d5a284006b881b25e4..91dc109a4cc66b49a4e5c5630557dbb750a13466 100644
--- a/src/TNL/Algorithms/Segments/ChunkedEllpack.h
+++ b/src/TNL/Algorithms/Segments/ChunkedEllpack.h
@@ -13,8 +13,8 @@
 #include <TNL/Algorithms/Segments/SegmentsPrinting.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
 template< typename Device,
           typename Index,
@@ -22,165 +22,200 @@ template< typename Device,
           ElementsOrganization Organization = Algorithms::Segments::DefaultElementsOrganization< Device >::getOrganization() >
 class ChunkedEllpack
 {
-   public:
+public:
+   using DeviceType = Device;
+   using IndexType = std::remove_const_t< Index >;
+   using OffsetsContainer = Containers::Vector< Index, DeviceType, IndexType, IndexAllocator >;
+   static constexpr ElementsOrganization
+   getOrganization()
+   {
+      return Organization;
+   }
+   using ViewType = ChunkedEllpackView< Device, Index, Organization >;
+   template< typename Device_, typename Index_ >
+   using ViewTemplate = ChunkedEllpackView< Device_, Index_, Organization >;
+   using ConstViewType = typename ViewType::ConstViewType;
+   using SegmentViewType = typename ViewType::SegmentViewType;
+   using ChunkedEllpackSliceInfoType = typename ViewType::ChunkedEllpackSliceInfoType;
+   // TODO: using ChunkedEllpackSliceInfoAllocator = typename IndexAllocatorType::retype< ChunkedEllpackSliceInfoType >;
+   using ChunkedEllpackSliceInfoAllocator = typename ViewType::ChunkedEllpackSliceInfoAllocator;
+   using ChunkedEllpackSliceInfoContainer = typename ViewType::ChunkedEllpackSliceInfoContainer;
+
+   static constexpr bool
+   havePadding()
+   {
+      return true;
+   };
+
+   ChunkedEllpack() = default;
+
+   template< typename SizesContainer >
+   ChunkedEllpack( const SizesContainer& sizes );
+
+   template< typename ListIndex >
+   ChunkedEllpack( const std::initializer_list< ListIndex >& segmentsSizes );
+
+   ChunkedEllpack( const ChunkedEllpack& segments ) = default;
+
+   ChunkedEllpack( ChunkedEllpack&& segments ) noexcept = default;
+
+   static std::string
+   getSerializationType();
+
+   static String
+   getSegmentsType();
+
+   ViewType
+   getView();
+
+   const ConstViewType
+   getConstView() const;
+
+   /**
+    * \brief Number of segments.
+    */
+   __cuda_callable__
+   IndexType
+   getSegmentsCount() const;
+
+   /**
+    * \brief Set sizes of particular segments.
+    */
+   template< typename SizesHolder = OffsetsContainer >
+   void
+   setSegmentsSizes( const SizesHolder& sizes );
+
+   void
+   reset();
+
+   IndexType
+   getSegmentSize( IndexType segmentIdx ) const;
+
+   /**
+    * \brief Number segments.
+    */
+   __cuda_callable__
+   IndexType
+   getSize() const;
+
+   __cuda_callable__
+   IndexType
+   getStorageSize() const;
+
+   __cuda_callable__
+   IndexType
+   getGlobalIndex( Index segmentIdx, Index localIdx ) const;
+
+   __cuda_callable__
+   SegmentViewType
+   getSegmentView( IndexType segmentIdx ) const;
+
+   /***
+    * \brief Go over all segments and for each segment element call
+    * function 'f' with arguments 'args'. The return type of 'f' is bool.
+    * When its true, the for-loop continues. Once 'f' returns false, the for-loop
+    * is terminated.
+    */
+   template< typename Function >
+   void
+   forElements( IndexType first, IndexType last, Function&& f ) const;
+
+   template< typename Function >
+   void
+   forAllElements( Function&& f ) const;
+
+   template< typename Function >
+   void
+   forSegments( IndexType begin, IndexType end, Function&& f ) const;
+
+   template< typename Function >
+   void
+   forAllSegments( Function&& f ) const;
+
+   /***
+    * \brief Go over all segments and perform a reduction in each of them.
+    */
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+   void
+   reduceSegments( IndexType first,
+                   IndexType last,
+                   Fetch& fetch,
+                   const Reduction& reduction,
+                   ResultKeeper& keeper,
+                   const Real& zero ) const;
 
-      using DeviceType = Device;
-      using IndexType = std::remove_const_t< Index >;
-      using OffsetsContainer = Containers::Vector< Index, DeviceType, IndexType, IndexAllocator >;
-      static constexpr ElementsOrganization getOrganization() { return Organization; }
-      using ViewType = ChunkedEllpackView< Device, Index, Organization >;
-      template< typename Device_, typename Index_ >
-      using ViewTemplate = ChunkedEllpackView< Device_, Index_, Organization >;
-      using ConstViewType = typename ViewType::ConstViewType;
-      using SegmentViewType = typename ViewType::SegmentViewType;
-      using ChunkedEllpackSliceInfoType = typename ViewType::ChunkedEllpackSliceInfoType; // detail::ChunkedEllpackSliceInfo< IndexType >;
-      //TODO: using ChunkedEllpackSliceInfoAllocator = typename IndexAllocatorType::retype< ChunkedEllpackSliceInfoType >;
-      using ChunkedEllpackSliceInfoAllocator = typename ViewType::ChunkedEllpackSliceInfoAllocator; // typename Allocators::Default< Device >::template Allocator< ChunkedEllpackSliceInfoType >;
-      using ChunkedEllpackSliceInfoContainer = typename ViewType::ChunkedEllpackSliceInfoContainer; // Containers::Array< ChunkedEllpackSliceInfoType, DeviceType, IndexType, ChunkedEllpackSliceInfoAllocator >;
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+   void
+   reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
 
-      static constexpr bool havePadding() { return true; };
+   ChunkedEllpack&
+   operator=( const ChunkedEllpack& source ) = default;
 
-      ChunkedEllpack() = default;
+   template< typename Device_, typename Index_, typename IndexAllocator_, ElementsOrganization Organization_ >
+   ChunkedEllpack&
+   operator=( const ChunkedEllpack< Device_, Index_, IndexAllocator_, Organization_ >& source );
 
-      template< typename SizesContainer >
-      ChunkedEllpack( const SizesContainer& sizes );
-
-      template< typename ListIndex >
-      ChunkedEllpack( const std::initializer_list< ListIndex >& segmentsSizes );
-
-      ChunkedEllpack( const ChunkedEllpack& segments ) = default;
-
-      ChunkedEllpack( ChunkedEllpack&& segments ) = default;
-
-      static String getSerializationType();
-
-      static String getSegmentsType();
-
-      ViewType getView();
-
-      const ConstViewType getConstView() const;
-
-      /**
-       * \brief Number of segments.
-       */
-      __cuda_callable__
-      IndexType getSegmentsCount() const;
-
-      /**
-       * \brief Set sizes of particular segments.
-       */
-      template< typename SizesHolder = OffsetsContainer >
-      void setSegmentsSizes( const SizesHolder& sizes );
-
-      void reset();
-
-      IndexType getSegmentSize( const IndexType segmentIdx ) const;
-
-      /**
-       * \brief Number segments.
-       */
-      __cuda_callable__
-      IndexType getSize() const;
-
-      __cuda_callable__
-      IndexType getStorageSize() const;
-
-      __cuda_callable__
-      IndexType getGlobalIndex( const Index segmentIdx, const Index localIdx ) const;
-
-      __cuda_callable__
-      SegmentViewType getSegmentView( const IndexType segmentIdx ) const;
-
-      /***
-       * \brief Go over all segments and for each segment element call
-       * function 'f' with arguments 'args'. The return type of 'f' is bool.
-       * When its true, the for-loop continues. Once 'f' returns false, the for-loop
-       * is terminated.
-       */
-      template< typename Function >
-      void forElements( IndexType first, IndexType last, Function&& f ) const;
-
-      template< typename Function >
-      void forAllElements( Function&& f ) const;
-
-      template< typename Function >
-      void forSegments( IndexType begin, IndexType end, Function&& f ) const;
-
-      template< typename Function >
-      void forAllSegments( Function&& f ) const;
-
-      /***
-       * \brief Go over all segments and perform a reduction in each of them.
-       */
-      template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
-      void reduceSegments( IndexType first, IndexType last, Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
-
-      template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
-      void reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
-
-      ChunkedEllpack& operator=( const ChunkedEllpack& source ) = default;
-
-      template< typename Device_, typename Index_, typename IndexAllocator_, ElementsOrganization Organization_ >
-      ChunkedEllpack& operator=( const ChunkedEllpack< Device_, Index_, IndexAllocator_, Organization_ >& source );
-
-      void save( File& file ) const;
-
-      void load( File& file );
-
-      template< typename Fetch >
-      SegmentsPrinter< ChunkedEllpack, Fetch > print( Fetch&& fetch ) const;
-
-      void printStructure( std::ostream& str ); // TODO const;
-
-   protected:
-
-      template< typename SegmentsSizes >
-      void resolveSliceSizes( SegmentsSizes& rowLengths );
-
-      template< typename SegmentsSizes >
-      bool setSlice( SegmentsSizes& rowLengths,
-                     const IndexType sliceIdx,
-                     IndexType& elementsToAllocation );
-
-      IndexType size = 0, storageSize = 0;
-
-      IndexType chunksInSlice = 256, desiredChunkSize = 16;
-
-      /**
-       * For each segment, this keeps index of the slice which contains the
-       * segment.
-       */
-      OffsetsContainer rowToSliceMapping;
-
-      /**
-       * For each row, this keeps index of the first chunk within a slice.
-       */
-      OffsetsContainer rowToChunkMapping;
-
-      OffsetsContainer chunksToSegmentsMapping;
-
-      /**
-       * Keeps index of the first segment index.
-       */
-      OffsetsContainer rowPointers;
-
-      ChunkedEllpackSliceInfoContainer slices;
-
-      IndexType numberOfSlices = 0;
-
-      template< typename Device_, typename Index_, typename IndexAllocator_, ElementsOrganization Organization_ >
-      friend class ChunkedEllpack;
+   void
+   save( File& file ) const;
+
+   void
+   load( File& file );
+
+   template< typename Fetch >
+   SegmentsPrinter< ChunkedEllpack, Fetch >
+   print( Fetch&& fetch ) const;
+
+   void
+   printStructure( std::ostream& str );  // TODO const;
+
+protected:
+   template< typename SegmentsSizes >
+   void
+   resolveSliceSizes( SegmentsSizes& rowLengths );
+
+   template< typename SegmentsSizes >
+   bool
+   setSlice( SegmentsSizes& rowLengths, IndexType sliceIdx, IndexType& elementsToAllocation );
+
+   IndexType size = 0, storageSize = 0;
+
+   IndexType chunksInSlice = 256, desiredChunkSize = 16;
+
+   /**
+    * For each segment, this keeps index of the slice which contains the
+    * segment.
+    */
+   OffsetsContainer rowToSliceMapping;
+
+   /**
+    * For each row, this keeps index of the first chunk within a slice.
+    */
+   OffsetsContainer rowToChunkMapping;
+
+   OffsetsContainer chunksToSegmentsMapping;
+
+   /**
+    * Keeps index of the first segment index.
+    */
+   OffsetsContainer rowPointers;
+
+   ChunkedEllpackSliceInfoContainer slices;
+
+   IndexType numberOfSlices = 0;
+
+   template< typename Device_, typename Index_, typename IndexAllocator_, ElementsOrganization Organization_ >
+   friend class ChunkedEllpack;
 };
 
-template <typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
-std::ostream& operator<<( std::ostream& str, const ChunkedEllpack< Device, Index, IndexAllocator, Organization >& segments ) { return printSegments( segments, str ); }
-
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
+std::ostream&
+operator<<( std::ostream& str, const ChunkedEllpack< Device, Index, IndexAllocator, Organization >& segments )
+{
+   return printSegments( segments, str );
+}
 
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
 
 #include <TNL/Algorithms/Segments/ChunkedEllpack.hpp>
diff --git a/src/TNL/Algorithms/Segments/ChunkedEllpack.hpp b/src/TNL/Algorithms/Segments/ChunkedEllpack.hpp
index 19cde42d5beb7c1ff2746a07e1c967df4c338706..5e81ce0bb027bb5f8348b994ba09fdf69a2c5d0c 100644
--- a/src/TNL/Algorithms/Segments/ChunkedEllpack.hpp
+++ b/src/TNL/Algorithms/Segments/ChunkedEllpack.hpp
@@ -13,63 +13,47 @@
 #include <TNL/Algorithms/Segments/Ellpack.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
-
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
-   template< typename SizesContainer >
-ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-ChunkedEllpack( const SizesContainer& segmentsSizes )
+namespace Algorithms {
+namespace Segments {
+
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
+template< typename SizesContainer >
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::ChunkedEllpack( const SizesContainer& segmentsSizes )
 {
    this->setSegmentsSizes( segmentsSizes );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
-   template< typename ListIndex >
-ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-ChunkedEllpack( const std::initializer_list< ListIndex >& segmentsSizes )
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
+template< typename ListIndex >
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::ChunkedEllpack(
+   const std::initializer_list< ListIndex >& segmentsSizes )
 {
    this->setSegmentsSizes( Containers::Vector< IndexType, DeviceType, IndexType >( segmentsSizes ) );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
-String
-ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-getSerializationType()
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
+std::string
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::getSerializationType()
 {
    // FIXME: the serialized data DEPEND on the Organization parameter, so it should be reflected in the serialization type
    return "ChunkedEllpack< [any_device], " + TNL::getSerializationType< IndexType >() + " >";
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
 String
-ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-getSegmentsType()
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::getSegmentsType()
 {
    return ViewType::getSegmentsType();
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
 typename ChunkedEllpack< Device, Index, IndexAllocator, Organization >::ViewType
-ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-getView()
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::getView()
 {
-   return ViewType( size, storageSize, chunksInSlice, desiredChunkSize,
+   return ViewType( size,
+                    storageSize,
+                    chunksInSlice,
+                    desiredChunkSize,
                     rowToChunkMapping.getView(),
                     rowToSliceMapping.getView(),
                     chunksToSegmentsMapping.getView(),
@@ -78,14 +62,14 @@ getView()
                     numberOfSlices );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
-auto ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-getConstView() const -> const ConstViewType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
+auto
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::getConstView() const -> const ConstViewType
 {
-   return ConstViewType( size, storageSize, chunksInSlice, desiredChunkSize,
+   return ConstViewType( size,
+                         storageSize,
+                         chunksInSlice,
+                         desiredChunkSize,
                          rowToChunkMapping.getConstView(),
                          rowToSliceMapping.getConstView(),
                          chunksToSegmentsMapping.getConstView(),
@@ -94,28 +78,20 @@ getConstView() const -> const ConstViewType
                          numberOfSlices );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
-   template< typename SegmentsSizes >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
+template< typename SegmentsSizes >
 void
-ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-resolveSliceSizes( SegmentsSizes& segmentsSizes )
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::resolveSliceSizes( SegmentsSizes& segmentsSizes )
 {
    /****
     * Iterate over rows and allocate slices so that each slice has
     * approximately the same number of allocated elements
     */
-   const IndexType desiredElementsInSlice =
-            this->chunksInSlice * this->desiredChunkSize;
+   const IndexType desiredElementsInSlice = this->chunksInSlice * this->desiredChunkSize;
 
-   IndexType segmentIdx( 0 ),
-             sliceSize( 0 ),
-             allocatedElementsInSlice( 0 );
+   IndexType segmentIdx( 0 ), sliceSize( 0 ), allocatedElementsInSlice( 0 );
    numberOfSlices = 0;
-   while( segmentIdx < segmentsSizes.getSize() )
-   {
+   while( segmentIdx < segmentsSizes.getSize() ) {
       /****
        * Add one row to the current slice until we reach the desired
        * number of elements in a slice.
@@ -123,28 +99,25 @@ resolveSliceSizes( SegmentsSizes& segmentsSizes )
       allocatedElementsInSlice += segmentsSizes[ segmentIdx ];
       sliceSize++;
       segmentIdx++;
-      if( allocatedElementsInSlice < desiredElementsInSlice  )
-          if( segmentIdx < segmentsSizes.getSize() && sliceSize < chunksInSlice ) continue;
-      TNL_ASSERT( sliceSize >0, );
+      if( allocatedElementsInSlice < desiredElementsInSlice )
+         if( segmentIdx < segmentsSizes.getSize() && sliceSize < chunksInSlice )
+            continue;
+      TNL_ASSERT( sliceSize > 0, );
       this->slices[ numberOfSlices ].size = sliceSize;
       this->slices[ numberOfSlices ].firstSegment = segmentIdx - sliceSize;
-      this->slices[ numberOfSlices ].pointer = allocatedElementsInSlice; // this is only temporary
+      this->slices[ numberOfSlices ].pointer = allocatedElementsInSlice;  // this is only temporary
       sliceSize = 0;
       numberOfSlices++;
       allocatedElementsInSlice = 0;
    }
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
-   template< typename SegmentsSizes >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
+template< typename SegmentsSizes >
 bool
-ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-setSlice( SegmentsSizes& rowLengths,
-          const IndexType sliceIndex,
-          IndexType& elementsToAllocation )
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::setSlice( SegmentsSizes& rowLengths,
+                                                                         const IndexType sliceIndex,
+                                                                         IndexType& elementsToAllocation )
 {
    /****
     * Now, compute the number of chunks per each row.
@@ -164,11 +137,10 @@ setSlice( SegmentsSizes& rowLengths,
 
    int totalAddedChunks( 0 );
    int maxRowLength( rowLengths[ sliceBegin ] );
-   for( IndexType i = sliceBegin; i < sliceEnd; i++ )
-   {
+   for( IndexType i = sliceBegin; i < sliceEnd; i++ ) {
       double rowRatio( 0.0 );
       if( allocatedElementsInSlice != 0 )
-         rowRatio = ( double ) rowLengths[ i ] / ( double ) allocatedElementsInSlice;
+         rowRatio = (double) rowLengths[ i ] / (double) allocatedElementsInSlice;
       const IndexType addedChunks = freeChunks * rowRatio;
       totalAddedChunks += addedChunks;
       this->rowToChunkMapping[ i ] += addedChunks;
@@ -178,8 +150,7 @@ setSlice( SegmentsSizes& rowLengths,
    freeChunks -= totalAddedChunks;
    while( freeChunks )
       for( IndexType i = sliceBegin; i < sliceEnd && freeChunks; i++ )
-         if( rowLengths[ i ] == maxRowLength )
-         {
+         if( rowLengths[ i ] == maxRowLength ) {
             this->rowToChunkMapping[ i ]++;
             freeChunks--;
          }
@@ -188,11 +159,9 @@ setSlice( SegmentsSizes& rowLengths,
     * Compute the chunk size
     */
    IndexType maxChunkInSlice( 0 );
-   for( IndexType i = sliceBegin; i < sliceEnd; i++ )
-   {
+   for( IndexType i = sliceBegin; i < sliceEnd; i++ ) {
       TNL_ASSERT_NE( this->rowToChunkMapping[ i ], 0, "" );
-      maxChunkInSlice = TNL::max( maxChunkInSlice,
-                              roundUpDivision( rowLengths[ i ], this->rowToChunkMapping[ i ] ) );
+      maxChunkInSlice = TNL::max( maxChunkInSlice, roundUpDivision( rowLengths[ i ], this->rowToChunkMapping[ i ] ) );
    }
 
    /****
@@ -205,13 +174,10 @@ setSlice( SegmentsSizes& rowLengths,
    for( IndexType i = sliceBegin; i < sliceEnd; i++ )
       this->rowToSliceMapping[ i ] = sliceIndex;
 
-   for( IndexType i = sliceBegin; i < sliceEnd; i++ )
-   {
-      this->rowPointers[ i + 1 ] = maxChunkInSlice*rowToChunkMapping[ i ];
-      TNL_ASSERT( this->rowPointers[ i ] >= 0,
-                 std::cerr << "this->rowPointers[ i ] = " << this->rowPointers[ i ] );
-      TNL_ASSERT( this->rowPointers[ i + 1 ] >= 0,
-                 std::cerr << "this->rowPointers[ i + 1 ] = " << this->rowPointers[ i + 1 ] );
+   for( IndexType i = sliceBegin; i < sliceEnd; i++ ) {
+      this->rowPointers[ i + 1 ] = maxChunkInSlice * rowToChunkMapping[ i ];
+      TNL_ASSERT( this->rowPointers[ i ] >= 0, std::cerr << "this->rowPointers[ i ] = " << this->rowPointers[ i ] );
+      TNL_ASSERT( this->rowPointers[ i + 1 ] >= 0, std::cerr << "this->rowPointers[ i + 1 ] = " << this->rowPointers[ i + 1 ] );
    }
 
    /****
@@ -222,18 +188,12 @@ setSlice( SegmentsSizes& rowLengths,
    return true;
 }
 
-
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
-   template< typename SizesHolder >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
+template< typename SizesHolder >
 void
-ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-setSegmentsSizes( const SizesHolder& segmentsSizes )
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::setSegmentsSizes( const SizesHolder& segmentsSizes )
 {
-   if( std::is_same< DeviceType, Devices::Host >::value )
-   {
+   if( std::is_same< DeviceType, Devices::Host >::value ) {
       this->size = segmentsSizes.getSize();
       this->slices.setSize( this->size );
       this->rowToChunkMapping.setSize( this->size );
@@ -249,12 +209,11 @@ setSegmentsSizes( const SizesHolder& segmentsSizes )
       IndexType chunksCount = this->numberOfSlices * this->chunksInSlice;
       this->chunksToSegmentsMapping.setSize( chunksCount );
       IndexType chunkIdx( 0 );
-      for( IndexType segmentIdx = 0; segmentIdx < this->size; segmentIdx++ )
-      {
+      for( IndexType segmentIdx = 0; segmentIdx < this->size; segmentIdx++ ) {
          const IndexType& sliceIdx = rowToSliceMapping[ segmentIdx ];
          IndexType firstChunkOfSegment( 0 );
          if( segmentIdx != slices[ sliceIdx ].firstSegment )
-               firstChunkOfSegment = rowToChunkMapping[ segmentIdx - 1 ];
+            firstChunkOfSegment = rowToChunkMapping[ segmentIdx - 1 ];
 
          const IndexType lastChunkOfSegment = rowToChunkMapping[ segmentIdx ];
          const IndexType segmentChunksCount = lastChunkOfSegment - firstChunkOfSegment;
@@ -262,9 +221,12 @@ setSegmentsSizes( const SizesHolder& segmentsSizes )
             this->chunksToSegmentsMapping[ chunkIdx++ ] = segmentIdx;
       }
    }
-   else
-   {
-      ChunkedEllpack< Devices::Host, Index, typename Allocators::Default< Devices::Host >::template Allocator< Index >, Organization > hostSegments;
+   else {
+      ChunkedEllpack< Devices::Host,
+                      Index,
+                      typename Allocators::Default< Devices::Host >::template Allocator< Index >,
+                      Organization >
+         hostSegments;
       Containers::Vector< IndexType, Devices::Host, IndexType > hostSegmentsSizes;
       hostSegmentsSizes = segmentsSizes;
       hostSegments.setSegmentsSizes( hostSegmentsSizes );
@@ -272,13 +234,9 @@ setSegmentsSizes( const SizesHolder& segmentsSizes )
    }
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
 void
-ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-reset()
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::reset()
 {
    this->size = 0;
    this->storageSize = 0;
@@ -290,155 +248,118 @@ reset()
    this->numberOfSlices = 0;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
-__cuda_callable__ auto ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-getSegmentsCount() const -> IndexType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
+__cuda_callable__
+auto
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::getSegmentsCount() const -> IndexType
 {
    return this->size;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
-auto ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-getSegmentSize( const IndexType segmentIdx ) const -> IndexType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
+auto
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::getSegmentSize( const IndexType segmentIdx ) const -> IndexType
 {
    return detail::ChunkedEllpack< IndexType, DeviceType, Organization >::getSegmentSize(
-      rowToSliceMapping.getConstView(),
-      slices.getConstView(),
-      rowToChunkMapping.getConstView(),
-      segmentIdx );
+      rowToSliceMapping.getConstView(), slices.getConstView(), rowToChunkMapping.getConstView(), segmentIdx );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
-__cuda_callable__ auto ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-getSize() const -> IndexType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
+__cuda_callable__
+auto
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::getSize() const -> IndexType
 {
    return this->size;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
-__cuda_callable__ auto ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-getStorageSize() const -> IndexType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
+__cuda_callable__
+auto
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::getStorageSize() const -> IndexType
 {
    return this->storageSize;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
-__cuda_callable__ auto ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-getGlobalIndex( const Index segmentIdx, const Index localIdx ) const -> IndexType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
+__cuda_callable__
+auto
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::getGlobalIndex( const Index segmentIdx,
+                                                                               const Index localIdx ) const -> IndexType
 {
-      return detail::ChunkedEllpack< IndexType, DeviceType, Organization >::getGlobalIndex(
-         rowToSliceMapping,
-         slices,
-         rowToChunkMapping,
-         chunksInSlice,
-         segmentIdx,
-         localIdx );
+   return detail::ChunkedEllpack< IndexType, DeviceType, Organization >::getGlobalIndex(
+      rowToSliceMapping, slices, rowToChunkMapping, chunksInSlice, segmentIdx, localIdx );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
-__cuda_callable__ auto ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType
-{
-}
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
+__cuda_callable__
+auto
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::getSegmentView( const IndexType segmentIdx ) const
+   -> SegmentViewType
+{}
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
+template< typename Function >
 void
-ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-forElements( IndexType first, IndexType last, Function&& f ) const
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::forElements( IndexType first,
+                                                                            IndexType last,
+                                                                            Function&& f ) const
 {
    this->getConstView().forElements( first, last, f );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
+template< typename Function >
 void
-ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-forAllElements( Function&& f ) const
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::forAllElements( Function&& f ) const
 {
    this->forElements( 0, this->getSegmentsCount(), f );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
+template< typename Function >
 void
-ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-forSegments( IndexType begin, IndexType end, Function&& f ) const
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::forSegments( IndexType begin, IndexType end, Function&& f ) const
 {
    this->getConstView().forSegments( begin, end, f );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
+template< typename Function >
 void
-ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-forAllSegments( Function&& f ) const
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::forAllSegments( Function&& f ) const
 {
    this->getConstView().forAllSegments( f );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
-   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
 void
-ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-reduceSegments( IndexType first, IndexType last, Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::reduceSegments( IndexType first,
+                                                                               IndexType last,
+                                                                               Fetch& fetch,
+                                                                               const Reduction& reduction,
+                                                                               ResultKeeper& keeper,
+                                                                               const Real& zero ) const
 {
    this->getConstView().reduceSegments( first, last, fetch, reduction, keeper, zero );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
-   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
 void
-ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::reduceAllSegments( Fetch& fetch,
+                                                                                  const Reduction& reduction,
+                                                                                  ResultKeeper& keeper,
+                                                                                  const Real& zero ) const
 {
    this->reduceSegments( 0, this->getSegmentsCount(), fetch, reduction, keeper, zero );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
-   template< typename Device_, typename Index_, typename IndexAllocator_, ElementsOrganization Organization_ >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
+template< typename Device_, typename Index_, typename IndexAllocator_, ElementsOrganization Organization_ >
 ChunkedEllpack< Device, Index, IndexAllocator, Organization >&
-ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-operator=( const ChunkedEllpack< Device_, Index_, IndexAllocator_, Organization_ >& source )
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::operator=(
+   const ChunkedEllpack< Device_, Index_, IndexAllocator_, Organization_ >& source )
 {
    this->size = source.size;
    this->storageSize = source.storageSize;
@@ -453,69 +374,48 @@ operator=( const ChunkedEllpack< Device_, Index_, IndexAllocator_, Organization_
    return *this;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
 void
-ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-save( File& file ) const
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::save( File& file ) const
 {
    file.save( &this->size );
    file.save( &this->storageSize );
    file.save( &this->chunksInSlice );
    file.save( &this->desiredChunkSize );
-   file << this->rowToChunkMapping
-        << this->rowToSliceMapping
-        << this->rowPointers
-        << this->chunksToSegmentsMapping
+   file << this->rowToChunkMapping << this->rowToSliceMapping << this->rowPointers << this->chunksToSegmentsMapping
         << this->slices;
    file.save( this->numberOfSlices );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
 void
-ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-load( File& file )
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::load( File& file )
 {
    file.load( &this->size );
    file.load( &this->storageSize );
    file.load( &this->chunksInSlice );
    file.load( &this->desiredChunkSize );
-   file >> this->rowToChunkMapping
-        >> this->rowToSliceMapping
-        >> this->chunksToSegmentsMapping
-        >> this->rowPointers
-        >> this->slices;
+   file >> this->rowToChunkMapping >> this->rowToSliceMapping >> this->chunksToSegmentsMapping >> this->rowPointers
+      >> this->slices;
    file.load( &this->numberOfSlices );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
-      template< typename Fetch >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
+template< typename Fetch >
 auto
-ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-print( Fetch&& fetch ) const -> SegmentsPrinter< ChunkedEllpack, Fetch >
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::print( Fetch&& fetch ) const
+   -> SegmentsPrinter< ChunkedEllpack, Fetch >
 {
    return SegmentsPrinter< ChunkedEllpack, Fetch >( *this, fetch );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization >
 void
-ChunkedEllpack< Device, Index, IndexAllocator, Organization >::
-printStructure( std::ostream& str )
+ChunkedEllpack< Device, Index, IndexAllocator, Organization >::printStructure( std::ostream& str )
 {
    this->getView().printStructure( str );
 }
 
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/ChunkedEllpackSegmentView.h b/src/TNL/Algorithms/Segments/ChunkedEllpackSegmentView.h
index 77f65e8d9e3e292a9ca96c1dde262e23b7d2a94a..a8e6a7b23639524e45bc4fe175043ab2c5c815e0 100644
--- a/src/TNL/Algorithms/Segments/ChunkedEllpackSegmentView.h
+++ b/src/TNL/Algorithms/Segments/ChunkedEllpackSegmentView.h
@@ -7,114 +7,117 @@
 #pragma once
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
-template< typename Index,
-          ElementsOrganization Organization >
+template< typename Index, ElementsOrganization Organization >
 class ChunkedEllpackSegmentView;
 
 template< typename Index >
 class ChunkedEllpackSegmentView< Index, ColumnMajorOrder >
 {
-   public:
-
-      using IndexType = Index;
-
-      __cuda_callable__
-      ChunkedEllpackSegmentView( const IndexType segmentIdx,
-                                 const IndexType offset,
-                                 const IndexType size,
-                                 const IndexType chunkSize,      // this is only for compatibility with the following specialization
-                                 const IndexType chunksInSlice ) // this one as well - both can be replaced when we could use constexprif in C++17
-      : segmentIdx( segmentIdx ), segmentOffset( offset ), segmentSize( size ){};
-
-      __cuda_callable__
-      ChunkedEllpackSegmentView( const ChunkedEllpackSegmentView& view )
-      : segmentIdx( view.segmentIdx ), segmentOffset( view.segmentOffset ), segmentSize( view.segmentSize ){};
-
-      __cuda_callable__
-      IndexType getSize() const
-      {
-         return this->segmentSize;
-      };
-
-      __cuda_callable__
-      IndexType getGlobalIndex( const IndexType localIndex ) const
-      {
-         TNL_ASSERT_LT( localIndex, segmentSize, "Local index exceeds segment bounds." );
-         return segmentOffset + localIndex;
-      };
-
-      __cuda_callable__
-      const IndexType& getSegmentIndex() const
-      {
-         return this->segmentIdx;
-      };
-
-      protected:
-
-         IndexType segmentIdx, segmentOffset, segmentSize;
+public:
+   using IndexType = Index;
+
+   __cuda_callable__
+   ChunkedEllpackSegmentView(
+      const IndexType segmentIdx,
+      const IndexType offset,
+      const IndexType size,
+      const IndexType chunkSize,       // this is only for compatibility with the following specialization
+      const IndexType chunksInSlice )  // this one as well - both can be replaced when we could use constexprif in C++17
+   : segmentIdx( segmentIdx ), segmentOffset( offset ), segmentSize( size ){};
+
+   __cuda_callable__
+   ChunkedEllpackSegmentView( const ChunkedEllpackSegmentView& view )
+   : segmentIdx( view.segmentIdx ), segmentOffset( view.segmentOffset ), segmentSize( view.segmentSize ){};
+
+   __cuda_callable__
+   IndexType
+   getSize() const
+   {
+      return this->segmentSize;
+   };
+
+   __cuda_callable__
+   IndexType
+   getGlobalIndex( const IndexType localIndex ) const
+   {
+      TNL_ASSERT_LT( localIndex, segmentSize, "Local index exceeds segment bounds." );
+      return segmentOffset + localIndex;
+   };
+
+   __cuda_callable__
+   const IndexType&
+   getSegmentIndex() const
+   {
+      return this->segmentIdx;
+   };
+
+protected:
+   IndexType segmentIdx, segmentOffset, segmentSize;
 };
 
 template< typename Index >
 class ChunkedEllpackSegmentView< Index, RowMajorOrder >
 {
-   public:
-
-      using IndexType = Index;
-
-      __cuda_callable__
-      ChunkedEllpackSegmentView( const IndexType segmentIdx,
-                                 const IndexType offset,
-                                 const IndexType size,
-                                 const IndexType chunkSize,
-                                 const IndexType chunksInSlice )
-      : segmentIdx( segmentIdx ), segmentOffset( offset ), segmentSize( size ),
-        chunkSize( chunkSize ), chunksInSlice( chunksInSlice ){};
-
-      __cuda_callable__
-      ChunkedEllpackSegmentView( const ChunkedEllpackSegmentView& view )
-      : segmentIdx( view.segmentIdx ), segmentOffset( view.segmentOffset ), segmentSize( view.segmentSize ),
-        chunkSize( view.chunkSize ), chunksInSlice( view.chunksInSlice ){};
-
-      __cuda_callable__
-      IndexType getSize() const
-      {
-         return this->segmentSize;
-      };
-
-      __cuda_callable__
-      IndexType getGlobalIndex( const IndexType localIdx ) const
-      {
-         TNL_ASSERT_LT( localIdx, segmentSize, "Local index exceeds segment bounds." );
-         const IndexType chunkIdx = localIdx / chunkSize;
-         const IndexType inChunkOffset = localIdx % chunkSize;
-         return segmentOffset + inChunkOffset * chunksInSlice + chunkIdx;
-      };
-
-      __cuda_callable__
-      const IndexType& getSegmentIndex() const
-      {
-         return this->segmentIdx;
-      };
-
-      __cuda_callable__
-      ChunkedEllpackSegmentView& operator = ( const ChunkedEllpackSegmentView& view ) const
-      {
-         this->segmentIdx = view.segmentIdx;
-         this->segmentOffset = view.segmentOffset;
-         this->segmentSize = view.segmentSize;
-         this->chunkSize = view.chunkSize;
-         this->chunksInSlice = view.chunksInSlice;
-         return *this;
-      }
-
-      protected:
-
-         IndexType segmentIdx, segmentOffset, segmentSize, chunkSize, chunksInSlice;
+public:
+   using IndexType = Index;
+
+   __cuda_callable__
+   ChunkedEllpackSegmentView( const IndexType segmentIdx,
+                              const IndexType offset,
+                              const IndexType size,
+                              const IndexType chunkSize,
+                              const IndexType chunksInSlice )
+   : segmentIdx( segmentIdx ), segmentOffset( offset ), segmentSize( size ), chunkSize( chunkSize ),
+     chunksInSlice( chunksInSlice ){};
+
+   __cuda_callable__
+   ChunkedEllpackSegmentView( const ChunkedEllpackSegmentView& view )
+   : segmentIdx( view.segmentIdx ), segmentOffset( view.segmentOffset ), segmentSize( view.segmentSize ),
+     chunkSize( view.chunkSize ), chunksInSlice( view.chunksInSlice ){};
+
+   __cuda_callable__
+   IndexType
+   getSize() const
+   {
+      return this->segmentSize;
+   };
+
+   __cuda_callable__
+   IndexType
+   getGlobalIndex( const IndexType localIdx ) const
+   {
+      TNL_ASSERT_LT( localIdx, segmentSize, "Local index exceeds segment bounds." );
+      const IndexType chunkIdx = localIdx / chunkSize;
+      const IndexType inChunkOffset = localIdx % chunkSize;
+      return segmentOffset + inChunkOffset * chunksInSlice + chunkIdx;
+   };
+
+   __cuda_callable__
+   const IndexType&
+   getSegmentIndex() const
+   {
+      return this->segmentIdx;
+   };
+
+   __cuda_callable__
+   ChunkedEllpackSegmentView&
+   operator=( const ChunkedEllpackSegmentView& view ) const
+   {
+      this->segmentIdx = view.segmentIdx;
+      this->segmentOffset = view.segmentOffset;
+      this->segmentSize = view.segmentSize;
+      this->chunkSize = view.chunkSize;
+      this->chunksInSlice = view.chunksInSlice;
+      return *this;
+   }
+
+protected:
+   IndexType segmentIdx, segmentOffset, segmentSize, chunkSize, chunksInSlice;
 };
 
-      } //namespace Segments
-   } //namespace Algorithms
-} //namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/ChunkedEllpackView.h b/src/TNL/Algorithms/Segments/ChunkedEllpackView.h
index 6c1281579ee0a1d1dda67607bda11b92e24c8f24..0e66ef5f6bc5722b827b331aa7ad343bc1b23f07 100644
--- a/src/TNL/Algorithms/Segments/ChunkedEllpackView.h
+++ b/src/TNL/Algorithms/Segments/ChunkedEllpackView.h
@@ -16,219 +16,242 @@
 #include <TNL/Algorithms/Segments/SegmentsPrinting.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
-
+namespace Algorithms {
+namespace Segments {
 
 template< typename Device,
           typename Index,
           ElementsOrganization Organization = Algorithms::Segments::DefaultElementsOrganization< Device >::getOrganization() >
 class ChunkedEllpackView
 {
-   public:
-
-      using DeviceType = Device;
-      using IndexType = std::remove_const_t< Index >;
-      using OffsetsView = typename Containers::VectorView< Index, DeviceType, IndexType >;
-      using ConstOffsetsView = typename OffsetsView::ConstViewType;
-      using ViewType = ChunkedEllpackView;
-      template< typename Device_, typename Index_ >
-      using ViewTemplate = ChunkedEllpackView< Device_, Index_, Organization >;
-      using ConstViewType = ChunkedEllpackView< Device, std::add_const_t< Index >, Organization >;
-      using SegmentViewType = ChunkedEllpackSegmentView< IndexType, Organization >;
-      using ChunkedEllpackSliceInfoType = detail::ChunkedEllpackSliceInfo< IndexType >;
-      using ChunkedEllpackSliceInfoAllocator = typename Allocators::Default< Device >::template Allocator< ChunkedEllpackSliceInfoType >;
-      using ChunkedEllpackSliceInfoContainer = Containers::Array< typename TNL::copy_const< ChunkedEllpackSliceInfoType >::template from< Index >::type, DeviceType, IndexType, ChunkedEllpackSliceInfoAllocator >;
-      using ChunkedEllpackSliceInfoContainerView = typename ChunkedEllpackSliceInfoContainer::ViewType;
-
-      static constexpr bool havePadding() { return true; };
-
-      __cuda_callable__
-      ChunkedEllpackView() = default;
-
-      __cuda_callable__
-      ChunkedEllpackView( const IndexType size,
-                          const IndexType storageSize,
-                          const IndexType chunksInSlice,
-                          const IndexType desiredChunkSize,
-                          const OffsetsView& rowToChunkMapping,
-                          const OffsetsView& rowToSliceMapping,
-                          const OffsetsView& chunksToSegmentsMapping,
-                          const OffsetsView& rowPointers,
-                          const ChunkedEllpackSliceInfoContainerView& slices,
-                          const IndexType numberOfSlices );
-
-      __cuda_callable__
-      ChunkedEllpackView( const IndexType size,
-                          const IndexType storageSize,
-                          const IndexType chunksInSlice,
-                          const IndexType desiredChunkSize,
-                          const OffsetsView&& rowToChunkMapping,
-                          const OffsetsView&& rowToSliceMapping,
-                          const OffsetsView&& chunksToSegmentsMapping,
-                          const OffsetsView&& rowPointers,
-                          const ChunkedEllpackSliceInfoContainerView&& slices,
-                          const IndexType numberOfSlices );
-
-      __cuda_callable__
-      ChunkedEllpackView( const ChunkedEllpackView& chunked_ellpack_view ) = default;
-
-      __cuda_callable__
-      ChunkedEllpackView( ChunkedEllpackView&& chunked_ellpack_view ) = default;
-
-      static String getSerializationType();
-
-      static String getSegmentsType();
-
-      __cuda_callable__
-      ViewType getView();
-
-      __cuda_callable__
-      const ConstViewType getConstView() const;
-
-      /**
-       * \brief Number of segments.
-       */
-      __cuda_callable__
-      IndexType getSegmentsCount() const;
-
-      /***
-       * \brief Returns size of the segment number \r segmentIdx
-       */
-      __cuda_callable__
-      IndexType getSegmentSize( const IndexType segmentIdx ) const;
-
-      /***
-       * \brief Returns number of elements managed by all segments.
-       */
-      __cuda_callable__
-      IndexType getSize() const;
-
-      /***
-       * \brief Returns number of elements that needs to be allocated.
-       */
-      __cuda_callable__
-      IndexType getStorageSize() const;
-
-      __cuda_callable__
-      IndexType getGlobalIndex( const Index segmentIdx, const Index localIdx ) const;
-
-      __cuda_callable__
-      SegmentViewType getSegmentView( const IndexType segmentIdx ) const;
-
-      /***
-       * \brief Go over all segments and for each segment element call
-       * function 'f' with arguments 'args'. The return type of 'f' is bool.
-       * When its true, the for-loop continues. Once 'f' returns false, the for-loop
-       * is terminated.
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function&& f ) const;
-
-      template< typename Function >
-      void forAllElements( Function&& f ) const;
-
-      template< typename Function >
-      void forSegments( IndexType begin, IndexType end, Function&& f ) const;
-
-      template< typename Function >
-      void forAllSegments( Function&& f ) const;
-
-      /***
-       * \brief Go over all segments and perform a reduction in each of them.
-       */
-      template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
-      void reduceSegments( IndexType first, IndexType last, Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
-
-      template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
-      void reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
-
-      ChunkedEllpackView& operator=( const ChunkedEllpackView& view );
-
-      void save( File& file ) const;
-
-      template< typename Fetch >
-      SegmentsPrinter< ChunkedEllpackView, Fetch > print( Fetch&& fetch ) const;
-
-      void printStructure( std::ostream& str ) const;
-
-   protected:
-
+public:
+   using DeviceType = Device;
+   using IndexType = std::remove_const_t< Index >;
+   using OffsetsView = typename Containers::VectorView< Index, DeviceType, IndexType >;
+   using ConstOffsetsView = typename OffsetsView::ConstViewType;
+   using ViewType = ChunkedEllpackView;
+   template< typename Device_, typename Index_ >
+   using ViewTemplate = ChunkedEllpackView< Device_, Index_, Organization >;
+   using ConstViewType = ChunkedEllpackView< Device, std::add_const_t< Index >, Organization >;
+   using SegmentViewType = ChunkedEllpackSegmentView< IndexType, Organization >;
+   using ChunkedEllpackSliceInfoType = detail::ChunkedEllpackSliceInfo< IndexType >;
+   using ChunkedEllpackSliceInfoAllocator =
+      typename Allocators::Default< Device >::template Allocator< ChunkedEllpackSliceInfoType >;
+   using ChunkedEllpackSliceInfoContainer =
+      Containers::Array< typename TNL::copy_const< ChunkedEllpackSliceInfoType >::template from< Index >::type,
+                         DeviceType,
+                         IndexType,
+                         ChunkedEllpackSliceInfoAllocator >;
+   using ChunkedEllpackSliceInfoContainerView = typename ChunkedEllpackSliceInfoContainer::ViewType;
+
+   static constexpr bool
+   havePadding()
+   {
+      return true;
+   };
+
+   __cuda_callable__
+   ChunkedEllpackView() = default;
+
+   __cuda_callable__
+   ChunkedEllpackView( IndexType size,
+                       IndexType storageSize,
+                       IndexType chunksInSlice,
+                       IndexType desiredChunkSize,
+                       const OffsetsView& rowToChunkMapping,
+                       const OffsetsView& rowToSliceMapping,
+                       const OffsetsView& chunksToSegmentsMapping,
+                       const OffsetsView& rowPointers,
+                       const ChunkedEllpackSliceInfoContainerView& slices,
+                       IndexType numberOfSlices );
+
+   __cuda_callable__
+   ChunkedEllpackView( IndexType size,
+                       IndexType storageSize,
+                       IndexType chunksInSlice,
+                       IndexType desiredChunkSize,
+                       const OffsetsView&& rowToChunkMapping,
+                       const OffsetsView&& rowToSliceMapping,
+                       const OffsetsView&& chunksToSegmentsMapping,
+                       const OffsetsView&& rowPointers,
+                       const ChunkedEllpackSliceInfoContainerView&& slices,
+                       IndexType numberOfSlices );
+
+   __cuda_callable__
+   ChunkedEllpackView( const ChunkedEllpackView& chunked_ellpack_view ) = default;
+
+   __cuda_callable__
+   ChunkedEllpackView( ChunkedEllpackView&& chunked_ellpack_view ) noexcept = default;
+
+   static std::string
+   getSerializationType();
+
+   static String
+   getSegmentsType();
+
+   __cuda_callable__
+   ViewType
+   getView();
+
+   __cuda_callable__
+   const ConstViewType
+   getConstView() const;
+
+   /**
+    * \brief Number of segments.
+    */
+   __cuda_callable__
+   IndexType
+   getSegmentsCount() const;
+
+   /***
+    * \brief Returns size of the segment number \r segmentIdx
+    */
+   __cuda_callable__
+   IndexType
+   getSegmentSize( IndexType segmentIdx ) const;
+
+   /***
+    * \brief Returns number of elements managed by all segments.
+    */
+   __cuda_callable__
+   IndexType
+   getSize() const;
+
+   /***
+    * \brief Returns number of elements that needs to be allocated.
+    */
+   __cuda_callable__
+   IndexType
+   getStorageSize() const;
+
+   __cuda_callable__
+   IndexType
+   getGlobalIndex( Index segmentIdx, Index localIdx ) const;
+
+   __cuda_callable__
+   SegmentViewType
+   getSegmentView( IndexType segmentIdx ) const;
+
+   /***
+    * \brief Go over all segments and for each segment element call
+    * function 'f' with arguments 'args'. The return type of 'f' is bool.
+    * When its true, the for-loop continues. Once 'f' returns false, the for-loop
+    * is terminated.
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function&& f ) const;
+
+   template< typename Function >
+   void
+   forAllElements( Function&& f ) const;
+
+   template< typename Function >
+   void
+   forSegments( IndexType begin, IndexType end, Function&& f ) const;
+
+   template< typename Function >
+   void
+   forAllSegments( Function&& f ) const;
+
+   /***
+    * \brief Go over all segments and perform a reduction in each of them.
+    */
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+   void
+   reduceSegments( IndexType first,
+                   IndexType last,
+                   Fetch& fetch,
+                   const Reduction& reduction,
+                   ResultKeeper& keeper,
+                   const Real& zero ) const;
+
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+   void
+   reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
+
+   ChunkedEllpackView&
+   operator=( const ChunkedEllpackView& view );
+
+   void
+   save( File& file ) const;
+
+   template< typename Fetch >
+   SegmentsPrinter< ChunkedEllpackView, Fetch >
+   print( Fetch&& fetch ) const;
+
+   void
+   printStructure( std::ostream& str ) const;
+
+protected:
 #ifdef HAVE_CUDA
-      template< typename Fetch,
-                typename Reduction,
-                typename ResultKeeper,
-                typename Real >
-      __device__
-      void reduceSegmentsKernelWithAllParameters( IndexType gridIdx,
-                                                     IndexType first,
-                                                     IndexType last,
-                                                     Fetch fetch,
-                                                     Reduction reduction,
-                                                     ResultKeeper keeper,
-                                                     Real zero ) const;
-
-      template< typename Fetch,
-                typename Reduction,
-                typename ResultKeeper,
-                typename Real >
-      __device__
-      void reduceSegmentsKernel( IndexType gridIdx,
-                                    IndexType first,
-                                    IndexType last,
-                                    Fetch fetch,
-                                    Reduction reduction,
-                                    ResultKeeper keeper,
-                                    Real zero ) const;
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+   __device__
+   void
+   reduceSegmentsKernelWithAllParameters( IndexType gridIdx,
+                                          IndexType first,
+                                          IndexType last,
+                                          Fetch fetch,
+                                          Reduction reduction,
+                                          ResultKeeper keeper,
+                                          Real zero ) const;
+
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+   __device__
+   void
+   reduceSegmentsKernel( IndexType gridIdx,
+                         IndexType first,
+                         IndexType last,
+                         Fetch fetch,
+                         Reduction reduction,
+                         ResultKeeper keeper,
+                         Real zero ) const;
 #endif
 
-      IndexType size = 0, storageSize = 0, numberOfSlices = 0;
+   IndexType size = 0, storageSize = 0, numberOfSlices = 0;
 
-      IndexType chunksInSlice = 256, desiredChunkSize = 16;
+   IndexType chunksInSlice = 256, desiredChunkSize = 16;
 
-      /**
-       * For each segment, this keeps index of the slice which contains the
-       * segment.
-       */
-      OffsetsView rowToSliceMapping;
+   /**
+    * For each segment, this keeps index of the slice which contains the
+    * segment.
+    */
+   OffsetsView rowToSliceMapping;
 
-      /**
-       * For each row, this keeps index of the first chunk within a slice.
-       */
-      OffsetsView rowToChunkMapping;
+   /**
+    * For each row, this keeps index of the first chunk within a slice.
+    */
+   OffsetsView rowToChunkMapping;
 
-      OffsetsView chunksToSegmentsMapping;
+   OffsetsView chunksToSegmentsMapping;
 
-      /**
-       * Keeps index of the first segment index.
-       */
-      OffsetsView rowPointers;
+   /**
+    * Keeps index of the first segment index.
+    */
+   OffsetsView rowPointers;
 
-      ChunkedEllpackSliceInfoContainerView slices;
+   ChunkedEllpackSliceInfoContainerView slices;
 
 #ifdef HAVE_CUDA
-      template< typename View_,
-                typename Index_,
-                typename Fetch_,
-                typename Reduction_,
-                typename ResultKeeper_,
-                typename Real_ >
-      friend __global__
-      void ChunkedEllpackreduceSegmentsKernel( View_ chunkedEllpack,
-                                                  Index_ gridIdx,
-                                                  Index_ first,
-                                                  Index_ last,
-                                                  Fetch_ fetch,
-                                                  Reduction_ reduction,
-                                                  ResultKeeper_ keeper,
-                                                  Real_ zero );
-
-      template< typename Index_, typename Fetch_, bool B_ >
-      friend struct detail::ChunkedEllpackreduceSegmentsDispatcher;
+   template< typename View_, typename Index_, typename Fetch_, typename Reduction_, typename ResultKeeper_, typename Real_ >
+   friend __global__
+   void
+   ChunkedEllpackreduceSegmentsKernel( View_ chunkedEllpack,
+                                       Index_ gridIdx,
+                                       Index_ first,
+                                       Index_ last,
+                                       Fetch_ fetch,
+                                       Reduction_ reduction,
+                                       ResultKeeper_ keeper,
+                                       Real_ zero );
+
+   template< typename Index_, typename Fetch_, bool B_ >
+   friend struct detail::ChunkedEllpackreduceSegmentsDispatcher;
 #endif
 };
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
 
 #include <TNL/Algorithms/Segments/ChunkedEllpackView.hpp>
diff --git a/src/TNL/Algorithms/Segments/ChunkedEllpackView.hpp b/src/TNL/Algorithms/Segments/ChunkedEllpackView.hpp
index a13bffb6b9c2d745bafe4e845c586600c5dbb8ec..12195559d056f7b07da0e34cb64616f5ca1b046b 100644
--- a/src/TNL/Algorithms/Segments/ChunkedEllpackView.hpp
+++ b/src/TNL/Algorithms/Segments/ChunkedEllpackView.hpp
@@ -14,95 +14,68 @@
 #include <TNL/Cuda/SharedMemory.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
-ChunkedEllpackView< Device, Index, Organization >::
-ChunkedEllpackView( const IndexType size,
-                    const IndexType storageSize,
-                    const IndexType chunksInSlice,
-                    const IndexType desiredChunkSize,
-                    const OffsetsView& rowToChunkMapping,
-                    const OffsetsView& rowToSliceMapping,
-                    const OffsetsView& chunksToSegmentsMapping,
-                    const OffsetsView& rowPointers,
-                    const ChunkedEllpackSliceInfoContainerView& slices,
-                    const IndexType numberOfSlices )
-: size( size ),
-  storageSize( storageSize ),
-  numberOfSlices( numberOfSlices ),
-  chunksInSlice( chunksInSlice ),
-  desiredChunkSize( desiredChunkSize ),
-  rowToSliceMapping( rowToSliceMapping ),
-  rowToChunkMapping( rowToChunkMapping ),
-  chunksToSegmentsMapping( chunksToSegmentsMapping ),
-  rowPointers( rowPointers ),
-  slices( slices )
-{
-}
-
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+ChunkedEllpackView< Device, Index, Organization >::ChunkedEllpackView( const IndexType size,
+                                                                       const IndexType storageSize,
+                                                                       const IndexType chunksInSlice,
+                                                                       const IndexType desiredChunkSize,
+                                                                       const OffsetsView& rowToChunkMapping,
+                                                                       const OffsetsView& rowToSliceMapping,
+                                                                       const OffsetsView& chunksToSegmentsMapping,
+                                                                       const OffsetsView& rowPointers,
+                                                                       const ChunkedEllpackSliceInfoContainerView& slices,
+                                                                       const IndexType numberOfSlices )
+: size( size ), storageSize( storageSize ), numberOfSlices( numberOfSlices ), chunksInSlice( chunksInSlice ),
+  desiredChunkSize( desiredChunkSize ), rowToSliceMapping( rowToSliceMapping ), rowToChunkMapping( rowToChunkMapping ),
+  chunksToSegmentsMapping( chunksToSegmentsMapping ), rowPointers( rowPointers ), slices( slices )
+{}
+
+template< typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
-ChunkedEllpackView< Device, Index, Organization >::
-ChunkedEllpackView( const IndexType size,
-                    const IndexType storageSize,
-                    const IndexType chunksInSlice,
-                    const IndexType desiredChunkSize,
-                    const OffsetsView&& rowToChunkMapping,
-                    const OffsetsView&& rowToSliceMapping,
-                    const OffsetsView&& chunksToSegmentsMapping,
-                    const OffsetsView&& rowPointers,
-                    const ChunkedEllpackSliceInfoContainerView&& slices,
-                    const IndexType numberOfSlices )
-: size( size ),
-  storageSize( storageSize ),
-  numberOfSlices( numberOfSlices ),
-  chunksInSlice( chunksInSlice ),
-  desiredChunkSize( desiredChunkSize ),
-  rowToSliceMapping( std::move( rowToSliceMapping ) ),
-  rowToChunkMapping( std::move( rowToChunkMapping ) ),
-  chunksToSegmentsMapping( std::move( chunksToSegmentsMapping ) ),
-  rowPointers( std::move( rowPointers ) ),
-  slices( std::move( slices ) )
-{
-}
-
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-String
-ChunkedEllpackView< Device, Index, Organization >::
-getSerializationType()
+ChunkedEllpackView< Device, Index, Organization >::ChunkedEllpackView( const IndexType size,
+                                                                       const IndexType storageSize,
+                                                                       const IndexType chunksInSlice,
+                                                                       const IndexType desiredChunkSize,
+                                                                       const OffsetsView&& rowToChunkMapping,
+                                                                       const OffsetsView&& rowToSliceMapping,
+                                                                       const OffsetsView&& chunksToSegmentsMapping,
+                                                                       const OffsetsView&& rowPointers,
+                                                                       const ChunkedEllpackSliceInfoContainerView&& slices,
+                                                                       const IndexType numberOfSlices )
+: size( size ), storageSize( storageSize ), numberOfSlices( numberOfSlices ), chunksInSlice( chunksInSlice ),
+  desiredChunkSize( desiredChunkSize ), rowToSliceMapping( std::move( rowToSliceMapping ) ),
+  rowToChunkMapping( std::move( rowToChunkMapping ) ), chunksToSegmentsMapping( std::move( chunksToSegmentsMapping ) ),
+  rowPointers( std::move( rowPointers ) ), slices( std::move( slices ) )
+{}
+
+template< typename Device, typename Index, ElementsOrganization Organization >
+std::string
+ChunkedEllpackView< Device, Index, Organization >::getSerializationType()
 {
    // FIXME: the serialized data DEPEND on the Organization parameter, so it should be reflected in the serialization type
    return "ChunkedEllpack< [any_device], " + TNL::getSerializationType< IndexType >() + " >";
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Device, typename Index, ElementsOrganization Organization >
 String
-ChunkedEllpackView< Device, Index, Organization >::
-getSegmentsType()
+ChunkedEllpackView< Device, Index, Organization >::getSegmentsType()
 {
    return "ChunkedEllpack";
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
 typename ChunkedEllpackView< Device, Index, Organization >::ViewType
-ChunkedEllpackView< Device, Index, Organization >::
-getView()
+ChunkedEllpackView< Device, Index, Organization >::getView()
 {
-   return ViewType( size, storageSize, chunksInSlice, desiredChunkSize,
+   return ViewType( size,
+                    storageSize,
+                    chunksInSlice,
+                    desiredChunkSize,
                     rowToChunkMapping.getView(),
                     rowToSliceMapping.getView(),
                     chunksToSegmentsMapping.getView(),
@@ -111,14 +84,16 @@ getView()
                     numberOfSlices );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-__cuda_callable__ auto ChunkedEllpackView< Device, Index, Organization >::
-getConstView() const -> const ConstViewType
+template< typename Device, typename Index, ElementsOrganization Organization >
+__cuda_callable__
+auto
+ChunkedEllpackView< Device, Index, Organization >::getConstView() const -> const ConstViewType
 {
    ChunkedEllpackView* this_ptr = const_cast< ChunkedEllpackView* >( this );
-   return ConstViewType( size, storageSize, chunksInSlice, desiredChunkSize,
+   return ConstViewType( size,
+                         storageSize,
+                         chunksInSlice,
+                         desiredChunkSize,
                          this_ptr->rowToChunkMapping.getView(),
                          this_ptr->rowToSliceMapping.getView(),
                          this_ptr->chunksToSegmentsMapping.getView(),
@@ -127,152 +102,103 @@ getConstView() const -> const ConstViewType
                          numberOfSlices );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-__cuda_callable__ auto ChunkedEllpackView< Device, Index, Organization >::
-getSegmentsCount() const -> IndexType
+template< typename Device, typename Index, ElementsOrganization Organization >
+__cuda_callable__
+auto
+ChunkedEllpackView< Device, Index, Organization >::getSegmentsCount() const -> IndexType
 {
    return this->size;
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-__cuda_callable__ auto ChunkedEllpackView< Device, Index, Organization >::
-getSegmentSize( const IndexType segmentIdx ) const -> IndexType
+template< typename Device, typename Index, ElementsOrganization Organization >
+__cuda_callable__
+auto
+ChunkedEllpackView< Device, Index, Organization >::getSegmentSize( const IndexType segmentIdx ) const -> IndexType
 {
    if( std::is_same< DeviceType, Devices::Host >::value )
       return detail::ChunkedEllpack< IndexType, DeviceType, Organization >::getSegmentSizeDirect(
-         rowToSliceMapping,
-         slices,
-         rowToChunkMapping,
-         segmentIdx );
-   if( std::is_same< DeviceType, Devices::Cuda >::value )
-   {
+         rowToSliceMapping, slices, rowToChunkMapping, segmentIdx );
+   if( std::is_same< DeviceType, Devices::Cuda >::value ) {
 #ifdef __CUDA_ARCH__
       return detail::ChunkedEllpack< IndexType, DeviceType, Organization >::getSegmentSizeDirect(
-         rowToSliceMapping,
-         slices,
-         rowToChunkMapping,
-         segmentIdx );
+         rowToSliceMapping, slices, rowToChunkMapping, segmentIdx );
 #else
       return detail::ChunkedEllpack< IndexType, DeviceType, Organization >::getSegmentSize(
-         rowToSliceMapping,
-         slices,
-         rowToChunkMapping,
-         segmentIdx );
+         rowToSliceMapping, slices, rowToChunkMapping, segmentIdx );
 #endif
    }
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-__cuda_callable__ auto ChunkedEllpackView< Device, Index, Organization >::
-getSize() const -> IndexType
+template< typename Device, typename Index, ElementsOrganization Organization >
+__cuda_callable__
+auto
+ChunkedEllpackView< Device, Index, Organization >::getSize() const -> IndexType
 {
    return this->size;
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-__cuda_callable__ auto ChunkedEllpackView< Device, Index, Organization >::
-getStorageSize() const -> IndexType
+template< typename Device, typename Index, ElementsOrganization Organization >
+__cuda_callable__
+auto
+ChunkedEllpackView< Device, Index, Organization >::getStorageSize() const -> IndexType
 {
    return this->storageSize;
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-__cuda_callable__ auto ChunkedEllpackView< Device, Index, Organization >::
-getGlobalIndex( const Index segmentIdx, const Index localIdx ) const -> IndexType
+template< typename Device, typename Index, ElementsOrganization Organization >
+__cuda_callable__
+auto
+ChunkedEllpackView< Device, Index, Organization >::getGlobalIndex( const Index segmentIdx, const Index localIdx ) const
+   -> IndexType
 {
    if( std::is_same< DeviceType, Devices::Host >::value )
       return detail::ChunkedEllpack< IndexType, DeviceType, Organization >::getGlobalIndexDirect(
-         rowToSliceMapping,
-         slices,
-         rowToChunkMapping,
-         chunksInSlice,
-         segmentIdx,
-         localIdx );
-   if( std::is_same< DeviceType, Devices::Cuda >::value )
-   {
+         rowToSliceMapping, slices, rowToChunkMapping, chunksInSlice, segmentIdx, localIdx );
+   if( std::is_same< DeviceType, Devices::Cuda >::value ) {
 #ifdef __CUDA_ARCH__
       return detail::ChunkedEllpack< IndexType, DeviceType, Organization >::getGlobalIndexDirect(
-         rowToSliceMapping,
-         slices,
-         rowToChunkMapping,
-         chunksInSlice,
-         segmentIdx,
-         localIdx );
+         rowToSliceMapping, slices, rowToChunkMapping, chunksInSlice, segmentIdx, localIdx );
 #else
       return detail::ChunkedEllpack< IndexType, DeviceType, Organization >::getGlobalIndex(
-         rowToSliceMapping,
-         slices,
-         rowToChunkMapping,
-         chunksInSlice,
-         segmentIdx,
-         localIdx );
+         rowToSliceMapping, slices, rowToChunkMapping, chunksInSlice, segmentIdx, localIdx );
 #endif
    }
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
 auto
-ChunkedEllpackView< Device, Index, Organization >::
-getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType
+ChunkedEllpackView< Device, Index, Organization >::getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType
 {
    if( std::is_same< DeviceType, Devices::Host >::value )
       return detail::ChunkedEllpack< IndexType, DeviceType, Organization >::getSegmentViewDirect(
-         rowToSliceMapping,
-         slices,
-         rowToChunkMapping,
-         chunksInSlice,
-         segmentIdx );
-   if( std::is_same< DeviceType, Devices::Cuda >::value )
-   {
+         rowToSliceMapping, slices, rowToChunkMapping, chunksInSlice, segmentIdx );
+   if( std::is_same< DeviceType, Devices::Cuda >::value ) {
 #ifdef __CUDA_ARCH__
       return detail::ChunkedEllpack< IndexType, DeviceType, Organization >::getSegmentViewDirect(
-         rowToSliceMapping,
-         slices,
-         rowToChunkMapping,
-         chunksInSlice,
-         segmentIdx );
+         rowToSliceMapping, slices, rowToChunkMapping, chunksInSlice, segmentIdx );
 #else
       return detail::ChunkedEllpack< IndexType, DeviceType, Organization >::getSegmentView(
-         rowToSliceMapping,
-         slices,
-         rowToChunkMapping,
-         chunksInSlice,
-         segmentIdx );
+         rowToSliceMapping, slices, rowToChunkMapping, chunksInSlice, segmentIdx );
 #endif
    }
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-ChunkedEllpackView< Device, Index, Organization >::
-forElements( IndexType first, IndexType last, Function&& f ) const
+ChunkedEllpackView< Device, Index, Organization >::forElements( IndexType first, IndexType last, Function&& f ) const
 {
    const IndexType chunksInSlice = this->chunksInSlice;
    auto rowToChunkMapping = this->rowToChunkMapping;
    auto rowToSliceMapping = this->rowToSliceMapping;
    auto slices = this->slices;
-   auto work = [=] __cuda_callable__ ( IndexType segmentIdx ) mutable {
+   auto work = [ = ] __cuda_callable__( IndexType segmentIdx ) mutable
+   {
       const IndexType sliceIdx = rowToSliceMapping[ segmentIdx ];
 
       IndexType firstChunkOfSegment( 0 );
-      if( segmentIdx != slices[ sliceIdx ].firstSegment )
-      {
+      if( segmentIdx != slices[ sliceIdx ].firstSegment ) {
          firstChunkOfSegment = rowToChunkMapping[ segmentIdx - 1 ];
       }
 
@@ -282,23 +208,19 @@ forElements( IndexType first, IndexType last, Function&& f ) const
       const IndexType chunkSize = slices[ sliceIdx ].chunkSize;
 
       const IndexType segmentSize = segmentChunksCount * chunkSize;
-      if( Organization == RowMajorOrder )
-      {
+      if( Organization == RowMajorOrder ) {
          IndexType begin = sliceOffset + firstChunkOfSegment * chunkSize;
          IndexType end = begin + segmentSize;
          IndexType localIdx( 0 );
          for( IndexType j = begin; j < end; j++ )
             f( segmentIdx, localIdx++, j );
       }
-      else
-      {
+      else {
          IndexType localIdx( 0 );
-         for( IndexType chunkIdx = 0; chunkIdx < segmentChunksCount; chunkIdx++ )
-         {
+         for( IndexType chunkIdx = 0; chunkIdx < segmentChunksCount; chunkIdx++ ) {
             IndexType begin = sliceOffset + firstChunkOfSegment + chunkIdx;
             IndexType end = begin + chunksInSlice * chunkSize;
-            for( IndexType j = begin; j < end; j += chunksInSlice )
-            {
+            for( IndexType j = begin; j < end; j += chunksInSlice ) {
                f( segmentIdx, localIdx++, j );
             }
          }
@@ -307,63 +229,54 @@ forElements( IndexType first, IndexType last, Function&& f ) const
    Algorithms::ParallelFor< DeviceType >::exec( first, last, work );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-ChunkedEllpackView< Device, Index, Organization >::
-forAllElements( Function&& f ) const
+ChunkedEllpackView< Device, Index, Organization >::forAllElements( Function&& f ) const
 {
    this->forElements( 0, this->getSegmentsCount(), f );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-ChunkedEllpackView< Device, Index, Organization >::
-forSegments( IndexType begin, IndexType end, Function&& function ) const
+ChunkedEllpackView< Device, Index, Organization >::forSegments( IndexType begin, IndexType end, Function&& function ) const
 {
    auto view = this->getConstView();
    using SVType = decltype( view.getSegmentView( IndexType() ) );
    static_assert( std::is_same< SVType, SegmentViewType >::value, "" );
-   auto f = [=] __cuda_callable__ ( IndexType segmentIdx ) mutable {
+   auto f = [ = ] __cuda_callable__( IndexType segmentIdx ) mutable
+   {
       auto segment = view.getSegmentView( segmentIdx );
       function( segment );
    };
    TNL::Algorithms::ParallelFor< DeviceType >::exec( begin, end, f );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-ChunkedEllpackView< Device, Index, Organization >::
-forAllSegments( Function&& f ) const
+ChunkedEllpackView< Device, Index, Organization >::forAllSegments( Function&& f ) const
 {
    this->forSegments( 0, this->getSegmentsCount(), f );
 }
 
-
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+template< typename Device, typename Index, ElementsOrganization Organization >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
 void
-ChunkedEllpackView< Device, Index, Organization >::
-reduceSegments( IndexType first, IndexType last, Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const
+ChunkedEllpackView< Device, Index, Organization >::reduceSegments( IndexType first,
+                                                                   IndexType last,
+                                                                   Fetch& fetch,
+                                                                   const Reduction& reduction,
+                                                                   ResultKeeper& keeper,
+                                                                   const Real& zero ) const
 {
    using RealType = typename detail::FetchLambdaAdapter< Index, Fetch >::ReturnType;
-   if( std::is_same< DeviceType, Devices::Host >::value )
-   {
-      //reduceSegmentsKernel( 0, first, last, fetch, reduction, keeper, zero );
-      //return;
+   if( std::is_same< DeviceType, Devices::Host >::value ) {
+      // reduceSegmentsKernel( 0, first, last, fetch, reduction, keeper, zero );
+      // return;
 
-      for( IndexType segmentIdx = first; segmentIdx < last; segmentIdx++ )
-      {
+      for( IndexType segmentIdx = first; segmentIdx < last; segmentIdx++ ) {
          const IndexType& sliceIndex = rowToSliceMapping[ segmentIdx ];
          TNL_ASSERT_LE( sliceIndex, this->size, "" );
          IndexType firstChunkOfSegment( 0 );
@@ -378,69 +291,65 @@ reduceSegments( IndexType first, IndexType last, Fetch& fetch, const Reduction&
          const IndexType segmentSize = segmentChunksCount * chunkSize;
          RealType aux( zero );
          bool compute( true );
-         if( Organization == RowMajorOrder )
-         {
+         if( Organization == RowMajorOrder ) {
             IndexType begin = sliceOffset + firstChunkOfSegment * chunkSize;
             IndexType end = begin + segmentSize;
             IndexType localIdx( 0 );
             for( IndexType globalIdx = begin; globalIdx < end && compute; globalIdx++ )
-               aux = reduction( aux, detail::FetchLambdaAdapter< IndexType, Fetch >::call( fetch, segmentIdx, localIdx++, globalIdx, compute ) );
+               aux = reduction(
+                  aux,
+                  detail::FetchLambdaAdapter< IndexType, Fetch >::call( fetch, segmentIdx, localIdx++, globalIdx, compute ) );
          }
-         else
-         {
-            for( IndexType chunkIdx = 0; chunkIdx < segmentChunksCount; chunkIdx++ )
-            {
+         else {
+            for( IndexType chunkIdx = 0; chunkIdx < segmentChunksCount; chunkIdx++ ) {
                IndexType begin = sliceOffset + firstChunkOfSegment + chunkIdx;
                IndexType end = begin + chunksInSlice * chunkSize;
                IndexType localIdx( 0 );
                for( IndexType globalIdx = begin; globalIdx < end && compute; globalIdx += chunksInSlice )
-                  aux = reduction( aux, detail::FetchLambdaAdapter< IndexType, Fetch >::call( fetch, segmentIdx, localIdx++, globalIdx, compute ) );
+                  aux = reduction( aux,
+                                   detail::FetchLambdaAdapter< IndexType, Fetch >::call(
+                                      fetch, segmentIdx, localIdx++, globalIdx, compute ) );
             }
          }
          keeper( segmentIdx, aux );
       }
    }
-   if( std::is_same< DeviceType, Devices::Cuda >::value )
-   {
+   if( std::is_same< DeviceType, Devices::Cuda >::value ) {
 #ifdef HAVE_CUDA
-      //const IndexType chunksCount = this->numberOfSlices * this->chunksInSlice;
-      // TODO: This ignores parameters first and last
+      // const IndexType chunksCount = this->numberOfSlices * this->chunksInSlice;
+      //  TODO: This ignores parameters first and last
       const IndexType cudaBlocks = this->numberOfSlices;
       const IndexType cudaGrids = roundUpDivision( cudaBlocks, Cuda::getMaxGridSize() );
       dim3 cudaBlockSize( this->chunksInSlice ), cudaGridSize;
       const IndexType sharedMemory = cudaBlockSize.x * sizeof( RealType );
 
-      for( IndexType gridIdx = 0; gridIdx < cudaGrids; gridIdx++ )
-      {
+      for( IndexType gridIdx = 0; gridIdx < cudaGrids; gridIdx++ ) {
          if( gridIdx == cudaGrids - 1 )
             cudaGridSize.x = cudaBlocks % Cuda::getMaxGridSize();
-         detail::ChunkedEllpackreduceSegmentsKernel< ViewType, IndexType, Fetch, Reduction, ResultKeeper, Real  >
-            <<< cudaGridSize, cudaBlockSize, sharedMemory  >>>
-            ( *this, gridIdx, first, last, fetch, reduction, keeper, zero );
+         detail::ChunkedEllpackreduceSegmentsKernel< ViewType, IndexType, Fetch, Reduction, ResultKeeper, Real >
+            <<< cudaGridSize, cudaBlockSize,
+            sharedMemory >>>( *this, gridIdx, first, last, fetch, reduction, keeper, zero );
       }
-      cudaStreamSynchronize(0);
+      cudaStreamSynchronize( 0 );
       TNL_CHECK_CUDA_DEVICE;
 #endif
    }
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+template< typename Device, typename Index, ElementsOrganization Organization >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
 void
-ChunkedEllpackView< Device, Index, Organization >::
-reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const
+ChunkedEllpackView< Device, Index, Organization >::reduceAllSegments( Fetch& fetch,
+                                                                      const Reduction& reduction,
+                                                                      ResultKeeper& keeper,
+                                                                      const Real& zero ) const
 {
    this->reduceSegments( 0, this->getSegmentsCount(), fetch, reduction, keeper, zero );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Device, typename Index, ElementsOrganization Organization >
 ChunkedEllpackView< Device, Index, Organization >&
-ChunkedEllpackView< Device, Index, Organization >::
-operator=( const ChunkedEllpackView& view )
+ChunkedEllpackView< Device, Index, Organization >::operator=( const ChunkedEllpackView& view )
 {
    this->size = view.size;
    this->storageSize = view.storageSize;
@@ -455,77 +364,55 @@ operator=( const ChunkedEllpackView& view )
    return *this;
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Device, typename Index, ElementsOrganization Organization >
 void
-ChunkedEllpackView< Device, Index, Organization >::
-save( File& file ) const
+ChunkedEllpackView< Device, Index, Organization >::save( File& file ) const
 {
    file.save( &this->size );
    file.save( &this->storageSize );
    file.save( &this->chunksInSlice );
    file.save( &this->desiredChunkSize );
-   file << this->rowToChunkMapping
-        << this->chunksToSegmentsMapping
-        << this->rowToSliceMapping
-        << this->rowPointers
+   file << this->rowToChunkMapping << this->chunksToSegmentsMapping << this->rowToSliceMapping << this->rowPointers
         << this->slices;
    file.save( &this->numberOfSlices );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-      template< typename Fetch >
+template< typename Device, typename Index, ElementsOrganization Organization >
+template< typename Fetch >
 auto
-ChunkedEllpackView< Device, Index, Organization >::
-print( Fetch&& fetch ) const -> SegmentsPrinter< ChunkedEllpackView, Fetch >
+ChunkedEllpackView< Device, Index, Organization >::print( Fetch&& fetch ) const -> SegmentsPrinter< ChunkedEllpackView, Fetch >
 {
    return SegmentsPrinter< ChunkedEllpackView, Fetch >( *this, fetch );
 }
 
-
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Device, typename Index, ElementsOrganization Organization >
 void
-ChunkedEllpackView< Device, Index, Organization >::
-printStructure( std::ostream& str ) const
+ChunkedEllpackView< Device, Index, Organization >::printStructure( std::ostream& str ) const
 {
-   //const IndexType numberOfSlices = this->getNumberOfSlices();
-   str << "Segments count: " << this->getSize() << std::endl
-       << "Slices: " << numberOfSlices << std::endl;
+   // const IndexType numberOfSlices = this->getNumberOfSlices();
+   str << "Segments count: " << this->getSize() << std::endl << "Slices: " << numberOfSlices << std::endl;
    for( IndexType i = 0; i < numberOfSlices; i++ )
-      str << "   Slice " << i
-          << " : size = " << this->slices.getElement( i ).size
+      str << "   Slice " << i << " : size = " << this->slices.getElement( i ).size
           << " chunkSize = " << this->slices.getElement( i ).chunkSize
           << " firstSegment = " << this->slices.getElement( i ).firstSegment
           << " pointer = " << this->slices.getElement( i ).pointer << std::endl;
    for( IndexType i = 0; i < this->getSize(); i++ )
-      str << "Segment " << i
-          << " : slice = " << this->rowToSliceMapping.getElement( i )
+      str << "Segment " << i << " : slice = " << this->rowToSliceMapping.getElement( i )
           << " chunk = " << this->rowToChunkMapping.getElement( i ) << std::endl;
 }
 
 #ifdef HAVE_CUDA
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Fetch,
-             typename Reduction,
-             typename ResultKeeper,
-             typename Real >
+template< typename Device, typename Index, ElementsOrganization Organization >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
 __device__
 void
-ChunkedEllpackView< Device, Index, Organization >::
-reduceSegmentsKernelWithAllParameters( IndexType gridIdx,
-                                          IndexType first,
-                                          IndexType last,
-                                          Fetch fetch,
-                                          Reduction reduction,
-                                          ResultKeeper keeper,
-                                          Real zero ) const
+ChunkedEllpackView< Device, Index, Organization >::reduceSegmentsKernelWithAllParameters( IndexType gridIdx,
+                                                                                          IndexType first,
+                                                                                          IndexType last,
+                                                                                          Fetch fetch,
+                                                                                          Reduction reduction,
+                                                                                          ResultKeeper keeper,
+                                                                                          Real zero ) const
 {
    using RealType = decltype( fetch( IndexType(), IndexType(), IndexType(), std::declval< bool& >() ) );
 
@@ -543,8 +430,6 @@ reduceSegmentsKernelWithAllParameters( IndexType gridIdx,
    chunksResults[ threadIdx.x ] = zero;
    __syncthreads();
 
-
-
    const IndexType sliceOffset = sliceInfo.pointer;
    const IndexType chunkSize = sliceInfo.chunkSize;
    const IndexType chunkIdx = sliceIdx * chunksInSlice + threadIdx.x;
@@ -555,23 +440,20 @@ reduceSegmentsKernelWithAllParameters( IndexType gridIdx,
    IndexType localIdx = ( threadIdx.x - firstChunkOfSegment ) * chunkSize;
    bool compute( true );
 
-   if( Organization == RowMajorOrder )
-   {
-      IndexType begin = sliceOffset + threadIdx.x * chunkSize; // threadIdx.x = chunkIdx within the slice
+   if( Organization == RowMajorOrder ) {
+      IndexType begin = sliceOffset + threadIdx.x * chunkSize;  // threadIdx.x = chunkIdx within the slice
       IndexType end = begin + chunkSize;
       for( IndexType j = begin; j < end && compute; j++ )
          chunksResults[ threadIdx.x ] = reduction( chunksResults[ threadIdx.x ], fetch( segmentIdx, localIdx++, j, compute ) );
    }
-   else
-   {
-      const IndexType begin = sliceOffset + threadIdx.x; // threadIdx.x = chunkIdx within the slice
+   else {
+      const IndexType begin = sliceOffset + threadIdx.x;  // threadIdx.x = chunkIdx within the slice
       const IndexType end = begin + chunksInSlice * chunkSize;
-         for( IndexType j = begin; j < end && compute; j += chunksInSlice )
-            chunksResults[ threadIdx.x ] = reduction( chunksResults[ threadIdx.x ], fetch( segmentIdx, localIdx++, j, compute ) );
+      for( IndexType j = begin; j < end && compute; j += chunksInSlice )
+         chunksResults[ threadIdx.x ] = reduction( chunksResults[ threadIdx.x ], fetch( segmentIdx, localIdx++, j, compute ) );
    }
    __syncthreads();
-   if( threadIdx.x < sliceInfo.size )
-   {
+   if( threadIdx.x < sliceInfo.size ) {
       const IndexType row = sliceInfo.firstSegment + threadIdx.x;
       IndexType chunkIndex( 0 );
       if( threadIdx.x != 0 )
@@ -579,29 +461,23 @@ reduceSegmentsKernelWithAllParameters( IndexType gridIdx,
       const IndexType lastChunk = this->rowToChunkMapping[ row ];
       RealType result( zero );
       while( chunkIndex < lastChunk )
-         result = reduction( result,  chunksResults[ chunkIndex++ ] );
+         result = reduction( result, chunksResults[ chunkIndex++ ] );
       if( row >= first && row < last )
          keeper( row, result );
    }
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Fetch,
-             typename Reduction,
-             typename ResultKeeper,
-             typename Real >
+template< typename Device, typename Index, ElementsOrganization Organization >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
 __device__
 void
-ChunkedEllpackView< Device, Index, Organization >::
-reduceSegmentsKernel( IndexType gridIdx,
-                         IndexType first,
-                         IndexType last,
-                         Fetch fetch,
-                         Reduction reduction,
-                         ResultKeeper keeper,
-                         Real zero ) const
+ChunkedEllpackView< Device, Index, Organization >::reduceSegmentsKernel( IndexType gridIdx,
+                                                                         IndexType first,
+                                                                         IndexType last,
+                                                                         Fetch fetch,
+                                                                         Reduction reduction,
+                                                                         ResultKeeper keeper,
+                                                                         Real zero ) const
 {
    using RealType = decltype( fetch( IndexType(), std::declval< bool& >() ) );
 
@@ -622,27 +498,24 @@ reduceSegmentsKernel( IndexType gridIdx,
 
    const IndexType sliceOffset = sliceInfo.pointer;
    const IndexType chunkSize = sliceInfo.chunkSize;
-   //const IndexType chunkIdx = sliceIdx * chunksInSlice + threadIdx.x;
+   // const IndexType chunkIdx = sliceIdx * chunksInSlice + threadIdx.x;
    bool compute( true );
 
-   if( Organization == RowMajorOrder )
-   {
-      IndexType begin = sliceOffset + threadIdx.x * chunkSize; // threadIdx.x = chunkIdx within the slice
+   if( Organization == RowMajorOrder ) {
+      IndexType begin = sliceOffset + threadIdx.x * chunkSize;  // threadIdx.x = chunkIdx within the slice
       IndexType end = begin + chunkSize;
       for( IndexType j = begin; j < end && compute; j++ )
          chunksResults[ threadIdx.x ] = reduction( chunksResults[ threadIdx.x ], fetch( j, compute ) );
    }
-   else
-   {
-      const IndexType begin = sliceOffset + threadIdx.x; // threadIdx.x = chunkIdx within the slice
+   else {
+      const IndexType begin = sliceOffset + threadIdx.x;  // threadIdx.x = chunkIdx within the slice
       const IndexType end = begin + chunksInSlice * chunkSize;
-         for( IndexType j = begin; j < end && compute; j += chunksInSlice )
-            chunksResults[ threadIdx.x ] = reduction( chunksResults[ threadIdx.x ], fetch( j, compute ) );
+      for( IndexType j = begin; j < end && compute; j += chunksInSlice )
+         chunksResults[ threadIdx.x ] = reduction( chunksResults[ threadIdx.x ], fetch( j, compute ) );
    }
    __syncthreads();
 
-   if( threadIdx.x < sliceInfo.size )
-   {
+   if( threadIdx.x < sliceInfo.size ) {
       const IndexType row = sliceInfo.firstSegment + threadIdx.x;
       IndexType chunkIndex( 0 );
       if( threadIdx.x != 0 )
@@ -650,13 +523,13 @@ reduceSegmentsKernel( IndexType gridIdx,
       const IndexType lastChunk = this->rowToChunkMapping[ row ];
       RealType result( zero );
       while( chunkIndex < lastChunk )
-         result = reduction( result,  chunksResults[ chunkIndex++ ] );
+         result = reduction( result, chunksResults[ chunkIndex++ ] );
       if( row >= first && row < last )
          keeper( row, result );
    }
 }
 #endif
 
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/ElementsOrganization.h b/src/TNL/Algorithms/Segments/ElementsOrganization.h
index 3d6009f70d676b9fbdcc0b9f083d13428e36ce53..0966aa66bcaf952a351185b2e12722593eee2cfb 100644
--- a/src/TNL/Algorithms/Segments/ElementsOrganization.h
+++ b/src/TNL/Algorithms/Segments/ElementsOrganization.h
@@ -9,15 +9,21 @@
 #include <TNL/Devices/Host.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
-enum ElementsOrganization { ColumnMajorOrder = 0, RowMajorOrder };
+enum ElementsOrganization
+{
+   ColumnMajorOrder = 0,
+   RowMajorOrder
+};
 
 template< typename Device >
 struct DefaultElementsOrganization
 {
-   static constexpr ElementsOrganization getOrganization() {
+   static constexpr ElementsOrganization
+   getOrganization()
+   {
       if( std::is_same< Device, Devices::Host >::value )
          return RowMajorOrder;
       else
@@ -25,15 +31,15 @@ struct DefaultElementsOrganization
    };
 };
 
-} // namespace Segments
-} // namespace Algorithms
+}  // namespace Segments
+}  // namespace Algorithms
 
-inline String getSerializationType( Algorithms::Segments::ElementsOrganization Organization )
+inline std::string
+getSerializationType( Algorithms::Segments::ElementsOrganization Organization )
 {
    if( Organization == Algorithms::Segments::RowMajorOrder )
-      return String( "RowMajorOrder" );
-   else
-      return String( "ColumnMajorOrder" );
+      return "RowMajorOrder";
+   return "ColumnMajorOrder";
 }
 
-} // namespace TNL
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/Ellpack.h b/src/TNL/Algorithms/Segments/Ellpack.h
index 2a838abd202be68098eefbbb0ce9ba16d0b587ce..d52eee693999ee85756e3341e568b0d7e4723cd3 100644
--- a/src/TNL/Algorithms/Segments/Ellpack.h
+++ b/src/TNL/Algorithms/Segments/Ellpack.h
@@ -11,8 +11,8 @@
 #include <TNL/Algorithms/Segments/SegmentView.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
 template< typename Device,
           typename Index,
@@ -21,128 +21,169 @@ template< typename Device,
           int Alignment = 32 >
 class Ellpack
 {
-   public:
+public:
+   using DeviceType = Device;
+   using IndexType = std::remove_const_t< Index >;
+   static constexpr int
+   getAlignment()
+   {
+      return Alignment;
+   }
+   static constexpr ElementsOrganization
+   getOrganization()
+   {
+      return Organization;
+   }
+   using OffsetsContainer = Containers::Vector< IndexType, DeviceType, IndexType >;
+   using SegmentsSizes = OffsetsContainer;
+   template< typename Device_, typename Index_ >
+   using ViewTemplate = EllpackView< Device_, Index_, Organization, Alignment >;
+   using ViewType = EllpackView< Device, Index, Organization, Alignment >;
+   using ConstViewType = typename ViewType::ConstViewType;
+   using SegmentViewType = SegmentView< IndexType, Organization >;
+
+   static constexpr bool
+   havePadding()
+   {
+      return true;
+   };
+
+   Ellpack() = default;
+
+   template< typename SizesContainer >
+   Ellpack( const SizesContainer& sizes );
+
+   template< typename ListIndex >
+   Ellpack( const std::initializer_list< ListIndex >& segmentsSizes );
+
+   Ellpack( IndexType segmentsCount, IndexType segmentSize );
+
+   Ellpack( const Ellpack& segments ) = default;
+
+   Ellpack( Ellpack&& segments ) noexcept = default;
+
+   static std::string
+   getSerializationType();
+
+   static String
+   getSegmentsType();
+
+   ViewType
+   getView();
+
+   const ConstViewType
+   getConstView() const;
+
+   /**
+    * \brief Set sizes of particular segments.
+    */
+   template< typename SizesHolder = OffsetsContainer >
+   void
+   setSegmentsSizes( const SizesHolder& sizes );
+
+   void
+   setSegmentsSizes( IndexType segmentsCount, IndexType segmentSize );
+
+   void
+   reset();
+
+   /**
+    * \brief Number segments.
+    */
+   __cuda_callable__
+   IndexType
+   getSegmentsCount() const;
+
+   __cuda_callable__
+   IndexType
+   getSegmentSize( IndexType segmentIdx ) const;
+
+   __cuda_callable__
+   IndexType
+   getSize() const;
+
+   __cuda_callable__
+   IndexType
+   getStorageSize() const;
+
+   __cuda_callable__
+   IndexType
+   getGlobalIndex( Index segmentIdx, Index localIdx ) const;
+
+   __cuda_callable__
+   SegmentViewType
+   getSegmentView( IndexType segmentIdx ) const;
+
+   /***
+    * \brief Go over all segments and for each segment element call
+    * function 'f' with arguments 'args'. The return type of 'f' is bool.
+    * When its true, the for-loop continues. Once 'f' returns false, the for-loop
+    * is terminated.
+    */
+   template< typename Function >
+   void
+   forElements( IndexType first, IndexType last, Function&& f ) const;
+
+   template< typename Function >
+   void
+   forAllElements( Function&& f ) const;
+
+   template< typename Function >
+   void
+   forSegments( IndexType begin, IndexType end, Function&& f ) const;
+
+   template< typename Function >
+   void
+   forAllSegments( Function&& f ) const;
+
+   /***
+    * \brief Go over all segments and perform a reduction in each of them.
+    */
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+   void
+   reduceSegments( IndexType first,
+                   IndexType last,
+                   Fetch& fetch,
+                   const Reduction& reduction,
+                   ResultKeeper& keeper,
+                   const Real& zero ) const;
 
-      using DeviceType = Device;
-      using IndexType = std::remove_const_t< Index >;
-      static constexpr int getAlignment() { return Alignment; }
-      static constexpr ElementsOrganization getOrganization() { return Organization; }
-      using OffsetsContainer = Containers::Vector< IndexType, DeviceType, IndexType >;
-      using SegmentsSizes = OffsetsContainer;
-      template< typename Device_, typename Index_ >
-      using ViewTemplate = EllpackView< Device_, Index_, Organization, Alignment >;
-      using ViewType = EllpackView< Device, Index, Organization, Alignment >;
-      using ConstViewType = typename ViewType::ConstViewType;
-      using SegmentViewType = SegmentView< IndexType, Organization >;
-
-      static constexpr bool havePadding() { return true; };
-
-      Ellpack();
-
-      template< typename SizesContainer >
-      Ellpack( const SizesContainer& sizes );
-
-      template< typename ListIndex >
-      Ellpack( const std::initializer_list< ListIndex >& segmentsSizes );
-
-      Ellpack( const IndexType segmentsCount, const IndexType segmentSize );
-
-      Ellpack( const Ellpack& segments ) = default;
-
-      Ellpack( Ellpack&& segments ) = default;
-
-      static String getSerializationType();
-
-      static String getSegmentsType();
-
-      ViewType getView();
-
-      const ConstViewType getConstView() const;
-
-      /**
-       * \brief Set sizes of particular segments.
-       */
-      template< typename SizesHolder = OffsetsContainer >
-      void setSegmentsSizes( const SizesHolder& sizes );
-
-      void setSegmentsSizes( const IndexType segmentsCount, const IndexType segmentSize );
-
-      void reset();
-
-      /**
-       * \brief Number segments.
-       */
-      __cuda_callable__
-      IndexType getSegmentsCount() const;
-
-      __cuda_callable__
-      IndexType getSegmentSize( const IndexType segmentIdx ) const;
-
-      __cuda_callable__
-      IndexType getSize() const;
-
-      __cuda_callable__
-      IndexType getStorageSize() const;
-
-      __cuda_callable__
-      IndexType getGlobalIndex( const Index segmentIdx, const Index localIdx ) const;
-
-      __cuda_callable__
-      SegmentViewType getSegmentView( const IndexType segmentIdx ) const;
-
-      /***
-       * \brief Go over all segments and for each segment element call
-       * function 'f' with arguments 'args'. The return type of 'f' is bool.
-       * When its true, the for-loop continues. Once 'f' returns false, the for-loop
-       * is terminated.
-       */
-      template< typename Function >
-      void forElements( IndexType first, IndexType last, Function&& f ) const;
-
-      template< typename Function >
-      void forAllElements( Function&& f ) const;
-
-      template< typename Function >
-      void forSegments( IndexType begin, IndexType end, Function&& f ) const;
-
-      template< typename Function >
-      void forAllSegments( Function&& f ) const;
-
-      /***
-       * \brief Go over all segments and perform a reduction in each of them.
-       */
-      template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
-      void reduceSegments( IndexType first, IndexType last, Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
-
-      template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
-      void reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
-
-      Ellpack& operator=( const Ellpack& source ) = default;
-
-      template< typename Device_, typename Index_, typename IndexAllocator_, ElementsOrganization Organization_, int Alignment_ >
-      Ellpack& operator=( const Ellpack< Device_, Index_, IndexAllocator_, Organization_, Alignment_ >& source );
-
-      void save( File& file ) const;
-
-      void load( File& file );
-
-      template< typename Fetch >
-      SegmentsPrinter< Ellpack, Fetch > print( Fetch&& fetch ) const;
-
-   protected:
-
-      IndexType segmentSize, size, alignedSize;
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+   void
+   reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
+
+   Ellpack&
+   operator=( const Ellpack& source ) = default;
+
+   template< typename Device_, typename Index_, typename IndexAllocator_, ElementsOrganization Organization_, int Alignment_ >
+   Ellpack&
+   operator=( const Ellpack< Device_, Index_, IndexAllocator_, Organization_, Alignment_ >& source );
+
+   void
+   save( File& file ) const;
+
+   void
+   load( File& file );
+
+   template< typename Fetch >
+   SegmentsPrinter< Ellpack, Fetch >
+   print( Fetch&& fetch ) const;
+
+protected:
+   IndexType segmentSize = 0;
+   IndexType size = 0;
+   IndexType alignedSize = 0;
 };
 
-template <typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
-std::ostream& operator<<( std::ostream& str, const Ellpack< Device, Index, IndexAllocator, Organization, Alignment >& segments ) { return printSegments( segments, str ); }
-
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
+std::ostream&
+operator<<( std::ostream& str, const Ellpack< Device, Index, IndexAllocator, Organization, Alignment >& segments )
+{
+   return printSegments( segments, str );
+}
+
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
 
 #include <TNL/Algorithms/Segments/Ellpack.hpp>
diff --git a/src/TNL/Algorithms/Segments/Ellpack.hpp b/src/TNL/Algorithms/Segments/Ellpack.hpp
index d4b3175b65650afbc771496944d81cd97dd2ed3b..cd0b60f92b1a141e067986c29f378be8ca7b0d5a 100644
--- a/src/TNL/Algorithms/Segments/Ellpack.hpp
+++ b/src/TNL/Algorithms/Segments/Ellpack.hpp
@@ -11,117 +11,65 @@
 #include <TNL/Algorithms/Segments/Ellpack.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
-
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
-Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-Ellpack()
-   : segmentSize( 0 ), size( 0 ), alignedSize( 0 )
-{
-}
-
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
-   template< typename SizesContainer >
-Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-Ellpack( const SizesContainer& segmentsSizes )
-   : segmentSize( 0 ), size( 0 ), alignedSize( 0 )
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
+template< typename SizesContainer >
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::Ellpack( const SizesContainer& segmentsSizes )
 {
    this->setSegmentsSizes( segmentsSizes );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
-   template< typename ListIndex >
-Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-Ellpack( const std::initializer_list< ListIndex >& segmentsSizes )
-   : segmentSize( 0 ), size( 0 ), alignedSize( 0 )
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
+template< typename ListIndex >
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::Ellpack(
+   const std::initializer_list< ListIndex >& segmentsSizes )
 {
    this->setSegmentsSizes( Containers::Vector< IndexType, DeviceType, IndexType >( segmentsSizes ) );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
-Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-Ellpack( const IndexType segmentsCount, const IndexType segmentSize )
-   : segmentSize( 0 ), size( 0 ), alignedSize( 0 )
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::Ellpack( const IndexType segmentsCount,
+                                                                            const IndexType segmentSize )
 {
    this->setSegmentsSizes( segmentsCount, segmentSize );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
-String
-Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-getSerializationType()
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
+std::string
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::getSerializationType()
 {
-   // FIXME: the serialized data DEPEND on the Organization and Alignment parameters, so it should be reflected in the serialization type
+   // FIXME: the serialized data DEPEND on the Organization and Alignment parameters, so it should be reflected in the
+   // serialization type
    return "Ellpack< [any_device], " + TNL::getSerializationType< IndexType >() + " >";
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
 String
-Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-getSegmentsType()
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::getSegmentsType()
 {
    return ViewType::getSegmentsType();
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
 auto
-Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-getView() -> ViewType
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::getView() -> ViewType
 {
    return ViewType( size, segmentSize, alignedSize );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
 auto
-Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-getConstView() const -> const ConstViewType
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::getConstView() const -> const ConstViewType
 {
    return ConstViewType( size, segmentSize, alignedSize );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
-   template< typename SizesHolder >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
+template< typename SizesHolder >
 void
-Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-setSegmentsSizes( const SizesHolder& sizes )
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::setSegmentsSizes( const SizesHolder& sizes )
 {
    this->segmentSize = max( sizes );
    this->size = sizes.getSize();
@@ -131,28 +79,19 @@ setSegmentsSizes( const SizesHolder& sizes )
       this->alignedSize = roundUpDivision( size, this->getAlignment() ) * this->getAlignment();
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
 void
-Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-reset()
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::reset()
 {
    this->segmentSize = 0;
    this->size = 0;
    this->alignedSize = 0;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
 void
-Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-setSegmentsSizes( const IndexType segmentsCount, const IndexType segmentSize )
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::setSegmentsSizes( const IndexType segmentsCount,
+                                                                                     const IndexType segmentSize )
 {
    this->segmentSize = segmentSize;
    this->size = segmentsCount;
@@ -162,59 +101,44 @@ setSegmentsSizes( const IndexType segmentsCount, const IndexType segmentSize )
       this->alignedSize = roundUpDivision( size, this->getAlignment() ) * this->getAlignment();
 }
 
-
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
-__cuda_callable__ auto Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-getSegmentsCount() const -> IndexType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
+__cuda_callable__
+auto
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::getSegmentsCount() const -> IndexType
 {
    return this->size;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
-__cuda_callable__ auto Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-getSegmentSize( const IndexType segmentIdx ) const -> IndexType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
+__cuda_callable__
+auto
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::getSegmentSize( const IndexType segmentIdx ) const
+   -> IndexType
 {
    return this->segmentSize;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
-__cuda_callable__ auto Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-getSize() const  -> IndexType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
+__cuda_callable__
+auto
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::getSize() const -> IndexType
 {
    return this->size * this->segmentSize;
 }
 
-
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
-__cuda_callable__ auto Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-getStorageSize() const -> IndexType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
+__cuda_callable__
+auto
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::getStorageSize() const -> IndexType
 {
    return this->alignedSize * this->segmentSize;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
-__cuda_callable__ auto Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-getGlobalIndex( const Index segmentIdx, const Index localIdx ) const -> IndexType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
+__cuda_callable__
+auto
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::getGlobalIndex( const Index segmentIdx,
+                                                                                   const Index localIdx ) const -> IndexType
 {
    if( Organization == RowMajorOrder )
       return segmentIdx * this->segmentSize + localIdx;
@@ -222,13 +146,11 @@ getGlobalIndex( const Index segmentIdx, const Index localIdx ) const -> IndexTyp
       return segmentIdx + this->alignedSize * localIdx;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
-__cuda_callable__ auto Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
+__cuda_callable__
+auto
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::getSegmentView( const IndexType segmentIdx ) const
+   -> SegmentViewType
 {
    if( Organization == RowMajorOrder )
       return SegmentViewType( segmentIdx, segmentIdx * this->segmentSize, this->segmentSize, 1 );
@@ -236,93 +158,71 @@ getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType
       return SegmentViewType( segmentIdx, segmentIdx, this->segmentSize, this->alignedSize );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
-   template< typename Function >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
+template< typename Function >
 void
-Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-forElements( IndexType first, IndexType last, Function&& f ) const
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::forElements( IndexType first,
+                                                                                IndexType last,
+                                                                                Function&& f ) const
 {
    this->getConstView().forElements( first, last, f );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
-   template< typename Function >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
+template< typename Function >
 void
-Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-forAllElements( Function&& f ) const
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::forAllElements( Function&& f ) const
 {
    this->forElements( 0, this->getSegmentsCount(), f );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
-   template< typename Function >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
+template< typename Function >
 void
-Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-forSegments( IndexType begin, IndexType end, Function&& f ) const
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::forSegments( IndexType begin,
+                                                                                IndexType end,
+                                                                                Function&& f ) const
 {
    this->getConstView().forSegments( begin, end, f );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
-   template< typename Function >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
+template< typename Function >
 void
-Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-forAllSegments( Function&& f ) const
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::forAllSegments( Function&& f ) const
 {
    this->getConstView().forAllSegments( f );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
-   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
 void
-Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-reduceSegments( IndexType first, IndexType last, Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::reduceSegments( IndexType first,
+                                                                                   IndexType last,
+                                                                                   Fetch& fetch,
+                                                                                   const Reduction& reduction,
+                                                                                   ResultKeeper& keeper,
+                                                                                   const Real& zero ) const
 {
    this->getConstView().reduceSegments( first, last, fetch, reduction, keeper, zero );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
-   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
 void
-Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::reduceAllSegments( Fetch& fetch,
+                                                                                      const Reduction& reduction,
+                                                                                      ResultKeeper& keeper,
+                                                                                      const Real& zero ) const
 {
    this->reduceSegments( 0, this->getSegmentsCount(), fetch, reduction, keeper, zero );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
-   template< typename Device_, typename Index_, typename IndexAllocator_, ElementsOrganization Organization_, int Alignment_ >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
+template< typename Device_, typename Index_, typename IndexAllocator_, ElementsOrganization Organization_, int Alignment_ >
 Ellpack< Device, Index, IndexAllocator, Organization, Alignment >&
-Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-operator=( const Ellpack< Device_, Index_, IndexAllocator_, Organization_, Alignment_ >& source )
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::operator=(
+   const Ellpack< Device_, Index_, IndexAllocator_, Organization_, Alignment_ >& source )
 {
    this->segmentSize = source.segmentSize;
    this->size = source.size;
@@ -330,47 +230,33 @@ operator=( const Ellpack< Device_, Index_, IndexAllocator_, Organization_, Align
    return *this;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
 void
-Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-save( File& file ) const
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::save( File& file ) const
 {
    file.save( &segmentSize );
    file.save( &size );
    file.save( &alignedSize );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
 void
-Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-load( File& file )
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::load( File& file )
 {
    file.load( &segmentSize );
    file.load( &size );
    file.load( &alignedSize );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int Alignment >
-      template< typename Fetch >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int Alignment >
+template< typename Fetch >
 auto
-Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::
-print( Fetch&& fetch ) const -> SegmentsPrinter< Ellpack, Fetch >
+Ellpack< Device, Index, IndexAllocator, Organization, Alignment >::print( Fetch&& fetch ) const
+   -> SegmentsPrinter< Ellpack, Fetch >
 {
    return SegmentsPrinter< Ellpack, Fetch >( *this, fetch );
 }
 
-      } // namespace Segments
-   }  // namespace Containers
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/EllpackView.h b/src/TNL/Algorithms/Segments/EllpackView.h
index 8b6dc0ca9eb0199591dca6885509b34c05e1a47d..8c015bebcad927e45101d98c7e2e2d521fae1d52 100644
--- a/src/TNL/Algorithms/Segments/EllpackView.h
+++ b/src/TNL/Algorithms/Segments/EllpackView.h
@@ -13,12 +13,19 @@
 #include <TNL/Algorithms/Segments/ElementsOrganization.h>
 #include <TNL/Algorithms/Segments/SegmentsPrinting.h>
 
-
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
-enum EllpackKernelType { Scalar, Vector, Vector2, Vector4, Vector8, Vector16 };
+enum EllpackKernelType
+{
+   Scalar,
+   Vector,
+   Vector2,
+   Vector4,
+   Vector8,
+   Vector16
+};
 
 template< typename Device,
           typename Index,
@@ -26,117 +33,155 @@ template< typename Device,
           int Alignment = 32 >
 class EllpackView
 {
-   public:
-
-      using DeviceType = Device;
-      using IndexType = std::remove_const_t< Index >;
-      static constexpr int getAlignment() { return Alignment; }
-      static constexpr ElementsOrganization getOrganization() { return Organization; }
-      using OffsetsContainer = Containers::Vector< IndexType, DeviceType, IndexType >;
-      using SegmentsSizes = OffsetsContainer;
-      template< typename Device_, typename Index_ >
-      using ViewTemplate = EllpackView< Device_, Index_, Organization, Alignment >;
-      using ViewType = EllpackView;
-      using ConstViewType = ViewType;
-      using SegmentViewType = SegmentView< IndexType, Organization >;
-
-      static constexpr bool havePadding() { return true; };
-
-      __cuda_callable__
-      EllpackView();
-
-      __cuda_callable__
-      EllpackView( IndexType segmentsCount, IndexType segmentSize, IndexType alignedSize );
-
-      __cuda_callable__
-      EllpackView( IndexType segmentsCount, IndexType segmentSize );
-
-      __cuda_callable__
-      EllpackView( const EllpackView& ellpackView ) = default;
-
-      __cuda_callable__
-      EllpackView( EllpackView&& ellpackView ) = default;
-
-      static String getSerializationType();
-
-      static String getSegmentsType();
-
-      __cuda_callable__
-      ViewType getView();
-
-      __cuda_callable__
-      const ConstViewType getConstView() const;
-
-      /**
-       * \brief Number segments.
-       */
-      __cuda_callable__
-      IndexType getSegmentsCount() const;
-
-      __cuda_callable__
-      IndexType getSegmentSize( const IndexType segmentIdx ) const;
-
-      __cuda_callable__
-      IndexType getSize() const;
-
-      __cuda_callable__
-      IndexType getStorageSize() const;
-
-      __cuda_callable__
-      IndexType getGlobalIndex( const Index segmentIdx, const Index localIdx ) const;
-
-      __cuda_callable__
-      SegmentViewType getSegmentView( const IndexType segmentIdx ) const;
-
-      /***
-       * \brief Go over all segments and for each segment element call
-       * function 'f' with arguments 'args'. The return type of 'f' is bool.
-       * When its true, the for-loop continues. Once 'f' returns false, the for-loop
-       * is terminated.
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function&& f ) const;
-
-      template< typename Function >
-      void forAllElements( Function&& f ) const;
-
-      template< typename Function >
-      void forSegments( IndexType begin, IndexType end, Function&& f ) const;
-
-      template< typename Function >
-      void forAllSegments( Function&& f ) const;
-
-      /***
-       * \brief Go over all segments and perform a reduction in each of them.
-       */
-      template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
-      void reduceSegments( IndexType first, IndexType last, Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
-
-      template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
-      void reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
-
-      EllpackView& operator=( const EllpackView& view );
-
-      void save( File& file ) const;
-
-      void load( File& file );
-
-      template< typename Fetch >
-      SegmentsPrinter< EllpackView, Fetch > print( Fetch&& fetch ) const;
-
-   protected:
-
-      IndexType segmentSize, segmentsCount, alignedSize;
+public:
+   using DeviceType = Device;
+   using IndexType = std::remove_const_t< Index >;
+   static constexpr int
+   getAlignment()
+   {
+      return Alignment;
+   }
+   static constexpr ElementsOrganization
+   getOrganization()
+   {
+      return Organization;
+   }
+   using OffsetsContainer = Containers::Vector< IndexType, DeviceType, IndexType >;
+   using SegmentsSizes = OffsetsContainer;
+   template< typename Device_, typename Index_ >
+   using ViewTemplate = EllpackView< Device_, Index_, Organization, Alignment >;
+   using ViewType = EllpackView;
+   using ConstViewType = ViewType;
+   using SegmentViewType = SegmentView< IndexType, Organization >;
+
+   static constexpr bool
+   havePadding()
+   {
+      return true;
+   };
+
+   __cuda_callable__
+   EllpackView() = default;
+
+   __cuda_callable__
+   EllpackView( IndexType segmentsCount, IndexType segmentSize, IndexType alignedSize );
+
+   __cuda_callable__
+   EllpackView( IndexType segmentsCount, IndexType segmentSize );
+
+   __cuda_callable__
+   EllpackView( const EllpackView& ellpackView ) = default;
+
+   __cuda_callable__
+   EllpackView( EllpackView&& ellpackView ) noexcept = default;
+
+   static std::string
+   getSerializationType();
+
+   static String
+   getSegmentsType();
+
+   __cuda_callable__
+   ViewType
+   getView();
+
+   __cuda_callable__
+   const ConstViewType
+   getConstView() const;
+
+   /**
+    * \brief Number segments.
+    */
+   __cuda_callable__
+   IndexType
+   getSegmentsCount() const;
+
+   __cuda_callable__
+   IndexType
+   getSegmentSize( IndexType segmentIdx ) const;
+
+   __cuda_callable__
+   IndexType
+   getSize() const;
+
+   __cuda_callable__
+   IndexType
+   getStorageSize() const;
+
+   __cuda_callable__
+   IndexType
+   getGlobalIndex( Index segmentIdx, Index localIdx ) const;
+
+   __cuda_callable__
+   SegmentViewType
+   getSegmentView( IndexType segmentIdx ) const;
+
+   /***
+    * \brief Go over all segments and for each segment element call
+    * function 'f' with arguments 'args'. The return type of 'f' is bool.
+    * When its true, the for-loop continues. Once 'f' returns false, the for-loop
+    * is terminated.
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function&& f ) const;
+
+   template< typename Function >
+   void
+   forAllElements( Function&& f ) const;
+
+   template< typename Function >
+   void
+   forSegments( IndexType begin, IndexType end, Function&& f ) const;
+
+   template< typename Function >
+   void
+   forAllSegments( Function&& f ) const;
+
+   /***
+    * \brief Go over all segments and perform a reduction in each of them.
+    */
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+   void
+   reduceSegments( IndexType first,
+                   IndexType last,
+                   Fetch& fetch,
+                   const Reduction& reduction,
+                   ResultKeeper& keeper,
+                   const Real& zero ) const;
+
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+   void
+   reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
+
+   EllpackView&
+   operator=( const EllpackView& view );
+
+   void
+   save( File& file ) const;
+
+   void
+   load( File& file );
+
+   template< typename Fetch >
+   SegmentsPrinter< EllpackView, Fetch >
+   print( Fetch&& fetch ) const;
+
+protected:
+   IndexType segmentSize = 0;
+   IndexType segmentsCount = 0;
+   IndexType alignedSize = 0;
 };
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
-std::ostream& operator<<( std::ostream& str, const EllpackView< Device, Index, Organization, Alignment >& ellpack ) { return printSegments( str, ellpack ); }
+template< typename Device, typename Index, ElementsOrganization Organization, int Alignment >
+std::ostream&
+operator<<( std::ostream& str, const EllpackView< Device, Index, Organization, Alignment >& ellpack )
+{
+   return printSegments( str, ellpack );
+}
 
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
 
 #include <TNL/Algorithms/Segments/EllpackView.hpp>
diff --git a/src/TNL/Algorithms/Segments/EllpackView.hpp b/src/TNL/Algorithms/Segments/EllpackView.hpp
index 8f1b56e5bd8b3ad8288789619e37c863b01a5b04..80f55778c9c298dec3fb839476d187777b4a95d8 100644
--- a/src/TNL/Algorithms/Segments/EllpackView.hpp
+++ b/src/TNL/Algorithms/Segments/EllpackView.hpp
@@ -12,80 +12,87 @@
 #include <TNL/Algorithms/Segments/detail/LambdaAdapter.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
 #ifdef HAVE_CUDA
-template< typename Index,
-          typename Fetch,
-          typename Reduction,
-          typename ResultKeeper,
-          typename Real >
-__global__ void
-EllpackCudaReductionKernelFull( Index first, Index last, Fetch fetch, const Reduction reduction, ResultKeeper keep, const Real zero, Index segmentSize )
+template< typename Index, typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+__global__
+void
+EllpackCudaReductionKernelFull( Index first,
+                                Index last,
+                                Fetch fetch,
+                                const Reduction reduction,
+                                ResultKeeper keep,
+                                const Real zero,
+                                Index segmentSize )
 {
    const int warpSize = 32;
    const int gridID = 0;
-   const Index segmentIdx = first + ((gridID * TNL::Cuda::getMaxGridXSize() ) + (blockIdx.x * blockDim.x) + threadIdx.x) / warpSize;
-   if (segmentIdx >= last)
+   const Index segmentIdx =
+      first + ( ( gridID * TNL::Cuda::getMaxGridXSize() ) + ( blockIdx.x * blockDim.x ) + threadIdx.x ) / warpSize;
+   if( segmentIdx >= last )
       return;
 
    Real result = zero;
-   const Index laneID = threadIdx.x & 31; // & is cheaper than %
+   const Index laneID = threadIdx.x & 31;  // & is cheaper than %
    const Index begin = segmentIdx * segmentSize;
    const Index end = begin + segmentSize;
 
    /* Calculate result */
    Index localIdx( 0 );
    bool compute( true );
-   for( Index i = begin + laneID; i < end; i += warpSize)
+   for( Index i = begin + laneID; i < end; i += warpSize )
       result = reduction( result, fetch( segmentIdx, localIdx++, i, compute ) );
 
    /* Reduction */
-   result = reduction( result, __shfl_down_sync(0xFFFFFFFF, result, 16 ) );
-   result = reduction( result, __shfl_down_sync(0xFFFFFFFF, result,  8 ) );
-   result = reduction( result, __shfl_down_sync(0xFFFFFFFF, result,  4 ) );
-   result = reduction( result, __shfl_down_sync(0xFFFFFFFF, result,  2 ) );
-   result = reduction( result, __shfl_down_sync(0xFFFFFFFF, result,  1 ) );
+   result = reduction( result, __shfl_down_sync( 0xFFFFFFFF, result, 16 ) );
+   result = reduction( result, __shfl_down_sync( 0xFFFFFFFF, result, 8 ) );
+   result = reduction( result, __shfl_down_sync( 0xFFFFFFFF, result, 4 ) );
+   result = reduction( result, __shfl_down_sync( 0xFFFFFFFF, result, 2 ) );
+   result = reduction( result, __shfl_down_sync( 0xFFFFFFFF, result, 1 ) );
    /* Write result */
    if( laneID == 0 )
       keep( segmentIdx, result );
 }
 
-template< typename Index,
-          typename Fetch,
-          typename Reduction,
-          typename ResultKeeper,
-          typename Real >
-__global__ void
-EllpackCudaReductionKernelCompact( Index first, Index last, Fetch fetch, const Reduction reduction, ResultKeeper keep, const Real zero, Index segmentSize )
+template< typename Index, typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+__global__
+void
+EllpackCudaReductionKernelCompact( Index first,
+                                   Index last,
+                                   Fetch fetch,
+                                   const Reduction reduction,
+                                   ResultKeeper keep,
+                                   const Real zero,
+                                   Index segmentSize )
 {
    const int warpSize = 32;
    const int gridID = 0;
-   const Index segmentIdx = first + ((gridID * TNL::Cuda::getMaxGridXSize() ) + (blockIdx.x * blockDim.x) + threadIdx.x) / warpSize;
-   if (segmentIdx >= last)
+   const Index segmentIdx =
+      first + ( ( gridID * TNL::Cuda::getMaxGridXSize() ) + ( blockIdx.x * blockDim.x ) + threadIdx.x ) / warpSize;
+   if( segmentIdx >= last )
       return;
 
    Real result = zero;
-   const Index laneID = threadIdx.x & 31; // & is cheaper than %
+   const Index laneID = threadIdx.x & 31;  // & is cheaper than %
    const Index begin = segmentIdx * segmentSize;
    const Index end = begin + segmentSize;
 
    /* Calculate result */
    bool compute( true );
-   for( Index i = begin + laneID; i < end; i += warpSize)
+   for( Index i = begin + laneID; i < end; i += warpSize )
       result = reduction( result, fetch( i, compute ) );
 
    /* Reduction */
-   result = reduction( result, __shfl_down_sync(0xFFFFFFFF, result, 16 ) );
-   result = reduction( result, __shfl_down_sync(0xFFFFFFFF, result,  8 ) );
-   result = reduction( result, __shfl_down_sync(0xFFFFFFFF, result,  4 ) );
-   result = reduction( result, __shfl_down_sync(0xFFFFFFFF, result,  2 ) );
-   result = reduction( result, __shfl_down_sync(0xFFFFFFFF, result,  1 ) );
+   result = reduction( result, __shfl_down_sync( 0xFFFFFFFF, result, 16 ) );
+   result = reduction( result, __shfl_down_sync( 0xFFFFFFFF, result, 8 ) );
+   result = reduction( result, __shfl_down_sync( 0xFFFFFFFF, result, 4 ) );
+   result = reduction( result, __shfl_down_sync( 0xFFFFFFFF, result, 2 ) );
+   result = reduction( result, __shfl_down_sync( 0xFFFFFFFF, result, 1 ) );
    /* Write result */
    if( laneID == 0 )
       keep( segmentIdx, result );
-
 }
 #endif
 
@@ -98,9 +105,15 @@ template< typename Index,
 struct EllpackCudaReductionDispatcher
 {
    static void
-   exec( Index first, Index last, Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero, Index segmentSize )
+   exec( Index first,
+         Index last,
+         Fetch& fetch,
+         const Reduction& reduction,
+         ResultKeeper& keeper,
+         const Real& zero,
+         Index segmentSize )
    {
-   #ifdef HAVE_CUDA
+#ifdef HAVE_CUDA
       if( last <= first )
          return;
       const Index segmentsCount = last - first;
@@ -108,24 +121,27 @@ struct EllpackCudaReductionDispatcher
       const Index blocksCount = Cuda::getNumberOfBlocks( threadsCount, 256 );
       dim3 blockSize( 256 );
       dim3 gridSize( blocksCount );
-      EllpackCudaReductionKernelFull<<< gridSize, blockSize >>>( first, last, fetch, reduction, keeper, zero, segmentSize );
-      cudaStreamSynchronize(0);
+      EllpackCudaReductionKernelFull<<< gridSize,
+         blockSize >>>( first, last, fetch, reduction, keeper, zero, segmentSize );
+      cudaStreamSynchronize( 0 );
       TNL_CHECK_CUDA_DEVICE;
-   #endif
+#endif
    }
 };
 
-template< typename Index,
-          typename Fetch,
-          typename Reduction,
-          typename ResultKeeper,
-          typename Real >
+template< typename Index, typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
 struct EllpackCudaReductionDispatcher< Index, Fetch, Reduction, ResultKeeper, Real, false >
 {
    static void
-   exec( Index first, Index last, Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero, Index segmentSize )
+   exec( Index first,
+         Index last,
+         Fetch& fetch,
+         const Reduction& reduction,
+         ResultKeeper& keeper,
+         const Real& zero,
+         Index segmentSize )
    {
-   #ifdef HAVE_CUDA
+#ifdef HAVE_CUDA
       if( last <= first )
          return;
       const Index segmentsCount = last - first;
@@ -133,43 +149,26 @@ struct EllpackCudaReductionDispatcher< Index, Fetch, Reduction, ResultKeeper, Re
       const Index blocksCount = Cuda::getNumberOfBlocks( threadsCount, 256 );
       dim3 blockSize( 256 );
       dim3 gridSize( blocksCount );
-      EllpackCudaReductionKernelCompact<<< gridSize, blockSize >>>( first, last, fetch, reduction, keeper, zero, segmentSize );
-      cudaStreamSynchronize(0);
+      EllpackCudaReductionKernelCompact<<< gridSize,
+         blockSize >>>( first, last, fetch, reduction, keeper, zero, segmentSize );
+      cudaStreamSynchronize( 0 );
       TNL_CHECK_CUDA_DEVICE;
-   #endif
+#endif
    }
 };
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
-__cuda_callable__
-EllpackView< Device, Index, Organization, Alignment >::
-EllpackView()
-   : segmentSize( 0 ), segmentsCount( 0 ), alignedSize( 0 )
-{
-}
-
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
+template< typename Device, typename Index, ElementsOrganization Organization, int Alignment >
 __cuda_callable__
-EllpackView< Device, Index, Organization, Alignment >::
-EllpackView( IndexType segmentsCount, IndexType segmentSize, IndexType alignedSize )
-   : segmentSize( segmentSize ), segmentsCount( segmentsCount ), alignedSize( alignedSize )
-{
-}
+EllpackView< Device, Index, Organization, Alignment >::EllpackView( IndexType segmentsCount,
+                                                                    IndexType segmentSize,
+                                                                    IndexType alignedSize )
+: segmentSize( segmentSize ), segmentsCount( segmentsCount ), alignedSize( alignedSize )
+{}
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
+template< typename Device, typename Index, ElementsOrganization Organization, int Alignment >
 __cuda_callable__
-EllpackView< Device, Index, Organization, Alignment >::
-EllpackView( IndexType segmentsCount, IndexType segmentSize )
-   : segmentSize( segmentSize ), segmentsCount( segmentsCount )
+EllpackView< Device, Index, Organization, Alignment >::EllpackView( IndexType segmentsCount, IndexType segmentSize )
+: segmentSize( segmentSize ), segmentsCount( segmentsCount )
 {
    if( Organization == RowMajorOrder )
       this->alignedSize = this->segmentsCount;
@@ -177,100 +176,75 @@ EllpackView( IndexType segmentsCount, IndexType segmentSize )
       this->alignedSize = roundUpDivision( segmentsCount, this->getAlignment() ) * this->getAlignment();
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
-String
-EllpackView< Device, Index, Organization, Alignment >::
-getSerializationType()
+template< typename Device, typename Index, ElementsOrganization Organization, int Alignment >
+std::string
+EllpackView< Device, Index, Organization, Alignment >::getSerializationType()
 {
-   // FIXME: the serialized data DEPEND on the Organization and Alignment parameters, so it should be reflected in the serialization type
+   // FIXME: the serialized data DEPEND on the Organization and Alignment parameters, so it should be reflected in the
+   // serialization type
    return "Ellpack< [any_device], " + TNL::getSerializationType< IndexType >() + " >";
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
+template< typename Device, typename Index, ElementsOrganization Organization, int Alignment >
 String
-EllpackView< Device, Index, Organization, Alignment >::
-getSegmentsType()
+EllpackView< Device, Index, Organization, Alignment >::getSegmentsType()
 {
    return "Ellpack";
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
+template< typename Device, typename Index, ElementsOrganization Organization, int Alignment >
 __cuda_callable__
 typename EllpackView< Device, Index, Organization, Alignment >::ViewType
-EllpackView< Device, Index, Organization, Alignment >::
-getView()
+EllpackView< Device, Index, Organization, Alignment >::getView()
 {
    return ViewType( segmentsCount, segmentSize, alignedSize );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
+template< typename Device, typename Index, ElementsOrganization Organization, int Alignment >
 __cuda_callable__
 auto
-EllpackView< Device, Index, Organization, Alignment >::
-getConstView() const -> const ConstViewType
+EllpackView< Device, Index, Organization, Alignment >::getConstView() const -> const ConstViewType
 {
    return ConstViewType( segmentsCount, segmentSize, alignedSize );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
-__cuda_callable__ auto EllpackView< Device, Index, Organization, Alignment >::
-getSegmentsCount() const -> IndexType
+template< typename Device, typename Index, ElementsOrganization Organization, int Alignment >
+__cuda_callable__
+auto
+EllpackView< Device, Index, Organization, Alignment >::getSegmentsCount() const -> IndexType
 {
    return this->segmentsCount;
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
-__cuda_callable__ auto EllpackView< Device, Index, Organization, Alignment >::
-getSegmentSize( const IndexType segmentIdx ) const -> IndexType
+template< typename Device, typename Index, ElementsOrganization Organization, int Alignment >
+__cuda_callable__
+auto
+EllpackView< Device, Index, Organization, Alignment >::getSegmentSize( const IndexType segmentIdx ) const -> IndexType
 {
    return this->segmentSize;
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
-__cuda_callable__ auto EllpackView< Device, Index, Organization, Alignment >::
-getSize() const -> IndexType
+template< typename Device, typename Index, ElementsOrganization Organization, int Alignment >
+__cuda_callable__
+auto
+EllpackView< Device, Index, Organization, Alignment >::getSize() const -> IndexType
 {
    return this->segmentsCount * this->segmentSize;
 }
 
-
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
-__cuda_callable__ auto EllpackView< Device, Index, Organization, Alignment >::
-getStorageSize() const -> IndexType
+template< typename Device, typename Index, ElementsOrganization Organization, int Alignment >
+__cuda_callable__
+auto
+EllpackView< Device, Index, Organization, Alignment >::getStorageSize() const -> IndexType
 {
    return this->alignedSize * this->segmentSize;
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
-__cuda_callable__ auto EllpackView< Device, Index, Organization, Alignment >::
-getGlobalIndex( const Index segmentIdx, const Index localIdx ) const -> IndexType
+template< typename Device, typename Index, ElementsOrganization Organization, int Alignment >
+__cuda_callable__
+auto
+EllpackView< Device, Index, Organization, Alignment >::getGlobalIndex( const Index segmentIdx, const Index localIdx ) const
+   -> IndexType
 {
    if( Organization == RowMajorOrder )
       return segmentIdx * this->segmentSize + localIdx;
@@ -278,12 +252,10 @@ getGlobalIndex( const Index segmentIdx, const Index localIdx ) const -> IndexTyp
       return segmentIdx + this->alignedSize * localIdx;
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
-__cuda_callable__ auto EllpackView< Device, Index, Organization, Alignment >::
-getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType
+template< typename Device, typename Index, ElementsOrganization Organization, int Alignment >
+__cuda_callable__
+auto
+EllpackView< Device, Index, Organization, Alignment >::getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType
 {
    if( Organization == RowMajorOrder )
       return SegmentViewType( segmentIdx, segmentIdx * this->segmentSize, this->segmentSize, 1 );
@@ -291,31 +263,28 @@ getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType
       return SegmentViewType( segmentIdx, segmentIdx, this->segmentSize, this->alignedSize );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
-   template< typename Function >
-void EllpackView< Device, Index, Organization, Alignment >::
-forElements( IndexType first, IndexType last, Function&& f ) const
+template< typename Device, typename Index, ElementsOrganization Organization, int Alignment >
+template< typename Function >
+void
+EllpackView< Device, Index, Organization, Alignment >::forElements( IndexType first, IndexType last, Function&& f ) const
 {
-   if( Organization == RowMajorOrder )
-   {
+   if( Organization == RowMajorOrder ) {
       const IndexType segmentSize = this->segmentSize;
-      auto l = [=] __cuda_callable__ ( const IndexType segmentIdx ) mutable {
+      auto l = [ = ] __cuda_callable__( const IndexType segmentIdx ) mutable
+      {
          const IndexType begin = segmentIdx * segmentSize;
          const IndexType end = begin + segmentSize;
          IndexType localIdx( 0 );
-         for( IndexType globalIdx = begin; globalIdx < end; globalIdx++  )
+         for( IndexType globalIdx = begin; globalIdx < end; globalIdx++ )
             f( segmentIdx, localIdx++, globalIdx );
       };
       Algorithms::ParallelFor< Device >::exec( first, last, l );
    }
-   else
-   {
+   else {
       const IndexType storageSize = this->getStorageSize();
       const IndexType alignedSize = this->alignedSize;
-      auto l = [=] __cuda_callable__ ( const IndexType segmentIdx ) mutable {
+      auto l = [ = ] __cuda_callable__( const IndexType segmentIdx ) mutable
+      {
          const IndexType begin = segmentIdx;
          const IndexType end = storageSize;
          IndexType localIdx( 0 );
@@ -326,110 +295,103 @@ forElements( IndexType first, IndexType last, Function&& f ) const
    }
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
-   template< typename Function >
-void EllpackView< Device, Index, Organization, Alignment >::
-forAllElements( Function&& f ) const
+template< typename Device, typename Index, ElementsOrganization Organization, int Alignment >
+template< typename Function >
+void
+EllpackView< Device, Index, Organization, Alignment >::forAllElements( Function&& f ) const
 {
    this->forElements( 0, this->getSegmentsCount(), f );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
-   template< typename Function >
-void EllpackView< Device, Index, Organization, Alignment >::
-forSegments( IndexType begin, IndexType end, Function&& function ) const
+template< typename Device, typename Index, ElementsOrganization Organization, int Alignment >
+template< typename Function >
+void
+EllpackView< Device, Index, Organization, Alignment >::forSegments( IndexType begin, IndexType end, Function&& function ) const
 {
    auto view = this->getConstView();
-   auto f = [=] __cuda_callable__ ( IndexType segmentIdx ) mutable {
+   auto f = [ = ] __cuda_callable__( IndexType segmentIdx ) mutable
+   {
       auto segment = view.getSegmentView( segmentIdx );
       function( segment );
    };
    TNL::Algorithms::ParallelFor< DeviceType >::exec( begin, end, f );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
-   template< typename Function >
-void EllpackView< Device, Index, Organization, Alignment >::
-forAllSegments( Function&& f ) const
+template< typename Device, typename Index, ElementsOrganization Organization, int Alignment >
+template< typename Function >
+void
+EllpackView< Device, Index, Organization, Alignment >::forAllSegments( Function&& f ) const
 {
    this->forSegments( 0, this->getSegmentsCount(), f );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
-   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
-void EllpackView< Device, Index, Organization, Alignment >::
-reduceSegments( IndexType first, IndexType last, Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const
+template< typename Device, typename Index, ElementsOrganization Organization, int Alignment >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+void
+EllpackView< Device, Index, Organization, Alignment >::reduceSegments( IndexType first,
+                                                                       IndexType last,
+                                                                       Fetch& fetch,
+                                                                       const Reduction& reduction,
+                                                                       ResultKeeper& keeper,
+                                                                       const Real& zero ) const
 {
-   //using RealType = decltype( fetch( IndexType(), IndexType(), IndexType(), std::declval< bool& >() ) );
+   // using RealType = decltype( fetch( IndexType(), IndexType(), IndexType(), std::declval< bool& >() ) );
    using RealType = typename detail::FetchLambdaAdapter< Index, Fetch >::ReturnType;
-   if( Organization == RowMajorOrder )
-   {
+   if( Organization == RowMajorOrder ) {
       if( std::is_same< Device, Devices::Cuda >::value )
-         EllpackCudaReductionDispatcher< IndexType, Fetch, Reduction, ResultKeeper, Real>::exec( first, last, fetch, reduction, keeper, zero, segmentSize );
-      else
-      {
+         EllpackCudaReductionDispatcher< IndexType, Fetch, Reduction, ResultKeeper, Real >::exec(
+            first, last, fetch, reduction, keeper, zero, segmentSize );
+      else {
          const IndexType segmentSize = this->segmentSize;
-         auto l = [=] __cuda_callable__ ( const IndexType segmentIdx ) mutable {
+         auto l = [ = ] __cuda_callable__( const IndexType segmentIdx ) mutable
+         {
             const IndexType begin = segmentIdx * segmentSize;
             const IndexType end = begin + segmentSize;
             Real aux( zero );
             IndexType localIdx( 0 );
             bool compute( true );
-            for( IndexType j = begin; j < end && compute; j++  )
-               aux = reduction( aux, detail::FetchLambdaAdapter< IndexType, Fetch >::call( fetch, segmentIdx, localIdx++, j, compute ) );
+            for( IndexType j = begin; j < end && compute; j++ )
+               aux = reduction(
+                  aux, detail::FetchLambdaAdapter< IndexType, Fetch >::call( fetch, segmentIdx, localIdx++, j, compute ) );
             keeper( segmentIdx, aux );
          };
          Algorithms::ParallelFor< Device >::exec( first, last, l );
       }
    }
-   else
-   {
+   else {
       const IndexType storageSize = this->getStorageSize();
       const IndexType alignedSize = this->alignedSize;
-      auto l = [=] __cuda_callable__ ( const IndexType segmentIdx ) mutable {
+      auto l = [ = ] __cuda_callable__( const IndexType segmentIdx ) mutable
+      {
          const IndexType begin = segmentIdx;
          const IndexType end = storageSize;
          RealType aux( zero );
          IndexType localIdx( 0 );
          bool compute( true );
-         for( IndexType j = begin; j < end && compute; j += alignedSize  )
-            aux = reduction( aux, detail::FetchLambdaAdapter< IndexType, Fetch >::call( fetch, segmentIdx, localIdx++, j, compute ) );
+         for( IndexType j = begin; j < end && compute; j += alignedSize )
+            aux = reduction(
+               aux, detail::FetchLambdaAdapter< IndexType, Fetch >::call( fetch, segmentIdx, localIdx++, j, compute ) );
          keeper( segmentIdx, aux );
       };
       Algorithms::ParallelFor< Device >::exec( first, last, l );
    }
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
-   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
-void EllpackView< Device, Index, Organization, Alignment >::
-reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const
+template< typename Device, typename Index, ElementsOrganization Organization, int Alignment >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+void
+EllpackView< Device, Index, Organization, Alignment >::reduceAllSegments( Fetch& fetch,
+                                                                          const Reduction& reduction,
+                                                                          ResultKeeper& keeper,
+                                                                          const Real& zero ) const
 {
    this->reduceSegments( 0, this->getSegmentsCount(), fetch, reduction, keeper, zero );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
+template< typename Device, typename Index, ElementsOrganization Organization, int Alignment >
 EllpackView< Device, Index, Organization, Alignment >&
-EllpackView< Device, Index, Organization, Alignment >::
-operator=( const EllpackView< Device, Index, Organization, Alignment >& view )
+EllpackView< Device, Index, Organization, Alignment >::operator=(
+   const EllpackView< Device, Index, Organization, Alignment >& view )
 {
    this->segmentSize = view.segmentSize;
    this->segmentsCount = view.segmentsCount;
@@ -437,42 +399,32 @@ operator=( const EllpackView< Device, Index, Organization, Alignment >& view )
    return *this;
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
-void EllpackView< Device, Index, Organization, Alignment >::
-save( File& file ) const
+template< typename Device, typename Index, ElementsOrganization Organization, int Alignment >
+void
+EllpackView< Device, Index, Organization, Alignment >::save( File& file ) const
 {
    file.save( &segmentSize );
    file.save( &segmentsCount );
    file.save( &alignedSize );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
-void EllpackView< Device, Index, Organization, Alignment >::
-load( File& file )
+template< typename Device, typename Index, ElementsOrganization Organization, int Alignment >
+void
+EllpackView< Device, Index, Organization, Alignment >::load( File& file )
 {
    file.load( &segmentSize );
    file.load( &segmentsCount );
    file.load( &alignedSize );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int Alignment >
-      template< typename Fetch >
+template< typename Device, typename Index, ElementsOrganization Organization, int Alignment >
+template< typename Fetch >
 auto
-EllpackView< Device, Index, Organization, Alignment >::
-print( Fetch&& fetch ) const -> SegmentsPrinter< EllpackView, Fetch >
+EllpackView< Device, Index, Organization, Alignment >::print( Fetch&& fetch ) const -> SegmentsPrinter< EllpackView, Fetch >
 {
    return SegmentsPrinter< EllpackView, Fetch >( *this, fetch );
 }
 
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/Kernels/CSRAdaptiveKernel.h b/src/TNL/Algorithms/Segments/Kernels/CSRAdaptiveKernel.h
index e3683ce1e4622fb7d8f5bb14ff3772ac22161148..2a05964d9c4905a2be7273b77e277c00473ced62 100644
--- a/src/TNL/Algorithms/Segments/Kernels/CSRAdaptiveKernel.h
+++ b/src/TNL/Algorithms/Segments/Kernels/CSRAdaptiveKernel.h
@@ -16,8 +16,8 @@
 #include <TNL/Algorithms/Segments/Kernels/details/CSRAdaptiveKernelBlockDescriptor.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
 #ifdef HAVE_CUDA
 
@@ -34,22 +34,21 @@ template< int CudaBlockSize,
           typename ResultKeeper,
           typename Real,
           typename... Args >
-__global__ void
+__global__
+void
 reduceSegmentsCSRAdaptiveKernel( BlocksView blocks,
-                                    int gridIdx,
-                                    Offsets offsets,
-                                    Index first,
-                                    Index last,
-                                    Fetch fetch,
-                                    Reduction reduce,
-                                    ResultKeeper keep,
-                                    Real zero,
-                                    Args... args );
+                                 int gridIdx,
+                                 Offsets offsets,
+                                 Index first,
+                                 Index last,
+                                 Fetch fetch,
+                                 Reduction reduce,
+                                 ResultKeeper keep,
+                                 Real zero,
+                                 Args... args );
 #endif
 
-
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 struct CSRAdaptiveKernel
 {
    using IndexType = Index;
@@ -59,58 +58,64 @@ struct CSRAdaptiveKernel
    using BlocksType = typename ViewType::BlocksType;
    using BlocksView = typename BlocksType::ViewType;
 
-   static constexpr int MaxValueSizeLog() { return ViewType::MaxValueSizeLog; };
+   static constexpr int
+   MaxValueSizeLog()
+   {
+      return ViewType::MaxValueSizeLog;
+   };
 
-   static int getSizeValueLog( const int& i ) { return detail::CSRAdaptiveKernelParameters<>::getSizeValueLog( i ); };
+   static int
+   getSizeValueLog( const int& i )
+   {
+      return detail::CSRAdaptiveKernelParameters<>::getSizeValueLog( i );
+   };
 
-   static TNL::String getKernelType();
+   static TNL::String
+   getKernelType();
 
    template< typename Offsets >
-   void init( const Offsets& offsets );
-
-   void reset();
-
-   ViewType getView();
-
-   ConstViewType getConstView() const;
-
-   template< typename OffsetsView,
-              typename Fetch,
-              typename Reduction,
-              typename ResultKeeper,
-              typename Real,
-              typename... Args >
-   void reduceSegments( const OffsetsView& offsets,
-                        Index first,
-                        Index last,
-                        Fetch& fetch,
-                        const Reduction& reduction,
-                        ResultKeeper& keeper,
-                        const Real& zero,
-                        Args... args ) const;
-
-   protected:
-      template< int SizeOfValue, typename Offsets >
-      Index findLimit( const Index start,
-                     const Offsets& offsets,
-                     const Index size,
-                     detail::Type &type,
-                     size_t &sum );
-
-      template< int SizeOfValue,
-                typename Offsets >
-      void initValueSize( const Offsets& offsets );
-
-      /**
-       * \brief  blocksArray[ i ] stores blocks for sizeof( Value ) == 2^i.
-       */
-      BlocksType blocksArray[ MaxValueSizeLog() ];
-
-      ViewType view;
+   void
+   init( const Offsets& offsets );
+
+   void
+   reset();
+
+   ViewType
+   getView();
+
+   ConstViewType
+   getConstView() const;
+
+   template< typename OffsetsView, typename Fetch, typename Reduction, typename ResultKeeper, typename Real, typename... Args >
+   void
+   reduceSegments( const OffsetsView& offsets,
+                   Index first,
+                   Index last,
+                   Fetch& fetch,
+                   const Reduction& reduction,
+                   ResultKeeper& keeper,
+                   const Real& zero,
+                   Args... args ) const;
+
+protected:
+   template< int SizeOfValue, typename Offsets >
+   Index
+   findLimit( Index start, const Offsets& offsets, Index size, detail::Type& type, size_t& sum );
+
+   template< int SizeOfValue, typename Offsets >
+   void
+   initValueSize( const Offsets& offsets );
+
+   /**
+    * \brief  blocksArray[ i ] stores blocks for sizeof( Value ) == 2^i.
+    */
+   BlocksType blocksArray[ MaxValueSizeLog() ];
+
+   ViewType view;
 };
 
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
 
 #include <TNL/Algorithms/Segments/Kernels/CSRAdaptiveKernel.hpp>
diff --git a/src/TNL/Algorithms/Segments/Kernels/CSRAdaptiveKernel.hpp b/src/TNL/Algorithms/Segments/Kernels/CSRAdaptiveKernel.hpp
index 79d5f0530338645e1272661b59323e0c5ce9f694..9396f63ed322d0d386efd04ad311b677cbf9aea5 100644
--- a/src/TNL/Algorithms/Segments/Kernels/CSRAdaptiveKernel.hpp
+++ b/src/TNL/Algorithms/Segments/Kernels/CSRAdaptiveKernel.hpp
@@ -15,126 +15,100 @@
 #include <TNL/Algorithms/Segments/Kernels/details/CSRAdaptiveKernelBlockDescriptor.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 TNL::String
-CSRAdaptiveKernel< Index, Device >::
-getKernelType()
+CSRAdaptiveKernel< Index, Device >::getKernelType()
 {
    return ViewType::getKernelType();
 };
 
-template< typename Index,
-          typename Device >
-   template< typename Offsets >
+template< typename Index, typename Device >
+template< typename Offsets >
 void
-CSRAdaptiveKernel< Index, Device >::
-init( const Offsets& offsets )
+CSRAdaptiveKernel< Index, Device >::init( const Offsets& offsets )
 {
-   if( max( offsets ) == 0 )
-   {
-      for( int i = 0; i < MaxValueSizeLog(); i++ )
-      {
+   if( max( offsets ) == 0 ) {
+      for( int i = 0; i < MaxValueSizeLog(); i++ ) {
          this->blocksArray[ i ].reset();
          this->view.setBlocks( this->blocksArray[ i ], i );
       }
       return;
    }
 
-   this->template initValueSize<  1 >( offsets );
-   this->template initValueSize<  2 >( offsets );
-   this->template initValueSize<  4 >( offsets );
-   this->template initValueSize<  8 >( offsets );
+   this->template initValueSize< 1 >( offsets );
+   this->template initValueSize< 2 >( offsets );
+   this->template initValueSize< 4 >( offsets );
+   this->template initValueSize< 8 >( offsets );
    this->template initValueSize< 16 >( offsets );
    this->template initValueSize< 32 >( offsets );
    for( int i = 0; i < MaxValueSizeLog(); i++ )
       this->view.setBlocks( this->blocksArray[ i ], i );
 }
 
-
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 void
-CSRAdaptiveKernel< Index, Device >::
-reset()
+CSRAdaptiveKernel< Index, Device >::reset()
 {
-   for( int i = 0; i < MaxValueSizeLog(); i++ )
-   {
+   for( int i = 0; i < MaxValueSizeLog(); i++ ) {
       this->blocksArray[ i ].reset();
       this->view.setBlocks( this->blocksArray[ i ], i );
    }
 }
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 auto
-CSRAdaptiveKernel< Index, Device >::
-getView() -> ViewType
+CSRAdaptiveKernel< Index, Device >::getView() -> ViewType
 {
    return this->view;
 }
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 auto
-CSRAdaptiveKernel< Index, Device >::
-getConstView() const -> ConstViewType
+CSRAdaptiveKernel< Index, Device >::getConstView() const -> ConstViewType
 {
    return this->view;
 };
 
-template< typename Index,
-          typename Device >
-   template< typename OffsetsView,
-               typename Fetch,
-               typename Reduction,
-               typename ResultKeeper,
-               typename Real,
-               typename... Args >
+template< typename Index, typename Device >
+template< typename OffsetsView, typename Fetch, typename Reduction, typename ResultKeeper, typename Real, typename... Args >
 void
-CSRAdaptiveKernel< Index, Device >::
-reduceSegments( const OffsetsView& offsets,
-                   Index first,
-                   Index last,
-                   Fetch& fetch,
-                   const Reduction& reduction,
-                   ResultKeeper& keeper,
-                   const Real& zero,
-                   Args... args ) const
+CSRAdaptiveKernel< Index, Device >::reduceSegments( const OffsetsView& offsets,
+                                                    Index first,
+                                                    Index last,
+                                                    Fetch& fetch,
+                                                    const Reduction& reduction,
+                                                    ResultKeeper& keeper,
+                                                    const Real& zero,
+                                                    Args... args ) const
 {
    view.reduceSegments( offsets, first, last, fetch, reduction, keeper, zero, args... );
 }
 
-template< typename Index,
-          typename Device >
-   template< int SizeOfValue,
-             typename Offsets >
+template< typename Index, typename Device >
+template< int SizeOfValue, typename Offsets >
 Index
-CSRAdaptiveKernel< Index, Device >::
-findLimit( const Index start,
-           const Offsets& offsets,
-           const Index size,
-           detail::Type &type,
-           size_t &sum )
+CSRAdaptiveKernel< Index, Device >::findLimit( const Index start,
+                                               const Offsets& offsets,
+                                               const Index size,
+                                               detail::Type& type,
+                                               size_t& sum )
 {
    sum = 0;
-   for( Index current = start; current < size - 1; current++ )
-   {
+   for( Index current = start; current < size - 1; current++ ) {
       Index elements = offsets[ current + 1 ] - offsets[ current ];
       sum += elements;
-      if( sum > detail::CSRAdaptiveKernelParameters< SizeOfValue >::StreamedSharedElementsPerWarp() )
-      {
-         if( current - start > 0 ) // extra row
-         {
+      if( sum > detail::CSRAdaptiveKernelParameters< SizeOfValue >::StreamedSharedElementsPerWarp() ) {
+         if( current - start > 0 ) {
+            // extra row
             type = detail::Type::STREAM;
             return current;
          }
-         else
-         {                  // one long row
-            if( sum <= 2 * detail::CSRAdaptiveKernelParameters< SizeOfValue >::MaxAdaptiveElementsPerWarp() ) //MAX_ELEMENTS_PER_WARP_ADAPT )
+         else {
+            // one long row
+            if( sum <= 2 * detail::CSRAdaptiveKernelParameters< SizeOfValue >::MaxAdaptiveElementsPerWarp() )
                type = detail::Type::VECTOR;
             else
                type = detail::Type::LONG;
@@ -143,54 +117,48 @@ findLimit( const Index start,
       }
    }
    type = detail::Type::STREAM;
-   return size - 1; // return last row pointer
+   return size - 1;  // return last row pointer
 }
 
-template< typename Index,
-          typename Device >
-   template< int SizeOfValue,
-             typename Offsets >
+template< typename Index, typename Device >
+template< int SizeOfValue, typename Offsets >
 void
-CSRAdaptiveKernel< Index, Device >::
-initValueSize( const Offsets& offsets )
+CSRAdaptiveKernel< Index, Device >::initValueSize( const Offsets& offsets )
 {
-   using HostOffsetsType = TNL::Containers::Vector< typename Offsets::IndexType, TNL::Devices::Host, typename Offsets::IndexType >;
+   using HostOffsetsType =
+      TNL::Containers::Vector< typename Offsets::IndexType, TNL::Devices::Host, typename Offsets::IndexType >;
    HostOffsetsType hostOffsets( offsets );
    const Index rows = offsets.getSize();
-   Index start( 0 ), nextStart( 0 );
+   Index start( 0 );
+   Index nextStart( 0 );
    size_t sum;
 
    // Fill blocks
    std::vector< detail::CSRAdaptiveKernelBlockDescriptor< Index > > inBlocks;
    inBlocks.reserve( rows );
 
-   while( nextStart != rows - 1 )
-   {
+   while( nextStart != rows - 1 ) {
       detail::Type type;
       nextStart = findLimit< SizeOfValue >( start, hostOffsets, rows, type, sum );
-      if( type == detail::Type::LONG )
-      {
+      if( type == detail::Type::LONG ) {
          const Index blocksCount = inBlocks.size();
-         const Index warpsPerCudaBlock = detail::CSRAdaptiveKernelParameters< SizeOfValue >::CudaBlockSize() / TNL::Cuda::getWarpSize();
+         const Index warpsPerCudaBlock =
+            detail::CSRAdaptiveKernelParameters< SizeOfValue >::CudaBlockSize() / TNL::Cuda::getWarpSize();
          Index warpsLeft = roundUpDivision( blocksCount, warpsPerCudaBlock ) * warpsPerCudaBlock - blocksCount;
          if( warpsLeft == 0 )
             warpsLeft = warpsPerCudaBlock;
          for( Index index = 0; index < warpsLeft; index++ )
             inBlocks.emplace_back( start, detail::Type::LONG, index, warpsLeft );
       }
-      else
-      {
-         inBlocks.emplace_back(start, type,
-               nextStart,
-               offsets.getElement(nextStart),
-               offsets.getElement(start) );
+      else {
+         inBlocks.emplace_back( start, type, nextStart, offsets.getElement( nextStart ), offsets.getElement( start ) );
       }
       start = nextStart;
    }
-   inBlocks.emplace_back(nextStart);
+   inBlocks.emplace_back( nextStart );
    this->blocksArray[ getSizeValueLog( SizeOfValue ) ] = inBlocks;
 }
 
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/Kernels/CSRAdaptiveKernelView.h b/src/TNL/Algorithms/Segments/Kernels/CSRAdaptiveKernelView.h
index b402b3185b42cfc18e5a66fe7f628e2ef6bd9322..5bd1f2c2e593f37477c55e78dc99d06e4c9f9a64 100644
--- a/src/TNL/Algorithms/Segments/Kernels/CSRAdaptiveKernelView.h
+++ b/src/TNL/Algorithms/Segments/Kernels/CSRAdaptiveKernelView.h
@@ -11,11 +11,10 @@
 #include <TNL/Algorithms/Segments/Kernels/details/CSRAdaptiveKernelParameters.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 struct CSRAdaptiveKernelView
 {
    using IndexType = Index;
@@ -27,43 +26,49 @@ struct CSRAdaptiveKernelView
 
    static constexpr int MaxValueSizeLog = detail::CSRAdaptiveKernelParameters<>::MaxValueSizeLog;
 
-   static int getSizeValueLog( const int& i ) { return detail::CSRAdaptiveKernelParameters<>::getSizeValueLog( i ); };
+   static int
+   getSizeValueLog( const int& i )
+   {
+      return detail::CSRAdaptiveKernelParameters<>::getSizeValueLog( i );
+   };
 
    CSRAdaptiveKernelView() = default;
 
-   void setBlocks( BlocksType& blocks, const int idx );
+   void
+   setBlocks( BlocksType& blocks, int idx );
 
-   ViewType getView();
+   ViewType
+   getView();
 
-   ConstViewType getConstView() const;
+   ConstViewType
+   getConstView() const;
 
-   static TNL::String getKernelType();
+   static TNL::String
+   getKernelType();
 
-   template< typename OffsetsView,
-             typename Fetch,
-             typename Reduction,
-             typename ResultKeeper,
-             typename Real,
-             typename... Args >
-   void reduceSegments( const OffsetsView& offsets,
-                        Index first,
-                        Index last,
-                        Fetch& fetch,
-                        const Reduction& reduction,
-                        ResultKeeper& keeper,
-                        const Real& zero,
-                        Args... args ) const;
+   template< typename OffsetsView, typename Fetch, typename Reduction, typename ResultKeeper, typename Real, typename... Args >
+   void
+   reduceSegments( const OffsetsView& offsets,
+                   Index first,
+                   Index last,
+                   Fetch& fetch,
+                   const Reduction& reduction,
+                   ResultKeeper& keeper,
+                   const Real& zero,
+                   Args... args ) const;
 
-   CSRAdaptiveKernelView& operator=( const CSRAdaptiveKernelView< Index, Device >& kernelView );
+   CSRAdaptiveKernelView&
+   operator=( const CSRAdaptiveKernelView< Index, Device >& kernelView );
 
-   void printBlocks( int idx ) const;
+   void
+   printBlocks( int idx ) const;
 
-   protected:
-      BlocksView blocksArray[ MaxValueSizeLog ];
+protected:
+   BlocksView blocksArray[ MaxValueSizeLog ];
 };
 
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
 
 #include <TNL/Algorithms/Segments/Kernels/CSRAdaptiveKernelView.hpp>
diff --git a/src/TNL/Algorithms/Segments/Kernels/CSRAdaptiveKernelView.hpp b/src/TNL/Algorithms/Segments/Kernels/CSRAdaptiveKernelView.hpp
index a68b71dcfede721edc92dc1c0cc22c9c93bfd3dc..a105eb289196f5defbc1966874aa83d915edfaab 100644
--- a/src/TNL/Algorithms/Segments/Kernels/CSRAdaptiveKernelView.hpp
+++ b/src/TNL/Algorithms/Segments/Kernels/CSRAdaptiveKernelView.hpp
@@ -17,8 +17,8 @@
 #include <TNL/Algorithms/Segments/Kernels/details/CSRAdaptiveKernelParameters.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
 #ifdef HAVE_CUDA
 
@@ -30,23 +30,25 @@ template< typename BlocksView,
           typename ResultKeeper,
           typename Real,
           typename... Args >
-__global__ void
+__global__
+void
 reduceSegmentsCSRAdaptiveKernel( BlocksView blocks,
-                                    int gridIdx,
-                                    Offsets offsets,
-                                    Index first,
-                                    Index last,
-                                    Fetch fetch,
-                                    Reduction reduce,
-                                    ResultKeeper keep,
-                                    Real zero,
-                                    Args... args )
+                                 int gridIdx,
+                                 Offsets offsets,
+                                 Index first,
+                                 Index last,
+                                 Fetch fetch,
+                                 Reduction reduce,
+                                 ResultKeeper keep,
+                                 Real zero,
+                                 Args... args )
 {
    using BlockType = detail::CSRAdaptiveKernelBlockDescriptor< Index >;
    constexpr int CudaBlockSize = detail::CSRAdaptiveKernelParameters< sizeof( Real ) >::CudaBlockSize();
    constexpr int WarpSize = Cuda::getWarpSize();
    constexpr int WarpsCount = detail::CSRAdaptiveKernelParameters< sizeof( Real ) >::WarpsCount();
-   constexpr size_t StreamedSharedElementsPerWarp  = detail::CSRAdaptiveKernelParameters< sizeof( Real ) >::StreamedSharedElementsPerWarp();
+   constexpr size_t StreamedSharedElementsPerWarp =
+      detail::CSRAdaptiveKernelParameters< sizeof( Real ) >::StreamedSharedElementsPerWarp();
 
    __shared__ Real streamShared[ WarpsCount ][ StreamedSharedElementsPerWarp ];
    __shared__ Real multivectorShared[ CudaBlockSize / WarpSize ];
@@ -61,7 +63,7 @@ reduceSegmentsCSRAdaptiveKernel( BlocksView blocks,
       multivectorShared[ threadIdx.x ] = zero;
    Real result = zero;
    bool compute( true );
-   const Index laneIdx = threadIdx.x & 31; // & is cheaper than %
+   const Index laneIdx = threadIdx.x & 31;  // & is cheaper than %
    /*if( laneIdx == 0 )
       sharedBlocks[ warpIdx ] = blocks[ blockIdx ];
    __syncthreads();
@@ -70,7 +72,7 @@ reduceSegmentsCSRAdaptiveKernel( BlocksView blocks,
    const Index firstSegmentIdx = block.getFirstSegment();
    const Index begin = offsets[ firstSegmentIdx ];
 
-   if( block.getType() == detail::Type::STREAM ) // Stream kernel - many short segments per warp
+   if( block.getType() == detail::Type::STREAM )  // Stream kernel - many short segments per warp
    {
       const Index warpIdx = threadIdx.x / 32;
       const Index end = begin + block.getSize();
@@ -80,9 +82,8 @@ reduceSegmentsCSRAdaptiveKernel( BlocksView blocks,
          streamShared[ warpIdx ][ globalIdx - begin ] = fetch( globalIdx, compute );
       const Index lastSegmentIdx = firstSegmentIdx + block.getSegmentsInBlock();
 
-      for( Index i = firstSegmentIdx + laneIdx; i < lastSegmentIdx; i += WarpSize )
-      {
-         const Index sharedEnd = offsets[ i + 1 ] - begin; // end of preprocessed data
+      for( Index i = firstSegmentIdx + laneIdx; i < lastSegmentIdx; i += WarpSize ) {
+         const Index sharedEnd = offsets[ i + 1 ] - begin;  // end of preprocessed data
          result = zero;
          // Scalar reduction
          for( Index sharedIdx = offsets[ i ] - begin; sharedIdx < sharedEnd; sharedIdx++ )
@@ -90,7 +91,7 @@ reduceSegmentsCSRAdaptiveKernel( BlocksView blocks,
          keep( i, result );
       }
    }
-   else if( block.getType() == detail::Type::VECTOR ) // Vector kernel - one segment per warp
+   else if( block.getType() == detail::Type::VECTOR )  // Vector kernel - one segment per warp
    {
       const Index end = begin + block.getSize();
       const Index segmentIdx = block.getFirstSegment();
@@ -100,32 +101,31 @@ reduceSegmentsCSRAdaptiveKernel( BlocksView blocks,
 
       // Parallel reduction
       result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 16 ) );
-      result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result,  8 ) );
-      result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result,  4 ) );
-      result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result,  2 ) );
-      result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result,  1 ) );
+      result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 8 ) );
+      result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 4 ) );
+      result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 2 ) );
+      result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 1 ) );
       if( laneIdx == 0 )
          keep( segmentIdx, result );
    }
-   else // block.getType() == Type::LONG - several warps per segment
+   else  // block.getType() == Type::LONG - several warps per segment
    {
-      const Index segmentIdx = block.getFirstSegment();//block.index[0];
-      const Index end = offsets[segmentIdx + 1];
+      const Index segmentIdx = block.getFirstSegment();  // block.index[0];
+      const Index end = offsets[ segmentIdx + 1 ];
 
       TNL_ASSERT_GT( block.getWarpsCount(), 0, "" );
       result = zero;
-      for( Index globalIdx = begin + laneIdx + TNL::Cuda::getWarpSize() * block.getWarpIdx();
-           globalIdx < end;
+      for( Index globalIdx = begin + laneIdx + TNL::Cuda::getWarpSize() * block.getWarpIdx(); globalIdx < end;
            globalIdx += TNL::Cuda::getWarpSize() * block.getWarpsCount() )
       {
          result = reduce( result, fetch( globalIdx, compute ) );
       }
 
-      result += __shfl_down_sync(0xFFFFFFFF, result, 16);
-      result += __shfl_down_sync(0xFFFFFFFF, result, 8);
-      result += __shfl_down_sync(0xFFFFFFFF, result, 4);
-      result += __shfl_down_sync(0xFFFFFFFF, result, 2);
-      result += __shfl_down_sync(0xFFFFFFFF, result, 1);
+      result += __shfl_down_sync( 0xFFFFFFFF, result, 16 );
+      result += __shfl_down_sync( 0xFFFFFFFF, result, 8 );
+      result += __shfl_down_sync( 0xFFFFFFFF, result, 4 );
+      result += __shfl_down_sync( 0xFFFFFFFF, result, 2 );
+      result += __shfl_down_sync( 0xFFFFFFFF, result, 1 );
 
       const Index warpID = threadIdx.x / 32;
       if( laneIdx == 0 )
@@ -133,37 +133,30 @@ reduceSegmentsCSRAdaptiveKernel( BlocksView blocks,
 
       __syncthreads();
       // Reduction in multivectorShared
-      if( block.getWarpIdx() == 0 && laneIdx < 16 )
-      {
+      if( block.getWarpIdx() == 0 && laneIdx < 16 ) {
          constexpr int totalWarps = CudaBlockSize / WarpSize;
-         if( totalWarps >= 32 )
-         {
-            multivectorShared[ laneIdx ] =  reduce( multivectorShared[ laneIdx ], multivectorShared[ laneIdx + 16 ] );
+         if( totalWarps >= 32 ) {
+            multivectorShared[ laneIdx ] = reduce( multivectorShared[ laneIdx ], multivectorShared[ laneIdx + 16 ] );
             __syncwarp();
          }
-         if( totalWarps >= 16 )
-         {
-            multivectorShared[ laneIdx ] =  reduce( multivectorShared[ laneIdx ], multivectorShared[ laneIdx +  8 ] );
+         if( totalWarps >= 16 ) {
+            multivectorShared[ laneIdx ] = reduce( multivectorShared[ laneIdx ], multivectorShared[ laneIdx + 8 ] );
             __syncwarp();
          }
-         if( totalWarps >= 8 )
-         {
-            multivectorShared[ laneIdx ] =  reduce( multivectorShared[ laneIdx ], multivectorShared[ laneIdx +  4 ] );
+         if( totalWarps >= 8 ) {
+            multivectorShared[ laneIdx ] = reduce( multivectorShared[ laneIdx ], multivectorShared[ laneIdx + 4 ] );
             __syncwarp();
          }
-         if( totalWarps >= 4 )
-         {
-            multivectorShared[ laneIdx ] =  reduce( multivectorShared[ laneIdx ], multivectorShared[ laneIdx +  2 ] );
+         if( totalWarps >= 4 ) {
+            multivectorShared[ laneIdx ] = reduce( multivectorShared[ laneIdx ], multivectorShared[ laneIdx + 2 ] );
             __syncwarp();
          }
-         if( totalWarps >= 2 )
-         {
-            multivectorShared[ laneIdx ] =  reduce( multivectorShared[ laneIdx ], multivectorShared[ laneIdx +  1 ] );
+         if( totalWarps >= 2 ) {
+            multivectorShared[ laneIdx ] = reduce( multivectorShared[ laneIdx ], multivectorShared[ laneIdx + 1 ] );
             __syncwarp();
          }
-         if( laneIdx == 0 )
-         {
-            //printf( "Long: segmentIdx %d -> %d \n", segmentIdx, multivectorShared[ 0 ] );
+         if( laneIdx == 0 ) {
+            // printf( "Long: segmentIdx %d -> %d \n", segmentIdx, multivectorShared[ 0 ] );
             keep( segmentIdx, multivectorShared[ 0 ] );
          }
       }
@@ -177,57 +170,43 @@ template< typename Index,
           typename Reduction,
           typename ResultKeeper,
           bool DispatchScalarCSR =
-            detail::CheckFetchLambda< Index, Fetch >::hasAllParameters() ||
-            std::is_same< Device, Devices::Host >::value >
+             detail::CheckFetchLambda< Index, Fetch >::hasAllParameters() || std::is_same< Device, Devices::Host >::value >
 struct CSRAdaptiveKernelreduceSegmentsDispatcher;
 
-template< typename Index,
-          typename Device,
-          typename Fetch,
-          typename Reduction,
-          typename ResultKeeper >
+template< typename Index, typename Device, typename Fetch, typename Reduction, typename ResultKeeper >
 struct CSRAdaptiveKernelreduceSegmentsDispatcher< Index, Device, Fetch, Reduction, ResultKeeper, true >
 {
-
-   template< typename BlocksView,
-             typename Offsets,
-             typename Real,
-             typename... Args >
-   static void reduce( const Offsets& offsets,
-                       const BlocksView& blocks,
-                       Index first,
-                       Index last,
-                       Fetch& fetch,
-                       const Reduction& reduction,
-                       ResultKeeper& keeper,
-                       const Real& zero,
-                       Args... args)
+   template< typename BlocksView, typename Offsets, typename Real, typename... Args >
+   static void
+   reduce( const Offsets& offsets,
+           const BlocksView& blocks,
+           Index first,
+           Index last,
+           Fetch& fetch,
+           const Reduction& reduction,
+           ResultKeeper& keeper,
+           const Real& zero,
+           Args... args )
    {
-      TNL::Algorithms::Segments::CSRScalarKernel< Index, Device >::
-         reduceSegments( offsets, first, last, fetch, reduction, keeper, zero, args... );
+      TNL::Algorithms::Segments::CSRScalarKernel< Index, Device >::reduceSegments(
+         offsets, first, last, fetch, reduction, keeper, zero, args... );
    }
 };
 
-template< typename Index,
-          typename Device,
-          typename Fetch,
-          typename Reduction,
-          typename ResultKeeper >
+template< typename Index, typename Device, typename Fetch, typename Reduction, typename ResultKeeper >
 struct CSRAdaptiveKernelreduceSegmentsDispatcher< Index, Device, Fetch, Reduction, ResultKeeper, false >
 {
-   template< typename BlocksView,
-             typename Offsets,
-             typename Real,
-             typename... Args >
-   static void reduce( const Offsets& offsets,
-                       const BlocksView& blocks,
-                       Index first,
-                       Index last,
-                       Fetch& fetch,
-                       const Reduction& reduction,
-                       ResultKeeper& keeper,
-                       const Real& zero,
-                       Args... args)
+   template< typename BlocksView, typename Offsets, typename Real, typename... Args >
+   static void
+   reduce( const Offsets& offsets,
+           const BlocksView& blocks,
+           Index first,
+           Index last,
+           Fetch& fetch,
+           const Reduction& reduction,
+           ResultKeeper& keeper,
+           const Real& zero,
+           Args... args )
    {
 #ifdef HAVE_CUDA
 
@@ -237,137 +216,101 @@ struct CSRAdaptiveKernelreduceSegmentsDispatcher< Index, Device, Fetch, Reductio
       constexpr size_t maxGridSize = TNL::Cuda::getMaxGridXSize();
 
       // Fill blocks
-      size_t neededThreads = blocks.getSize() * TNL::Cuda::getWarpSize(); // one warp per block
+      size_t neededThreads = blocks.getSize() * TNL::Cuda::getWarpSize();  // one warp per block
       // Execute kernels on device
-      for (Index gridIdx = 0; neededThreads != 0; gridIdx++ )
-      {
-         if( maxGridSize * threads >= neededThreads )
-         {
+      for( Index gridIdx = 0; neededThreads != 0; gridIdx++ ) {
+         if( maxGridSize * threads >= neededThreads ) {
             blocksCount = roundUpDivision( neededThreads, threads );
             neededThreads = 0;
          }
-         else
-         {
+         else {
             blocksCount = maxGridSize;
             neededThreads -= maxGridSize * threads;
          }
 
-         reduceSegmentsCSRAdaptiveKernel<
-               BlocksView,
-               Offsets,
-               Index, Fetch, Reduction, ResultKeeper, Real, Args... >
-            <<<blocksCount, threads>>>(
-               blocks,
-               gridIdx,
-               offsets,
-               first,
-               last,
-               fetch,
-               reduction,
-               keeper,
-               zero,
-               args... );
+         reduceSegmentsCSRAdaptiveKernel< BlocksView, Offsets, Index, Fetch, Reduction, ResultKeeper, Real, Args... >
+            <<<blocksCount,
+            threads>>>( blocks, gridIdx, offsets, first, last, fetch, reduction, keeper, zero, args... );
       }
-      cudaStreamSynchronize(0);
+      cudaStreamSynchronize( 0 );
       TNL_CHECK_CUDA_DEVICE;
 #endif
    }
 };
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 void
-CSRAdaptiveKernelView< Index, Device >::
-setBlocks( BlocksType& blocks, const int idx )
+CSRAdaptiveKernelView< Index, Device >::setBlocks( BlocksType& blocks, const int idx )
 {
    this->blocksArray[ idx ].bind( blocks );
 }
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 auto
-CSRAdaptiveKernelView< Index, Device >::
-getView() -> ViewType
+CSRAdaptiveKernelView< Index, Device >::getView() -> ViewType
 {
    return *this;
 };
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 auto
-CSRAdaptiveKernelView< Index, Device >::
-getConstView() const -> ConstViewType
+CSRAdaptiveKernelView< Index, Device >::getConstView() const -> ConstViewType
 {
    return *this;
 }
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 TNL::String
-CSRAdaptiveKernelView< Index, Device >::
-getKernelType()
+CSRAdaptiveKernelView< Index, Device >::getKernelType()
 {
    return "Adaptive";
 }
 
-template< typename Index,
-          typename Device >
-   template< typename OffsetsView,
-               typename Fetch,
-               typename Reduction,
-               typename ResultKeeper,
-               typename Real,
-               typename... Args >
+template< typename Index, typename Device >
+template< typename OffsetsView, typename Fetch, typename Reduction, typename ResultKeeper, typename Real, typename... Args >
 void
-CSRAdaptiveKernelView< Index, Device >::
-reduceSegments( const OffsetsView& offsets,
-                   Index first,
-                   Index last,
-                   Fetch& fetch,
-                   const Reduction& reduction,
-                   ResultKeeper& keeper,
-                   const Real& zero,
-                   Args... args ) const
+CSRAdaptiveKernelView< Index, Device >::reduceSegments( const OffsetsView& offsets,
+                                                        Index first,
+                                                        Index last,
+                                                        Fetch& fetch,
+                                                        const Reduction& reduction,
+                                                        ResultKeeper& keeper,
+                                                        const Real& zero,
+                                                        Args... args ) const
 {
    int valueSizeLog = getSizeValueLog( sizeof( Real ) );
 
-   if( detail::CheckFetchLambda< Index, Fetch >::hasAllParameters() || valueSizeLog >= MaxValueSizeLog )
-   {
-      TNL::Algorithms::Segments::CSRScalarKernel< Index, Device >::
-         reduceSegments( offsets, first, last, fetch, reduction, keeper, zero, args... );
+   if( detail::CheckFetchLambda< Index, Fetch >::hasAllParameters() || valueSizeLog >= MaxValueSizeLog ) {
+      TNL::Algorithms::Segments::CSRScalarKernel< Index, Device >::reduceSegments(
+         offsets, first, last, fetch, reduction, keeper, zero, args... );
       return;
    }
 
-   CSRAdaptiveKernelreduceSegmentsDispatcher< Index, Device, Fetch, Reduction, ResultKeeper  >::template
-      reduce< BlocksView, OffsetsView, Real, Args... >( offsets, this->blocksArray[ valueSizeLog ], first, last, fetch, reduction, keeper, zero, args... );
+   CSRAdaptiveKernelreduceSegmentsDispatcher< Index, Device, Fetch, Reduction, ResultKeeper >::
+      template reduce< BlocksView, OffsetsView, Real, Args... >(
+         offsets, this->blocksArray[ valueSizeLog ], first, last, fetch, reduction, keeper, zero, args... );
 }
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 CSRAdaptiveKernelView< Index, Device >&
-CSRAdaptiveKernelView< Index, Device >::
-operator=( const CSRAdaptiveKernelView< Index, Device >& kernelView )
+CSRAdaptiveKernelView< Index, Device >::operator=( const CSRAdaptiveKernelView< Index, Device >& kernelView )
 {
    for( int i = 0; i < MaxValueSizeLog; i++ )
       this->blocksArray[ i ].bind( kernelView.blocksArray[ i ] );
    return *this;
 }
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 void
-CSRAdaptiveKernelView< Index, Device >::
-printBlocks( int idx ) const
+CSRAdaptiveKernelView< Index, Device >::printBlocks( int idx ) const
 {
    auto& blocks = this->blocksArray[ idx ];
-   for( Index i = 0; i < this->blocks.getSize(); i++ )
-   {
+   for( Index i = 0; i < this->blocks.getSize(); i++ ) {
       auto block = blocks.getElement( i );
       std::cout << "Block " << i << " : " << block << std::endl;
    }
-
 }
 
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/Kernels/CSRHybridKernel.h b/src/TNL/Algorithms/Segments/Kernels/CSRHybridKernel.h
index 9c1246406fab4dbaae3b22246ab7d7b3f8a9c1b0..8a16a0afca7dd01ee23f1970e6b0b2f05bb68514 100644
--- a/src/TNL/Algorithms/Segments/Kernels/CSRHybridKernel.h
+++ b/src/TNL/Algorithms/Segments/Kernels/CSRHybridKernel.h
@@ -13,12 +13,10 @@
 #include <TNL/Algorithms/Segments/detail/LambdaAdapter.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
-template< typename Index,
-          typename Device,
-          int ThreadsInBlock = 128 >
+template< typename Index, typename Device, int ThreadsInBlock = 128 >
 struct CSRHybridKernel
 {
    using IndexType = Index;
@@ -27,35 +25,37 @@ struct CSRHybridKernel
    using ConstViewType = CSRHybridKernel< Index, Device, ThreadsInBlock >;
 
    template< typename Offsets >
-   void init( const Offsets& offsets );
+   void
+   init( const Offsets& offsets );
 
-   void reset();
+   void
+   reset();
 
-   ViewType getView();
+   ViewType
+   getView();
 
-   ConstViewType getConstView() const;
+   ConstViewType
+   getConstView() const;
 
-   static TNL::String getKernelType();
+   static TNL::String
+   getKernelType();
 
-   template< typename OffsetsView,
-             typename Fetch,
-             typename Reduction,
-             typename ResultKeeper,
-             typename Real >
-   void reduceSegments( const OffsetsView& offsets,
-                                  Index first,
-                                  Index last,
-                                  Fetch& fetch,
-                                  const Reduction& reduction,
-                                  ResultKeeper& keeper,
-                                  const Real& zero ) const;
+   template< typename OffsetsView, typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+   void
+   reduceSegments( const OffsetsView& offsets,
+                   Index first,
+                   Index last,
+                   Fetch& fetch,
+                   const Reduction& reduction,
+                   ResultKeeper& keeper,
+                   const Real& zero ) const;
 
-   protected:
-      int threadsPerSegment;
+protected:
+   int threadsPerSegment;
 };
 
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
 
 #include <TNL/Algorithms/Segments/Kernels/CSRHybridKernel.hpp>
diff --git a/src/TNL/Algorithms/Segments/Kernels/CSRHybridKernel.hpp b/src/TNL/Algorithms/Segments/Kernels/CSRHybridKernel.hpp
index 639a33942858258402b2f162572620460109782a..b2ba912a8ce582854aff18fbc469d1e80dbaedff 100644
--- a/src/TNL/Algorithms/Segments/Kernels/CSRHybridKernel.hpp
+++ b/src/TNL/Algorithms/Segments/Kernels/CSRHybridKernel.hpp
@@ -14,8 +14,8 @@
 #include <TNL/Algorithms/Segments/Kernels/CSRHybridKernel.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
 #ifdef HAVE_CUDA
 template< int ThreadsPerSegment,
@@ -26,48 +26,47 @@ template< int ThreadsPerSegment,
           typename ResultKeeper,
           typename Real >
 __global__
-void reduceSegmentsCSRHybridVectorKernel(
-    int gridIdx,
-    const Offsets offsets,
-    Index first,
-    Index last,
-    Fetch fetch,
-    const Reduction reduce,
-    ResultKeeper keep,
-    const Real zero )
+void
+reduceSegmentsCSRHybridVectorKernel( int gridIdx,
+                                     const Offsets offsets,
+                                     Index first,
+                                     Index last,
+                                     Fetch fetch,
+                                     const Reduction reduce,
+                                     ResultKeeper keep,
+                                     const Real zero )
 {
-    const Index segmentIdx =  TNL::Cuda::getGlobalThreadIdx( gridIdx ) / ThreadsPerSegment + first;
-    if( segmentIdx >= last )
-        return;
+   const Index segmentIdx = TNL::Cuda::getGlobalThreadIdx( gridIdx ) / ThreadsPerSegment + first;
+   if( segmentIdx >= last )
+      return;
 
-    const int laneIdx = threadIdx.x & ( ThreadsPerSegment - 1 ); // & is cheaper than %
-    Index endIdx = offsets[ segmentIdx + 1] ;
+   const int laneIdx = threadIdx.x & ( ThreadsPerSegment - 1 );  // & is cheaper than %
+   Index endIdx = offsets[ segmentIdx + 1 ];
 
-    Index localIdx( laneIdx );
-    Real aux = zero;
-    bool compute( true );
-    for( Index globalIdx = offsets[ segmentIdx ] + localIdx; globalIdx < endIdx; globalIdx += ThreadsPerSegment )
-    {
+   Index localIdx( laneIdx );
+   Real aux = zero;
+   bool compute( true );
+   for( Index globalIdx = offsets[ segmentIdx ] + localIdx; globalIdx < endIdx; globalIdx += ThreadsPerSegment ) {
       aux = reduce( aux, detail::FetchLambdaAdapter< Index, Fetch >::call( fetch, segmentIdx, localIdx, globalIdx, compute ) );
       localIdx += TNL::Cuda::getWarpSize();
-    }
+   }
 
-    /****
-     * Reduction in each segment.
-     */
-    if( ThreadsPerSegment == 32 )
-        aux = reduce( aux, __shfl_down_sync( 0xFFFFFFFF, aux, 16 ) );
-    if( ThreadsPerSegment >= 16 )
-        aux = reduce( aux, __shfl_down_sync( 0xFFFFFFFF, aux,  8 ) );
-    if( ThreadsPerSegment >= 8 )
-        aux = reduce( aux, __shfl_down_sync( 0xFFFFFFFF, aux,  4 ) );
-    if( ThreadsPerSegment >= 4 )
-        aux = reduce( aux, __shfl_down_sync( 0xFFFFFFFF, aux,  2 ) );
-    if( ThreadsPerSegment >= 2 )
-        aux = reduce( aux, __shfl_down_sync( 0xFFFFFFFF, aux,  1 ) );
+   /****
+    * Reduction in each segment.
+    */
+   if( ThreadsPerSegment == 32 )
+      aux = reduce( aux, __shfl_down_sync( 0xFFFFFFFF, aux, 16 ) );
+   if( ThreadsPerSegment >= 16 )
+      aux = reduce( aux, __shfl_down_sync( 0xFFFFFFFF, aux, 8 ) );
+   if( ThreadsPerSegment >= 8 )
+      aux = reduce( aux, __shfl_down_sync( 0xFFFFFFFF, aux, 4 ) );
+   if( ThreadsPerSegment >= 4 )
+      aux = reduce( aux, __shfl_down_sync( 0xFFFFFFFF, aux, 2 ) );
+   if( ThreadsPerSegment >= 2 )
+      aux = reduce( aux, __shfl_down_sync( 0xFFFFFFFF, aux, 1 ) );
 
-    if( laneIdx == 0 )
-        keep( segmentIdx, aux );
+   if( laneIdx == 0 )
+      keep( segmentIdx, aux );
 }
 
 template< int BlockSize,
@@ -79,230 +78,228 @@ template< int BlockSize,
           typename ResultKeeper,
           typename Real >
 __global__
-void reduceSegmentsCSRHybridMultivectorKernel(
-    int gridIdx,
-    const Offsets offsets,
-    Index first,
-    Index last,
-    Fetch fetch,
-    const Reduction reduce,
-    ResultKeeper keep,
-    const Real zero )
+void
+reduceSegmentsCSRHybridMultivectorKernel( int gridIdx,
+                                          const Offsets offsets,
+                                          Index first,
+                                          Index last,
+                                          Fetch fetch,
+                                          const Reduction reduce,
+                                          ResultKeeper keep,
+                                          const Real zero )
 {
-    const Index segmentIdx =  TNL::Cuda::getGlobalThreadIdx( gridIdx ) / ThreadsPerSegment + first;
-    if( segmentIdx >= last )
-        return;
+   const Index segmentIdx = TNL::Cuda::getGlobalThreadIdx( gridIdx ) / ThreadsPerSegment + first;
+   if( segmentIdx >= last )
+      return;
 
-    __shared__ Real shared[ BlockSize / 32 ];
-    if( threadIdx.x < BlockSize / TNL::Cuda::getWarpSize() )
-        shared[ threadIdx.x ] = zero;
+   __shared__ Real shared[ BlockSize / 32 ];
+   if( threadIdx.x < BlockSize / TNL::Cuda::getWarpSize() )
+      shared[ threadIdx.x ] = zero;
 
-    const int laneIdx = threadIdx.x & ( ThreadsPerSegment - 1 ); // & is cheaper than %
-    const int inWarpLaneIdx = threadIdx.x & ( TNL::Cuda::getWarpSize() - 1 ); // & is cheaper than %
-    const Index beginIdx = offsets[ segmentIdx ];
-    const Index endIdx   = offsets[ segmentIdx + 1 ] ;
+   const int laneIdx = threadIdx.x & ( ThreadsPerSegment - 1 );               // & is cheaper than %
+   const int inWarpLaneIdx = threadIdx.x & ( TNL::Cuda::getWarpSize() - 1 );  // & is cheaper than %
+   const Index beginIdx = offsets[ segmentIdx ];
+   const Index endIdx = offsets[ segmentIdx + 1 ];
 
-    Real result = zero;
-    bool compute( true );
-    Index localIdx = laneIdx;
-    for( Index globalIdx = beginIdx + laneIdx; globalIdx < endIdx && compute; globalIdx += ThreadsPerSegment )
-    {
-       result = reduce( result, detail::FetchLambdaAdapter< Index, Fetch >::call( fetch, segmentIdx, localIdx, globalIdx, compute ) );
-       localIdx += ThreadsPerSegment;
-    }
-    result += __shfl_down_sync(0xFFFFFFFF, result, 16);
-    result += __shfl_down_sync(0xFFFFFFFF, result, 8);
-    result += __shfl_down_sync(0xFFFFFFFF, result, 4);
-    result += __shfl_down_sync(0xFFFFFFFF, result, 2);
-    result += __shfl_down_sync(0xFFFFFFFF, result, 1);
+   Real result = zero;
+   bool compute( true );
+   Index localIdx = laneIdx;
+   for( Index globalIdx = beginIdx + laneIdx; globalIdx < endIdx && compute; globalIdx += ThreadsPerSegment ) {
+      result =
+         reduce( result, detail::FetchLambdaAdapter< Index, Fetch >::call( fetch, segmentIdx, localIdx, globalIdx, compute ) );
+      localIdx += ThreadsPerSegment;
+   }
+   result += __shfl_down_sync( 0xFFFFFFFF, result, 16 );
+   result += __shfl_down_sync( 0xFFFFFFFF, result, 8 );
+   result += __shfl_down_sync( 0xFFFFFFFF, result, 4 );
+   result += __shfl_down_sync( 0xFFFFFFFF, result, 2 );
+   result += __shfl_down_sync( 0xFFFFFFFF, result, 1 );
 
-    const Index warpIdx = threadIdx.x / TNL::Cuda::getWarpSize();
-    if( inWarpLaneIdx == 0 )
-        shared[ warpIdx ] = result;
+   const Index warpIdx = threadIdx.x / TNL::Cuda::getWarpSize();
+   if( inWarpLaneIdx == 0 )
+      shared[ warpIdx ] = result;
 
-    __syncthreads();
-    // Reduction in shared
-    if( warpIdx == 0 && inWarpLaneIdx < 16 )
-    {
-        //constexpr int totalWarps = BlockSize / WarpSize;
-        constexpr int warpsPerSegment = ThreadsPerSegment / TNL::Cuda::getWarpSize();
-        if( warpsPerSegment >= 32 )
-        {
-            shared[ inWarpLaneIdx ] =  reduce( shared[ inWarpLaneIdx ], shared[ inWarpLaneIdx + 16 ] );
-            __syncwarp();
-        }
-        if( warpsPerSegment >= 16 )
-        {
-            shared[ inWarpLaneIdx ] =  reduce( shared[ inWarpLaneIdx ], shared[ inWarpLaneIdx +  8 ] );
-            __syncwarp();
-        }
-        if( warpsPerSegment >= 8 )
-        {
-            shared[ inWarpLaneIdx ] =  reduce( shared[ inWarpLaneIdx ], shared[ inWarpLaneIdx +  4 ] );
-            __syncwarp();
-        }
-        if( warpsPerSegment >= 4 )
-        {
-            shared[ inWarpLaneIdx ] =  reduce( shared[ inWarpLaneIdx ], shared[ inWarpLaneIdx +  2 ] );
-            __syncwarp();
-        }
-        if( warpsPerSegment >= 2 )
-        {
-            shared[ inWarpLaneIdx ] =  reduce( shared[ inWarpLaneIdx ], shared[ inWarpLaneIdx +  1 ] );
-            __syncwarp();
-        }
-        constexpr int segmentsCount = BlockSize / ThreadsPerSegment;
-        if( inWarpLaneIdx < segmentsCount && segmentIdx + inWarpLaneIdx < last )
-        {
-            //printf( "Long: segmentIdx %d -> %d \n", segmentIdx, aux );
-            keep( segmentIdx + inWarpLaneIdx, shared[ inWarpLaneIdx * ThreadsPerSegment / 32 ] );
-        }
-    }
+   __syncthreads();
+   // Reduction in shared
+   if( warpIdx == 0 && inWarpLaneIdx < 16 ) {
+      // constexpr int totalWarps = BlockSize / WarpSize;
+      constexpr int warpsPerSegment = ThreadsPerSegment / TNL::Cuda::getWarpSize();
+      if( warpsPerSegment >= 32 ) {
+         shared[ inWarpLaneIdx ] = reduce( shared[ inWarpLaneIdx ], shared[ inWarpLaneIdx + 16 ] );
+         __syncwarp();
+      }
+      if( warpsPerSegment >= 16 ) {
+         shared[ inWarpLaneIdx ] = reduce( shared[ inWarpLaneIdx ], shared[ inWarpLaneIdx + 8 ] );
+         __syncwarp();
+      }
+      if( warpsPerSegment >= 8 ) {
+         shared[ inWarpLaneIdx ] = reduce( shared[ inWarpLaneIdx ], shared[ inWarpLaneIdx + 4 ] );
+         __syncwarp();
+      }
+      if( warpsPerSegment >= 4 ) {
+         shared[ inWarpLaneIdx ] = reduce( shared[ inWarpLaneIdx ], shared[ inWarpLaneIdx + 2 ] );
+         __syncwarp();
+      }
+      if( warpsPerSegment >= 2 ) {
+         shared[ inWarpLaneIdx ] = reduce( shared[ inWarpLaneIdx ], shared[ inWarpLaneIdx + 1 ] );
+         __syncwarp();
+      }
+      constexpr int segmentsCount = BlockSize / ThreadsPerSegment;
+      if( inWarpLaneIdx < segmentsCount && segmentIdx + inWarpLaneIdx < last ) {
+         // printf( "Long: segmentIdx %d -> %d \n", segmentIdx, aux );
+         keep( segmentIdx + inWarpLaneIdx, shared[ inWarpLaneIdx * ThreadsPerSegment / 32 ] );
+      }
+   }
 }
 #endif
 
-
-
-template< typename Index,
-          typename Device,
-          int ThreadsInBlock >
-    template< typename Offsets >
+template< typename Index, typename Device, int ThreadsInBlock >
+template< typename Offsets >
 void
-CSRHybridKernel< Index, Device, ThreadsInBlock >::
-init( const Offsets& offsets )
+CSRHybridKernel< Index, Device, ThreadsInBlock >::init( const Offsets& offsets )
 {
-    TNL_ASSERT_GT( offsets.getSize(), 0, "offsets size must be strictly positive" );
-    const Index segmentsCount = offsets.getSize() - 1;
-    if( segmentsCount <= 0 )
-       return;
-    const Index elementsInSegment = std::ceil( ( double ) offsets.getElement( segmentsCount ) / ( double ) segmentsCount );
-    this->threadsPerSegment = TNL::min( std::pow( 2, std::ceil( std::log2( elementsInSegment ) ) ), ThreadsInBlock ); //TNL::Cuda::getWarpSize() );
-    TNL_ASSERT_GE( threadsPerSegment, 0, "" );
-    TNL_ASSERT_LE( threadsPerSegment, ThreadsInBlock, "" );
+   TNL_ASSERT_GT( offsets.getSize(), 0, "offsets size must be strictly positive" );
+   const Index segmentsCount = offsets.getSize() - 1;
+   if( segmentsCount <= 0 )
+      return;
+   const Index elementsInSegment = std::ceil( (double) offsets.getElement( segmentsCount ) / (double) segmentsCount );
+   this->threadsPerSegment =
+      TNL::min( std::pow( 2, std::ceil( std::log2( elementsInSegment ) ) ), ThreadsInBlock );  // TNL::Cuda::getWarpSize() );
+   TNL_ASSERT_GE( threadsPerSegment, 0, "" );
+   TNL_ASSERT_LE( threadsPerSegment, ThreadsInBlock, "" );
 }
 
-template< typename Index,
-          typename Device,
-          int ThreadsInBlock >
+template< typename Index, typename Device, int ThreadsInBlock >
 void
-CSRHybridKernel< Index, Device, ThreadsInBlock >::
-reset()
+CSRHybridKernel< Index, Device, ThreadsInBlock >::reset()
 {
-    this->threadsPerSegment = 0;
+   this->threadsPerSegment = 0;
 }
 
-template< typename Index,
-          typename Device,
-          int ThreadsInBlock >
+template< typename Index, typename Device, int ThreadsInBlock >
 auto
-CSRHybridKernel< Index, Device, ThreadsInBlock >::
-getView() -> ViewType
+CSRHybridKernel< Index, Device, ThreadsInBlock >::getView() -> ViewType
 {
-    return *this;
+   return *this;
 }
 
-template< typename Index,
-          typename Device,
-          int ThreadsInBlock >
+template< typename Index, typename Device, int ThreadsInBlock >
 TNL::String
-CSRHybridKernel< Index, Device, ThreadsInBlock >::
-getKernelType()
+CSRHybridKernel< Index, Device, ThreadsInBlock >::getKernelType()
 {
-    return "Hybrid " + TNL::convertToString( ThreadsInBlock );
+   return "Hybrid " + TNL::convertToString( ThreadsInBlock );
 }
 
-template< typename Index,
-          typename Device,
-          int ThreadsInBlock >
+template< typename Index, typename Device, int ThreadsInBlock >
 auto
-CSRHybridKernel< Index, Device, ThreadsInBlock >::
-getConstView() const -> ConstViewType
+CSRHybridKernel< Index, Device, ThreadsInBlock >::getConstView() const -> ConstViewType
 {
-    return *this;
+   return *this;
 };
 
-
-template< typename Index,
-          typename Device,
-          int ThreadsInBlock >
-    template< typename OffsetsView,
-              typename Fetch,
-              typename Reduction,
-              typename ResultKeeper,
-              typename Real >
+template< typename Index, typename Device, int ThreadsInBlock >
+template< typename OffsetsView, typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
 void
-CSRHybridKernel< Index, Device, ThreadsInBlock >::
-reduceSegments( const OffsetsView& offsets,
-                         Index first,
-                         Index last,
-                         Fetch& fetch,
-                         const Reduction& reduction,
-                         ResultKeeper& keeper,
-                         const Real& zero ) const
+CSRHybridKernel< Index, Device, ThreadsInBlock >::reduceSegments( const OffsetsView& offsets,
+                                                                  Index first,
+                                                                  Index last,
+                                                                  Fetch& fetch,
+                                                                  const Reduction& reduction,
+                                                                  ResultKeeper& keeper,
+                                                                  const Real& zero ) const
 {
-    TNL_ASSERT_GE( this->threadsPerSegment, 0, "" );
-    TNL_ASSERT_LE( this->threadsPerSegment, ThreadsInBlock, "" );
+   TNL_ASSERT_GE( this->threadsPerSegment, 0, "" );
+   TNL_ASSERT_LE( this->threadsPerSegment, ThreadsInBlock, "" );
 
 #ifdef HAVE_CUDA
-    if( last <= first )
-       return;
-    const size_t threadsCount = this->threadsPerSegment * ( last - first );
-    dim3 blocksCount, gridsCount, blockSize( ThreadsInBlock );
-    TNL::Cuda::setupThreads( blockSize, blocksCount, gridsCount, threadsCount );
-    //std::cerr << " this->threadsPerSegment = " << this->threadsPerSegment << " offsets = " << offsets << std::endl;
-    for( unsigned int gridIdx = 0; gridIdx < gridsCount.x; gridIdx ++ )
-    {
-        dim3 gridSize;
-        TNL::Cuda::setupGrid( blocksCount, gridsCount, gridIdx, gridSize );
-        switch( this->threadsPerSegment )
-        {
-            case 0:      // this means zero/empty matrix
-                break;
-            case 1:
-                reduceSegmentsCSRHybridVectorKernel<  1, OffsetsView, Index, Fetch, Reduction, ResultKeeper, Real ><<< gridSize, blockSize >>>(
-                    gridIdx, offsets, first, last, fetch, reduction, keeper, zero );
-                    break;
-            case 2:
-                reduceSegmentsCSRHybridVectorKernel<  2, OffsetsView, Index, Fetch, Reduction, ResultKeeper, Real ><<< gridSize, blockSize >>>(
-                    gridIdx, offsets, first, last, fetch, reduction, keeper, zero );
-                    break;
-            case 4:
-                reduceSegmentsCSRHybridVectorKernel<  4, OffsetsView, Index, Fetch, Reduction, ResultKeeper, Real ><<< gridSize, blockSize >>>(
-                    gridIdx, offsets, first, last, fetch, reduction, keeper, zero );
-                    break;
-            case 8:
-                reduceSegmentsCSRHybridVectorKernel<  8, OffsetsView, Index, Fetch, Reduction, ResultKeeper, Real ><<< gridSize, blockSize >>>(
-                    gridIdx, offsets, first, last, fetch, reduction, keeper, zero );
-                    break;
-            case 16:
-                reduceSegmentsCSRHybridVectorKernel< 16, OffsetsView, Index, Fetch, Reduction, ResultKeeper, Real ><<< gridSize, blockSize >>>(
-                    gridIdx, offsets, first, last, fetch, reduction, keeper, zero );
-                    break;
-            case 32:
-                reduceSegmentsCSRHybridVectorKernel< 32, OffsetsView, Index, Fetch, Reduction, ResultKeeper, Real ><<< gridSize, blockSize >>>(
-                    gridIdx, offsets, first, last, fetch, reduction, keeper, zero );
-                    break;
-            case 64:
-                reduceSegmentsCSRHybridMultivectorKernel< ThreadsInBlock,  64, OffsetsView, Index, Fetch, Reduction, ResultKeeper, Real ><<< gridSize, blockSize >>>(
-                    gridIdx, offsets, first, last, fetch, reduction, keeper, zero );
-                    break;
-            case 128:
-                reduceSegmentsCSRHybridMultivectorKernel< ThreadsInBlock, 128, OffsetsView, Index, Fetch, Reduction, ResultKeeper, Real ><<< gridSize, blockSize >>>(
-                    gridIdx, offsets, first, last, fetch, reduction, keeper, zero );
-                    break;
-            case 256:
-                reduceSegmentsCSRHybridMultivectorKernel< ThreadsInBlock, 256, OffsetsView, Index, Fetch, Reduction, ResultKeeper, Real ><<< gridSize, blockSize >>>(
-                    gridIdx, offsets, first, last, fetch, reduction, keeper, zero );
-                    break;
-            default:
-                throw std::runtime_error( std::string( "Wrong value of threadsPerSegment: " ) + std::to_string( this->threadsPerSegment ) );
-        }
-    }
-    cudaStreamSynchronize(0);
-    TNL_CHECK_CUDA_DEVICE;
+   if( last <= first )
+      return;
+   const size_t threadsCount = this->threadsPerSegment * ( last - first );
+   dim3 blocksCount, gridsCount, blockSize( ThreadsInBlock );
+   TNL::Cuda::setupThreads( blockSize, blocksCount, gridsCount, threadsCount );
+   // std::cerr << " this->threadsPerSegment = " << this->threadsPerSegment << " offsets = " << offsets << std::endl;
+   for( unsigned int gridIdx = 0; gridIdx < gridsCount.x; gridIdx++ ) {
+      dim3 gridSize;
+      TNL::Cuda::setupGrid( blocksCount, gridsCount, gridIdx, gridSize );
+      switch( this->threadsPerSegment ) {
+         case 0:  // this means zero/empty matrix
+            break;
+         case 1:
+            reduceSegmentsCSRHybridVectorKernel< 1, OffsetsView, Index, Fetch, Reduction, ResultKeeper, Real > <<<
+               gridSize,
+               blockSize >>>( gridIdx, offsets, first, last, fetch, reduction, keeper, zero );
+            break;
+         case 2:
+            reduceSegmentsCSRHybridVectorKernel< 2, OffsetsView, Index, Fetch, Reduction, ResultKeeper, Real > <<<
+               gridSize,
+               blockSize >>>( gridIdx, offsets, first, last, fetch, reduction, keeper, zero );
+            break;
+         case 4:
+            reduceSegmentsCSRHybridVectorKernel< 4, OffsetsView, Index, Fetch, Reduction, ResultKeeper, Real > <<<
+               gridSize,
+               blockSize >>>( gridIdx, offsets, first, last, fetch, reduction, keeper, zero );
+            break;
+         case 8:
+            reduceSegmentsCSRHybridVectorKernel< 8, OffsetsView, Index, Fetch, Reduction, ResultKeeper, Real > <<<
+               gridSize,
+               blockSize >>>( gridIdx, offsets, first, last, fetch, reduction, keeper, zero );
+            break;
+         case 16:
+            reduceSegmentsCSRHybridVectorKernel< 16, OffsetsView, Index, Fetch, Reduction, ResultKeeper, Real >
+               <<< gridSize,
+               blockSize >>>( gridIdx, offsets, first, last, fetch, reduction, keeper, zero );
+            break;
+         case 32:
+            reduceSegmentsCSRHybridVectorKernel< 32, OffsetsView, Index, Fetch, Reduction, ResultKeeper, Real >
+               <<< gridSize,
+               blockSize >>>( gridIdx, offsets, first, last, fetch, reduction, keeper, zero );
+            break;
+         case 64:
+            reduceSegmentsCSRHybridMultivectorKernel< ThreadsInBlock,
+                                                      64,
+                                                      OffsetsView,
+                                                      Index,
+                                                      Fetch,
+                                                      Reduction,
+                                                      ResultKeeper,
+                                                      Real >
+               <<< gridSize,
+               blockSize >>>( gridIdx, offsets, first, last, fetch, reduction, keeper, zero );
+            break;
+         case 128:
+            reduceSegmentsCSRHybridMultivectorKernel< ThreadsInBlock,
+                                                      128,
+                                                      OffsetsView,
+                                                      Index,
+                                                      Fetch,
+                                                      Reduction,
+                                                      ResultKeeper,
+                                                      Real >
+               <<< gridSize,
+               blockSize >>>( gridIdx, offsets, first, last, fetch, reduction, keeper, zero );
+            break;
+         case 256:
+            reduceSegmentsCSRHybridMultivectorKernel< ThreadsInBlock,
+                                                      256,
+                                                      OffsetsView,
+                                                      Index,
+                                                      Fetch,
+                                                      Reduction,
+                                                      ResultKeeper,
+                                                      Real >
+               <<< gridSize,
+               blockSize >>>( gridIdx, offsets, first, last, fetch, reduction, keeper, zero );
+            break;
+         default:
+            throw std::runtime_error( std::string( "Wrong value of threadsPerSegment: " )
+                                      + std::to_string( this->threadsPerSegment ) );
+      }
+   }
+   cudaStreamSynchronize( 0 );
+   TNL_CHECK_CUDA_DEVICE;
 #endif
 }
 
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/Kernels/CSRLightKernel.h b/src/TNL/Algorithms/Segments/Kernels/CSRLightKernel.h
index 1a978558f04a046aa8b5289479884c91be35a0d7..b43d6528d8b55ee9af95f851b036e74bde1972a7 100644
--- a/src/TNL/Algorithms/Segments/Kernels/CSRLightKernel.h
+++ b/src/TNL/Algorithms/Segments/Kernels/CSRLightKernel.h
@@ -13,13 +13,17 @@
 #include <TNL/Algorithms/Segments/detail/LambdaAdapter.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
-enum LightCSRSThreadsMapping { LightCSRConstantThreads, CSRLightAutomaticThreads, CSRLightAutomaticThreadsLightSpMV };
+enum LightCSRSThreadsMapping
+{
+   LightCSRConstantThreads,
+   CSRLightAutomaticThreads,
+   CSRLightAutomaticThreadsLightSpMV
+};
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 struct CSRLightKernel
 {
    using IndexType = Index;
@@ -28,49 +32,54 @@ struct CSRLightKernel
    using ConstViewType = CSRLightKernel< Index, Device >;
 
    template< typename Offsets >
-   void init( const Offsets& offsets );
-
-   void reset();
-
-   ViewType getView();
+   void
+   init( const Offsets& offsets );
 
-   ConstViewType getConstView() const;
+   void
+   reset();
 
-   static TNL::String getKernelType();
+   ViewType
+   getView();
 
-   TNL::String getSetup() const;
+   ConstViewType
+   getConstView() const;
 
-   template< typename OffsetsView,
-             typename Fetch,
-             typename Reduction,
-             typename ResultKeeper,
-             typename Real >
-   void reduceSegments( const OffsetsView& offsets,
-                        Index first,
-                        Index last,
-                        Fetch& fetch,
-                        const Reduction& reduction,
-                        ResultKeeper& keeper,
-                        const Real& zero ) const;
+   static TNL::String
+   getKernelType();
 
+   TNL::String
+   getSetup() const;
 
-   void setThreadsMapping( LightCSRSThreadsMapping mapping );
+   template< typename OffsetsView, typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+   void
+   reduceSegments( const OffsetsView& offsets,
+                   Index first,
+                   Index last,
+                   Fetch& fetch,
+                   const Reduction& reduction,
+                   ResultKeeper& keeper,
+                   const Real& zero ) const;
 
-   LightCSRSThreadsMapping getThreadsMapping() const;
+   void
+   setThreadsMapping( LightCSRSThreadsMapping mapping );
 
-   void setThreadsPerSegment( int threadsPerSegment );
+   LightCSRSThreadsMapping
+   getThreadsMapping() const;
 
-   int getThreadsPerSegment() const;
+   void
+   setThreadsPerSegment( int threadsPerSegment );
 
-   protected:
+   int
+   getThreadsPerSegment() const;
 
-      LightCSRSThreadsMapping mapping = CSRLightAutomaticThreads;
+protected:
+   LightCSRSThreadsMapping mapping = CSRLightAutomaticThreads;
 
-      int threadsPerSegment = 32;
+   int threadsPerSegment = 32;
 };
 
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
 
 #include <TNL/Algorithms/Segments/Kernels/CSRLightKernel.hpp>
diff --git a/src/TNL/Algorithms/Segments/Kernels/CSRLightKernel.hpp b/src/TNL/Algorithms/Segments/Kernels/CSRLightKernel.hpp
index 973ca4cb45602a0914a1593b5384e541d950c3e1..51e4ad15bd63f27bcb3275577d094090b1097adf 100644
--- a/src/TNL/Algorithms/Segments/Kernels/CSRLightKernel.hpp
+++ b/src/TNL/Algorithms/Segments/Kernels/CSRLightKernel.hpp
@@ -14,154 +14,137 @@
 #include <TNL/Algorithms/Segments/Kernels/CSRLightKernel.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
 #ifdef HAVE_CUDA
-template< typename Real,
-          typename Index,
-          typename OffsetsView,
-          typename Fetch,
-          typename Reduce,
-          typename Keep >
+template< typename Real, typename Index, typename OffsetsView, typename Fetch, typename Reduce, typename Keep >
 __global__
-void SpMVCSRLight2( OffsetsView offsets,
-                                 const Index first,
-                                 const Index last,
-                                 Fetch fetch,
-                                 Reduce reduce,
-                                 Keep keep,
-                                 const Real zero,
-                                 const Index gridID)
+void
+SpMVCSRLight2( OffsetsView offsets,
+               const Index first,
+               const Index last,
+               Fetch fetch,
+               Reduce reduce,
+               Keep keep,
+               const Real zero,
+               const Index gridID )
 {
    const Index segmentIdx =
-      first + ( ( gridID * TNL::Cuda::getMaxGridXSize() ) + (blockIdx.x * blockDim.x) + threadIdx.x ) / 2;
+      first + ( ( gridID * TNL::Cuda::getMaxGridXSize() ) + ( blockIdx.x * blockDim.x ) + threadIdx.x ) / 2;
    if( segmentIdx >= last )
       return;
 
-   const Index inGroupID = threadIdx.x & 1; // & is cheaper than %
-   const Index maxID = offsets[ segmentIdx  + 1];
+   const Index inGroupID = threadIdx.x & 1;  // & is cheaper than %
+   const Index maxID = offsets[ segmentIdx + 1 ];
 
    Real result = zero;
    bool compute = true;
-   for( Index i = offsets[segmentIdx] + inGroupID; i < maxID; i += 2)
+   for( Index i = offsets[ segmentIdx ] + inGroupID; i < maxID; i += 2 )
       result = reduce( result, fetch( i, compute ) );
 
    /* Parallel reduction */
-   result = reduce( result, __shfl_down_sync(0xFFFFFFFF, result, 1 ) );
+   result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 1 ) );
 
    /* Write result */
    if( inGroupID == 0 )
       keep( segmentIdx, result );
 }
 
-template< typename Real,
-          typename Index,
-          typename OffsetsView,
-          typename Fetch,
-          typename Reduce,
-          typename Keep >
+template< typename Real, typename Index, typename OffsetsView, typename Fetch, typename Reduce, typename Keep >
 __global__
-void SpMVCSRLight4( OffsetsView offsets,
-                                 const Index first,
-                                 const Index last,
-                                 Fetch fetch,
-                                 Reduce reduce,
-                                 Keep keep,
-                                 const Real zero,
-                                 const Index gridID )
+void
+SpMVCSRLight4( OffsetsView offsets,
+               const Index first,
+               const Index last,
+               Fetch fetch,
+               Reduce reduce,
+               Keep keep,
+               const Real zero,
+               const Index gridID )
 {
    const Index segmentIdx =
-      first + ((gridID * TNL::Cuda::getMaxGridXSize() ) + (blockIdx.x * blockDim.x) + threadIdx.x) / 4;
-   if (segmentIdx >= last)
+      first + ( ( gridID * TNL::Cuda::getMaxGridXSize() ) + ( blockIdx.x * blockDim.x ) + threadIdx.x ) / 4;
+   if( segmentIdx >= last )
       return;
 
-   const Index inGroupID = threadIdx.x & 3; // & is cheaper than %
-   const Index maxID = offsets[segmentIdx + 1];
+   const Index inGroupID = threadIdx.x & 3;  // & is cheaper than %
+   const Index maxID = offsets[ segmentIdx + 1 ];
 
    Real result = zero;
    bool compute = true;
-   for (Index i = offsets[segmentIdx] + inGroupID; i < maxID; i += 4)
+   for( Index i = offsets[ segmentIdx ] + inGroupID; i < maxID; i += 4 )
       result = reduce( result, fetch( i, compute ) );
 
    /* Parallel reduction */
-   result = reduce( result, __shfl_down_sync(0xFFFFFFFF, result, 2 ) );
-   result = reduce( result, __shfl_down_sync(0xFFFFFFFF, result, 1 ) );
+   result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 2 ) );
+   result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 1 ) );
 
    /* Write result */
    if( inGroupID == 0 )
       keep( segmentIdx, result );
-
 }
 
-template< typename Real,
-          typename Index,
-          typename OffsetsView,
-          typename Fetch,
-          typename Reduce,
-          typename Keep >
+template< typename Real, typename Index, typename OffsetsView, typename Fetch, typename Reduce, typename Keep >
 __global__
-void SpMVCSRLight8( OffsetsView offsets,
-                                 const Index first,
-                                 const Index last,
-                                 Fetch fetch,
-                                 Reduce reduce,
-                                 Keep keep,
-                                 const Real zero,
-                                 const Index gridID)
+void
+SpMVCSRLight8( OffsetsView offsets,
+               const Index first,
+               const Index last,
+               Fetch fetch,
+               Reduce reduce,
+               Keep keep,
+               const Real zero,
+               const Index gridID )
 {
    const Index segmentIdx =
-      first + ((gridID * TNL::Cuda::getMaxGridXSize() ) + (blockIdx.x * blockDim.x) + threadIdx.x) / 8;
-   if (segmentIdx >= last)
+      first + ( ( gridID * TNL::Cuda::getMaxGridXSize() ) + ( blockIdx.x * blockDim.x ) + threadIdx.x ) / 8;
+   if( segmentIdx >= last )
       return;
 
    Index i;
-   const Index inGroupID = threadIdx.x & 7; // & is cheaper than %
-   const Index maxID = offsets[segmentIdx + 1];
+   const Index inGroupID = threadIdx.x & 7;  // & is cheaper than %
+   const Index maxID = offsets[ segmentIdx + 1 ];
 
    Real result = zero;
    bool compute = true;
-   for (i = offsets[segmentIdx] + inGroupID; i < maxID; i += 8)
+   for( i = offsets[ segmentIdx ] + inGroupID; i < maxID; i += 8 )
       result = reduce( result, fetch( i, compute ) );
 
    /* Parallel reduction */
-   result = reduce( result, __shfl_down_sync(0xFFFFFFFF, result, 4 ) );
-   result = reduce( result, __shfl_down_sync(0xFFFFFFFF, result, 2 ) );
-   result = reduce( result, __shfl_down_sync(0xFFFFFFFF, result, 1 ) );
+   result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 4 ) );
+   result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 2 ) );
+   result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 1 ) );
 
    /* Write result */
    if( inGroupID == 0 )
       keep( segmentIdx, result );
 }
 
-template< typename Real,
-          typename Index,
-          typename OffsetsView,
-          typename Fetch,
-          typename Reduce,
-          typename Keep >
+template< typename Real, typename Index, typename OffsetsView, typename Fetch, typename Reduce, typename Keep >
 __global__
-void SpMVCSRLight16( OffsetsView offsets,
-                                  const Index first,
-                                  const Index last,
-                                  Fetch fetch,
-                                  Reduce reduce,
-                                  Keep keep,
-                                  const Real zero,
-                                  const Index gridID )
+void
+SpMVCSRLight16( OffsetsView offsets,
+                const Index first,
+                const Index last,
+                Fetch fetch,
+                Reduce reduce,
+                Keep keep,
+                const Real zero,
+                const Index gridID )
 {
    const Index segmentIdx =
-      first + ((gridID * TNL::Cuda::getMaxGridXSize() ) + (blockIdx.x * blockDim.x) + threadIdx.x ) / 16;
+      first + ( ( gridID * TNL::Cuda::getMaxGridXSize() ) + ( blockIdx.x * blockDim.x ) + threadIdx.x ) / 16;
    if( segmentIdx >= last )
       return;
 
    Index i;
-   const Index inGroupID = threadIdx.x & 15; // & is cheaper than %
-   const Index maxID = offsets[segmentIdx + 1];
+   const Index inGroupID = threadIdx.x & 15;  // & is cheaper than %
+   const Index maxID = offsets[ segmentIdx + 1 ];
 
    Real result = zero;
    bool compute = true;
-   for( i = offsets[segmentIdx] + inGroupID; i < maxID; i += 16 )
+   for( i = offsets[ segmentIdx ] + inGroupID; i < maxID; i += 16 )
       result = reduce( result, fetch( i, compute ) );
 
    /* Parallel reduction */
@@ -224,58 +207,62 @@ template< int ThreadsPerSegment,
           typename Reduce,
           typename Keep >
 __global__
-void SpMVCSRVector( OffsetsView offsets,
-                    const Index first,
-                    const Index last,
-                    Fetch fetch,
-                    Reduce reduce,
-                    Keep keep,
-                    const Real zero,
-                    const Index gridID )
+void
+SpMVCSRVector( OffsetsView offsets,
+               const Index first,
+               const Index last,
+               Fetch fetch,
+               Reduce reduce,
+               Keep keep,
+               const Real zero,
+               const Index gridID )
 {
-   //const int warpSize = 32;
-   const Index warpID = first + ((gridID * TNL::Cuda::getMaxGridXSize() ) + (blockIdx.x * blockDim.x) + threadIdx.x) / ThreadsPerSegment;
-   if (warpID >= last)
+   // const int warpSize = 32;
+   const Index warpID =
+      first + ( ( gridID * TNL::Cuda::getMaxGridXSize() ) + ( blockIdx.x * blockDim.x ) + threadIdx.x ) / ThreadsPerSegment;
+   if( warpID >= last )
       return;
 
    Real result = zero;
-   const Index laneID = threadIdx.x & ( ThreadsPerSegment - 1 ); // & is cheaper than %
-   Index endID = offsets[warpID + 1];
+   const Index laneID = threadIdx.x & ( ThreadsPerSegment - 1 );  // & is cheaper than %
+   Index endID = offsets[ warpID + 1 ];
 
    // Calculate result
    bool compute = true;
-   for (Index i = offsets[warpID] + laneID; i < endID; i += ThreadsPerSegment )
+   for( Index i = offsets[ warpID ] + laneID; i < endID; i += ThreadsPerSegment )
       result = reduce( result, fetch( i, compute ) );
 
    // Reduction
-   if( ThreadsPerSegment > 16 )
-   {
-      result = reduce( result, __shfl_down_sync(0xFFFFFFFF, result, 16 ) );
-      result = reduce( result, __shfl_down_sync(0xFFFFFFFF, result,  8 ) );
-      result = reduce( result, __shfl_down_sync(0xFFFFFFFF, result,  4 ) );
-      result = reduce( result, __shfl_down_sync(0xFFFFFFFF, result,  2 ) );
-      result = reduce( result, __shfl_down_sync(0xFFFFFFFF, result,  1 ) );
-   } else if( ThreadsPerSegment > 8 ) {
-      result = reduce( result, __shfl_down_sync(0xFFFFFFFF, result,  8 ) );
-      result = reduce( result, __shfl_down_sync(0xFFFFFFFF, result,  4 ) );
-      result = reduce( result, __shfl_down_sync(0xFFFFFFFF, result,  2 ) );
-      result = reduce( result, __shfl_down_sync(0xFFFFFFFF, result,  1 ) );
-   } else if( ThreadsPerSegment > 4 ) {
-      result = reduce( result, __shfl_down_sync(0xFFFFFFFF, result,  4 ) );
-      result = reduce( result, __shfl_down_sync(0xFFFFFFFF, result,  2 ) );
-      result = reduce( result, __shfl_down_sync(0xFFFFFFFF, result,  1 ) );
-   } else if( ThreadsPerSegment > 2 ) {
-      result = reduce( result, __shfl_down_sync(0xFFFFFFFF, result,  2 ) );
-      result = reduce( result, __shfl_down_sync(0xFFFFFFFF, result,  1 ) );
-   } else if( ThreadsPerSegment > 1 )
-      result = reduce( result, __shfl_down_sync(0xFFFFFFFF, result,  1 ) );
+   if( ThreadsPerSegment > 16 ) {
+      result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 16 ) );
+      result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 8 ) );
+      result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 4 ) );
+      result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 2 ) );
+      result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 1 ) );
+   }
+   else if( ThreadsPerSegment > 8 ) {
+      result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 8 ) );
+      result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 4 ) );
+      result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 2 ) );
+      result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 1 ) );
+   }
+   else if( ThreadsPerSegment > 4 ) {
+      result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 4 ) );
+      result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 2 ) );
+      result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 1 ) );
+   }
+   else if( ThreadsPerSegment > 2 ) {
+      result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 2 ) );
+      result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 1 ) );
+   }
+   else if( ThreadsPerSegment > 1 )
+      result = reduce( result, __shfl_down_sync( 0xFFFFFFFF, result, 1 ) );
 
    // Store result
    if( laneID == 0 )
       keep( warpID, result );
 }
 
-
 template< int BlockSize,
           int ThreadsPerSegment,
           typename Offsets,
@@ -285,85 +272,78 @@ template< int BlockSize,
           typename ResultKeeper,
           typename Real >
 __global__
-void reduceSegmentsCSRLightMultivectorKernel(
-    int gridIdx,
-    const Offsets offsets,
-    Index first,
-    Index last,
-    Fetch fetch,
-    const Reduction reduce,
-    ResultKeeper keep,
-    const Real zero )
+void
+reduceSegmentsCSRLightMultivectorKernel( int gridIdx,
+                                         const Offsets offsets,
+                                         Index first,
+                                         Index last,
+                                         Fetch fetch,
+                                         const Reduction reduce,
+                                         ResultKeeper keep,
+                                         const Real zero )
 {
-    const Index segmentIdx =  TNL::Cuda::getGlobalThreadIdx( gridIdx ) / ThreadsPerSegment + first;
-    if( segmentIdx >= last )
-        return;
-
-    __shared__ Real shared[ BlockSize / 32 ];
-    if( threadIdx.x < BlockSize / TNL::Cuda::getWarpSize() )
-        shared[ threadIdx.x ] = zero;
-
-    const int laneIdx = threadIdx.x & ( ThreadsPerSegment - 1 ); // & is cheaper than %
-    const int inWarpLaneIdx = threadIdx.x & ( TNL::Cuda::getWarpSize() - 1 ); // & is cheaper than %
-    const Index beginIdx = offsets[ segmentIdx ];
-    const Index endIdx   = offsets[ segmentIdx + 1 ] ;
-
-    Real result = zero;
-    bool compute( true );
-    Index localIdx = laneIdx;
-    for( Index globalIdx = beginIdx + laneIdx; globalIdx < endIdx && compute; globalIdx += ThreadsPerSegment )
-    {
-       result = reduce( result, detail::FetchLambdaAdapter< Index, Fetch >::call( fetch, segmentIdx, localIdx, globalIdx, compute ) );
-       localIdx += ThreadsPerSegment;
-    }
-    result += __shfl_down_sync(0xFFFFFFFF, result, 16);
-    result += __shfl_down_sync(0xFFFFFFFF, result, 8);
-    result += __shfl_down_sync(0xFFFFFFFF, result, 4);
-    result += __shfl_down_sync(0xFFFFFFFF, result, 2);
-    result += __shfl_down_sync(0xFFFFFFFF, result, 1);
-
-    const Index warpIdx = threadIdx.x / TNL::Cuda::getWarpSize();
-    if( inWarpLaneIdx == 0 )
-        shared[ warpIdx ] = result;
-
-    __syncthreads();
-    // Reduction in shared
-    if( warpIdx == 0 && inWarpLaneIdx < 16 )
-    {
-        //constexpr int totalWarps = BlockSize / WarpSize;
-        constexpr int warpsPerSegment = ThreadsPerSegment / TNL::Cuda::getWarpSize();
-        if( warpsPerSegment >= 32 )
-        {
-            shared[ inWarpLaneIdx ] =  reduce( shared[ inWarpLaneIdx ], shared[ inWarpLaneIdx + 16 ] );
-            __syncwarp();
-        }
-        if( warpsPerSegment >= 16 )
-        {
-            shared[ inWarpLaneIdx ] =  reduce( shared[ inWarpLaneIdx ], shared[ inWarpLaneIdx +  8 ] );
-            __syncwarp();
-        }
-        if( warpsPerSegment >= 8 )
-        {
-            shared[ inWarpLaneIdx ] =  reduce( shared[ inWarpLaneIdx ], shared[ inWarpLaneIdx +  4 ] );
-            __syncwarp();
-        }
-        if( warpsPerSegment >= 4 )
-        {
-            shared[ inWarpLaneIdx ] =  reduce( shared[ inWarpLaneIdx ], shared[ inWarpLaneIdx +  2 ] );
-            __syncwarp();
-        }
-        if( warpsPerSegment >= 2 )
-        {
-            shared[ inWarpLaneIdx ] =  reduce( shared[ inWarpLaneIdx ], shared[ inWarpLaneIdx +  1 ] );
-            __syncwarp();
-        }
-        constexpr int segmentsCount = BlockSize / ThreadsPerSegment;
-        if( inWarpLaneIdx < segmentsCount && segmentIdx + inWarpLaneIdx < last )
-        {
-            //printf( "Long: segmentIdx %d -> %d \n", segmentIdx, aux );
-            keep( segmentIdx + inWarpLaneIdx, shared[ inWarpLaneIdx * ThreadsPerSegment / 32 ] );
-        }
-    }
+   const Index segmentIdx = TNL::Cuda::getGlobalThreadIdx( gridIdx ) / ThreadsPerSegment + first;
+   if( segmentIdx >= last )
+      return;
+
+   __shared__ Real shared[ BlockSize / 32 ];
+   if( threadIdx.x < BlockSize / TNL::Cuda::getWarpSize() )
+      shared[ threadIdx.x ] = zero;
+
+   const int laneIdx = threadIdx.x & ( ThreadsPerSegment - 1 );               // & is cheaper than %
+   const int inWarpLaneIdx = threadIdx.x & ( TNL::Cuda::getWarpSize() - 1 );  // & is cheaper than %
+   const Index beginIdx = offsets[ segmentIdx ];
+   const Index endIdx = offsets[ segmentIdx + 1 ];
+
+   Real result = zero;
+   bool compute( true );
+   Index localIdx = laneIdx;
+   for( Index globalIdx = beginIdx + laneIdx; globalIdx < endIdx && compute; globalIdx += ThreadsPerSegment ) {
+      result =
+         reduce( result, detail::FetchLambdaAdapter< Index, Fetch >::call( fetch, segmentIdx, localIdx, globalIdx, compute ) );
+      localIdx += ThreadsPerSegment;
+   }
+   result += __shfl_down_sync( 0xFFFFFFFF, result, 16 );
+   result += __shfl_down_sync( 0xFFFFFFFF, result, 8 );
+   result += __shfl_down_sync( 0xFFFFFFFF, result, 4 );
+   result += __shfl_down_sync( 0xFFFFFFFF, result, 2 );
+   result += __shfl_down_sync( 0xFFFFFFFF, result, 1 );
+
+   const Index warpIdx = threadIdx.x / TNL::Cuda::getWarpSize();
+   if( inWarpLaneIdx == 0 )
+      shared[ warpIdx ] = result;
+
+   __syncthreads();
+   // Reduction in shared
+   if( warpIdx == 0 && inWarpLaneIdx < 16 ) {
+      // constexpr int totalWarps = BlockSize / WarpSize;
+      constexpr int warpsPerSegment = ThreadsPerSegment / TNL::Cuda::getWarpSize();
+      if( warpsPerSegment >= 32 ) {
+         shared[ inWarpLaneIdx ] = reduce( shared[ inWarpLaneIdx ], shared[ inWarpLaneIdx + 16 ] );
+         __syncwarp();
+      }
+      if( warpsPerSegment >= 16 ) {
+         shared[ inWarpLaneIdx ] = reduce( shared[ inWarpLaneIdx ], shared[ inWarpLaneIdx + 8 ] );
+         __syncwarp();
+      }
+      if( warpsPerSegment >= 8 ) {
+         shared[ inWarpLaneIdx ] = reduce( shared[ inWarpLaneIdx ], shared[ inWarpLaneIdx + 4 ] );
+         __syncwarp();
+      }
+      if( warpsPerSegment >= 4 ) {
+         shared[ inWarpLaneIdx ] = reduce( shared[ inWarpLaneIdx ], shared[ inWarpLaneIdx + 2 ] );
+         __syncwarp();
+      }
+      if( warpsPerSegment >= 2 ) {
+         shared[ inWarpLaneIdx ] = reduce( shared[ inWarpLaneIdx ], shared[ inWarpLaneIdx + 1 ] );
+         __syncwarp();
+      }
+      constexpr int segmentsCount = BlockSize / ThreadsPerSegment;
+      if( inWarpLaneIdx < segmentsCount && segmentIdx + inWarpLaneIdx < last ) {
+         // printf( "Long: segmentIdx %d -> %d \n", segmentIdx, aux );
+         keep( segmentIdx + inWarpLaneIdx, shared[ inWarpLaneIdx * ThreadsPerSegment / 32 ] );
+      }
+   }
 }
 
 #endif
@@ -373,104 +353,88 @@ template< typename Index,
           typename Reduce,
           typename Keep,
           bool DispatchScalarCSR =
-            detail::CheckFetchLambda< Index, Fetch >::hasAllParameters() ||
-            std::is_same< Device, Devices::Host >::value >
+             detail::CheckFetchLambda< Index, Fetch >::hasAllParameters() || std::is_same< Device, Devices::Host >::value >
 struct CSRLightKernelreduceSegmentsDispatcher;
 
-template< typename Index,
-          typename Device,
-          typename Fetch,
-          typename Reduction,
-          typename ResultKeeper >
+template< typename Index, typename Device, typename Fetch, typename Reduction, typename ResultKeeper >
 struct CSRLightKernelreduceSegmentsDispatcher< Index, Device, Fetch, Reduction, ResultKeeper, true >
 {
-
-   template< typename Offsets,
-             typename Real >
-   static void reduce( const Offsets& offsets,
-                       Index first,
-                       Index last,
-                       Fetch& fetch,
-                       const Reduction& reduce,
-                       ResultKeeper& keep,
-                       const Real& zero,
-                       const Index threadsPerSegment )
+   template< typename Offsets, typename Real >
+   static void
+   reduce( const Offsets& offsets,
+           Index first,
+           Index last,
+           Fetch& fetch,
+           const Reduction& reduce,
+           ResultKeeper& keep,
+           const Real& zero,
+           const Index threadsPerSegment )
    {
-      TNL::Algorithms::Segments::CSRScalarKernel< Index, Device >::
-         reduceSegments( offsets, first, last, fetch, reduce, keep, zero );
+      TNL::Algorithms::Segments::CSRScalarKernel< Index, Device >::reduceSegments(
+         offsets, first, last, fetch, reduce, keep, zero );
    }
 };
 
-template< typename Index,
-          typename Device,
-          typename Fetch,
-          typename Reduce,
-          typename Keep >
+template< typename Index, typename Device, typename Fetch, typename Reduce, typename Keep >
 struct CSRLightKernelreduceSegmentsDispatcher< Index, Device, Fetch, Reduce, Keep, false >
 {
-   template< typename OffsetsView,
-             typename Real >
-   static void reduce( const OffsetsView& offsets,
-                       Index first,
-                       Index last,
-                       Fetch& fetch,
-                       const Reduce& reduce,
-                       Keep& keep,
-                       const Real& zero,
-                       const Index threadsPerSegment )
+   template< typename OffsetsView, typename Real >
+   static void
+   reduce( const OffsetsView& offsets,
+           Index first,
+           Index last,
+           Fetch& fetch,
+           const Reduce& reduce,
+           Keep& keep,
+           const Real& zero,
+           const Index threadsPerSegment )
    {
 #ifdef HAVE_CUDA
-    if( last <= first )
-       return;
+      if( last <= first )
+         return;
 
       const size_t threads = 128;
       Index blocks, groupSize;
 
-      size_t  neededThreads = threadsPerSegment * ( last - first );
+      size_t neededThreads = threadsPerSegment * ( last - first );
 
-      for (Index grid = 0; neededThreads != 0; ++grid)
-      {
-         if( TNL::Cuda::getMaxGridXSize() * threads >= neededThreads)
-         {
-            blocks = roundUpDivision(neededThreads, threads);
+      for( Index grid = 0; neededThreads != 0; ++grid ) {
+         if( TNL::Cuda::getMaxGridXSize() * threads >= neededThreads ) {
+            blocks = roundUpDivision( neededThreads, threads );
             neededThreads = 0;
          }
-         else
-         {
+         else {
             blocks = TNL::Cuda::getMaxGridXSize();
             neededThreads -= TNL::Cuda::getMaxGridXSize() * threads;
          }
 
          if( threadsPerSegment == 1 )
-            SpMVCSRVector< 1, Real, Index, OffsetsView, Fetch, Reduce, Keep ><<< blocks, threads >>>(
-               offsets, first, last, fetch, reduce, keep, zero, grid );
+            SpMVCSRVector< 1, Real, Index, OffsetsView, Fetch, Reduce, Keep > <<< blocks,
+               threads >>>( offsets, first, last, fetch, reduce, keep, zero, grid );
          if( threadsPerSegment == 2 )
-            SpMVCSRVector< 2, Real, Index, OffsetsView, Fetch, Reduce, Keep ><<< blocks, threads >>>(
-               offsets, first, last, fetch, reduce, keep, zero, grid );
+            SpMVCSRVector< 2, Real, Index, OffsetsView, Fetch, Reduce, Keep > <<< blocks,
+               threads >>>( offsets, first, last, fetch, reduce, keep, zero, grid );
          if( threadsPerSegment == 4 )
-            SpMVCSRVector< 4, Real, Index, OffsetsView, Fetch, Reduce, Keep ><<< blocks, threads >>>(
-               offsets, first, last, fetch, reduce, keep, zero, grid );
+            SpMVCSRVector< 4, Real, Index, OffsetsView, Fetch, Reduce, Keep > <<< blocks,
+               threads >>>( offsets, first, last, fetch, reduce, keep, zero, grid );
          if( threadsPerSegment == 8 )
-            SpMVCSRVector< 8, Real, Index, OffsetsView, Fetch, Reduce, Keep ><<< blocks, threads >>>(
-               offsets, first, last, fetch, reduce, keep, zero, grid );
+            SpMVCSRVector< 8, Real, Index, OffsetsView, Fetch, Reduce, Keep > <<< blocks,
+               threads >>>( offsets, first, last, fetch, reduce, keep, zero, grid );
          if( threadsPerSegment == 16 )
-            SpMVCSRVector< 16, Real, Index, OffsetsView, Fetch, Reduce, Keep ><<< blocks, threads >>>(
-               offsets, first, last, fetch, reduce, keep, zero, grid );
+            SpMVCSRVector< 16, Real, Index, OffsetsView, Fetch, Reduce, Keep > <<< blocks,
+               threads >>>( offsets, first, last, fetch, reduce, keep, zero, grid );
          if( threadsPerSegment == 32 )
-            SpMVCSRVector< 32, Real, Index, OffsetsView, Fetch, Reduce, Keep ><<< blocks, threads >>>(
-               offsets, first, last, fetch, reduce, keep, zero, grid );
-         if( threadsPerSegment == 64 )
-         { // Execute CSR MultiVector
-            reduceSegmentsCSRLightMultivectorKernel< 128, 64 ><<<blocks, threads>>>(
-                     grid, offsets, first, last, fetch, reduce, keep, zero );
+            SpMVCSRVector< 32, Real, Index, OffsetsView, Fetch, Reduce, Keep > <<< blocks,
+               threads >>>( offsets, first, last, fetch, reduce, keep, zero, grid );
+         if( threadsPerSegment == 64 ) {  // Execute CSR MultiVector
+            reduceSegmentsCSRLightMultivectorKernel< 128, 64 > <<<blocks,
+               threads>>>( grid, offsets, first, last, fetch, reduce, keep, zero );
          }
-         if (threadsPerSegment >= 128 )
-         { // Execute CSR MultiVector
-            reduceSegmentsCSRLightMultivectorKernel< 128, 128 ><<<blocks, threads>>>(
-                     grid, offsets, first, last, fetch, reduce, keep, zero );
+         if( threadsPerSegment >= 128 ) {  // Execute CSR MultiVector
+            reduceSegmentsCSRLightMultivectorKernel< 128, 128 > <<<blocks,
+               threads>>>( grid, offsets, first, last, fetch, reduce, keep, zero );
          }
 
-
          /*if (threadsPerSegment == 2)
             SpMVCSRLight2<Real, Index, OffsetsView, Fetch, Reduce, Keep ><<<blocks, threads>>>(
                offsets, first, last, fetch, reduce, keep, zero, grid );
@@ -499,28 +463,25 @@ struct CSRLightKernelreduceSegmentsDispatcher< Index, Device, Fetch, Reduce, Kee
                      grid, offsets, first, last, fetch, reduce, keep, zero );
          }*/
       }
-      cudaStreamSynchronize(0);
+      cudaStreamSynchronize( 0 );
       TNL_CHECK_CUDA_DEVICE;
 #endif
    }
 };
 
-
-template< typename Index,
-          typename Device >
-    template< typename Offsets >
+template< typename Index, typename Device >
+template< typename Offsets >
 void
-CSRLightKernel< Index, Device >::
-init( const Offsets& offsets )
+CSRLightKernel< Index, Device >::init( const Offsets& offsets )
 {
    TNL_ASSERT_GT( offsets.getSize(), 0, "offsets size must be strictly positive" );
    const Index segmentsCount = offsets.getSize() - 1;
-    if( segmentsCount <= 0 )
-       return;
+   if( segmentsCount <= 0 )
+      return;
 
-   if( this->getThreadsMapping() == CSRLightAutomaticThreads )
-   {
-      const Index elementsInSegment = roundUpDivision( offsets.getElement( segmentsCount ), segmentsCount ); // non zeroes per row
+   if( this->getThreadsMapping() == CSRLightAutomaticThreads ) {
+      const Index elementsInSegment =
+         roundUpDivision( offsets.getElement( segmentsCount ), segmentsCount );  // non zeroes per row
       if( elementsInSegment <= 2 )
          setThreadsPerSegment( 2 );
       else if( elementsInSegment <= 4 )
@@ -529,15 +490,15 @@ init( const Offsets& offsets )
          setThreadsPerSegment( 8 );
       else if( elementsInSegment <= 16 )
          setThreadsPerSegment( 16 );
-      else //if (nnz <= 2 * matrix.MAX_ELEMENTS_PER_WARP)
-         setThreadsPerSegment( 32 ); // CSR Vector
-      //else
-      //   threadsPerSegment = roundUpDivision(nnz, matrix.MAX_ELEMENTS_PER_WARP) * 32; // CSR MultiVector
+      else                            // if (nnz <= 2 * matrix.MAX_ELEMENTS_PER_WARP)
+         setThreadsPerSegment( 32 );  // CSR Vector
+      // else
+      //    threadsPerSegment = roundUpDivision(nnz, matrix.MAX_ELEMENTS_PER_WARP) * 32; // CSR MultiVector
    }
 
-   if( this->getThreadsMapping() == CSRLightAutomaticThreadsLightSpMV )
-   {
-      const Index elementsInSegment = roundUpDivision( offsets.getElement( segmentsCount ), segmentsCount ); // non zeroes per row
+   if( this->getThreadsMapping() == CSRLightAutomaticThreadsLightSpMV ) {
+      const Index elementsInSegment =
+         roundUpDivision( offsets.getElement( segmentsCount ), segmentsCount );  // non zeroes per row
       if( elementsInSegment <= 2 )
          setThreadsPerSegment( 2 );
       else if( elementsInSegment <= 4 )
@@ -546,66 +507,51 @@ init( const Offsets& offsets )
          setThreadsPerSegment( 8 );
       else if( elementsInSegment <= 16 )
          setThreadsPerSegment( 16 );
-      else //if (nnz <= 2 * matrix.MAX_ELEMENTS_PER_WARP)
-         setThreadsPerSegment( 32 ); // CSR Vector
-      //else
-      //   threadsPerSegment = roundUpDivision(nnz, matrix.MAX_ELEMENTS_PER_WARP) * 32; // CSR MultiVector
+      else                            // if (nnz <= 2 * matrix.MAX_ELEMENTS_PER_WARP)
+         setThreadsPerSegment( 32 );  // CSR Vector
+      // else
+      //    threadsPerSegment = roundUpDivision(nnz, matrix.MAX_ELEMENTS_PER_WARP) * 32; // CSR MultiVector
    }
 }
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 void
-CSRLightKernel< Index, Device >::
-reset()
+CSRLightKernel< Index, Device >::reset()
 {
    this->threadsPerSegment = 0;
 }
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 auto
-CSRLightKernel< Index, Device >::
-getView() -> ViewType
+CSRLightKernel< Index, Device >::getView() -> ViewType
 {
-    return *this;
+   return *this;
 }
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 TNL::String
-CSRLightKernel< Index, Device >::
-getKernelType()
+CSRLightKernel< Index, Device >::getKernelType()
 {
-    return "Light";
+   return "Light";
 }
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 auto
-CSRLightKernel< Index, Device >::
-getConstView() const -> ConstViewType
+CSRLightKernel< Index, Device >::getConstView() const -> ConstViewType
 {
-    return *this;
+   return *this;
 };
 
-
-template< typename Index,
-          typename Device >
-    template< typename OffsetsView,
-              typename Fetch,
-              typename Reduce,
-              typename Keep,
-              typename Real >
+template< typename Index, typename Device >
+template< typename OffsetsView, typename Fetch, typename Reduce, typename Keep, typename Real >
 void
-CSRLightKernel< Index, Device >::
-reduceSegments( const OffsetsView& offsets,
-                Index first,
-                Index last,
-                Fetch& fetch,
-                const Reduce& reduce,
-                Keep& keep,
-                const Real& zero ) const
+CSRLightKernel< Index, Device >::reduceSegments( const OffsetsView& offsets,
+                                                 Index first,
+                                                 Index last,
+                                                 Fetch& fetch,
+                                                 const Reduce& reduce,
+                                                 Keep& keep,
+                                                 const Real& zero ) const
 {
    TNL_ASSERT_GE( this->threadsPerSegment, 0, "" );
    TNL_ASSERT_LE( this->threadsPerSegment, 33, "" );
@@ -613,50 +559,37 @@ reduceSegments( const OffsetsView& offsets,
       offsets, first, last, fetch, reduce, keep, zero, this->threadsPerSegment );
 }
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 void
-CSRLightKernel< Index, Device >::
-setThreadsMapping( LightCSRSThreadsMapping mapping )
+CSRLightKernel< Index, Device >::setThreadsMapping( LightCSRSThreadsMapping mapping )
 {
-   this-> mapping = mapping;
+   this->mapping = mapping;
 }
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 LightCSRSThreadsMapping
-CSRLightKernel< Index, Device >::
-getThreadsMapping() const
+CSRLightKernel< Index, Device >::getThreadsMapping() const
 {
    return this->mapping;
 }
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 void
-CSRLightKernel< Index, Device >::
-setThreadsPerSegment( int threadsPerSegment )
+CSRLightKernel< Index, Device >::setThreadsPerSegment( int threadsPerSegment )
 {
-   if( threadsPerSegment !=  1 &&
-       threadsPerSegment !=  2 &&
-       threadsPerSegment !=  4 &&
-       threadsPerSegment !=  8 &&
-       threadsPerSegment != 16 &&
-       threadsPerSegment != 32 )
-       throw std::runtime_error( "Number of threads per segment must be power of 2 - 1, 2, ... 32." );
+   if( threadsPerSegment != 1 && threadsPerSegment != 2 && threadsPerSegment != 4 && threadsPerSegment != 8
+       && threadsPerSegment != 16 && threadsPerSegment != 32 )
+      throw std::runtime_error( "Number of threads per segment must be power of 2 - 1, 2, ... 32." );
    this->threadsPerSegment = threadsPerSegment;
 }
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 int
-CSRLightKernel< Index, Device >::
-getThreadsPerSegment() const
+CSRLightKernel< Index, Device >::getThreadsPerSegment() const
 {
    return this->threadsPerSegment;
 }
 
-
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/Kernels/CSRScalarKernel.h b/src/TNL/Algorithms/Segments/Kernels/CSRScalarKernel.h
index 7997f51ba3625a7f62223c363012ab90d92b897b..d2a53f7c4f56a6beb5f1974670dd36c60bfd8568 100644
--- a/src/TNL/Algorithms/Segments/Kernels/CSRScalarKernel.h
+++ b/src/TNL/Algorithms/Segments/Kernels/CSRScalarKernel.h
@@ -13,47 +13,47 @@
 #include <TNL/Algorithms/Segments/detail/LambdaAdapter.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 struct CSRScalarKernel
 {
-    using IndexType = Index;
-    using DeviceType = Device;
-    using ViewType = CSRScalarKernel< Index, Device >;
-    using ConstViewType = CSRScalarKernel< Index, Device >;
-
-    template< typename Offsets >
-    void init( const Offsets& offsets );
-
-    void reset();
-
-    ViewType getView();
-
-    ConstViewType getConstView() const;
-
-    static TNL::String getKernelType();
-
-    template< typename OffsetsView,
-              typename Fetch,
-              typename Reduction,
-              typename ResultKeeper,
-              typename Real,
-              typename... Args >
-    static void reduceSegments( const OffsetsView& offsets,
-                               Index first,
-                               Index last,
-                               Fetch& fetch,
-                               const Reduction& reduction,
-                               ResultKeeper& keeper,
-                               const Real& zero,
-                               Args... args );
+   using IndexType = Index;
+   using DeviceType = Device;
+   using ViewType = CSRScalarKernel< Index, Device >;
+   using ConstViewType = CSRScalarKernel< Index, Device >;
+
+   template< typename Offsets >
+   void
+   init( const Offsets& offsets );
+
+   void
+   reset();
+
+   ViewType
+   getView();
+
+   ConstViewType
+   getConstView() const;
+
+   static TNL::String
+   getKernelType();
+
+   template< typename OffsetsView, typename Fetch, typename Reduction, typename ResultKeeper, typename Real, typename... Args >
+   static void
+   reduceSegments( const OffsetsView& offsets,
+                   Index first,
+                   Index last,
+                   Fetch& fetch,
+                   const Reduction& reduction,
+                   ResultKeeper& keeper,
+                   const Real& zero,
+                   Args... args );
 };
 
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
 
 #include <TNL/Algorithms/Segments/Kernels/CSRScalarKernel.hpp>
diff --git a/src/TNL/Algorithms/Segments/Kernels/CSRScalarKernel.hpp b/src/TNL/Algorithms/Segments/Kernels/CSRScalarKernel.hpp
index 2990124499b4717680f3b5ec857d4fced8b03f2c..db1cdcc6cc6d3593c65c75d173953fda0e54ef42 100644
--- a/src/TNL/Algorithms/Segments/Kernels/CSRScalarKernel.hpp
+++ b/src/TNL/Algorithms/Segments/Kernels/CSRScalarKernel.hpp
@@ -14,8 +14,8 @@
 #include <TNL/Algorithms/Segments/detail/LambdaAdapter.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
 template< typename Index,
           typename Device,
@@ -25,46 +25,40 @@ template< typename Index,
           bool DispatchScalarCSR = detail::CheckFetchLambda< Index, Fetch >::hasAllParameters() >
 struct CSRScalarKernelreduceSegmentsDispatcher;
 
-template< typename Index,
-          typename Device,
-          typename Fetch,
-          typename Reduction,
-          typename ResultKeeper >
+template< typename Index, typename Device, typename Fetch, typename Reduction, typename ResultKeeper >
 struct CSRScalarKernelreduceSegmentsDispatcher< Index, Device, Fetch, Reduction, ResultKeeper, true >
 {
-
-   template< typename Offsets,
-             typename Real >
-   static void reduce( const Offsets& offsets,
-                       Index first,
-                       Index last,
-                       Fetch& fetch,
-                       const Reduction& reduction,
-                       ResultKeeper& keep,
-                       const Real& zero )
+   template< typename Offsets, typename Real >
+   static void
+   reduce( const Offsets& offsets,
+           Index first,
+           Index last,
+           Fetch& fetch,
+           const Reduction& reduction,
+           ResultKeeper& keep,
+           const Real& zero )
    {
-      auto l = [=] __cuda_callable__ ( const Index segmentIdx ) mutable {
+      auto l = [ = ] __cuda_callable__( const Index segmentIdx ) mutable
+      {
          const Index begin = offsets[ segmentIdx ];
          const Index end = offsets[ segmentIdx + 1 ];
          Real aux( zero );
          Index localIdx( 0 );
          bool compute( true );
-         for( Index globalIdx = begin; globalIdx < end && compute; globalIdx++  )
-             aux = reduction( aux, fetch( segmentIdx, localIdx++, globalIdx, compute ) );
+         for( Index globalIdx = begin; globalIdx < end && compute; globalIdx++ )
+            aux = reduction( aux, fetch( segmentIdx, localIdx++, globalIdx, compute ) );
          keep( segmentIdx, aux );
       };
 
-      if( std::is_same< Device, TNL::Devices::Sequential >::value )
-      {
-         for( Index segmentIdx = first; segmentIdx < last; segmentIdx ++ )
+      if( std::is_same< Device, TNL::Devices::Sequential >::value ) {
+         for( Index segmentIdx = first; segmentIdx < last; segmentIdx++ )
             l( segmentIdx );
       }
-      else if( std::is_same< Device, TNL::Devices::Host >::value )
-      {
+      else if( std::is_same< Device, TNL::Devices::Host >::value ) {
 #ifdef HAVE_OPENMP
-        #pragma omp parallel for firstprivate( l ) schedule( dynamic, 100 ), if( Devices::Host::isOMPEnabled() )
+         #pragma omp parallel for firstprivate( l ) schedule( dynamic, 100 ), if( Devices::Host::isOMPEnabled() )
 #endif
-         for( Index segmentIdx = first; segmentIdx < last; segmentIdx ++ )
+         for( Index segmentIdx = first; segmentIdx < last; segmentIdx++ )
             l( segmentIdx );
       }
       else
@@ -72,115 +66,89 @@ struct CSRScalarKernelreduceSegmentsDispatcher< Index, Device, Fetch, Reduction,
    }
 };
 
-template< typename Index,
-          typename Device,
-          typename Fetch,
-          typename Reduce,
-          typename Keep >
+template< typename Index, typename Device, typename Fetch, typename Reduce, typename Keep >
 struct CSRScalarKernelreduceSegmentsDispatcher< Index, Device, Fetch, Reduce, Keep, false >
 {
-   template< typename OffsetsView,
-             typename Real >
-   static void reduce( const OffsetsView& offsets,
-                       Index first,
-                       Index last,
-                       Fetch& fetch,
-                       const Reduce& reduction,
-                       Keep& keep,
-                       const Real& zero )
+   template< typename OffsetsView, typename Real >
+   static void
+   reduce( const OffsetsView& offsets,
+           Index first,
+           Index last,
+           Fetch& fetch,
+           const Reduce& reduction,
+           Keep& keep,
+           const Real& zero )
    {
-      auto l = [=] __cuda_callable__ ( const Index segmentIdx ) mutable {
+      auto l = [ = ] __cuda_callable__( const Index segmentIdx ) mutable
+      {
          const Index begin = offsets[ segmentIdx ];
          const Index end = offsets[ segmentIdx + 1 ];
          Real aux( zero );
          bool compute( true );
-         for( Index globalIdx = begin; globalIdx < end && compute; globalIdx++  )
-             aux = reduction( aux, fetch( globalIdx, compute ) );
+         for( Index globalIdx = begin; globalIdx < end && compute; globalIdx++ )
+            aux = reduction( aux, fetch( globalIdx, compute ) );
          keep( segmentIdx, aux );
       };
 
-      if( std::is_same< Device, TNL::Devices::Sequential >::value )
-      {
-         for( Index segmentIdx = first; segmentIdx < last; segmentIdx ++ )
+      if( std::is_same< Device, TNL::Devices::Sequential >::value ) {
+         for( Index segmentIdx = first; segmentIdx < last; segmentIdx++ )
             l( segmentIdx );
       }
-      else if( std::is_same< Device, TNL::Devices::Host >::value )
-      {
+      else if( std::is_same< Device, TNL::Devices::Host >::value ) {
 #ifdef HAVE_OPENMP
-        #pragma omp parallel for firstprivate( l ) schedule( dynamic, 100 ), if( Devices::Host::isOMPEnabled() )
+         #pragma omp parallel for firstprivate( l ) schedule( dynamic, 100 ), if( Devices::Host::isOMPEnabled() )
 #endif
-         for( Index segmentIdx = first; segmentIdx < last; segmentIdx ++ )
+         for( Index segmentIdx = first; segmentIdx < last; segmentIdx++ )
             l( segmentIdx );
       }
       else
          Algorithms::ParallelFor< Device >::exec( first, last, l );
-
    }
 };
 
-
-template< typename Index,
-          typename Device >
-    template< typename Offsets >
+template< typename Index, typename Device >
+template< typename Offsets >
 void
-CSRScalarKernel< Index, Device >::
-init( const Offsets& offsets )
-{
-}
+CSRScalarKernel< Index, Device >::init( const Offsets& offsets )
+{}
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 void
-CSRScalarKernel< Index, Device >::
-reset()
-{
-}
+CSRScalarKernel< Index, Device >::reset()
+{}
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 auto
-CSRScalarKernel< Index, Device >::
-getView() -> ViewType
+CSRScalarKernel< Index, Device >::getView() -> ViewType
 {
-    return *this;
+   return *this;
 }
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 auto
-CSRScalarKernel< Index, Device >::
-getConstView() const -> ConstViewType
+CSRScalarKernel< Index, Device >::getConstView() const -> ConstViewType
 {
-    return *this;
+   return *this;
 };
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 TNL::String
-CSRScalarKernel< Index, Device >::
-getKernelType()
+CSRScalarKernel< Index, Device >::getKernelType()
 {
-    return "Scalar";
+   return "Scalar";
 }
 
-template< typename Index,
-          typename Device >
-    template< typename OffsetsView,
-              typename Fetch,
-              typename Reduction,
-              typename ResultKeeper,
-              typename Real,
-              typename... Args >
+template< typename Index, typename Device >
+template< typename OffsetsView, typename Fetch, typename Reduction, typename ResultKeeper, typename Real, typename... Args >
 void
-CSRScalarKernel< Index, Device >::
-reduceSegments( const OffsetsView& offsets,
-                   Index first,
-                   Index last,
-                   Fetch& fetch,
-                   const Reduction& reduction,
-                   ResultKeeper& keeper,
-                   const Real& zero,
-                   Args... args )
+CSRScalarKernel< Index, Device >::reduceSegments( const OffsetsView& offsets,
+                                                  Index first,
+                                                  Index last,
+                                                  Fetch& fetch,
+                                                  const Reduction& reduction,
+                                                  ResultKeeper& keeper,
+                                                  const Real& zero,
+                                                  Args... args )
 {
    CSRScalarKernelreduceSegmentsDispatcher< Index, Device, Fetch, Reduction, ResultKeeper >::reduce(
       offsets, first, last, fetch, reduction, keeper, zero );
@@ -192,8 +160,8 @@ reduceSegments( const OffsetsView& offsets,
         IndexType localIdx( 0 );
         bool compute( true );
         for( IndexType globalIdx = begin; globalIdx < end && compute; globalIdx++  )
-            aux = reduction( aux, detail::FetchLambdaAdapter< IndexType, Fetch >::call( fetch, segmentIdx, localIdx++, globalIdx, compute ) );
-        keeper( segmentIdx, aux );
+            aux = reduction( aux, detail::FetchLambdaAdapter< IndexType, Fetch >::call( fetch, segmentIdx, localIdx++,
+globalIdx, compute ) ); keeper( segmentIdx, aux );
     };
 
      if( std::is_same< DeviceType, TNL::Devices::Host >::value )
@@ -210,13 +178,13 @@ reduceSegments( const OffsetsView& offsets,
             IndexType localIdx( 0 );
             bool compute( true );
             for( IndexType globalIdx = begin; globalIdx < end && compute; globalIdx++  )
-                aux = reduction( aux, detail::FetchLambdaAdapter< IndexType, Fetch >::call( fetch, segmentIdx, localIdx++, globalIdx, compute ) );
-            keeper( segmentIdx, aux );
+                aux = reduction( aux, detail::FetchLambdaAdapter< IndexType, Fetch >::call( fetch, segmentIdx, localIdx++,
+globalIdx, compute ) ); keeper( segmentIdx, aux );
         }
     }
     else
         Algorithms::ParallelFor< Device >::exec( first, last, l, args... );*/
 }
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/Kernels/CSRVectorKernel.h b/src/TNL/Algorithms/Segments/Kernels/CSRVectorKernel.h
index d8de2a2ea614c421c0180d1f88eeb8247402e250..fad288fcfff42888004bf73086f3a6adf5ca867d 100644
--- a/src/TNL/Algorithms/Segments/Kernels/CSRVectorKernel.h
+++ b/src/TNL/Algorithms/Segments/Kernels/CSRVectorKernel.h
@@ -13,11 +13,10 @@
 #include <TNL/Algorithms/Segments/detail/LambdaAdapter.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 struct CSRVectorKernel
 {
    using IndexType = Index;
@@ -26,34 +25,35 @@ struct CSRVectorKernel
    using ConstViewType = CSRVectorKernel< Index, Device >;
 
    template< typename Offsets >
-   void init( const Offsets& offsets );
-
-   void reset();
-
-   ViewType getView();
-
-   ConstViewType getConstView() const;
-
-   static TNL::String getKernelType();
-
-   template< typename OffsetsView,
-             typename Fetch,
-             typename Reduction,
-             typename ResultKeeper,
-             typename Real,
-             typename... Args >
-   static void reduceSegments( const OffsetsView& offsets,
-                                  Index first,
-                                  Index last,
-                                  Fetch& fetch,
-                                  const Reduction& reduction,
-                                  ResultKeeper& keeper,
-                                  const Real& zero,
-                                  Args... args );
+   void
+   init( const Offsets& offsets );
+
+   void
+   reset();
+
+   ViewType
+   getView();
+
+   ConstViewType
+   getConstView() const;
+
+   static TNL::String
+   getKernelType();
+
+   template< typename OffsetsView, typename Fetch, typename Reduction, typename ResultKeeper, typename Real, typename... Args >
+   static void
+   reduceSegments( const OffsetsView& offsets,
+                   Index first,
+                   Index last,
+                   Fetch& fetch,
+                   const Reduction& reduction,
+                   ResultKeeper& keeper,
+                   const Real& zero,
+                   Args... args );
 };
 
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
 
 #include <TNL/Algorithms/Segments/Kernels/CSRVectorKernel.hpp>
diff --git a/src/TNL/Algorithms/Segments/Kernels/CSRVectorKernel.hpp b/src/TNL/Algorithms/Segments/Kernels/CSRVectorKernel.hpp
index 7d210d2294b55092bb98bacafd9dfd5ad51f5933..2942b78d0ce631b48309ea6e89e42a0ccd704d1c 100644
--- a/src/TNL/Algorithms/Segments/Kernels/CSRVectorKernel.hpp
+++ b/src/TNL/Algorithms/Segments/Kernels/CSRVectorKernel.hpp
@@ -14,8 +14,8 @@
 #include <TNL/Algorithms/Segments/Kernels/CSRVectorKernel.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
 #ifdef HAVE_CUDA
 template< typename Offsets,
@@ -26,137 +26,116 @@ template< typename Offsets,
           typename Real,
           typename... Args >
 __global__
-void reduceSegmentsCSRKernelVector(
-    int gridIdx,
-    const Offsets offsets,
-    Index first,
-    Index last,
-    Fetch fetch,
-    const Reduction reduce,
-    ResultKeeper keep,
-    const Real zero,
-    Args... args )
+void
+reduceSegmentsCSRKernelVector( int gridIdx,
+                               const Offsets offsets,
+                               Index first,
+                               Index last,
+                               Fetch fetch,
+                               const Reduction reduce,
+                               ResultKeeper keep,
+                               const Real zero,
+                               Args... args )
 {
-    /***
-     * We map one warp to each segment
-     */
-    const Index segmentIdx =  TNL::Cuda::getGlobalThreadIdx( gridIdx ) / TNL::Cuda::getWarpSize() + first;
-    if( segmentIdx >= last )
-        return;
-
-    const int laneIdx = threadIdx.x & ( TNL::Cuda::getWarpSize() - 1 ); // & is cheaper than %
-    TNL_ASSERT_LT( segmentIdx + 1, offsets.getSize(), "" );
-    Index endIdx = offsets[ segmentIdx + 1 ];
-
-    Index localIdx( laneIdx );
-    Real aux = zero;
-    bool compute( true );
-    for( Index globalIdx = offsets[ segmentIdx ] + localIdx; globalIdx < endIdx; globalIdx += TNL::Cuda::getWarpSize() )
-    {
-        TNL_ASSERT_LT( globalIdx, endIdx, "" );
-        aux = reduce( aux, detail::FetchLambdaAdapter< Index, Fetch >::call( fetch, segmentIdx, localIdx, globalIdx, compute ) );
-        localIdx += TNL::Cuda::getWarpSize();
-    }
+   /***
+    * We map one warp to each segment
+    */
+   const Index segmentIdx = TNL::Cuda::getGlobalThreadIdx( gridIdx ) / TNL::Cuda::getWarpSize() + first;
+   if( segmentIdx >= last )
+      return;
+
+   const int laneIdx = threadIdx.x & ( TNL::Cuda::getWarpSize() - 1 );  // & is cheaper than %
+   TNL_ASSERT_LT( segmentIdx + 1, offsets.getSize(), "" );
+   Index endIdx = offsets[ segmentIdx + 1 ];
+
+   Index localIdx( laneIdx );
+   Real aux = zero;
+   bool compute( true );
+   for( Index globalIdx = offsets[ segmentIdx ] + localIdx; globalIdx < endIdx; globalIdx += TNL::Cuda::getWarpSize() ) {
+      TNL_ASSERT_LT( globalIdx, endIdx, "" );
+      aux = reduce( aux, detail::FetchLambdaAdapter< Index, Fetch >::call( fetch, segmentIdx, localIdx, globalIdx, compute ) );
+      localIdx += TNL::Cuda::getWarpSize();
+   }
 
    /****
     * Reduction in each warp which means in each segment.
     */
    aux = reduce( aux, __shfl_down_sync( 0xFFFFFFFF, aux, 16 ) );
-   aux = reduce( aux, __shfl_down_sync( 0xFFFFFFFF, aux,  8 ) );
-   aux = reduce( aux, __shfl_down_sync( 0xFFFFFFFF, aux,  4 ) );
-   aux = reduce( aux, __shfl_down_sync( 0xFFFFFFFF, aux,  2 ) );
-   aux = reduce( aux, __shfl_down_sync( 0xFFFFFFFF, aux,  1 ) );
+   aux = reduce( aux, __shfl_down_sync( 0xFFFFFFFF, aux, 8 ) );
+   aux = reduce( aux, __shfl_down_sync( 0xFFFFFFFF, aux, 4 ) );
+   aux = reduce( aux, __shfl_down_sync( 0xFFFFFFFF, aux, 2 ) );
+   aux = reduce( aux, __shfl_down_sync( 0xFFFFFFFF, aux, 1 ) );
 
    if( laneIdx == 0 )
-     keep( segmentIdx, aux );
+      keep( segmentIdx, aux );
 }
 #endif
 
-template< typename Index,
-          typename Device >
-    template< typename Offsets >
+template< typename Index, typename Device >
+template< typename Offsets >
 void
-CSRVectorKernel< Index, Device >::
-init( const Offsets& offsets )
-{
-}
+CSRVectorKernel< Index, Device >::init( const Offsets& offsets )
+{}
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 void
-CSRVectorKernel< Index, Device >::
-reset()
-{
-}
+CSRVectorKernel< Index, Device >::reset()
+{}
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 auto
-CSRVectorKernel< Index, Device >::
-getView() -> ViewType
+CSRVectorKernel< Index, Device >::getView() -> ViewType
 {
-    return *this;
+   return *this;
 }
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 auto
-CSRVectorKernel< Index, Device >::
-getConstView() const -> ConstViewType
+CSRVectorKernel< Index, Device >::getConstView() const -> ConstViewType
 {
-    return *this;
+   return *this;
 };
 
-template< typename Index,
-          typename Device >
+template< typename Index, typename Device >
 TNL::String
-CSRVectorKernel< Index, Device >::
-getKernelType()
+CSRVectorKernel< Index, Device >::getKernelType()
 {
-    return "Vector";
+   return "Vector";
 }
 
-template< typename Index,
-          typename Device >
-    template< typename OffsetsView,
-              typename Fetch,
-              typename Reduction,
-              typename ResultKeeper,
-              typename Real,
-              typename... Args >
+template< typename Index, typename Device >
+template< typename OffsetsView, typename Fetch, typename Reduction, typename ResultKeeper, typename Real, typename... Args >
 void
-CSRVectorKernel< Index, Device >::
-reduceSegments( const OffsetsView& offsets,
-                         Index first,
-                         Index last,
-                         Fetch& fetch,
-                         const Reduction& reduction,
-                         ResultKeeper& keeper,
-                         const Real& zero,
-                         Args... args )
+CSRVectorKernel< Index, Device >::reduceSegments( const OffsetsView& offsets,
+                                                  Index first,
+                                                  Index last,
+                                                  Fetch& fetch,
+                                                  const Reduction& reduction,
+                                                  ResultKeeper& keeper,
+                                                  const Real& zero,
+                                                  Args... args )
 {
 #ifdef HAVE_CUDA
-    if( last <= first )
-       return;
-
-    const Index warpsCount = last - first;
-    const size_t threadsCount = warpsCount * TNL::Cuda::getWarpSize();
-    dim3 blocksCount, gridsCount, blockSize( 256 );
-    TNL::Cuda::setupThreads( blockSize, blocksCount, gridsCount, threadsCount );
-    dim3 gridIdx;
-    for( gridIdx.x = 0; gridIdx.x < gridsCount.x; gridIdx.x ++ )
-    {
-        dim3 gridSize;
-        TNL::Cuda::setupGrid( blocksCount, gridsCount, gridIdx, gridSize );
-        reduceSegmentsCSRKernelVector< OffsetsView, IndexType, Fetch, Reduction, ResultKeeper, Real, Args... >
-        <<< gridSize, blockSize >>>(
-            gridIdx.x, offsets, first, last, fetch, reduction, keeper, zero, args... );
-    }
-    cudaStreamSynchronize(0);
-    TNL_CHECK_CUDA_DEVICE;
+   if( last <= first )
+      return;
+
+   const Index warpsCount = last - first;
+   const size_t threadsCount = warpsCount * TNL::Cuda::getWarpSize();
+   dim3 blocksCount, gridsCount, blockSize( 256 );
+   TNL::Cuda::setupThreads( blockSize, blocksCount, gridsCount, threadsCount );
+   dim3 gridIdx;
+   for( gridIdx.x = 0; gridIdx.x < gridsCount.x; gridIdx.x++ ) {
+      dim3 gridSize;
+      TNL::Cuda::setupGrid( blocksCount, gridsCount, gridIdx, gridSize );
+      reduceSegmentsCSRKernelVector< OffsetsView, IndexType, Fetch, Reduction, ResultKeeper, Real, Args... > <<<
+         gridSize,
+         blockSize >>>( gridIdx.x, offsets, first, last, fetch, reduction, keeper, zero, args... );
+   }
+   cudaStreamSynchronize( 0 );
+   TNL_CHECK_CUDA_DEVICE;
 #endif
 }
 
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/Kernels/details/CSRAdaptiveKernelBlockDescriptor.h b/src/TNL/Algorithms/Segments/Kernels/details/CSRAdaptiveKernelBlockDescriptor.h
index d6d1e1573cb628f86646a4eef5d8e7f122fa97bb..a47b0877121e14bc32b773095ef291e411682b88 100644
--- a/src/TNL/Algorithms/Segments/Kernels/details/CSRAdaptiveKernelBlockDescriptor.h
+++ b/src/TNL/Algorithms/Segments/Kernels/details/CSRAdaptiveKernelBlockDescriptor.h
@@ -7,11 +7,12 @@
 #pragma once
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
-         namespace detail {
+namespace Algorithms {
+namespace Segments {
+namespace detail {
 
-enum class Type {
+enum class Type
+{
    /* LONG = 0!!! Non zero value rewrites index[1] */
    LONG = 0,
    STREAM = 1,
@@ -24,31 +25,33 @@ enum class Type {
 template< typename Index >
 union CSRAdaptiveKernelBlockDescriptor
 {
-   CSRAdaptiveKernelBlockDescriptor(Index row, Type type = Type::VECTOR, Index index = 0, uint8_t warpsCount = 0) noexcept
+   CSRAdaptiveKernelBlockDescriptor( Index row, Type type = Type::VECTOR, Index index = 0, uint8_t warpsCount = 0 ) noexcept
    {
-      this->index[0] = row;
-      this->index[1] = index;
-      this->byte[sizeof(Index) == 4 ? 7 : 15] = (uint8_t)type;
+      this->index[ 0 ] = row;
+      this->index[ 1 ] = index;
+      this->byte[ sizeof( Index ) == 4 ? 7 : 15 ] = (uint8_t) type;
    }
 
-   CSRAdaptiveKernelBlockDescriptor(Index row, Type type, Index nextRow, Index maxID, Index minID) noexcept
+   CSRAdaptiveKernelBlockDescriptor( Index row, Type type, Index nextRow, Index maxID, Index minID ) noexcept
    {
-      this->index[0] = row;
-      this->index[1] = 0;
-      this->twobytes[sizeof(Index) == 4 ? 2 : 4] = maxID - minID;
+      this->index[ 0 ] = row;
+      this->index[ 1 ] = 0;
+      this->twobytes[ sizeof( Index ) == 4 ? 2 : 4 ] = maxID - minID;
 
-      if (type == Type::STREAM)
-         this->twobytes[sizeof(Index) == 4 ? 3 : 5] = nextRow - row;
+      if( type == Type::STREAM )
+         this->twobytes[ sizeof( Index ) == 4 ? 3 : 5 ] = nextRow - row;
 
-      if (type == Type::STREAM)
-         this->byte[sizeof(Index) == 4 ? 7 : 15] |= 0b1000000;
-      else if (type == Type::VECTOR)
-         this->byte[sizeof(Index) == 4 ? 7 : 15] |= 0b10000000;
+      if( type == Type::STREAM )
+         this->byte[ sizeof( Index ) == 4 ? 7 : 15 ] |= 0b1000000;
+      else if( type == Type::VECTOR )
+         this->byte[ sizeof( Index ) == 4 ? 7 : 15 ] |= 0b10000000;
    }
 
    CSRAdaptiveKernelBlockDescriptor() = default;
 
-   __cuda_callable__ Type getType() const
+   __cuda_callable__
+   Type
+   getType() const
    {
       if( byte[ sizeof( Index ) == 4 ? 7 : 15 ] & 0b1000000 )
          return Type::STREAM;
@@ -57,7 +60,9 @@ union CSRAdaptiveKernelBlockDescriptor
       return Type::LONG;
    }
 
-   __cuda_callable__ const Index& getFirstSegment() const
+   __cuda_callable__
+   const Index&
+   getFirstSegment() const
    {
       return index[ 0 ];
    }
@@ -65,35 +70,43 @@ union CSRAdaptiveKernelBlockDescriptor
    /***
     * \brief Returns number of elements covered by the block.
     */
-   __cuda_callable__ const Index getSize() const
+   __cuda_callable__
+   const Index
+   getSize() const
    {
-      return twobytes[ sizeof(Index) == 4 ? 2 : 4 ];
+      return twobytes[ sizeof( Index ) == 4 ? 2 : 4 ];
    }
 
    /***
     * \brief Returns number of segments covered by the block.
     */
-   __cuda_callable__ const Index getSegmentsInBlock() const
+   __cuda_callable__
+   const Index
+   getSegmentsInBlock() const
    {
       return ( twobytes[ sizeof( Index ) == 4 ? 3 : 5 ] & 0x3FFF );
    }
 
-   __cuda_callable__ uint8_t getWarpIdx() const
+   __cuda_callable__
+   uint8_t
+   getWarpIdx() const
    {
       return index[ 1 ];
    }
 
-   __cuda_callable__ uint8_t getWarpsCount() const
+   __cuda_callable__
+   uint8_t
+   getWarpsCount() const
    {
       return 1;
    }
 
-   void print( std::ostream& str ) const
+   void
+   print( std::ostream& str ) const
    {
       Type type = this->getType();
       str << "Type: ";
-      switch( type )
-      {
+      switch( type ) {
          case Type::STREAM:
             str << " Stream ";
             break;
@@ -108,10 +121,10 @@ union CSRAdaptiveKernelBlockDescriptor
       str << " block end: " << getSize();
       str << " index in warp: " << index[ 1 ];
    }
-   Index index[2]; // index[0] is row pointer, index[1] is index in warp
-   uint8_t byte[sizeof(Index) == 4 ? 8 : 16]; // byte[7/15] is type specificator
-   uint16_t twobytes[sizeof(Index) == 4 ? 4 : 8]; //twobytes[2/4] is maxID - minID
-                                                //twobytes[3/5] is nextRow - row
+   Index index[ 2 ];                                   // index[0] is row pointer, index[1] is index in warp
+   uint8_t byte[ sizeof( Index ) == 4 ? 8 : 16 ];      // byte[7/15] is type specificator
+   uint16_t twobytes[ sizeof( Index ) == 4 ? 4 : 8 ];  // twobytes[2/4] is maxID - minID
+                                                       // twobytes[3/5] is nextRow - row
 };
 #else
 
@@ -124,7 +137,7 @@ struct CSRAdaptiveKernelBlockDescriptor
                                      uint8_t warpsCount = 0 ) noexcept
    {
       this->firstSegmentIdx = firstSegmentIdx;
-      this->type = ( uint8_t ) type;
+      this->type = (uint8_t) type;
       this->warpIdx = warpIdx;
       this->warpsCount = warpsCount;
       /*this->index[0] = row;
@@ -132,17 +145,13 @@ struct CSRAdaptiveKernelBlockDescriptor
       this->byte[sizeof(Index) == 4 ? 7 : 15] = (uint8_t)type;*/
    }
 
-   CSRAdaptiveKernelBlockDescriptor( Index firstSegmentIdx,
-                                     Type type,
-                                     Index lastSegmentIdx,
-                                     Index end,
-                                     Index begin ) noexcept
+   CSRAdaptiveKernelBlockDescriptor( Index firstSegmentIdx, Type type, Index lastSegmentIdx, Index end, Index begin ) noexcept
    {
       this->firstSegmentIdx = firstSegmentIdx;
       this->warpIdx = 0;
       this->blockSize = end - begin;
       this->segmentsInBlock = lastSegmentIdx - firstSegmentIdx;
-      this->type = ( uint8_t ) type;
+      this->type = (uint8_t) type;
 
       /*this->index[0] = row;
       this->index[1] = 0;
@@ -159,9 +168,11 @@ struct CSRAdaptiveKernelBlockDescriptor
 
    CSRAdaptiveKernelBlockDescriptor() = default;
 
-   __cuda_callable__ Type getType() const
+   __cuda_callable__
+   Type
+   getType() const
    {
-      return ( Type ) this->type;
+      return (Type) this->type;
       /*if( byte[ sizeof( Index ) == 4 ? 7 : 15 ] & 0b1000000 )
          return Type::STREAM;
       if( byte[ sizeof( Index ) == 4 ? 7 : 15 ] & 0b10000000 )
@@ -169,45 +180,55 @@ struct CSRAdaptiveKernelBlockDescriptor
       return Type::LONG;*/
    }
 
-   __cuda_callable__ const Index& getFirstSegment() const
+   __cuda_callable__
+   const Index&
+   getFirstSegment() const
    {
       return this->firstSegmentIdx;
-      //return index[ 0 ];
+      // return index[ 0 ];
    }
 
    /***
     * \brief Returns number of elements covered by the block.
     */
-   __cuda_callable__ const Index getSize() const
+   __cuda_callable__
+   Index
+   getSize() const
    {
       return this->blockSize;
-      //return twobytes[ sizeof(Index) == 4 ? 2 : 4 ];
+      // return twobytes[ sizeof(Index) == 4 ? 2 : 4 ];
    }
 
    /***
     * \brief Returns number of segments covered by the block.
     */
-   __cuda_callable__ const Index getSegmentsInBlock() const
+   __cuda_callable__
+   Index
+   getSegmentsInBlock() const
    {
       return this->segmentsInBlock;
-      //return ( twobytes[ sizeof( Index ) == 4 ? 3 : 5 ] & 0x3FFF );
+      // return ( twobytes[ sizeof( Index ) == 4 ? 3 : 5 ] & 0x3FFF );
    }
 
-   __cuda_callable__ uint8_t getWarpIdx() const
+   __cuda_callable__
+   uint8_t
+   getWarpIdx() const
    {
       return this->warpIdx;
    }
 
-   __cuda_callable__ uint8_t getWarpsCount() const
+   __cuda_callable__
+   uint8_t
+   getWarpsCount() const
    {
       return this->warpsCount;
    }
 
-   void print( std::ostream& str ) const
+   void
+   print( std::ostream& str ) const
    {
       str << "Type: ";
-      switch( this->getType() )
-      {
+      switch( this->getType() ) {
          case Type::STREAM:
             str << " Stream ";
             break;
@@ -227,21 +248,22 @@ struct CSRAdaptiveKernelBlockDescriptor
    Index firstSegmentIdx, blockSize, segmentsInBlock;
    uint8_t warpIdx, warpsCount;
 
-   //Index index[2]; // index[0] is row pointer, index[1] is index in warp
-   //uint8_t byte[sizeof(Index) == 4 ? 8 : 16]; // byte[7/15] is type specificator
-   //uint16_t twobytes[sizeof(Index) == 4 ? 4 : 8]; //twobytes[2/4] is maxID - minID
-                                                //twobytes[3/5] is nextRow - row
+   // Index index[2]; // index[0] is row pointer, index[1] is index in warp
+   // uint8_t byte[sizeof(Index) == 4 ? 8 : 16]; // byte[7/15] is type specificator
+   // uint16_t twobytes[sizeof(Index) == 4 ? 4 : 8]; //twobytes[2/4] is maxID - minID
+   // twobytes[3/5] is nextRow - row
 };
 
 #endif
 
 template< typename Index >
-std::ostream& operator<< ( std::ostream& str, const CSRAdaptiveKernelBlockDescriptor< Index >& block )
+std::ostream&
+operator<<( std::ostream& str, const CSRAdaptiveKernelBlockDescriptor< Index >& block )
 {
    block.print( str );
    return str;
 }
-         } // namespace detail
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace detail
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/Kernels/details/CSRAdaptiveKernelParameters.h b/src/TNL/Algorithms/Segments/Kernels/details/CSRAdaptiveKernelParameters.h
index cf882de94da4340c0c6b8f97ee57eb7ae1b66065..80832297b7967e08f484d142c9f561e5712984ce 100644
--- a/src/TNL/Algorithms/Segments/Kernels/details/CSRAdaptiveKernelParameters.h
+++ b/src/TNL/Algorithms/Segments/Kernels/details/CSRAdaptiveKernelParameters.h
@@ -7,23 +7,27 @@
 #pragma once
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
-         namespace detail {
+namespace Algorithms {
+namespace Segments {
+namespace detail {
 
 // This can be used for tunning the number of CUDA threads per block depending on the size of Value
 // TODO: Perform some tests
 static constexpr int CSRAdaptiveKernelParametersCudaBlockSizes[] = { 256, 256, 256, 256, 256, 256 };
 
-template< int SizeOfValue = 1,
-          int StreamedSharedMemory_ = 24576 >
+template< int SizeOfValue = 1, int StreamedSharedMemory_ = 24576 >
 struct CSRAdaptiveKernelParameters
 {
    static constexpr int MaxValueSizeLog = 6;
 
-   static constexpr int getSizeValueLogConstexpr( const int i );
+   static constexpr int
+   getSizeValueLogConstexpr( int i );
 
-   static constexpr int getSizeOfValue() { return SizeOfValue; };
+   static constexpr int
+   getSizeOfValue()
+   {
+      return SizeOfValue;
+   };
 
    static constexpr int SizeOfValueLog = getSizeValueLogConstexpr( SizeOfValue );
 
@@ -34,7 +38,11 @@ struct CSRAdaptiveKernelParameters
     *
     * \return CUDA block size.
     */
-   static constexpr int CudaBlockSize() { return CSRAdaptiveKernelParametersCudaBlockSizes[ SizeOfValueLog ]; };
+   static constexpr int
+   CudaBlockSize()
+   {
+      return CSRAdaptiveKernelParametersCudaBlockSizes[ SizeOfValueLog ];
+   };
    //{ return SizeOfValue == 8 ? 128 : 256; };
 
    /**
@@ -42,67 +50,100 @@ struct CSRAdaptiveKernelParameters
     *
     * \return Stream shared memory.
     */
-   static constexpr size_t StreamedSharedMemory() { return StreamedSharedMemory_; };
+   static constexpr size_t
+   StreamedSharedMemory()
+   {
+      return StreamedSharedMemory_;
+   };
 
    /**
     * \brief Number of elements fitting into streamed shared memory.
     */
-   static constexpr size_t StreamedSharedElementsCount() { return StreamedSharedMemory() / SizeOfValue; };
+   static constexpr size_t
+   StreamedSharedElementsCount()
+   {
+      return StreamedSharedMemory() / SizeOfValue;
+   };
 
    /**
     * \brief Computes number of warps in one CUDA block.
     */
-   static constexpr size_t WarpsCount() { return CudaBlockSize() / Cuda::getWarpSize(); };
+   static constexpr size_t
+   WarpsCount()
+   {
+      return CudaBlockSize() / Cuda::getWarpSize();
+   };
 
    /**
     * \brief Computes number of elements to be streamed into the shared memory.
     *
     * \return Number of elements to be streamed into the shared memory.
     */
-   static constexpr size_t StreamedSharedElementsPerWarp() { return StreamedSharedElementsCount() / WarpsCount(); };
+   static constexpr size_t
+   StreamedSharedElementsPerWarp()
+   {
+      return StreamedSharedElementsCount() / WarpsCount();
+   };
 
    /**
     * \brief Returns maximum number of elements per warp for vector and hybrid kernel.
     *
     * \return Maximum number of elements per warp for vector and hybrid kernel.
     */
-   static constexpr int MaxVectorElementsPerWarp() { return 384; };
+   static constexpr int
+   MaxVectorElementsPerWarp()
+   {
+      return 384;
+   };
 
    /**
     * \brief Returns maximum number of elements per warp for adaptive kernel.
     *
     * \return Maximum number of elements per warp for adaptive kernel.
     */
-   static constexpr int MaxAdaptiveElementsPerWarp() { return 512; };
+   static constexpr int
+   MaxAdaptiveElementsPerWarp()
+   {
+      return 512;
+   };
 
-   static int getSizeValueLog( const int i )
+   static int
+   getSizeValueLog( const int i )
    {
-      if( i ==  1 ) return 0;
-      if( i ==  2 ) return 1;
-      if( i <=  4 ) return 2;
-      if( i <=  8 ) return 3;
-      if( i <= 16 ) return 4;
+      if( i == 1 )
+         return 0;
+      if( i == 2 )
+         return 1;
+      if( i <= 4 )
+         return 2;
+      if( i <= 8 )
+         return 3;
+      if( i <= 16 )
+         return 4;
       return 5;
    }
 };
 
-
-template< int SizeOfValue,
-          int StreamedSharedMemory_ >
+template< int SizeOfValue, int StreamedSharedMemory_ >
 constexpr int
-CSRAdaptiveKernelParameters< SizeOfValue, StreamedSharedMemory_ >::
-getSizeValueLogConstexpr( const int i )
+CSRAdaptiveKernelParameters< SizeOfValue, StreamedSharedMemory_ >::getSizeValueLogConstexpr( const int i )
 {
-   if( i ==  1 ) return 0;
-   if( i ==  2 ) return 1;
-   if( i <=  4 ) return 2;
-   if( i <=  8 ) return 3;
-   if( i <= 16 ) return 4;
-   if( i <= 32 ) return 5;
+   if( i == 1 )
+      return 0;
+   if( i == 2 )
+      return 1;
+   if( i <= 4 )
+      return 2;
+   if( i <= 8 )
+      return 3;
+   if( i <= 16 )
+      return 4;
+   if( i <= 32 )
+      return 5;
    return 6;
 };
 
-         } // namespace detail
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace detail
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/SegmentElement.h b/src/TNL/Algorithms/Segments/SegmentElement.h
index a704b9fc4f6ad286f46f874e13427bb9495747e7..87ce42069452e2c6ef0f891445b50ffc4d4a6921 100644
--- a/src/TNL/Algorithms/Segments/SegmentElement.h
+++ b/src/TNL/Algorithms/Segments/SegmentElement.h
@@ -11,8 +11,8 @@
 #include <TNL/Cuda/CudaCallable.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
 /**
  * \brief Simple structure representing one element of a segment.
@@ -22,59 +22,67 @@ namespace TNL {
 template< typename Index >
 class SegmentElement
 {
-   public:
+public:
+   /**
+    * \brief Type used for indexing of the elements.
+    */
+   using IndexType = Index;
 
-      /**
-       * \brief Type used for indexing of the elements.
-       */
-      using IndexType = Index;
+   /**
+    * \brief Constructor of the segment element with all parameters.
+    *
+    * \param segmentIdx is in index of the parent segment.
+    * \param localIdx is a rank of the element in the segment.
+    * \param globalIdx is an index of the element in the related container.
+    */
+   __cuda_callable__
+   SegmentElement( const IndexType& segmentIdx, const IndexType& localIdx, const IndexType globalIdx )
+   : segmentIdx( segmentIdx ), localIdx( localIdx ), globalIdx( globalIdx ){};
 
-      /**
-       * \brief Constructor of the segment element with all parameters.
-       *
-       * \param segmentIdx is in index of the parent segment.
-       * \param localIdx is a rank of the element in the segment.
-       * \param globalIdx is an index of the element in the related container.
-       */
-      __cuda_callable__
-      SegmentElement( const IndexType& segmentIdx,
-                      const IndexType& localIdx,
-                      const IndexType globalIdx )
-      : segmentIdx( segmentIdx ), localIdx( localIdx ), globalIdx( globalIdx ) {};
+   /**
+    * \brief Returns index of the parent segment.
+    *
+    * \return index of the parent segment.
+    */
+   __cuda_callable__
+   const IndexType&
+   segmentIndex() const
+   {
+      return segmentIdx;
+   };
 
-      /**
-       * \brief Returns index of the parent segment.
-       *
-       * \return index of the parent segment.
-       */
-      __cuda_callable__
-      const IndexType& segmentIndex() const { return segmentIdx; };
+   /**
+    * \brief Returns rank of the element in the segment.
+    *
+    * \return rank of the element in the segment.
+    */
+   __cuda_callable__
+   const IndexType&
+   localIndex() const
+   {
+      return localIdx;
+   };
 
-      /**
-       * \brief Returns rank of the element in the segment.
-       *
-       * \return rank of the element in the segment.
-       */
-      __cuda_callable__
-      const IndexType& localIndex() const { return localIdx; };
+   /**
+    * \brief Returns index of the element in the related container.
+    *
+    * \return index of the element in the related container.
+    */
+   __cuda_callable__
+   const IndexType&
+   globalIndex() const
+   {
+      return globalIdx;
+   };
 
-      /**
-       * \brief Returns index of the element in the related container.
-       *
-       * \return index of the element in the related container.
-       */
-      __cuda_callable__
-      const IndexType& globalIndex() const { return globalIdx; };
+protected:
+   const IndexType& segmentIdx;
 
-   protected:
+   const IndexType& localIdx;
 
-      const IndexType& segmentIdx;
-
-      const IndexType& localIdx;
-
-      const IndexType globalIdx;
+   const IndexType globalIdx;
 };
 
-      } // namespace Segments
-   } // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/SegmentView.h b/src/TNL/Algorithms/Segments/SegmentView.h
index 2ee276027f486642515ebbec7460b864ffc2a43c..b085ecbd3730cd38432752841452969f3e5b4e09 100644
--- a/src/TNL/Algorithms/Segments/SegmentView.h
+++ b/src/TNL/Algorithms/Segments/SegmentView.h
@@ -10,8 +10,8 @@
 #include <TNL/Algorithms/Segments/SegmentViewIterator.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
 /**
  * \brief Data structure for accessing particular segment.
@@ -22,11 +22,9 @@ namespace TNL {
  *  and \ref TNL::Algorithms::Segments::SegmentView< Index, RowMajorOrder > for column-major
  * and row-major elements organization respectively. They have equivalent interface.
  */
-template< typename Index,
-          ElementsOrganization Organization >
+template< typename Index, ElementsOrganization Organization >
 class SegmentView;
 
-
 /**
  * \brief Data structure for accessing particular segment.
  *
@@ -35,225 +33,256 @@ class SegmentView;
 template< typename Index >
 class SegmentView< Index, ColumnMajorOrder >
 {
-   public:
-
-      /**
-       * \brief Type for indexing elements in related segments.
-       */
-      using IndexType = Index;
-
-      /**
-       * \brief Type of iterator for iterating over elements of the segment.
-       */
-      using IteratorType = SegmentViewIterator< SegmentView >;
-
-      /**
-       * \brief Conctructor with all parameters.
-       *
-       * \param segmentIdx is an index of segment the segment view will point to.
-       * \param offset is an offset of the segment in the parent segments.
-       * \param size is a size of the segment.
-       * \param step is stepping between neighbouring elements in the segment.
-       */
-      __cuda_callable__
-      SegmentView( const IndexType segmentIdx,
-                   const IndexType offset,
-                   const IndexType size,
-                   const IndexType step )
-      : segmentIdx( segmentIdx ), segmentOffset( offset ), segmentSize( size ), step( step ){};
-
-      /**
-       * \brief Copy constructor.
-       *
-       * \param view is the source view.
-       */
-      __cuda_callable__
-      SegmentView( const SegmentView& view )
-      : segmentIdx( view.segmentIdx ), segmentOffset( view.segmentOffset ), segmentSize( view.segmentSize ), step( view.step ){};
-
-      /**
-       * \brief Get the size of the segment, i.e. number of elements in the segment.
-       *
-       * \return number of elements in the segment.
-       */
-      __cuda_callable__
-      const IndexType& getSize() const
-      {
-         return this->segmentSize;
-      };
-
-      /**
-       * \brief Get global index of an element with rank \e localIndex in the segment.
-       *
-       * \param localIndex is the rank of the element in the segment.
-       * \return global index of the element.
-       */
-      __cuda_callable__
-      IndexType getGlobalIndex( const IndexType localIndex ) const
-      {
-         TNL_ASSERT_LT( localIndex, segmentSize, "Local index exceeds segment bounds." );
-         return segmentOffset + localIndex * step;
-      };
-
-      /**
-       * \brief Get index of the segment.
-       *
-       * \return index of the segment.
-       */
-      __cuda_callable__
-      const IndexType& getSegmentIndex() const
-      {
-         return this->segmentIdx;
-      };
-
-      /**
-       * \brief Returns iterator pointing at the beginning of the segment.
-       *
-       * \return iterator pointing at the beginning.
-       */
-      __cuda_callable__
-      IteratorType begin() const { return IteratorType( *this, 0 ); };
-
-      /**
-       * \brief Returns iterator pointing at the end of the segment.
-       *
-       * \return iterator pointing at the end.
-       */
-      __cuda_callable__
-      IteratorType end() const { return IteratorType( *this, this->getSize() ); };
-
-      /**
-       * \brief Returns constant iterator pointing at the beginning of the segment.
-       *
-       * \return iterator pointing at the beginning.
-       */
-      __cuda_callable__
-      const IteratorType cbegin() const { return IteratorType( *this, 0 ); };
-
-      /**
-       * \brief Returns constant iterator pointing at the end of the segment.
-       *
-       * \return iterator pointing at the end.
-       */
-      __cuda_callable__
-      const IteratorType cend() const { return IteratorType( *this, this->getSize() ); };
-
-      protected:
-
-         IndexType segmentIdx, segmentOffset, segmentSize, step;
+public:
+   /**
+    * \brief Type for indexing elements in related segments.
+    */
+   using IndexType = Index;
+
+   /**
+    * \brief Type of iterator for iterating over elements of the segment.
+    */
+   using IteratorType = SegmentViewIterator< SegmentView >;
+
+   /**
+    * \brief Conctructor with all parameters.
+    *
+    * \param segmentIdx is an index of segment the segment view will point to.
+    * \param offset is an offset of the segment in the parent segments.
+    * \param size is a size of the segment.
+    * \param step is stepping between neighbouring elements in the segment.
+    */
+   __cuda_callable__
+   SegmentView( const IndexType segmentIdx, const IndexType offset, const IndexType size, const IndexType step )
+   : segmentIdx( segmentIdx ), segmentOffset( offset ), segmentSize( size ), step( step ){};
+
+   /**
+    * \brief Copy constructor.
+    *
+    * \param view is the source view.
+    */
+   __cuda_callable__
+   SegmentView( const SegmentView& view )
+   : segmentIdx( view.segmentIdx ), segmentOffset( view.segmentOffset ), segmentSize( view.segmentSize ), step( view.step ){};
+
+   /**
+    * \brief Get the size of the segment, i.e. number of elements in the segment.
+    *
+    * \return number of elements in the segment.
+    */
+   __cuda_callable__
+   const IndexType&
+   getSize() const
+   {
+      return this->segmentSize;
+   };
+
+   /**
+    * \brief Get global index of an element with rank \e localIndex in the segment.
+    *
+    * \param localIndex is the rank of the element in the segment.
+    * \return global index of the element.
+    */
+   __cuda_callable__
+   IndexType
+   getGlobalIndex( const IndexType localIndex ) const
+   {
+      TNL_ASSERT_LT( localIndex, segmentSize, "Local index exceeds segment bounds." );
+      return segmentOffset + localIndex * step;
+   };
+
+   /**
+    * \brief Get index of the segment.
+    *
+    * \return index of the segment.
+    */
+   __cuda_callable__
+   const IndexType&
+   getSegmentIndex() const
+   {
+      return this->segmentIdx;
+   };
+
+   /**
+    * \brief Returns iterator pointing at the beginning of the segment.
+    *
+    * \return iterator pointing at the beginning.
+    */
+   __cuda_callable__
+   IteratorType
+   begin() const
+   {
+      return IteratorType( *this, 0 );
+   };
+
+   /**
+    * \brief Returns iterator pointing at the end of the segment.
+    *
+    * \return iterator pointing at the end.
+    */
+   __cuda_callable__
+   IteratorType
+   end() const
+   {
+      return IteratorType( *this, this->getSize() );
+   };
+
+   /**
+    * \brief Returns constant iterator pointing at the beginning of the segment.
+    *
+    * \return iterator pointing at the beginning.
+    */
+   __cuda_callable__
+   IteratorType
+   cbegin() const
+   {
+      return IteratorType( *this, 0 );
+   };
+
+   /**
+    * \brief Returns constant iterator pointing at the end of the segment.
+    *
+    * \return iterator pointing at the end.
+    */
+   __cuda_callable__
+   IteratorType
+   cend() const
+   {
+      return IteratorType( *this, this->getSize() );
+   };
+
+protected:
+   IndexType segmentIdx, segmentOffset, segmentSize, step;
 };
 
 template< typename Index >
 class SegmentView< Index, RowMajorOrder >
 {
-   public:
-
-      /**
-       * \brief Type for indexing elements in related segments.
-       */
-      using IndexType = Index;
-
-      /**
-       * \brief Type of iterator for iterating over elements of the segment.
-       */
-      using IteratorType = SegmentViewIterator< SegmentView >;
-
-      /**
-       * \brief Conctructor with all parameters.
-       *
-       * \param segmentIdx is an index of segment the segment view will point to.
-       * \param offset is an offset of the segment in the parent segments.
-       * \param size is a size of the segment.
-       * \param step is stepping between neighbouring elements in the segment.
-       */
-      __cuda_callable__
-      SegmentView( const IndexType segmentIdx,
-                   const IndexType offset,
-                   const IndexType size,
-                   const IndexType step = 1 ) // For compatibility with previous specialization
-      : segmentIdx( segmentIdx ), segmentOffset( offset ), segmentSize( size ){};
-
-      /**
-       * \brief Copy constructor.
-       *
-       * \param view is the source view.
-       */
-      __cuda_callable__
-      SegmentView( const SegmentView& view )
-      : segmentIdx( view.segmentIdx ), segmentOffset( view.segmentOffset ), segmentSize( view.segmentSize ) {};
-
-      /**
-       * \brief Get the size of the segment, i.e. number of elements in the segment.
-       *
-       * \return number of elements in the segment.
-       */
-      __cuda_callable__
-      const IndexType& getSize() const
-      {
-         return this->segmentSize;
-      };
-
-      /**
-       * \brief Get global index of an element with rank \e localIndex in the segment.
-       *
-       * \param localIndex is the rank of the element in the segment.
-       * \return global index of the element.
-       */
-      __cuda_callable__
-      IndexType getGlobalIndex( const IndexType localIndex ) const
-      {
-         TNL_ASSERT_LT( localIndex, segmentSize, "Local index exceeds segment bounds." );
-         return segmentOffset + localIndex;
-      };
-
-      /**
-       * \brief Get index of the segment.
-       *
-       * \return index of the segment.
-       */
-      __cuda_callable__
-      const IndexType& getSegmentIndex() const
-      {
-         return this->segmentIdx;
-      };
-
-      /**
-       * \brief Returns iterator pointing at the beginning of the segment.
-       *
-       * \return iterator pointing at the beginning.
-       */
-      __cuda_callable__
-      IteratorType begin() const { return IteratorType( *this, 0 ); };
-
-      /**
-       * \brief Returns iterator pointing at the end of the segment.
-       *
-       * \return iterator pointing at the end.
-       */
-      __cuda_callable__
-      IteratorType end() const { return IteratorType( *this, this->getSize() ); };
-
-      /**
-       * \brief Returns constant iterator pointing at the beginning of the segment.
-       *
-       * \return iterator pointing at the beginning.
-       */
-      __cuda_callable__
-      const IteratorType cbegin() const { return IteratorType( *this, 0 ); };
-
-      /**
-       * \brief Returns constant iterator pointing at the end of the segment.
-       *
-       * \return iterator pointing at the end.
-       */
-      __cuda_callable__
-      const IteratorType cend() const { return IteratorType( *this, this->getSize() ); };
-
-      protected:
-
-         IndexType segmentIdx, segmentOffset, segmentSize;
+public:
+   /**
+    * \brief Type for indexing elements in related segments.
+    */
+   using IndexType = Index;
+
+   /**
+    * \brief Type of iterator for iterating over elements of the segment.
+    */
+   using IteratorType = SegmentViewIterator< SegmentView >;
+
+   /**
+    * \brief Conctructor with all parameters.
+    *
+    * \param segmentIdx is an index of segment the segment view will point to.
+    * \param offset is an offset of the segment in the parent segments.
+    * \param size is a size of the segment.
+    * \param step is stepping between neighbouring elements in the segment.
+    */
+   __cuda_callable__
+   SegmentView( const IndexType segmentIdx,
+                const IndexType offset,
+                const IndexType size,
+                const IndexType step = 1 )  // For compatibility with previous specialization
+   : segmentIdx( segmentIdx ), segmentOffset( offset ), segmentSize( size ){};
+
+   /**
+    * \brief Copy constructor.
+    *
+    * \param view is the source view.
+    */
+   __cuda_callable__
+   SegmentView( const SegmentView& view )
+   : segmentIdx( view.segmentIdx ), segmentOffset( view.segmentOffset ), segmentSize( view.segmentSize ){};
+
+   /**
+    * \brief Get the size of the segment, i.e. number of elements in the segment.
+    *
+    * \return number of elements in the segment.
+    */
+   __cuda_callable__
+   const IndexType&
+   getSize() const
+   {
+      return this->segmentSize;
+   };
+
+   /**
+    * \brief Get global index of an element with rank \e localIndex in the segment.
+    *
+    * \param localIndex is the rank of the element in the segment.
+    * \return global index of the element.
+    */
+   __cuda_callable__
+   IndexType
+   getGlobalIndex( const IndexType localIndex ) const
+   {
+      TNL_ASSERT_LT( localIndex, segmentSize, "Local index exceeds segment bounds." );
+      return segmentOffset + localIndex;
+   };
+
+   /**
+    * \brief Get index of the segment.
+    *
+    * \return index of the segment.
+    */
+   __cuda_callable__
+   const IndexType&
+   getSegmentIndex() const
+   {
+      return this->segmentIdx;
+   };
+
+   /**
+    * \brief Returns iterator pointing at the beginning of the segment.
+    *
+    * \return iterator pointing at the beginning.
+    */
+   __cuda_callable__
+   IteratorType
+   begin() const
+   {
+      return IteratorType( *this, 0 );
+   };
+
+   /**
+    * \brief Returns iterator pointing at the end of the segment.
+    *
+    * \return iterator pointing at the end.
+    */
+   __cuda_callable__
+   IteratorType
+   end() const
+   {
+      return IteratorType( *this, this->getSize() );
+   };
+
+   /**
+    * \brief Returns constant iterator pointing at the beginning of the segment.
+    *
+    * \return iterator pointing at the beginning.
+    */
+   __cuda_callable__
+   IteratorType
+   cbegin() const
+   {
+      return IteratorType( *this, 0 );
+   };
+
+   /**
+    * \brief Returns constant iterator pointing at the end of the segment.
+    *
+    * \return iterator pointing at the end.
+    */
+   __cuda_callable__
+   IteratorType
+   cend() const
+   {
+      return IteratorType( *this, this->getSize() );
+   };
+
+protected:
+   IndexType segmentIdx, segmentOffset, segmentSize;
 };
 
-      } //namespace Segments
-   } //namespace Algorithms
-} //namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/SegmentViewIterator.h b/src/TNL/Algorithms/Segments/SegmentViewIterator.h
index 483a63e84d598efd4dde1f63f28f638537174963..a35bd5fc7a9270848ff13ed74d0c83588b549722 100644
--- a/src/TNL/Algorithms/Segments/SegmentViewIterator.h
+++ b/src/TNL/Algorithms/Segments/SegmentViewIterator.h
@@ -12,8 +12,8 @@
 #include <TNL/Algorithms/Segments/SegmentElement.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
 /**
  * \brief Iterator for iterating over elements of a segment.
@@ -25,79 +25,81 @@ namespace TNL {
 template< typename SegmentView >
 class SegmentViewIterator
 {
-   public:
-
-      /**
-       * \brief Type of SegmentView
-       */
-      using SegmentViewType = SegmentView;
-
-      /**
-       * \brief The type used for matrix elements indexing.
-       */
-      using IndexType = typename SegmentViewType::IndexType;
-
-      /**
-       * \brief The type of related matrix element.
-       */
-      using SegmentElementType = SegmentElement< IndexType >;
-
-      __cuda_callable__
-      SegmentViewIterator( const SegmentViewType& segmentView,
-                           const IndexType& localIdx );
-
-      /**
-       * \brief Comparison of two matrix Segment iterators.
-       *
-       * \param other is another matrix Segment iterator.
-       * \return \e true if both iterators points at the same point of the same matrix, \e false otherwise.
-       */
-      __cuda_callable__
-      bool operator==( const SegmentViewIterator& other ) const;
-
-      /**
-       * \brief Comparison of two matrix Segment iterators.
-       *
-       * \param other is another matrix Segment iterator.
-       * \return \e false if both iterators points at the same point of the same matrix, \e true otherwise.
-       */
-      __cuda_callable__
-      bool operator!=( const SegmentViewIterator& other ) const;
-
-      /**
-       * \brief Operator for incrementing the iterator, i.e. moving to the next element.
-       *
-       * \return reference to this iterator.
-       */
-      __cuda_callable__
-      SegmentViewIterator& operator++();
-
-      /**
-       * \brief Operator for decrementing the iterator, i.e. moving to the previous element.
-       *
-       * \return reference to this iterator.
-       */
-      __cuda_callable__
-      SegmentViewIterator& operator--();
-
-      /**
-       * \brief Operator for derefrencing the iterator.
-       *
-       * It returns structure \ref SegmentElementType which represent one element of a segment.
-       * \return segment element the iterator points to.
-       */
-      __cuda_callable__
-      const SegmentElementType operator*() const;
-
-   protected:
-
-      const SegmentViewType& segmentView;
-
-      IndexType localIdx = 0;
+public:
+   /**
+    * \brief Type of SegmentView
+    */
+   using SegmentViewType = SegmentView;
+
+   /**
+    * \brief The type used for matrix elements indexing.
+    */
+   using IndexType = typename SegmentViewType::IndexType;
+
+   /**
+    * \brief The type of related matrix element.
+    */
+   using SegmentElementType = SegmentElement< IndexType >;
+
+   __cuda_callable__
+   SegmentViewIterator( const SegmentViewType& segmentView, const IndexType& localIdx );
+
+   /**
+    * \brief Comparison of two matrix Segment iterators.
+    *
+    * \param other is another matrix Segment iterator.
+    * \return \e true if both iterators points at the same point of the same matrix, \e false otherwise.
+    */
+   __cuda_callable__
+   bool
+   operator==( const SegmentViewIterator& other ) const;
+
+   /**
+    * \brief Comparison of two matrix Segment iterators.
+    *
+    * \param other is another matrix Segment iterator.
+    * \return \e false if both iterators points at the same point of the same matrix, \e true otherwise.
+    */
+   __cuda_callable__
+   bool
+   operator!=( const SegmentViewIterator& other ) const;
+
+   /**
+    * \brief Operator for incrementing the iterator, i.e. moving to the next element.
+    *
+    * \return reference to this iterator.
+    */
+   __cuda_callable__
+   SegmentViewIterator&
+   operator++();
+
+   /**
+    * \brief Operator for decrementing the iterator, i.e. moving to the previous element.
+    *
+    * \return reference to this iterator.
+    */
+   __cuda_callable__
+   SegmentViewIterator&
+   operator--();
+
+   /**
+    * \brief Operator for derefrencing the iterator.
+    *
+    * It returns structure \ref SegmentElementType which represent one element of a segment.
+    * \return segment element the iterator points to.
+    */
+   __cuda_callable__
+   const SegmentElementType
+   operator*() const;
+
+protected:
+   const SegmentViewType& segmentView;
+
+   IndexType localIdx = 0;
 };
 
-      } // namespace Segments
-   } // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
 
 #include <TNL/Algorithms/Segments/SegmentViewIterator.hpp>
diff --git a/src/TNL/Algorithms/Segments/SegmentViewIterator.hpp b/src/TNL/Algorithms/Segments/SegmentViewIterator.hpp
index a71a19fe73f5fa663daf471063eb6548a269f573..f0e32c2930ec353a121bc472efd8cec455241579 100644
--- a/src/TNL/Algorithms/Segments/SegmentViewIterator.hpp
+++ b/src/TNL/Algorithms/Segments/SegmentViewIterator.hpp
@@ -10,33 +10,27 @@
 #include <TNL/Assert.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
 template< typename SegmentView >
 __cuda_callable__
-SegmentViewIterator< SegmentView >::
-SegmentViewIterator( const SegmentViewType& segmentView,
-                     const IndexType& localIdx )
+SegmentViewIterator< SegmentView >::SegmentViewIterator( const SegmentViewType& segmentView, const IndexType& localIdx )
 : segmentView( segmentView ), localIdx( localIdx )
-{
-}
+{}
 
 template< typename SegmentView >
-__cuda_callable__ bool
-SegmentViewIterator< SegmentView >::
-operator==( const SegmentViewIterator& other ) const
+__cuda_callable__
+bool
+SegmentViewIterator< SegmentView >::operator==( const SegmentViewIterator& other ) const
 {
-   if( &this->segmentView == &other.segmentView &&
-       localIdx == other.localIdx )
-      return true;
-   return false;
+   return &this->segmentView == &other.segmentView && localIdx == other.localIdx;
 }
 
 template< typename SegmentView >
-__cuda_callable__ bool
-SegmentViewIterator< SegmentView >::
-operator!=( const SegmentViewIterator& other ) const
+__cuda_callable__
+bool
+SegmentViewIterator< SegmentView >::operator!=( const SegmentViewIterator& other ) const
 {
    return ! ( other == *this );
 }
@@ -44,36 +38,32 @@ operator!=( const SegmentViewIterator& other ) const
 template< typename SegmentView >
 __cuda_callable__
 SegmentViewIterator< SegmentView >&
-SegmentViewIterator< SegmentView >::
-operator++()
+SegmentViewIterator< SegmentView >::operator++()
 {
    if( localIdx < segmentView.getSize() )
-      localIdx ++;
+      localIdx++;
    return *this;
 }
 
 template< typename SegmentView >
 __cuda_callable__
 SegmentViewIterator< SegmentView >&
-SegmentViewIterator< SegmentView >::
-operator--()
+SegmentViewIterator< SegmentView >::operator--()
 {
    if( localIdx > 0 )
-      localIdx --;
+      localIdx--;
    return *this;
 }
 
 template< typename SegmentView >
-__cuda_callable__ auto
-SegmentViewIterator< SegmentView >::
-operator*() const -> const SegmentElementType
+__cuda_callable__
+auto
+SegmentViewIterator< SegmentView >::operator*() const -> const SegmentElementType
 {
    return SegmentElementType(
-      this->segmentView.getSegmentIndex(),
-      this->localIdx,
-      this->segmentView.getGlobalIndex( this->localIdx ) );
+      this->segmentView.getSegmentIndex(), this->localIdx, this->segmentView.getGlobalIndex( this->localIdx ) );
 }
 
-      } // namespace Segments
-   } // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/SegmentsPrinting.h b/src/TNL/Algorithms/Segments/SegmentsPrinting.h
index 36aca444a50e6760943c1aad92b5813d390f0f2a..750d5f9730f328cf550f56c00103246368db7696 100644
--- a/src/TNL/Algorithms/Segments/SegmentsPrinting.h
+++ b/src/TNL/Algorithms/Segments/SegmentsPrinting.h
@@ -10,8 +10,8 @@
 #include <TNL/Containers/Array.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
 /**
  * \brief Print segments sizes, i.e. the segments setup.
@@ -27,15 +27,15 @@ namespace TNL {
  * \include SegmentsPrintingExample-1.out
  */
 template< typename Segments >
-std::ostream& printSegments( const Segments& segments, std::ostream& str )
+std::ostream&
+printSegments( const Segments& segments, std::ostream& str )
 {
    using IndexType = typename Segments::IndexType;
    using DeviceType = typename Segments::DeviceType;
 
    auto segmentsCount = segments.getSegmentsCount();
    str << " [";
-   for( IndexType segmentIdx = 0; segmentIdx < segmentsCount; segmentIdx++ )
-   {
+   for( IndexType segmentIdx = 0; segmentIdx < segmentsCount; segmentIdx++ ) {
       auto segmentSize = segments.getSegmentSize( segmentIdx );
       str << " " << segmentSize;
       if( segmentIdx < segmentsCount )
@@ -47,14 +47,13 @@ std::ostream& printSegments( const Segments& segments, std::ostream& str )
 
 /// This is to prevent from appearing in Doxygen documentation.
 /// \cond HIDDEN_CLASS
-template< typename Segments,
-          typename Fetch >
+template< typename Segments, typename Fetch >
 struct SegmentsPrinter
 {
-   SegmentsPrinter( const Segments& segments, Fetch&& fetch )
-   : segments( segments ), fetch( fetch ) {}
+   SegmentsPrinter( const Segments& segments, Fetch&& fetch ) : segments( segments ), fetch( fetch ) {}
 
-   std::ostream& print( std::ostream& str ) const
+   std::ostream&
+   print( std::ostream& str ) const
    {
       using IndexType = typename Segments::IndexType;
       using DeviceType = typename Segments::DeviceType;
@@ -62,17 +61,17 @@ struct SegmentsPrinter
 
       TNL::Containers::Array< ValueType, DeviceType, IndexType > aux( 1 );
       auto view = segments.getConstView();
-      for( IndexType segmentIdx = 0; segmentIdx < segments.getSegmentsCount(); segmentIdx++ )
-      {
+      for( IndexType segmentIdx = 0; segmentIdx < segments.getSegmentsCount(); segmentIdx++ ) {
          str << "Seg. " << segmentIdx << ": [ ";
          auto segmentSize = segments.getSegmentSize( segmentIdx );
-         for( IndexType localIdx = 0; localIdx < segmentSize; localIdx++ )
-         {
-            aux.forAllElements( [=] __cuda_callable__ ( IndexType elementIdx, double& v ) mutable {
-               //printf( "####### localIdx = %d, globalIdx = %d \n", localIdx, view.getGlobalIndex( segmentIdx, localIdx ) );
-               //v = view.getGlobalIndex( segmentIdx, localIdx );
-               v = fetch( view.getGlobalIndex( segmentIdx, localIdx ) );
-            } );
+         for( IndexType localIdx = 0; localIdx < segmentSize; localIdx++ ) {
+            aux.forAllElements(
+               [ = ] __cuda_callable__( IndexType elementIdx, double& v ) mutable
+               {
+                  // printf( "####### localIdx = %d, globalIdx = %d \n", localIdx, view.getGlobalIndex( segmentIdx, localIdx )
+                  // ); v = view.getGlobalIndex( segmentIdx, localIdx );
+                  v = fetch( view.getGlobalIndex( segmentIdx, localIdx ) );
+               } );
             auto value = aux.getElement( 0 );
             str << value;
             if( localIdx < segmentSize - 1 )
@@ -83,8 +82,7 @@ struct SegmentsPrinter
       return str;
    }
 
-   protected:
-
+protected:
    const Segments& segments;
 
    Fetch fetch;
@@ -97,9 +95,9 @@ std::ostream& operator<<( std::ostream& str, const SegmentsPrinter< Segments, Fe
    return printer.print( str );
 }*/
 
-template< typename Segments,
-          typename Fetch >
-std::ostream& printSegments( const Segments& segments, Fetch&& fetch, std::ostream& str )
+template< typename Segments, typename Fetch >
+std::ostream&
+printSegments( const Segments& segments, Fetch&& fetch, std::ostream& str )
 {
    using IndexType = typename Segments::IndexType;
    using DeviceType = typename Segments::DeviceType;
@@ -107,18 +105,18 @@ std::ostream& printSegments( const Segments& segments, Fetch&& fetch, std::ostre
 
    TNL::Containers::Array< ValueType, DeviceType, IndexType > aux( 1 );
    auto view = segments.getConstView();
-   for( IndexType segmentIdx = 0; segmentIdx < segments.getSegmentsCount(); segmentIdx++ )
-   {
+   for( IndexType segmentIdx = 0; segmentIdx < segments.getSegmentsCount(); segmentIdx++ ) {
       str << "Seg. " << segmentIdx << ": [ ";
       auto segmentSize = segments.getSegmentSize( segmentIdx );
-      //std::cerr << "Segment size = " << segmentSize << std::endl;
-      for( IndexType localIdx = 0; localIdx < segmentSize; localIdx++ )
-      {
-         aux.forAllElements( [=] __cuda_callable__ ( IndexType elementIdx, double& v ) mutable {
-            //printf( "####### localIdx = %d, globalIdx = %d \n", localIdx, view.getGlobalIndex( segmentIdx, localIdx ) );
-            v = fetch( view.getGlobalIndex( segmentIdx, localIdx ) );
-            //v = view.getGlobalIndex( segmentIdx, localIdx );
-         } );
+      // std::cerr << "Segment size = " << segmentSize << std::endl;
+      for( IndexType localIdx = 0; localIdx < segmentSize; localIdx++ ) {
+         aux.forAllElements(
+            [ = ] __cuda_callable__( IndexType elementIdx, double& v ) mutable
+            {
+               // printf( "####### localIdx = %d, globalIdx = %d \n", localIdx, view.getGlobalIndex( segmentIdx, localIdx ) );
+               v = fetch( view.getGlobalIndex( segmentIdx, localIdx ) );
+               // v = view.getGlobalIndex( segmentIdx, localIdx );
+            } );
          auto value = aux.getElement( 0 );
          str << value;
          if( localIdx < segmentSize - 1 )
@@ -130,6 +128,6 @@ std::ostream& printSegments( const Segments& segments, Fetch&& fetch, std::ostre
 }
 /// \endcond
 
-      } // namespace Segments
-   } // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/SlicedEllpack.h b/src/TNL/Algorithms/Segments/SlicedEllpack.h
index 61c5468530124c70ae92689da297218c6e693778..61263489bc93321f5fe38da8fd2c7a02f8713248 100644
--- a/src/TNL/Algorithms/Segments/SlicedEllpack.h
+++ b/src/TNL/Algorithms/Segments/SlicedEllpack.h
@@ -12,8 +12,8 @@
 #include <TNL/Algorithms/Segments/SegmentView.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
 template< typename Device,
           typename Index,
@@ -22,126 +22,165 @@ template< typename Device,
           int SliceSize = 32 >
 class SlicedEllpack
 {
-   public:
-
-      using DeviceType = Device;
-      using IndexType = std::remove_const_t< Index >;
-      using OffsetsContainer = Containers::Vector< Index, DeviceType, IndexType, IndexAllocator >;
-      static constexpr int getSliceSize() { return SliceSize; }
-      static constexpr ElementsOrganization getOrganization() { return Organization; }
-      using ViewType = SlicedEllpackView< Device, Index, Organization, SliceSize >;
-      template< typename Device_, typename Index_ >
-      using ViewTemplate = SlicedEllpackView< Device_, Index_, Organization, SliceSize >;
-      using ConstViewType = SlicedEllpackView< Device, std::add_const_t< Index >, Organization, SliceSize >;
-      using SegmentViewType = SegmentView< IndexType, Organization >;
-
-      static constexpr bool havePadding() { return true; };
-
-      SlicedEllpack();
-
-      template< typename SizesContainer >
-      SlicedEllpack( const SizesContainer& sizes );
-
-      template< typename ListIndex >
-      SlicedEllpack( const std::initializer_list< ListIndex >& segmentsSizes );
-
-      SlicedEllpack( const SlicedEllpack& segments ) = default;
-
-      SlicedEllpack( SlicedEllpack&& segments ) = default;
-
-      static String getSerializationType();
-
-      static String getSegmentsType();
-
-      ViewType getView();
-
-      const ConstViewType getConstView() const;
-
-      /**
-       * \brief Set sizes of particular segments.
-       */
-      template< typename SizesHolder = OffsetsContainer >
-      void setSegmentsSizes( const SizesHolder& sizes );
-
-      void reset();
-
-      __cuda_callable__
-      IndexType getSegmentsCount() const;
-
-      __cuda_callable__
-      IndexType getSegmentSize( const IndexType segmentIdx ) const;
-
-      /**
-       * \brief Number segments.
-       */
-      __cuda_callable__
-      IndexType getSize() const;
-
-
-      __cuda_callable__
-      IndexType getStorageSize() const;
-
-      __cuda_callable__
-      IndexType getGlobalIndex( const Index segmentIdx, const Index localIdx ) const;
-
-      __cuda_callable__
-      SegmentViewType getSegmentView( const IndexType segmentIdx ) const;
-
-      /***
-       * \brief Go over all segments and for each segment element call
-       * function 'f' with arguments 'args'. The return type of 'f' is bool.
-       * When its true, the for-loop continues. Once 'f' returns false, the for-loop
-       * is terminated.
-       */
-      template< typename Function >
-      void forElements( IndexType first, IndexType last, Function&& f ) const;
-
-      template< typename Function >
-      void forAllElements( Function&& f ) const;
-
-      template< typename Function >
-      void forSegments( IndexType begin, IndexType end, Function&& f ) const;
-
-      template< typename Function >
-      void forAllSegments( Function&& f ) const;
-
-      /***
-       * \brief Go over all segments and perform a reduction in each of them.
-       */
-      template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
-      void reduceSegments( IndexType first, IndexType last, Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
-
-      template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
-      void reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
-
-      SlicedEllpack& operator=( const SlicedEllpack& source ) = default;
-
-      template< typename Device_, typename Index_, typename IndexAllocator_, ElementsOrganization Organization_ >
-      SlicedEllpack& operator=( const SlicedEllpack< Device_, Index_, IndexAllocator_, Organization_, SliceSize >& source );
-
-      void save( File& file ) const;
-
-      void load( File& file );
-
-      template< typename Fetch >
-      SegmentsPrinter< SlicedEllpack, Fetch > print( Fetch&& fetch ) const;
-
-   protected:
-
-      IndexType size, alignedSize, segmentsCount;
-
-      OffsetsContainer sliceOffsets, sliceSegmentSizes;
+public:
+   using DeviceType = Device;
+   using IndexType = std::remove_const_t< Index >;
+   using OffsetsContainer = Containers::Vector< Index, DeviceType, IndexType, IndexAllocator >;
+   static constexpr int
+   getSliceSize()
+   {
+      return SliceSize;
+   }
+   static constexpr ElementsOrganization
+   getOrganization()
+   {
+      return Organization;
+   }
+   using ViewType = SlicedEllpackView< Device, Index, Organization, SliceSize >;
+   template< typename Device_, typename Index_ >
+   using ViewTemplate = SlicedEllpackView< Device_, Index_, Organization, SliceSize >;
+   using ConstViewType = SlicedEllpackView< Device, std::add_const_t< Index >, Organization, SliceSize >;
+   using SegmentViewType = SegmentView< IndexType, Organization >;
+
+   static constexpr bool
+   havePadding()
+   {
+      return true;
+   };
+
+   SlicedEllpack() = default;
+
+   template< typename SizesContainer >
+   SlicedEllpack( const SizesContainer& sizes );
+
+   template< typename ListIndex >
+   SlicedEllpack( const std::initializer_list< ListIndex >& segmentsSizes );
+
+   SlicedEllpack( const SlicedEllpack& segments ) = default;
+
+   SlicedEllpack( SlicedEllpack&& segments ) noexcept = default;
+
+   static std::string
+   getSerializationType();
+
+   static String
+   getSegmentsType();
+
+   ViewType
+   getView();
+
+   const ConstViewType
+   getConstView() const;
+
+   /**
+    * \brief Set sizes of particular segments.
+    */
+   template< typename SizesHolder = OffsetsContainer >
+   void
+   setSegmentsSizes( const SizesHolder& sizes );
+
+   void
+   reset();
+
+   __cuda_callable__
+   IndexType
+   getSegmentsCount() const;
+
+   __cuda_callable__
+   IndexType
+   getSegmentSize( IndexType segmentIdx ) const;
+
+   /**
+    * \brief Number segments.
+    */
+   __cuda_callable__
+   IndexType
+   getSize() const;
+
+   __cuda_callable__
+   IndexType
+   getStorageSize() const;
+
+   __cuda_callable__
+   IndexType
+   getGlobalIndex( Index segmentIdx, Index localIdx ) const;
+
+   __cuda_callable__
+   SegmentViewType
+   getSegmentView( IndexType segmentIdx ) const;
+
+   /***
+    * \brief Go over all segments and for each segment element call
+    * function 'f' with arguments 'args'. The return type of 'f' is bool.
+    * When its true, the for-loop continues. Once 'f' returns false, the for-loop
+    * is terminated.
+    */
+   template< typename Function >
+   void
+   forElements( IndexType first, IndexType last, Function&& f ) const;
+
+   template< typename Function >
+   void
+   forAllElements( Function&& f ) const;
+
+   template< typename Function >
+   void
+   forSegments( IndexType begin, IndexType end, Function&& f ) const;
+
+   template< typename Function >
+   void
+   forAllSegments( Function&& f ) const;
+
+   /***
+    * \brief Go over all segments and perform a reduction in each of them.
+    */
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+   void
+   reduceSegments( IndexType first,
+                   IndexType last,
+                   Fetch& fetch,
+                   const Reduction& reduction,
+                   ResultKeeper& keeper,
+                   const Real& zero ) const;
+
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+   void
+   reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
+
+   SlicedEllpack&
+   operator=( const SlicedEllpack& source ) = default;
+
+   template< typename Device_, typename Index_, typename IndexAllocator_, ElementsOrganization Organization_ >
+   SlicedEllpack&
+   operator=( const SlicedEllpack< Device_, Index_, IndexAllocator_, Organization_, SliceSize >& source );
+
+   void
+   save( File& file ) const;
+
+   void
+   load( File& file );
+
+   template< typename Fetch >
+   SegmentsPrinter< SlicedEllpack, Fetch >
+   print( Fetch&& fetch ) const;
+
+protected:
+   IndexType size = 0;
+   IndexType alignedSize = 0;
+   IndexType segmentsCount = 0;
+
+   OffsetsContainer sliceOffsets, sliceSegmentSizes;
 };
 
-template <typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
-std::ostream& operator<<( std::ostream& str, const SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >& segments ) { return printSegments( str, segments ); }
-
-      } // namespace Segements
-   }  // namespace Algorithms
-} // namespace TNL
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
+std::ostream&
+operator<<( std::ostream& str, const SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >& segments )
+{
+   return printSegments( str, segments );
+}
+
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
 
 #include <TNL/Algorithms/Segments/SlicedEllpack.hpp>
diff --git a/src/TNL/Algorithms/Segments/SlicedEllpack.hpp b/src/TNL/Algorithms/Segments/SlicedEllpack.hpp
index b5df25a5d1ee80e77bda41b1d0f5c482786ba9cf..caef47f6414ee30fef7783c22a7920ce734b0d69 100644
--- a/src/TNL/Algorithms/Segments/SlicedEllpack.hpp
+++ b/src/TNL/Algorithms/Segments/SlicedEllpack.hpp
@@ -13,105 +13,58 @@
 #include <TNL/Algorithms/Segments/Ellpack.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
-
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
-SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-SlicedEllpack()
-   : size( 0 ), alignedSize( 0 ), segmentsCount( 0 )
-{
-}
-
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
-   template< typename SizesContainer >
-SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-SlicedEllpack( const SizesContainer& segmentsSizes )
-   : size( 0 ), alignedSize( 0 ), segmentsCount( 0 )
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
+template< typename SizesContainer >
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::SlicedEllpack( const SizesContainer& segmentsSizes )
 {
    this->setSegmentsSizes( segmentsSizes );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
-   template< typename ListIndex >
-SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-SlicedEllpack( const std::initializer_list< ListIndex >& segmentsSizes )
-   : size( 0 ), alignedSize( 0 ), segmentsCount( 0 )
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
+template< typename ListIndex >
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::SlicedEllpack(
+   const std::initializer_list< ListIndex >& segmentsSizes )
 {
    this->setSegmentsSizes( Containers::Vector< IndexType, DeviceType, IndexType >( segmentsSizes ) );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
-String
-SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-getSerializationType()
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
+std::string
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::getSerializationType()
 {
-   // FIXME: the serialized data DEPEND on the Organization and Alignment parameters, so it should be reflected in the serialization type
+   // FIXME: the serialized data DEPEND on the Organization and Alignment parameters, so it should be reflected in the
+   // serialization type
    return "SlicedEllpack< [any_device], " + TNL::getSerializationType< IndexType >() + " >";
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
 String
-SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-getSegmentsType()
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::getSegmentsType()
 {
    return ViewType::getSegmentsType();
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
 typename SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::ViewType
-SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-getView()
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::getView()
 {
    return ViewType( size, alignedSize, segmentsCount, sliceOffsets.getView(), sliceSegmentSizes.getView() );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
 auto
-SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-getConstView() const -> const ConstViewType
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::getConstView() const -> const ConstViewType
 {
    return ConstViewType( size, alignedSize, segmentsCount, sliceOffsets.getConstView(), sliceSegmentSizes.getConstView() );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
-   template< typename SizesHolder >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
+template< typename SizesHolder >
 void
-SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-setSegmentsSizes( const SizesHolder& sizes )
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::setSegmentsSizes( const SizesHolder& sizes )
 {
    this->segmentsCount = sizes.getSize();
    const IndexType slicesCount = roundUpDivision( this->segmentsCount, getSliceSize() );
@@ -125,33 +78,32 @@ setSegmentsSizes( const SizesHolder& sizes )
    const auto sizes_view = sizes.getConstView();
    auto slices_view = this->sliceOffsets.getView();
    auto slice_segment_size_view = this->sliceSegmentSizes.getView();
-   auto fetch = [=] __cuda_callable__ ( IndexType segmentIdx, IndexType localIdx, IndexType globalIdx, bool& compute ) -> IndexType {
+   auto fetch =
+      [ = ] __cuda_callable__( IndexType segmentIdx, IndexType localIdx, IndexType globalIdx, bool& compute ) -> IndexType
+   {
       if( globalIdx < _size )
          return sizes_view[ globalIdx ];
       return 0;
    };
-   auto reduce = [] __cuda_callable__ ( IndexType& aux, const IndexType i ) -> IndexType {
+   auto reduce = [] __cuda_callable__( IndexType & aux, const IndexType i ) -> IndexType
+   {
       return TNL::max( aux, i );
    };
-   auto keep = [=] __cuda_callable__ ( IndexType i, IndexType res ) mutable {
+   auto keep = [ = ] __cuda_callable__( IndexType i, IndexType res ) mutable
+   {
       slices_view[ i ] = res * SliceSize;
       slice_segment_size_view[ i ] = res;
    };
    ellpack.reduceAllSegments( fetch, reduce, keep, std::numeric_limits< IndexType >::min() );
    Algorithms::inplaceExclusiveScan( this->sliceOffsets );
-   //this->sliceOffsets.template exclusiveScan< Algorithms::detail::ScanType::Exclusive >();
+   // this->sliceOffsets.template exclusiveScan< Algorithms::detail::ScanType::Exclusive >();
    this->size = sum( sizes );
    this->alignedSize = this->sliceOffsets.getElement( slicesCount );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
 void
-SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-reset()
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::reset()
 {
    this->size = 0;
    this->alignedSize = 0;
@@ -160,78 +112,64 @@ reset()
    this->sliceSegmentSizes.reset();
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
-__cuda_callable__ auto SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-getSegmentsCount() const -> IndexType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
+__cuda_callable__
+auto
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::getSegmentsCount() const -> IndexType
 {
    return this->segmentsCount;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
-__cuda_callable__ auto SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-getSegmentSize( const IndexType segmentIdx ) const -> IndexType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
+__cuda_callable__
+auto
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::getSegmentSize( const IndexType segmentIdx ) const
+   -> IndexType
 {
    const Index sliceIdx = segmentIdx / SliceSize;
    if( std::is_same< DeviceType, Devices::Host >::value )
       return this->sliceSegmentSizes[ sliceIdx ];
-   else
-   {
+   else {
 #ifdef __CUDA_ARCH__
-   return this->sliceSegmentSizes[ sliceIdx ];
+      return this->sliceSegmentSizes[ sliceIdx ];
 #else
-   return this->sliceSegmentSizes.getElement( sliceIdx );
+      return this->sliceSegmentSizes.getElement( sliceIdx );
 #endif
    }
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
-__cuda_callable__ auto SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-getSize() const -> IndexType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
+__cuda_callable__
+auto
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::getSize() const -> IndexType
 {
    return this->size;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
-__cuda_callable__ auto SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-getStorageSize() const -> IndexType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
+__cuda_callable__
+auto
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::getStorageSize() const -> IndexType
 {
    return this->alignedSize;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
-__cuda_callable__ auto SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-getGlobalIndex( const Index segmentIdx, const Index localIdx ) const -> IndexType
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
+__cuda_callable__
+auto
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::getGlobalIndex( const Index segmentIdx,
+                                                                                         const Index localIdx ) const
+   -> IndexType
 {
    const IndexType sliceIdx = segmentIdx / SliceSize;
    const IndexType segmentInSliceIdx = segmentIdx % SliceSize;
-   IndexType sliceOffset, segmentSize;
-   if( std::is_same< DeviceType, Devices::Host >::value )
-   {
+   IndexType sliceOffset;
+   IndexType segmentSize;
+   if( std::is_same< DeviceType, Devices::Host >::value ) {
       sliceOffset = this->sliceOffsets[ sliceIdx ];
       segmentSize = this->sliceSegmentSizes[ sliceIdx ];
    }
-   else
-   {
+   else {
 #ifdef __CUDA__ARCH__
       sliceOffset = this->sliceOffsets[ sliceIdx ];
       segmentSize = this->sliceSegmentSizes[ sliceIdx ];
@@ -246,15 +184,11 @@ getGlobalIndex( const Index segmentIdx, const Index localIdx ) const -> IndexTyp
       return sliceOffset + segmentInSliceIdx + SliceSize * localIdx;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
 __cuda_callable__
 auto
-SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::getSegmentView( const IndexType segmentIdx ) const
+   -> SegmentViewType
 {
    const IndexType sliceIdx = segmentIdx / SliceSize;
    const IndexType segmentInSliceIdx = segmentIdx % SliceSize;
@@ -267,93 +201,71 @@ getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType
       return SegmentViewType( segmentIdx, sliceOffset + segmentInSliceIdx, segmentSize, SliceSize );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
-   template< typename Function >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
+template< typename Function >
 void
-SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-forElements( IndexType first, IndexType last, Function&& f ) const
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::forElements( IndexType first,
+                                                                                      IndexType last,
+                                                                                      Function&& f ) const
 {
    this->getConstView().forElements( first, last, f );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
-   template< typename Function >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
+template< typename Function >
 void
-SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-forAllElements( Function&& f ) const
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::forAllElements( Function&& f ) const
 {
    this->forElements( 0, this->getSegmentsCount(), f );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
-   template< typename Function >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
+template< typename Function >
 void
-SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-forSegments( IndexType begin, IndexType end, Function&& f ) const
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::forSegments( IndexType begin,
+                                                                                      IndexType end,
+                                                                                      Function&& f ) const
 {
    this->getConstView().forSegments( begin, end, f );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
-   template< typename Function >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
+template< typename Function >
 void
-SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-forAllSegments( Function&& f ) const
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::forAllSegments( Function&& f ) const
 {
    this->getConstView().forAllSegments( f );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
-   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
 void
-SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-reduceSegments( IndexType first, IndexType last, Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::reduceSegments( IndexType first,
+                                                                                         IndexType last,
+                                                                                         Fetch& fetch,
+                                                                                         const Reduction& reduction,
+                                                                                         ResultKeeper& keeper,
+                                                                                         const Real& zero ) const
 {
    this->getConstView().reduceSegments( first, last, fetch, reduction, keeper, zero );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
-   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
 void
-SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::reduceAllSegments( Fetch& fetch,
+                                                                                            const Reduction& reduction,
+                                                                                            ResultKeeper& keeper,
+                                                                                            const Real& zero ) const
 {
    this->reduceSegments( 0, this->getSegmentsCount(), fetch, reduction, keeper, zero );
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
-   template< typename Device_, typename Index_, typename IndexAllocator_, ElementsOrganization Organization_ >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
+template< typename Device_, typename Index_, typename IndexAllocator_, ElementsOrganization Organization_ >
 SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >&
-SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-operator=( const SlicedEllpack< Device_, Index_, IndexAllocator_, Organization_, SliceSize >& source )
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::operator=(
+   const SlicedEllpack< Device_, Index_, IndexAllocator_, Organization_, SliceSize >& source )
 {
    this->size = source.size;
    this->alignedSize = source.alignedSize;
@@ -363,14 +275,9 @@ operator=( const SlicedEllpack< Device_, Index_, IndexAllocator_, Organization_,
    return *this;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
 void
-SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-save( File& file ) const
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::save( File& file ) const
 {
    file.save( &size );
    file.save( &alignedSize );
@@ -379,14 +286,9 @@ save( File& file ) const
    file << this->sliceSegmentSizes;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
 void
-SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-load( File& file )
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::load( File& file )
 {
    file.load( &size );
    file.load( &alignedSize );
@@ -395,19 +297,15 @@ load( File& file )
    file >> this->sliceSegmentSizes;
 }
 
-template< typename Device,
-          typename Index,
-          typename IndexAllocator,
-          ElementsOrganization Organization,
-          int SliceSize >
-      template< typename Fetch >
+template< typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization, int SliceSize >
+template< typename Fetch >
 auto
-SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::
-print( Fetch&& fetch ) const -> SegmentsPrinter< SlicedEllpack, Fetch >
+SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >::print( Fetch&& fetch ) const
+   -> SegmentsPrinter< SlicedEllpack, Fetch >
 {
    return SegmentsPrinter< SlicedEllpack, Fetch >( *this, fetch );
 }
 
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/SlicedEllpackView.h b/src/TNL/Algorithms/Segments/SlicedEllpackView.h
index 288dd9e2be0fd32ebaaee0f4b5b3250cf3ea8424..a37a56ac7dc248ffd8f3b1ea7a4af593414c32ad 100644
--- a/src/TNL/Algorithms/Segments/SlicedEllpackView.h
+++ b/src/TNL/Algorithms/Segments/SlicedEllpackView.h
@@ -14,8 +14,8 @@
 #include <TNL/Algorithms/Segments/SegmentsPrinting.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
 template< typename Device,
           typename Index,
@@ -23,119 +23,157 @@ template< typename Device,
           int SliceSize = 32 >
 class SlicedEllpackView
 {
-   public:
-
-      using DeviceType = Device;
-      using IndexType = std::remove_const_t< Index >;
-      using OffsetsView = typename Containers::VectorView< Index, DeviceType, IndexType >;
-      static constexpr int getSliceSize() { return SliceSize; }
-      static constexpr ElementsOrganization getOrganization() { return Organization; }
-      template< typename Device_, typename Index_ >
-      using ViewTemplate = SlicedEllpackView< Device_, Index_, Organization, SliceSize >;
-      using ViewType = SlicedEllpackView;
-      using ConstViewType = SlicedEllpackView< Device, std::add_const_t< Index >, Organization, SliceSize >;
-      using SegmentViewType = SegmentView< IndexType, Organization >;
-
-      static constexpr bool havePadding() { return true; };
-
-      __cuda_callable__
-      SlicedEllpackView();
-
-      __cuda_callable__
-      SlicedEllpackView( IndexType size,
-                         IndexType alignedSize,
-                         IndexType segmentsCount,
-                         OffsetsView&& sliceOffsets,
-                         OffsetsView&& sliceSegmentSizes );
-
-      __cuda_callable__
-      SlicedEllpackView( const SlicedEllpackView& slicedEllpackView ) = default;
-
-      __cuda_callable__
-      SlicedEllpackView( SlicedEllpackView&& slicedEllpackView ) = default;
-
-      static String getSerializationType();
-
-      static String getSegmentsType();
-
-      __cuda_callable__
-      ViewType getView();
-
-      __cuda_callable__
-      const ConstViewType getConstView() const;
-
-      __cuda_callable__
-      IndexType getSegmentsCount() const;
-
-      __cuda_callable__
-      IndexType getSegmentSize( const IndexType segmentIdx ) const;
-
-      /**
-       * \brief Number segments.
-       */
-      __cuda_callable__
-      IndexType getSize() const;
-
-      __cuda_callable__
-      IndexType getStorageSize() const;
-
-      __cuda_callable__
-      IndexType getGlobalIndex( const Index segmentIdx, const Index localIdx ) const;
-
-      __cuda_callable__
-      SegmentViewType getSegmentView( const IndexType segmentIdx ) const;
-
-      /***
-       * \brief Go over all segments and for each segment element call
-       * function 'f' with arguments 'args'. The return type of 'f' is bool.
-       * When its true, the for-loop continues. Once 'f' returns false, the for-loop
-       * is terminated.
-       */
-      template< typename Function >
-      void forElements( IndexType first, IndexType last, Function&& f ) const;
-
-      template< typename Function >
-      void forAllElements( Function&& f ) const;
-
-      template< typename Function >
-      void forSegments( IndexType begin, IndexType end, Function&& f ) const;
-
-      template< typename Function >
-      void forAllSegments( Function&& f ) const;
-
-      /***
-       * \brief Go over all segments and perform a reduction in each of them.
-       */
-      template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
-      void reduceSegments( IndexType first, IndexType last, Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
-
-      template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
-      void reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
-
-      SlicedEllpackView& operator=( const SlicedEllpackView& view );
-
-      void save( File& file ) const;
-
-      void load( File& file );
-
-      template< typename Fetch >
-      SegmentsPrinter< SlicedEllpackView, Fetch > print( Fetch&& fetch ) const;
-
-   protected:
-
-      IndexType size, alignedSize, segmentsCount;
-
-      OffsetsView sliceOffsets, sliceSegmentSizes;
+public:
+   using DeviceType = Device;
+   using IndexType = std::remove_const_t< Index >;
+   using OffsetsView = typename Containers::VectorView< Index, DeviceType, IndexType >;
+   static constexpr int
+   getSliceSize()
+   {
+      return SliceSize;
+   }
+   static constexpr ElementsOrganization
+   getOrganization()
+   {
+      return Organization;
+   }
+   template< typename Device_, typename Index_ >
+   using ViewTemplate = SlicedEllpackView< Device_, Index_, Organization, SliceSize >;
+   using ViewType = SlicedEllpackView;
+   using ConstViewType = SlicedEllpackView< Device, std::add_const_t< Index >, Organization, SliceSize >;
+   using SegmentViewType = SegmentView< IndexType, Organization >;
+
+   static constexpr bool
+   havePadding()
+   {
+      return true;
+   };
+
+   __cuda_callable__
+   SlicedEllpackView() = default;
+
+   __cuda_callable__
+   SlicedEllpackView( IndexType size,
+                      IndexType alignedSize,
+                      IndexType segmentsCount,
+                      OffsetsView&& sliceOffsets,
+                      OffsetsView&& sliceSegmentSizes );
+
+   __cuda_callable__
+   SlicedEllpackView( const SlicedEllpackView& slicedEllpackView ) = default;
+
+   __cuda_callable__
+   SlicedEllpackView( SlicedEllpackView&& slicedEllpackView ) noexcept = default;
+
+   static std::string
+   getSerializationType();
+
+   static String
+   getSegmentsType();
+
+   __cuda_callable__
+   ViewType
+   getView();
+
+   __cuda_callable__
+   const ConstViewType
+   getConstView() const;
+
+   __cuda_callable__
+   IndexType
+   getSegmentsCount() const;
+
+   __cuda_callable__
+   IndexType
+   getSegmentSize( IndexType segmentIdx ) const;
+
+   /**
+    * \brief Number segments.
+    */
+   __cuda_callable__
+   IndexType
+   getSize() const;
+
+   __cuda_callable__
+   IndexType
+   getStorageSize() const;
+
+   __cuda_callable__
+   IndexType
+   getGlobalIndex( Index segmentIdx, Index localIdx ) const;
+
+   __cuda_callable__
+   SegmentViewType
+   getSegmentView( IndexType segmentIdx ) const;
+
+   /***
+    * \brief Go over all segments and for each segment element call
+    * function 'f' with arguments 'args'. The return type of 'f' is bool.
+    * When its true, the for-loop continues. Once 'f' returns false, the for-loop
+    * is terminated.
+    */
+   template< typename Function >
+   void
+   forElements( IndexType first, IndexType last, Function&& f ) const;
+
+   template< typename Function >
+   void
+   forAllElements( Function&& f ) const;
+
+   template< typename Function >
+   void
+   forSegments( IndexType begin, IndexType end, Function&& f ) const;
+
+   template< typename Function >
+   void
+   forAllSegments( Function&& f ) const;
+
+   /***
+    * \brief Go over all segments and perform a reduction in each of them.
+    */
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+   void
+   reduceSegments( IndexType first,
+                   IndexType last,
+                   Fetch& fetch,
+                   const Reduction& reduction,
+                   ResultKeeper& keeper,
+                   const Real& zero ) const;
+
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+   void
+   reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const;
+
+   SlicedEllpackView&
+   operator=( const SlicedEllpackView& view );
+
+   void
+   save( File& file ) const;
+
+   void
+   load( File& file );
+
+   template< typename Fetch >
+   SegmentsPrinter< SlicedEllpackView, Fetch >
+   print( Fetch&& fetch ) const;
+
+protected:
+   IndexType size = 0;
+   IndexType alignedSize = 0;
+   IndexType segmentsCount = 0;
+
+   OffsetsView sliceOffsets, sliceSegmentSizes;
 };
 
-template <typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int SliceSize >
-std::ostream& operator<<( std::ostream& str, const SlicedEllpackView< Device, Index, Organization, SliceSize >& segments ) { return printSegments( str, segments ); }
+template< typename Device, typename Index, ElementsOrganization Organization, int SliceSize >
+std::ostream&
+operator<<( std::ostream& str, const SlicedEllpackView< Device, Index, Organization, SliceSize >& segments )
+{
+   return printSegments( str, segments );
+}
 
-      } // namespace Segements
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
 
 #include <TNL/Algorithms/Segments/SlicedEllpackView.hpp>
diff --git a/src/TNL/Algorithms/Segments/SlicedEllpackView.hpp b/src/TNL/Algorithms/Segments/SlicedEllpackView.hpp
index 85199acb860b1fc82f142f16c9d9c37201990c3e..85834e1799821dc2d27f8b38f1e848a2ccc1feb5 100644
--- a/src/TNL/Algorithms/Segments/SlicedEllpackView.hpp
+++ b/src/TNL/Algorithms/Segments/SlicedEllpackView.hpp
@@ -14,151 +14,109 @@
 #include "SlicedEllpackView.h"
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
+namespace Algorithms {
+namespace Segments {
 
-
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int SliceSize >
-__cuda_callable__
-SlicedEllpackView< Device, Index, Organization, SliceSize >::
-SlicedEllpackView()
-   : size( 0 ), alignedSize( 0 ), segmentsCount( 0 )
-{
-}
-
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int SliceSize >
+template< typename Device, typename Index, ElementsOrganization Organization, int SliceSize >
 __cuda_callable__
-SlicedEllpackView< Device, Index, Organization, SliceSize >::
-SlicedEllpackView(  IndexType size,
-                    IndexType alignedSize,
-                    IndexType segmentsCount,
-                    OffsetsView&& sliceOffsets,
-                    OffsetsView&& sliceSegmentSizes )
-   : size( size ), alignedSize( alignedSize ), segmentsCount( segmentsCount ),
-     sliceOffsets( std::forward< OffsetsView >( sliceOffsets ) ), sliceSegmentSizes( std::forward< OffsetsView >( sliceSegmentSizes ) )
-{
-}
+SlicedEllpackView< Device, Index, Organization, SliceSize >::SlicedEllpackView( IndexType size,
+                                                                                IndexType alignedSize,
+                                                                                IndexType segmentsCount,
+                                                                                OffsetsView&& sliceOffsets,
+                                                                                OffsetsView&& sliceSegmentSizes )
+: size( size ), alignedSize( alignedSize ), segmentsCount( segmentsCount ),
+  sliceOffsets( std::forward< OffsetsView >( sliceOffsets ) ),
+  sliceSegmentSizes( std::forward< OffsetsView >( sliceSegmentSizes ) )
+{}
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int SliceSize >
-String
-SlicedEllpackView< Device, Index, Organization, SliceSize >::
-getSerializationType()
+template< typename Device, typename Index, ElementsOrganization Organization, int SliceSize >
+std::string
+SlicedEllpackView< Device, Index, Organization, SliceSize >::getSerializationType()
 {
-   // FIXME: the serialized data DEPEND on the Organization and Alignment parameters, so it should be reflected in the serialization type
+   // FIXME: the serialized data DEPEND on the Organization and Alignment parameters, so it should be reflected in the
+   // serialization type
    return "SlicedEllpack< [any_device], " + TNL::getSerializationType< IndexType >() + " >";
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int SliceSize >
+template< typename Device, typename Index, ElementsOrganization Organization, int SliceSize >
 String
-SlicedEllpackView< Device, Index, Organization, SliceSize >::
-getSegmentsType()
+SlicedEllpackView< Device, Index, Organization, SliceSize >::getSegmentsType()
 {
    return "SlicedEllpack";
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int SliceSize >
+template< typename Device, typename Index, ElementsOrganization Organization, int SliceSize >
 __cuda_callable__
 typename SlicedEllpackView< Device, Index, Organization, SliceSize >::ViewType
-SlicedEllpackView< Device, Index, Organization, SliceSize >::
-getView()
+SlicedEllpackView< Device, Index, Organization, SliceSize >::getView()
 {
    return ViewType( size, alignedSize, segmentsCount, sliceOffsets, sliceSegmentSizes );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int SliceSize >
+template< typename Device, typename Index, ElementsOrganization Organization, int SliceSize >
 __cuda_callable__
 auto
-SlicedEllpackView< Device, Index, Organization, SliceSize >::
-getConstView() const -> const ConstViewType
+SlicedEllpackView< Device, Index, Organization, SliceSize >::getConstView() const -> const ConstViewType
 {
    return ConstViewType( size, alignedSize, segmentsCount, sliceOffsets.getConstView(), sliceSegmentSizes.getConstView() );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int SliceSize >
-__cuda_callable__ auto SlicedEllpackView< Device, Index, Organization, SliceSize >::
-getSegmentsCount() const -> IndexType
+template< typename Device, typename Index, ElementsOrganization Organization, int SliceSize >
+__cuda_callable__
+auto
+SlicedEllpackView< Device, Index, Organization, SliceSize >::getSegmentsCount() const -> IndexType
 {
    return this->segmentsCount;
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int SliceSize >
-__cuda_callable__ auto SlicedEllpackView< Device, Index, Organization, SliceSize >::
-getSegmentSize( const IndexType segmentIdx ) const -> IndexType
+template< typename Device, typename Index, ElementsOrganization Organization, int SliceSize >
+__cuda_callable__
+auto
+SlicedEllpackView< Device, Index, Organization, SliceSize >::getSegmentSize( const IndexType segmentIdx ) const -> IndexType
 {
    const Index sliceIdx = segmentIdx / SliceSize;
    if( std::is_same< DeviceType, Devices::Host >::value )
       return this->sliceSegmentSizes[ sliceIdx ];
-   else
-   {
+   else {
 #ifdef __CUDA_ARCH__
-   return this->sliceSegmentSizes[ sliceIdx ];
+      return this->sliceSegmentSizes[ sliceIdx ];
 #else
-   return this->sliceSegmentSizes.getElement( sliceIdx );
+      return this->sliceSegmentSizes.getElement( sliceIdx );
 #endif
    }
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int SliceSize >
-__cuda_callable__ auto SlicedEllpackView< Device, Index, Organization, SliceSize >::
-getSize() const -> IndexType
+template< typename Device, typename Index, ElementsOrganization Organization, int SliceSize >
+__cuda_callable__
+auto
+SlicedEllpackView< Device, Index, Organization, SliceSize >::getSize() const -> IndexType
 {
    return this->size;
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int SliceSize >
-__cuda_callable__ auto SlicedEllpackView< Device, Index, Organization, SliceSize >::
-getStorageSize() const -> IndexType
+template< typename Device, typename Index, ElementsOrganization Organization, int SliceSize >
+__cuda_callable__
+auto
+SlicedEllpackView< Device, Index, Organization, SliceSize >::getStorageSize() const -> IndexType
 {
    return this->alignedSize;
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int SliceSize >
-__cuda_callable__ auto SlicedEllpackView< Device, Index, Organization, SliceSize >::
-getGlobalIndex( const Index segmentIdx, const Index localIdx ) const -> IndexType
+template< typename Device, typename Index, ElementsOrganization Organization, int SliceSize >
+__cuda_callable__
+auto
+SlicedEllpackView< Device, Index, Organization, SliceSize >::getGlobalIndex( const Index segmentIdx,
+                                                                             const Index localIdx ) const -> IndexType
 {
    const IndexType sliceIdx = segmentIdx / SliceSize;
    const IndexType segmentInSliceIdx = segmentIdx % SliceSize;
-   IndexType sliceOffset, segmentSize;
-   if( std::is_same< DeviceType, Devices::Host >::value )
-   {
+   IndexType sliceOffset;
+   IndexType segmentSize;
+   if( std::is_same< DeviceType, Devices::Host >::value ) {
       sliceOffset = this->sliceOffsets[ sliceIdx ];
       segmentSize = this->sliceSegmentSizes[ sliceIdx ];
    }
-   else
-   {
+   else {
 #ifdef __CUDA_ARCH__
       sliceOffset = this->sliceOffsets[ sliceIdx ];
       segmentSize = this->sliceSegmentSizes[ sliceIdx ];
@@ -173,14 +131,11 @@ getGlobalIndex( const Index segmentIdx, const Index localIdx ) const -> IndexTyp
       return sliceOffset + segmentInSliceIdx + SliceSize * localIdx;
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int SliceSize >
+template< typename Device, typename Index, ElementsOrganization Organization, int SliceSize >
 __cuda_callable__
 auto
-SlicedEllpackView< Device, Index, Organization, SliceSize >::
-getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType
+SlicedEllpackView< Device, Index, Organization, SliceSize >::getSegmentView( const IndexType segmentIdx ) const
+   -> SegmentViewType
 {
    const IndexType sliceIdx = segmentIdx / SliceSize;
    const IndexType segmentInSliceIdx = segmentIdx % SliceSize;
@@ -193,50 +148,44 @@ getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType
       return SegmentViewType( segmentIdx, sliceOffset + segmentInSliceIdx, segmentSize, SliceSize );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int SliceSize >
-   template< typename Function >
+template< typename Device, typename Index, ElementsOrganization Organization, int SliceSize >
+template< typename Function >
 void
-SlicedEllpackView< Device, Index, Organization, SliceSize >::
-forElements( IndexType first, IndexType last, Function&& f ) const
+SlicedEllpackView< Device, Index, Organization, SliceSize >::forElements( IndexType first, IndexType last, Function&& f ) const
 {
    const auto sliceSegmentSizes_view = this->sliceSegmentSizes.getConstView();
    const auto sliceOffsets_view = this->sliceOffsets.getConstView();
-   if( Organization == RowMajorOrder )
-   {
-      auto l = [=] __cuda_callable__ ( const IndexType segmentIdx ) mutable {
+   if( Organization == RowMajorOrder ) {
+      auto l = [ = ] __cuda_callable__( const IndexType segmentIdx ) mutable
+      {
          const IndexType sliceIdx = segmentIdx / SliceSize;
          const IndexType segmentInSliceIdx = segmentIdx % SliceSize;
          const IndexType segmentSize = sliceSegmentSizes_view[ sliceIdx ];
          const IndexType begin = sliceOffsets_view[ sliceIdx ] + segmentInSliceIdx * segmentSize;
          const IndexType end = begin + segmentSize;
          IndexType localIdx( 0 );
-         for( IndexType globalIdx = begin; globalIdx < end; globalIdx++  )
-         {
+         for( IndexType globalIdx = begin; globalIdx < end; globalIdx++ ) {
             // The following is a workaround of a bug in nvcc 11.2
 #if CUDART_VERSION == 11020
-             f( segmentIdx, localIdx, globalIdx );
-             localIdx++;
+            f( segmentIdx, localIdx, globalIdx );
+            localIdx++;
 #else
-             f( segmentIdx, localIdx++, globalIdx );
+            f( segmentIdx, localIdx++, globalIdx );
 #endif
          }
       };
       Algorithms::ParallelFor< Device >::exec( first, last, l );
    }
-   else
-   {
-      auto l = [=] __cuda_callable__ ( const IndexType segmentIdx ) mutable {
+   else {
+      auto l = [ = ] __cuda_callable__( const IndexType segmentIdx ) mutable
+      {
          const IndexType sliceIdx = segmentIdx / SliceSize;
          const IndexType segmentInSliceIdx = segmentIdx % SliceSize;
-         //const IndexType segmentSize = sliceSegmentSizes_view[ sliceIdx ];
+         // const IndexType segmentSize = sliceSegmentSizes_view[ sliceIdx ];
          const IndexType begin = sliceOffsets_view[ sliceIdx ] + segmentInSliceIdx;
          const IndexType end = sliceOffsets_view[ sliceIdx + 1 ];
          IndexType localIdx( 0 );
-         for( IndexType globalIdx = begin; globalIdx < end; globalIdx += SliceSize )
-         {
+         for( IndexType globalIdx = begin; globalIdx < end; globalIdx += SliceSize ) {
             // The following is a workaround of a bug in nvcc 11.2
 #if CUDART_VERSION == 11020
             f( segmentIdx, localIdx, globalIdx );
@@ -250,63 +199,55 @@ forElements( IndexType first, IndexType last, Function&& f ) const
    }
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int SliceSize >
-   template< typename Function >
+template< typename Device, typename Index, ElementsOrganization Organization, int SliceSize >
+template< typename Function >
 void
-SlicedEllpackView< Device, Index, Organization, SliceSize >::
-forAllElements( Function&& f ) const
+SlicedEllpackView< Device, Index, Organization, SliceSize >::forAllElements( Function&& f ) const
 {
    this->forElements( 0, this->getSegmentsCount(), f );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int SliceSize >
-   template< typename Function >
+template< typename Device, typename Index, ElementsOrganization Organization, int SliceSize >
+template< typename Function >
 void
-SlicedEllpackView< Device, Index, Organization, SliceSize >::
-forSegments( IndexType begin, IndexType end, Function&& function ) const
+SlicedEllpackView< Device, Index, Organization, SliceSize >::forSegments( IndexType begin,
+                                                                          IndexType end,
+                                                                          Function&& function ) const
 {
    auto view = this->getConstView();
-   auto f = [=] __cuda_callable__ ( IndexType segmentIdx ) mutable {
+   auto f = [ = ] __cuda_callable__( IndexType segmentIdx ) mutable
+   {
       auto segment = view.getSegmentView( segmentIdx );
       function( segment );
    };
    TNL::Algorithms::ParallelFor< DeviceType >::exec( begin, end, f );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int SliceSize >
-   template< typename Function >
+template< typename Device, typename Index, ElementsOrganization Organization, int SliceSize >
+template< typename Function >
 void
-SlicedEllpackView< Device, Index, Organization, SliceSize >::
-forAllSegments( Function&& f ) const
+SlicedEllpackView< Device, Index, Organization, SliceSize >::forAllSegments( Function&& f ) const
 {
    this->forSegments( 0, this->getSegmentsCount(), f );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int SliceSize >
-   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+template< typename Device, typename Index, ElementsOrganization Organization, int SliceSize >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
 void
-SlicedEllpackView< Device, Index, Organization, SliceSize >::
-reduceSegments( IndexType first, IndexType last, Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const
+SlicedEllpackView< Device, Index, Organization, SliceSize >::reduceSegments( IndexType first,
+                                                                             IndexType last,
+                                                                             Fetch& fetch,
+                                                                             const Reduction& reduction,
+                                                                             ResultKeeper& keeper,
+                                                                             const Real& zero ) const
 {
    using RealType = typename detail::FetchLambdaAdapter< Index, Fetch >::ReturnType;
-   //using RealType = decltype( fetch( IndexType(), IndexType(), IndexType(), std::declval< bool& >() ) );
+   // using RealType = decltype( fetch( IndexType(), IndexType(), IndexType(), std::declval< bool& >() ) );
    const auto sliceSegmentSizes_view = this->sliceSegmentSizes.getConstView();
    const auto sliceOffsets_view = this->sliceOffsets.getConstView();
-   if( Organization == RowMajorOrder )
-   {
-      auto l = [=] __cuda_callable__ ( const IndexType segmentIdx ) mutable {
+   if( Organization == RowMajorOrder ) {
+      auto l = [ = ] __cuda_callable__( const IndexType segmentIdx ) mutable
+      {
          const IndexType sliceIdx = segmentIdx / SliceSize;
          const IndexType segmentInSliceIdx = segmentIdx % SliceSize;
          const IndexType segmentSize = sliceSegmentSizes_view[ sliceIdx ];
@@ -315,50 +256,48 @@ reduceSegments( IndexType first, IndexType last, Fetch& fetch, const Reduction&
          RealType aux( zero );
          IndexType localIdx( 0 );
          bool compute( true );
-         for( IndexType globalIdx = begin; globalIdx< end; globalIdx++  )
-            aux = reduction( aux, detail::FetchLambdaAdapter< IndexType, Fetch >::call( fetch, segmentIdx, localIdx++, globalIdx, compute ) );
+         for( IndexType globalIdx = begin; globalIdx < end; globalIdx++ )
+            aux = reduction(
+               aux, detail::FetchLambdaAdapter< IndexType, Fetch >::call( fetch, segmentIdx, localIdx++, globalIdx, compute ) );
          keeper( segmentIdx, aux );
       };
       Algorithms::ParallelFor< Device >::exec( first, last, l );
    }
-   else
-   {
-      auto l = [=] __cuda_callable__ ( const IndexType segmentIdx ) mutable {
+   else {
+      auto l = [ = ] __cuda_callable__( const IndexType segmentIdx ) mutable
+      {
          const IndexType sliceIdx = segmentIdx / SliceSize;
          const IndexType segmentInSliceIdx = segmentIdx % SliceSize;
-         //const IndexType segmentSize = sliceSegmentSizes_view[ sliceIdx ];
+         // const IndexType segmentSize = sliceSegmentSizes_view[ sliceIdx ];
          const IndexType begin = sliceOffsets_view[ sliceIdx ] + segmentInSliceIdx;
          const IndexType end = sliceOffsets_view[ sliceIdx + 1 ];
          RealType aux( zero );
          IndexType localIdx( 0 );
          bool compute( true );
-         for( IndexType globalIdx = begin; globalIdx < end; globalIdx += SliceSize  )
-            aux = reduction( aux, detail::FetchLambdaAdapter< IndexType, Fetch >::call( fetch, segmentIdx, localIdx++, globalIdx, compute ) );
+         for( IndexType globalIdx = begin; globalIdx < end; globalIdx += SliceSize )
+            aux = reduction(
+               aux, detail::FetchLambdaAdapter< IndexType, Fetch >::call( fetch, segmentIdx, localIdx++, globalIdx, compute ) );
          keeper( segmentIdx, aux );
       };
       Algorithms::ParallelFor< Device >::exec( first, last, l );
    }
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int SliceSize >
-   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
+template< typename Device, typename Index, ElementsOrganization Organization, int SliceSize >
+template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real >
 void
-SlicedEllpackView< Device, Index, Organization, SliceSize >::
-reduceAllSegments( Fetch& fetch, const Reduction& reduction, ResultKeeper& keeper, const Real& zero ) const
+SlicedEllpackView< Device, Index, Organization, SliceSize >::reduceAllSegments( Fetch& fetch,
+                                                                                const Reduction& reduction,
+                                                                                ResultKeeper& keeper,
+                                                                                const Real& zero ) const
 {
    this->reduceSegments( 0, this->getSegmentsCount(), fetch, reduction, keeper, zero );
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int SliceSize >
+template< typename Device, typename Index, ElementsOrganization Organization, int SliceSize >
 SlicedEllpackView< Device, Index, Organization, SliceSize >&
-SlicedEllpackView< Device, Index, Organization, SliceSize >::
-operator=( const SlicedEllpackView< Device, Index, Organization, SliceSize >& view )
+SlicedEllpackView< Device, Index, Organization, SliceSize >::operator=(
+   const SlicedEllpackView< Device, Index, Organization, SliceSize >& view )
 {
    this->size = view.size;
    this->alignedSize = view.alignedSize;
@@ -368,13 +307,9 @@ operator=( const SlicedEllpackView< Device, Index, Organization, SliceSize >& vi
    return *this;
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int SliceSize >
+template< typename Device, typename Index, ElementsOrganization Organization, int SliceSize >
 void
-SlicedEllpackView< Device, Index, Organization, SliceSize >::
-save( File& file ) const
+SlicedEllpackView< Device, Index, Organization, SliceSize >::save( File& file ) const
 {
    file.save( &size );
    file.save( &alignedSize );
@@ -383,13 +318,9 @@ save( File& file ) const
    file << this->sliceSegmentSizes;
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int SliceSize >
+template< typename Device, typename Index, ElementsOrganization Organization, int SliceSize >
 void
-SlicedEllpackView< Device, Index, Organization, SliceSize >::
-load( File& file )
+SlicedEllpackView< Device, Index, Organization, SliceSize >::load( File& file )
 {
    file.load( &size );
    file.load( &alignedSize );
@@ -398,18 +329,15 @@ load( File& file )
    file >> this->sliceSegmentSizes;
 }
 
-template< typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          int SliceSize >
-      template< typename Fetch >
+template< typename Device, typename Index, ElementsOrganization Organization, int SliceSize >
+template< typename Fetch >
 auto
-SlicedEllpackView< Device, Index, Organization, SliceSize >::
-print( Fetch&& fetch ) const -> SegmentsPrinter< SlicedEllpackView, Fetch >
+SlicedEllpackView< Device, Index, Organization, SliceSize >::print( Fetch&& fetch ) const
+   -> SegmentsPrinter< SlicedEllpackView, Fetch >
 {
    return SegmentsPrinter< SlicedEllpackView, Fetch >( *this, fetch );
 }
 
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/_NamespaceDoxy.h b/src/TNL/Algorithms/Segments/_NamespaceDoxy.h
index 0edf373bd3423158b164eb6700c439cc27d7f548..5f055a122db6fa1caa39f27e0a3935c76e7f3869 100644
--- a/src/TNL/Algorithms/Segments/_NamespaceDoxy.h
+++ b/src/TNL/Algorithms/Segments/_NamespaceDoxy.h
@@ -7,7 +7,7 @@
 #pragma once
 
 namespace TNL {
-   namespace Algorithms {
+namespace Algorithms {
 /**
  * \brief Namespace holding segments data structures.
  *
@@ -51,8 +51,8 @@ namespace TNL {
  \end{array}
  \f]
 
- Such "matrices" can be stored in memory in a row-wise manner in one contiguous array because of the performance reasons. The first "matrix" (i.e. values of the matrix elements)
- would be stored as follows
+ Such "matrices" can be stored in memory in a row-wise manner in one contiguous array because of the performance reasons. The
+first "matrix" (i.e. values of the matrix elements) would be stored as follows
 
  \f[
     \begin{array}{|cc|c|cccc|c|cc|} 1 & 2 &  5 & 3 & 4 & 7 & 9 & 12 & 15 & 17 & 20 \end{array}
@@ -64,38 +64,40 @@ and the second one (i.e. column indexes of the matrix values) as follows
     \begin{array}{|cc|c|cccc|c|cc|} 0 & 2 & 2 & 0 & 1 & 2 & 3 & 4 & 2 & 3 & 4 \end{array}
  \f]
 
-What we see above is so called [CSR sparse matrix format](https://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_row_(CSR,_CRS_or_Yale_format)).
-It is the most popular format for storage of sparse matrices designed for high performance. However, it may not be the most efficient format for storage
-of sparse matrices on GPUs. Therefore many other formats have been developed to get better performance. These formats often have different layout
-of the matrix elements in the memory. They have to deal especially with two difficulties:
+What we see above is so called [CSR sparse matrix
+format](https://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_row_(CSR,_CRS_or_Yale_format)). It is the most popular
+format for storage of sparse matrices designed for high performance. However, it may not be the most efficient format for
+storage of sparse matrices on GPUs. Therefore many other formats have been developed to get better performance. These formats
+often have different layout of the matrix elements in the memory. They have to deal especially with two difficulties:
 
-1. Efficient storage of matrix elements in the memory to fulfill the requirements of coalesced memory accesses on GPUs or good spatial locality
- for efficient use of caches on CPUs.
+1. Efficient storage of matrix elements in the memory to fulfill the requirements of coalesced memory accesses on GPUs or good
+spatial locality for efficient use of caches on CPUs.
 2. Efficient mapping of GPU threads to different matrix rows.
 
 Necessity of working with this kind of data structure is not limited only to sparse matrices. We could name at least few others:
 
-1. Efficient storage of [graphs](https://en.wikipedia.org/wiki/Graph_(discrete_mathematics)) - one segment represents one graph node,
-   the elements in one segments are indexes of its neighbors.
-2. [Unstructured numerical meshes](https://en.wikipedia.org/wiki/Types_of_mesh) - unstructured numerical mesh is a graph in fact.
-3. [Particle in cell method](https://en.wikipedia.org/wiki/Particle-in-cell) - one segment represents one cell, the elements in one segment
-   are indexes of the particles.
-4. [K-means clustering](https://en.wikipedia.org/wiki/K-means_clustering) - segments represent one cluster, the elements represent vectors
-   belonging to given cluster.
-5. [Hashing](https://arxiv.org/abs/1907.02900) - segments are particular rows of the hash table, elements in segments corresponds with coliding
-   hashed elements.
-
-In general, segments can be used for problems that somehow corresponds wit 2D data structure where each row can have different size and we need
-to perform miscellaneous operations within the rows. The name *segments* comes from segmented parallel reduction or
-[segmented scan (prefix-sum)](https://en.wikipedia.org/wiki/Segmented_scan).
+1. Efficient storage of [graphs](https://en.wikipedia.org/wiki/Graph_(discrete_mathematics)) - one segment represents one graph
+node, the elements in one segments are indexes of its neighbors.
+2. [Unstructured numerical meshes](https://en.wikipedia.org/wiki/Types_of_mesh) - unstructured numerical mesh is a graph in
+fact.
+3. [Particle in cell method](https://en.wikipedia.org/wiki/Particle-in-cell) - one segment represents one cell, the elements in
+one segment are indexes of the particles.
+4. [K-means clustering](https://en.wikipedia.org/wiki/K-means_clustering) - segments represent one cluster, the elements
+represent vectors belonging to given cluster.
+5. [Hashing](https://arxiv.org/abs/1907.02900) - segments are particular rows of the hash table, elements in segments
+corresponds with coliding hashed elements.
+
+In general, segments can be used for problems that somehow corresponds wit 2D data structure where each row can have different
+size and we need to perform miscellaneous operations within the rows. The name *segments* comes from segmented parallel
+reduction or [segmented scan (prefix-sum)](https://en.wikipedia.org/wiki/Segmented_scan).
 
 The following example demonstrates the essence of *segments* in TNL:
 
 \includelineno Algorithms/Segments/SegmentsExample_General.cpp
 
-We demonstrate two formats of segments - \ref TNL::Algorithms::Segments::CSR and \ref TNL::Algorithms::Segments::Ellpack running on both CPU and GPU
-(lines 58-76). For each of them, we call function `SegmentsExample` which first creates given segments (line 18). The segments are defined by the sizes of
-particular segments.
+We demonstrate two formats of segments - \ref TNL::Algorithms::Segments::CSR and \ref TNL::Algorithms::Segments::Ellpack running
+on both CPU and GPU (lines 58-76). For each of them, we call function `SegmentsExample` which first creates given segments (line
+18). The segments are defined by the sizes of particular segments.
 
 Next we allocate array with data related to the segments (line 24). The number of elemets managed by the segments is given by
 \ref TNL::Algorithms::Segments::CSR::getStorageSize and \ref TNL::Algorithms::Segments::Ellpack::getStorageSize respectively.
@@ -103,36 +105,36 @@ Next we allocate array with data related to the segments (line 24). The number o
 Next we setup the segments elements (lines 29-33) by calling \ref TNL::Algorithms::Segments::CSR::forAllElements
 (and \ref TNL::Algorithms::Segments::CSR::forAllElements respectively) which iterates over all elements of the segments
 in parallel and perform given lambda function. The lambda function receives index of the segment (`segmentIdx`),
-index of the element within the segment (`localIdx`), index of the element within the array `data` and a reference to boolean (`compute`) which serves as a
-hint for interrupting the iteration over the elements of given segment when it is set to `false`. The value of the elements having the local index smaller or equal
-to the segments index is set to the value of the segment index. It creates, in fact, lower triangular matrix elements of which have values equal to row index.
-
-Next we use a function \ref TNL::Algorithms::Segments::printSegments to print the content of the segments (lines 38-39). To do this we have to provide a lambda function
-`fetch` (line 38) which returns value of elements with given global index.
-
-Finally we show how to compute sum of all elemnts in each segment. Firstly, we create vector into which we will store the sums (line 44) and get its view (line 45).
-The size of the vector is given by the number of the segments which can be obtained by the means of the method \ref TNL::Algorithms::Segments::CSR::getSegmentsCount
-(and \ref TNL::Algorithms::Segments::Ellpack::getSegmentsCount respectively). The sums are computed using the method \ref TNL::Algorithms::Segments::CSR::reduceAllSegments
-(and \ref TNL::Algorithms::Segments::Ellpack::reduceAllSegments respectively) which works the same way as the flexible parallel reduction (\ref TNL::Algorithms::Reduction).
-It requires lambda functions `fetch` for reading the data related to particular elements of the segments, function `reduce` which is \ref std::plus in this case and a
-function `keep` to store the result of sums in particular segments.
+index of the element within the segment (`localIdx`), index of the element within the array `data` and a reference to boolean
+(`compute`) which serves as a hint for interrupting the iteration over the elements of given segment when it is set to `false`.
+The value of the elements having the local index smaller or equal to the segments index is set to the value of the segment
+index. It creates, in fact, lower triangular matrix elements of which have values equal to row index.
+
+Next we use a function \ref TNL::Algorithms::Segments::printSegments to print the content of the segments (lines 38-39). To do
+this we have to provide a lambda function `fetch` (line 38) which returns value of elements with given global index.
+
+Finally we show how to compute sum of all elemnts in each segment. Firstly, we create vector into which we will store the sums
+(line 44) and get its view (line 45). The size of the vector is given by the number of the segments which can be obtained by the
+means of the method \ref TNL::Algorithms::Segments::CSR::getSegmentsCount (and \ref
+TNL::Algorithms::Segments::Ellpack::getSegmentsCount respectively). The sums are computed using the method \ref
+TNL::Algorithms::Segments::CSR::reduceAllSegments (and \ref TNL::Algorithms::Segments::Ellpack::reduceAllSegments respectively)
+which works the same way as the flexible parallel reduction (\ref TNL::Algorithms::Reduction). It requires lambda functions
+`fetch` for reading the data related to particular elements of the segments, function `reduce` which is \ref std::plus in this
+case and a function `keep` to store the result of sums in particular segments.
 
 The result looks as follows:
 
 \include SegmentsExample_General.out
 
-Note that the Ellpack format manages more elements than we asked for. It is because some formats use padding elements for more efficient memory accesses. The padding
-elements are available to the user as well and so we must ensure that work only with those elements we want to. This is the reason why we use the if statement on the
-line 31 when setting up the values of the elements in segments. The padding elements can be used in case when we later need more elements than we requested. However,
-the segments data structure does not allow any resizing of the segments. One can change the sizes of the segments, however, the access to the originally managed data
-is becoming invalid at that moment.
+Note that the Ellpack format manages more elements than we asked for. It is because some formats use padding elements for more
+efficient memory accesses. The padding elements are available to the user as well and so we must ensure that work only with
+those elements we want to. This is the reason why we use the if statement on the line 31 when setting up the values of the
+elements in segments. The padding elements can be used in case when we later need more elements than we requested. However, the
+segments data structure does not allow any resizing of the segments. One can change the sizes of the segments, however, the
+access to the originally managed data is becoming invalid at that moment.
 
 */
 
-
-
-      namespace Segments {
-
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+namespace Segments {}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/detail/BiEllpack.h b/src/TNL/Algorithms/Segments/detail/BiEllpack.h
index f19636b2369055bb9dde42ab655d774ee39f9374..ee92e08b3489828ea7c243cd69a981185429c923 100644
--- a/src/TNL/Algorithms/Segments/detail/BiEllpack.h
+++ b/src/TNL/Algorithms/Segments/detail/BiEllpack.h
@@ -12,9 +12,9 @@
 #include <TNL/Algorithms/Segments/detail/CheckLambdas.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
-         namespace detail {
+namespace Algorithms {
+namespace Segments {
+namespace detail {
 
 template< typename Index,
           typename Device,
@@ -22,265 +22,259 @@ template< typename Index,
           int WarpSize = 32 >
 class BiEllpack
 {
-   public:
-
-      using DeviceType = Device;
-      using IndexType = Index;
-      static constexpr bool getOrganization() { return Organization; }
-      using OffsetsContainer = Containers::Vector< IndexType, DeviceType, IndexType >;
-      using OffsetsHolderView = typename OffsetsContainer::ConstViewType;
-      using ConstOffsetsHolderView = typename OffsetsHolderView::ConstViewType;
-      using SegmentsSizes = OffsetsContainer;
-      using SegmentViewType = BiEllpackSegmentView< IndexType, Organization >;
+public:
+   using DeviceType = Device;
+   using IndexType = Index;
+   static constexpr bool
+   getOrganization()
+   {
+      return Organization;
+   }
+   using OffsetsContainer = Containers::Vector< IndexType, DeviceType, IndexType >;
+   using OffsetsHolderView = typename OffsetsContainer::ConstViewType;
+   using ConstOffsetsHolderView = typename OffsetsHolderView::ConstViewType;
+   using SegmentsSizes = OffsetsContainer;
+   using SegmentViewType = BiEllpackSegmentView< IndexType, Organization >;
 
-      static constexpr int getWarpSize() { return WarpSize; };
+   static constexpr int
+   getWarpSize()
+   {
+      return WarpSize;
+   };
 
-      static constexpr int getLogWarpSize() { return std::log2( WarpSize ); };
+   static constexpr int
+   getLogWarpSize()
+   {
+      return std::log2( WarpSize );
+   };
 
-      static constexpr int getGroupsCount() { return getLogWarpSize() + 1; };
+   static constexpr int
+   getGroupsCount()
+   {
+      return getLogWarpSize() + 1;
+   };
 
-      __cuda_callable__
-      static IndexType getActiveGroupsCountDirect( const ConstOffsetsHolderView& rowPermArray, const IndexType segmentIdx )
-      {
-         TNL_ASSERT_GE( segmentIdx, 0, "" );
-         //TNL_ASSERT_LT( segmentIdx, this->getSize(), "" );
+   __cuda_callable__
+   static IndexType
+   getActiveGroupsCountDirect( const ConstOffsetsHolderView& rowPermArray, const IndexType segmentIdx )
+   {
+      TNL_ASSERT_GE( segmentIdx, 0, "" );
+      // TNL_ASSERT_LT( segmentIdx, this->getSize(), "" );
 
-         IndexType strip = segmentIdx / getWarpSize();
-         IndexType rowStripPermutation = rowPermArray[ segmentIdx ] - getWarpSize() * strip;
-         IndexType numberOfGroups = getLogWarpSize() + 1;
-         IndexType bisection = 1;
-         for( IndexType i = 0; i < getLogWarpSize() + 1; i++ )
-         {
-            if( rowStripPermutation < bisection )
-               return numberOfGroups - i;
-            bisection *= 2;
-         }
-         TNL_ASSERT_TRUE( false, "segmentIdx was not found" );
-         return -1; // to avoid compiler warning
+      IndexType strip = segmentIdx / getWarpSize();
+      IndexType rowStripPermutation = rowPermArray[ segmentIdx ] - getWarpSize() * strip;
+      IndexType numberOfGroups = getLogWarpSize() + 1;
+      IndexType bisection = 1;
+      for( IndexType i = 0; i < getLogWarpSize() + 1; i++ ) {
+         if( rowStripPermutation < bisection )
+            return numberOfGroups - i;
+         bisection *= 2;
       }
+      TNL_ASSERT_TRUE( false, "segmentIdx was not found" );
+      return -1;  // to avoid compiler warning
+   }
 
-      static IndexType getActiveGroupsCount( const ConstOffsetsHolderView& rowPermArray, const IndexType segmentIdx )
-      {
-         TNL_ASSERT_GE( segmentIdx, 0, "" );
-         //TNL_ASSERT_LT( segmentIdx, this->getSize(), "" );
+   static IndexType
+   getActiveGroupsCount( const ConstOffsetsHolderView& rowPermArray, const IndexType segmentIdx )
+   {
+      TNL_ASSERT_GE( segmentIdx, 0, "" );
+      // TNL_ASSERT_LT( segmentIdx, this->getSize(), "" );
 
-         IndexType strip = segmentIdx / getWarpSize();
-         IndexType rowStripPermutation = rowPermArray.getElement( segmentIdx ) - getWarpSize() * strip;
-         IndexType numberOfGroups = getLogWarpSize() + 1;
-         IndexType bisection = 1;
-         for( IndexType i = 0; i < getLogWarpSize() + 1; i++ )
-         {
-            if( rowStripPermutation < bisection )
-               return numberOfGroups - i;
-            bisection *= 2;
-         }
-         throw std::logic_error( "segmentIdx was not found" );
+      IndexType strip = segmentIdx / getWarpSize();
+      IndexType rowStripPermutation = rowPermArray.getElement( segmentIdx ) - getWarpSize() * strip;
+      IndexType numberOfGroups = getLogWarpSize() + 1;
+      IndexType bisection = 1;
+      for( IndexType i = 0; i < getLogWarpSize() + 1; i++ ) {
+         if( rowStripPermutation < bisection )
+            return numberOfGroups - i;
+         bisection *= 2;
       }
+      throw std::logic_error( "segmentIdx was not found" );
+   }
 
-      __cuda_callable__
-      static IndexType getGroupSizeDirect( const ConstOffsetsHolderView& groupPointers,
-                                           const IndexType strip,
-                                           const IndexType group )
-      {
-         const IndexType groupOffset = strip * ( getLogWarpSize() + 1 ) + group;
-         return groupPointers[ groupOffset + 1 ] - groupPointers[ groupOffset ];
-      }
+   __cuda_callable__
+   static IndexType
+   getGroupSizeDirect( const ConstOffsetsHolderView& groupPointers, const IndexType strip, const IndexType group )
+   {
+      const IndexType groupOffset = strip * ( getLogWarpSize() + 1 ) + group;
+      return groupPointers[ groupOffset + 1 ] - groupPointers[ groupOffset ];
+   }
 
-      static IndexType getGroupSize( const ConstOffsetsHolderView& groupPointers,
-                                     const IndexType strip,
-                                     const IndexType group )
-      {
-         const IndexType groupOffset = strip * ( getLogWarpSize() + 1 ) + group;
-         return groupPointers.getElement( groupOffset + 1 ) - groupPointers.getElement( groupOffset );
-      }
-      __cuda_callable__ static
-      IndexType getSegmentSizeDirect( const OffsetsHolderView& rowPermArray,
-                                      const OffsetsHolderView& groupPointers,
-                                      const IndexType segmentIdx )
-      {
-         const IndexType strip = segmentIdx / getWarpSize();
-         //const IndexType groupIdx = strip * ( getLogWarpSize() + 1 );
-         //const IndexType rowStripPerm = rowPermArray[ segmentIdx ] - strip * getWarpSize();
-         const IndexType groupsCount = getActiveGroupsCountDirect( rowPermArray, segmentIdx );
-         IndexType groupHeight = getWarpSize();
-         IndexType segmentSize = 0;
-         for( IndexType groupIdx = 0; groupIdx < groupsCount; groupIdx++ )
-         {
-            const IndexType groupSize = getGroupSizeDirect( groupPointers, strip, groupIdx );
-            IndexType groupWidth =  groupSize / groupHeight;
-            segmentSize += groupWidth;
-            groupHeight /= 2;
-         }
-         return segmentSize;
+   static IndexType
+   getGroupSize( const ConstOffsetsHolderView& groupPointers, const IndexType strip, const IndexType group )
+   {
+      const IndexType groupOffset = strip * ( getLogWarpSize() + 1 ) + group;
+      return groupPointers.getElement( groupOffset + 1 ) - groupPointers.getElement( groupOffset );
+   }
+   __cuda_callable__
+   static IndexType
+   getSegmentSizeDirect( const OffsetsHolderView& rowPermArray,
+                         const OffsetsHolderView& groupPointers,
+                         const IndexType segmentIdx )
+   {
+      const IndexType strip = segmentIdx / getWarpSize();
+      // const IndexType groupIdx = strip * ( getLogWarpSize() + 1 );
+      // const IndexType rowStripPerm = rowPermArray[ segmentIdx ] - strip * getWarpSize();
+      const IndexType groupsCount = getActiveGroupsCountDirect( rowPermArray, segmentIdx );
+      IndexType groupHeight = getWarpSize();
+      IndexType segmentSize = 0;
+      for( IndexType groupIdx = 0; groupIdx < groupsCount; groupIdx++ ) {
+         const IndexType groupSize = getGroupSizeDirect( groupPointers, strip, groupIdx );
+         IndexType groupWidth = groupSize / groupHeight;
+         segmentSize += groupWidth;
+         groupHeight /= 2;
       }
+      return segmentSize;
+   }
 
-      static
-      IndexType getSegmentSize( const OffsetsHolderView& rowPermArray,
-                                const OffsetsHolderView& groupPointers,
-                                const IndexType segmentIdx )
-      {
-         const IndexType strip = segmentIdx / getWarpSize();
-         //const IndexType groupIdx = strip * ( getLogWarpSize() + 1 );
-         //const IndexType rowStripPerm = rowPermArray.getElement( segmentIdx ) - strip * getWarpSize();
-         const IndexType groupsCount = getActiveGroupsCount( rowPermArray, segmentIdx );
-         IndexType groupHeight = getWarpSize();
-         IndexType segmentSize = 0;
-         for( IndexType group = 0; group < groupsCount; group++ )
-         {
-            const IndexType groupSize = getGroupSize( groupPointers, strip, group );
-            IndexType groupWidth =  groupSize / groupHeight;
-            segmentSize += groupWidth;
-            groupHeight /= 2;
-         }
-         return segmentSize;
+   static IndexType
+   getSegmentSize( const OffsetsHolderView& rowPermArray, const OffsetsHolderView& groupPointers, const IndexType segmentIdx )
+   {
+      const IndexType strip = segmentIdx / getWarpSize();
+      // const IndexType groupIdx = strip * ( getLogWarpSize() + 1 );
+      // const IndexType rowStripPerm = rowPermArray.getElement( segmentIdx ) - strip * getWarpSize();
+      const IndexType groupsCount = getActiveGroupsCount( rowPermArray, segmentIdx );
+      IndexType groupHeight = getWarpSize();
+      IndexType segmentSize = 0;
+      for( IndexType group = 0; group < groupsCount; group++ ) {
+         const IndexType groupSize = getGroupSize( groupPointers, strip, group );
+         IndexType groupWidth = groupSize / groupHeight;
+         segmentSize += groupWidth;
+         groupHeight /= 2;
       }
+      return segmentSize;
+   }
 
-      __cuda_callable__ static
-      IndexType getGlobalIndexDirect( const OffsetsHolderView& rowPermArray,
-                                      const OffsetsHolderView& groupPointers,
-                                      const IndexType segmentIdx,
-                                      IndexType localIdx )
-      {
-         const IndexType strip = segmentIdx / getWarpSize();
-         const IndexType groupIdx = strip * ( getLogWarpSize() + 1 );
-         const IndexType rowStripPerm = rowPermArray[ segmentIdx ] - strip * getWarpSize();
-         const IndexType groupsCount = getActiveGroupsCountDirect( rowPermArray, segmentIdx );
-         IndexType globalIdx = groupPointers[ groupIdx ];
-         IndexType groupHeight = getWarpSize();
-         for( IndexType group = 0; group < groupsCount; group++ )
-         {
-            const IndexType groupSize = getGroupSizeDirect( groupPointers, strip, group );
-            if(  groupSize )
-            {
-               IndexType groupWidth =  groupSize / groupHeight;
-               if( localIdx >= groupWidth )
-               {
-                  localIdx -= groupWidth;
-                  globalIdx += groupSize;
-               }
+   __cuda_callable__
+   static IndexType
+   getGlobalIndexDirect( const OffsetsHolderView& rowPermArray,
+                         const OffsetsHolderView& groupPointers,
+                         const IndexType segmentIdx,
+                         IndexType localIdx )
+   {
+      const IndexType strip = segmentIdx / getWarpSize();
+      const IndexType groupIdx = strip * ( getLogWarpSize() + 1 );
+      const IndexType rowStripPerm = rowPermArray[ segmentIdx ] - strip * getWarpSize();
+      const IndexType groupsCount = getActiveGroupsCountDirect( rowPermArray, segmentIdx );
+      IndexType globalIdx = groupPointers[ groupIdx ];
+      IndexType groupHeight = getWarpSize();
+      for( IndexType group = 0; group < groupsCount; group++ ) {
+         const IndexType groupSize = getGroupSizeDirect( groupPointers, strip, group );
+         if( groupSize ) {
+            IndexType groupWidth = groupSize / groupHeight;
+            if( localIdx >= groupWidth ) {
+               localIdx -= groupWidth;
+               globalIdx += groupSize;
+            }
+            else {
+               if( Organization == RowMajorOrder )
+                  return globalIdx + rowStripPerm * groupWidth + localIdx;
                else
-               {
-                  if( Organization == RowMajorOrder )
-                     return globalIdx + rowStripPerm * groupWidth + localIdx;
-                  else
-                     return globalIdx + rowStripPerm + localIdx * groupHeight;
-               }
+                  return globalIdx + rowStripPerm + localIdx * groupHeight;
             }
-            groupHeight /= 2;
          }
-         TNL_ASSERT_TRUE( false, "Segment capacity exceeded, wrong localIdx." );
-         return -1; // to avoid compiler warning
+         groupHeight /= 2;
       }
+      TNL_ASSERT_TRUE( false, "Segment capacity exceeded, wrong localIdx." );
+      return -1;  // to avoid compiler warning
+   }
 
-      static
-      IndexType getGlobalIndex( const ConstOffsetsHolderView& rowPermArray,
-                                const ConstOffsetsHolderView& groupPointers,
-                                const IndexType segmentIdx,
-                                IndexType localIdx )
-      {
-         const IndexType strip = segmentIdx / getWarpSize();
-         const IndexType groupIdx = strip * ( getLogWarpSize() + 1 );
-         const IndexType rowStripPerm = rowPermArray.getElement( segmentIdx ) - strip * getWarpSize();
-         const IndexType groupsCount = getActiveGroupsCount( rowPermArray, segmentIdx );
-         IndexType globalIdx = groupPointers.getElement( groupIdx );
-         IndexType groupHeight = getWarpSize();
-         for( IndexType group = 0; group < groupsCount; group++ )
-         {
-            const IndexType groupSize = getGroupSize( groupPointers, strip, group );
-            if(  groupSize )
-            {
-               IndexType groupWidth =  groupSize / groupHeight;
-               if( localIdx >= groupWidth )
-               {
-                  localIdx -= groupWidth;
-                  globalIdx += groupSize;
+   static IndexType
+   getGlobalIndex( const ConstOffsetsHolderView& rowPermArray,
+                   const ConstOffsetsHolderView& groupPointers,
+                   const IndexType segmentIdx,
+                   IndexType localIdx )
+   {
+      const IndexType strip = segmentIdx / getWarpSize();
+      const IndexType groupIdx = strip * ( getLogWarpSize() + 1 );
+      const IndexType rowStripPerm = rowPermArray.getElement( segmentIdx ) - strip * getWarpSize();
+      const IndexType groupsCount = getActiveGroupsCount( rowPermArray, segmentIdx );
+      IndexType globalIdx = groupPointers.getElement( groupIdx );
+      IndexType groupHeight = getWarpSize();
+      for( IndexType group = 0; group < groupsCount; group++ ) {
+         const IndexType groupSize = getGroupSize( groupPointers, strip, group );
+         if( groupSize ) {
+            IndexType groupWidth = groupSize / groupHeight;
+            if( localIdx >= groupWidth ) {
+               localIdx -= groupWidth;
+               globalIdx += groupSize;
+            }
+            else {
+               if( Organization == RowMajorOrder ) {
+                  return globalIdx + rowStripPerm * groupWidth + localIdx;
                }
                else
-               {
-                  if( Organization == RowMajorOrder )
-                  {
-                     return globalIdx + rowStripPerm * groupWidth + localIdx;
-                  }
-                  else
-                     return globalIdx + rowStripPerm + localIdx * groupHeight;
-               }
+                  return globalIdx + rowStripPerm + localIdx * groupHeight;
             }
-            groupHeight /= 2;
          }
-         TNL_ASSERT_TRUE( false, "Segment capacity exceeded, wrong localIdx." );
-         return -1; // to avoid compiler warning
+         groupHeight /= 2;
       }
+      TNL_ASSERT_TRUE( false, "Segment capacity exceeded, wrong localIdx." );
+      return -1;  // to avoid compiler warning
+   }
 
-      static __cuda_callable__
-      SegmentViewType getSegmentViewDirect( const OffsetsHolderView& rowPermArray,
-                                            const OffsetsHolderView& groupPointers,
-                                            const IndexType segmentIdx )
-      {
-         using GroupsWidthType = typename SegmentViewType::GroupsWidthType;
+   static __cuda_callable__
+   SegmentViewType
+   getSegmentViewDirect( const OffsetsHolderView& rowPermArray,
+                         const OffsetsHolderView& groupPointers,
+                         const IndexType segmentIdx )
+   {
+      using GroupsWidthType = typename SegmentViewType::GroupsWidthType;
 
-         const IndexType strip = segmentIdx / getWarpSize();
-         const IndexType groupIdx = strip * ( getLogWarpSize() + 1 );
-         const IndexType inStripIdx = rowPermArray[ segmentIdx ] - strip * getWarpSize();
-         const IndexType groupsCount = getActiveGroupsCountDirect( rowPermArray, segmentIdx );
-         IndexType groupHeight = getWarpSize();
-         GroupsWidthType groupsWidth( 0 );
-         TNL_ASSERT_LE( groupsCount, getGroupsCount(), "" );
-         for( IndexType i = 0; i < groupsCount; i++ )
-         {
-            const IndexType groupSize = groupPointers[ groupIdx + i + 1 ] - groupPointers[ groupIdx + i ];
-            groupsWidth[ i ] = groupSize / groupHeight;
-            groupHeight /= 2;
-            //std::cerr << " ROW INIT: groupIdx = " << i << " groupSize = " << groupSize << " groupWidth = " << groupsWidth[ i ] << std::endl;
-         }
-         return SegmentViewType( segmentIdx,
-                                 groupPointers[ groupIdx ],
-                                 inStripIdx,
-                                 groupsWidth );
+      const IndexType strip = segmentIdx / getWarpSize();
+      const IndexType groupIdx = strip * ( getLogWarpSize() + 1 );
+      const IndexType inStripIdx = rowPermArray[ segmentIdx ] - strip * getWarpSize();
+      const IndexType groupsCount = getActiveGroupsCountDirect( rowPermArray, segmentIdx );
+      IndexType groupHeight = getWarpSize();
+      GroupsWidthType groupsWidth( 0 );
+      TNL_ASSERT_LE( groupsCount, getGroupsCount(), "" );
+      for( IndexType i = 0; i < groupsCount; i++ ) {
+         const IndexType groupSize = groupPointers[ groupIdx + i + 1 ] - groupPointers[ groupIdx + i ];
+         groupsWidth[ i ] = groupSize / groupHeight;
+         groupHeight /= 2;
+         // std::cerr << " ROW INIT: groupIdx = " << i << " groupSize = " << groupSize << " groupWidth = " << groupsWidth[ i ]
+         // << std::endl;
       }
+      return SegmentViewType( segmentIdx, groupPointers[ groupIdx ], inStripIdx, groupsWidth );
+   }
 
-      static __cuda_callable__
-      SegmentViewType getSegmentView( const OffsetsHolderView& rowPermArray,
-                                      const OffsetsHolderView& groupPointers,
-                                      const IndexType segmentIdx )
-      {
-         using GroupsWidthType = typename SegmentViewType::GroupsWidthType;
+   static __cuda_callable__
+   SegmentViewType
+   getSegmentView( const OffsetsHolderView& rowPermArray, const OffsetsHolderView& groupPointers, const IndexType segmentIdx )
+   {
+      using GroupsWidthType = typename SegmentViewType::GroupsWidthType;
 
-         const IndexType strip = segmentIdx / getWarpSize();
-         const IndexType groupIdx = strip * ( getLogWarpSize() + 1 );
-         const IndexType inStripIdx = rowPermArray.getElement( segmentIdx ) - strip * getWarpSize();
-         const IndexType groupsCount = getActiveGroupsCount( rowPermArray, segmentIdx );
-         IndexType groupHeight = getWarpSize();
-         GroupsWidthType groupsWidth( 0 );
-         for( IndexType i = 0; i < groupsCount; i++ )
-         {
-            const IndexType groupSize = groupPointers.getElement( groupIdx + i + 1 ) - groupPointers.getElement( groupIdx + i );
-            groupsWidth[ i ] = groupSize / groupHeight;
-            groupHeight /= 2;
-         }
-         return SegmentViewType( segmentIdx,
-                                 groupPointers[ groupIdx ],
-                                 inStripIdx,
-                                 groupsWidth );
+      const IndexType strip = segmentIdx / getWarpSize();
+      const IndexType groupIdx = strip * ( getLogWarpSize() + 1 );
+      const IndexType inStripIdx = rowPermArray.getElement( segmentIdx ) - strip * getWarpSize();
+      const IndexType groupsCount = getActiveGroupsCount( rowPermArray, segmentIdx );
+      IndexType groupHeight = getWarpSize();
+      GroupsWidthType groupsWidth( 0 );
+      for( IndexType i = 0; i < groupsCount; i++ ) {
+         const IndexType groupSize = groupPointers.getElement( groupIdx + i + 1 ) - groupPointers.getElement( groupIdx + i );
+         groupsWidth[ i ] = groupSize / groupHeight;
+         groupHeight /= 2;
       }
+      return SegmentViewType( segmentIdx, groupPointers[ groupIdx ], inStripIdx, groupsWidth );
+   }
 
-      static
-      Index getStripLength( const ConstOffsetsHolderView& groupPointers, const IndexType strip )
-      {
-         TNL_ASSERT( strip >= 0, std::cerr << "strip = " << strip );
-
-          return groupPointers.getElement( ( strip + 1 ) * ( getLogWarpSize() + 1 ) )
-                 - groupPointers.getElement( strip * ( getLogWarpSize() + 1 ) );
-      }
+   static Index
+   getStripLength( const ConstOffsetsHolderView& groupPointers, const IndexType strip )
+   {
+      TNL_ASSERT( strip >= 0, std::cerr << "strip = " << strip );
 
-      static __cuda_callable__
-      Index getStripLengthDirect( const ConstOffsetsHolderView& groupPointers, const IndexType strip )
-      {
-         TNL_ASSERT( strip >= 0, std::cerr << "strip = " << strip );
+      return groupPointers.getElement( ( strip + 1 ) * ( getLogWarpSize() + 1 ) )
+           - groupPointers.getElement( strip * ( getLogWarpSize() + 1 ) );
+   }
 
-          return groupPointers[ ( strip + 1 ) * ( getLogWarpSize() + 1 ) ]
-                 - groupPointers[ strip * ( getLogWarpSize() + 1 ) ];
-      }
+   static __cuda_callable__
+   Index
+   getStripLengthDirect( const ConstOffsetsHolderView& groupPointers, const IndexType strip )
+   {
+      TNL_ASSERT( strip >= 0, std::cerr << "strip = " << strip );
 
+      return groupPointers[ ( strip + 1 ) * ( getLogWarpSize() + 1 ) ] - groupPointers[ strip * ( getLogWarpSize() + 1 ) ];
+   }
 };
 
 #ifdef HAVE_CUDA
@@ -289,51 +283,48 @@ template< typename Index,
           int BlockDim = 256,
           int WarpSize = 32,
           bool HasAllParameters = detail::CheckFetchLambda< Index, Fetch >::hasAllParameters() >
-struct BiEllpackreduceSegmentsDispatcher{};
+struct BiEllpackreduceSegmentsDispatcher
+{};
 
 template< typename Index, typename Fetch, int BlockDim, int WarpSize >
 struct BiEllpackreduceSegmentsDispatcher< Index, Fetch, BlockDim, WarpSize, true >
 {
-   template< typename View,
-             typename Reduction,
-             typename ResultKeeper,
-             typename Real,
-             typename... Args >
+   template< typename View, typename Reduction, typename ResultKeeper, typename Real, typename... Args >
    __device__
-   static void exec( View biEllpack,
-                     Index gridIdx,
-                     Index first,
-                     Index last,
-                     Fetch fetch,
-                     Reduction reduction,
-                     ResultKeeper keeper,
-                     Real zero,
-                     Args... args )
+   static void
+   exec( View biEllpack,
+         Index gridIdx,
+         Index first,
+         Index last,
+         Fetch fetch,
+         Reduction reduction,
+         ResultKeeper keeper,
+         Real zero,
+         Args... args )
    {
-      biEllpack.template reduceSegmentsKernelWithAllParameters< Fetch, Reduction, ResultKeeper, Real, BlockDim, Args... >( gridIdx, first, last, fetch, reduction, keeper, zero, args... );
+      biEllpack.template reduceSegmentsKernelWithAllParameters< Fetch, Reduction, ResultKeeper, Real, BlockDim, Args... >(
+         gridIdx, first, last, fetch, reduction, keeper, zero, args... );
    }
 };
 
 template< typename Index, typename Fetch, int BlockDim, int WarpSize >
 struct BiEllpackreduceSegmentsDispatcher< Index, Fetch, BlockDim, WarpSize, false >
 {
-   template< typename View,
-             typename Reduction,
-             typename ResultKeeper,
-             typename Real,
-             typename... Args >
+   template< typename View, typename Reduction, typename ResultKeeper, typename Real, typename... Args >
    __device__
-   static void exec( View biEllpack,
-                     Index gridIdx,
-                     Index first,
-                     Index last,
-                     Fetch fetch,
-                     Reduction reduction,
-                     ResultKeeper keeper,
-                     Real zero,
-                     Args... args )
+   static void
+   exec( View biEllpack,
+         Index gridIdx,
+         Index first,
+         Index last,
+         Fetch fetch,
+         Reduction reduction,
+         ResultKeeper keeper,
+         Real zero,
+         Args... args )
    {
-      biEllpack.template reduceSegmentsKernel< Fetch, Reduction, ResultKeeper, Real, BlockDim, Args... >( gridIdx, first, last, fetch, reduction, keeper, zero, args... );
+      biEllpack.template reduceSegmentsKernel< Fetch, Reduction, ResultKeeper, Real, BlockDim, Args... >(
+         gridIdx, first, last, fetch, reduction, keeper, zero, args... );
    }
 };
 
@@ -346,21 +337,23 @@ template< typename View,
           int BlockDim,
           typename... Args >
 __global__
-void BiEllpackreduceSegmentsKernel( View biEllpack,
-                                       Index gridIdx,
-                                       Index first,
-                                       Index last,
-                                       Fetch fetch,
-                                       Reduction reduction,
-                                       ResultKeeper keeper,
-                                       Real zero,
-                                       Args... args )
+void
+BiEllpackreduceSegmentsKernel( View biEllpack,
+                               Index gridIdx,
+                               Index first,
+                               Index last,
+                               Fetch fetch,
+                               Reduction reduction,
+                               ResultKeeper keeper,
+                               Real zero,
+                               Args... args )
 {
-   BiEllpackreduceSegmentsDispatcher< Index, Fetch, BlockDim >::exec( biEllpack, gridIdx, first, last, fetch, reduction, keeper, zero, args... );
+   BiEllpackreduceSegmentsDispatcher< Index, Fetch, BlockDim >::exec(
+      biEllpack, gridIdx, first, last, fetch, reduction, keeper, zero, args... );
 }
 #endif
 
-         } //namespace detail
-      } //namespace Segments
-   } //namespace Algorithms
-} //namepsace TNL
+}  // namespace detail
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/detail/CSR.h b/src/TNL/Algorithms/Segments/detail/CSR.h
index 3354aaf1749e28cb27af17c663908b161cf91124..7d0c982952fce013c2276f133d8459b4419b7471 100644
--- a/src/TNL/Algorithms/Segments/detail/CSR.h
+++ b/src/TNL/Algorithms/Segments/detail/CSR.h
@@ -9,104 +9,115 @@
 #include <TNL/Algorithms/scan.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
-         namespace detail {
+namespace Algorithms {
+namespace Segments {
+namespace detail {
 
-template< typename Device,
-          typename Index >
+template< typename Device, typename Index >
 class CSR
 {
-   public:
-
-      using DeviceType = Device;
-      using IndexType = Index;
-
-      template< typename SizesHolder, typename CSROffsets >
-      static void setSegmentsSizes( const SizesHolder& sizes, CSROffsets& offsets )
-      {
-         offsets.setSize( sizes.getSize() + 1 );
-         // GOTCHA: when sizes.getSize() == 0, getView returns a full view with size == 1
-         if( sizes.getSize() > 0 ) {
-            auto view = offsets.getView( 0, sizes.getSize() );
-            view = sizes;
-         }
-         offsets.setElement( sizes.getSize(), 0 );
-         inplaceExclusiveScan( offsets );
+public:
+   using DeviceType = Device;
+   using IndexType = Index;
+
+   template< typename SizesHolder, typename CSROffsets >
+   static void
+   setSegmentsSizes( const SizesHolder& sizes, CSROffsets& offsets )
+   {
+      offsets.setSize( sizes.getSize() + 1 );
+      // GOTCHA: when sizes.getSize() == 0, getView returns a full view with size == 1
+      if( sizes.getSize() > 0 ) {
+         auto view = offsets.getView( 0, sizes.getSize() );
+         view = sizes;
       }
-
-      template< typename CSROffsets >
-      __cuda_callable__
-      static IndexType getSegmentsCount( const CSROffsets& offsets )
-      {
-         return offsets.getSize() - 1;
-      }
-
-      /***
-       * \brief Returns size of the segment number \r segmentIdx
-       */
-      template< typename CSROffsets >
-      __cuda_callable__
-      static IndexType getSegmentSize( const CSROffsets& offsets, const IndexType segmentIdx )
-      {
-         if( ! std::is_same< DeviceType, Devices::Host >::value )
-         {
+      offsets.setElement( sizes.getSize(), 0 );
+      inplaceExclusiveScan( offsets );
+   }
+
+   template< typename CSROffsets >
+   __cuda_callable__
+   static IndexType
+   getSegmentsCount( const CSROffsets& offsets )
+   {
+      return offsets.getSize() - 1;
+   }
+
+   /***
+    * \brief Returns size of the segment number \r segmentIdx
+    */
+   template< typename CSROffsets >
+   __cuda_callable__
+   static IndexType
+   getSegmentSize( const CSROffsets& offsets, const IndexType segmentIdx )
+   {
+      if( ! std::is_same< DeviceType, Devices::Host >::value ) {
 #ifdef __CUDA_ARCH__
-            return offsets[ segmentIdx + 1 ] - offsets[ segmentIdx ];
+         return offsets[ segmentIdx + 1 ] - offsets[ segmentIdx ];
 #else
-            return offsets.getElement( segmentIdx + 1 ) - offsets.getElement( segmentIdx );
+         return offsets.getElement( segmentIdx + 1 ) - offsets.getElement( segmentIdx );
 #endif
-         }
-         return offsets[ segmentIdx + 1 ] - offsets[ segmentIdx ];
       }
-
-      /***
-       * \brief Returns number of elements that needs to be allocated.
-       */
-      template< typename CSROffsets >
-      __cuda_callable__
-      static IndexType getStorageSize( const CSROffsets& offsets )
-      {
-         if( ! std::is_same< DeviceType, Devices::Host >::value )
-         {
+      return offsets[ segmentIdx + 1 ] - offsets[ segmentIdx ];
+   }
+
+   /***
+    * \brief Returns number of elements that needs to be allocated.
+    */
+   template< typename CSROffsets >
+   __cuda_callable__
+   static IndexType
+   getStorageSize( const CSROffsets& offsets )
+   {
+      if( ! std::is_same< DeviceType, Devices::Host >::value ) {
 #ifdef __CUDA_ARCH__
-            return offsets[ getSegmentsCount( offsets ) ];
+         return offsets[ getSegmentsCount( offsets ) ];
 #else
-            return offsets.getElement( getSegmentsCount( offsets ) );
+         return offsets.getElement( getSegmentsCount( offsets ) );
 #endif
-         }
-         return offsets[ getSegmentsCount( offsets ) ];
       }
-
-      __cuda_callable__
-      IndexType getGlobalIndex( const Index segmentIdx, const Index localIdx ) const;
-
-      __cuda_callable__
-      void getSegmentAndLocalIndex( const Index globalIdx, Index& segmentIdx, Index& localIdx ) const;
-
-      /***
-       * \brief Go over all segments and for each segment element call
-       * function 'f' with arguments 'args'. The return type of 'f' is bool.
-       * When its true, the for-loop continues. Once 'f' returns false, the for-loop
-       * is terminated.
-       */
-      template< typename Function, typename... Args >
-      void forElements( IndexType first, IndexType last, Function& f, Args... args ) const;
-
-      template< typename Function, typename... Args >
-      void forAllElements( Function& f, Args... args ) const;
-
-
-      /***
-       * \brief Go over all segments and perform a reduction in each of them.
-       */
-      template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real, typename... Args >
-      void reduceSegments( IndexType first, IndexType last, Fetch& fetch, Reduction& reduction, ResultKeeper& keeper, const Real& zero, Args... args ) const;
-
-      template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real, typename... Args >
-      void reduceAllSegments( Fetch& fetch, Reduction& reduction, ResultKeeper& keeper, const Real& zero, Args... args ) const;
+      return offsets[ getSegmentsCount( offsets ) ];
+   }
+
+   __cuda_callable__
+   IndexType
+   getGlobalIndex( Index segmentIdx, Index localIdx ) const;
+
+   __cuda_callable__
+   void
+   getSegmentAndLocalIndex( Index globalIdx, Index& segmentIdx, Index& localIdx ) const;
+
+   /***
+    * \brief Go over all segments and for each segment element call
+    * function 'f' with arguments 'args'. The return type of 'f' is bool.
+    * When its true, the for-loop continues. Once 'f' returns false, the for-loop
+    * is terminated.
+    */
+   template< typename Function, typename... Args >
+   void
+   forElements( IndexType first, IndexType last, Function& f, Args... args ) const;
+
+   template< typename Function, typename... Args >
+   void
+   forAllElements( Function& f, Args... args ) const;
+
+   /***
+    * \brief Go over all segments and perform a reduction in each of them.
+    */
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real, typename... Args >
+   void
+   reduceSegments( IndexType first,
+                   IndexType last,
+                   Fetch& fetch,
+                   Reduction& reduction,
+                   ResultKeeper& keeper,
+                   const Real& zero,
+                   Args... args ) const;
+
+   template< typename Fetch, typename Reduction, typename ResultKeeper, typename Real, typename... Args >
+   void
+   reduceAllSegments( Fetch& fetch, Reduction& reduction, ResultKeeper& keeper, const Real& zero, Args... args ) const;
 };
-         } // namespace detail
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace detail
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/detail/CSRAdaptiveKernelBlockDescriptor.h b/src/TNL/Algorithms/Segments/detail/CSRAdaptiveKernelBlockDescriptor.h
index d6d1e1573cb628f86646a4eef5d8e7f122fa97bb..581bb3bce78d86ddca2e2a0fd0359684d6b7a586 100644
--- a/src/TNL/Algorithms/Segments/detail/CSRAdaptiveKernelBlockDescriptor.h
+++ b/src/TNL/Algorithms/Segments/detail/CSRAdaptiveKernelBlockDescriptor.h
@@ -7,11 +7,12 @@
 #pragma once
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
-         namespace detail {
+namespace Algorithms {
+namespace Segments {
+namespace detail {
 
-enum class Type {
+enum class Type
+{
    /* LONG = 0!!! Non zero value rewrites index[1] */
    LONG = 0,
    STREAM = 1,
@@ -24,31 +25,33 @@ enum class Type {
 template< typename Index >
 union CSRAdaptiveKernelBlockDescriptor
 {
-   CSRAdaptiveKernelBlockDescriptor(Index row, Type type = Type::VECTOR, Index index = 0, uint8_t warpsCount = 0) noexcept
+   CSRAdaptiveKernelBlockDescriptor( Index row, Type type = Type::VECTOR, Index index = 0, uint8_t warpsCount = 0 ) noexcept
    {
-      this->index[0] = row;
-      this->index[1] = index;
-      this->byte[sizeof(Index) == 4 ? 7 : 15] = (uint8_t)type;
+      this->index[ 0 ] = row;
+      this->index[ 1 ] = index;
+      this->byte[ sizeof( Index ) == 4 ? 7 : 15 ] = (uint8_t) type;
    }
 
-   CSRAdaptiveKernelBlockDescriptor(Index row, Type type, Index nextRow, Index maxID, Index minID) noexcept
+   CSRAdaptiveKernelBlockDescriptor( Index row, Type type, Index nextRow, Index maxID, Index minID ) noexcept
    {
-      this->index[0] = row;
-      this->index[1] = 0;
-      this->twobytes[sizeof(Index) == 4 ? 2 : 4] = maxID - minID;
+      this->index[ 0 ] = row;
+      this->index[ 1 ] = 0;
+      this->twobytes[ sizeof( Index ) == 4 ? 2 : 4 ] = maxID - minID;
 
-      if (type == Type::STREAM)
-         this->twobytes[sizeof(Index) == 4 ? 3 : 5] = nextRow - row;
+      if( type == Type::STREAM )
+         this->twobytes[ sizeof( Index ) == 4 ? 3 : 5 ] = nextRow - row;
 
-      if (type == Type::STREAM)
-         this->byte[sizeof(Index) == 4 ? 7 : 15] |= 0b1000000;
-      else if (type == Type::VECTOR)
-         this->byte[sizeof(Index) == 4 ? 7 : 15] |= 0b10000000;
+      if( type == Type::STREAM )
+         this->byte[ sizeof( Index ) == 4 ? 7 : 15 ] |= 0b1000000;
+      else if( type == Type::VECTOR )
+         this->byte[ sizeof( Index ) == 4 ? 7 : 15 ] |= 0b10000000;
    }
 
    CSRAdaptiveKernelBlockDescriptor() = default;
 
-   __cuda_callable__ Type getType() const
+   __cuda_callable__
+   Type
+   getType() const
    {
       if( byte[ sizeof( Index ) == 4 ? 7 : 15 ] & 0b1000000 )
          return Type::STREAM;
@@ -57,7 +60,9 @@ union CSRAdaptiveKernelBlockDescriptor
       return Type::LONG;
    }
 
-   __cuda_callable__ const Index& getFirstSegment() const
+   __cuda_callable__
+   const Index&
+   getFirstSegment() const
    {
       return index[ 0 ];
    }
@@ -65,35 +70,43 @@ union CSRAdaptiveKernelBlockDescriptor
    /***
     * \brief Returns number of elements covered by the block.
     */
-   __cuda_callable__ const Index getSize() const
+   __cuda_callable__
+   const Index
+   getSize() const
    {
-      return twobytes[ sizeof(Index) == 4 ? 2 : 4 ];
+      return twobytes[ sizeof( Index ) == 4 ? 2 : 4 ];
    }
 
    /***
     * \brief Returns number of segments covered by the block.
     */
-   __cuda_callable__ const Index getSegmentsInBlock() const
+   __cuda_callable__
+   const Index
+   getSegmentsInBlock() const
    {
       return ( twobytes[ sizeof( Index ) == 4 ? 3 : 5 ] & 0x3FFF );
    }
 
-   __cuda_callable__ uint8_t getWarpIdx() const
+   __cuda_callable__
+   uint8_t
+   getWarpIdx() const
    {
       return index[ 1 ];
    }
 
-   __cuda_callable__ uint8_t getWarpsCount() const
+   __cuda_callable__
+   uint8_t
+   getWarpsCount() const
    {
       return 1;
    }
 
-   void print( std::ostream& str ) const
+   void
+   print( std::ostream& str ) const
    {
       Type type = this->getType();
       str << "Type: ";
-      switch( type )
-      {
+      switch( type ) {
          case Type::STREAM:
             str << " Stream ";
             break;
@@ -108,10 +121,10 @@ union CSRAdaptiveKernelBlockDescriptor
       str << " block end: " << getSize();
       str << " index in warp: " << index[ 1 ];
    }
-   Index index[2]; // index[0] is row pointer, index[1] is index in warp
-   uint8_t byte[sizeof(Index) == 4 ? 8 : 16]; // byte[7/15] is type specificator
-   uint16_t twobytes[sizeof(Index) == 4 ? 4 : 8]; //twobytes[2/4] is maxID - minID
-                                                //twobytes[3/5] is nextRow - row
+   Index index[ 2 ];                                   // index[0] is row pointer, index[1] is index in warp
+   uint8_t byte[ sizeof( Index ) == 4 ? 8 : 16 ];      // byte[7/15] is type specificator
+   uint16_t twobytes[ sizeof( Index ) == 4 ? 4 : 8 ];  // twobytes[2/4] is maxID - minID
+                                                       // twobytes[3/5] is nextRow - row
 };
 #else
 
@@ -124,7 +137,7 @@ struct CSRAdaptiveKernelBlockDescriptor
                                      uint8_t warpsCount = 0 ) noexcept
    {
       this->firstSegmentIdx = firstSegmentIdx;
-      this->type = ( uint8_t ) type;
+      this->type = (uint8_t) type;
       this->warpIdx = warpIdx;
       this->warpsCount = warpsCount;
       /*this->index[0] = row;
@@ -132,17 +145,13 @@ struct CSRAdaptiveKernelBlockDescriptor
       this->byte[sizeof(Index) == 4 ? 7 : 15] = (uint8_t)type;*/
    }
 
-   CSRAdaptiveKernelBlockDescriptor( Index firstSegmentIdx,
-                                     Type type,
-                                     Index lastSegmentIdx,
-                                     Index end,
-                                     Index begin ) noexcept
+   CSRAdaptiveKernelBlockDescriptor( Index firstSegmentIdx, Type type, Index lastSegmentIdx, Index end, Index begin ) noexcept
    {
       this->firstSegmentIdx = firstSegmentIdx;
       this->warpIdx = 0;
       this->blockSize = end - begin;
       this->segmentsInBlock = lastSegmentIdx - firstSegmentIdx;
-      this->type = ( uint8_t ) type;
+      this->type = (uint8_t) type;
 
       /*this->index[0] = row;
       this->index[1] = 0;
@@ -159,9 +168,11 @@ struct CSRAdaptiveKernelBlockDescriptor
 
    CSRAdaptiveKernelBlockDescriptor() = default;
 
-   __cuda_callable__ Type getType() const
+   __cuda_callable__
+   Type
+   getType() const
    {
-      return ( Type ) this->type;
+      return (Type) this->type;
       /*if( byte[ sizeof( Index ) == 4 ? 7 : 15 ] & 0b1000000 )
          return Type::STREAM;
       if( byte[ sizeof( Index ) == 4 ? 7 : 15 ] & 0b10000000 )
@@ -169,45 +180,55 @@ struct CSRAdaptiveKernelBlockDescriptor
       return Type::LONG;*/
    }
 
-   __cuda_callable__ const Index& getFirstSegment() const
+   __cuda_callable__
+   const Index&
+   getFirstSegment() const
    {
       return this->firstSegmentIdx;
-      //return index[ 0 ];
+      // return index[ 0 ];
    }
 
    /***
     * \brief Returns number of elements covered by the block.
     */
-   __cuda_callable__ const Index getSize() const
+   __cuda_callable__
+   const Index
+   getSize() const
    {
       return this->blockSize;
-      //return twobytes[ sizeof(Index) == 4 ? 2 : 4 ];
+      // return twobytes[ sizeof(Index) == 4 ? 2 : 4 ];
    }
 
    /***
     * \brief Returns number of segments covered by the block.
     */
-   __cuda_callable__ const Index getSegmentsInBlock() const
+   __cuda_callable__
+   const Index
+   getSegmentsInBlock() const
    {
       return this->segmentsInBlock;
-      //return ( twobytes[ sizeof( Index ) == 4 ? 3 : 5 ] & 0x3FFF );
+      // return ( twobytes[ sizeof( Index ) == 4 ? 3 : 5 ] & 0x3FFF );
    }
 
-   __cuda_callable__ uint8_t getWarpIdx() const
+   __cuda_callable__
+   uint8_t
+   getWarpIdx() const
    {
       return this->warpIdx;
    }
 
-   __cuda_callable__ uint8_t getWarpsCount() const
+   __cuda_callable__
+   uint8_t
+   getWarpsCount() const
    {
       return this->warpsCount;
    }
 
-   void print( std::ostream& str ) const
+   void
+   print( std::ostream& str ) const
    {
       str << "Type: ";
-      switch( this->getType() )
-      {
+      switch( this->getType() ) {
          case Type::STREAM:
             str << " Stream ";
             break;
@@ -227,21 +248,22 @@ struct CSRAdaptiveKernelBlockDescriptor
    Index firstSegmentIdx, blockSize, segmentsInBlock;
    uint8_t warpIdx, warpsCount;
 
-   //Index index[2]; // index[0] is row pointer, index[1] is index in warp
-   //uint8_t byte[sizeof(Index) == 4 ? 8 : 16]; // byte[7/15] is type specificator
-   //uint16_t twobytes[sizeof(Index) == 4 ? 4 : 8]; //twobytes[2/4] is maxID - minID
-                                                //twobytes[3/5] is nextRow - row
+   // Index index[2]; // index[0] is row pointer, index[1] is index in warp
+   // uint8_t byte[sizeof(Index) == 4 ? 8 : 16]; // byte[7/15] is type specificator
+   // uint16_t twobytes[sizeof(Index) == 4 ? 4 : 8]; //twobytes[2/4] is maxID - minID
+   // twobytes[3/5] is nextRow - row
 };
 
 #endif
 
 template< typename Index >
-std::ostream& operator<< ( std::ostream& str, const CSRAdaptiveKernelBlockDescriptor< Index >& block )
+std::ostream&
+operator<<( std::ostream& str, const CSRAdaptiveKernelBlockDescriptor< Index >& block )
 {
    block.print( str );
    return str;
 }
-         } // namespace detail
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace detail
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/detail/CSRAdaptiveKernelParameters.h b/src/TNL/Algorithms/Segments/detail/CSRAdaptiveKernelParameters.h
index cf882de94da4340c0c6b8f97ee57eb7ae1b66065..e4dd80a1733fa411caa2e17468638c26ab153267 100644
--- a/src/TNL/Algorithms/Segments/detail/CSRAdaptiveKernelParameters.h
+++ b/src/TNL/Algorithms/Segments/detail/CSRAdaptiveKernelParameters.h
@@ -7,23 +7,27 @@
 #pragma once
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
-         namespace detail {
+namespace Algorithms {
+namespace Segments {
+namespace detail {
 
 // This can be used for tunning the number of CUDA threads per block depending on the size of Value
 // TODO: Perform some tests
 static constexpr int CSRAdaptiveKernelParametersCudaBlockSizes[] = { 256, 256, 256, 256, 256, 256 };
 
-template< int SizeOfValue = 1,
-          int StreamedSharedMemory_ = 24576 >
+template< int SizeOfValue = 1, int StreamedSharedMemory_ = 24576 >
 struct CSRAdaptiveKernelParameters
 {
    static constexpr int MaxValueSizeLog = 6;
 
-   static constexpr int getSizeValueLogConstexpr( const int i );
+   static constexpr int
+   getSizeValueLogConstexpr( const int i );
 
-   static constexpr int getSizeOfValue() { return SizeOfValue; };
+   static constexpr int
+   getSizeOfValue()
+   {
+      return SizeOfValue;
+   };
 
    static constexpr int SizeOfValueLog = getSizeValueLogConstexpr( SizeOfValue );
 
@@ -34,7 +38,11 @@ struct CSRAdaptiveKernelParameters
     *
     * \return CUDA block size.
     */
-   static constexpr int CudaBlockSize() { return CSRAdaptiveKernelParametersCudaBlockSizes[ SizeOfValueLog ]; };
+   static constexpr int
+   CudaBlockSize()
+   {
+      return CSRAdaptiveKernelParametersCudaBlockSizes[ SizeOfValueLog ];
+   };
    //{ return SizeOfValue == 8 ? 128 : 256; };
 
    /**
@@ -42,67 +50,100 @@ struct CSRAdaptiveKernelParameters
     *
     * \return Stream shared memory.
     */
-   static constexpr size_t StreamedSharedMemory() { return StreamedSharedMemory_; };
+   static constexpr size_t
+   StreamedSharedMemory()
+   {
+      return StreamedSharedMemory_;
+   };
 
    /**
     * \brief Number of elements fitting into streamed shared memory.
     */
-   static constexpr size_t StreamedSharedElementsCount() { return StreamedSharedMemory() / SizeOfValue; };
+   static constexpr size_t
+   StreamedSharedElementsCount()
+   {
+      return StreamedSharedMemory() / SizeOfValue;
+   };
 
    /**
     * \brief Computes number of warps in one CUDA block.
     */
-   static constexpr size_t WarpsCount() { return CudaBlockSize() / Cuda::getWarpSize(); };
+   static constexpr size_t
+   WarpsCount()
+   {
+      return CudaBlockSize() / Cuda::getWarpSize();
+   };
 
    /**
     * \brief Computes number of elements to be streamed into the shared memory.
     *
     * \return Number of elements to be streamed into the shared memory.
     */
-   static constexpr size_t StreamedSharedElementsPerWarp() { return StreamedSharedElementsCount() / WarpsCount(); };
+   static constexpr size_t
+   StreamedSharedElementsPerWarp()
+   {
+      return StreamedSharedElementsCount() / WarpsCount();
+   };
 
    /**
     * \brief Returns maximum number of elements per warp for vector and hybrid kernel.
     *
     * \return Maximum number of elements per warp for vector and hybrid kernel.
     */
-   static constexpr int MaxVectorElementsPerWarp() { return 384; };
+   static constexpr int
+   MaxVectorElementsPerWarp()
+   {
+      return 384;
+   };
 
    /**
     * \brief Returns maximum number of elements per warp for adaptive kernel.
     *
     * \return Maximum number of elements per warp for adaptive kernel.
     */
-   static constexpr int MaxAdaptiveElementsPerWarp() { return 512; };
+   static constexpr int
+   MaxAdaptiveElementsPerWarp()
+   {
+      return 512;
+   };
 
-   static int getSizeValueLog( const int i )
+   static int
+   getSizeValueLog( const int i )
    {
-      if( i ==  1 ) return 0;
-      if( i ==  2 ) return 1;
-      if( i <=  4 ) return 2;
-      if( i <=  8 ) return 3;
-      if( i <= 16 ) return 4;
+      if( i == 1 )
+         return 0;
+      if( i == 2 )
+         return 1;
+      if( i <= 4 )
+         return 2;
+      if( i <= 8 )
+         return 3;
+      if( i <= 16 )
+         return 4;
       return 5;
    }
 };
 
-
-template< int SizeOfValue,
-          int StreamedSharedMemory_ >
+template< int SizeOfValue, int StreamedSharedMemory_ >
 constexpr int
-CSRAdaptiveKernelParameters< SizeOfValue, StreamedSharedMemory_ >::
-getSizeValueLogConstexpr( const int i )
+CSRAdaptiveKernelParameters< SizeOfValue, StreamedSharedMemory_ >::getSizeValueLogConstexpr( const int i )
 {
-   if( i ==  1 ) return 0;
-   if( i ==  2 ) return 1;
-   if( i <=  4 ) return 2;
-   if( i <=  8 ) return 3;
-   if( i <= 16 ) return 4;
-   if( i <= 32 ) return 5;
+   if( i == 1 )
+      return 0;
+   if( i == 2 )
+      return 1;
+   if( i <= 4 )
+      return 2;
+   if( i <= 8 )
+      return 3;
+   if( i <= 16 )
+      return 4;
+   if( i <= 32 )
+      return 5;
    return 6;
 };
 
-         } // namespace detail
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace detail
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/detail/CheckLambdas.h b/src/TNL/Algorithms/Segments/detail/CheckLambdas.h
index e57f2fa849235fa069a9235117cccfe17875fe3a..95fba02fffdb2af760c537a5c522b47b7e7990c0 100644
--- a/src/TNL/Algorithms/Segments/detail/CheckLambdas.h
+++ b/src/TNL/Algorithms/Segments/detail/CheckLambdas.h
@@ -6,31 +6,36 @@
 
 #pragma once
 
-
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
-         namespace detail {
+namespace Algorithms {
+namespace Segments {
+namespace detail {
 
-template< typename Index,
-          typename Lambda >
+template< typename Index, typename Lambda >
 class CheckFetchLambda
 {
-   private:
-      typedef char YesType[1];
-      typedef char NoType[2];
-
-      template< typename C > static YesType& test( decltype(std::declval< C >()( Index(), Index(), Index(), std::declval< bool& >() ) ) );
-      template< typename C > static NoType& test(...);
-
-      static constexpr bool value = ( sizeof( test< Lambda >(0) ) == sizeof( YesType ) );
-
-   public:
-
-      static constexpr bool hasAllParameters() { return value; };
+private:
+   using YesType = char[ 1 ];
+   using NoType = char[ 2 ];
+
+   template< typename C >
+   static YesType&
+   test( decltype( std::declval< C >()( Index(), Index(), Index(), std::declval< bool& >() ) ) );
+   template< typename C >
+   static NoType&
+   test( ... );
+
+   static constexpr bool value = ( sizeof( test< Lambda >( 0 ) ) == sizeof( YesType ) );
+
+public:
+   static constexpr bool
+   hasAllParameters()
+   {
+      return value;
+   };
 };
 
-         } // namespace detail
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace detail
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/detail/ChunkedEllpack.h b/src/TNL/Algorithms/Segments/detail/ChunkedEllpack.h
index 269a8ed5a602eb0d9eb8f3099d3b201562454fd8..ff63ce78a6407cea78cf65ca5d96432a85ef8f9b 100644
--- a/src/TNL/Algorithms/Segments/detail/ChunkedEllpack.h
+++ b/src/TNL/Algorithms/Segments/detail/ChunkedEllpack.h
@@ -12,9 +12,9 @@
 #include <TNL/Algorithms/Segments/detail/CheckLambdas.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
-         namespace detail {
+namespace Algorithms {
+namespace Segments {
+namespace detail {
 
 /***
  * In the ChunkedEllpack, the segments are split into slices. This is done
@@ -48,208 +48,195 @@ struct ChunkedEllpackSliceInfo
    Index pointer;
 };
 
-template< typename Index,
-          typename Device,
-          ElementsOrganization Organization >
+template< typename Index, typename Device, ElementsOrganization Organization >
 class ChunkedEllpack
 {
-   public:
-
-      using DeviceType = Device;
-      using IndexType = Index;
-      static constexpr ElementsOrganization getOrganization() { return Organization; }
-      using OffsetsContainer = Containers::Vector< IndexType, DeviceType, IndexType >;
-      using OffsetsHolderView = typename OffsetsContainer::ConstViewType;
-      using SegmentsSizes = OffsetsContainer;
-      using ChunkedEllpackSliceInfoType = detail::ChunkedEllpackSliceInfo< IndexType >;
-      using ChunkedEllpackSliceInfoAllocator = typename Allocators::Default< Device >::template Allocator< ChunkedEllpackSliceInfoType >;
-      using ChunkedEllpackSliceInfoContainer = Containers::Array< ChunkedEllpackSliceInfoType, DeviceType, IndexType, ChunkedEllpackSliceInfoAllocator >;
-      using ChunkedEllpackSliceInfoContainerView = typename ChunkedEllpackSliceInfoContainer::ConstViewType;
-      using SegmentViewType = ChunkedEllpackSegmentView< IndexType, Organization >;
+public:
+   using DeviceType = Device;
+   using IndexType = Index;
+   static constexpr ElementsOrganization
+   getOrganization()
+   {
+      return Organization;
+   }
+   using OffsetsContainer = Containers::Vector< IndexType, DeviceType, IndexType >;
+   using OffsetsHolderView = typename OffsetsContainer::ConstViewType;
+   using SegmentsSizes = OffsetsContainer;
+   using ChunkedEllpackSliceInfoType = detail::ChunkedEllpackSliceInfo< IndexType >;
+   using ChunkedEllpackSliceInfoAllocator =
+      typename Allocators::Default< Device >::template Allocator< ChunkedEllpackSliceInfoType >;
+   using ChunkedEllpackSliceInfoContainer =
+      Containers::Array< ChunkedEllpackSliceInfoType, DeviceType, IndexType, ChunkedEllpackSliceInfoAllocator >;
+   using ChunkedEllpackSliceInfoContainerView = typename ChunkedEllpackSliceInfoContainer::ConstViewType;
+   using SegmentViewType = ChunkedEllpackSegmentView< IndexType, Organization >;
 
-      __cuda_callable__ static
-      IndexType getSegmentSizeDirect( const OffsetsHolderView& segmentsToSlicesMapping,
-                                      const ChunkedEllpackSliceInfoContainerView& slices,
-                                      const OffsetsHolderView& segmentsToChunksMapping,
-                                      const IndexType segmentIdx )
-      {
-         const IndexType& sliceIndex = segmentsToSlicesMapping[ segmentIdx ];
-         IndexType firstChunkOfSegment( 0 );
-         if( segmentIdx != slices[ sliceIndex ].firstSegment )
-            firstChunkOfSegment = segmentsToChunksMapping[ segmentIdx - 1 ];
+   __cuda_callable__
+   static IndexType
+   getSegmentSizeDirect( const OffsetsHolderView& segmentsToSlicesMapping,
+                         const ChunkedEllpackSliceInfoContainerView& slices,
+                         const OffsetsHolderView& segmentsToChunksMapping,
+                         const IndexType segmentIdx )
+   {
+      const IndexType& sliceIndex = segmentsToSlicesMapping[ segmentIdx ];
+      IndexType firstChunkOfSegment( 0 );
+      if( segmentIdx != slices[ sliceIndex ].firstSegment )
+         firstChunkOfSegment = segmentsToChunksMapping[ segmentIdx - 1 ];
 
-         const IndexType lastChunkOfSegment = segmentsToChunksMapping[ segmentIdx ];
-         const IndexType segmentChunksCount = lastChunkOfSegment - firstChunkOfSegment;
-         const IndexType chunkSize = slices[ sliceIndex ].chunkSize;
-         return chunkSize * segmentChunksCount;
-      }
+      const IndexType lastChunkOfSegment = segmentsToChunksMapping[ segmentIdx ];
+      const IndexType segmentChunksCount = lastChunkOfSegment - firstChunkOfSegment;
+      const IndexType chunkSize = slices[ sliceIndex ].chunkSize;
+      return chunkSize * segmentChunksCount;
+   }
 
-      static
-      IndexType getSegmentSize( const OffsetsHolderView& segmentsToSlicesMapping,
-                                const ChunkedEllpackSliceInfoContainerView& slices,
-                                const OffsetsHolderView& segmentsToChunksMapping,
-                                const IndexType segmentIdx )
-      {
-         const IndexType& sliceIndex = segmentsToSlicesMapping.getElement( segmentIdx );
-         IndexType firstChunkOfSegment( 0 );
-         if( segmentIdx != slices.getElement( sliceIndex ).firstSegment )
-            firstChunkOfSegment = segmentsToChunksMapping.getElement( segmentIdx - 1 );
+   static IndexType
+   getSegmentSize( const OffsetsHolderView& segmentsToSlicesMapping,
+                   const ChunkedEllpackSliceInfoContainerView& slices,
+                   const OffsetsHolderView& segmentsToChunksMapping,
+                   const IndexType segmentIdx )
+   {
+      const IndexType& sliceIndex = segmentsToSlicesMapping.getElement( segmentIdx );
+      IndexType firstChunkOfSegment( 0 );
+      if( segmentIdx != slices.getElement( sliceIndex ).firstSegment )
+         firstChunkOfSegment = segmentsToChunksMapping.getElement( segmentIdx - 1 );
 
-         const IndexType lastChunkOfSegment = segmentsToChunksMapping.getElement( segmentIdx );
-         const IndexType segmentChunksCount = lastChunkOfSegment - firstChunkOfSegment;
-         const IndexType chunkSize = slices.getElement( sliceIndex ).chunkSize;
-         return chunkSize * segmentChunksCount;
-      }
+      const IndexType lastChunkOfSegment = segmentsToChunksMapping.getElement( segmentIdx );
+      const IndexType segmentChunksCount = lastChunkOfSegment - firstChunkOfSegment;
+      const IndexType chunkSize = slices.getElement( sliceIndex ).chunkSize;
+      return chunkSize * segmentChunksCount;
+   }
 
-      __cuda_callable__ static
-      IndexType getGlobalIndexDirect( const OffsetsHolderView& segmentsToSlicesMapping,
-                                      const ChunkedEllpackSliceInfoContainerView& slices,
-                                      const OffsetsHolderView& segmentsToChunksMapping,
-                                      const IndexType chunksInSlice,
-                                      const IndexType segmentIdx,
-                                      const IndexType localIdx )
-      {
-         const IndexType& sliceIndex = segmentsToSlicesMapping[ segmentIdx ];
-         IndexType firstChunkOfSegment( 0 );
-         if( segmentIdx != slices[ sliceIndex ].firstSegment )
-            firstChunkOfSegment = segmentsToChunksMapping[ segmentIdx - 1 ];
+   __cuda_callable__
+   static IndexType
+   getGlobalIndexDirect( const OffsetsHolderView& segmentsToSlicesMapping,
+                         const ChunkedEllpackSliceInfoContainerView& slices,
+                         const OffsetsHolderView& segmentsToChunksMapping,
+                         const IndexType chunksInSlice,
+                         const IndexType segmentIdx,
+                         const IndexType localIdx )
+   {
+      const IndexType& sliceIndex = segmentsToSlicesMapping[ segmentIdx ];
+      IndexType firstChunkOfSegment( 0 );
+      if( segmentIdx != slices[ sliceIndex ].firstSegment )
+         firstChunkOfSegment = segmentsToChunksMapping[ segmentIdx - 1 ];
 
-         //const IndexType lastChunkOfSegment = segmentsToChunksMapping[ segmentIdx ];
-         //const IndexType segmentChunksCount = lastChunkOfSegment - firstChunkOfSegment;
-         const IndexType sliceOffset = slices[ sliceIndex ].pointer;
-         const IndexType chunkSize = slices[ sliceIndex ].chunkSize;
-         //TNL_ASSERT_LE( localIdx, segmentChunksCount * chunkSize, "" );
-         TNL_ASSERT_LE( localIdx, ( segmentsToChunksMapping[ segmentIdx ] - firstChunkOfSegment ) * chunkSize, "" );
+      // const IndexType lastChunkOfSegment = segmentsToChunksMapping[ segmentIdx ];
+      // const IndexType segmentChunksCount = lastChunkOfSegment - firstChunkOfSegment;
+      const IndexType sliceOffset = slices[ sliceIndex ].pointer;
+      const IndexType chunkSize = slices[ sliceIndex ].chunkSize;
+      // TNL_ASSERT_LE( localIdx, segmentChunksCount * chunkSize, "" );
+      TNL_ASSERT_LE( localIdx, ( segmentsToChunksMapping[ segmentIdx ] - firstChunkOfSegment ) * chunkSize, "" );
 
-         if( Organization == RowMajorOrder )
-            return sliceOffset + firstChunkOfSegment * chunkSize + localIdx;
-         else
-         {
-            const IndexType inChunkOffset = localIdx % chunkSize;
-            const IndexType chunkIdx = localIdx / chunkSize;
-            return sliceOffset + inChunkOffset * chunksInSlice + firstChunkOfSegment + chunkIdx;
-         }
+      if( Organization == RowMajorOrder )
+         return sliceOffset + firstChunkOfSegment * chunkSize + localIdx;
+      else {
+         const IndexType inChunkOffset = localIdx % chunkSize;
+         const IndexType chunkIdx = localIdx / chunkSize;
+         return sliceOffset + inChunkOffset * chunksInSlice + firstChunkOfSegment + chunkIdx;
       }
+   }
 
-      static
-      IndexType getGlobalIndex( const OffsetsHolderView& segmentsToSlicesMapping,
-                                const ChunkedEllpackSliceInfoContainerView& slices,
-                                const OffsetsHolderView& segmentsToChunksMapping,
-                                const IndexType chunksInSlice,
-                                const IndexType segmentIdx,
-                                const IndexType localIdx )
-      {
-         const IndexType& sliceIndex = segmentsToSlicesMapping.getElement( segmentIdx );
-         IndexType firstChunkOfSegment( 0 );
-         if( segmentIdx != slices.getElement( sliceIndex ).firstSegment )
-            firstChunkOfSegment = segmentsToChunksMapping.getElement( segmentIdx - 1 );
+   static IndexType
+   getGlobalIndex( const OffsetsHolderView& segmentsToSlicesMapping,
+                   const ChunkedEllpackSliceInfoContainerView& slices,
+                   const OffsetsHolderView& segmentsToChunksMapping,
+                   const IndexType chunksInSlice,
+                   const IndexType segmentIdx,
+                   const IndexType localIdx )
+   {
+      const IndexType& sliceIndex = segmentsToSlicesMapping.getElement( segmentIdx );
+      IndexType firstChunkOfSegment( 0 );
+      if( segmentIdx != slices.getElement( sliceIndex ).firstSegment )
+         firstChunkOfSegment = segmentsToChunksMapping.getElement( segmentIdx - 1 );
 
-         //const IndexType lastChunkOfSegment = segmentsToChunksMapping.getElement( segmentIdx );
-         //const IndexType segmentChunksCount = lastChunkOfSegment - firstChunkOfSegment;
-         const IndexType sliceOffset = slices.getElement( sliceIndex ).pointer;
-         const IndexType chunkSize = slices.getElement( sliceIndex ).chunkSize;
-         //TNL_ASSERT_LE( localIdx, segmentChunksCount * chunkSize, "" );
-         TNL_ASSERT_LE( localIdx, ( segmentsToChunksMapping.getElement( segmentIdx ) - firstChunkOfSegment ) * chunkSize, "" );
+      // const IndexType lastChunkOfSegment = segmentsToChunksMapping.getElement( segmentIdx );
+      // const IndexType segmentChunksCount = lastChunkOfSegment - firstChunkOfSegment;
+      const IndexType sliceOffset = slices.getElement( sliceIndex ).pointer;
+      const IndexType chunkSize = slices.getElement( sliceIndex ).chunkSize;
+      // TNL_ASSERT_LE( localIdx, segmentChunksCount * chunkSize, "" );
+      TNL_ASSERT_LE( localIdx, ( segmentsToChunksMapping.getElement( segmentIdx ) - firstChunkOfSegment ) * chunkSize, "" );
 
-         if( Organization == RowMajorOrder )
-            return sliceOffset + firstChunkOfSegment * chunkSize + localIdx;
-         else
-         {
-            const IndexType inChunkOffset = localIdx % chunkSize;
-            const IndexType chunkIdx = localIdx / chunkSize;
-            return sliceOffset + inChunkOffset * chunksInSlice + firstChunkOfSegment + chunkIdx;
-         }
+      if( Organization == RowMajorOrder )
+         return sliceOffset + firstChunkOfSegment * chunkSize + localIdx;
+      else {
+         const IndexType inChunkOffset = localIdx % chunkSize;
+         const IndexType chunkIdx = localIdx / chunkSize;
+         return sliceOffset + inChunkOffset * chunksInSlice + firstChunkOfSegment + chunkIdx;
       }
+   }
 
-      static __cuda_callable__
-      SegmentViewType getSegmentViewDirect( const OffsetsHolderView& segmentsToSlicesMapping,
-                                            const ChunkedEllpackSliceInfoContainerView& slices,
-                                            const OffsetsHolderView& segmentsToChunksMapping,
-                                            const IndexType& chunksInSlice,
-                                            const IndexType& segmentIdx )
-      {
-         const IndexType& sliceIndex = segmentsToSlicesMapping[ segmentIdx ];
-         IndexType firstChunkOfSegment( 0 );
-         if( segmentIdx != slices[ sliceIndex ].firstSegment )
-            firstChunkOfSegment = segmentsToChunksMapping[ segmentIdx - 1 ];
+   static __cuda_callable__
+   SegmentViewType
+   getSegmentViewDirect( const OffsetsHolderView& segmentsToSlicesMapping,
+                         const ChunkedEllpackSliceInfoContainerView& slices,
+                         const OffsetsHolderView& segmentsToChunksMapping,
+                         const IndexType& chunksInSlice,
+                         const IndexType& segmentIdx )
+   {
+      const IndexType& sliceIndex = segmentsToSlicesMapping[ segmentIdx ];
+      IndexType firstChunkOfSegment( 0 );
+      if( segmentIdx != slices[ sliceIndex ].firstSegment )
+         firstChunkOfSegment = segmentsToChunksMapping[ segmentIdx - 1 ];
 
-         const IndexType lastChunkOfSegment = segmentsToChunksMapping[ segmentIdx ];
-         const IndexType segmentChunksCount = lastChunkOfSegment - firstChunkOfSegment;
-         const IndexType sliceOffset = slices[ sliceIndex ].pointer;
-         const IndexType chunkSize = slices[ sliceIndex ].chunkSize;
-         const IndexType segmentSize = segmentChunksCount * chunkSize;
+      const IndexType lastChunkOfSegment = segmentsToChunksMapping[ segmentIdx ];
+      const IndexType segmentChunksCount = lastChunkOfSegment - firstChunkOfSegment;
+      const IndexType sliceOffset = slices[ sliceIndex ].pointer;
+      const IndexType chunkSize = slices[ sliceIndex ].chunkSize;
+      const IndexType segmentSize = segmentChunksCount * chunkSize;
 
-         if( Organization == RowMajorOrder )
-            return SegmentViewType( segmentIdx,
-                                    sliceOffset + firstChunkOfSegment * chunkSize,
-                                    segmentSize,
-                                    chunkSize,
-                                    chunksInSlice );
-         else
-            return SegmentViewType( segmentIdx,
-                                    sliceOffset + firstChunkOfSegment,
-                                    segmentSize,
-                                    chunkSize,
-                                    chunksInSlice );
-      }
+      if( Organization == RowMajorOrder )
+         return SegmentViewType(
+            segmentIdx, sliceOffset + firstChunkOfSegment * chunkSize, segmentSize, chunkSize, chunksInSlice );
+      else
+         return SegmentViewType( segmentIdx, sliceOffset + firstChunkOfSegment, segmentSize, chunkSize, chunksInSlice );
+   }
 
-      static __cuda_callable__
-      SegmentViewType getSegmentView( const OffsetsHolderView& segmentsToSlicesMapping,
-                                      const ChunkedEllpackSliceInfoContainerView& slices,
-                                      const OffsetsHolderView& segmentsToChunksMapping,
-                                      const IndexType chunksInSlice,
-                                      const IndexType segmentIdx )
-      {
-         const IndexType& sliceIndex = segmentsToSlicesMapping.getElement( segmentIdx );
-         IndexType firstChunkOfSegment( 0 );
-         if( segmentIdx != slices.getElement( sliceIndex ).firstSegment )
-            firstChunkOfSegment = segmentsToChunksMapping.getElement( segmentIdx - 1 );
+   static __cuda_callable__
+   SegmentViewType
+   getSegmentView( const OffsetsHolderView& segmentsToSlicesMapping,
+                   const ChunkedEllpackSliceInfoContainerView& slices,
+                   const OffsetsHolderView& segmentsToChunksMapping,
+                   const IndexType chunksInSlice,
+                   const IndexType segmentIdx )
+   {
+      const IndexType& sliceIndex = segmentsToSlicesMapping.getElement( segmentIdx );
+      IndexType firstChunkOfSegment( 0 );
+      if( segmentIdx != slices.getElement( sliceIndex ).firstSegment )
+         firstChunkOfSegment = segmentsToChunksMapping.getElement( segmentIdx - 1 );
 
-         const IndexType lastChunkOfSegment = segmentsToChunksMapping.getElement( segmentIdx );
-         const IndexType segmentChunksCount = lastChunkOfSegment - firstChunkOfSegment;
-         const IndexType sliceOffset = slices.getElement( sliceIndex ).pointer;
-         const IndexType chunkSize = slices.getElement( sliceIndex ).chunkSize;
-         const IndexType segmentSize = segmentChunksCount * chunkSize;
+      const IndexType lastChunkOfSegment = segmentsToChunksMapping.getElement( segmentIdx );
+      const IndexType segmentChunksCount = lastChunkOfSegment - firstChunkOfSegment;
+      const IndexType sliceOffset = slices.getElement( sliceIndex ).pointer;
+      const IndexType chunkSize = slices.getElement( sliceIndex ).chunkSize;
+      const IndexType segmentSize = segmentChunksCount * chunkSize;
 
-         if( Organization == RowMajorOrder )
-            return SegmentViewType( segmentIdx,
-                                    sliceOffset + firstChunkOfSegment * chunkSize,
-                                    segmentSize,
-                                    chunkSize,
-                                    chunksInSlice );
-         else
-            return SegmentViewType( segmentIdx,
-                                    sliceOffset + firstChunkOfSegment,
-                                    segmentSize,
-                                    chunkSize,
-                                    chunksInSlice );
-      }
+      if( Organization == RowMajorOrder )
+         return SegmentViewType(
+            segmentIdx, sliceOffset + firstChunkOfSegment * chunkSize, segmentSize, chunkSize, chunksInSlice );
+      else
+         return SegmentViewType( segmentIdx, sliceOffset + firstChunkOfSegment, segmentSize, chunkSize, chunksInSlice );
+   }
 };
 
 #ifdef HAVE_CUDA
-template< typename Index,
-          typename Fetch,
-          bool HasAllParameters = detail::CheckFetchLambda< Index, Fetch >::hasAllParameters() >
-struct ChunkedEllpackreduceSegmentsDispatcher{};
+template< typename Index, typename Fetch, bool HasAllParameters = detail::CheckFetchLambda< Index, Fetch >::hasAllParameters() >
+struct ChunkedEllpackreduceSegmentsDispatcher
+{};
 
 template< typename Index, typename Fetch >
 struct ChunkedEllpackreduceSegmentsDispatcher< Index, Fetch, true >
 {
-   template< typename View,
-             typename Reduction,
-             typename ResultKeeper,
-             typename Real,
-             typename... Args >
+   template< typename View, typename Reduction, typename ResultKeeper, typename Real, typename... Args >
    __device__
-   static void exec( View chunkedEllpack,
-                     Index gridIdx,
-                     Index first,
-                     Index last,
-                     Fetch fetch,
-                     Reduction reduction,
-                     ResultKeeper keeper,
-                     Real zero,
-                     Args... args )
+   static void
+   exec( View chunkedEllpack,
+         Index gridIdx,
+         Index first,
+         Index last,
+         Fetch fetch,
+         Reduction reduction,
+         ResultKeeper keeper,
+         Real zero,
+         Args... args )
    {
       chunkedEllpack.reduceSegmentsKernelWithAllParameters( gridIdx, first, last, fetch, reduction, keeper, zero, args... );
    }
@@ -258,21 +245,18 @@ struct ChunkedEllpackreduceSegmentsDispatcher< Index, Fetch, true >
 template< typename Index, typename Fetch >
 struct ChunkedEllpackreduceSegmentsDispatcher< Index, Fetch, false >
 {
-   template< typename View,
-             typename Reduction,
-             typename ResultKeeper,
-             typename Real,
-             typename... Args >
+   template< typename View, typename Reduction, typename ResultKeeper, typename Real, typename... Args >
    __device__
-   static void exec( View chunkedEllpack,
-                     Index gridIdx,
-                     Index first,
-                     Index last,
-                     Fetch fetch,
-                     Reduction reduction,
-                     ResultKeeper keeper,
-                     Real zero,
-                     Args... args )
+   static void
+   exec( View chunkedEllpack,
+         Index gridIdx,
+         Index first,
+         Index last,
+         Fetch fetch,
+         Reduction reduction,
+         ResultKeeper keeper,
+         Real zero,
+         Args... args )
    {
       chunkedEllpack.reduceSegmentsKernel( gridIdx, first, last, fetch, reduction, keeper, zero, args... );
    }
@@ -286,21 +270,23 @@ template< typename View,
           typename Real,
           typename... Args >
 __global__
-void ChunkedEllpackreduceSegmentsKernel( View chunkedEllpack,
-                                            Index gridIdx,
-                                            Index first,
-                                            Index last,
-                                            Fetch fetch,
-                                            Reduction reduction,
-                                            ResultKeeper keeper,
-                                            Real zero,
-                                            Args... args )
+void
+ChunkedEllpackreduceSegmentsKernel( View chunkedEllpack,
+                                    Index gridIdx,
+                                    Index first,
+                                    Index last,
+                                    Fetch fetch,
+                                    Reduction reduction,
+                                    ResultKeeper keeper,
+                                    Real zero,
+                                    Args... args )
 {
-   ChunkedEllpackreduceSegmentsDispatcher< Index, Fetch >::exec( chunkedEllpack, gridIdx, first, last, fetch, reduction, keeper, zero, args... );
+   ChunkedEllpackreduceSegmentsDispatcher< Index, Fetch >::exec(
+      chunkedEllpack, gridIdx, first, last, fetch, reduction, keeper, zero, args... );
 }
 #endif
 
-         } //namespace detail
-      } //namespace Segments
-   } //namespace Algorithms
-} //namepsace TNL
+}  // namespace detail
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Segments/detail/LambdaAdapter.h b/src/TNL/Algorithms/Segments/detail/LambdaAdapter.h
index 48f989afb128f305699cc280752c57f62469df0e..7f50455599af25b16798f59c2c4c9f461974bd72 100644
--- a/src/TNL/Algorithms/Segments/detail/LambdaAdapter.h
+++ b/src/TNL/Algorithms/Segments/detail/LambdaAdapter.h
@@ -9,44 +9,41 @@
 #include "CheckLambdas.h"
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Segments {
-         namespace detail {
+namespace Algorithms {
+namespace Segments {
+namespace detail {
 
-template< typename Index,
-          typename Lambda,
-          bool AllParameters = CheckFetchLambda< Index, Lambda >::hasAllParameters() >
+template< typename Index, typename Lambda, bool AllParameters = CheckFetchLambda< Index, Lambda >::hasAllParameters() >
 struct FetchLambdaAdapter
-{
-};
+{};
 
-template< typename Index,
-          typename Lambda >
+template< typename Index, typename Lambda >
 struct FetchLambdaAdapter< Index, Lambda, true >
 {
    using ReturnType = decltype( std::declval< Lambda >()( Index(), Index(), Index(), std::declval< bool& >() ) );
 
    __cuda_callable__
-   static ReturnType call( Lambda& f, Index segmentIdx, Index localIdx, Index globalIdx, bool& compute )
+   static ReturnType
+   call( Lambda& f, Index segmentIdx, Index localIdx, Index globalIdx, bool& compute )
    {
       return f( segmentIdx, localIdx, globalIdx, compute );
    }
 };
 
-template< typename Index,
-          typename Lambda >
+template< typename Index, typename Lambda >
 struct FetchLambdaAdapter< Index, Lambda, false >
 {
    using ReturnType = decltype( std::declval< Lambda >()( Index(), std::declval< bool& >() ) );
 
    __cuda_callable__
-   static ReturnType call( Lambda& f, Index segmentIdx, Index localIdx, Index globalIdx, bool& compute )
+   static ReturnType
+   call( Lambda& f, Index segmentIdx, Index localIdx, Index globalIdx, bool& compute )
    {
       return f( globalIdx, compute );
    }
 };
 
-         } // namespace detail
-      } // namespace Segments
-   }  // namespace Algorithms
-} // namespace TNL
+}  // namespace detail
+}  // namespace Segments
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/SequentialFor.h b/src/TNL/Algorithms/SequentialFor.h
index 86ad928093f16b830cc9c0a59aed160a10241c6e..ab3a58e40a9ebea2196e61576f5b80ba9960ae90 100644
--- a/src/TNL/Algorithms/SequentialFor.h
+++ b/src/TNL/Algorithms/SequentialFor.h
@@ -8,9 +8,8 @@
 
 #include <TNL/Algorithms/ParallelFor.h>
 
-
 namespace TNL {
-   namespace Algorithms {
+namespace Algorithms {
 
 /**
  * \brief Wrapper to ParallelFor which makes it run sequentially.
@@ -36,15 +35,14 @@ struct SequentialFor
     * \include SequentialForExample.out
     *
     */
-   template< typename Index,
-             typename Function >
-   static void exec( Index start, Index end, Function f )
+   template< typename Index, typename Function >
+   static void
+   exec( Index start, Index end, Function f )
    {
       for( Index i = start; i < end; i++ )
          ParallelFor< Device >::exec( i, i + 1, f );
    }
 };
 
-
-   } // namespace Algorithms
-} // namespace TNL
\ No newline at end of file
+}  // namespace Algorithms
+}  // namespace TNL
\ No newline at end of file
diff --git a/src/TNL/Algorithms/Sorting/BitonicSort.h b/src/TNL/Algorithms/Sorting/BitonicSort.h
index a6cd368d1add652d5cd6889868c880a9daea84ba..df3bda5283c413ecc34b505a6a5e7e9235ddc7a7 100644
--- a/src/TNL/Algorithms/Sorting/BitonicSort.h
+++ b/src/TNL/Algorithms/Sorting/BitonicSort.h
@@ -12,8 +12,8 @@
 #include <TNL/Exceptions/NotImplementedError.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Sorting {
+namespace Algorithms {
+namespace Sorting {
 
 struct BitonicSort
 {
@@ -39,6 +39,6 @@ struct BitonicSort
    }
 };
 
-      } // namespace Sorting
-   } // namespace Algorithms
-} //namespace TNL
+}  // namespace Sorting
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Sorting/BubbleSort.h b/src/TNL/Algorithms/Sorting/BubbleSort.h
index f6898b26f7217b6507fb85a417b18181bacbb863..022d32a1a9026482958111376a1464cc814c74d9 100644
--- a/src/TNL/Algorithms/Sorting/BubbleSort.h
+++ b/src/TNL/Algorithms/Sorting/BubbleSort.h
@@ -15,8 +15,8 @@
 #include <TNL/Exceptions/NotImplementedError.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Sorting {
+namespace Algorithms {
+namespace Sorting {
 
 struct BubbleSort
 {
@@ -28,33 +28,28 @@ struct BubbleSort
 
       Index left = begin;
       Index right = end - 1;
-      while( left < right )
-      {
-         //Index lastChange = end - 1;
-         for( Index j = left; j < right - 1; j++ )
-         {
-            TNL_ASSERT_LT( j+1, end, "" );
-            if( ! compare( j, j+1 ) )
-            {
-               swap( j, j+1 );
-               //lastChange = j;
+      while( left < right ) {
+         // Index lastChange = end - 1;
+         for( Index j = left; j < right - 1; j++ ) {
+            TNL_ASSERT_LT( j + 1, end, "" );
+            if( ! compare( j, j + 1 ) ) {
+               swap( j, j + 1 );
+               // lastChange = j;
             }
          }
-         right--; //lastChange;
-         for( Index j = right; j >= left; j-- )
-         {
-            TNL_ASSERT_LT( j+1, end, "" );
-            if( ! compare( j, j+1 ) )
-            {
-               swap( j, j+1 );
-               //lastChange = j;
+         right--;  // lastChange;
+         for( Index j = right; j >= left; j-- ) {
+            TNL_ASSERT_LT( j + 1, end, "" );
+            if( ! compare( j, j + 1 ) ) {
+               swap( j, j + 1 );
+               // lastChange = j;
             }
          }
-         left++; //lastChange;
+         left++;  // lastChange;
       }
    }
 };
 
-      } // namespace Sorting
-   } // namespace Algorithms
-} //namespace TNL
+}  // namespace Sorting
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Sorting/DefaultSorter.h b/src/TNL/Algorithms/Sorting/DefaultSorter.h
index eb797e33c0f7f768fa1b4d70dce1e7366500ada5..c4aff29448fb6304dec621d8219824a1928c0fb8 100644
--- a/src/TNL/Algorithms/Sorting/DefaultSorter.h
+++ b/src/TNL/Algorithms/Sorting/DefaultSorter.h
@@ -17,8 +17,8 @@
 #include <TNL/Algorithms/Sorting/STLSort.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Sorting {
+namespace Algorithms {
+namespace Sorting {
 
 template< typename Device >
 struct DefaultSorter;
@@ -62,6 +62,6 @@ struct DefaultInplaceSorter< Devices::Cuda >
    using SorterType = Algorithms::Sorting::BitonicSort;
 };
 
-      } // namespace Sorting
-   } // namespace Algorithms
-} // namespace TNL
+}  // namespace Sorting
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Sorting/Quicksort.h b/src/TNL/Algorithms/Sorting/Quicksort.h
index 58188ca4aebdbf18675937ccbf378f624bf33b52..a62ca485484bce78e778abf0364464b8db806456 100644
--- a/src/TNL/Algorithms/Sorting/Quicksort.h
+++ b/src/TNL/Algorithms/Sorting/Quicksort.h
@@ -11,8 +11,8 @@
 #include <TNL/Algorithms/Sorting/detail/Quicksorter.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Sorting {
+namespace Algorithms {
+namespace Sorting {
 
 struct Quicksort
 {
@@ -29,9 +29,8 @@ struct Quicksort
       Quicksorter< typename Array::ValueType, typename Array::DeviceType > qs;
       qs.sort( array, compare );
    }
-
 };
 
-      } // namespace Sorting
-   } // namespace Algorithms
-} //namespace TNL
+}  // namespace Sorting
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Sorting/STLSort.h b/src/TNL/Algorithms/Sorting/STLSort.h
index d9f15a724d252032a150b5652d9aa534f88118ef..4e6859ba4259239ef401bb5c330b73af3242e6fe 100644
--- a/src/TNL/Algorithms/Sorting/STLSort.h
+++ b/src/TNL/Algorithms/Sorting/STLSort.h
@@ -11,8 +11,8 @@
 #include <algorithm>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Sorting {
+namespace Algorithms {
+namespace Sorting {
 
 struct STLSort
 {
@@ -29,6 +29,6 @@ struct STLSort
    }
 };
 
-      } // namespace Sorting
-   } // namespace Algorithms
-} //namespace TNL
+}  // namespace Sorting
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Sorting/detail/Quicksorter.h b/src/TNL/Algorithms/Sorting/detail/Quicksorter.h
index e11b5618f0417099244c09de97e6258dadca9891..2dc9996972a494ed644662cd4f0e4f9d01c89298 100644
--- a/src/TNL/Algorithms/Sorting/detail/Quicksorter.h
+++ b/src/TNL/Algorithms/Sorting/detail/Quicksorter.h
@@ -12,8 +12,8 @@
 #include <TNL/Algorithms/Sorting/detail/task.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Sorting {
+namespace Algorithms {
+namespace Sorting {
 
 template< typename Value, typename Device >
 class Quicksorter;
@@ -21,85 +21,96 @@ class Quicksorter;
 template< typename Value >
 class Quicksorter< Value, Devices::Cuda >
 {
-   public:
-
-      using ValueType = Value;
-      using DeviceType = Devices::Cuda;
-
-
-      template< typename Array, typename Compare >
-      void sort( Array& arr, const Compare& cmp );
-
-      template< typename Array >
-      void sort( Array& arr );
-
-   protected:
-
-      void init( Containers::ArrayView<Value, Devices::Cuda> arr, int gridDim, int blockDim, int desiredElemPerBlock, int maxSharable);
-
-      template< typename CMP >
-         void performSort( const CMP &Cmp );
-
-
-      /**
-       * returns how many blocks are needed to start sort phase 1 if @param elemPerBlock were to be used
-       * */
-      int getSetsNeeded(int elemPerBlock) const;
-
-      /**
-       * returns the optimal amount of elements per thread needed for phase
-       * */
-      int getElemPerBlock() const;
-
-      /**
-       * returns the amount of blocks needed to start phase 1 while also initializing all tasks
-       * */
-      template< typename CMP >
-         int initTasks(int elemPerBlock, const CMP &Cmp);
-
-      /**
-       * does the 1st phase of Quicksort until out of task memory or each task is small enough
-       * for correctness, secondphase method needs to be called to sort each subsequences
-       * */
-      template <typename CMP>
-         void firstPhase(const CMP &Cmp);
-
-      /**
-       * update necessary variables after 1 phase1 sort
-       * */
-      void processNewTasks();
-
-      /**
-       * sorts all leftover tasks
-       * */
-      template <typename CMP>
-         void secondPhase( const CMP &Cmp) ;
-
-      int maxBlocks, threadsPerBlock, desiredElemPerBlock, maxSharable; //kernel config
-
-      Containers::Array<Value, Devices::Cuda> auxMem;
-      Containers::ArrayView<Value, Devices::Cuda> arr, aux;
-
-      int desired_2ndPhasElemPerBlock;
-      const int g_maxTasks = 1 << 14;
-      int maxTasks;
-
-
-      Containers::Array<TASK, Devices::Cuda> cuda_tasks, cuda_newTasks, cuda_2ndPhaseTasks; //1 set of 2 rotating tasks and 2nd phase
-      Containers::Array<int, Devices::Cuda> cuda_newTasksAmount, cuda_2ndPhaseTasksAmount;  //is in reality 1 integer each
-
-      Containers::Array<int, Devices::Cuda> cuda_blockToTaskMapping;
-      Containers::Array<int, Devices::Cuda> cuda_reductionTaskInitMem;
-
-      int host_1stPhaseTasksAmount = 0, host_2ndPhaseTasksAmount = 0;
-      int iteration = 0;
-
-      template< typename T >
-      friend int getSetsNeededFunction(int elemPerBlock, const Quicksorter< T, Devices::Cuda >& quicksort );
+public:
+   using ValueType = Value;
+   using DeviceType = Devices::Cuda;
+
+   template< typename Array, typename Compare >
+   void
+   sort( Array& arr, const Compare& cmp );
+
+   template< typename Array >
+   void
+   sort( Array& arr );
+
+protected:
+   void
+   init( Containers::ArrayView< Value, Devices::Cuda > arr,
+         int gridDim,
+         int blockDim,
+         int desiredElemPerBlock,
+         int maxSharable );
+
+   template< typename CMP >
+   void
+   performSort( const CMP& Cmp );
+
+   /**
+    * returns how many blocks are needed to start sort phase 1 if @param elemPerBlock were to be used
+    * */
+   int
+   getSetsNeeded( int elemPerBlock ) const;
+
+   /**
+    * returns the optimal amount of elements per thread needed for phase
+    * */
+   int
+   getElemPerBlock() const;
+
+   /**
+    * returns the amount of blocks needed to start phase 1 while also initializing all tasks
+    * */
+   template< typename CMP >
+   int
+   initTasks( int elemPerBlock, const CMP& Cmp );
+
+   /**
+    * does the 1st phase of Quicksort until out of task memory or each task is small enough
+    * for correctness, secondphase method needs to be called to sort each subsequences
+    * */
+   template< typename CMP >
+   void
+   firstPhase( const CMP& Cmp );
+
+   /**
+    * update necessary variables after 1 phase1 sort
+    * */
+   void
+   processNewTasks();
+
+   /**
+    * sorts all leftover tasks
+    * */
+   template< typename CMP >
+   void
+   secondPhase( const CMP& Cmp );
+
+   int maxBlocks, threadsPerBlock, desiredElemPerBlock, maxSharable;  // kernel config
+
+   Containers::Array< Value, Devices::Cuda > auxMem;
+   Containers::ArrayView< Value, Devices::Cuda > arr, aux;
+
+   int desired_2ndPhasElemPerBlock;
+   const int g_maxTasks = 1 << 14;
+   int maxTasks;
+
+   Containers::Array< TASK, Devices::Cuda > cuda_tasks, cuda_newTasks,
+      cuda_2ndPhaseTasks;  // 1 set of 2 rotating tasks and 2nd phase
+   Containers::Array< int, Devices::Cuda > cuda_newTasksAmount, cuda_2ndPhaseTasksAmount;  // is in reality 1 integer each
+
+   Containers::Array< int, Devices::Cuda > cuda_blockToTaskMapping;
+   Containers::Array< int, Devices::Cuda > cuda_reductionTaskInitMem;
+
+   int host_1stPhaseTasksAmount = 0, host_2ndPhaseTasksAmount = 0;
+   int iteration = 0;
+
+   template< typename T >
+   friend int
+   getSetsNeededFunction( int elemPerBlock, const Quicksorter< T, Devices::Cuda >& quicksort );
 };
 
-        } // namespace Sorting
-    } // namespace Algorithms
-} // namespace TNL
+}  // namespace Sorting
+}  // namespace Algorithms
+}  // namespace TNL
 
 #include <TNL/Algorithms/Sorting/detail/Quicksorter.hpp>
diff --git a/src/TNL/Algorithms/Sorting/detail/Quicksorter.hpp b/src/TNL/Algorithms/Sorting/detail/Quicksorter.hpp
index 677c8a89fa938f050bf446d2112876e39c2a9396..14ef504f469ec8a4fcedff78cd98855e7f8a4446 100644
--- a/src/TNL/Algorithms/Sorting/detail/Quicksorter.hpp
+++ b/src/TNL/Algorithms/Sorting/detail/Quicksorter.hpp
@@ -17,75 +17,80 @@
 #include <TNL/Algorithms/scan.h>
 
 namespace TNL {
-    namespace Algorithms {
-        namespace Sorting {
+namespace Algorithms {
+namespace Sorting {
 
 template< typename Value >
-   template< typename Array, typename Compare >
+template< typename Array, typename Compare >
 void
-Quicksorter< Value, Devices::Cuda >::
-sort( Array& arr, const Compare& cmp )
+Quicksorter< Value, Devices::Cuda >::sort( Array& arr, const Compare& cmp )
 {
 #ifdef HAVE_CUDA
-    cudaDeviceProp deviceProp;
-    cudaGetDeviceProperties(&deviceProp, 0);
-
-    /**
-     * for every block there is a bit of shared memory reserved, the actual value can slightly differ
-     * */
-    int sharedReserve = sizeof(int) * (16 + 3 * 32);
-    int maxSharable = deviceProp.sharedMemPerBlock - sharedReserve;
-
-    int blockDim = 512; //best case
-
-    /**
-     * the goal is to use shared memory as often as possible
-     * each thread in a block will process n elements, n==multiplier
-     * + 1 reserved for pivot (statically allocating Value type throws weird error, hence it needs to be dynamic)
-     *
-     * blockDim*multiplier*sizeof(Value) + 1*sizeof(Value) <= maxSharable
-     * */
-    int elemPerBlock = (maxSharable - sizeof(Value)) / sizeof(Value); //try to use up all of shared memory to store elements
-    const int maxBlocks = (1 << 20);
-    const int maxMultiplier = 8;
-    int multiplier = min(elemPerBlock / blockDim, maxMultiplier);
-
-    if (multiplier <= 0) //a block cant store 512 elements, sorting some really big data
-    {
-        blockDim = 256; //try to fit 256 elements
-        multiplier = min(elemPerBlock / blockDim, maxMultiplier);
-
-        if (multiplier <= 0)
-        {
-            //worst case scenario, shared memory cant be utilized at all because of the sheer size of Value
-            //sort has to be done with the use of global memory alone
-
-            this->init(arr, maxBlocks, 512, 0, 0);
-            this->performSort( cmp );
-            return;
-        }
-    }
-
-    TNL_ASSERT_LE( ( int ) ( blockDim * multiplier * sizeof(Value) ), maxSharable,"" );
-
-    this->init(arr, maxBlocks, blockDim, multiplier * blockDim, maxSharable);
-    this->performSort( cmp );
+   cudaDeviceProp deviceProp;
+   cudaGetDeviceProperties( &deviceProp, 0 );
+
+   /**
+    * for every block there is a bit of shared memory reserved, the actual value can slightly differ
+    * */
+   int sharedReserve = sizeof( int ) * ( 16 + 3 * 32 );
+   int maxSharable = deviceProp.sharedMemPerBlock - sharedReserve;
+
+   int blockDim = 512;  // best case
+
+   /**
+    * the goal is to use shared memory as often as possible
+    * each thread in a block will process n elements, n==multiplier
+    * + 1 reserved for pivot (statically allocating Value type throws weird error, hence it needs to be dynamic)
+    *
+    * blockDim*multiplier*sizeof(Value) + 1*sizeof(Value) <= maxSharable
+    * */
+   int elemPerBlock =
+      ( maxSharable - sizeof( Value ) ) / sizeof( Value );  // try to use up all of shared memory to store elements
+   const int maxBlocks = ( 1 << 20 );
+   const int maxMultiplier = 8;
+   int multiplier = min( elemPerBlock / blockDim, maxMultiplier );
+
+   if( multiplier <= 0 )  // a block cant store 512 elements, sorting some really big data
+   {
+      blockDim = 256;  // try to fit 256 elements
+      multiplier = min( elemPerBlock / blockDim, maxMultiplier );
+
+      if( multiplier <= 0 ) {
+         // worst case scenario, shared memory cant be utilized at all because of the sheer size of Value
+         // sort has to be done with the use of global memory alone
+
+         this->init( arr, maxBlocks, 512, 0, 0 );
+         this->performSort( cmp );
+         return;
+      }
+   }
+
+   TNL_ASSERT_LE( (int) ( blockDim * multiplier * sizeof( Value ) ), maxSharable, "" );
+
+   this->init( arr, maxBlocks, blockDim, multiplier * blockDim, maxSharable );
+   this->performSort( cmp );
 #endif
 }
 
 template< typename Value >
-   template< typename Array >
+template< typename Array >
 void
-Quicksorter< Value, Devices::Cuda >::
-sort( Array& arr )
+Quicksorter< Value, Devices::Cuda >::sort( Array& arr )
 {
-   this->sort(arr, [] __cuda_callable__( const Value& a, const Value& b ) { return a < b; } );
+   this->sort( arr,
+               [] __cuda_callable__( const Value& a, const Value& b )
+               {
+                  return a < b;
+               } );
 }
 
 template< typename Value >
 void
-Quicksorter< Value, Devices::Cuda >::
-init( Containers::ArrayView<Value, Devices::Cuda> arr, int gridDim, int blockDim, int desiredElemPerBlock, int maxSharable)
+Quicksorter< Value, Devices::Cuda >::init( Containers::ArrayView< Value, Devices::Cuda > arr,
+                                           int gridDim,
+                                           int blockDim,
+                                           int desiredElemPerBlock,
+                                           int maxSharable )
 {
    this->maxBlocks = gridDim;
    this->threadsPerBlock = blockDim;
@@ -96,22 +101,20 @@ init( Containers::ArrayView<Value, Devices::Cuda> arr, int gridDim, int blockDim
    this->aux.bind( auxMem.getView() );
    this->desired_2ndPhasElemPerBlock = desiredElemPerBlock;
    this->maxTasks = min( arr.getSize(), g_maxTasks );
-   this->cuda_tasks.setSize(maxTasks);
-   this->cuda_newTasks.setSize(maxTasks);
-   this->cuda_2ndPhaseTasks.setSize(maxTasks);
-   this->cuda_newTasksAmount.setSize(1);
-   this->cuda_2ndPhaseTasksAmount.setSize(1);
-   this->cuda_blockToTaskMapping.setSize(maxBlocks);
-   this->cuda_reductionTaskInitMem.setSize(maxTasks);
-
-   if (arr.getSize() > desired_2ndPhasElemPerBlock)
-   {
-      cuda_tasks.setElement(0, TASK(0, arr.getSize(), 0));
+   this->cuda_tasks.setSize( maxTasks );
+   this->cuda_newTasks.setSize( maxTasks );
+   this->cuda_2ndPhaseTasks.setSize( maxTasks );
+   this->cuda_newTasksAmount.setSize( 1 );
+   this->cuda_2ndPhaseTasksAmount.setSize( 1 );
+   this->cuda_blockToTaskMapping.setSize( maxBlocks );
+   this->cuda_reductionTaskInitMem.setSize( maxTasks );
+
+   if( arr.getSize() > desired_2ndPhasElemPerBlock ) {
+      cuda_tasks.setElement( 0, TASK( 0, arr.getSize(), 0 ) );
       host_1stPhaseTasksAmount = 1;
    }
-   else
-   {
-      cuda_2ndPhaseTasks.setElement(0, TASK(0, arr.getSize(), 0));
+   else {
+      cuda_2ndPhaseTasks.setElement( 0, TASK( 0, arr.getSize(), 0 ) );
       host_2ndPhaseTasksAmount = 1;
    }
 
@@ -119,280 +122,270 @@ init( Containers::ArrayView<Value, Devices::Cuda> arr, int gridDim, int blockDim
    TNL_CHECK_CUDA_DEVICE;
 }
 
-
 template< typename Value >
-   template< typename CMP >
+template< typename CMP >
 void
-Quicksorter< Value, Devices::Cuda >::
-performSort( const CMP &Cmp )
+Quicksorter< Value, Devices::Cuda >::performSort( const CMP& Cmp )
 {
 #ifdef HAVE_CUDA
-    firstPhase(Cmp);
-
-    int total2ndPhase = host_1stPhaseTasksAmount + host_2ndPhaseTasksAmount;
-    if (total2ndPhase > 0)
-        secondPhase(Cmp);
-
-    cudaDeviceSynchronize();
-    TNL_CHECK_CUDA_DEVICE;
-
-#ifdef CHECK_RESULT_SORT
-    if (!is_sorted(arr))
-    {
-        std::ofstream out("error.txt");
-        out << arr << std::endl;
-        out << aux << std::endl;
-        out << cuda_tasks << std::endl;
-        out << cuda_newTasks << std::endl;
-        out << cuda_2ndPhaseTasks << std::endl;
-
-        out << cuda_newTasksAmount << std::endl;
-        out << cuda_2ndPhaseTasksAmount << std::endl;
-
-        out << iteration << std::endl;
-    }
-#endif
+   firstPhase( Cmp );
+
+   int total2ndPhase = host_1stPhaseTasksAmount + host_2ndPhaseTasksAmount;
+   if( total2ndPhase > 0 )
+      secondPhase( Cmp );
+
+   cudaDeviceSynchronize();
+   TNL_CHECK_CUDA_DEVICE;
+
+   #ifdef CHECK_RESULT_SORT
+   if( ! is_sorted( arr ) ) {
+      std::ofstream out( "error.txt" );
+      out << arr << std::endl;
+      out << aux << std::endl;
+      out << cuda_tasks << std::endl;
+      out << cuda_newTasks << std::endl;
+      out << cuda_2ndPhaseTasks << std::endl;
+
+      out << cuda_newTasksAmount << std::endl;
+      out << cuda_2ndPhaseTasksAmount << std::endl;
+
+      out << iteration << std::endl;
+   }
+   #endif
 #endif
 }
 
 template< typename Value >
-   template< typename CMP >
+template< typename CMP >
 void
-Quicksorter< Value, Devices::Cuda >::
-firstPhase( const CMP &Cmp )
+Quicksorter< Value, Devices::Cuda >::firstPhase( const CMP& Cmp )
 {
 #ifdef HAVE_CUDA
-    while (host_1stPhaseTasksAmount > 0)
-    {
-        if (host_1stPhaseTasksAmount >= maxTasks)
-            break;
-
-        if (host_2ndPhaseTasksAmount >= maxTasks) //2nd phase occupies enoughs tasks to warrant premature 2nd phase sort
-        {
+   while( host_1stPhaseTasksAmount > 0 ) {
+      if( host_1stPhaseTasksAmount >= maxTasks )
+         break;
+
+      if( host_2ndPhaseTasksAmount >= maxTasks )  // 2nd phase occupies enoughs tasks to warrant premature 2nd phase sort
+      {
+         int tmp = host_1stPhaseTasksAmount;
+         host_1stPhaseTasksAmount = 0;
+         secondPhase( Cmp );
+         cuda_2ndPhaseTasksAmount = host_2ndPhaseTasksAmount = 0;
+         host_1stPhaseTasksAmount = tmp;
+      }
+
+      // just in case newly created tasks wouldnt fit
+      // bite the bullet and sort with single blocks
+      if( host_1stPhaseTasksAmount * 2 >= maxTasks + ( maxTasks - host_2ndPhaseTasksAmount ) ) {
+         if( host_2ndPhaseTasksAmount
+             >= 0.75 * maxTasks )  // 2nd phase occupies enoughs tasks to warrant premature 2nd phase sort
+         {
             int tmp = host_1stPhaseTasksAmount;
             host_1stPhaseTasksAmount = 0;
-            secondPhase(Cmp);
+            secondPhase( Cmp );
             cuda_2ndPhaseTasksAmount = host_2ndPhaseTasksAmount = 0;
             host_1stPhaseTasksAmount = tmp;
-        }
-
-        //just in case newly created tasks wouldnt fit
-        //bite the bullet and sort with single blocks
-        if (host_1stPhaseTasksAmount * 2 >= maxTasks + (maxTasks - host_2ndPhaseTasksAmount))
-        {
-            if (host_2ndPhaseTasksAmount >= 0.75 * maxTasks) //2nd phase occupies enoughs tasks to warrant premature 2nd phase sort
-            {
-                int tmp = host_1stPhaseTasksAmount;
-                host_1stPhaseTasksAmount = 0;
-                secondPhase(Cmp);
-                cuda_2ndPhaseTasksAmount = host_2ndPhaseTasksAmount = 0;
-                host_1stPhaseTasksAmount = tmp;
-            }
-            else
-                break;
-        }
-
-        //---------------------------------------------------------------
-
-        int elemPerBlock = getElemPerBlock();
-
-        /**
-         * initializes tasks so that each block knows which task to work on and which part of array to split
-         * also sets pivot needed for partitioning, this is why Cmp is needed
-         * */
-        int blocksCnt = initTasks(elemPerBlock, Cmp);
-        TNL_CHECK_CUDA_DEVICE;
-
-        //not enough or too many blocks needed, switch to 2nd phase
-        if (blocksCnt <= 1 || blocksCnt > cuda_blockToTaskMapping.getSize())
+         }
+         else
             break;
-
-        //-----------------------------------------------
-        //do the partitioning
-
-        auto &task = iteration % 2 == 0 ? cuda_tasks : cuda_newTasks;
-        int externMemByteSize = elemPerBlock * sizeof(Value) + sizeof(Value); //elems + 1 for pivot
-
-        /**
-         * check if partition procedure can use shared memory for coalesced write after reordering
-         *
-         * move elements smaller than pivot to the left and bigger to the right
-         * note: pivot isnt inserted in the middle yet
-         * */
-        if (externMemByteSize <= maxSharable)
-        {
-            cudaQuickSort1stPhase<Value, CMP, true>
-                <<<blocksCnt, threadsPerBlock, externMemByteSize>>>(
-                    arr, aux, Cmp, elemPerBlock,
-                    task, cuda_blockToTaskMapping);
-        }
-        else
-        {
-            cudaQuickSort1stPhase<Value, CMP, false>
-                <<<blocksCnt, threadsPerBlock, sizeof(Value)>>>(
-                    arr, aux, Cmp, elemPerBlock,
-                    task, cuda_blockToTaskMapping);
-        }
-        TNL_CHECK_CUDA_DEVICE;
-
-        /**
-         * fill in the gap between smaller and bigger with elements == pivot
-         * after writing also create new tasks, each task generates at max 2 tasks
-         *
-         * tasks smaller than desired_2ndPhasElemPerBlock go into 2nd phase
-         * bigger need more blocks to partition and are written into newTask
-         * with iteration %2, rotate between the 2 tasks array to save from copying
-         * */
-        auto &newTask = iteration % 2 == 0 ? cuda_newTasks : cuda_tasks;
-        cudaWritePivot<Value>
-            <<<host_1stPhaseTasksAmount, threadsPerBlock, sizeof(Value)>>>(
-                arr, aux, desired_2ndPhasElemPerBlock,
-                task, newTask, cuda_newTasksAmount.getData(),
-                cuda_2ndPhaseTasks, cuda_2ndPhaseTasksAmount.getData());
-        TNL_CHECK_CUDA_DEVICE;
-
-        //----------------------------------------
-
-        processNewTasks();
-        iteration++;
-    }
+      }
+
+      //---------------------------------------------------------------
+
+      int elemPerBlock = getElemPerBlock();
+
+      /**
+       * initializes tasks so that each block knows which task to work on and which part of array to split
+       * also sets pivot needed for partitioning, this is why Cmp is needed
+       * */
+      int blocksCnt = initTasks( elemPerBlock, Cmp );
+      TNL_CHECK_CUDA_DEVICE;
+
+      // not enough or too many blocks needed, switch to 2nd phase
+      if( blocksCnt <= 1 || blocksCnt > cuda_blockToTaskMapping.getSize() )
+         break;
+
+      //-----------------------------------------------
+      // do the partitioning
+
+      auto& task = iteration % 2 == 0 ? cuda_tasks : cuda_newTasks;
+      int externMemByteSize = elemPerBlock * sizeof( Value ) + sizeof( Value );  // elems + 1 for pivot
+
+      /**
+       * check if partition procedure can use shared memory for coalesced write after reordering
+       *
+       * move elements smaller than pivot to the left and bigger to the right
+       * note: pivot isnt inserted in the middle yet
+       * */
+      if( externMemByteSize <= maxSharable ) {
+         cudaQuickSort1stPhase< Value, CMP, true > <<<blocksCnt, threadsPerBlock,
+            externMemByteSize>>>( arr, aux, Cmp, elemPerBlock, task, cuda_blockToTaskMapping );
+      }
+      else {
+         cudaQuickSort1stPhase< Value, CMP, false > <<<blocksCnt, threadsPerBlock,
+            sizeof( Value ) >>>( arr, aux, Cmp, elemPerBlock, task, cuda_blockToTaskMapping );
+      }
+      TNL_CHECK_CUDA_DEVICE;
+
+      /**
+       * fill in the gap between smaller and bigger with elements == pivot
+       * after writing also create new tasks, each task generates at max 2 tasks
+       *
+       * tasks smaller than desired_2ndPhasElemPerBlock go into 2nd phase
+       * bigger need more blocks to partition and are written into newTask
+       * with iteration %2, rotate between the 2 tasks array to save from copying
+       * */
+      auto& newTask = iteration % 2 == 0 ? cuda_newTasks : cuda_tasks;
+      cudaWritePivot< Value > <<<host_1stPhaseTasksAmount, threadsPerBlock,
+         sizeof( Value ) >>>( arr,
+                                             aux,
+                                             desired_2ndPhasElemPerBlock,
+                                             task,
+                                             newTask,
+                                             cuda_newTasksAmount.getData(),
+                                             cuda_2ndPhaseTasks,
+                                             cuda_2ndPhaseTasksAmount.getData() );
+      TNL_CHECK_CUDA_DEVICE;
+
+      //----------------------------------------
+
+      processNewTasks();
+      iteration++;
+   }
 #endif
 }
 
 template< typename Value >
-   template< typename CMP >
+template< typename CMP >
 void
-Quicksorter< Value, Devices::Cuda >::
-secondPhase(const CMP &Cmp)
+Quicksorter< Value, Devices::Cuda >::secondPhase( const CMP& Cmp )
 {
 #ifdef HAVE_CUDA
-    int total2ndPhase = host_1stPhaseTasksAmount + host_2ndPhaseTasksAmount;
-    const int stackSize = 32;
-    auto &leftoverTasks = iteration % 2 == 0 ? cuda_tasks : cuda_newTasks;
-
-    int elemInShared = desiredElemPerBlock;
-    int externSharedByteSize = elemInShared * sizeof(Value) + sizeof(Value); //reserve space for storing elements + 1 pivot
-    if (externSharedByteSize > maxSharable)
-    {
-        externSharedByteSize = sizeof(Value);
-        elemInShared = 0;
-    }
-
-    if (host_1stPhaseTasksAmount > 0 && host_2ndPhaseTasksAmount > 0)
-    {
-        auto tasks = leftoverTasks.getView(0, host_1stPhaseTasksAmount);
-        auto tasks2 = cuda_2ndPhaseTasks.getView(0, host_2ndPhaseTasksAmount);
-
-        cudaQuickSort2ndPhase<Value, CMP, stackSize>
-            <<<total2ndPhase, threadsPerBlock, externSharedByteSize>>>(arr, aux, Cmp, tasks, tasks2, elemInShared, desired_2ndPhasElemPerBlock);
-    }
-    else if (host_1stPhaseTasksAmount > 0)
-    {
-        auto tasks = leftoverTasks.getView(0, host_1stPhaseTasksAmount);
-        cudaQuickSort2ndPhase<Value, CMP, stackSize>
-            <<<total2ndPhase, threadsPerBlock, externSharedByteSize>>>(arr, aux, Cmp, tasks, elemInShared, desired_2ndPhasElemPerBlock);
-    }
-    else
-    {
-        auto tasks2 = cuda_2ndPhaseTasks.getView(0, host_2ndPhaseTasksAmount);
-
-        cudaQuickSort2ndPhase<Value, CMP, stackSize>
-            <<<total2ndPhase, threadsPerBlock, externSharedByteSize>>>(arr, aux, Cmp, tasks2, elemInShared, desired_2ndPhasElemPerBlock);
-    }
+   int total2ndPhase = host_1stPhaseTasksAmount + host_2ndPhaseTasksAmount;
+   const int stackSize = 32;
+   auto& leftoverTasks = iteration % 2 == 0 ? cuda_tasks : cuda_newTasks;
+
+   int elemInShared = desiredElemPerBlock;
+   int externSharedByteSize = elemInShared * sizeof( Value ) + sizeof( Value );  // reserve space for storing elements + 1 pivot
+   if( externSharedByteSize > maxSharable ) {
+      externSharedByteSize = sizeof( Value );
+      elemInShared = 0;
+   }
+
+   if( host_1stPhaseTasksAmount > 0 && host_2ndPhaseTasksAmount > 0 ) {
+      auto tasks = leftoverTasks.getView( 0, host_1stPhaseTasksAmount );
+      auto tasks2 = cuda_2ndPhaseTasks.getView( 0, host_2ndPhaseTasksAmount );
+
+      cudaQuickSort2ndPhase< Value, CMP, stackSize > <<<total2ndPhase, threadsPerBlock,
+         externSharedByteSize>>>( arr, aux, Cmp, tasks, tasks2, elemInShared, desired_2ndPhasElemPerBlock );
+   }
+   else if( host_1stPhaseTasksAmount > 0 ) {
+      auto tasks = leftoverTasks.getView( 0, host_1stPhaseTasksAmount );
+      cudaQuickSort2ndPhase< Value, CMP, stackSize > <<<total2ndPhase, threadsPerBlock,
+         externSharedByteSize>>>( arr, aux, Cmp, tasks, elemInShared, desired_2ndPhasElemPerBlock );
+   }
+   else {
+      auto tasks2 = cuda_2ndPhaseTasks.getView( 0, host_2ndPhaseTasksAmount );
+
+      cudaQuickSort2ndPhase< Value, CMP, stackSize > <<<total2ndPhase, threadsPerBlock,
+         externSharedByteSize>>>( arr, aux, Cmp, tasks2, elemInShared, desired_2ndPhasElemPerBlock );
+   }
 #endif
 }
 
 template< typename Value >
-int getSetsNeededFunction(int elemPerBlock, const Quicksorter< Value, Devices::Cuda >& quicksort )
+int
+getSetsNeededFunction( int elemPerBlock, const Quicksorter< Value, Devices::Cuda >& quicksort )
 {
-    auto view = quicksort.iteration % 2 == 0 ? quicksort.cuda_tasks.getConstView() : quicksort.cuda_newTasks.getConstView();
-    auto fetch = [=] __cuda_callable__(int i) -> int {
-        const auto &task = view[i];
-        int size = task.partitionEnd - task.partitionBegin;
-        return size / elemPerBlock + (size % elemPerBlock != 0);
-    };
-    return reduce< Devices::Cuda >( 0, quicksort.host_1stPhaseTasksAmount, fetch, TNL::Plus{} );
+   auto view = quicksort.iteration % 2 == 0 ? quicksort.cuda_tasks.getConstView() : quicksort.cuda_newTasks.getConstView();
+   auto fetch = [ = ] __cuda_callable__( int i ) -> int
+   {
+      const auto& task = view[ i ];
+      int size = task.partitionEnd - task.partitionBegin;
+      return size / elemPerBlock + ( size % elemPerBlock != 0 );
+   };
+   return reduce< Devices::Cuda >( 0, quicksort.host_1stPhaseTasksAmount, fetch, TNL::Plus{} );
 }
 
 template< typename Value >
 int
-Quicksorter< Value, Devices::Cuda >::
-getSetsNeeded(int elemPerBlock) const
+Quicksorter< Value, Devices::Cuda >::getSetsNeeded( int elemPerBlock ) const
 {
-    return getSetsNeededFunction< Value >( elemPerBlock, *this );
+   return getSetsNeededFunction< Value >( elemPerBlock, *this );
 }
 
 template< typename Value >
 int
-Quicksorter< Value, Devices::Cuda >::
-getElemPerBlock() const
+Quicksorter< Value, Devices::Cuda >::getElemPerBlock() const
 {
-    return desiredElemPerBlock;
+   return desiredElemPerBlock;
 
-    int setsNeeded = getSetsNeeded(desiredElemPerBlock);
+   int setsNeeded = getSetsNeeded( desiredElemPerBlock );
 
-    if (setsNeeded <= maxBlocks)
-        return desiredElemPerBlock;
+   if( setsNeeded <= maxBlocks )
+      return desiredElemPerBlock;
 
-    //want multiplier*minElemPerBLock <= x*threadPerBlock
-    //find smallest x so that this inequality holds
-    double multiplier = 1. * setsNeeded / maxBlocks;
-    int elemPerBlock = multiplier * desiredElemPerBlock;
-    setsNeeded = elemPerBlock / threadsPerBlock + (elemPerBlock % threadsPerBlock != 0);
+   // want multiplier*minElemPerBLock <= x*threadPerBlock
+   // find smallest x so that this inequality holds
+   double multiplier = 1. * setsNeeded / maxBlocks;
+   int elemPerBlock = multiplier * desiredElemPerBlock;
+   setsNeeded = elemPerBlock / threadsPerBlock + static_cast< int >( elemPerBlock % threadsPerBlock != 0 );
 
-    return setsNeeded * threadsPerBlock;
+   return setsNeeded * threadsPerBlock;
 }
 
 template< typename Value >
-   template< typename CMP >
+template< typename CMP >
 int
-Quicksorter< Value, Devices::Cuda >::
-initTasks(int elemPerBlock, const CMP &Cmp)
+Quicksorter< Value, Devices::Cuda >::initTasks( int elemPerBlock, const CMP& Cmp )
 {
 #ifdef HAVE_CUDA
-    auto &src = iteration % 2 == 0 ? arr : aux;
-    auto &tasks = iteration % 2 == 0 ? cuda_tasks : cuda_newTasks;
+   auto& src = iteration % 2 == 0 ? arr : aux;
+   auto& tasks = iteration % 2 == 0 ? cuda_tasks : cuda_newTasks;
 
-    //--------------------------------------------------------
-    int blocks = host_1stPhaseTasksAmount / threadsPerBlock + (host_1stPhaseTasksAmount % threadsPerBlock != 0);
+   //--------------------------------------------------------
+   int blocks = host_1stPhaseTasksAmount / threadsPerBlock + ( host_1stPhaseTasksAmount % threadsPerBlock != 0 );
 
-    cudaCalcBlocksNeeded<<<blocks, threadsPerBlock>>>(tasks.getView(0, host_1stPhaseTasksAmount), elemPerBlock,
-                                                      cuda_reductionTaskInitMem.getView(0, host_1stPhaseTasksAmount));
-    //cuda_reductionTaskInitMem[i] == how many blocks task i needs
+   cudaCalcBlocksNeeded<<<blocks,
+      threadsPerBlock>>>( tasks.getView( 0, host_1stPhaseTasksAmount ),
+                                         elemPerBlock,
+                                         cuda_reductionTaskInitMem.getView( 0, host_1stPhaseTasksAmount ) );
+   // cuda_reductionTaskInitMem[i] == how many blocks task i needs
 
-    inplaceInclusiveScan(cuda_reductionTaskInitMem);
-    //cuda_reductionTaskInitMem[i] == how many blocks task [0..i] need
+   inplaceInclusiveScan( cuda_reductionTaskInitMem );
+   // cuda_reductionTaskInitMem[i] == how many blocks task [0..i] need
 
-    int blocksNeeded = cuda_reductionTaskInitMem.getElement(host_1stPhaseTasksAmount - 1);
+   int blocksNeeded = cuda_reductionTaskInitMem.getElement( host_1stPhaseTasksAmount - 1 );
 
-    //need too many blocks, give back control
-    if (blocksNeeded > cuda_blockToTaskMapping.getSize())
-        return blocksNeeded;
+   // need too many blocks, give back control
+   if( blocksNeeded > cuda_blockToTaskMapping.getSize() )
+      return blocksNeeded;
 
-    //--------------------------------------------------------
+   //--------------------------------------------------------
 
-    cudaInitTask<<<host_1stPhaseTasksAmount, threadsPerBlock>>>(
-        tasks.getView(0, host_1stPhaseTasksAmount),                     //task to read from
-        cuda_blockToTaskMapping.getView(0, blocksNeeded),               //maps block to a certain task
-        cuda_reductionTaskInitMem.getView(0, host_1stPhaseTasksAmount), //has how many each task need blocks precalculated
-        src, Cmp);                                                      //used to pick pivot
+   cudaInitTask<<<host_1stPhaseTasksAmount,
+      threadsPerBlock>>>(
+         tasks.getView( 0, host_1stPhaseTasksAmount ),                      // task to read from
+         cuda_blockToTaskMapping.getView( 0, blocksNeeded ),                // maps block to a certain task
+         cuda_reductionTaskInitMem.getView( 0, host_1stPhaseTasksAmount ),  // has how many each task need blocks precalculated
+         src,
+         Cmp );  // used to pick pivot
 
-    cuda_newTasksAmount.setElement(0, 0); //resets new element counter
-    return blocksNeeded;
+   cuda_newTasksAmount.setElement( 0, 0 );  // resets new element counter
+   return blocksNeeded;
 #else
-    return -1;
+   return -1;
 #endif
 }
 
-template <typename Value>
+template< typename Value >
 void
-Quicksorter< Value, Devices::Cuda >::
-processNewTasks()
+Quicksorter< Value, Devices::Cuda >::processNewTasks()
 {
-    host_1stPhaseTasksAmount = min(cuda_newTasksAmount.getElement(0), maxTasks);
-    host_2ndPhaseTasksAmount = min(cuda_2ndPhaseTasksAmount.getElement(0), maxTasks);
+   host_1stPhaseTasksAmount = min( cuda_newTasksAmount.getElement( 0 ), maxTasks );
+   host_2ndPhaseTasksAmount = min( cuda_2ndPhaseTasksAmount.getElement( 0 ), maxTasks );
 }
 
-        } // namespace Sorting
-    } // namespace Algorithms
-} // namespace TNL
+}  // namespace Sorting
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Sorting/detail/bitonicSort.h b/src/TNL/Algorithms/Sorting/detail/bitonicSort.h
index 09ddb4206d7ca505f142b2454b178d7a7795c48f..eb6a69dda884824e3195f1eccda2303be557e966 100644
--- a/src/TNL/Algorithms/Sorting/detail/bitonicSort.h
+++ b/src/TNL/Algorithms/Sorting/detail/bitonicSort.h
@@ -10,8 +10,8 @@
 #include <TNL/Algorithms/Sorting/detail/helpers.h>
 
 namespace TNL {
-    namespace Algorithms {
-        namespace Sorting {
+namespace Algorithms {
+namespace Sorting {
 
 #ifdef HAVE_CUDA
 
@@ -19,29 +19,30 @@ namespace TNL {
  * this kernel simulates 1 exchange
  * splits input arr that is bitonic into 2 bitonic sequences
  */
-template <typename Value, typename CMP>
-__global__ void bitonicMergeGlobal(TNL::Containers::ArrayView<Value, TNL::Devices::Cuda> arr,
-                                   CMP Cmp,
-                                   int monotonicSeqLen, int bitonicLen)
+template< typename Value, typename CMP >
+__global__
+void
+bitonicMergeGlobal( TNL::Containers::ArrayView< Value, TNL::Devices::Cuda > arr, CMP Cmp, int monotonicSeqLen, int bitonicLen )
 {
-    int i = blockIdx.x * blockDim.x + threadIdx.x;
+   int i = blockIdx.x * blockDim.x + threadIdx.x;
 
-    int part = i / (bitonicLen / 2); //computes which sorting block this thread belongs to
+   int part = i / ( bitonicLen / 2 );  // computes which sorting block this thread belongs to
 
-    //the index of 2 elements that should be compared and swapped
-    int s = part * bitonicLen + (i & ((bitonicLen / 2) - 1));
-    int e = s + bitonicLen / 2;
-    if (e >= arr.getSize()) //arr[e] is virtual padding and will not be exchanged with
-        return;
+   // the index of 2 elements that should be compared and swapped
+   int s = part * bitonicLen + ( i & ( ( bitonicLen / 2 ) - 1 ) );
+   int e = s + bitonicLen / 2;
+   if( e >= arr.getSize() )  // arr[e] is virtual padding and will not be exchanged with
+      return;
 
-    int partsInSeq = monotonicSeqLen / bitonicLen;
-    //calculate the direction of swapping
-    int monotonicSeqIdx = part / partsInSeq;
-    bool ascending = (monotonicSeqIdx & 1) != 0;
-    if ((monotonicSeqIdx + 1) * monotonicSeqLen >= arr.getSize()) //special case for part with no "partner" to be merged with in next phase
-        ascending = true;
+   int partsInSeq = monotonicSeqLen / bitonicLen;
+   // calculate the direction of swapping
+   int monotonicSeqIdx = part / partsInSeq;
+   bool ascending = ( monotonicSeqIdx & 1 ) != 0;
+   if( ( monotonicSeqIdx + 1 ) * monotonicSeqLen
+       >= arr.getSize() )  // special case for part with no "partner" to be merged with in next phase
+      ascending = true;
 
-    cmpSwap(arr[s], arr[e], ascending, Cmp);
+   cmpSwap( arr[ s ], arr[ e ], ascending, Cmp );
 }
 
 //---------------------------------------------
@@ -53,333 +54,359 @@ __global__ void bitonicMergeGlobal(TNL::Containers::ArrayView<Value, TNL::Device
  *
  * this version uses shared memory to do the operations
  * */
-template <typename Value, typename CMP>
-__global__ void bitonicMergeSharedMemory(TNL::Containers::ArrayView<Value, TNL::Devices::Cuda> arr,
-                                         CMP Cmp,
-                                         int monotonicSeqLen, int bitonicLen)
+template< typename Value, typename CMP >
+__global__
+void
+bitonicMergeSharedMemory( TNL::Containers::ArrayView< Value, TNL::Devices::Cuda > arr,
+                          CMP Cmp,
+                          int monotonicSeqLen,
+                          int bitonicLen )
 {
-    extern __shared__ int externMem[];
-    Value *sharedMem = (Value *)externMem;
-
-    int sharedMemLen = 2 * blockDim.x;
-
-    //1st index and last index of subarray that this threadBlock should merge
-    int myBlockStart = blockIdx.x * sharedMemLen;
-    int myBlockEnd = TNL::min(arr.getSize(), myBlockStart + sharedMemLen);
-
-    //copy from globalMem into sharedMem
-    for (int i = threadIdx.x; myBlockStart + i < myBlockEnd; i += blockDim.x)
-        sharedMem[i] = arr[myBlockStart + i];
-    __syncthreads();
-
-    //------------------------------------------
-    //bitonic activity
-    {
-        //calculate the direction of swapping
-        int i = blockIdx.x * blockDim.x + threadIdx.x;
-        int part = i / (bitonicLen / 2);
-        int partsInSeq = monotonicSeqLen / bitonicLen;
-        int monotonicSeqIdx = part / partsInSeq;
-
-        bool ascending = (monotonicSeqIdx & 1) != 0;
-        //special case for parts with no "partner"
-        if ((monotonicSeqIdx + 1) * monotonicSeqLen >= arr.getSize())
-            ascending = true;
-        //------------------------------------------
-
-        //do bitonic merge
-        for (; bitonicLen > 1; bitonicLen /= 2)
-        {
-            //calculates which 2 indexes will be compared and swap
-            int part = threadIdx.x / (bitonicLen / 2);
-            int s = part * bitonicLen + (threadIdx.x & ((bitonicLen / 2) - 1));
-            int e = s + bitonicLen / 2;
-
-            if (e < myBlockEnd - myBlockStart) //not touching virtual padding
-                cmpSwap(sharedMem[s], sharedMem[e], ascending, Cmp);
-            __syncthreads();
-        }
-    }
-
-    //------------------------------------------
-
-    //writeback to global memory
-    for (int i = threadIdx.x; myBlockStart + i < myBlockEnd; i += blockDim.x)
-        arr[myBlockStart + i] = sharedMem[i];
+   extern __shared__ int externMem[];
+   Value* sharedMem = (Value*) externMem;
+
+   int sharedMemLen = 2 * blockDim.x;
+
+   // 1st index and last index of subarray that this threadBlock should merge
+   int myBlockStart = blockIdx.x * sharedMemLen;
+   int myBlockEnd = TNL::min( arr.getSize(), myBlockStart + sharedMemLen );
+
+   // copy from globalMem into sharedMem
+   for( int i = threadIdx.x; myBlockStart + i < myBlockEnd; i += blockDim.x )
+      sharedMem[ i ] = arr[ myBlockStart + i ];
+   __syncthreads();
+
+   //------------------------------------------
+   // bitonic activity
+   {
+      // calculate the direction of swapping
+      int i = blockIdx.x * blockDim.x + threadIdx.x;
+      int part = i / ( bitonicLen / 2 );
+      int partsInSeq = monotonicSeqLen / bitonicLen;
+      int monotonicSeqIdx = part / partsInSeq;
+
+      bool ascending = ( monotonicSeqIdx & 1 ) != 0;
+      // special case for parts with no "partner"
+      if( ( monotonicSeqIdx + 1 ) * monotonicSeqLen >= arr.getSize() )
+         ascending = true;
+      //------------------------------------------
+
+      // do bitonic merge
+      for( ; bitonicLen > 1; bitonicLen /= 2 ) {
+         // calculates which 2 indexes will be compared and swap
+         int part = threadIdx.x / ( bitonicLen / 2 );
+         int s = part * bitonicLen + ( threadIdx.x & ( ( bitonicLen / 2 ) - 1 ) );
+         int e = s + bitonicLen / 2;
+
+         if( e < myBlockEnd - myBlockStart )  // not touching virtual padding
+            cmpSwap( sharedMem[ s ], sharedMem[ e ], ascending, Cmp );
+         __syncthreads();
+      }
+   }
+
+   //------------------------------------------
+
+   // writeback to global memory
+   for( int i = threadIdx.x; myBlockStart + i < myBlockEnd; i += blockDim.x )
+      arr[ myBlockStart + i ] = sharedMem[ i ];
 }
 
-
 /**
  * entrypoint for bitonicSort_Block
  * sorts @param arr in alternating order to create bitonic sequences
  * sharedMem has to be able to store at least blockDim.x*2 elements
  * */
-template <typename Value, typename CMP>
-__global__ void bitoniSort1stStepSharedMemory(TNL::Containers::ArrayView<Value, TNL::Devices::Cuda> arr, CMP Cmp)
+template< typename Value, typename CMP >
+__global__
+void
+bitoniSort1stStepSharedMemory( TNL::Containers::ArrayView< Value, TNL::Devices::Cuda > arr, CMP Cmp )
 {
-    extern __shared__ int externMem[];
-
-    Value * sharedMem = (Value *)externMem;
-    int sharedMemLen = 2*blockDim.x;
-
-    int myBlockStart = blockIdx.x * sharedMemLen;
-    int myBlockEnd = TNL::min(arr.getSize(), myBlockStart+sharedMemLen);
-
-    //copy from globalMem into sharedMem
-    for (int i = threadIdx.x; myBlockStart + i < myBlockEnd; i += blockDim.x)
-        sharedMem[i] = arr[myBlockStart + i];
-    __syncthreads();
-
-    //------------------------------------------
-    //bitonic activity
-    {
-        int i = blockIdx.x * blockDim.x + threadIdx.x;
-        int paddedSize = closestPow2(myBlockEnd - myBlockStart);
-
-        for (int monotonicSeqLen = 2; monotonicSeqLen <= paddedSize; monotonicSeqLen *= 2)
-        {
-            //calculate the direction of swapping
-            int monotonicSeqIdx = i / (monotonicSeqLen/2);
-            bool ascending = (monotonicSeqIdx & 1) != 0;
-            if ((monotonicSeqIdx + 1) * monotonicSeqLen >= arr.getSize()) //special case for parts with no "partner"
-                ascending = true;
-
-            for (int len = monotonicSeqLen; len > 1; len /= 2)
-            {
-                //calculates which 2 indexes will be compared and swap
-                int part = threadIdx.x / (len / 2);
-                int s = part * len + (threadIdx.x & ((len / 2) - 1));
-                int e = s + len / 2;
-
-                if(e < myBlockEnd - myBlockStart) //touching virtual padding
-                    cmpSwap(sharedMem[s], sharedMem[e], ascending, Cmp);
-                __syncthreads();
-            }
-        }
-    }
-
-    //writeback to global memory
-    for (int i = threadIdx.x; myBlockStart + i < myBlockEnd; i += blockDim.x)
-        arr[myBlockStart + i] = sharedMem[i];
+   extern __shared__ int externMem[];
+
+   Value* sharedMem = (Value*) externMem;
+   int sharedMemLen = 2 * blockDim.x;
+
+   int myBlockStart = blockIdx.x * sharedMemLen;
+   int myBlockEnd = TNL::min( arr.getSize(), myBlockStart + sharedMemLen );
+
+   // copy from globalMem into sharedMem
+   for( int i = threadIdx.x; myBlockStart + i < myBlockEnd; i += blockDim.x )
+      sharedMem[ i ] = arr[ myBlockStart + i ];
+   __syncthreads();
+
+   //------------------------------------------
+   // bitonic activity
+   {
+      int i = blockIdx.x * blockDim.x + threadIdx.x;
+      int paddedSize = closestPow2( myBlockEnd - myBlockStart );
+
+      for( int monotonicSeqLen = 2; monotonicSeqLen <= paddedSize; monotonicSeqLen *= 2 ) {
+         // calculate the direction of swapping
+         int monotonicSeqIdx = i / ( monotonicSeqLen / 2 );
+         bool ascending = ( monotonicSeqIdx & 1 ) != 0;
+         if( ( monotonicSeqIdx + 1 ) * monotonicSeqLen >= arr.getSize() )  // special case for parts with no "partner"
+            ascending = true;
+
+         for( int len = monotonicSeqLen; len > 1; len /= 2 ) {
+            // calculates which 2 indexes will be compared and swap
+            int part = threadIdx.x / ( len / 2 );
+            int s = part * len + ( threadIdx.x & ( ( len / 2 ) - 1 ) );
+            int e = s + len / 2;
+
+            if( e < myBlockEnd - myBlockStart )  // touching virtual padding
+               cmpSwap( sharedMem[ s ], sharedMem[ e ], ascending, Cmp );
+            __syncthreads();
+         }
+      }
+   }
+
+   // writeback to global memory
+   for( int i = threadIdx.x; myBlockStart + i < myBlockEnd; i += blockDim.x )
+      arr[ myBlockStart + i ] = sharedMem[ i ];
 }
 #endif
 
-
-template <typename Value, typename CMP>
-void bitonicSortWithShared(TNL::Containers::ArrayView<Value, TNL::Devices::Cuda> view, const CMP &Cmp,
-                           int gridDim, int blockDim, int sharedMemLen, int sharedMemSize)
+template< typename Value, typename CMP >
+void
+bitonicSortWithShared( TNL::Containers::ArrayView< Value, TNL::Devices::Cuda > view,
+                       const CMP& Cmp,
+                       int gridDim,
+                       int blockDim,
+                       int sharedMemLen,
+                       int sharedMemSize )
 {
 #ifdef HAVE_CUDA
-    int paddedSize = closestPow2(view.getSize());
-
-    bitoniSort1stStepSharedMemory<<<gridDim, blockDim, sharedMemSize>>>(view, Cmp);
-    //now alternating monotonic sequences with bitonicLenght of sharedMemLen
-
-    // \/ has bitonicLength of 2 * sharedMemLen
-    for (int monotonicSeqLen = 2 * sharedMemLen; monotonicSeqLen <= paddedSize; monotonicSeqLen *= 2)
-    {
-        for (int bitonicLen = monotonicSeqLen; bitonicLen > 1; bitonicLen /= 2)
-        {
-            if (bitonicLen > sharedMemLen)
-            {
-                bitonicMergeGlobal<<<gridDim, blockDim>>>(
-                    view, Cmp, monotonicSeqLen, bitonicLen);
-            }
-            else
-            {
-                bitonicMergeSharedMemory<<<gridDim, blockDim, sharedMemSize>>>(
-                    view, Cmp, monotonicSeqLen, bitonicLen);
-
-                //simulates sorts until bitonicLen == 2 already, no need to continue this loop
-                break;
-            }
-        }
-    }
-    cudaDeviceSynchronize();
+   int paddedSize = closestPow2( view.getSize() );
+
+   bitoniSort1stStepSharedMemory<<<gridDim, blockDim, sharedMemSize>>>( view, Cmp );
+   // now alternating monotonic sequences with bitonicLenght of sharedMemLen
+
+   // \/ has bitonicLength of 2 * sharedMemLen
+   for( int monotonicSeqLen = 2 * sharedMemLen; monotonicSeqLen <= paddedSize; monotonicSeqLen *= 2 ) {
+      for( int bitonicLen = monotonicSeqLen; bitonicLen > 1; bitonicLen /= 2 ) {
+         if( bitonicLen > sharedMemLen ) {
+            bitonicMergeGlobal<<<gridDim, blockDim>>>( view, Cmp, monotonicSeqLen, bitonicLen );
+         }
+         else {
+            bitonicMergeSharedMemory<<<gridDim, blockDim,
+               sharedMemSize>>>( view, Cmp, monotonicSeqLen, bitonicLen );
+
+            // simulates sorts until bitonicLen == 2 already, no need to continue this loop
+            break;
+         }
+      }
+   }
+   cudaDeviceSynchronize();
 #endif
 }
 
 //---------------------------------------------
 
-template <typename Value, typename CMP>
-void bitonicSort(TNL::Containers::ArrayView<Value, TNL::Devices::Cuda> view,
-                 const CMP &Cmp,
-                 int gridDim, int blockDim)
+template< typename Value, typename CMP >
+void
+bitonicSort( TNL::Containers::ArrayView< Value, TNL::Devices::Cuda > view, const CMP& Cmp, int gridDim, int blockDim )
 
 {
 #ifdef HAVE_CUDA
-    int paddedSize = closestPow2(view.getSize());
-
-    for (int monotonicSeqLen = 2; monotonicSeqLen <= paddedSize; monotonicSeqLen *= 2)
-    {
-        for (int bitonicLen = monotonicSeqLen; bitonicLen > 1; bitonicLen /= 2)
-        {
-            bitonicMergeGlobal<<<gridDim, blockDim>>>(view, Cmp, monotonicSeqLen, bitonicLen);
-        }
-    }
-    cudaDeviceSynchronize();
+   int paddedSize = closestPow2( view.getSize() );
+
+   for( int monotonicSeqLen = 2; monotonicSeqLen <= paddedSize; monotonicSeqLen *= 2 ) {
+      for( int bitonicLen = monotonicSeqLen; bitonicLen > 1; bitonicLen /= 2 ) {
+         bitonicMergeGlobal<<<gridDim, blockDim>>>( view, Cmp, monotonicSeqLen, bitonicLen );
+      }
+   }
+   cudaDeviceSynchronize();
 #endif
 }
 
 //---------------------------------------------
-template <typename Value, typename CMP>
-void bitonicSort(TNL::Containers::ArrayView<Value, TNL::Devices::Cuda> src, int begin, int end, const CMP &Cmp)
+template< typename Value, typename CMP >
+void
+bitonicSort( TNL::Containers::ArrayView< Value, TNL::Devices::Cuda > src, int begin, int end, const CMP& Cmp )
 {
 #ifdef HAVE_CUDA
-    auto view = src.getView(begin, end);
-
-    int threadsNeeded = view.getSize() / 2 + (view.getSize() % 2 != 0);
-
-    cudaDeviceProp deviceProp;
-    cudaGetDeviceProperties(&deviceProp, 0);
-
-    const int maxThreadsPerBlock = 512;
-
-    int sharedMemLen = maxThreadsPerBlock * 2;
-    size_t sharedMemSize = sharedMemLen * sizeof(Value);
-
-    if (sharedMemSize <= deviceProp.sharedMemPerBlock)
-    {
-        int blockDim = maxThreadsPerBlock;
-        int gridDim = threadsNeeded / blockDim + (threadsNeeded % blockDim != 0);
-        bitonicSortWithShared(view, Cmp, gridDim, blockDim, sharedMemLen, sharedMemSize);
-    }
-    else if (sharedMemSize / 2 <= deviceProp.sharedMemPerBlock)
-    {
-        int blockDim = maxThreadsPerBlock / 2; //256
-        int gridDim = threadsNeeded / blockDim + (threadsNeeded % blockDim != 0);
-        sharedMemSize /= 2;
-        sharedMemLen /= 2;
-        bitonicSortWithShared(view, Cmp, gridDim, blockDim, sharedMemLen, sharedMemSize);
-    }
-    else
-    {
-        int gridDim = threadsNeeded / maxThreadsPerBlock + (threadsNeeded % maxThreadsPerBlock != 0);
-        bitonicSort(view, Cmp, gridDim, maxThreadsPerBlock);
-    }
+   auto view = src.getView( begin, end );
+
+   int threadsNeeded = view.getSize() / 2 + ( view.getSize() % 2 != 0 );
+
+   cudaDeviceProp deviceProp;
+   cudaGetDeviceProperties( &deviceProp, 0 );
+
+   const int maxThreadsPerBlock = 512;
+
+   int sharedMemLen = maxThreadsPerBlock * 2;
+   size_t sharedMemSize = sharedMemLen * sizeof( Value );
+
+   if( sharedMemSize <= deviceProp.sharedMemPerBlock ) {
+      int blockDim = maxThreadsPerBlock;
+      int gridDim = threadsNeeded / blockDim + ( threadsNeeded % blockDim != 0 );
+      bitonicSortWithShared( view, Cmp, gridDim, blockDim, sharedMemLen, sharedMemSize );
+   }
+   else if( sharedMemSize / 2 <= deviceProp.sharedMemPerBlock ) {
+      int blockDim = maxThreadsPerBlock / 2;  // 256
+      int gridDim = threadsNeeded / blockDim + ( threadsNeeded % blockDim != 0 );
+      sharedMemSize /= 2;
+      sharedMemLen /= 2;
+      bitonicSortWithShared( view, Cmp, gridDim, blockDim, sharedMemLen, sharedMemSize );
+   }
+   else {
+      int gridDim = threadsNeeded / maxThreadsPerBlock + ( threadsNeeded % maxThreadsPerBlock != 0 );
+      bitonicSort( view, Cmp, gridDim, maxThreadsPerBlock );
+   }
 #endif
 }
 
 //---------------------------------------------
 
-template <typename Value, typename CMP>
-void bitonicSort(TNL::Containers::ArrayView<Value, TNL::Devices::Cuda> arr, int begin, int end)
+template< typename Value, typename CMP >
+void
+bitonicSort( TNL::Containers::ArrayView< Value, TNL::Devices::Cuda > arr, int begin, int end )
 {
-    bitonicSort(arr, begin, end, [] __cuda_callable__(const Value &a, const Value &b) { return a < b; });
+   bitonicSort( arr,
+                begin,
+                end,
+                [] __cuda_callable__( const Value& a, const Value& b )
+                {
+                   return a < b;
+                } );
 }
 
-template <typename Value, typename CMP>
-void bitonicSort(TNL::Containers::ArrayView<Value, TNL::Devices::Cuda> arr, const CMP &Cmp)
+template< typename Value, typename CMP >
+void
+bitonicSort( TNL::Containers::ArrayView< Value, TNL::Devices::Cuda > arr, const CMP& Cmp )
 {
-    bitonicSort(arr, 0, arr.getSize(), Cmp);
+   bitonicSort( arr, 0, arr.getSize(), Cmp );
 }
 
-template <typename Value>
-void bitonicSort(TNL::Containers::ArrayView<Value, TNL::Devices::Cuda> arr)
+template< typename Value >
+void
+bitonicSort( TNL::Containers::ArrayView< Value, TNL::Devices::Cuda > arr )
 {
-    bitonicSort(arr, [] __cuda_callable__(const Value &a, const Value &b) { return a < b; });
+   bitonicSort( arr,
+                [] __cuda_callable__( const Value& a, const Value& b )
+                {
+                   return a < b;
+                } );
 }
 
 //---------------------------------------------
-template <typename Value, typename CMP>
-void bitonicSort(std::vector<Value> &vec, int begin, int end, const CMP &Cmp)
+template< typename Value, typename CMP >
+void
+bitonicSort( std::vector< Value >& vec, int begin, int end, const CMP& Cmp )
 {
-    TNL::Containers::Array<Value, TNL::Devices::Cuda> Arr(vec);
-    auto view = Arr.getView();
-    bitonicSort(view, begin, end, Cmp);
+   TNL::Containers::Array< Value, TNL::Devices::Cuda > Arr( vec );
+   auto view = Arr.getView();
+   bitonicSort( view, begin, end, Cmp );
 
-    TNL::Algorithms::MultiDeviceMemoryOperations<TNL::Devices::Host, TNL::Devices::Cuda>::
-        copy(vec.data(), view.getData(), view.getSize());
+   TNL::Algorithms::MultiDeviceMemoryOperations< TNL::Devices::Host, TNL::Devices::Cuda >::copy(
+      vec.data(), view.getData(), view.getSize() );
 }
 
-template <typename Value>
-void bitonicSort(std::vector<Value> &vec, int begin, int end)
+template< typename Value >
+void
+bitonicSort( std::vector< Value >& vec, int begin, int end )
 {
-    bitonicSort(vec, begin, end, [] __cuda_callable__(const Value &a, const Value &b) { return a < b; });
+   bitonicSort( vec,
+                begin,
+                end,
+                [] __cuda_callable__( const Value& a, const Value& b )
+                {
+                   return a < b;
+                } );
 }
 
-template <typename Value, typename CMP>
-void bitonicSort(std::vector<Value> &vec, const CMP &Cmp)
+template< typename Value, typename CMP >
+void
+bitonicSort( std::vector< Value >& vec, const CMP& Cmp )
 {
-    bitonicSort(vec, 0, vec.size(), Cmp);
+   bitonicSort( vec, 0, vec.size(), Cmp );
 }
 
-template <typename Value>
-void bitonicSort(std::vector<Value> &vec)
+template< typename Value >
+void
+bitonicSort( std::vector< Value >& vec )
 {
-    bitonicSort(vec, [] __cuda_callable__(const Value &a, const Value &b) { return a < b; });
+   bitonicSort( vec,
+                [] __cuda_callable__( const Value& a, const Value& b )
+                {
+                   return a < b;
+                } );
 }
 
-template <typename Value>
-void bitonicSort( TNL::Containers::Array< Value, TNL::Devices::Host > &vec)
+template< typename Value >
+void
+bitonicSort( TNL::Containers::Array< Value, TNL::Devices::Host >& vec )
 {
-    bitonicSort(vec, [] __cuda_callable__(const Value &a, const Value &b) { return a < b; });
+   bitonicSort( vec,
+                [] __cuda_callable__( const Value& a, const Value& b )
+                {
+                   return a < b;
+                } );
 }
 
-
 //---------------------------------------------
 //---------------------------------------------
 
 #ifdef HAVE_CUDA
-template< typename CMP, typename SWAP>
-__global__ void bitonicMergeGlobal(int size, CMP Cmp, SWAP Swap,
-                                   int monotonicSeqLen, int bitonicLen)
+template< typename CMP, typename SWAP >
+__global__
+void
+bitonicMergeGlobal( int size, CMP Cmp, SWAP Swap, int monotonicSeqLen, int bitonicLen )
 {
-    int i = blockIdx.x * blockDim.x + threadIdx.x;
-
-    int part = i / (bitonicLen / 2); //computes which sorting block this thread belongs to
-
-    //the index of 2 elements that should be compared and swapped
-    int s = part * bitonicLen + (i & ((bitonicLen / 2) - 1));
-    int e = s + bitonicLen / 2;
-    if (e >= size) //arr[e] is virtual padding and will not be exchanged with
-        return;
-
-    //calculate the direction of swapping
-    int partsInSeq = monotonicSeqLen / bitonicLen;
-    int monotonicSeqIdx = part / partsInSeq;
-    bool ascending = (monotonicSeqIdx & 1) != 0;
-    if ((monotonicSeqIdx + 1) * monotonicSeqLen >= size) //special case for part with no "partner" to be merged with in next phase
-        ascending = true;
-
-    if( ascending == Cmp(e, s) )
-        Swap(s, e);
+   int i = blockIdx.x * blockDim.x + threadIdx.x;
+
+   int part = i / ( bitonicLen / 2 );  // computes which sorting block this thread belongs to
+
+   // the index of 2 elements that should be compared and swapped
+   int s = part * bitonicLen + ( i & ( ( bitonicLen / 2 ) - 1 ) );
+   int e = s + bitonicLen / 2;
+   if( e >= size )  // arr[e] is virtual padding and will not be exchanged with
+      return;
+
+   // calculate the direction of swapping
+   int partsInSeq = monotonicSeqLen / bitonicLen;
+   int monotonicSeqIdx = part / partsInSeq;
+   bool ascending = ( monotonicSeqIdx & 1 ) != 0;
+   if( ( monotonicSeqIdx + 1 ) * monotonicSeqLen
+       >= size )  // special case for part with no "partner" to be merged with in next phase
+      ascending = true;
+
+   if( ascending == Cmp( e, s ) )
+      Swap( s, e );
 }
 
 template< typename CMP, typename SWAP >
-void bitonicSort(int begin, int end, const CMP &Cmp, SWAP Swap)
+void
+bitonicSort( int begin, int end, const CMP& Cmp, SWAP Swap )
 {
-    int size = end - begin;
-    int paddedSize = closestPow2(size);
-
-    int threadsNeeded = size / 2 + (size % 2 != 0);
-
-    const int maxThreadsPerBlock = 512;
-    int threadsPerBlock = maxThreadsPerBlock;
-    int blocks = threadsNeeded / threadsPerBlock + (threadsNeeded % threadsPerBlock != 0);
-
-    auto compareWithOffset =
-        [=] __cuda_callable__(int i, int j) {
-            return Cmp(i + begin, j + begin);
-        };
-
-    auto swapWithOffset =
-        [=] __cuda_callable__(int i, int j) mutable {
-            Swap(i + begin, j + begin);
-        };
-
-    for (int monotonicSeqLen = 2; monotonicSeqLen <= paddedSize; monotonicSeqLen *= 2)
-    {
-        for (int bitonicLen = monotonicSeqLen; bitonicLen > 1; bitonicLen /= 2)
-        {
-            bitonicMergeGlobal<<<blocks, threadsPerBlock>>>(
-                size, compareWithOffset, swapWithOffset,
-                monotonicSeqLen, bitonicLen);
-        }
-    }
-    cudaDeviceSynchronize();
+   int size = end - begin;
+   int paddedSize = closestPow2( size );
+
+   int threadsNeeded = size / 2 + ( size % 2 != 0 );
+
+   const int maxThreadsPerBlock = 512;
+   int threadsPerBlock = maxThreadsPerBlock;
+   int blocks = threadsNeeded / threadsPerBlock + ( threadsNeeded % threadsPerBlock != 0 );
+
+   auto compareWithOffset = [ = ] __cuda_callable__( int i, int j )
+   {
+      return Cmp( i + begin, j + begin );
+   };
+
+   auto swapWithOffset = [ = ] __cuda_callable__( int i, int j ) mutable
+   {
+      Swap( i + begin, j + begin );
+   };
+
+   for( int monotonicSeqLen = 2; monotonicSeqLen <= paddedSize; monotonicSeqLen *= 2 ) {
+      for( int bitonicLen = monotonicSeqLen; bitonicLen > 1; bitonicLen /= 2 ) {
+         bitonicMergeGlobal<<<blocks,
+            threadsPerBlock>>>( size, compareWithOffset, swapWithOffset, monotonicSeqLen, bitonicLen );
+      }
+   }
+   cudaDeviceSynchronize();
 }
 #endif
-        } // namespace Sorting
-    } // namespace Algorithms
-} // namespace TNL
+}  // namespace Sorting
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Sorting/detail/blockBitonicSort.h b/src/TNL/Algorithms/Sorting/detail/blockBitonicSort.h
index dd92b40f609d0be90d59b3b3fceafcb5ce8f99b0..60fa8fc4a2d8cbea6f78ef4019de2083dcaf07ba 100644
--- a/src/TNL/Algorithms/Sorting/detail/blockBitonicSort.h
+++ b/src/TNL/Algorithms/Sorting/detail/blockBitonicSort.h
@@ -9,8 +9,8 @@
 #include <TNL/Containers/Array.h>
 
 namespace TNL {
-    namespace Algorithms {
-        namespace Sorting {
+namespace Algorithms {
+namespace Sorting {
 
 #ifdef HAVE_CUDA
 
@@ -21,53 +21,54 @@ namespace TNL {
  * works independently from other concurrent blocks
  * @param sharedMem sharedMem pointer has to be able to store all of src elements
  * */
-template <typename Value, typename CMP>
-__device__ void bitonicSort_Block(TNL::Containers::ArrayView<Value, TNL::Devices::Cuda> src,
-                                  TNL::Containers::ArrayView<Value, TNL::Devices::Cuda> dst,
-                                  Value *sharedMem, const CMP &Cmp)
+template< typename Value, typename CMP >
+__device__
+void
+bitonicSort_Block( TNL::Containers::ArrayView< Value, TNL::Devices::Cuda > src,
+                   TNL::Containers::ArrayView< Value, TNL::Devices::Cuda > dst,
+                   Value* sharedMem,
+                   const CMP& Cmp )
 {
-    //copy from globalMem into sharedMem
-    for (int i = threadIdx.x; i < src.getSize(); i += blockDim.x)
-        sharedMem[i] = src[i];
-    __syncthreads();
-
-    //------------------------------------------
-    //bitonic activity
-    {
-        int paddedSize = closestPow2_ptx(src.getSize());
-
-        for (int monotonicSeqLen = 2; monotonicSeqLen <= paddedSize; monotonicSeqLen *= 2)
-        {
-            for (int bitonicLen = monotonicSeqLen; bitonicLen > 1; bitonicLen /= 2)
+   // copy from globalMem into sharedMem
+   for( int i = threadIdx.x; i < src.getSize(); i += blockDim.x )
+      sharedMem[ i ] = src[ i ];
+   __syncthreads();
+
+   //------------------------------------------
+   // bitonic activity
+   {
+      int paddedSize = closestPow2_ptx( src.getSize() );
+
+      for( int monotonicSeqLen = 2; monotonicSeqLen <= paddedSize; monotonicSeqLen *= 2 ) {
+         for( int bitonicLen = monotonicSeqLen; bitonicLen > 1; bitonicLen /= 2 ) {
+            for( int i = threadIdx.x;; i += blockDim.x )  // simulates other blocks in case src.size > blockDim.x*2
             {
-                for (int i = threadIdx.x;; i += blockDim.x) //simulates other blocks in case src.size > blockDim.x*2
-                {
-                    //calculates which 2 indexes will be compared and swap
-                    int part = i / (bitonicLen / 2);
-                    int s = part * bitonicLen + (i & ((bitonicLen / 2) - 1));
-                    int e = s + bitonicLen / 2;
-
-                    if (e >= src.getSize()) //touching virtual padding, the order dont swap
-                        break;
-
-                    //calculate the direction of swapping
-                    int monotonicSeqIdx = i / (monotonicSeqLen / 2);
-                    bool ascending = (monotonicSeqIdx & 1) != 0;
-                    if ((monotonicSeqIdx + 1) * monotonicSeqLen >= src.getSize()) //special case for parts with no "partner"
-                        ascending = true;
-
-                    cmpSwap(sharedMem[s], sharedMem[e], ascending, Cmp);
-                }
-
-                __syncthreads(); //only 1 synchronization needed
+               // calculates which 2 indexes will be compared and swap
+               int part = i / ( bitonicLen / 2 );
+               int s = part * bitonicLen + ( i & ( ( bitonicLen / 2 ) - 1 ) );
+               int e = s + bitonicLen / 2;
+
+               if( e >= src.getSize() )  // touching virtual padding, the order dont swap
+                  break;
+
+               // calculate the direction of swapping
+               int monotonicSeqIdx = i / ( monotonicSeqLen / 2 );
+               bool ascending = ( monotonicSeqIdx & 1 ) != 0;
+               if( ( monotonicSeqIdx + 1 ) * monotonicSeqLen >= src.getSize() )  // special case for parts with no "partner"
+                  ascending = true;
+
+               cmpSwap( sharedMem[ s ], sharedMem[ e ], ascending, Cmp );
             }
-        }
-    }
 
-    //------------------------------------------
-    //writeback to global memory
-    for (int i = threadIdx.x; i < dst.getSize(); i += blockDim.x)
-        dst[i] = sharedMem[i];
+            __syncthreads();  // only 1 synchronization needed
+         }
+      }
+   }
+
+   //------------------------------------------
+   // writeback to global memory
+   for( int i = threadIdx.x; i < dst.getSize(); i += blockDim.x )
+      dst[ i ] = sharedMem[ i ];
 }
 
 /**
@@ -78,40 +79,39 @@ __device__ void bitonicSort_Block(TNL::Containers::ArrayView<Value, TNL::Devices
  * works independently from other concurrent blocks
  * this version doesnt use shared memory and is prefered for Value with big size
  * */
-template <typename Value, typename CMP>
-__device__ void bitonicSort_Block(TNL::Containers::ArrayView<Value, TNL::Devices::Cuda> src,
-                                  const CMP &Cmp)
+template< typename Value, typename CMP >
+__device__
+void
+bitonicSort_Block( TNL::Containers::ArrayView< Value, TNL::Devices::Cuda > src, const CMP& Cmp )
 {
-    int paddedSize = closestPow2_ptx(src.getSize());
-
-    for (int monotonicSeqLen = 2; monotonicSeqLen <= paddedSize; monotonicSeqLen *= 2)
-    {
-        for (int bitonicLen = monotonicSeqLen; bitonicLen > 1; bitonicLen /= 2)
-        {
-            for (int i = threadIdx.x;; i += blockDim.x) //simulates other blocks in case src.size > blockDim.x*2
-            {
-                //calculates which 2 indexes will be compared and swap
-                int part = i / (bitonicLen / 2);
-                int s = part * bitonicLen + (i & ((bitonicLen / 2) - 1));
-                int e = s + bitonicLen / 2;
-
-                if (e >= src.getSize())
-                    break;
-
-                //calculate the direction of swapping
-                int monotonicSeqIdx = i / (monotonicSeqLen / 2);
-                bool ascending = (monotonicSeqIdx & 1) != 0;
-                if ((monotonicSeqIdx + 1) * monotonicSeqLen >= src.getSize()) //special case for parts with no "partner"
-                    ascending = true;
-
-                cmpSwap(src[s], src[e], ascending, Cmp);
-            }
-            __syncthreads();
-        }
-    }
+   int paddedSize = closestPow2_ptx( src.getSize() );
+
+   for( int monotonicSeqLen = 2; monotonicSeqLen <= paddedSize; monotonicSeqLen *= 2 ) {
+      for( int bitonicLen = monotonicSeqLen; bitonicLen > 1; bitonicLen /= 2 ) {
+         for( int i = threadIdx.x;; i += blockDim.x )  // simulates other blocks in case src.size > blockDim.x*2
+         {
+            // calculates which 2 indexes will be compared and swap
+            int part = i / ( bitonicLen / 2 );
+            int s = part * bitonicLen + ( i & ( ( bitonicLen / 2 ) - 1 ) );
+            int e = s + bitonicLen / 2;
+
+            if( e >= src.getSize() )
+               break;
+
+            // calculate the direction of swapping
+            int monotonicSeqIdx = i / ( monotonicSeqLen / 2 );
+            bool ascending = ( monotonicSeqIdx & 1 ) != 0;
+            if( ( monotonicSeqIdx + 1 ) * monotonicSeqLen >= src.getSize() )  // special case for parts with no "partner"
+               ascending = true;
+
+            cmpSwap( src[ s ], src[ e ], ascending, Cmp );
+         }
+         __syncthreads();
+      }
+   }
 }
 
 #endif
-        } // namespace Sorting
-    } // namespace Algorithms
-} // namespace TNL
+}  // namespace Sorting
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Sorting/detail/cudaPartition.h b/src/TNL/Algorithms/Sorting/detail/cudaPartition.h
index 21a0de7b618ae59a7fde01580cd824fdc539a130..f2f5634dda552363454d372c80c8f3a74b668ec0 100644
--- a/src/TNL/Algorithms/Sorting/detail/cudaPartition.h
+++ b/src/TNL/Algorithms/Sorting/detail/cudaPartition.h
@@ -13,214 +13,226 @@
 #include <TNL/Algorithms/detail/CudaScanKernel.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace Sorting {
+namespace Algorithms {
+namespace Sorting {
 
 #ifdef HAVE_CUDA
 
-template <typename Value, typename Device, typename CMP>
-__device__ Value pickPivot(TNL::Containers::ArrayView<Value, Device> src, const CMP &Cmp)
+template< typename Value, typename Device, typename CMP >
+__device__
+Value
+pickPivot( TNL::Containers::ArrayView< Value, Device > src, const CMP& Cmp )
 {
-    //return src[0];
-    //return src[src.getSize()-1];
-
-    if (src.getSize() == 1)
-        return src[0];
-
-    const Value &a = src[0], &b = src[src.getSize() / 2], &c = src[src.getSize() - 1];
-
-    if (Cmp(a, b)) // ..a..b..
-    {
-        if (Cmp(b, c)) // ..a..b..c
-            return b;
-        else if (Cmp(c, a)) //..c..a..b..
-            return a;
-        else //..a..c..b..
-            return c;
-    }
-    else //..b..a..
-    {
-        if (Cmp(a, c)) //..b..a..c
-            return a;
-        else if (Cmp(c, b)) //..c..b..a..
-            return b;
-        else //..b..c..a..
-            return c;
-    }
+   // return src[0];
+   // return src[src.getSize()-1];
+
+   if( src.getSize() == 1 )
+      return src[ 0 ];
+
+   const Value &a = src[ 0 ], &b = src[ src.getSize() / 2 ], &c = src[ src.getSize() - 1 ];
+
+   if( Cmp( a, b ) )  // ..a..b..
+   {
+      if( Cmp( b, c ) )  // ..a..b..c
+         return b;
+      else if( Cmp( c, a ) )  //..c..a..b..
+         return a;
+      else  //..a..c..b..
+         return c;
+   }
+   else  //..b..a..
+   {
+      if( Cmp( a, c ) )  //..b..a..c
+         return a;
+      else if( Cmp( c, b ) )  //..c..b..a..
+         return b;
+      else  //..b..c..a..
+         return c;
+   }
 }
 
-template <typename Value, typename Device, typename CMP>
-__device__ int pickPivotIdx(TNL::Containers::ArrayView<Value, Device> src, const CMP &Cmp)
+template< typename Value, typename Device, typename CMP >
+__device__
+int
+pickPivotIdx( TNL::Containers::ArrayView< Value, Device > src, const CMP& Cmp )
 {
-    //return 0;
-    //return src.getSize()-1;
-
-    if (src.getSize() <= 1)
-        return 0;
-
-    const Value &a = src[0], &b = src[src.getSize() / 2], &c = src[src.getSize() - 1];
-
-    if (Cmp(a, b)) // ..a..b..
-    {
-        if (Cmp(b, c)) // ..a..b..c
-            return src.getSize() / 2;
-        else if (Cmp(c, a)) //..c..a..b..
-            return 0;
-        else //..a..c..b..
-            return src.getSize() - 1;
-    }
-    else //..b..a..
-    {
-        if (Cmp(a, c)) //..b..a..c
-            return 0;
-        else if (Cmp(c, b)) //..c..b..a..
-            return src.getSize() / 2;
-        else //..b..c..a..
-            return src.getSize() - 1;
-    }
+   // return 0;
+   // return src.getSize()-1;
+
+   if( src.getSize() <= 1 )
+      return 0;
+
+   const Value &a = src[ 0 ], &b = src[ src.getSize() / 2 ], &c = src[ src.getSize() - 1 ];
+
+   if( Cmp( a, b ) )  // ..a..b..
+   {
+      if( Cmp( b, c ) )  // ..a..b..c
+         return src.getSize() / 2;
+      else if( Cmp( c, a ) )  //..c..a..b..
+         return 0;
+      else  //..a..c..b..
+         return src.getSize() - 1;
+   }
+   else  //..b..a..
+   {
+      if( Cmp( a, c ) )  //..b..a..c
+         return 0;
+      else if( Cmp( c, b ) )  //..c..b..a..
+         return src.getSize() / 2;
+      else  //..b..c..a..
+         return src.getSize() - 1;
+   }
 }
 
 //-----------------------------------------------------------
 
-template <typename Value, typename CMP>
-__device__ void countElem( Containers::ArrayView<Value, Devices::Cuda> arr,
-                           const CMP &Cmp,
-                           int &smaller, int &bigger,
-                           const Value &pivot)
+template< typename Value, typename CMP >
+__device__
+void
+countElem( Containers::ArrayView< Value, Devices::Cuda > arr, const CMP& Cmp, int& smaller, int& bigger, const Value& pivot )
 {
-    for (int i = threadIdx.x; i < arr.getSize(); i += blockDim.x)
-    {
-        const Value &data = arr[i];
-        if (Cmp(data, pivot))
-            smaller++;
-        else if (Cmp(pivot, data))
-            bigger++;
-    }
+   for( int i = threadIdx.x; i < arr.getSize(); i += blockDim.x ) {
+      const Value& data = arr[ i ];
+      if( Cmp( data, pivot ) )
+         smaller++;
+      else if( Cmp( pivot, data ) )
+         bigger++;
+   }
 }
 
 //-----------------------------------------------------------
 
-template <typename Value, typename CMP>
-__device__ void copyDataShared( Containers::ArrayView<Value, Devices::Cuda> src,
-                                Containers::ArrayView<Value, Devices::Cuda> dst,
-                                const CMP &Cmp,
-                                Value *sharedMem,
-                                int smallerStart, int biggerStart,
-                                int smallerTotal, int biggerTotal,
-                                int smallerOffset, int biggerOffset, //exclusive prefix sum of elements
-                                const Value &pivot)
+template< typename Value, typename CMP >
+__device__
+void
+copyDataShared( Containers::ArrayView< Value, Devices::Cuda > src,
+                Containers::ArrayView< Value, Devices::Cuda > dst,
+                const CMP& Cmp,
+                Value* sharedMem,
+                int smallerStart,
+                int biggerStart,
+                int smallerTotal,
+                int biggerTotal,
+                int smallerOffset,
+                int biggerOffset,  // exclusive prefix sum of elements
+                const Value& pivot )
 {
-
-    for (int i = threadIdx.x; i < src.getSize(); i += blockDim.x)
-    {
-        const Value &data = src[i];
-        if (Cmp(data, pivot))
-            sharedMem[smallerOffset++] = data;
-        else if (Cmp(pivot, data))
-            sharedMem[smallerTotal + biggerOffset++] = data;
-    }
-    __syncthreads();
-
-    for (int i = threadIdx.x; i < smallerTotal + biggerTotal; i += blockDim.x)
-    {
-        if (i < smallerTotal)
-            dst[smallerStart + i] = sharedMem[i];
-        else
-            dst[biggerStart + i - smallerTotal] = sharedMem[i];
-    }
+   for( int i = threadIdx.x; i < src.getSize(); i += blockDim.x ) {
+      const Value& data = src[ i ];
+      if( Cmp( data, pivot ) )
+         sharedMem[ smallerOffset++ ] = data;
+      else if( Cmp( pivot, data ) )
+         sharedMem[ smallerTotal + biggerOffset++ ] = data;
+   }
+   __syncthreads();
+
+   for( int i = threadIdx.x; i < smallerTotal + biggerTotal; i += blockDim.x ) {
+      if( i < smallerTotal )
+         dst[ smallerStart + i ] = sharedMem[ i ];
+      else
+         dst[ biggerStart + i - smallerTotal ] = sharedMem[ i ];
+   }
 }
 
-template <typename Value, typename CMP>
-__device__ void copyData( Containers::ArrayView<Value, Devices::Cuda> src,
-                          Containers::ArrayView<Value, Devices::Cuda> dst,
-                          const CMP &Cmp,
-                          int smallerStart, int biggerStart,
-                          const Value &pivot)
+template< typename Value, typename CMP >
+__device__
+void
+copyData( Containers::ArrayView< Value, Devices::Cuda > src,
+          Containers::ArrayView< Value, Devices::Cuda > dst,
+          const CMP& Cmp,
+          int smallerStart,
+          int biggerStart,
+          const Value& pivot )
 {
-    for (int i = threadIdx.x; i < src.getSize(); i += blockDim.x)
-    {
-        const Value &data = src[i];
-        if (Cmp(data, pivot))
-        {
-            /*
-            if(smallerStart >= dst.getSize() || smallerStart < 0)
-                printf("failed smaller: b:%d t:%d: tried to write into [%d]/%d\n", blockDim.x, threadIdx.x, smallerStart, dst.getSize());
-            */
-            dst[smallerStart++] = data;
-        }
-        else if (Cmp(pivot, data))
-        {
-            /*
-            if(biggerStart >= dst.getSize() || biggerStart < 0)
-                printf("failed bigger: b:%d t:%d: tried to write into [%d]/%d\n", blockDim.x, threadIdx.x, biggerStart, dst.getSize());
-            */
-            dst[biggerStart++] = data;
-        }
-    }
+   for( int i = threadIdx.x; i < src.getSize(); i += blockDim.x ) {
+      const Value& data = src[ i ];
+      if( Cmp( data, pivot ) ) {
+         /*
+         if(smallerStart >= dst.getSize() || smallerStart < 0)
+             printf("failed smaller: b:%d t:%d: tried to write into [%d]/%d\n", blockDim.x, threadIdx.x, smallerStart,
+         dst.getSize());
+         */
+         dst[ smallerStart++ ] = data;
+      }
+      else if( Cmp( pivot, data ) ) {
+         /*
+         if(biggerStart >= dst.getSize() || biggerStart < 0)
+             printf("failed bigger: b:%d t:%d: tried to write into [%d]/%d\n", blockDim.x, threadIdx.x, biggerStart,
+         dst.getSize());
+         */
+         dst[ biggerStart++ ] = data;
+      }
+   }
 }
 
 //----------------------------------------------------------------------------------
 
-template <typename Value, typename CMP, bool useShared>
-__device__ void cudaPartition( Containers::ArrayView<Value, Devices::Cuda> src,
-                               Containers::ArrayView<Value, Devices::Cuda> dst,
-                               const CMP &Cmp,
-                               Value *sharedMem,
-                               const Value &pivot,
-                               int elemPerBlock, TASK &task)
+template< typename Value, typename CMP, bool useShared >
+__device__
+void
+cudaPartition( Containers::ArrayView< Value, Devices::Cuda > src,
+               Containers::ArrayView< Value, Devices::Cuda > dst,
+               const CMP& Cmp,
+               Value* sharedMem,
+               const Value& pivot,
+               int elemPerBlock,
+               TASK& task )
 {
-    static __shared__ int smallerStart, biggerStart;
-
-    int myBegin = elemPerBlock * (blockIdx.x - task.firstBlock);
-    int myEnd = TNL::min(myBegin + elemPerBlock, src.getSize());
-
-    auto srcView = src.getView(myBegin, myEnd);
-
-    //-------------------------------------------------------------------------
-
-    int smaller = 0, bigger = 0;
-    countElem(srcView, Cmp, smaller, bigger, pivot);
-
-    //synchronization is in this function already
-    using BlockScan = Algorithms::detail::CudaBlockScan< Algorithms::detail::ScanType::Inclusive, 0, TNL::Plus, int >;
-    __shared__ typename BlockScan::Storage storage;
-    int smallerPrefSumInc = BlockScan::scan( TNL::Plus{}, 0, smaller, threadIdx.x, storage );
-    int biggerPrefSumInc = BlockScan::scan( TNL::Plus{}, 0, bigger, threadIdx.x, storage );
-
-    if (threadIdx.x == blockDim.x - 1) //last thread in block has sum of all values
-    {
-        smallerStart = atomicAdd(&(task.dstBegin), smallerPrefSumInc);
-        biggerStart = atomicAdd(&(task.dstEnd), -biggerPrefSumInc) - biggerPrefSumInc;
-    }
-    __syncthreads();
-
-    //-----------------------------------------------------------
-    if (useShared)
-    {
-        static __shared__ int smallerTotal, biggerTotal;
-        if (threadIdx.x == blockDim.x - 1)
-        {
-            smallerTotal = smallerPrefSumInc;
-            biggerTotal = biggerPrefSumInc;
-        }
-        __syncthreads();
-
-        copyDataShared(srcView, dst, Cmp, sharedMem,
-                       smallerStart, biggerStart,
-                       smallerTotal, biggerTotal,
-                       smallerPrefSumInc - smaller, biggerPrefSumInc - bigger, //exclusive prefix sum of elements
-                       pivot);
-    }
-    else
-    {
-        int destSmaller = smallerStart + smallerPrefSumInc - smaller;
-        int destBigger = biggerStart + biggerPrefSumInc - bigger;
-        copyData(srcView, dst, Cmp, destSmaller, destBigger, pivot);
-    }
+   static __shared__ int smallerStart, biggerStart;
+
+   int myBegin = elemPerBlock * ( blockIdx.x - task.firstBlock );
+   int myEnd = TNL::min( myBegin + elemPerBlock, src.getSize() );
+
+   auto srcView = src.getView( myBegin, myEnd );
+
+   //-------------------------------------------------------------------------
+
+   int smaller = 0, bigger = 0;
+   countElem( srcView, Cmp, smaller, bigger, pivot );
+
+   // synchronization is in this function already
+   using BlockScan = Algorithms::detail::CudaBlockScan< Algorithms::detail::ScanType::Inclusive, 0, TNL::Plus, int >;
+   __shared__ typename BlockScan::Storage storage;
+   int smallerPrefSumInc = BlockScan::scan( TNL::Plus{}, 0, smaller, threadIdx.x, storage );
+   int biggerPrefSumInc = BlockScan::scan( TNL::Plus{}, 0, bigger, threadIdx.x, storage );
+
+   if( threadIdx.x == blockDim.x - 1 )  // last thread in block has sum of all values
+   {
+      smallerStart = atomicAdd( &( task.dstBegin ), smallerPrefSumInc );
+      biggerStart = atomicAdd( &( task.dstEnd ), -biggerPrefSumInc ) - biggerPrefSumInc;
+   }
+   __syncthreads();
+
+   //-----------------------------------------------------------
+   if( useShared ) {
+      static __shared__ int smallerTotal, biggerTotal;
+      if( threadIdx.x == blockDim.x - 1 ) {
+         smallerTotal = smallerPrefSumInc;
+         biggerTotal = biggerPrefSumInc;
+      }
+      __syncthreads();
+
+      copyDataShared( srcView,
+                      dst,
+                      Cmp,
+                      sharedMem,
+                      smallerStart,
+                      biggerStart,
+                      smallerTotal,
+                      biggerTotal,
+                      smallerPrefSumInc - smaller,
+                      biggerPrefSumInc - bigger,  // exclusive prefix sum of elements
+                      pivot );
+   }
+   else {
+      int destSmaller = smallerStart + smallerPrefSumInc - smaller;
+      int destBigger = biggerStart + biggerPrefSumInc - bigger;
+      copyData( srcView, dst, Cmp, destSmaller, destBigger, pivot );
+   }
 }
 
 #endif
 
-      } // namespace Sorting
-   } // namespace Algorithms
-} // namespace TNL
+}  // namespace Sorting
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Sorting/detail/helpers.h b/src/TNL/Algorithms/Sorting/detail/helpers.h
index 4c317f10f50f9e63ccbd3495b6b858bf648a05e3..747bb5853658fb5b853207984bf093b4100a1d2a 100644
--- a/src/TNL/Algorithms/Sorting/detail/helpers.h
+++ b/src/TNL/Algorithms/Sorting/detail/helpers.h
@@ -10,46 +10,53 @@
 #include <TNL/Math.h>
 
 namespace TNL {
-    namespace Algorithms {
-        namespace Sorting {
+namespace Algorithms {
+namespace Sorting {
 
 #ifdef HAVE_CUDA
 
 // Inline PTX call to return index of highest non-zero bit in a word
-static __device__ __forceinline__ unsigned int __btflo(unsigned int word)
+static __device__
+__forceinline__ unsigned int
+__btflo( unsigned int word )
 {
-    unsigned int ret;
-    asm volatile("bfind.u32 %0, %1;"
-                 : "=r"(ret)
-                 : "r"(word));
-    return ret;
+   unsigned int ret;
+   asm volatile( "bfind.u32 %0, %1;" : "=r"( ret ) : "r"( word ) );
+   return ret;
 }
 
-__device__ int closestPow2_ptx(int bitonicLen)
+__device__
+int
+closestPow2_ptx( int bitonicLen )
 {
-    return 1 << (__btflo((unsigned)bitonicLen - 1U) + 1);
+   return 1 << ( __btflo( (unsigned) bitonicLen - 1U ) + 1 );
 }
 
-__host__ __device__ int closestPow2(int x)
+__host__
+__device__
+int
+closestPow2( int x )
 {
-    if (x == 0)
-        return 0;
+   if( x == 0 )
+      return 0;
 
-    int ret = 1;
-    while (ret < x)
-        ret <<= 1;
+   int ret = 1;
+   while( ret < x )
+      ret <<= 1;
 
-    return ret;
+   return ret;
 }
 
-template <typename Value, typename CMP>
-__cuda_callable__ void cmpSwap(Value &a, Value &b, bool ascending, const CMP &Cmp)
+template< typename Value, typename CMP >
+__cuda_callable__
+void
+cmpSwap( Value& a, Value& b, bool ascending, const CMP& Cmp )
 {
-    if (ascending == Cmp(b, a))
-        TNL::swap(a, b);
+   if( ascending == Cmp( b, a ) )
+      TNL::swap( a, b );
 }
 
 #endif
-        } //namespace Sorting
-    } //namespace Algorithms
-} // namespace TNL
\ No newline at end of file
+}  // namespace Sorting
+}  // namespace Algorithms
+}  // namespace TNL
\ No newline at end of file
diff --git a/src/TNL/Algorithms/Sorting/detail/quicksort_1Block.h b/src/TNL/Algorithms/Sorting/detail/quicksort_1Block.h
index 08c5796a1ea59da847d9d72c639dfd1ed0fd64dc..85a63ece539cb4fbf8f989ece4c02aac2f30bcb2 100644
--- a/src/TNL/Algorithms/Sorting/detail/quicksort_1Block.h
+++ b/src/TNL/Algorithms/Sorting/detail/quicksort_1Block.h
@@ -14,239 +14,249 @@
 #include <TNL/Algorithms/detail/CudaScanKernel.h>
 
 namespace TNL {
-    namespace Algorithms {
-        namespace Sorting {
+namespace Algorithms {
+namespace Sorting {
 
 #ifdef HAVE_CUDA
 
-template <typename Value, typename CMP>
-__device__ void externSort( Containers::ArrayView<Value, TNL::Devices::Cuda> src,
-                            Containers::ArrayView<Value, TNL::Devices::Cuda> dst,
-                            const CMP &Cmp, Value *sharedMem)
+template< typename Value, typename CMP >
+__device__
+void
+externSort( Containers::ArrayView< Value, TNL::Devices::Cuda > src,
+            Containers::ArrayView< Value, TNL::Devices::Cuda > dst,
+            const CMP& Cmp,
+            Value* sharedMem )
 {
-    bitonicSort_Block(src, dst, sharedMem, Cmp);
+   bitonicSort_Block( src, dst, sharedMem, Cmp );
 }
 
-template <typename Value, typename CMP>
-__device__ void externSort( Containers::ArrayView<Value, TNL::Devices::Cuda> src,
-                            const CMP &Cmp)
+template< typename Value, typename CMP >
+__device__
+void
+externSort( Containers::ArrayView< Value, TNL::Devices::Cuda > src, const CMP& Cmp )
 {
-    bitonicSort_Block(src, Cmp);
+   bitonicSort_Block( src, Cmp );
 }
 
 //---------------------------------------------------------------
 
-template <int stackSize>
-__device__ void stackPush(int stackArrBegin[], int stackArrEnd[],
-                          int stackDepth[], int &stackTop,
-                          int begin, int pivotBegin,
-                          int pivotEnd, int end,
-                          int iteration);
+template< int stackSize >
+__device__
+void
+stackPush( int stackArrBegin[],
+           int stackArrEnd[],
+           int stackDepth[],
+           int& stackTop,
+           int begin,
+           int pivotBegin,
+           int pivotEnd,
+           int end,
+           int iteration );
 
 //---------------------------------------------------------------
 
-template <typename Value, typename CMP, int stackSize, bool useShared>
-__device__ void singleBlockQuickSort( Containers::ArrayView<Value, TNL::Devices::Cuda> arr,
-                                      Containers::ArrayView<Value, TNL::Devices::Cuda> aux,
-                                      const CMP &Cmp, int _iteration,
-                                      Value *sharedMem, int memSize,
-                                      int maxBitonicSize)
+template< typename Value, typename CMP, int stackSize, bool useShared >
+__device__
+void
+singleBlockQuickSort( Containers::ArrayView< Value, TNL::Devices::Cuda > arr,
+                      Containers::ArrayView< Value, TNL::Devices::Cuda > aux,
+                      const CMP& Cmp,
+                      int _iteration,
+                      Value* sharedMem,
+                      int memSize,
+                      int maxBitonicSize )
 {
-    if (arr.getSize() <= maxBitonicSize)
-    {
-        auto &src = (_iteration & 1) == 0 ? arr : aux;
-        if (useShared && arr.getSize() <= memSize)
-            externSort<Value, CMP>(src, arr, Cmp, sharedMem);
-        else
-        {
-            externSort<Value, CMP>(src, Cmp);
-            //extern sort without shared memory only works in-place, need to copy into from aux
-            if ((_iteration & 1) != 0)
-                for (int i = threadIdx.x; i < arr.getSize(); i += blockDim.x)
-                    arr[i] = src[i];
-        }
-
-        return;
-    }
-
-    static __shared__ int stackTop;
-    static __shared__ int stackArrBegin[stackSize], stackArrEnd[stackSize], stackDepth[stackSize];
-    static __shared__ int begin, end, iteration;
-    static __shared__ int pivotBegin, pivotEnd;
-    Value *piv = sharedMem;
-    sharedMem += 1;
-
-    if (threadIdx.x == 0)
-    {
-        stackTop = 0;
-        stackArrBegin[stackTop] = 0;
-        stackArrEnd[stackTop] = arr.getSize();
-        stackDepth[stackTop] = _iteration;
-        stackTop++;
-    }
-    __syncthreads();
-
-    while (stackTop > 0)
-    {
-        //pick up partition to break up
-        if (threadIdx.x == 0)
-        {
-            begin = stackArrBegin[stackTop - 1];
-            end = stackArrEnd[stackTop - 1];
-            iteration = stackDepth[stackTop - 1];
-            stackTop--;
-        }
-        __syncthreads();
-
-        int size = end - begin;
-        auto &src = (iteration & 1) == 0 ? arr : aux;
-
-        //small enough for for bitonic
-        if (size <= maxBitonicSize)
-        {
-            if (useShared && size <= memSize)
-                externSort<Value, CMP>(src.getView(begin, end), arr.getView(begin, end), Cmp, sharedMem);
-            else
-            {
-                externSort<Value, CMP>(src.getView(begin, end), Cmp);
-                //extern sort without shared memory only works in-place, need to copy into from aux
-                if ((iteration & 1) != 0)
-                    for (int i = threadIdx.x; i < src.getSize(); i += blockDim.x)
-                        arr[begin + i] = src[i];
-            }
-            __syncthreads();
-            continue;
-        }
-
-        //------------------------------------------------------
-
-        if (threadIdx.x == 0)
-            *piv = pickPivot(src.getView(begin, end), Cmp);
-        __syncthreads();
-        Value &pivot = *piv;
-
-        int smaller = 0, bigger = 0;
-        countElem(src.getView(begin, end), Cmp, smaller, bigger, pivot);
-
-        //synchronization is in this function already
-        using BlockScan = Algorithms::detail::CudaBlockScan< Algorithms::detail::ScanType::Inclusive, 0, TNL::Plus, int >;
-        __shared__ typename BlockScan::Storage storage;
-        int smallerPrefSumInc = BlockScan::scan( TNL::Plus{}, 0, smaller, threadIdx.x, storage );
-        int biggerPrefSumInc = BlockScan::scan( TNL::Plus{}, 0, bigger, threadIdx.x, storage );
-
-        if (threadIdx.x == blockDim.x - 1) //has sum of all smaller and greater elements than pivot in src
-        {
-            pivotBegin = 0 + smallerPrefSumInc;
-            pivotEnd = size - biggerPrefSumInc;
-        }
-        __syncthreads();
-
-        //--------------------------------------------------------------
-        /**
-         * move elements, either use shared mem for coalesced access or without shared mem if data is too big
-         * */
-
-        auto &dst = (iteration & 1) == 0 ? aux : arr;
-
-        if (useShared && size <= memSize)
-        {
-            static __shared__ int smallerTotal, biggerTotal;
-            if (threadIdx.x == blockDim.x - 1)
-            {
-                smallerTotal = smallerPrefSumInc;
-                biggerTotal = biggerPrefSumInc;
-            }
-            __syncthreads();
-
-            copyDataShared(src.getView(begin, end), dst.getView(begin, end),
-                           Cmp, sharedMem,
-                           0, pivotEnd,
-                           smallerTotal, biggerTotal,
-                           smallerPrefSumInc - smaller, biggerPrefSumInc - bigger, //exclusive prefix sum of elements
-                           pivot);
-        }
-        else
-        {
-            int destSmaller = 0 + (smallerPrefSumInc - smaller);
-            int destBigger = pivotEnd + (biggerPrefSumInc - bigger);
-
-            copyData(src.getView(begin, end), dst.getView(begin, end), Cmp, destSmaller, destBigger, pivot);
-        }
-
-        __syncthreads();
-
-        for (int i = pivotBegin + threadIdx.x; i < pivotEnd; i += blockDim.x)
-            arr[begin + i] = pivot;
-
-        //creates new tasks
-        if (threadIdx.x == 0)
-        {
-            stackPush<stackSize>(stackArrBegin, stackArrEnd, stackDepth, stackTop,
-                                 begin, begin + pivotBegin,
-                                 begin + pivotEnd, end,
-                                 iteration);
-        }
-        __syncthreads(); //sync to update stackTop
-    }                    //ends while loop
+   if( arr.getSize() <= maxBitonicSize ) {
+      auto& src = ( _iteration & 1 ) == 0 ? arr : aux;
+      if( useShared && arr.getSize() <= memSize )
+         externSort< Value, CMP >( src, arr, Cmp, sharedMem );
+      else {
+         externSort< Value, CMP >( src, Cmp );
+         // extern sort without shared memory only works in-place, need to copy into from aux
+         if( ( _iteration & 1 ) != 0 )
+            for( int i = threadIdx.x; i < arr.getSize(); i += blockDim.x )
+               arr[ i ] = src[ i ];
+      }
+
+      return;
+   }
+
+   static __shared__ int stackTop;
+   static __shared__ int stackArrBegin[ stackSize ], stackArrEnd[ stackSize ], stackDepth[ stackSize ];
+   static __shared__ int begin, end, iteration;
+   static __shared__ int pivotBegin, pivotEnd;
+   Value* piv = sharedMem;
+   sharedMem += 1;
+
+   if( threadIdx.x == 0 ) {
+      stackTop = 0;
+      stackArrBegin[ stackTop ] = 0;
+      stackArrEnd[ stackTop ] = arr.getSize();
+      stackDepth[ stackTop ] = _iteration;
+      stackTop++;
+   }
+   __syncthreads();
+
+   while( stackTop > 0 ) {
+      // pick up partition to break up
+      if( threadIdx.x == 0 ) {
+         begin = stackArrBegin[ stackTop - 1 ];
+         end = stackArrEnd[ stackTop - 1 ];
+         iteration = stackDepth[ stackTop - 1 ];
+         stackTop--;
+      }
+      __syncthreads();
+
+      int size = end - begin;
+      auto& src = ( iteration & 1 ) == 0 ? arr : aux;
+
+      // small enough for for bitonic
+      if( size <= maxBitonicSize ) {
+         if( useShared && size <= memSize )
+            externSort< Value, CMP >( src.getView( begin, end ), arr.getView( begin, end ), Cmp, sharedMem );
+         else {
+            externSort< Value, CMP >( src.getView( begin, end ), Cmp );
+            // extern sort without shared memory only works in-place, need to copy into from aux
+            if( ( iteration & 1 ) != 0 )
+               for( int i = threadIdx.x; i < src.getSize(); i += blockDim.x )
+                  arr[ begin + i ] = src[ i ];
+         }
+         __syncthreads();
+         continue;
+      }
+
+      //------------------------------------------------------
+
+      if( threadIdx.x == 0 )
+         *piv = pickPivot( src.getView( begin, end ), Cmp );
+      __syncthreads();
+      Value& pivot = *piv;
+
+      int smaller = 0, bigger = 0;
+      countElem( src.getView( begin, end ), Cmp, smaller, bigger, pivot );
+
+      // synchronization is in this function already
+      using BlockScan = Algorithms::detail::CudaBlockScan< Algorithms::detail::ScanType::Inclusive, 0, TNL::Plus, int >;
+      __shared__ typename BlockScan::Storage storage;
+      int smallerPrefSumInc = BlockScan::scan( TNL::Plus{}, 0, smaller, threadIdx.x, storage );
+      int biggerPrefSumInc = BlockScan::scan( TNL::Plus{}, 0, bigger, threadIdx.x, storage );
+
+      if( threadIdx.x == blockDim.x - 1 )  // has sum of all smaller and greater elements than pivot in src
+      {
+         pivotBegin = 0 + smallerPrefSumInc;
+         pivotEnd = size - biggerPrefSumInc;
+      }
+      __syncthreads();
+
+      //--------------------------------------------------------------
+      /**
+       * move elements, either use shared mem for coalesced access or without shared mem if data is too big
+       * */
+
+      auto& dst = ( iteration & 1 ) == 0 ? aux : arr;
+
+      if( useShared && size <= memSize ) {
+         static __shared__ int smallerTotal, biggerTotal;
+         if( threadIdx.x == blockDim.x - 1 ) {
+            smallerTotal = smallerPrefSumInc;
+            biggerTotal = biggerPrefSumInc;
+         }
+         __syncthreads();
+
+         copyDataShared( src.getView( begin, end ),
+                         dst.getView( begin, end ),
+                         Cmp,
+                         sharedMem,
+                         0,
+                         pivotEnd,
+                         smallerTotal,
+                         biggerTotal,
+                         smallerPrefSumInc - smaller,
+                         biggerPrefSumInc - bigger,  // exclusive prefix sum of elements
+                         pivot );
+      }
+      else {
+         int destSmaller = 0 + ( smallerPrefSumInc - smaller );
+         int destBigger = pivotEnd + ( biggerPrefSumInc - bigger );
+
+         copyData( src.getView( begin, end ), dst.getView( begin, end ), Cmp, destSmaller, destBigger, pivot );
+      }
+
+      __syncthreads();
+
+      for( int i = pivotBegin + threadIdx.x; i < pivotEnd; i += blockDim.x )
+         arr[ begin + i ] = pivot;
+
+      // creates new tasks
+      if( threadIdx.x == 0 ) {
+         stackPush< stackSize >(
+            stackArrBegin, stackArrEnd, stackDepth, stackTop, begin, begin + pivotBegin, begin + pivotEnd, end, iteration );
+      }
+      __syncthreads();  // sync to update stackTop
+   }                    // ends while loop
 }
 
 //--------------------------------------------------------------
 
-template <int stackSize>
-__device__ void stackPush(int stackArrBegin[], int stackArrEnd[],
-                          int stackDepth[], int &stackTop,
-                          int begin, int pivotBegin,
-                          int pivotEnd, int end,
-                          int iteration)
+template< int stackSize >
+__device__
+void
+stackPush( int stackArrBegin[],
+           int stackArrEnd[],
+           int stackDepth[],
+           int& stackTop,
+           int begin,
+           int pivotBegin,
+           int pivotEnd,
+           int end,
+           int iteration )
 {
-    int sizeL = pivotBegin - begin, sizeR = end - pivotEnd;
-
-    //push the bigger one 1st and then smaller one 2nd
-    //in next iteration, the smaller part will be handled 1st
-    if (sizeL > sizeR)
-    {
-        if (sizeL > 0) //left from pivot are smaller elems
-        {
-            stackArrBegin[stackTop] = begin;
-            stackArrEnd[stackTop] = pivotBegin;
-            stackDepth[stackTop] = iteration + 1;
-            stackTop++;
-        }
-
-        if (sizeR > 0) //right from pivot until end are elem greater than pivot
-        {
-            assert(stackTop < stackSize && "Local quicksort stack overflow.");
-
-            stackArrBegin[stackTop] = pivotEnd;
-            stackArrEnd[stackTop] = end;
-            stackDepth[stackTop] = iteration + 1;
-            stackTop++;
-        }
-    }
-    else
-    {
-        if (sizeR > 0) //right from pivot until end are elem greater than pivot
-        {
-            stackArrBegin[stackTop] = pivotEnd;
-            stackArrEnd[stackTop] = end;
-            stackDepth[stackTop] = iteration + 1;
-            stackTop++;
-        }
-
-        if (sizeL > 0) //left from pivot are smaller elems
-        {
-            assert(stackTop < stackSize && "Local quicksort stack overflow.");
-
-            stackArrBegin[stackTop] = begin;
-            stackArrEnd[stackTop] = pivotBegin;
-            stackDepth[stackTop] = iteration + 1;
-            stackTop++;
-        }
-    }
+   int sizeL = pivotBegin - begin, sizeR = end - pivotEnd;
+
+   // push the bigger one 1st and then smaller one 2nd
+   // in next iteration, the smaller part will be handled 1st
+   if( sizeL > sizeR ) {
+      if( sizeL > 0 )  // left from pivot are smaller elems
+      {
+         stackArrBegin[ stackTop ] = begin;
+         stackArrEnd[ stackTop ] = pivotBegin;
+         stackDepth[ stackTop ] = iteration + 1;
+         stackTop++;
+      }
+
+      if( sizeR > 0 )  // right from pivot until end are elem greater than pivot
+      {
+         assert( stackTop < stackSize && "Local quicksort stack overflow." );
+
+         stackArrBegin[ stackTop ] = pivotEnd;
+         stackArrEnd[ stackTop ] = end;
+         stackDepth[ stackTop ] = iteration + 1;
+         stackTop++;
+      }
+   }
+   else {
+      if( sizeR > 0 )  // right from pivot until end are elem greater than pivot
+      {
+         stackArrBegin[ stackTop ] = pivotEnd;
+         stackArrEnd[ stackTop ] = end;
+         stackDepth[ stackTop ] = iteration + 1;
+         stackTop++;
+      }
+
+      if( sizeL > 0 )  // left from pivot are smaller elems
+      {
+         assert( stackTop < stackSize && "Local quicksort stack overflow." );
+
+         stackArrBegin[ stackTop ] = begin;
+         stackArrEnd[ stackTop ] = pivotBegin;
+         stackDepth[ stackTop ] = iteration + 1;
+         stackTop++;
+      }
+   }
 }
 
 #endif
 
-        } // namespace Sorting
-    } // namespace Algorithms
-} // namespace TNL
+}  // namespace Sorting
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Sorting/detail/quicksort_kernel.h b/src/TNL/Algorithms/Sorting/detail/quicksort_kernel.h
index 9d341a5ef9cb8557b6f0ee78d2595010482c2571..aad9b0c7bb9ed2341b68b52d332ac60fd4063da8 100644
--- a/src/TNL/Algorithms/Sorting/detail/quicksort_kernel.h
+++ b/src/TNL/Algorithms/Sorting/detail/quicksort_kernel.h
@@ -13,249 +13,288 @@
 #include <TNL/Algorithms/Sorting/detail/cudaPartition.h>
 #include <TNL/Algorithms/Sorting/detail/quicksort_1Block.h>
 
-
 namespace TNL {
-   namespace Algorithms {
-      namespace Sorting {
+namespace Algorithms {
+namespace Sorting {
 
 #ifdef HAVE_CUDA
 
-__device__ void writeNewTask(int begin, int end, int iteration, int maxElemFor2ndPhase,
-                             Containers::ArrayView<TASK, Devices::Cuda> newTasks, int *newTasksCnt,
-                             Containers::ArrayView<TASK, Devices::Cuda> secondPhaseTasks, int *secondPhaseTasksCnt);
+__device__
+void
+writeNewTask( int begin,
+              int end,
+              int iteration,
+              int maxElemFor2ndPhase,
+              Containers::ArrayView< TASK, Devices::Cuda > newTasks,
+              int* newTasksCnt,
+              Containers::ArrayView< TASK, Devices::Cuda > secondPhaseTasks,
+              int* secondPhaseTasksCnt );
 
 //-----------------------------------------------------------
 
-__global__ void cudaCalcBlocksNeeded(Containers::ArrayView<TASK, Devices::Cuda> cuda_tasks, int elemPerBlock,
-                                     Containers::ArrayView<int, Devices::Cuda> blocksNeeded)
+__global__
+void
+cudaCalcBlocksNeeded( Containers::ArrayView< TASK, Devices::Cuda > cuda_tasks,
+                      int elemPerBlock,
+                      Containers::ArrayView< int, Devices::Cuda > blocksNeeded )
 {
-    int i = blockIdx.x * blockDim.x + threadIdx.x;
-    if (i >= cuda_tasks.getSize())
-        return;
+   int i = blockIdx.x * blockDim.x + threadIdx.x;
+   if( i >= cuda_tasks.getSize() )
+      return;
 
-    TASK &task = cuda_tasks[i];
-    int size = task.partitionEnd - task.partitionBegin;
-    blocksNeeded[i] = size / elemPerBlock + (size % elemPerBlock != 0);
+   TASK& task = cuda_tasks[ i ];
+   int size = task.partitionEnd - task.partitionBegin;
+   blocksNeeded[ i ] = size / elemPerBlock + ( size % elemPerBlock != 0 );
 }
 
 //-----------------------------------------------------------
 
-template <typename Value, typename CMP>
-__global__ void cudaInitTask(Containers::ArrayView<TASK, Devices::Cuda> cuda_tasks,
-                             Containers::ArrayView<int, Devices::Cuda> cuda_blockToTaskMapping,
-                             Containers::ArrayView<int, Devices::Cuda> cuda_reductionTaskInitMem,
-                             Containers::ArrayView<Value, Devices::Cuda> src, CMP Cmp)
+template< typename Value, typename CMP >
+__global__
+void
+cudaInitTask( Containers::ArrayView< TASK, Devices::Cuda > cuda_tasks,
+              Containers::ArrayView< int, Devices::Cuda > cuda_blockToTaskMapping,
+              Containers::ArrayView< int, Devices::Cuda > cuda_reductionTaskInitMem,
+              Containers::ArrayView< Value, Devices::Cuda > src,
+              CMP Cmp )
 {
-    if (blockIdx.x >= cuda_tasks.getSize())
-        return;
-
-    int start = blockIdx.x == 0 ? 0 : cuda_reductionTaskInitMem[blockIdx.x - 1];
-    int end = cuda_reductionTaskInitMem[blockIdx.x];
-    for (int i = start + threadIdx.x; i < end; i += blockDim.x)
-        cuda_blockToTaskMapping[i] = blockIdx.x;
-
-    if (threadIdx.x == 0)
-    {
-        TASK &task = cuda_tasks[blockIdx.x];
-        int pivotIdx = task.partitionBegin + pickPivotIdx(src.getView(task.partitionBegin, task.partitionEnd), Cmp);
-        task.initTask(start, end - start, pivotIdx);
-    }
+   if( blockIdx.x >= cuda_tasks.getSize() )
+      return;
+
+   int start = blockIdx.x == 0 ? 0 : cuda_reductionTaskInitMem[ blockIdx.x - 1 ];
+   int end = cuda_reductionTaskInitMem[ blockIdx.x ];
+   for( int i = start + threadIdx.x; i < end; i += blockDim.x )
+      cuda_blockToTaskMapping[ i ] = blockIdx.x;
+
+   if( threadIdx.x == 0 ) {
+      TASK& task = cuda_tasks[ blockIdx.x ];
+      int pivotIdx = task.partitionBegin + pickPivotIdx( src.getView( task.partitionBegin, task.partitionEnd ), Cmp );
+      task.initTask( start, end - start, pivotIdx );
+   }
 }
 
 //----------------------------------------------------
 
-template <typename Value, typename CMP, bool useShared>
-__global__ void cudaQuickSort1stPhase(Containers::ArrayView<Value, Devices::Cuda> arr, Containers::ArrayView<Value, Devices::Cuda> aux,
-                                      const CMP &Cmp, int elemPerBlock,
-                                      Containers::ArrayView<TASK, Devices::Cuda> tasks,
-                                      Containers::ArrayView<int, Devices::Cuda> taskMapping)
+template< typename Value, typename CMP, bool useShared >
+__global__
+void
+cudaQuickSort1stPhase( Containers::ArrayView< Value, Devices::Cuda > arr,
+                       Containers::ArrayView< Value, Devices::Cuda > aux,
+                       const CMP& Cmp,
+                       int elemPerBlock,
+                       Containers::ArrayView< TASK, Devices::Cuda > tasks,
+                       Containers::ArrayView< int, Devices::Cuda > taskMapping )
 {
-    extern __shared__ int externMem[];
-    Value *piv = (Value *)externMem;
-    Value *sharedMem = piv + 1;
-
-    TASK &myTask = tasks[taskMapping[blockIdx.x]];
-    auto &src = (myTask.iteration & 1) == 0 ? arr : aux;
-    auto &dst = (myTask.iteration & 1) == 0 ? aux : arr;
-
-    if (threadIdx.x == 0)
-        *piv = src[myTask.pivotIdx];
-    __syncthreads();
-    Value &pivot = *piv;
-
-    cudaPartition<Value, CMP, useShared>(
-        src.getView(myTask.partitionBegin, myTask.partitionEnd),
-        dst.getView(myTask.partitionBegin, myTask.partitionEnd),
-        Cmp, sharedMem, pivot,
-        elemPerBlock, myTask);
+   extern __shared__ int externMem[];
+   Value* piv = (Value*) externMem;
+   Value* sharedMem = piv + 1;
+
+   TASK& myTask = tasks[ taskMapping[ blockIdx.x ] ];
+   auto& src = ( myTask.iteration & 1 ) == 0 ? arr : aux;
+   auto& dst = ( myTask.iteration & 1 ) == 0 ? aux : arr;
+
+   if( threadIdx.x == 0 )
+      *piv = src[ myTask.pivotIdx ];
+   __syncthreads();
+   Value& pivot = *piv;
+
+   cudaPartition< Value, CMP, useShared >( src.getView( myTask.partitionBegin, myTask.partitionEnd ),
+                                           dst.getView( myTask.partitionBegin, myTask.partitionEnd ),
+                                           Cmp,
+                                           sharedMem,
+                                           pivot,
+                                           elemPerBlock,
+                                           myTask );
 }
 
 //----------------------------------------------------
 
-template <typename Value>
-__global__ void cudaWritePivot(Containers::ArrayView<Value, Devices::Cuda> arr, Containers::ArrayView<Value, Devices::Cuda> aux, int maxElemFor2ndPhase,
-                               Containers::ArrayView<TASK, Devices::Cuda> tasks, Containers::ArrayView<TASK, Devices::Cuda> newTasks, int *newTasksCnt,
-                               Containers::ArrayView<TASK, Devices::Cuda> secondPhaseTasks, int *secondPhaseTasksCnt)
+template< typename Value >
+__global__
+void
+cudaWritePivot( Containers::ArrayView< Value, Devices::Cuda > arr,
+                Containers::ArrayView< Value, Devices::Cuda > aux,
+                int maxElemFor2ndPhase,
+                Containers::ArrayView< TASK, Devices::Cuda > tasks,
+                Containers::ArrayView< TASK, Devices::Cuda > newTasks,
+                int* newTasksCnt,
+                Containers::ArrayView< TASK, Devices::Cuda > secondPhaseTasks,
+                int* secondPhaseTasksCnt )
 {
-    extern __shared__ int externMem[];
-    Value *piv = (Value *)externMem;
-
-    TASK &myTask = tasks[blockIdx.x];
-
-    if (threadIdx.x == 0)
-        *piv = (myTask.iteration & 1) == 0 ? arr[myTask.pivotIdx] : aux[myTask.pivotIdx];
-    __syncthreads();
-    Value &pivot = *piv;
-
-    int leftBegin = myTask.partitionBegin, leftEnd = myTask.partitionBegin + myTask.dstBegin;
-    int rightBegin = myTask.partitionBegin + myTask.dstEnd, rightEnd = myTask.partitionEnd;
-
-    for (int i = leftEnd + threadIdx.x; i < rightBegin; i += blockDim.x)
-    {
-        /*
-        #ifdef DEBUG
-        aux[i] = -1;
-        #endif
-        */
-        arr[i] = pivot;
-    }
-
-    if (threadIdx.x != 0)
-        return;
-
-    if (leftEnd - leftBegin > 0)
-    {
-        writeNewTask(leftBegin, leftEnd, myTask.iteration,
-                     maxElemFor2ndPhase,
-                     newTasks, newTasksCnt,
-                     secondPhaseTasks, secondPhaseTasksCnt);
-    }
-
-    if (rightEnd - rightBegin > 0)
-    {
-        writeNewTask(rightBegin, rightEnd,
-                     myTask.iteration, maxElemFor2ndPhase,
-                     newTasks, newTasksCnt,
-                     secondPhaseTasks, secondPhaseTasksCnt);
-    }
+   extern __shared__ int externMem[];
+   Value* piv = (Value*) externMem;
+
+   TASK& myTask = tasks[ blockIdx.x ];
+
+   if( threadIdx.x == 0 )
+      *piv = ( myTask.iteration & 1 ) == 0 ? arr[ myTask.pivotIdx ] : aux[ myTask.pivotIdx ];
+   __syncthreads();
+   Value& pivot = *piv;
+
+   int leftBegin = myTask.partitionBegin, leftEnd = myTask.partitionBegin + myTask.dstBegin;
+   int rightBegin = myTask.partitionBegin + myTask.dstEnd, rightEnd = myTask.partitionEnd;
+
+   for( int i = leftEnd + threadIdx.x; i < rightBegin; i += blockDim.x ) {
+      /*
+      #ifdef DEBUG
+      aux[i] = -1;
+      #endif
+      */
+      arr[ i ] = pivot;
+   }
+
+   if( threadIdx.x != 0 )
+      return;
+
+   if( leftEnd - leftBegin > 0 ) {
+      writeNewTask( leftBegin,
+                    leftEnd,
+                    myTask.iteration,
+                    maxElemFor2ndPhase,
+                    newTasks,
+                    newTasksCnt,
+                    secondPhaseTasks,
+                    secondPhaseTasksCnt );
+   }
+
+   if( rightEnd - rightBegin > 0 ) {
+      writeNewTask( rightBegin,
+                    rightEnd,
+                    myTask.iteration,
+                    maxElemFor2ndPhase,
+                    newTasks,
+                    newTasksCnt,
+                    secondPhaseTasks,
+                    secondPhaseTasksCnt );
+   }
 }
 
 //-----------------------------------------------------------
 
-__device__ void writeNewTask(int begin, int end, int iteration, int maxElemFor2ndPhase,
-                             Containers::ArrayView<TASK, Devices::Cuda> newTasks, int *newTasksCnt,
-                             Containers::ArrayView<TASK, Devices::Cuda> secondPhaseTasks, int *secondPhaseTasksCnt)
+__device__
+void
+writeNewTask( int begin,
+              int end,
+              int iteration,
+              int maxElemFor2ndPhase,
+              Containers::ArrayView< TASK, Devices::Cuda > newTasks,
+              int* newTasksCnt,
+              Containers::ArrayView< TASK, Devices::Cuda > secondPhaseTasks,
+              int* secondPhaseTasksCnt )
 {
-    int size = end - begin;
-    if (size < 0)
-    {
-        printf("negative size, something went really wrong\n");
-        return;
-    }
-
-    if (size == 0)
-        return;
-
-    if (size <= maxElemFor2ndPhase)
-    {
-        int idx = atomicAdd(secondPhaseTasksCnt, 1);
-        if (idx < secondPhaseTasks.getSize())
-            secondPhaseTasks[idx] = TASK(begin, end, iteration + 1);
-        else
-        {
-            //printf("ran out of memory, trying backup\n");
-            int idx = atomicAdd(newTasksCnt, 1);
-            if (idx < newTasks.getSize())
-                newTasks[idx] = TASK(begin, end, iteration + 1);
-            else
-                printf("ran out of memory for second phase task, there isnt even space in newTask list\nPart of array may stay unsorted!!!\n");
-        }
-    }
-    else
-    {
-        int idx = atomicAdd(newTasksCnt, 1);
-        if (idx < newTasks.getSize())
-            newTasks[idx] = TASK(begin, end, iteration + 1);
-        else
-        {
-            //printf("ran out of memory, trying backup\n");
-            int idx = atomicAdd(secondPhaseTasksCnt, 1);
-            if (idx < secondPhaseTasks.getSize())
-                secondPhaseTasks[idx] = TASK(begin, end, iteration + 1);
-            else
-                printf("ran out of memory for newtask, there isnt even space in second phase task list\nPart of array may stay unsorted!!!\n");
-        }
-    }
+   int size = end - begin;
+   if( size < 0 ) {
+      printf( "negative size, something went really wrong\n" );
+      return;
+   }
+
+   if( size == 0 )
+      return;
+
+   if( size <= maxElemFor2ndPhase ) {
+      int idx = atomicAdd( secondPhaseTasksCnt, 1 );
+      if( idx < secondPhaseTasks.getSize() )
+         secondPhaseTasks[ idx ] = TASK( begin, end, iteration + 1 );
+      else {
+         // printf("ran out of memory, trying backup\n");
+         int idx = atomicAdd( newTasksCnt, 1 );
+         if( idx < newTasks.getSize() )
+            newTasks[ idx ] = TASK( begin, end, iteration + 1 );
+         else
+            printf( "ran out of memory for second phase task, there isnt even space in newTask list\nPart of array may stay "
+                    "unsorted!!!\n" );
+      }
+   }
+   else {
+      int idx = atomicAdd( newTasksCnt, 1 );
+      if( idx < newTasks.getSize() )
+         newTasks[ idx ] = TASK( begin, end, iteration + 1 );
+      else {
+         // printf("ran out of memory, trying backup\n");
+         int idx = atomicAdd( secondPhaseTasksCnt, 1 );
+         if( idx < secondPhaseTasks.getSize() )
+            secondPhaseTasks[ idx ] = TASK( begin, end, iteration + 1 );
+         else
+            printf( "ran out of memory for newtask, there isnt even space in second phase task list\nPart of array may stay "
+                    "unsorted!!!\n" );
+      }
+   }
 }
 
 //-----------------------------------------------------------
 
-template <typename Value, typename CMP, int stackSize>
-__global__ void cudaQuickSort2ndPhase(Containers::ArrayView<Value, Devices::Cuda> arr, Containers::ArrayView<Value, Devices::Cuda> aux,
-                                      CMP Cmp,
-                                      Containers::ArrayView<TASK, Devices::Cuda> secondPhaseTasks,
-                                      int elemInShared, int maxBitonicSize)
+template< typename Value, typename CMP, int stackSize >
+__global__
+void
+cudaQuickSort2ndPhase( Containers::ArrayView< Value, Devices::Cuda > arr,
+                       Containers::ArrayView< Value, Devices::Cuda > aux,
+                       CMP Cmp,
+                       Containers::ArrayView< TASK, Devices::Cuda > secondPhaseTasks,
+                       int elemInShared,
+                       int maxBitonicSize )
 {
-    extern __shared__ int externMem[];
-    Value *sharedMem = (Value *)externMem;
-
-    TASK &myTask = secondPhaseTasks[blockIdx.x];
-    if (myTask.partitionEnd - myTask.partitionBegin <= 0)
-    {
-        //printf("empty task???\n");
-        return;
-    }
-
-    auto arrView = arr.getView(myTask.partitionBegin, myTask.partitionEnd);
-    auto auxView = aux.getView(myTask.partitionBegin, myTask.partitionEnd);
-
-    if (elemInShared == 0)
-    {
-        singleBlockQuickSort<Value, CMP, stackSize, false>(arrView, auxView, Cmp, myTask.iteration, sharedMem, 0, maxBitonicSize);
-    }
-    else
-    {
-        singleBlockQuickSort<Value, CMP, stackSize, true>(arrView, auxView, Cmp, myTask.iteration, sharedMem, elemInShared, maxBitonicSize);
-    }
+   extern __shared__ int externMem[];
+   Value* sharedMem = (Value*) externMem;
+
+   TASK& myTask = secondPhaseTasks[ blockIdx.x ];
+   if( myTask.partitionEnd - myTask.partitionBegin <= 0 ) {
+      // printf("empty task???\n");
+      return;
+   }
+
+   auto arrView = arr.getView( myTask.partitionBegin, myTask.partitionEnd );
+   auto auxView = aux.getView( myTask.partitionBegin, myTask.partitionEnd );
+
+   if( elemInShared == 0 ) {
+      singleBlockQuickSort< Value, CMP, stackSize, false >(
+         arrView, auxView, Cmp, myTask.iteration, sharedMem, 0, maxBitonicSize );
+   }
+   else {
+      singleBlockQuickSort< Value, CMP, stackSize, true >(
+         arrView, auxView, Cmp, myTask.iteration, sharedMem, elemInShared, maxBitonicSize );
+   }
 }
 
-template <typename Value, typename CMP, int stackSize>
-__global__ void cudaQuickSort2ndPhase(Containers::ArrayView<Value, Devices::Cuda> arr, Containers::ArrayView<Value, Devices::Cuda> aux,
-                                      CMP Cmp,
-                                      Containers::ArrayView<TASK, Devices::Cuda> secondPhaseTasks1,
-                                      Containers::ArrayView<TASK, Devices::Cuda> secondPhaseTasks2,
-                                      int elemInShared, int maxBitonicSize)
+template< typename Value, typename CMP, int stackSize >
+__global__
+void
+cudaQuickSort2ndPhase( Containers::ArrayView< Value, Devices::Cuda > arr,
+                       Containers::ArrayView< Value, Devices::Cuda > aux,
+                       CMP Cmp,
+                       Containers::ArrayView< TASK, Devices::Cuda > secondPhaseTasks1,
+                       Containers::ArrayView< TASK, Devices::Cuda > secondPhaseTasks2,
+                       int elemInShared,
+                       int maxBitonicSize )
 {
-    extern __shared__ int externMem[];
-    Value *sharedMem = (Value *)externMem;
-
-    TASK myTask;
-    if (blockIdx.x < secondPhaseTasks1.getSize())
-        myTask = secondPhaseTasks1[blockIdx.x];
-    else
-        myTask = secondPhaseTasks2[blockIdx.x - secondPhaseTasks1.getSize()];
-
-    if (myTask.partitionEnd - myTask.partitionBegin <= 0)
-    {
-        //printf("empty task???\n");
-        return;
-    }
-
-    auto arrView = arr.getView(myTask.partitionBegin, myTask.partitionEnd);
-    auto auxView = aux.getView(myTask.partitionBegin, myTask.partitionEnd);
-
-    if (elemInShared <= 0)
-    {
-        singleBlockQuickSort<Value, CMP, stackSize, false>(arrView, auxView, Cmp, myTask.iteration, sharedMem, 0, maxBitonicSize);
-    }
-    else
-    {
-        singleBlockQuickSort<Value, CMP, stackSize, true>(arrView, auxView, Cmp, myTask.iteration, sharedMem, elemInShared, maxBitonicSize);
-    }
+   extern __shared__ int externMem[];
+   Value* sharedMem = (Value*) externMem;
+
+   TASK myTask;
+   if( blockIdx.x < secondPhaseTasks1.getSize() )
+      myTask = secondPhaseTasks1[ blockIdx.x ];
+   else
+      myTask = secondPhaseTasks2[ blockIdx.x - secondPhaseTasks1.getSize() ];
+
+   if( myTask.partitionEnd - myTask.partitionBegin <= 0 ) {
+      // printf("empty task???\n");
+      return;
+   }
+
+   auto arrView = arr.getView( myTask.partitionBegin, myTask.partitionEnd );
+   auto auxView = aux.getView( myTask.partitionBegin, myTask.partitionEnd );
+
+   if( elemInShared <= 0 ) {
+      singleBlockQuickSort< Value, CMP, stackSize, false >(
+         arrView, auxView, Cmp, myTask.iteration, sharedMem, 0, maxBitonicSize );
+   }
+   else {
+      singleBlockQuickSort< Value, CMP, stackSize, true >(
+         arrView, auxView, Cmp, myTask.iteration, sharedMem, elemInShared, maxBitonicSize );
+   }
 }
 
 #endif
 
-      } // namespace Sorting
-   } // namespace Algorithms
-} // namespace TNL
+}  // namespace Sorting
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/Sorting/detail/task.h b/src/TNL/Algorithms/Sorting/detail/task.h
index 43b2689912dd7f8afeeceb8ae1f526b2fbbda4e9..9afc8791ffadd885057db9da728438f6fb1cf4a0 100644
--- a/src/TNL/Algorithms/Sorting/detail/task.h
+++ b/src/TNL/Algorithms/Sorting/detail/task.h
@@ -13,56 +13,60 @@
 #include <TNL/Cuda/CudaCallable.h>
 
 namespace TNL {
-    namespace Algorithms {
-        namespace Sorting {
+namespace Algorithms {
+namespace Sorting {
 
 struct TASK
 {
-    //start and end position of array to read and write from
-    int partitionBegin, partitionEnd;
-    //-----------------------------------------------
-    //helper variables for blocks working on this task
+   // start and end position of array to read and write from
+   int partitionBegin, partitionEnd;
+   //-----------------------------------------------
+   // helper variables for blocks working on this task
 
-    int iteration;
-    int pivotIdx;
-    int dstBegin, dstEnd;
-    int firstBlock, blockCount;//for workers read only values
+   int iteration;
+   int pivotIdx;
+   int dstBegin, dstEnd;
+   int firstBlock, blockCount;  // for workers read only values
 
-    __cuda_callable__
-    TASK(int begin, int end, int iteration)
-        : partitionBegin(begin), partitionEnd(end),
-        iteration(iteration), pivotIdx(-1),
-        dstBegin(-151561), dstEnd(-151561),
-        firstBlock(-100), blockCount(-100)
-        {}
+   __cuda_callable__
+   TASK( int begin, int end, int iteration )
+   : partitionBegin( begin ), partitionEnd( end ), iteration( iteration ), pivotIdx( -1 ), dstBegin( -151561 ),
+     dstEnd( -151561 ), firstBlock( -100 ), blockCount( -100 )
+   {}
 
-    __cuda_callable__
-    void initTask(int firstBlock, int blocks, int pivotIdx)
-    {
-        dstBegin= 0; dstEnd = partitionEnd - partitionBegin;
-        this->firstBlock = firstBlock;
-        blockCount = blocks;
-        this->pivotIdx = pivotIdx;
-    }
+   __cuda_callable__
+   void
+   initTask( int firstBlock, int blocks, int pivotIdx )
+   {
+      dstBegin = 0;
+      dstEnd = partitionEnd - partitionBegin;
+      this->firstBlock = firstBlock;
+      blockCount = blocks;
+      this->pivotIdx = pivotIdx;
+   }
 
-    __cuda_callable__
-    int getSize() const
-    {
-        return partitionEnd - partitionBegin;
-    }
+   __cuda_callable__
+   int
+   getSize() const
+   {
+      return partitionEnd - partitionBegin;
+   }
 
-    TASK() = default;
+   TASK() = default;
 };
 
-inline std::ostream& operator<<(std::ostream & out, const TASK & task)
+inline std::ostream&
+operator<<( std::ostream& out, const TASK& task )
 {
-    out << "[ ";
-    out << task.partitionBegin << " - " << task.partitionEnd;
-    out << " | " << "iteration: " << task.iteration;
-    out << " | " << "pivotIdx: " << task.pivotIdx;
-    return out << " ] ";
+   out << "[ ";
+   out << task.partitionBegin << " - " << task.partitionEnd;
+   out << " | "
+       << "iteration: " << task.iteration;
+   out << " | "
+       << "pivotIdx: " << task.pivotIdx;
+   return out << " ] ";
 }
 
-        } // namespace Sorting
-    } // namespace Algorithms
-} // namespace TNL
+}  // namespace Sorting
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/contains.h b/src/TNL/Algorithms/contains.h
index cd6e8afacf1d6d82bb6ed65f48bec10f455193c2..fc8bd81b3cc7b640d91a250ea475617d3f9d3fd4 100644
--- a/src/TNL/Algorithms/contains.h
+++ b/src/TNL/Algorithms/contains.h
@@ -67,5 +67,5 @@ containsOnlyValue( const Array& array,
    return detail::ContainsOnlyValue< typename Array::DeviceType >()( array.getData() + begin, end - begin, value );
 }
 
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/detail/Contains.h b/src/TNL/Algorithms/detail/Contains.h
index 83b25edbbfeed03facc4fbfdc8651f5658c90b20..a9a9bff723853902c737b93335fb666dbfdc64f5 100644
--- a/src/TNL/Algorithms/detail/Contains.h
+++ b/src/TNL/Algorithms/detail/Contains.h
@@ -22,18 +22,16 @@ struct Contains;
 template< typename Device >
 struct ContainsOnlyValue;
 
-
 template<>
 struct Contains< Devices::Sequential >
 {
-   template< typename Element,
-             typename Index >
+   template< typename Element, typename Index >
    __cuda_callable__
-   bool operator()( const Element* data,
-                    const Index size,
-                    const Element& value )
+   bool
+   operator()( const Element* data, const Index size, const Element& value )
    {
-      if( size == 0 ) return false;
+      if( size == 0 )
+         return false;
       TNL_ASSERT_TRUE( data, "Attempted to check data through a nullptr." );
       TNL_ASSERT_GE( size, 0, "" );
 
@@ -47,14 +45,13 @@ struct Contains< Devices::Sequential >
 template<>
 struct ContainsOnlyValue< Devices::Sequential >
 {
-   template< typename Element,
-             typename Index >
+   template< typename Element, typename Index >
    __cuda_callable__
-   bool operator()( const Element* data,
-                    const Index size,
-                    const Element& value )
+   bool
+   operator()( const Element* data, const Index size, const Element& value )
    {
-      if( size == 0 ) return false;
+      if( size == 0 )
+         return false;
       TNL_ASSERT_TRUE( data, "Attempted to check data through a nullptr." );
       TNL_ASSERT_GE( size, 0, "" );
 
@@ -65,23 +62,24 @@ struct ContainsOnlyValue< Devices::Sequential >
    }
 };
 
-
 template<>
 struct Contains< Devices::Host >
 {
-   template< typename Element,
-             typename Index >
-   bool operator()( const Element* data,
-                    const Index size,
-                    const Element& value )
+   template< typename Element, typename Index >
+   bool
+   operator()( const Element* data, const Index size, const Element& value )
    {
-      if( size == 0 ) return false;
+      if( size == 0 )
+         return false;
       TNL_ASSERT_TRUE( data, "Attempted to check data through a nullptr." );
       TNL_ASSERT_GE( size, 0, "" );
 
       if( Devices::Host::isOMPEnabled() && Devices::Host::getMaxThreadsCount() > 1 ) {
-         auto fetch = [=] ( Index i ) -> bool { return data[ i ] == value; };
-         return reduce< Devices::Host >( ( Index ) 0, size, fetch, std::logical_or<>{}, false );
+         auto fetch = [ = ]( Index i ) -> bool
+         {
+            return data[ i ] == value;
+         };
+         return reduce< Devices::Host >( (Index) 0, size, fetch, std::logical_or<>{}, false );
       }
       else {
          // sequential algorithm can return as soon as it finds a match
@@ -93,19 +91,21 @@ struct Contains< Devices::Host >
 template<>
 struct ContainsOnlyValue< Devices::Host >
 {
-   template< typename Element,
-             typename Index >
-   bool operator()( const Element* data,
-                    const Index size,
-                    const Element& value )
+   template< typename Element, typename Index >
+   bool
+   operator()( const Element* data, const Index size, const Element& value )
    {
-      if( size == 0 ) return false;
+      if( size == 0 )
+         return false;
       TNL_ASSERT_TRUE( data, "Attempted to check data through a nullptr." );
       TNL_ASSERT_GE( size, 0, "" );
 
       if( Devices::Host::isOMPEnabled() && Devices::Host::getMaxThreadsCount() > 1 ) {
-         auto fetch = [data, value] ( Index i ) -> bool { return data[ i ] == value; };
-         return reduce< Devices::Host >( ( Index ) 0, size, fetch, std::logical_and<>{}, true );
+         auto fetch = [ data, value ]( Index i ) -> bool
+         {
+            return data[ i ] == value;
+         };
+         return reduce< Devices::Host >( (Index) 0, size, fetch, std::logical_and<>{}, true );
       }
       else {
          // sequential algorithm can return as soon as it finds a mismatch
@@ -114,43 +114,46 @@ struct ContainsOnlyValue< Devices::Host >
    }
 };
 
-
 template<>
 struct Contains< Devices::Cuda >
 {
-   template< typename Element,
-             typename Index >
-   bool operator()( const Element* data,
-                    const Index size,
-                    const Element& value )
+   template< typename Element, typename Index >
+   bool
+   operator()( const Element* data, const Index size, const Element& value )
    {
-      if( size == 0 ) return false;
+      if( size == 0 )
+         return false;
       TNL_ASSERT_TRUE( data, "Attempted to check data through a nullptr." );
       TNL_ASSERT_GE( size, (Index) 0, "" );
 
-      auto fetch = [=] __cuda_callable__ ( Index i ) -> bool { return data[ i ] == value; };
-      return reduce< Devices::Cuda >( ( Index ) 0, size, fetch, std::logical_or<>{}, false );
+      auto fetch = [ = ] __cuda_callable__( Index i ) -> bool
+      {
+         return data[ i ] == value;
+      };
+      return reduce< Devices::Cuda >( (Index) 0, size, fetch, std::logical_or<>{}, false );
    }
 };
 
 template<>
 struct ContainsOnlyValue< Devices::Cuda >
 {
-   template< typename Element,
-             typename Index >
-   bool operator()( const Element* data,
-                    const Index size,
-                    const Element& value )
+   template< typename Element, typename Index >
+   bool
+   operator()( const Element* data, const Index size, const Element& value )
    {
-      if( size == 0 ) return false;
+      if( size == 0 )
+         return false;
       TNL_ASSERT_TRUE( data, "Attempted to check data through a nullptr." );
       TNL_ASSERT_GE( size, 0, "" );
 
-      auto fetch = [=] __cuda_callable__ ( Index i ) -> bool { return data[ i ] == value; };
-      return reduce< Devices::Cuda >( ( Index ) 0, size, fetch, std::logical_and<>{}, true );
+      auto fetch = [ = ] __cuda_callable__( Index i ) -> bool
+      {
+         return data[ i ] == value;
+      };
+      return reduce< Devices::Cuda >( (Index) 0, size, fetch, std::logical_and<>{}, true );
    }
 };
 
-} // namespace detail
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace detail
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/detail/CudaMultireductionKernel.h b/src/TNL/Algorithms/detail/CudaMultireductionKernel.h
index 36fb83c731e9d607a2de1f605518afe75db7f6d8..a8c30c4d734d3ee5dc8d6cecd8eed5304138cf82 100644
--- a/src/TNL/Algorithms/detail/CudaMultireductionKernel.h
+++ b/src/TNL/Algorithms/detail/CudaMultireductionKernel.h
@@ -11,6 +11,7 @@
 #include <TNL/Assert.h>
 #include <TNL/Math.h>
 #include <TNL/Cuda/DeviceInfo.h>
+#include <TNL/Cuda/KernelLaunch.h>
 #include <TNL/Cuda/SharedMemory.h>
 #include <TNL/Algorithms/CudaReductionBuffer.h>
 #include <TNL/Exceptions/CudaSupportMissing.h>
@@ -19,7 +20,6 @@ namespace TNL {
 namespace Algorithms {
 namespace detail {
 
-#ifdef HAVE_CUDA
 /****
  * The performance of this kernel is very sensitive to register usage.
  * Compile with --ptxas-options=-v and configure these constants for given
@@ -29,44 +29,43 @@ static constexpr int Multireduction_maxThreadsPerBlock = 256;  // must be a powe
 static constexpr int Multireduction_registersPerThread = 32;   // empirically determined optimal value
 
 // __CUDA_ARCH__ is defined only in device code!
-#if (__CUDA_ARCH__ == 750 )
-   // Turing has a limit of 1024 threads per multiprocessor
-   static constexpr int Multireduction_minBlocksPerMultiprocessor = 4;
+#if( __CUDA_ARCH__ == 750 )
+// Turing has a limit of 1024 threads per multiprocessor
+static constexpr int Multireduction_minBlocksPerMultiprocessor = 4;
 #else
-   static constexpr int Multireduction_minBlocksPerMultiprocessor = 8;
+static constexpr int Multireduction_minBlocksPerMultiprocessor = 8;
 #endif
 
-template< int blockSizeX,
-          typename Result,
-          typename DataFetcher,
-          typename Reduction,
-          typename Index >
-__global__ void
+#ifdef HAVE_CUDA
+template< int blockSizeX, typename Result, typename DataFetcher, typename Reduction, typename Index >
+__global__
+void
 __launch_bounds__( Multireduction_maxThreadsPerBlock, Multireduction_minBlocksPerMultiprocessor )
-CudaMultireductionKernel( const Result identity,
-                          DataFetcher dataFetcher,
-                          const Reduction reduction,
-                          const Index size,
-                          const int n,
-                          Result* output )
+   CudaMultireductionKernel( const Result identity,
+                             DataFetcher dataFetcher,
+                             const Reduction reduction,
+                             const Index size,
+                             const int n,
+                             Result* output )
 {
    Result* sdata = Cuda::getSharedMemory< Result >();
 
    // Get the thread id (tid), global thread id (gid) and gridSize.
    const Index tid = threadIdx.y * blockDim.x + threadIdx.x;
-         Index gid = blockIdx.x * blockDim.x + threadIdx.x;
+   Index gid = blockIdx.x * blockDim.x + threadIdx.x;
    const Index gridSizeX = blockDim.x * gridDim.x;
 
    // Get the dataset index.
    const int y = blockIdx.y * blockDim.y + threadIdx.y;
-   if( y >= n ) return;
+   if( y >= n )
+      return;
 
    sdata[ tid ] = identity;
 
    // Start with the sequential reduction and push the result into the shared memory.
    while( gid + 4 * gridSizeX < size ) {
-      sdata[ tid ] = reduction( sdata[ tid ], dataFetcher( gid,                 y ) );
-      sdata[ tid ] = reduction( sdata[ tid ], dataFetcher( gid + gridSizeX,     y ) );
+      sdata[ tid ] = reduction( sdata[ tid ], dataFetcher( gid, y ) );
+      sdata[ tid ] = reduction( sdata[ tid ], dataFetcher( gid + gridSizeX, y ) );
       sdata[ tid ] = reduction( sdata[ tid ], dataFetcher( gid + 2 * gridSizeX, y ) );
       sdata[ tid ] = reduction( sdata[ tid ], dataFetcher( gid + 3 * gridSizeX, y ) );
       gid += 4 * gridSizeX;
@@ -99,7 +98,7 @@ CudaMultireductionKernel( const Result identity,
       __syncthreads();
    }
    if( blockSizeX >= 128 ) {
-      if( threadIdx.x <  64 )
+      if( threadIdx.x < 64 )
          sdata[ tid ] = reduction( sdata[ tid ], sdata[ tid + 64 ] );
       __syncthreads();
    }
@@ -119,13 +118,13 @@ CudaMultireductionKernel( const Result identity,
       if( blockSizeX >= 16 )
          sdata[ tid ] = reduction( sdata[ tid ], sdata[ tid + 8 ] );
       __syncwarp();
-      if( blockSizeX >=  8 )
+      if( blockSizeX >= 8 )
          sdata[ tid ] = reduction( sdata[ tid ], sdata[ tid + 4 ] );
       __syncwarp();
-      if( blockSizeX >=  4 )
+      if( blockSizeX >= 4 )
          sdata[ tid ] = reduction( sdata[ tid ], sdata[ tid + 2 ] );
       __syncwarp();
-      if( blockSizeX >=  2 )
+      if( blockSizeX >= 2 )
          sdata[ tid ] = reduction( sdata[ tid ], sdata[ tid + 1 ] );
    }
 
@@ -136,10 +135,7 @@ CudaMultireductionKernel( const Result identity,
 }
 #endif
 
-template< typename Result,
-          typename DataFetcher,
-          typename Reduction,
-          typename Index >
+template< typename Result, typename DataFetcher, typename Reduction, typename Index >
 int
 CudaMultireductionKernelLauncher( const Result identity,
                                   DataFetcher dataFetcher,
@@ -162,36 +158,37 @@ CudaMultireductionKernelLauncher( const Result identity,
    const int blocksdPerMultiprocessor = Cuda::DeviceInfo::getRegistersPerMultiprocessor( activeDevice )
                                       / ( Multireduction_maxThreadsPerBlock * Multireduction_registersPerThread );
    const int desGridSizeX = blocksdPerMultiprocessor * Cuda::DeviceInfo::getCudaMultiprocessors( activeDevice );
-   dim3 blockSize, gridSize;
+   Cuda::LaunchConfiguration launch_config;
 
    // version A: max 16 rows of threads
-   blockSize.y = TNL::min( n, 16 );
+   launch_config.blockSize.y = TNL::min( n, 16 );
 
    // version B: up to 16 rows of threads, then "minimize" number of inactive rows
-//   if( n <= 16 )
-//      blockSize.y = n;
-//   else {
-//      int r = (n - 1) % 16 + 1;
-//      if( r > 12 )
-//         blockSize.y = 16;
-//      else if( r > 8 )
-//         blockSize.y = 4;
-//      else if( r > 4 )
-//         blockSize.y = 8;
-//      else
-//         blockSize.y = 4;
-//   }
-
-   // blockSize.x has to be a power of 2
-   blockSize.x = Multireduction_maxThreadsPerBlock;
-   while( blockSize.x * blockSize.y > Multireduction_maxThreadsPerBlock )
-      blockSize.x /= 2;
-
-   gridSize.x = TNL::min( Cuda::getNumberOfBlocks( size, blockSize.x ), desGridSizeX );
-   gridSize.y = Cuda::getNumberOfBlocks( n, blockSize.y );
-
-   if( gridSize.y > (unsigned) Cuda::getMaxGridSize() ) {
-      std::cerr << "Maximum gridSize.y limit exceeded (limit is 65535, attempted " << gridSize.y << ")." << std::endl;
+   //   if( n <= 16 )
+   //      launch_config.blockSize.y = n;
+   //   else {
+   //      int r = (n - 1) % 16 + 1;
+   //      if( r > 12 )
+   //         launch_config.blockSize.y = 16;
+   //      else if( r > 8 )
+   //         launch_config.blockSize.y = 4;
+   //      else if( r > 4 )
+   //         launch_config.blockSize.y = 8;
+   //      else
+   //         launch_config.blockSize.y = 4;
+   //   }
+
+   // launch_config.blockSize.x has to be a power of 2
+   launch_config.blockSize.x = Multireduction_maxThreadsPerBlock;
+   while( launch_config.blockSize.x * launch_config.blockSize.y > Multireduction_maxThreadsPerBlock )
+      launch_config.blockSize.x /= 2;
+
+   launch_config.gridSize.x = TNL::min( Cuda::getNumberOfBlocks( size, launch_config.blockSize.x ), desGridSizeX );
+   launch_config.gridSize.y = Cuda::getNumberOfBlocks( n, launch_config.blockSize.y );
+
+   if( launch_config.gridSize.y > (unsigned) Cuda::getMaxGridSize() ) {
+      std::cerr << "Maximum launch_config.gridSize.y limit exceeded (limit is 65535, attempted " << launch_config.gridSize.y
+                << ")." << std::endl;
       throw 1;
    }
 
@@ -202,82 +199,143 @@ CudaMultireductionKernelLauncher( const Result identity,
    cudaReductionBuffer.setSize( buf_size );
    output = cudaReductionBuffer.template getData< Result >();
 
-   // when there is only one warp per blockSize.x, we need to allocate two warps
+   // when there is only one warp per launch_config.blockSize.x, we need to allocate two warps
    // worth of shared memory so that we don't index shared memory out of bounds
-   const Index shmem = (blockSize.x <= 32)
-            ? 2 * blockSize.x * blockSize.y * sizeof( Result )
-            : blockSize.x * blockSize.y * sizeof( Result );
+   launch_config.dynamicSharedMemorySize = ( launch_config.blockSize.x <= 32 )
+                                            ? 2 * launch_config.blockSize.x * launch_config.blockSize.y * sizeof( Result )
+                                            : launch_config.blockSize.x * launch_config.blockSize.y * sizeof( Result );
 
    // Depending on the blockSize we generate appropriate template instance.
-   switch( blockSize.x )
-   {
+   switch( launch_config.blockSize.x ) {
       case 512:
-         CudaMultireductionKernel< 512 >
-         <<< gridSize, blockSize, shmem >>>( identity, dataFetcher, reduction, size, n, output );
+         Cuda::launchKernelSync( CudaMultireductionKernel< 512, Result, DataFetcher, Reduction, Index >,
+                                 0,
+                                 launch_config,
+                                 identity,
+                                 dataFetcher,
+                                 reduction,
+                                 size,
+                                 n,
+                                 output );
          break;
       case 256:
-         cudaFuncSetCacheConfig(CudaMultireductionKernel< 256, Result, DataFetcher, Reduction, Index >, cudaFuncCachePreferShared);
-
-         CudaMultireductionKernel< 256 >
-         <<< gridSize, blockSize, shmem >>>( identity, dataFetcher, reduction, size, n, output );
+         cudaFuncSetCacheConfig( CudaMultireductionKernel< 256, Result, DataFetcher, Reduction, Index >,
+                                 cudaFuncCachePreferShared );
+         Cuda::launchKernelSync( CudaMultireductionKernel< 256, Result, DataFetcher, Reduction, Index >,
+                                 0,
+                                 launch_config,
+                                 identity,
+                                 dataFetcher,
+                                 reduction,
+                                 size,
+                                 n,
+                                 output );
          break;
       case 128:
-         cudaFuncSetCacheConfig(CudaMultireductionKernel< 128, Result, DataFetcher, Reduction, Index >, cudaFuncCachePreferShared);
-
-         CudaMultireductionKernel< 128 >
-         <<< gridSize, blockSize, shmem >>>( identity, dataFetcher, reduction, size, n, output );
+         cudaFuncSetCacheConfig( CudaMultireductionKernel< 128, Result, DataFetcher, Reduction, Index >,
+                                 cudaFuncCachePreferShared );
+         Cuda::launchKernelSync( CudaMultireductionKernel< 128, Result, DataFetcher, Reduction, Index >,
+                                 0,
+                                 launch_config,
+                                 identity,
+                                 dataFetcher,
+                                 reduction,
+                                 size,
+                                 n,
+                                 output );
          break;
-      case  64:
-         cudaFuncSetCacheConfig(CudaMultireductionKernel<  64, Result, DataFetcher, Reduction, Index >, cudaFuncCachePreferShared);
-
-         CudaMultireductionKernel<  64 >
-         <<< gridSize, blockSize, shmem >>>( identity, dataFetcher, reduction, size, n, output );
+      case 64:
+         cudaFuncSetCacheConfig( CudaMultireductionKernel< 64, Result, DataFetcher, Reduction, Index >,
+                                 cudaFuncCachePreferShared );
+         Cuda::launchKernelSync( CudaMultireductionKernel< 64, Result, DataFetcher, Reduction, Index >,
+                                 0,
+                                 launch_config,
+                                 identity,
+                                 dataFetcher,
+                                 reduction,
+                                 size,
+                                 n,
+                                 output );
          break;
-      case  32:
-         cudaFuncSetCacheConfig(CudaMultireductionKernel<  32, Result, DataFetcher, Reduction, Index >, cudaFuncCachePreferShared);
-
-         CudaMultireductionKernel<  32 >
-         <<< gridSize, blockSize, shmem >>>( identity, dataFetcher, reduction, size, n, output );
+      case 32:
+         cudaFuncSetCacheConfig( CudaMultireductionKernel< 32, Result, DataFetcher, Reduction, Index >,
+                                 cudaFuncCachePreferShared );
+         Cuda::launchKernelSync( CudaMultireductionKernel< 32, Result, DataFetcher, Reduction, Index >,
+                                 0,
+                                 launch_config,
+                                 identity,
+                                 dataFetcher,
+                                 reduction,
+                                 size,
+                                 n,
+                                 output );
          break;
-      case  16:
-         cudaFuncSetCacheConfig(CudaMultireductionKernel<  16, Result, DataFetcher, Reduction, Index >, cudaFuncCachePreferShared);
-
-         CudaMultireductionKernel<  16 >
-         <<< gridSize, blockSize, shmem >>>( identity, dataFetcher, reduction, size, n, output );
+      case 16:
+         cudaFuncSetCacheConfig( CudaMultireductionKernel< 16, Result, DataFetcher, Reduction, Index >,
+                                 cudaFuncCachePreferShared );
+         Cuda::launchKernelSync( CudaMultireductionKernel< 16, Result, DataFetcher, Reduction, Index >,
+                                 0,
+                                 launch_config,
+                                 identity,
+                                 dataFetcher,
+                                 reduction,
+                                 size,
+                                 n,
+                                 output );
          break;
-     case   8:
-         cudaFuncSetCacheConfig(CudaMultireductionKernel<   8, Result, DataFetcher, Reduction, Index >, cudaFuncCachePreferShared);
-
-         CudaMultireductionKernel<   8 >
-         <<< gridSize, blockSize, shmem >>>( identity, dataFetcher, reduction, size, n, output );
+      case 8:
+         cudaFuncSetCacheConfig( CudaMultireductionKernel< 8, Result, DataFetcher, Reduction, Index >,
+                                 cudaFuncCachePreferShared );
+         Cuda::launchKernelSync( CudaMultireductionKernel< 8, Result, DataFetcher, Reduction, Index >,
+                                 0,
+                                 launch_config,
+                                 identity,
+                                 dataFetcher,
+                                 reduction,
+                                 size,
+                                 n,
+                                 output );
          break;
-      case   4:
-         cudaFuncSetCacheConfig(CudaMultireductionKernel<   4, Result, DataFetcher, Reduction, Index >, cudaFuncCachePreferShared);
-
-         CudaMultireductionKernel<   4 >
-         <<< gridSize, blockSize, shmem >>>( identity, dataFetcher, reduction, size, n, output );
-        break;
-      case   2:
-         cudaFuncSetCacheConfig(CudaMultireductionKernel<   2, Result, DataFetcher, Reduction, Index >, cudaFuncCachePreferShared);
-
-         CudaMultireductionKernel<   2 >
-         <<< gridSize, blockSize, shmem >>>( identity, dataFetcher, reduction, size, n, output );
+      case 4:
+         cudaFuncSetCacheConfig( CudaMultireductionKernel< 4, Result, DataFetcher, Reduction, Index >,
+                                 cudaFuncCachePreferShared );
+         Cuda::launchKernelSync( CudaMultireductionKernel< 4, Result, DataFetcher, Reduction, Index >,
+                                 0,
+                                 launch_config,
+                                 identity,
+                                 dataFetcher,
+                                 reduction,
+                                 size,
+                                 n,
+                                 output );
+         break;
+      case 2:
+         cudaFuncSetCacheConfig( CudaMultireductionKernel< 2, Result, DataFetcher, Reduction, Index >,
+                                 cudaFuncCachePreferShared );
+         Cuda::launchKernelSync( CudaMultireductionKernel< 2, Result, DataFetcher, Reduction, Index >,
+                                 0,
+                                 launch_config,
+                                 identity,
+                                 dataFetcher,
+                                 reduction,
+                                 size,
+                                 n,
+                                 output );
          break;
-      case   1:
+      case 1:
          throw std::logic_error( "blockSize should not be 1." );
       default:
-         throw std::logic_error( "Block size is " + std::to_string(blockSize.x) + " which is none of 1, 2, 4, 8, 16, 32, 64, 128, 256 or 512." );
+         throw std::logic_error( "Block size is " + std::to_string( launch_config.blockSize.x )
+                                 + " which is none of 1, 2, 4, 8, 16, 32, 64, 128, 256 or 512." );
    }
-   cudaStreamSynchronize(0);
-   TNL_CHECK_CUDA_DEVICE;
 
    // return the size of the output array on the CUDA device
-   return gridSize.x;
+   return launch_config.gridSize.x;
 #else
    throw Exceptions::CudaSupportMissing();
 #endif
 }
 
-} // namespace detail
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace detail
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/detail/CudaReductionKernel.h b/src/TNL/Algorithms/detail/CudaReductionKernel.h
index 910b953ee6a8ee40f2233f2fb58b4a54dde067c5..a9d693ff55fc17d2e7f885ff97aa862e0d790a1c 100644
--- a/src/TNL/Algorithms/detail/CudaReductionKernel.h
+++ b/src/TNL/Algorithms/detail/CudaReductionKernel.h
@@ -11,6 +11,7 @@
 #include <TNL/Assert.h>
 #include <TNL/Math.h>
 #include <TNL/Cuda/DeviceInfo.h>
+#include <TNL/Cuda/KernelLaunch.h>
 #include <TNL/Algorithms/CudaReductionBuffer.h>
 #include <TNL/Algorithms/MultiDeviceMemoryOperations.h>
 #include <TNL/Exceptions/CudaSupportMissing.h>
@@ -29,9 +30,7 @@ namespace detail {
  * `ValueType`, e.g. using the `__shfl_sync` intrinsics for supported
  * value types.
  */
-template< int blockSize,
-          typename Reduction,
-          typename ValueType >
+template< int blockSize, typename Reduction, typename ValueType >
 struct CudaBlockReduce
 {
    // storage to be allocated in shared memory
@@ -39,7 +38,7 @@ struct CudaBlockReduce
    {
       // when there is only one warp per blockSize.x, we need to allocate two warps
       // worth of shared memory so that we don't index shared memory out of bounds
-      ValueType data[ (blockSize <= 32) ? 2 * blockSize : blockSize ];
+      ValueType data[ ( blockSize <= 32 ) ? 2 * blockSize : blockSize ];
    };
 
    /* Cooperative reduction across the CUDA block - each thread will get the
@@ -54,13 +53,9 @@ struct CudaBlockReduce
     * \param storage     Auxiliary storage (must be allocated as a __shared__
     *                    variable).
     */
-   __device__ static
-   ValueType
-   reduce( const Reduction& reduction,
-           ValueType identity,
-           ValueType threadValue,
-           int tid,
-           Storage& storage )
+   __device__
+   static ValueType
+   reduce( const Reduction& reduction, ValueType identity, ValueType threadValue, int tid, Storage& storage )
    {
       storage.data[ tid ] = threadValue;
       __syncthreads();
@@ -81,7 +76,7 @@ struct CudaBlockReduce
          __syncthreads();
       }
       if( blockSize >= 128 ) {
-         if( tid <  64 )
+         if( tid < 64 )
             storage.data[ tid ] = reduction( storage.data[ tid ], storage.data[ tid + 64 ] );
          __syncthreads();
       }
@@ -101,13 +96,13 @@ struct CudaBlockReduce
          if( blockSize >= 16 )
             storage.data[ tid ] = reduction( storage.data[ tid ], storage.data[ tid + 8 ] );
          __syncwarp();
-         if( blockSize >=  8 )
+         if( blockSize >= 8 )
             storage.data[ tid ] = reduction( storage.data[ tid ], storage.data[ tid + 4 ] );
          __syncwarp();
-         if( blockSize >=  4 )
+         if( blockSize >= 4 )
             storage.data[ tid ] = reduction( storage.data[ tid ], storage.data[ tid + 2 ] );
          __syncwarp();
-         if( blockSize >=  2 )
+         if( blockSize >= 2 )
             storage.data[ tid ] = reduction( storage.data[ tid ], storage.data[ tid + 1 ] );
       }
 
@@ -116,9 +111,7 @@ struct CudaBlockReduce
    }
 };
 
-template< int blockSize,
-          typename Reduction,
-          typename ValueType >
+template< int blockSize, typename Reduction, typename ValueType >
 struct CudaBlockReduceShfl
 {
    // storage to be allocated in shared memory
@@ -139,13 +132,9 @@ struct CudaBlockReduceShfl
     * \param storage     Auxiliary storage (must be allocated as a __shared__
     *                    variable).
     */
-   __device__ static
-   ValueType
-   reduce( const Reduction& reduction,
-           ValueType identity,
-           ValueType threadValue,
-           int tid,
-           Storage& storage )
+   __device__
+   static ValueType
+   reduce( const Reduction& reduction, ValueType identity, ValueType threadValue, int tid, Storage& storage )
    {
       // verify the configuration
       static_assert( blockSize / Cuda::getWarpSize() <= Cuda::getWarpSize(),
@@ -184,10 +173,9 @@ struct CudaBlockReduceShfl
     * Cooperative reduction across the warp - each thread will get the result
     * of the reduction
     */
-   __device__ static
-   ValueType
-   warpReduce( const Reduction& reduction,
-               ValueType threadValue )
+   __device__
+   static ValueType
+   warpReduce( const Reduction& reduction, ValueType threadValue )
    {
       constexpr unsigned mask = 0xffffffff;
       #pragma unroll
@@ -199,52 +187,38 @@ struct CudaBlockReduceShfl
    }
 };
 
-template< int blockSize,
-          typename Reduction >
-struct CudaBlockReduce< blockSize, Reduction, int >
-: public CudaBlockReduceShfl< blockSize, Reduction, int >
+template< int blockSize, typename Reduction >
+struct CudaBlockReduce< blockSize, Reduction, int > : public CudaBlockReduceShfl< blockSize, Reduction, int >
 {};
 
-template< int blockSize,
-          typename Reduction >
-struct CudaBlockReduce< blockSize, Reduction, unsigned int >
-: public CudaBlockReduceShfl< blockSize, Reduction, unsigned int >
+template< int blockSize, typename Reduction >
+struct CudaBlockReduce< blockSize, Reduction, unsigned int > : public CudaBlockReduceShfl< blockSize, Reduction, unsigned int >
 {};
 
-template< int blockSize,
-          typename Reduction >
-struct CudaBlockReduce< blockSize, Reduction, long >
-: public CudaBlockReduceShfl< blockSize, Reduction, long >
+template< int blockSize, typename Reduction >
+struct CudaBlockReduce< blockSize, Reduction, long > : public CudaBlockReduceShfl< blockSize, Reduction, long >
 {};
 
-template< int blockSize,
-          typename Reduction >
+template< int blockSize, typename Reduction >
 struct CudaBlockReduce< blockSize, Reduction, unsigned long >
 : public CudaBlockReduceShfl< blockSize, Reduction, unsigned long >
 {};
 
-template< int blockSize,
-          typename Reduction >
-struct CudaBlockReduce< blockSize, Reduction, long long >
-: public CudaBlockReduceShfl< blockSize, Reduction, long long >
+template< int blockSize, typename Reduction >
+struct CudaBlockReduce< blockSize, Reduction, long long > : public CudaBlockReduceShfl< blockSize, Reduction, long long >
 {};
 
-template< int blockSize,
-          typename Reduction >
+template< int blockSize, typename Reduction >
 struct CudaBlockReduce< blockSize, Reduction, unsigned long long >
 : public CudaBlockReduceShfl< blockSize, Reduction, unsigned long long >
 {};
 
-template< int blockSize,
-          typename Reduction >
-struct CudaBlockReduce< blockSize, Reduction, float >
-: public CudaBlockReduceShfl< blockSize, Reduction, float >
+template< int blockSize, typename Reduction >
+struct CudaBlockReduce< blockSize, Reduction, float > : public CudaBlockReduceShfl< blockSize, Reduction, float >
 {};
 
-template< int blockSize,
-          typename Reduction >
-struct CudaBlockReduce< blockSize, Reduction, double >
-: public CudaBlockReduceShfl< blockSize, Reduction, double >
+template< int blockSize, typename Reduction >
+struct CudaBlockReduce< blockSize, Reduction, double > : public CudaBlockReduceShfl< blockSize, Reduction, double >
 {};
 
 /* Template for cooperative reduction with argument across the CUDA block of
@@ -256,10 +230,7 @@ struct CudaBlockReduce< blockSize, Reduction, double >
  * `ValueType`, e.g. using the `__shfl_sync` intrinsics for supported
  * value types.
  */
-template< int blockSize,
-          typename Reduction,
-          typename ValueType,
-          typename IndexType >
+template< int blockSize, typename Reduction, typename ValueType, typename IndexType >
 struct CudaBlockReduceWithArgument
 {
    // storage to be allocated in shared memory
@@ -267,8 +238,8 @@ struct CudaBlockReduceWithArgument
    {
       // when there is only one warp per blockSize.x, we need to allocate two warps
       // worth of shared memory so that we don't index shared memory out of bounds
-      ValueType data[ (blockSize <= 32) ? 2 * blockSize : blockSize ];
-      IndexType idx [ (blockSize <= 32) ? 2 * blockSize : blockSize ];
+      ValueType data[ ( blockSize <= 32 ) ? 2 * blockSize : blockSize ];
+      IndexType idx[ ( blockSize <= 32 ) ? 2 * blockSize : blockSize ];
    };
 
    /* Cooperative reduction with argument across the CUDA block - each thread
@@ -284,8 +255,8 @@ struct CudaBlockReduceWithArgument
     * \param storage     Auxiliary storage (must be allocated as a __shared__
     *                    variable).
     */
-   __device__ static
-   std::pair< ValueType, IndexType >
+   __device__
+   static std::pair< ValueType, IndexType >
    reduceWithArgument( const Reduction& reduction,
                        ValueType identity,
                        ValueType threadValue,
@@ -313,7 +284,7 @@ struct CudaBlockReduceWithArgument
          __syncthreads();
       }
       if( blockSize >= 128 ) {
-         if( tid <  64 )
+         if( tid < 64 )
             reduction( storage.data[ tid ], storage.data[ tid + 64 ], storage.idx[ tid ], storage.idx[ tid + 64 ] );
          __syncthreads();
       }
@@ -333,13 +304,13 @@ struct CudaBlockReduceWithArgument
          if( blockSize >= 16 )
             reduction( storage.data[ tid ], storage.data[ tid + 8 ], storage.idx[ tid ], storage.idx[ tid + 8 ] );
          __syncwarp();
-         if( blockSize >=  8 )
+         if( blockSize >= 8 )
             reduction( storage.data[ tid ], storage.data[ tid + 4 ], storage.idx[ tid ], storage.idx[ tid + 4 ] );
          __syncwarp();
-         if( blockSize >=  4 )
+         if( blockSize >= 4 )
             reduction( storage.data[ tid ], storage.data[ tid + 2 ], storage.idx[ tid ], storage.idx[ tid + 2 ] );
          __syncwarp();
-         if( blockSize >=  2 )
+         if( blockSize >= 2 )
             reduction( storage.data[ tid ], storage.data[ tid + 1 ], storage.idx[ tid ], storage.idx[ tid + 1 ] );
       }
 
@@ -357,39 +328,38 @@ struct CudaBlockReduceWithArgument
 static constexpr int Reduction_maxThreadsPerBlock = 256;  // must be a power of 2
 static constexpr int Reduction_registersPerThread = 32;   // empirically determined optimal value
 
-#ifdef HAVE_CUDA
 // __CUDA_ARCH__ is defined only in device code!
-#if (__CUDA_ARCH__ == 750 )
-   // Turing has a limit of 1024 threads per multiprocessor
-   static constexpr int Reduction_minBlocksPerMultiprocessor = 4;
+#if( __CUDA_ARCH__ == 750 )
+// Turing has a limit of 1024 threads per multiprocessor
+static constexpr int Reduction_minBlocksPerMultiprocessor = 4;
 #else
-   static constexpr int Reduction_minBlocksPerMultiprocessor = 8;
+static constexpr int Reduction_minBlocksPerMultiprocessor = 8;
 #endif
 
-template< int blockSize,
-          typename DataFetcher,
-          typename Reduction,
-          typename Result,
-          typename Index >
-__global__ void
+#ifdef HAVE_CUDA
+template< int blockSize, typename DataFetcher, typename Reduction, typename Result, typename Index >
+__global__
+void
 __launch_bounds__( Reduction_maxThreadsPerBlock, Reduction_minBlocksPerMultiprocessor )
-CudaReductionKernel( DataFetcher dataFetcher,
-                     const Reduction reduction,
-                     Result identity,
-                     Index begin,
-                     Index end,
-                     Result* output )
+   CudaReductionKernel( DataFetcher dataFetcher,
+                        const Reduction reduction,
+                        Result identity,
+                        Index begin,
+                        Index end,
+                        Result* output )
 {
    TNL_ASSERT_EQ( blockDim.x, blockSize, "unexpected block size in CudaReductionKernel" );
 
    // allocate shared memory
    using BlockReduce = CudaBlockReduce< blockSize, Reduction, Result >;
-   union Shared {
+   union Shared
+   {
       typename BlockReduce::Storage blockReduceStorage;
 
       // initialization is not allowed for __shared__ variables, so we need to
       // disable initialization in the implicit default constructor
-      __device__ Shared() {}
+      __device__
+      Shared() {}
    };
    __shared__ Shared storage;
 
@@ -426,32 +396,31 @@ CudaReductionKernel( DataFetcher dataFetcher,
       output[ blockIdx.x ] = result;
 }
 
-template< int blockSize,
-          typename DataFetcher,
-          typename Reduction,
-          typename Result,
-          typename Index >
-__global__ void
+template< int blockSize, typename DataFetcher, typename Reduction, typename Result, typename Index >
+__global__
+void
 __launch_bounds__( Reduction_maxThreadsPerBlock, Reduction_minBlocksPerMultiprocessor )
-CudaReductionWithArgumentKernel( DataFetcher dataFetcher,
-                                 const Reduction reduction,
-                                 Result identity,
-                                 Index begin,
-                                 Index end,
-                                 Result* output,
-                                 Index* idxOutput,
-                                 const Index* idxInput = nullptr )
+   CudaReductionWithArgumentKernel( DataFetcher dataFetcher,
+                                    const Reduction reduction,
+                                    Result identity,
+                                    Index begin,
+                                    Index end,
+                                    Result* output,
+                                    Index* idxOutput,
+                                    const Index* idxInput = nullptr )
 {
    TNL_ASSERT_EQ( blockDim.x, blockSize, "unexpected block size in CudaReductionKernel" );
 
    // allocate shared memory
    using BlockReduce = CudaBlockReduceWithArgument< blockSize, Reduction, Result, Index >;
-   union Shared {
+   union Shared
+   {
       typename BlockReduce::Storage blockReduceStorage;
 
       // initialization is not allowed for __shared__ variables, so we need to
       // disable initialization in the implicit default constructor
-      __device__ Shared() {}
+      __device__
+      Shared() {}
    };
    __shared__ Shared storage;
 
@@ -514,7 +483,8 @@ CudaReductionWithArgumentKernel( DataFetcher dataFetcher,
    __syncthreads();
 
    // Perform the parallel reduction.
-   const std::pair< Result, Index > result_pair = BlockReduce::reduceWithArgument( reduction, identity, result, initialIndex, threadIdx.x, storage.blockReduceStorage );
+   const std::pair< Result, Index > result_pair =
+      BlockReduce::reduceWithArgument( reduction, identity, result, initialIndex, threadIdx.x, storage.blockReduceStorage );
 
    // Store the result back in the global memory.
    if( threadIdx.x == 0 ) {
@@ -524,9 +494,7 @@ CudaReductionWithArgumentKernel( DataFetcher dataFetcher,
 }
 #endif
 
-
-template< typename Index,
-          typename Result >
+template< typename Index, typename Result >
 struct CudaReductionKernelLauncher
 {
    // The number of blocks should be a multiple of the number of multiprocessors
@@ -546,18 +514,13 @@ struct CudaReductionKernelLauncher
    : activeDevice( Cuda::DeviceInfo::getActiveDevice() ),
      blocksdPerMultiprocessor( Cuda::DeviceInfo::getRegistersPerMultiprocessor( activeDevice )
                                / ( Reduction_maxThreadsPerBlock * Reduction_registersPerThread ) ),
-     //desGridSize( blocksdPerMultiprocessor * Cuda::DeviceInfo::getCudaMultiprocessors( activeDevice ) ),
-     desGridSize( Cuda::DeviceInfo::getCudaMultiprocessors( activeDevice ) ),
-     begin( begin ), end( end )
-   {
-   }
+     // desGridSize( blocksdPerMultiprocessor * Cuda::DeviceInfo::getCudaMultiprocessors( activeDevice ) ),
+     desGridSize( Cuda::DeviceInfo::getCudaMultiprocessors( activeDevice ) ), begin( begin ), end( end )
+   {}
 
-   template< typename DataFetcher,
-             typename Reduction >
-   int start( const Reduction& reduction,
-              DataFetcher& dataFetcher,
-              const Result& identity,
-              Result*& output )
+   template< typename DataFetcher, typename Reduction >
+   int
+   start( const Reduction& reduction, DataFetcher& dataFetcher, const Result& identity, Result*& output )
    {
       // create reference to the reduction buffer singleton and set size
       const std::size_t buf_size = 2 * desGridSize * sizeof( Result );
@@ -569,13 +532,13 @@ struct CudaReductionKernelLauncher
       return this->reducedSize;
    }
 
-   template< typename DataFetcher,
-             typename Reduction >
-   int startWithArgument( const Reduction& reduction,
-                          DataFetcher& dataFetcher,
-                          const Result& identity,
-                          Result*& output,
-                          Index*& idxOutput )
+   template< typename DataFetcher, typename Reduction >
+   int
+   startWithArgument( const Reduction& reduction,
+                      DataFetcher& dataFetcher,
+                      const Result& identity,
+                      Result*& output,
+                      Index*& idxOutput )
    {
       // create reference to the reduction buffer singleton and set size
       const std::size_t buf_size = 2 * desGridSize * ( sizeof( Result ) + sizeof( Index ) );
@@ -590,18 +553,19 @@ struct CudaReductionKernelLauncher
 
    template< typename Reduction >
    Result
-   finish( const Reduction& reduction,
-           const Result& identity )
+   finish( const Reduction& reduction, const Result& identity )
    {
       // Input is the first half of the buffer, output is the second half
       CudaReductionBuffer& cudaReductionBuffer = CudaReductionBuffer::getInstance();
       Result* input = cudaReductionBuffer.template getData< Result >();
       Result* output = &input[ desGridSize ];
 
-      while( this->reducedSize > 1 )
-      {
+      while( this->reducedSize > 1 ) {
          // this lambda has to be defined inside the loop, because the captured variable changes
-         auto copyFetch = [input] __cuda_callable__ ( Index i ) { return input[ i ]; };
+         auto copyFetch = [ input ] __cuda_callable__( Index i )
+         {
+            return input[ i ];
+         };
          this->reducedSize = this->launch( 0, this->reducedSize, reduction, copyFetch, identity, output );
          std::swap( input, output );
       }
@@ -618,8 +582,7 @@ struct CudaReductionKernelLauncher
 
    template< typename Reduction >
    std::pair< Result, Index >
-   finishWithArgument( const Reduction& reduction,
-                       const Result& identity )
+   finishWithArgument( const Reduction& reduction, const Result& identity )
    {
       // Input is the first half of the buffer, output is the second half
       CudaReductionBuffer& cudaReductionBuffer = CudaReductionBuffer::getInstance();
@@ -628,11 +591,14 @@ struct CudaReductionKernelLauncher
       Index* idxInput = reinterpret_cast< Index* >( &output[ desGridSize ] );
       Index* idxOutput = &idxInput[ desGridSize ];
 
-      while( this->reducedSize > 1 )
-      {
+      while( this->reducedSize > 1 ) {
          // this lambda has to be defined inside the loop, because the captured variable changes
-         auto copyFetch = [input] __cuda_callable__ ( Index i ) { return input[ i ]; };
-         this->reducedSize = this->launchWithArgument( ( Index ) 0, this->reducedSize, reduction, copyFetch, identity, output, idxOutput, idxInput );
+         auto copyFetch = [ input ] __cuda_callable__( Index i )
+         {
+            return input[ i ];
+         };
+         this->reducedSize = this->launchWithArgument(
+            (Index) 0, this->reducedSize, reduction, copyFetch, identity, output, idxOutput, idxInput );
          std::swap( input, output );
          std::swap( idxInput, idxOutput );
       }
@@ -650,225 +616,245 @@ struct CudaReductionKernelLauncher
       return result;
    }
 
-
-   protected:
-      template< typename DataFetcher,
-                typename Reduction >
-      int launch( const Index begin,
-                  const Index end,
-                  const Reduction& reduction,
-                  DataFetcher& dataFetcher,
-                  const Result& identity,
-                  Result* output )
-      {
+protected:
+   template< typename DataFetcher, typename Reduction >
+   int
+   launch( const Index begin,
+           const Index end,
+           const Reduction& reduction,
+           DataFetcher& dataFetcher,
+           const Result& identity,
+           Result* output )
+   {
 #ifdef HAVE_CUDA
-         const Index size = end - begin;
-         dim3 blockSize, gridSize;
-         blockSize.x = Reduction_maxThreadsPerBlock;
-         gridSize.x = TNL::min( Cuda::getNumberOfBlocks( size, blockSize.x ), desGridSize );
-
-         // This is "general", but this method always sets blockSize.x to a specific value,
-         // so runtime switch is not necessary - it only prolongs the compilation time.
+      const Index size = end - begin;
+      Cuda::LaunchConfiguration launch_config;
+      launch_config.blockSize.x = Reduction_maxThreadsPerBlock;
+      launch_config.gridSize.x = TNL::min( Cuda::getNumberOfBlocks( size, launch_config.blockSize.x ), desGridSize );
+      // shared memory is allocated statically inside the kernel
+
+      // This is "general", but this method always sets blockSize.x to a specific value,
+      // so runtime switch is not necessary - it only prolongs the compilation time.
+      // clang-format off
 /*
-         // Depending on the blockSize we generate appropriate template instance.
-         switch( blockSize.x )
-         {
-            case 512:
-               CudaReductionKernel< 512 >
-               <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output);
-               break;
-            case 256:
-               cudaFuncSetCacheConfig(CudaReductionKernel< 256, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
-
-               CudaReductionKernel< 256 >
-               <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output);
-               break;
-            case 128:
-               cudaFuncSetCacheConfig(CudaReductionKernel< 128, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
-
-               CudaReductionKernel< 128 >
-               <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output);
-               break;
-            case  64:
-               cudaFuncSetCacheConfig(CudaReductionKernel<  64, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
-
-               CudaReductionKernel<  64 >
-               <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output);
-               break;
-            case  32:
-               cudaFuncSetCacheConfig(CudaReductionKernel<  32, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
-
-               CudaReductionKernel<  32 >
-               <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output);
-               break;
-            case  16:
-               cudaFuncSetCacheConfig(CudaReductionKernel<  16, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
-
-               CudaReductionKernel<  16 >
-               <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output);
-               break;
-           case   8:
-               cudaFuncSetCacheConfig(CudaReductionKernel<   8, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
-
-               CudaReductionKernel<   8 >
-               <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output);
-               break;
-            case   4:
-               cudaFuncSetCacheConfig(CudaReductionKernel<   4, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
-
-               CudaReductionKernel<   4 >
-               <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output);
-               break;
-            case   2:
-               cudaFuncSetCacheConfig(CudaReductionKernel<   2, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
-
-               CudaReductionKernel<   2 >
-               <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output);
-               break;
-            case   1:
-               TNL_ASSERT( false, std::cerr << "blockSize should not be 1." << std::endl );
-            default:
-               TNL_ASSERT( false, std::cerr << "Block size is " << blockSize. x << " which is none of 1, 2, 4, 8, 16, 32, 64, 128, 256 or 512." );
-         }
-         cudaStreamSynchronize(0);
-         TNL_CHECK_CUDA_DEVICE;
+      // Depending on the blockSize we generate appropriate template instance.
+      switch( blockSize.x )
+      {
+         case 512:
+            CudaReductionKernel< 512 >
+            <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output);
+            break;
+         case 256:
+            cudaFuncSetCacheConfig(CudaReductionKernel< 256, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
+
+            CudaReductionKernel< 256 >
+            <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output);
+            break;
+         case 128:
+            cudaFuncSetCacheConfig(CudaReductionKernel< 128, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
+
+            CudaReductionKernel< 128 >
+            <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output);
+            break;
+         case  64:
+            cudaFuncSetCacheConfig(CudaReductionKernel<  64, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
+
+            CudaReductionKernel<  64 >
+            <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output);
+            break;
+         case  32:
+            cudaFuncSetCacheConfig(CudaReductionKernel<  32, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
+
+            CudaReductionKernel<  32 >
+            <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output);
+            break;
+         case  16:
+            cudaFuncSetCacheConfig(CudaReductionKernel<  16, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
+
+            CudaReductionKernel<  16 >
+            <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output);
+            break;
+        case   8:
+            cudaFuncSetCacheConfig(CudaReductionKernel<   8, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
+
+            CudaReductionKernel<   8 >
+            <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output);
+            break;
+         case   4:
+            cudaFuncSetCacheConfig(CudaReductionKernel<   4, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
+
+            CudaReductionKernel<   4 >
+            <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output);
+            break;
+         case   2:
+            cudaFuncSetCacheConfig(CudaReductionKernel<   2, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
+
+            CudaReductionKernel<   2 >
+            <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output);
+            break;
+         case   1:
+            TNL_ASSERT( false, std::cerr << "blockSize should not be 1." << std::endl );
+         default:
+            TNL_ASSERT( false, std::cerr << "Block size is " << blockSize. x << " which is none of 1, 2, 4, 8, 16, 32, 64, 128, 256 or 512." );
+      }
+      cudaStreamSynchronize(0);
+      TNL_CHECK_CUDA_DEVICE;
 */
+      // clang-format on
+
+      // Check just to future-proof the code setting blockSize.x
+      if( launch_config.blockSize.x == Reduction_maxThreadsPerBlock ) {
+         cudaFuncSetCacheConfig( CudaReductionKernel< Reduction_maxThreadsPerBlock, DataFetcher, Reduction, Result, Index >,
+                                 cudaFuncCachePreferShared );
+         Cuda::launchKernelSync( CudaReductionKernel< Reduction_maxThreadsPerBlock, DataFetcher, Reduction, Result, Index >,
+                                 0,
+                                 launch_config,
+                                 dataFetcher,
+                                 reduction,
+                                 identity,
+                                 begin,
+                                 end,
+                                 output );
+      }
+      else {
+         TNL_ASSERT( false,
+                     std::cerr << "Block size was expected to be " << Reduction_maxThreadsPerBlock << ", but "
+                               << launch_config.blockSize.x << " was specified." << std::endl; );
+      }
 
-         // Check just to future-proof the code setting blockSize.x
-         if( blockSize.x == Reduction_maxThreadsPerBlock ) {
-            cudaFuncSetCacheConfig(CudaReductionKernel< Reduction_maxThreadsPerBlock, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
-
-            // shared memory is allocated statically inside the kernel
-            CudaReductionKernel< Reduction_maxThreadsPerBlock >
-            <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, begin, end, output);
-            cudaStreamSynchronize(0);
-            TNL_CHECK_CUDA_DEVICE;
-         }
-         else {
-            TNL_ASSERT( false, std::cerr << "Block size was expected to be " << Reduction_maxThreadsPerBlock << ", but " << blockSize.x << " was specified." << std::endl; );
-         }
-
-         // Return the size of the output array on the CUDA device
-         return gridSize.x;
+      // Return the size of the output array on the CUDA device
+      return launch_config.gridSize.x;
 #else
-         throw Exceptions::CudaSupportMissing();
+      throw Exceptions::CudaSupportMissing();
 #endif
-      }
+   }
 
-      template< typename DataFetcher,
-                typename Reduction >
-      int launchWithArgument( const Index begin,
-                              const Index end,
-                              const Reduction& reduction,
-                              DataFetcher& dataFetcher,
-                              const Result& identity,
-                              Result* output,
-                              Index* idxOutput,
-                              const Index* idxInput )
-      {
+   template< typename DataFetcher, typename Reduction >
+   int
+   launchWithArgument( const Index begin,
+                       const Index end,
+                       const Reduction& reduction,
+                       DataFetcher& dataFetcher,
+                       const Result& identity,
+                       Result* output,
+                       Index* idxOutput,
+                       const Index* idxInput )
+   {
 #ifdef HAVE_CUDA
-         dim3 blockSize, gridSize;
-         const Index size = end - begin;
-         blockSize.x = Reduction_maxThreadsPerBlock;
-         gridSize.x = TNL::min( Cuda::getNumberOfBlocks( size, blockSize.x ), desGridSize );
-
-         // This is "general", but this method always sets blockSize.x to a specific value,
-         // so runtime switch is not necessary - it only prolongs the compilation time.
+      const Index size = end - begin;
+      Cuda::LaunchConfiguration launch_config;
+      launch_config.blockSize.x = Reduction_maxThreadsPerBlock;
+      launch_config.gridSize.x = TNL::min( Cuda::getNumberOfBlocks( size, launch_config.blockSize.x ), desGridSize );
+      // shared memory is allocated statically inside the kernel
+
+      // This is "general", but this method always sets blockSize.x to a specific value,
+      // so runtime switch is not necessary - it only prolongs the compilation time.
+      // clang-format off
 /*
-         // Depending on the blockSize we generate appropriate template instance.
-         switch( blockSize.x )
-         {
-            case 512:
-               CudaReductionWithArgumentKernel< 512 >
-               <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output, idxOutput, idxInput );
-               break;
-            case 256:
-               cudaFuncSetCacheConfig(CudaReductionWithArgumentKernel< 256, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
-
-               CudaReductionWithArgumentKernel< 256 >
-               <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output, idxOutput, idxInput );
-               break;
-            case 128:
-               cudaFuncSetCacheConfig(CudaReductionWithArgumentKernel< 128, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
-
-               CudaReductionWithArgumentKernel< 128 >
-               <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output, idxOutput, idxInput );
-               break;
-            case  64:
-               cudaFuncSetCacheConfig(CudaReductionWithArgumentKernel<  64, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
-
-               CudaReductionWithArgumentKernel<  64 >
-               <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output, idxOutput, idxInput );
-               break;
-            case  32:
-               cudaFuncSetCacheConfig(CudaReductionWithArgumentKernel<  32, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
-
-               CudaReductionWithArgumentKernel<  32 >
-               <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output, idxOutput, idxInput );
-               break;
-            case  16:
-               cudaFuncSetCacheConfig(CudaReductionWithArgumentKernel<  16, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
-
-               CudaReductionWithArgumentKernel<  16 >
-               <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output, idxOutput, idxInput );
-               break;
-           case   8:
-               cudaFuncSetCacheConfig(CudaReductionWithArgumentKernel<   8, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
-
-               CudaReductionWithArgumentKernel<   8 >
-               <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output, idxOutput, idxInput );
-               break;
-            case   4:
-               cudaFuncSetCacheConfig(CudaReductionWithArgumentKernel<   4, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
-
-               CudaReductionWithArgumentKernel<   4 >
-               <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output, idxOutput, idxInput );
-               break;
-            case   2:
-               cudaFuncSetCacheConfig(CudaReductionWithArgumentKernel<   2, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
-
-               CudaReductionWithArgumentKernel<   2 >
-               <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output, idxOutput, idxInput );
-               break;
-            case   1:
-               TNL_ASSERT( false, std::cerr << "blockSize should not be 1." << std::endl );
-            default:
-               TNL_ASSERT( false, std::cerr << "Block size is " << blockSize. x << " which is none of 1, 2, 4, 8, 16, 32, 64, 128, 256 or 512." );
-         }
-         cudaStreamSynchronize(0);
-         TNL_CHECK_CUDA_DEVICE;
+      // Depending on the blockSize we generate appropriate template instance.
+      switch( blockSize.x )
+      {
+         case 512:
+            CudaReductionWithArgumentKernel< 512 >
+            <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output, idxOutput, idxInput );
+            break;
+         case 256:
+            cudaFuncSetCacheConfig(CudaReductionWithArgumentKernel< 256, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
+
+            CudaReductionWithArgumentKernel< 256 >
+            <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output, idxOutput, idxInput );
+            break;
+         case 128:
+            cudaFuncSetCacheConfig(CudaReductionWithArgumentKernel< 128, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
+
+            CudaReductionWithArgumentKernel< 128 >
+            <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output, idxOutput, idxInput );
+            break;
+         case  64:
+            cudaFuncSetCacheConfig(CudaReductionWithArgumentKernel<  64, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
+
+            CudaReductionWithArgumentKernel<  64 >
+            <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output, idxOutput, idxInput );
+            break;
+         case  32:
+            cudaFuncSetCacheConfig(CudaReductionWithArgumentKernel<  32, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
+
+            CudaReductionWithArgumentKernel<  32 >
+            <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output, idxOutput, idxInput );
+            break;
+         case  16:
+            cudaFuncSetCacheConfig(CudaReductionWithArgumentKernel<  16, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
+
+            CudaReductionWithArgumentKernel<  16 >
+            <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output, idxOutput, idxInput );
+            break;
+        case   8:
+            cudaFuncSetCacheConfig(CudaReductionWithArgumentKernel<   8, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
+
+            CudaReductionWithArgumentKernel<   8 >
+            <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output, idxOutput, idxInput );
+            break;
+         case   4:
+            cudaFuncSetCacheConfig(CudaReductionWithArgumentKernel<   4, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
+
+            CudaReductionWithArgumentKernel<   4 >
+            <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output, idxOutput, idxInput );
+            break;
+         case   2:
+            cudaFuncSetCacheConfig(CudaReductionWithArgumentKernel<   2, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
+
+            CudaReductionWithArgumentKernel<   2 >
+            <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, size, output, idxOutput, idxInput );
+            break;
+         case   1:
+            TNL_ASSERT( false, std::cerr << "blockSize should not be 1." << std::endl );
+         default:
+            TNL_ASSERT( false, std::cerr << "Block size is " << blockSize. x << " which is none of 1, 2, 4, 8, 16, 32, 64, 128, 256 or 512." );
+      }
+      cudaStreamSynchronize(0);
+      TNL_CHECK_CUDA_DEVICE;
 */
+      // clang-format on
+
+      // Check just to future-proof the code setting blockSize.x
+      if( launch_config.blockSize.x == Reduction_maxThreadsPerBlock ) {
+         cudaFuncSetCacheConfig(
+            CudaReductionWithArgumentKernel< Reduction_maxThreadsPerBlock, DataFetcher, Reduction, Result, Index >,
+            cudaFuncCachePreferShared );
+         Cuda::launchKernelSync(
+            CudaReductionWithArgumentKernel< Reduction_maxThreadsPerBlock, DataFetcher, Reduction, Result, Index >,
+            0,
+            launch_config,
+            dataFetcher,
+            reduction,
+            identity,
+            begin,
+            end,
+            output,
+            idxOutput,
+            idxInput );
+      }
+      else {
+         TNL_ASSERT( false,
+                     std::cerr << "Block size was expected to be " << Reduction_maxThreadsPerBlock << ", but "
+                               << launch_config.blockSize.x << " was specified." << std::endl; );
+      }
 
-         // Check just to future-proof the code setting blockSize.x
-         if( blockSize.x == Reduction_maxThreadsPerBlock ) {
-            cudaFuncSetCacheConfig(CudaReductionWithArgumentKernel< Reduction_maxThreadsPerBlock, DataFetcher, Reduction, Result, Index >, cudaFuncCachePreferShared);
-
-            // shared memory is allocated statically inside the kernel
-            CudaReductionWithArgumentKernel< Reduction_maxThreadsPerBlock >
-            <<< gridSize, blockSize >>>( dataFetcher, reduction, identity, begin, end, output, idxOutput, idxInput );
-            cudaStreamSynchronize(0);
-            TNL_CHECK_CUDA_DEVICE;
-         }
-         else {
-            TNL_ASSERT( false, std::cerr << "Block size was expected to be " << Reduction_maxThreadsPerBlock << ", but " << blockSize.x << " was specified." << std::endl; );
-         }
-
-         // return the size of the output array on the CUDA device
-         return gridSize.x;
+      // return the size of the output array on the CUDA device
+      return launch_config.gridSize.x;
 #else
-         throw Exceptions::CudaSupportMissing();
+      throw Exceptions::CudaSupportMissing();
 #endif
-      }
-
+   }
 
-      const int activeDevice;
-      const int blocksdPerMultiprocessor;
-      const int desGridSize;
-      //const Index originalSize;
-      const Index begin, end;
-      Index reducedSize;
+   const int activeDevice;
+   const int blocksdPerMultiprocessor;
+   const int desGridSize;
+   // const Index originalSize;
+   const Index begin, end;
+   Index reducedSize;
 };
 
-} // namespace detail
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace detail
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/detail/CudaScanKernel.h b/src/TNL/Algorithms/detail/CudaScanKernel.h
index 173852afc0b69647a417f4fef31ab93d685ad7e6..93d9614cf1afe2fca4a40bbc5bf5692dc8c941de 100644
--- a/src/TNL/Algorithms/detail/CudaScanKernel.h
+++ b/src/TNL/Algorithms/detail/CudaScanKernel.h
@@ -7,6 +7,7 @@
 #pragma once
 
 #include <TNL/Math.h>
+#include <TNL/Cuda/KernelLaunch.h>
 #include <TNL/Cuda/SharedMemory.h>
 #include <TNL/Exceptions/CudaBadAlloc.h>
 #include <TNL/Containers/Array.h>
@@ -26,16 +27,14 @@ namespace detail {
  * `ValueType`, e.g. using the `__shfl_sync` intrinsics for supported
  * value types.
  */
-template< ScanType scanType,
-          int blockSize,
-          typename Reduction,
-          typename ValueType >
+template< ScanType scanType, int blockSize, typename Reduction, typename ValueType >
 struct CudaBlockScan
 {
    // storage to be allocated in shared memory
    struct Storage
    {
-      ValueType chunkResults[ blockSize + blockSize / Cuda::getNumberOfSharedMemoryBanks() ];  // accessed via Cuda::getInterleaving()
+      ValueType
+         chunkResults[ blockSize + blockSize / Cuda::getNumberOfSharedMemoryBanks() ];  // accessed via Cuda::getInterleaving()
       ValueType warpResults[ Cuda::getWarpSize() ];
    };
 
@@ -51,13 +50,9 @@ struct CudaBlockScan
     * \param storage      Auxiliary storage (must be allocated as a __shared__
     *                     variable).
     */
-   __device__ static
-   ValueType
-   scan( const Reduction& reduction,
-         ValueType identity,
-         ValueType threadValue,
-         int tid,
-         Storage& storage )
+   __device__
+   static ValueType
+   scan( const Reduction& reduction, ValueType identity, ValueType threadValue, int tid, Storage& storage )
    {
       // verify the configuration
       TNL_ASSERT_EQ( blockDim.x, blockSize, "unexpected block size in CudaBlockScan::scan" );
@@ -75,7 +70,8 @@ struct CudaBlockScan
       #pragma unroll
       for( int stride = 1; stride < Cuda::getWarpSize(); stride *= 2 ) {
          if( lane_id >= stride ) {
-            storage.chunkResults[ chunkResultIdx ] = reduction( storage.chunkResults[ chunkResultIdx ], storage.chunkResults[ Cuda::getInterleaving( tid - stride ) ] );
+            storage.chunkResults[ chunkResultIdx ] = reduction( storage.chunkResults[ chunkResultIdx ],
+                                                                storage.chunkResults[ Cuda::getInterleaving( tid - stride ) ] );
          }
          __syncwarp();
       }
@@ -104,7 +100,7 @@ struct CudaBlockScan
       if( scanType == ScanType::Exclusive ) {
          storage.chunkResults[ chunkResultIdx ] = threadValue;
          __syncthreads();
-         threadValue = (tid == 0) ? identity : storage.chunkResults[ Cuda::getInterleaving( tid - 1 ) ];
+         threadValue = ( tid == 0 ) ? identity : storage.chunkResults[ Cuda::getInterleaving( tid - 1 ) ];
       }
 
       __syncthreads();
@@ -136,13 +132,9 @@ struct CudaBlockScanShfl
     * \param storage      Auxiliary storage (must be allocated as a __shared__
     *                     variable).
     */
-   __device__ static
-   ValueType
-   scan( const Reduction& reduction,
-         ValueType identity,
-         ValueType threadValue,
-         int tid,
-         Storage& storage )
+   __device__
+   static ValueType
+   scan( const Reduction& reduction, ValueType identity, ValueType threadValue, int tid, Storage& storage )
    {
       const int lane_id = tid % Cuda::getWarpSize();
       const int warp_id = tid / Cuda::getWarpSize();
@@ -182,13 +174,9 @@ struct CudaBlockScanShfl
     * total = thread's result of the *inclusive* scan
     */
    template< ScanType warpScanType >
-   __device__ static
-   ValueType
-   warpScan( const Reduction& reduction,
-             ValueType identity,
-             ValueType threadValue,
-             int lane_id,
-             ValueType& total )
+   __device__
+   static ValueType
+   warpScan( const Reduction& reduction, ValueType identity, ValueType threadValue, int lane_id, ValueType& total )
    {
       constexpr unsigned mask = 0xffffffff;
 
@@ -214,58 +202,40 @@ struct CudaBlockScanShfl
    }
 };
 
-template< ScanType scanType,
-          int blockSize,
-          typename Reduction >
-struct CudaBlockScan< scanType, blockSize, Reduction, int >
-: public CudaBlockScanShfl< scanType, blockSize, Reduction, int >
+template< ScanType scanType, int blockSize, typename Reduction >
+struct CudaBlockScan< scanType, blockSize, Reduction, int > : public CudaBlockScanShfl< scanType, blockSize, Reduction, int >
 {};
 
-template< ScanType scanType,
-          int blockSize,
-          typename Reduction >
+template< ScanType scanType, int blockSize, typename Reduction >
 struct CudaBlockScan< scanType, blockSize, Reduction, unsigned int >
 : public CudaBlockScanShfl< scanType, blockSize, Reduction, unsigned int >
 {};
 
-template< ScanType scanType,
-          int blockSize,
-          typename Reduction >
-struct CudaBlockScan< scanType, blockSize, Reduction, long >
-: public CudaBlockScanShfl< scanType, blockSize, Reduction, long >
+template< ScanType scanType, int blockSize, typename Reduction >
+struct CudaBlockScan< scanType, blockSize, Reduction, long > : public CudaBlockScanShfl< scanType, blockSize, Reduction, long >
 {};
 
-template< ScanType scanType,
-          int blockSize,
-          typename Reduction >
+template< ScanType scanType, int blockSize, typename Reduction >
 struct CudaBlockScan< scanType, blockSize, Reduction, unsigned long >
 : public CudaBlockScanShfl< scanType, blockSize, Reduction, unsigned long >
 {};
 
-template< ScanType scanType,
-          int blockSize,
-          typename Reduction >
+template< ScanType scanType, int blockSize, typename Reduction >
 struct CudaBlockScan< scanType, blockSize, Reduction, long long >
 : public CudaBlockScanShfl< scanType, blockSize, Reduction, long long >
 {};
 
-template< ScanType scanType,
-          int blockSize,
-          typename Reduction >
+template< ScanType scanType, int blockSize, typename Reduction >
 struct CudaBlockScan< scanType, blockSize, Reduction, unsigned long long >
 : public CudaBlockScanShfl< scanType, blockSize, Reduction, unsigned long long >
 {};
 
-template< ScanType scanType,
-          int blockSize,
-          typename Reduction >
+template< ScanType scanType, int blockSize, typename Reduction >
 struct CudaBlockScan< scanType, blockSize, Reduction, float >
 : public CudaBlockScanShfl< scanType, blockSize, Reduction, float >
 {};
 
-template< ScanType scanType,
-          int blockSize,
-          typename Reduction >
+template< ScanType scanType, int blockSize, typename Reduction >
 struct CudaBlockScan< scanType, blockSize, Reduction, double >
 : public CudaBlockScanShfl< scanType, blockSize, Reduction, double >
 {};
@@ -274,11 +244,7 @@ struct CudaBlockScan< scanType, blockSize, Reduction, double >
  * It is a *cooperative* operation - all threads must call the operation,
  * otherwise it will deadlock!
  */
-template< ScanType scanType,
-          int blockSize,
-          int valuesPerThread,
-          typename Reduction,
-          typename ValueType >
+template< ScanType scanType, int blockSize, int valuesPerThread, typename Reduction, typename ValueType >
 struct CudaTileScan
 {
    using BlockScan = CudaBlockScan< ScanType::Exclusive, blockSize, Reduction, ValueType >;
@@ -309,10 +275,9 @@ struct CudaTileScan
     * \param storage      Auxiliary storage (must be allocated as a __shared__
     *                     variable).
     */
-   template< typename InputView,
-             typename OutputView >
-   __device__ static
-   ValueType
+   template< typename InputView, typename OutputView >
+   __device__
+   static ValueType
    scan( const InputView input,
          OutputView output,
          typename InputView::IndexType begin,
@@ -342,16 +307,14 @@ struct CudaTileScan
       // Load data into the shared memory.
       {
          int idx = threadIdx.x;
-         while( idx < elementsInBlock )
-         {
+         while( idx < elementsInBlock ) {
             storage.data[ idx ] = input[ begin ];
             begin += blockDim.x;
             idx += blockDim.x;
          }
          // fill the remaining (maxElementsInBlock - elementsInBlock) values with identity
          // (this helps to avoid divergent branches in the blocks below)
-         while( idx < maxElementsInBlock )
-         {
+         while( idx < maxElementsInBlock ) {
             storage.data[ idx ] = identity;
             idx += blockDim.x;
          }
@@ -373,8 +336,7 @@ struct CudaTileScan
 
       // Downsweep step: scan the chunks and use the result of spine scan as the initial value.
       #pragma unroll
-      for( int i = 0; i < valuesPerThread; i++ )
-      {
+      for( int i = 0; i < valuesPerThread; i++ ) {
          const ValueType inputValue = storage.data[ chunkOffset + i ];
          if( scanType == ScanType::Exclusive )
             storage.data[ chunkOffset + i ] = value;
@@ -387,8 +349,7 @@ struct CudaTileScan
       // Store the result back in the global memory.
       {
          int idx = threadIdx.x;
-         while( idx < elementsInBlock )
-         {
+         while( idx < elementsInBlock ) {
             output[ outputBegin ] = storage.data[ idx ];
             outputBegin += blockDim.x;
             idx += blockDim.x;
@@ -402,12 +363,9 @@ struct CudaTileScan
 
 /* CudaScanKernelUpsweep - compute partial reductions per each CUDA block.
  */
-template< int blockSize,
-          int valuesPerThread,
-          typename InputView,
-          typename Reduction,
-          typename ValueType >
-__global__ void
+template< int blockSize, int valuesPerThread, typename InputView, typename Reduction, typename ValueType >
+__global__
+void
 CudaScanKernelUpsweep( const InputView input,
                        typename InputView::IndexType begin,
                        typename InputView::IndexType end,
@@ -423,13 +381,15 @@ CudaScanKernelUpsweep( const InputView input,
 
    // allocate shared memory
    using BlockReduce = CudaBlockReduce< blockSize, Reduction, ValueType >;
-   union Shared {
+   union Shared
+   {
       ValueType data[ blockSize * valuesPerThread ];
       typename BlockReduce::Storage blockReduceStorage;
 
       // initialization is not allowed for __shared__ variables, so we need to
       // disable initialization in the implicit default constructor
-      __device__ Shared() {}
+      __device__
+      Shared() {}
    };
    __shared__ Shared storage;
 
@@ -445,16 +405,14 @@ CudaScanKernelUpsweep( const InputView input,
    // Load data into the shared memory.
    {
       int idx = threadIdx.x;
-      while( idx < elementsInBlock )
-      {
+      while( idx < elementsInBlock ) {
          storage.data[ idx ] = input[ begin ];
          begin += blockDim.x;
          idx += blockDim.x;
       }
       // fill the remaining (maxElementsInBlock - elementsInBlock) values with identity
       // (this helps to avoid divergent branches in the blocks below)
-      while( idx < maxElementsInBlock )
-      {
+      while( idx < maxElementsInBlock ) {
          storage.data[ idx ] = identity;
          idx += blockDim.x;
       }
@@ -480,13 +438,9 @@ CudaScanKernelUpsweep( const InputView input,
 /* CudaScanKernelDownsweep - scan each tile of the input separately in each CUDA
  * block and use the result of spine scan as the initial value
  */
-template< ScanType scanType,
-          int blockSize,
-          int valuesPerThread,
-          typename InputView,
-          typename OutputView,
-          typename Reduction >
-__global__ void
+template< ScanType scanType, int blockSize, int valuesPerThread, typename InputView, typename OutputView, typename Reduction >
+__global__
+void
 CudaScanKernelDownsweep( const InputView input,
                          OutputView output,
                          typename InputView::IndexType begin,
@@ -501,12 +455,14 @@ CudaScanKernelDownsweep( const InputView input,
    using TileScan = CudaTileScan< scanType, blockSize, valuesPerThread, Reduction, ValueType >;
 
    // allocate shared memory
-   union Shared {
+   union Shared
+   {
       typename TileScan::Storage tileScanStorage;
 
       // initialization is not allowed for __shared__ variables, so we need to
       // disable initialization in the implicit default constructor
-      __device__ Shared() {}
+      __device__
+      Shared() {}
    };
    __shared__ Shared storage;
 
@@ -521,13 +477,9 @@ CudaScanKernelDownsweep( const InputView input,
  * block (first phase to be followed by CudaScanKernelUniformShift when there
  * are multiple CUDA blocks).
  */
-template< ScanType scanType,
-          int blockSize,
-          int valuesPerThread,
-          typename InputView,
-          typename OutputView,
-          typename Reduction >
-__global__ void
+template< ScanType scanType, int blockSize, int valuesPerThread, typename InputView, typename OutputView, typename Reduction >
+__global__
+void
 CudaScanKernelParallel( const InputView input,
                         OutputView output,
                         typename InputView::IndexType begin,
@@ -541,17 +493,20 @@ CudaScanKernelParallel( const InputView input,
    using TileScan = CudaTileScan< scanType, blockSize, valuesPerThread, Reduction, ValueType >;
 
    // allocate shared memory
-   union Shared {
+   union Shared
+   {
       typename TileScan::Storage tileScanStorage;
 
       // initialization is not allowed for __shared__ variables, so we need to
       // disable initialization in the implicit default constructor
-      __device__ Shared() {}
+      __device__
+      Shared() {}
    };
    __shared__ Shared storage;
 
    // scan from input into output
-   const ValueType value = TileScan::scan( input, output, begin, end, outputBegin, reduction, identity, identity, storage.tileScanStorage );
+   const ValueType value =
+      TileScan::scan( input, output, begin, end, outputBegin, reduction, identity, identity, storage.tileScanStorage );
 
    // The last thread of the block stores the block result in the global memory.
    if( blockResults && threadIdx.x == blockDim.x - 1 )
@@ -566,11 +521,9 @@ CudaScanKernelParallel( const InputView input,
  * \param shift         A global shift to be applied to all elements of the
  *                      output array.
  */
-template< int blockSize,
-          int valuesPerThread,
-          typename OutputView,
-          typename Reduction >
-__global__ void
+template< int blockSize, int valuesPerThread, typename OutputView, typename Reduction >
+__global__
+void
 CudaScanKernelUniformShift( OutputView output,
                             typename OutputView::IndexType outputBegin,
                             typename OutputView::IndexType outputEnd,
@@ -579,12 +532,14 @@ CudaScanKernelUniformShift( OutputView output,
                             typename OutputView::ValueType shift )
 {
    // load the block result into a __shared__ variable first
-   union Shared {
+   union Shared
+   {
       typename OutputView::ValueType blockResult;
 
       // initialization is not allowed for __shared__ variables, so we need to
       // disable initialization in the implicit default constructor
-      __device__ Shared() {}
+      __device__
+      Shared() {}
    };
    __shared__ Shared storage;
    if( threadIdx.x == 0 )
@@ -601,8 +556,7 @@ CudaScanKernelUniformShift( OutputView output,
    shift = reduction( shift, storage.blockResult );
 
    int valueIdx = 0;
-   while( valueIdx < valuesPerThread && outputBegin < outputEnd )
-   {
+   while( valueIdx < valuesPerThread && outputBegin < outputEnd ) {
       output[ outputBegin ] = reduction( output[ outputBegin ], shift );
       outputBegin += blockDim.x;
       valueIdx++;
@@ -618,7 +572,7 @@ template< ScanType scanType,
           typename ValueType,
           // use blockSize=256 for 32-bit value types, scale with sizeof(ValueType)
           // to keep shared memory requirements constant
-          int blockSize = 256 * 4 / sizeof(ValueType),
+          int blockSize = 256 * 4 / sizeof( ValueType ),
           // valuesPerThread should be odd to avoid shared memory bank conflicts
           int valuesPerThread = 7 >
 struct CudaScanKernelLauncher
@@ -638,9 +592,7 @@ struct CudaScanKernelLauncher
     * \param identity Neutral element for given reduction operation, i.e.
     *                 value such that `reduction(identity, x) == x` for any `x`.
     */
-   template< typename InputArray,
-             typename OutputArray,
-             typename Reduction >
+   template< typename InputArray, typename OutputArray, typename Reduction >
    static void
    perform( const InputArray& input,
             OutputArray& output,
@@ -650,29 +602,13 @@ struct CudaScanKernelLauncher
             Reduction&& reduction,
             typename OutputArray::ValueType identity )
    {
-      const auto blockShifts = performFirstPhase(
-         input,
-         output,
-         begin,
-         end,
-         outputBegin,
-         reduction,
-         identity );
+      const auto blockShifts = performFirstPhase( input, output, begin, end, outputBegin, reduction, identity );
 
       // if the first-phase kernel was launched with just one block, skip the second phase
       if( blockShifts.getSize() <= 2 )
          return;
 
-      performSecondPhase(
-         input,
-         output,
-         blockShifts,
-         begin,
-         end,
-         outputBegin,
-         reduction,
-         identity,
-         identity );
+      performSecondPhase( input, output, blockShifts, begin, end, outputBegin, reduction, identity, identity );
    }
 
    /****
@@ -690,9 +626,7 @@ struct CudaScanKernelLauncher
     * \param identity Neutral element for given reduction operation, i.e.
     *                 value such that `reduction(identity, x) == x` for any `x`.
     */
-   template< typename InputArray,
-             typename OutputArray,
-             typename Reduction >
+   template< typename InputArray, typename OutputArray, typename Reduction >
    static auto
    performFirstPhase( const InputArray& input,
                       OutputArray& output,
@@ -712,54 +646,86 @@ struct CudaScanKernelLauncher
          blockResults.setElement( 0, identity );
 
          // run the kernel with just 1 block
-         if( end - begin <= blockSize )
-            CudaScanKernelParallel< scanType, blockSize, 1 ><<< 1, blockSize >>>
-               ( input.getConstView(),
-                 output.getView(),
-                 begin,
-                 end,
-                 outputBegin,
-                 reduction,
-                 identity,
-                 // blockResults are shifted by 1, because the 0-th element should stay identity
-                 &blockResults.getData()[ 1 ] );
-         else if( end - begin <= blockSize * 3 )
-            CudaScanKernelParallel< scanType, blockSize, 3 ><<< 1, blockSize >>>
-               ( input.getConstView(),
-                 output.getView(),
-                 begin,
-                 end,
-                 outputBegin,
-                 reduction,
-                 identity,
-                 // blockResults are shifted by 1, because the 0-th element should stay identity
-                 &blockResults.getData()[ 1 ] );
-         else if( end - begin <= blockSize * 5 )
-            CudaScanKernelParallel< scanType, blockSize, 5 ><<< 1, blockSize >>>
-               ( input.getConstView(),
-                 output.getView(),
-                 begin,
-                 end,
-                 outputBegin,
-                 reduction,
-                 identity,
-                 // blockResults are shifted by 1, because the 0-th element should stay identity
-                 &blockResults.getData()[ 1 ] );
-         else
-            CudaScanKernelParallel< scanType, blockSize, valuesPerThread ><<< 1, blockSize >>>
-               ( input.getConstView(),
-                 output.getView(),
-                 begin,
-                 end,
-                 outputBegin,
-                 reduction,
-                 identity,
-                 // blockResults are shifted by 1, because the 0-th element should stay identity
-                 &blockResults.getData()[ 1 ] );
-
-         // synchronize the null-stream
-         cudaStreamSynchronize(0);
-         TNL_CHECK_CUDA_DEVICE;
+         if( end - begin <= blockSize ) {
+            constexpr auto kernel = CudaScanKernelParallel< scanType,
+                                                            blockSize,
+                                                            1,
+                                                            typename InputArray::ConstViewType,
+                                                            typename OutputArray::ViewType,
+                                                            Reduction >;
+            Cuda::launchKernelSync( kernel,
+                                    0,
+                                    Cuda::LaunchConfiguration( 1, blockSize ),
+                                    input.getConstView(),
+                                    output.getView(),
+                                    begin,
+                                    end,
+                                    outputBegin,
+                                    reduction,
+                                    identity,
+                                    // blockResults are shifted by 1, because the 0-th element should stay identity
+                                    &blockResults.getData()[ 1 ] );
+         }
+         else if( end - begin <= blockSize * 3 ) {
+            constexpr auto kernel = CudaScanKernelParallel< scanType,
+                                                            blockSize,
+                                                            3,
+                                                            typename InputArray::ConstViewType,
+                                                            typename OutputArray::ViewType,
+                                                            Reduction >;
+            Cuda::launchKernelSync( kernel,
+                                    0,
+                                    Cuda::LaunchConfiguration( 1, blockSize ),
+                                    input.getConstView(),
+                                    output.getView(),
+                                    begin,
+                                    end,
+                                    outputBegin,
+                                    reduction,
+                                    identity,
+                                    // blockResults are shifted by 1, because the 0-th element should stay identity
+                                    &blockResults.getData()[ 1 ] );
+         }
+         else if( end - begin <= blockSize * 5 ) {
+            constexpr auto kernel = CudaScanKernelParallel< scanType,
+                                                            blockSize,
+                                                            5,
+                                                            typename InputArray::ConstViewType,
+                                                            typename OutputArray::ViewType,
+                                                            Reduction >;
+            Cuda::launchKernelSync( kernel,
+                                    0,
+                                    Cuda::LaunchConfiguration( 1, blockSize ),
+                                    input.getConstView(),
+                                    output.getView(),
+                                    begin,
+                                    end,
+                                    outputBegin,
+                                    reduction,
+                                    identity,
+                                    // blockResults are shifted by 1, because the 0-th element should stay identity
+                                    &blockResults.getData()[ 1 ] );
+         }
+         else {
+            constexpr auto kernel = CudaScanKernelParallel< scanType,
+                                                            blockSize,
+                                                            valuesPerThread,
+                                                            typename InputArray::ConstViewType,
+                                                            typename OutputArray::ViewType,
+                                                            Reduction >;
+            Cuda::launchKernelSync( kernel,
+                                    0,
+                                    Cuda::LaunchConfiguration( 1, blockSize ),
+                                    input.getConstView(),
+                                    output.getView(),
+                                    begin,
+                                    end,
+                                    outputBegin,
+                                    reduction,
+                                    identity,
+                                    // blockResults are shifted by 1, because the 0-th element should stay identity
+                                    &blockResults.getData()[ 1 ] );
+         }
 
          // Store the number of CUDA grids for the purpose of unit testing, i.e.
          // to check if we test the algorithm with more than one CUDA grid.
@@ -784,52 +750,64 @@ struct CudaScanKernelLauncher
             const Index gridOffset = gridIdx * maxGridSize() * maxElementsInBlock;
             const Index currentSize = TNL::min( end - begin - gridOffset, maxGridSize() * maxElementsInBlock );
 
-            // setup block and grid size
-            dim3 cudaBlockSize, cudaGridSize;
-            cudaBlockSize.x = blockSize;
-            cudaGridSize.x = roundUpDivision( currentSize, maxElementsInBlock );
+            // set CUDA launch configuration
+            Cuda::LaunchConfiguration launch_config;
+            launch_config.blockSize.x = blockSize;
+            launch_config.gridSize.x = roundUpDivision( currentSize, maxElementsInBlock );
 
             // run the kernel
-            switch( phaseType )
-            {
+            switch( phaseType ) {
                case ScanPhaseType::WriteInFirstPhase:
-                  CudaScanKernelParallel< scanType, blockSize, valuesPerThread ><<< cudaGridSize, cudaBlockSize >>>
-                     ( input.getConstView(),
-                       output.getView(),
-                       begin + gridOffset,
-                       begin + gridOffset + currentSize,
-                       outputBegin + gridOffset,
-                       reduction,
-                       identity,
-                       &blockResults.getData()[ gridIdx * maxGridSize() ] );
-                  break;
+                  {
+                     constexpr auto kernel = CudaScanKernelParallel< scanType,
+                                                                     blockSize,
+                                                                     valuesPerThread,
+                                                                     typename InputArray::ConstViewType,
+                                                                     typename OutputArray::ViewType,
+                                                                     Reduction >;
+                     Cuda::launchKernelAsync( kernel,
+                                              0,
+                                              launch_config,
+                                              input.getConstView(),
+                                              output.getView(),
+                                              begin + gridOffset,
+                                              begin + gridOffset + currentSize,
+                                              outputBegin + gridOffset,
+                                              reduction,
+                                              identity,
+                                              &blockResults.getData()[ gridIdx * maxGridSize() ] );
+                     break;
+                  }
 
                case ScanPhaseType::WriteInSecondPhase:
-                  CudaScanKernelUpsweep< blockSize, valuesPerThread ><<< cudaGridSize, cudaBlockSize >>>
-                     ( input.getConstView(),
-                       begin + gridOffset,
-                       begin + gridOffset + currentSize,
-                       reduction,
-                       identity,
-                       &blockResults.getData()[ gridIdx * maxGridSize() ] );
-                  break;
+                  {
+                     constexpr auto kernel = CudaScanKernelUpsweep< blockSize,
+                                                                    valuesPerThread,
+                                                                    typename InputArray::ConstViewType,
+                                                                    Reduction,
+                                                                    typename OutputArray::ValueType >;
+                     Cuda::launchKernelAsync( kernel,
+                                              0,
+                                              launch_config,
+                                              input.getConstView(),
+                                              begin + gridOffset,
+                                              begin + gridOffset + currentSize,
+                                              reduction,
+                                              identity,
+                                              &blockResults.getData()[ gridIdx * maxGridSize() ] );
+                     break;
+                  }
             }
          }
 
          // synchronize the null-stream after all grids
-         cudaStreamSynchronize(0);
+         cudaStreamSynchronize( 0 );
          TNL_CHECK_CUDA_DEVICE;
 
          // blockResults now contains scan results for each block. The first phase
          // ends by computing an exclusive scan of this array.
          CudaScanKernelLauncher< ScanType::Exclusive, ScanPhaseType::WriteInSecondPhase, ValueType >::perform(
-            blockResults,
-            blockResults,
-            0,
-            blockResults.getSize(),
-            0,
-            reduction,
-            identity );
+            blockResults, blockResults, 0, blockResults.getSize(), 0, reduction, identity );
 
          // Store the number of CUDA grids for the purpose of unit testing, i.e.
          // to check if we test the algorithm with more than one CUDA grid.
@@ -859,10 +837,7 @@ struct CudaScanKernelLauncher
     * \param shift A constant shifting all elements of the array (usually
     *              `identity`, i.e. the neutral value).
     */
-   template< typename InputArray,
-             typename OutputArray,
-             typename BlockShifts,
-             typename Reduction >
+   template< typename InputArray, typename OutputArray, typename BlockShifts, typename Reduction >
    static void
    performSecondPhase( const InputArray& input,
                        OutputArray& output,
@@ -880,13 +855,17 @@ struct CudaScanKernelLauncher
       // if the input was already scanned with just one block in the first phase,
       // it must be shifted uniformly in the second phase
       if( end - begin <= blockSize * valuesPerThread ) {
-         CudaScanKernelUniformShift< blockSize, valuesPerThread ><<< 1, blockSize >>>
-            ( output.getView(),
-              outputBegin,
-              outputBegin + end - begin,
-              reduction,
-              blockShifts.getData(),
-              shift );
+         constexpr auto kernel =
+            CudaScanKernelUniformShift< blockSize, valuesPerThread, typename OutputArray::ViewType, Reduction >;
+         Cuda::launchKernelSync( kernel,
+                                 0,
+                                 Cuda::LaunchConfiguration( 1, blockSize ),
+                                 output.getView(),
+                                 outputBegin,
+                                 outputBegin + end - begin,
+                                 reduction,
+                                 blockShifts.getData(),
+                                 shift );
       }
       else {
          // compute the number of grids
@@ -900,60 +879,78 @@ struct CudaScanKernelLauncher
             const Index gridOffset = gridIdx * maxGridSize() * maxElementsInBlock;
             const Index currentSize = TNL::min( end - begin - gridOffset, maxGridSize() * maxElementsInBlock );
 
-            // setup block and grid size
-            dim3 cudaBlockSize, cudaGridSize;
-            cudaBlockSize.x = blockSize;
-            cudaGridSize.x = roundUpDivision( currentSize, maxElementsInBlock );
+            // set CUDA launch configuration
+            Cuda::LaunchConfiguration launch_config;
+            launch_config.blockSize.x = blockSize;
+            launch_config.gridSize.x = roundUpDivision( currentSize, maxElementsInBlock );
 
             // run the kernel
-            switch( phaseType )
-            {
+            switch( phaseType ) {
                case ScanPhaseType::WriteInFirstPhase:
-                  CudaScanKernelUniformShift< blockSize, valuesPerThread ><<< cudaGridSize, cudaBlockSize >>>
-                     ( output.getView(),
-                       outputBegin + gridOffset,
-                       outputBegin + gridOffset + currentSize,
-                       reduction,
-                       &blockShifts.getData()[ gridIdx * maxGridSize() ],
-                       shift );
-                  break;
+                  {
+                     constexpr auto kernel =
+                        CudaScanKernelUniformShift< blockSize, valuesPerThread, typename OutputArray::ViewType, Reduction >;
+                     Cuda::launchKernelAsync( kernel,
+                                              0,
+                                              launch_config,
+                                              output.getView(),
+                                              outputBegin + gridOffset,
+                                              outputBegin + gridOffset + currentSize,
+                                              reduction,
+                                              &blockShifts.getData()[ gridIdx * maxGridSize() ],
+                                              shift );
+                     break;
+                  }
 
                case ScanPhaseType::WriteInSecondPhase:
-                  CudaScanKernelDownsweep< scanType, blockSize, valuesPerThread ><<< cudaGridSize, cudaBlockSize >>>
-                     ( input.getConstView(),
-                       output.getView(),
-                       begin + gridOffset,
-                       begin + gridOffset + currentSize,
-                       outputBegin + gridOffset,
-                       reduction,
-                       identity,
-                       shift,
-                       &blockShifts.getData()[ gridIdx * maxGridSize() ] );
-                  break;
+                  {
+                     constexpr auto kernel = CudaScanKernelDownsweep< scanType,
+                                                                      blockSize,
+                                                                      valuesPerThread,
+                                                                      typename InputArray::ConstViewType,
+                                                                      typename OutputArray::ViewType,
+                                                                      Reduction >;
+                     Cuda::launchKernelAsync( kernel,
+                                              0,
+                                              launch_config,
+                                              input.getConstView(),
+                                              output.getView(),
+                                              begin + gridOffset,
+                                              begin + gridOffset + currentSize,
+                                              outputBegin + gridOffset,
+                                              reduction,
+                                              identity,
+                                              shift,
+                                              &blockShifts.getData()[ gridIdx * maxGridSize() ] );
+                     break;
+                  }
             }
          }
-      }
 
-      // synchronize the null-stream after all grids
-      cudaStreamSynchronize(0);
-      TNL_CHECK_CUDA_DEVICE;
+         // synchronize the null-stream after all grids
+         cudaStreamSynchronize( 0 );
+         TNL_CHECK_CUDA_DEVICE;
+      }
    }
 
    // The following serves for setting smaller maxGridSize so that we can force
    // the scan in CUDA to run with more than one grid in unit tests.
-   static int& maxGridSize()
+   static int&
+   maxGridSize()
    {
       static int maxGridSize = Cuda::getMaxGridSize();
       return maxGridSize;
    }
 
-   static void resetMaxGridSize()
+   static void
+   resetMaxGridSize()
    {
       maxGridSize() = Cuda::getMaxGridSize();
       gridsCount() = -1;
    }
 
-   static int& gridsCount()
+   static int&
+   gridsCount()
    {
       static int gridsCount = -1;
       return gridsCount;
@@ -962,6 +959,6 @@ struct CudaScanKernelLauncher
 
 #endif
 
-} // namespace detail
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace detail
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/detail/DistributedScan.h b/src/TNL/Algorithms/detail/DistributedScan.h
index c4ac019789fc9703322e66b7ea0cfcb7c35923d6..2472b9808da510f77d6fea47d4fec5815399cb45 100644
--- a/src/TNL/Algorithms/detail/DistributedScan.h
+++ b/src/TNL/Algorithms/detail/DistributedScan.h
@@ -20,9 +20,7 @@ namespace detail {
 template< ScanType Type, ScanPhaseType PhaseType >
 struct DistributedScan
 {
-   template< typename InputDistributedArray,
-             typename OutputDistributedArray,
-             typename Reduction >
+   template< typename InputDistributedArray, typename OutputDistributedArray, typename Reduction >
    static void
    perform( const InputDistributedArray& input,
             OutputDistributedArray& output,
@@ -44,27 +42,31 @@ struct DistributedScan
          // perform first phase on the local data
          const auto inputLocalView = input.getConstLocalView();
          auto outputLocalView = output.getLocalView();
-         const auto block_results = Scan< DeviceType, Type, PhaseType >::performFirstPhase( inputLocalView, outputLocalView, begin, end, begin, reduction, identity );
+         const auto block_results = Scan< DeviceType, Type, PhaseType >::performFirstPhase(
+            inputLocalView, outputLocalView, begin, end, begin, reduction, identity );
          const ValueType local_result = block_results.getElement( block_results.getSize() - 1 );
 
          // exchange local results between ranks
          const int nproc = MPI::GetSize( communicator );
          ValueType dataForScatter[ nproc ];
-         for( int i = 0; i < nproc; i++ ) dataForScatter[ i ] = local_result;
+         for( int i = 0; i < nproc; i++ )
+            dataForScatter[ i ] = local_result;
          Containers::Array< ValueType, Devices::Host > rank_results( nproc );
          // NOTE: exchanging general data types does not work with MPI
          MPI::Alltoall( dataForScatter, 1, rank_results.getData(), 1, communicator );
 
          // compute the scan of the per-rank results
-         Scan< Devices::Host, ScanType::Exclusive, ScanPhaseType::WriteInSecondPhase >::perform( rank_results, rank_results, 0, nproc, 0, reduction, identity );
+         Scan< Devices::Host, ScanType::Exclusive, ScanPhaseType::WriteInSecondPhase >::perform(
+            rank_results, rank_results, 0, nproc, 0, reduction, identity );
 
          // perform the second phase, using the per-block and per-rank results
          const int rank = MPI::GetRank( communicator );
-         Scan< DeviceType, Type, PhaseType >::performSecondPhase( inputLocalView, outputLocalView, block_results, begin, end, begin, reduction, identity, rank_results[ rank ] );
+         Scan< DeviceType, Type, PhaseType >::performSecondPhase(
+            inputLocalView, outputLocalView, block_results, begin, end, begin, reduction, identity, rank_results[ rank ] );
       }
    }
 };
 
-} // namespace detail
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace detail
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/detail/Reduction.h b/src/TNL/Algorithms/detail/Reduction.h
index 6ea2e25b6c51983d5c4434c26ff7ed84652f03b3..3a839d0ab7abad20edb5ff0e9d40f705b5587a76 100644
--- a/src/TNL/Algorithms/detail/Reduction.h
+++ b/src/TNL/Algorithms/detail/Reduction.h
@@ -15,8 +15,8 @@
 #include <TNL/Devices/Cuda.h>
 
 namespace TNL {
-   namespace Algorithms {
-      namespace detail {
+namespace Algorithms {
+namespace detail {
 
 template< typename Device >
 struct Reduction;
@@ -24,83 +24,41 @@ struct Reduction;
 template<>
 struct Reduction< Devices::Sequential >
 {
-   template< typename Index,
-             typename Result,
-             typename Fetch,
-             typename Reduce >
+   template< typename Index, typename Result, typename Fetch, typename Reduce >
    static constexpr Result
-   reduce( const Index begin,
-           const Index end,
-           Fetch&& fetch,
-           Reduce&& reduce,
-           const Result& identity );
+   reduce( Index begin, Index end, Fetch&& fetch, Reduce&& reduce, const Result& identity );
 
-   template< typename Index,
-             typename Result,
-             typename Fetch,
-             typename Reduce >
+   template< typename Index, typename Result, typename Fetch, typename Reduce >
    static constexpr std::pair< Result, Index >
-   reduceWithArgument( const Index begin,
-                       const Index end,
-                       Fetch&& fetch,
-                       Reduce&& reduce,
-                       const Result& identity );
+   reduceWithArgument( Index begin, Index end, Fetch&& fetch, Reduce&& reduce, const Result& identity );
 };
 
 template<>
 struct Reduction< Devices::Host >
 {
-   template< typename Index,
-             typename Result,
-             typename Fetch,
-             typename Reduce >
+   template< typename Index, typename Result, typename Fetch, typename Reduce >
    static Result
-   reduce( const Index begin,
-           const Index end,
-           Fetch&& fetch,
-           Reduce&& reduce,
-           const Result& identity );
+   reduce( Index begin, Index end, Fetch&& fetch, Reduce&& reduce, const Result& identity );
 
-   template< typename Index,
-             typename Result,
-             typename Fetch,
-             typename Reduce >
+   template< typename Index, typename Result, typename Fetch, typename Reduce >
    static std::pair< Result, Index >
-   reduceWithArgument( const Index begin,
-                       const Index end,
-                       Fetch&& fetch,
-                       Reduce&& reduce,
-                       const Result& identity );
+   reduceWithArgument( Index begin, Index end, Fetch&& fetch, Reduce&& reduce, const Result& identity );
 };
 
 template<>
 struct Reduction< Devices::Cuda >
 {
-   template< typename Index,
-             typename Result,
-             typename Fetch,
-             typename Reduce >
+   template< typename Index, typename Result, typename Fetch, typename Reduce >
    static Result
-   reduce( const Index begin,
-           const Index end,
-           Fetch&& fetch,
-           Reduce&& reduce,
-           const Result& identity );
+   reduce( Index begin, Index end, Fetch&& fetch, Reduce&& reduce, const Result& identity );
 
-   template< typename Index,
-             typename Result,
-             typename Fetch,
-             typename Reduce >
+   template< typename Index, typename Result, typename Fetch, typename Reduce >
    static std::pair< Result, Index >
-   reduceWithArgument( const Index begin,
-                       const Index end,
-                       Fetch&& fetch,
-                       Reduce&& reduce,
-                       const Result& identity );
+   reduceWithArgument( Index begin, Index end, Fetch&& fetch, Reduce&& reduce, const Result& identity );
 };
 
-      } // namespace detail
-   } // namespace Algorithms
-} // namespace TNL
+}  // namespace detail
+}  // namespace Algorithms
+}  // namespace TNL
 
 #include <TNL/Algorithms/detail/Reduction.hpp>
diff --git a/src/TNL/Algorithms/detail/Reduction.hpp b/src/TNL/Algorithms/detail/Reduction.hpp
index 9d67447917c956b53928baec4292346bfb1b48b4..dc7d59f4a13aa394aafd610d5acdb210f51426ea 100644
--- a/src/TNL/Algorithms/detail/Reduction.hpp
+++ b/src/TNL/Algorithms/detail/Reduction.hpp
@@ -17,32 +17,28 @@
 #include <TNL/Algorithms/MultiDeviceMemoryOperations.h>
 
 #ifdef CUDA_REDUCTION_PROFILING
-#include <iostream>
-#include <TNL/Timer.h>
+   #include <iostream>
+   #include <TNL/Timer.h>
 #endif
 
 namespace TNL {
-   namespace Algorithms {
-      namespace detail {
+namespace Algorithms {
+namespace detail {
 
 /****
  * Arrays smaller than the following constant
  * are reduced on CPU. The constant must not be larger
  * than maximal CUDA grid size.
  */
-static constexpr int Reduction_minGpuDataSize = 256;//65536; //16384;//1024;//256;
+static constexpr int Reduction_minGpuDataSize = 256;  // 65536; //16384;//1024;//256;
 
-template< typename Index,
-          typename Result,
-          typename Fetch,
-          typename Reduce >
+template< typename Index, typename Result, typename Fetch, typename Reduce >
 constexpr Result
-Reduction< Devices::Sequential >::
-reduce( const Index begin,
-        const Index end,
-        Fetch&& fetch,
-        Reduce&& reduce,
-        const Result& identity )
+Reduction< Devices::Sequential >::reduce( const Index begin,
+                                          const Index end,
+                                          Fetch&& fetch,
+                                          Reduce&& reduce,
+                                          const Result& identity )
 {
    constexpr int block_size = 128;
    const Index size = end - begin;
@@ -81,17 +77,13 @@ reduce( const Index begin,
    }
 }
 
-template< typename Index,
-          typename Result,
-          typename Fetch,
-          typename Reduce >
+template< typename Index, typename Result, typename Fetch, typename Reduce >
 constexpr std::pair< Result, Index >
-Reduction< Devices::Sequential >::
-reduceWithArgument( const Index begin,
-                    const Index end,
-                    Fetch&& fetch,
-                    Reduce&& reduce,
-                    const Result& identity )
+Reduction< Devices::Sequential >::reduceWithArgument( const Index begin,
+                                                      const Index end,
+                                                      Fetch&& fetch,
+                                                      Reduce&& reduce,
+                                                      const Result& identity )
 {
    constexpr int block_size = 128;
    const Index size = end - begin;
@@ -107,8 +99,7 @@ reduceWithArgument( const Index begin,
       for( Index b = 0; b < blocks; b++ ) {
          const Index offset = begin + b * block_size;
          for( int i = 0; i < block_size; i += 4 ) {
-            if( ! initialized )
-            {
+            if( ! initialized ) {
                arg[ 0 ] = offset + i;
                arg[ 1 ] = offset + i + 1;
                arg[ 2 ] = offset + i + 2;
@@ -120,7 +111,7 @@ reduceWithArgument( const Index begin,
                initialized = true;
                continue;
             }
-            reduce( r[ 0 ], fetch( offset + i ),     arg[ 0 ], offset + i );
+            reduce( r[ 0 ], fetch( offset + i ), arg[ 0 ], offset + i );
             reduce( r[ 1 ], fetch( offset + i + 1 ), arg[ 1 ], offset + i + 1 );
             reduce( r[ 2 ], fetch( offset + i + 2 ), arg[ 2 ], offset + i + 2 );
             reduce( r[ 3 ], fetch( offset + i + 3 ), arg[ 3 ], offset + i + 3 );
@@ -149,17 +140,9 @@ reduceWithArgument( const Index begin,
    }
 }
 
-template< typename Index,
-          typename Result,
-          typename Fetch,
-          typename Reduce >
+template< typename Index, typename Result, typename Fetch, typename Reduce >
 Result
-Reduction< Devices::Host >::
-reduce( const Index begin,
-        const Index end,
-        Fetch&& fetch,
-        Reduce&& reduce,
-        const Result& identity )
+Reduction< Devices::Host >::reduce( const Index begin, const Index end, Fetch&& fetch, Reduce&& reduce, const Result& identity )
 {
 #ifdef HAVE_OPENMP
    constexpr int block_size = 128;
@@ -170,10 +153,10 @@ reduce( const Index begin,
       // global result variable
       Result result = identity;
       const int threads = TNL::min( blocks, Devices::Host::getMaxThreadsCount() );
-#pragma omp parallel num_threads(threads)
+      #pragma omp parallel num_threads(threads)
       {
          // initialize array for thread-local results
-         Result r[ 4 ] = { identity, identity, identity, identity  };
+         Result r[ 4 ] = { identity, identity, identity, identity };
 
          #pragma omp for nowait
          for( Index b = 0; b < blocks; b++ ) {
@@ -211,17 +194,13 @@ reduce( const Index begin,
       return Reduction< Devices::Sequential >::reduce( begin, end, fetch, reduce, identity );
 }
 
-template< typename Index,
-          typename Result,
-          typename Fetch,
-          typename Reduce >
+template< typename Index, typename Result, typename Fetch, typename Reduce >
 std::pair< Result, Index >
-Reduction< Devices::Host >::
-reduceWithArgument( const Index begin,
-                    const Index end,
-                    Fetch&& fetch,
-                    Reduce&& reduce,
-                    const Result& identity )
+Reduction< Devices::Host >::reduceWithArgument( const Index begin,
+                                                const Index end,
+                                                Fetch&& fetch,
+                                                Reduce&& reduce,
+                                                const Result& identity )
 {
 #ifdef HAVE_OPENMP
    constexpr int block_size = 128;
@@ -232,11 +211,11 @@ reduceWithArgument( const Index begin,
       // global result variable
       std::pair< Result, Index > result( identity, -1 );
       const int threads = TNL::min( blocks, Devices::Host::getMaxThreadsCount() );
-#pragma omp parallel num_threads(threads)
+      #pragma omp parallel num_threads(threads)
       {
          // initialize array for thread-local results
          Index arg[ 4 ] = { 0, 0, 0, 0 };
-         Result r[ 4 ] = { identity, identity, identity, identity  };
+         Result r[ 4 ] = { identity, identity, identity, identity };
          bool initialized( false );
 
          #pragma omp for nowait
@@ -255,7 +234,7 @@ reduceWithArgument( const Index begin,
                   initialized = true;
                   continue;
                }
-               reduce( r[ 0 ], fetch( offset + i ),     arg[ 0 ], offset + i );
+               reduce( r[ 0 ], fetch( offset + i ), arg[ 0 ], offset + i );
                reduce( r[ 1 ], fetch( offset + i + 1 ), arg[ 1 ], offset + i + 1 );
                reduce( r[ 2 ], fetch( offset + i + 2 ), arg[ 2 ], offset + i + 2 );
                reduce( r[ 3 ], fetch( offset + i + 3 ), arg[ 3 ], offset + i + 3 );
@@ -289,17 +268,9 @@ reduceWithArgument( const Index begin,
       return Reduction< Devices::Sequential >::reduceWithArgument( begin, end, fetch, reduce, identity );
 }
 
-template< typename Index,
-          typename Result,
-          typename Fetch,
-          typename Reduce >
+template< typename Index, typename Result, typename Fetch, typename Reduce >
 Result
-Reduction< Devices::Cuda >::
-reduce( const Index begin,
-        const Index end,
-        Fetch&& fetch,
-        Reduce&& reduce,
-        const Result& identity )
+Reduction< Devices::Cuda >::reduce( const Index begin, const Index end, Fetch&& fetch, Reduce&& reduce, const Result& identity )
 {
    // trivial case, nothing to reduce
    if( begin >= end )
@@ -310,90 +281,85 @@ reduce( const Index begin,
    // in which case reduce on host might fail.
    constexpr bool can_reduce_later_on_host = std::is_fundamental< Result >::value || std::is_pointer< Result >::value;
 
-   #ifdef CUDA_REDUCTION_PROFILING
-      Timer timer;
-      timer.reset();
-      timer.start();
-   #endif
+#ifdef CUDA_REDUCTION_PROFILING
+   Timer timer;
+   timer.reset();
+   timer.start();
+#endif
 
    detail::CudaReductionKernelLauncher< Index, Result > reductionLauncher( begin, end );
 
    // start the reduce on the GPU
-   Result* deviceAux1( 0 );
-   const int reducedSize = reductionLauncher.start(
-      reduce,
-      fetch,
-      identity,
-      deviceAux1 );
-
-   #ifdef CUDA_REDUCTION_PROFILING
-      timer.stop();
-      std::cout << "   Reduction on GPU to size " << reducedSize << " took " << timer.getRealTime() << " sec. " << std::endl;
-      timer.reset();
-      timer.start();
-   #endif
+   Result* deviceAux1 = nullptr;
+   const int reducedSize = reductionLauncher.start( reduce, fetch, identity, deviceAux1 );
+
+#ifdef CUDA_REDUCTION_PROFILING
+   timer.stop();
+   std::cout << "   Reduction on GPU to size " << reducedSize << " took " << timer.getRealTime() << " sec. " << std::endl;
+   timer.reset();
+   timer.start();
+#endif
 
    if( can_reduce_later_on_host ) {
       // transfer the reduced data from device to host
       std::unique_ptr< Result[] > resultArray{
-         // Workaround for nvcc 10.1.168 - it would modify the simple expression
-         // `new Result[reducedSize]` in the source code to `new (Result[reducedSize])`
-         // which is not correct - see e.g. https://stackoverflow.com/a/39671946
-         // Thus, the host compiler would spit out hundreds of warnings...
-         // Funnily enough, nvcc's behaviour depends on the context rather than the
-         // expression, because exactly the same simple expression in different places
-         // does not produce warnings.
-         #ifdef __NVCC__
-         new Result[ static_cast<const int&>(reducedSize) ]
-         #else
+// Workaround for nvcc 10.1.168 - it would modify the simple expression
+// `new Result[reducedSize]` in the source code to `new (Result[reducedSize])`
+// which is not correct - see e.g. https://stackoverflow.com/a/39671946
+// Thus, the host compiler would spit out hundreds of warnings...
+// Funnily enough, nvcc's behaviour depends on the context rather than the
+// expression, because exactly the same simple expression in different places
+// does not produce warnings.
+#ifdef __NVCC__
+         new Result[ static_cast< const int& >( reducedSize ) ]
+#else
          new Result[ reducedSize ]
-         #endif
+#endif
       };
       MultiDeviceMemoryOperations< void, Devices::Cuda >::copy( resultArray.get(), deviceAux1, reducedSize );
 
-      #ifdef CUDA_REDUCTION_PROFILING
-         timer.stop();
-         std::cout << "   Transferring data to CPU took " << timer.getRealTime() << " sec. " << std::endl;
-         timer.reset();
-         timer.start();
-      #endif
+#ifdef CUDA_REDUCTION_PROFILING
+      timer.stop();
+      std::cout << "   Transferring data to CPU took " << timer.getRealTime() << " sec. " << std::endl;
+      timer.reset();
+      timer.start();
+#endif
 
       // finish the reduce on the host
-      auto fetch = [&] ( Index i ) { return resultArray[ i ]; };
+      auto fetch = [ & ]( Index i )
+      {
+         return resultArray[ i ];
+      };
       const Result result = Reduction< Devices::Sequential >::reduce( 0, reducedSize, fetch, reduce, identity );
 
-      #ifdef CUDA_REDUCTION_PROFILING
-         timer.stop();
-         std::cout << "   Reduction of small data set on CPU took " << timer.getRealTime() << " sec. " << std::endl;
-      #endif
+#ifdef CUDA_REDUCTION_PROFILING
+      timer.stop();
+      std::cout << "   Reduction of small data set on CPU took " << timer.getRealTime() << " sec. " << std::endl;
+#endif
       return result;
    }
    else {
       // data can't be safely reduced on host, so continue with the reduce on the GPU
       auto result = reductionLauncher.finish( reduce, identity );
 
-      #ifdef CUDA_REDUCTION_PROFILING
-         timer.stop();
-         std::cout << "   Reduction of small data set on GPU took " << timer.getRealTime() << " sec. " << std::endl;
-         timer.reset();
-         timer.start();
-      #endif
+#ifdef CUDA_REDUCTION_PROFILING
+      timer.stop();
+      std::cout << "   Reduction of small data set on GPU took " << timer.getRealTime() << " sec. " << std::endl;
+      timer.reset();
+      timer.start();
+#endif
 
       return result;
    }
 }
 
-template< typename Index,
-          typename Result,
-          typename Fetch,
-          typename Reduce >
+template< typename Index, typename Result, typename Fetch, typename Reduce >
 std::pair< Result, Index >
-Reduction< Devices::Cuda >::
-reduceWithArgument( const Index begin,
-                    const Index end,
-                    Fetch&& fetch,
-                    Reduce&& reduce,
-                    const Result& identity )
+Reduction< Devices::Cuda >::reduceWithArgument( const Index begin,
+                                                const Index end,
+                                                Fetch&& fetch,
+                                                Reduce&& reduce,
+                                                const Result& identity )
 {
    // trivial case, nothing to reduce
    if( begin >= end )
@@ -404,98 +370,94 @@ reduceWithArgument( const Index begin,
    // in which case reduce on host might fail.
    constexpr bool can_reduce_later_on_host = std::is_fundamental< Result >::value || std::is_pointer< Result >::value;
 
-   #ifdef CUDA_REDUCTION_PROFILING
-      Timer timer;
-      timer.reset();
-      timer.start();
-   #endif
+#ifdef CUDA_REDUCTION_PROFILING
+   Timer timer;
+   timer.reset();
+   timer.start();
+#endif
 
    detail::CudaReductionKernelLauncher< Index, Result > reductionLauncher( begin, end );
 
    // start the reduce on the GPU
-   Result* deviceAux1( nullptr );
-   Index* deviceIndexes( nullptr );
-   const int reducedSize = reductionLauncher.startWithArgument(
-      reduce,
-      fetch,
-      identity,
-      deviceAux1,
-      deviceIndexes );
-
-   #ifdef CUDA_REDUCTION_PROFILING
-      timer.stop();
-      std::cout << "   Reduction on GPU to size " << reducedSize << " took " << timer.getRealTime() << " sec. " << std::endl;
-      timer.reset();
-      timer.start();
-   #endif
+   Result* deviceAux1 = nullptr;
+   Index* deviceIndexes = nullptr;
+   const int reducedSize = reductionLauncher.startWithArgument( reduce, fetch, identity, deviceAux1, deviceIndexes );
+
+#ifdef CUDA_REDUCTION_PROFILING
+   timer.stop();
+   std::cout << "   Reduction on GPU to size " << reducedSize << " took " << timer.getRealTime() << " sec. " << std::endl;
+   timer.reset();
+   timer.start();
+#endif
 
    if( can_reduce_later_on_host ) {
       // transfer the reduced data from device to host
       std::unique_ptr< Result[] > resultArray{
-         // Workaround for nvcc 10.1.168 - it would modify the simple expression
-         // `new Result[reducedSize]` in the source code to `new (Result[reducedSize])`
-         // which is not correct - see e.g. https://stackoverflow.com/a/39671946
-         // Thus, the host compiler would spit out hundreds of warnings...
-         // Funnily enough, nvcc's behaviour depends on the context rather than the
-         // expression, because exactly the same simple expression in different places
-         // does not produce warnings.
-         #ifdef __NVCC__
-         new Result[ static_cast<const int&>(reducedSize) ]
-         #else
+// Workaround for nvcc 10.1.168 - it would modify the simple expression
+// `new Result[reducedSize]` in the source code to `new (Result[reducedSize])`
+// which is not correct - see e.g. https://stackoverflow.com/a/39671946
+// Thus, the host compiler would spit out hundreds of warnings...
+// Funnily enough, nvcc's behaviour depends on the context rather than the
+// expression, because exactly the same simple expression in different places
+// does not produce warnings.
+#ifdef __NVCC__
+         new Result[ static_cast< const int& >( reducedSize ) ]
+#else
          new Result[ reducedSize ]
-         #endif
+#endif
       };
       std::unique_ptr< Index[] > indexArray{
-         // Workaround for nvcc 10.1.168 - it would modify the simple expression
-         // `new Index[reducedSize]` in the source code to `new (Index[reducedSize])`
-         // which is not correct - see e.g. https://stackoverflow.com/a/39671946
-         // Thus, the host compiler would spit out hundreds of warnings...
-         // Funnily enough, nvcc's behaviour depends on the context rather than the
-         // expression, because exactly the same simple expression in different places
-         // does not produce warnings.
-         #ifdef __NVCC__
-         new Index[ static_cast<const int&>(reducedSize) ]
-         #else
+// Workaround for nvcc 10.1.168 - it would modify the simple expression
+// `new Index[reducedSize]` in the source code to `new (Index[reducedSize])`
+// which is not correct - see e.g. https://stackoverflow.com/a/39671946
+// Thus, the host compiler would spit out hundreds of warnings...
+// Funnily enough, nvcc's behaviour depends on the context rather than the
+// expression, because exactly the same simple expression in different places
+// does not produce warnings.
+#ifdef __NVCC__
+         new Index[ static_cast< const int& >( reducedSize ) ]
+#else
          new Index[ reducedSize ]
-         #endif
+#endif
       };
       MultiDeviceMemoryOperations< void, Devices::Cuda >::copy( resultArray.get(), deviceAux1, reducedSize );
       MultiDeviceMemoryOperations< void, Devices::Cuda >::copy( indexArray.get(), deviceIndexes, reducedSize );
 
-      #ifdef CUDA_REDUCTION_PROFILING
-         timer.stop();
-         std::cout << "   Transferring data to CPU took " << timer.getRealTime() << " sec. " << std::endl;
-         timer.reset();
-         timer.start();
-      #endif
+#ifdef CUDA_REDUCTION_PROFILING
+      timer.stop();
+      std::cout << "   Transferring data to CPU took " << timer.getRealTime() << " sec. " << std::endl;
+      timer.reset();
+      timer.start();
+#endif
 
       // finish the reduce on the host
-//      auto fetch = [&] ( Index i ) { return resultArray[ i ]; };
-//      const Result result = Reduction< Devices::Sequential >::reduceWithArgument( reducedSize, argument, reduce, fetch, identity );
+      //      auto fetch = [&] ( Index i ) { return resultArray[ i ]; };
+      //      const Result result = Reduction< Devices::Sequential >::reduceWithArgument( reducedSize, argument, reduce, fetch,
+      //      identity );
       for( Index i = 1; i < reducedSize; i++ )
-         reduce( resultArray[ 0 ], resultArray[ i ], indexArray[ 0 ], indexArray[ i ]  );
+         reduce( resultArray[ 0 ], resultArray[ i ], indexArray[ 0 ], indexArray[ i ] );
 
-      #ifdef CUDA_REDUCTION_PROFILING
-         timer.stop();
-         std::cout << "   Reduction of small data set on CPU took " << timer.getRealTime() << " sec. " << std::endl;
-      #endif
+#ifdef CUDA_REDUCTION_PROFILING
+      timer.stop();
+      std::cout << "   Reduction of small data set on CPU took " << timer.getRealTime() << " sec. " << std::endl;
+#endif
       return std::make_pair( resultArray[ 0 ], indexArray[ 0 ] );
    }
    else {
       // data can't be safely reduced on host, so continue with the reduce on the GPU
       auto result = reductionLauncher.finishWithArgument( reduce, identity );
 
-      #ifdef CUDA_REDUCTION_PROFILING
-         timer.stop();
-         std::cout << "   Reduction of small data set on GPU took " << timer.getRealTime() << " sec. " << std::endl;
-         timer.reset();
-         timer.start();
-      #endif
+#ifdef CUDA_REDUCTION_PROFILING
+      timer.stop();
+      std::cout << "   Reduction of small data set on GPU took " << timer.getRealTime() << " sec. " << std::endl;
+      timer.reset();
+      timer.start();
+#endif
 
       return result;
    }
 }
 
-      } // namespace detail
-   } // namespace Algorithms
-} // namespace TNL
+}  // namespace detail
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/detail/Scan.h b/src/TNL/Algorithms/detail/Scan.h
index 1a491f2566b6ce4e012ca7aac72a81efb7f26090..9517725b5409b51640f76394a36eb9371a62acd0 100644
--- a/src/TNL/Algorithms/detail/Scan.h
+++ b/src/TNL/Algorithms/detail/Scan.h
@@ -23,9 +23,7 @@ struct Scan;
 template< ScanType Type, ScanPhaseType PhaseType >
 struct Scan< Devices::Sequential, Type, PhaseType >
 {
-   template< typename InputArray,
-             typename OutputArray,
-             typename Reduction >
+   template< typename InputArray, typename OutputArray, typename Reduction >
    // returns the last value of inclusive scan (reduction of the whole input)
    static typename OutputArray::ValueType
    perform( const InputArray& input,
@@ -36,9 +34,7 @@ struct Scan< Devices::Sequential, Type, PhaseType >
             Reduction&& reduction,
             typename OutputArray::ValueType identity );
 
-   template< typename InputArray,
-             typename OutputArray,
-             typename Reduction >
+   template< typename InputArray, typename OutputArray, typename Reduction >
    static auto
    performFirstPhase( const InputArray& input,
                       OutputArray& output,
@@ -48,10 +44,7 @@ struct Scan< Devices::Sequential, Type, PhaseType >
                       Reduction&& reduction,
                       typename OutputArray::ValueType identity );
 
-   template< typename InputArray,
-             typename OutputArray,
-             typename BlockShifts,
-             typename Reduction >
+   template< typename InputArray, typename OutputArray, typename BlockShifts, typename Reduction >
    static void
    performSecondPhase( const InputArray& input,
                        OutputArray& output,
@@ -67,9 +60,7 @@ struct Scan< Devices::Sequential, Type, PhaseType >
 template< ScanType Type, ScanPhaseType PhaseType >
 struct Scan< Devices::Host, Type, PhaseType >
 {
-   template< typename InputArray,
-             typename OutputArray,
-             typename Reduction >
+   template< typename InputArray, typename OutputArray, typename Reduction >
    static void
    perform( const InputArray& input,
             OutputArray& output,
@@ -79,9 +70,7 @@ struct Scan< Devices::Host, Type, PhaseType >
             Reduction&& reduction,
             typename OutputArray::ValueType identity );
 
-   template< typename InputArray,
-             typename OutputArray,
-             typename Reduction >
+   template< typename InputArray, typename OutputArray, typename Reduction >
    static auto
    performFirstPhase( const InputArray& input,
                       OutputArray& output,
@@ -91,10 +80,7 @@ struct Scan< Devices::Host, Type, PhaseType >
                       Reduction&& reduction,
                       typename OutputArray::ValueType identity );
 
-   template< typename InputArray,
-             typename OutputArray,
-             typename BlockShifts,
-             typename Reduction >
+   template< typename InputArray, typename OutputArray, typename BlockShifts, typename Reduction >
    static void
    performSecondPhase( const InputArray& input,
                        OutputArray& output,
@@ -110,9 +96,7 @@ struct Scan< Devices::Host, Type, PhaseType >
 template< ScanType Type, ScanPhaseType PhaseType >
 struct Scan< Devices::Cuda, Type, PhaseType >
 {
-   template< typename InputArray,
-             typename OutputArray,
-             typename Reduction >
+   template< typename InputArray, typename OutputArray, typename Reduction >
    static void
    perform( const InputArray& input,
             OutputArray& output,
@@ -122,9 +106,7 @@ struct Scan< Devices::Cuda, Type, PhaseType >
             Reduction&& reduction,
             typename OutputArray::ValueType identity );
 
-   template< typename InputArray,
-             typename OutputArray,
-             typename Reduction >
+   template< typename InputArray, typename OutputArray, typename Reduction >
    static auto
    performFirstPhase( const InputArray& input,
                       OutputArray& output,
@@ -134,10 +116,7 @@ struct Scan< Devices::Cuda, Type, PhaseType >
                       Reduction&& reduction,
                       typename OutputArray::ValueType identity );
 
-   template< typename InputArray,
-             typename OutputArray,
-             typename BlockShifts,
-             typename Reduction >
+   template< typename InputArray, typename OutputArray, typename BlockShifts, typename Reduction >
    static void
    performSecondPhase( const InputArray& input,
                        OutputArray& output,
@@ -150,8 +129,8 @@ struct Scan< Devices::Cuda, Type, PhaseType >
                        typename OutputArray::ValueType shift );
 };
 
-} // namespace detail
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace detail
+}  // namespace Algorithms
+}  // namespace TNL
 
 #include "Scan.hpp"
diff --git a/src/TNL/Algorithms/detail/Scan.hpp b/src/TNL/Algorithms/detail/Scan.hpp
index 39f244f0b3c73b0ab8c2e1fcc07e11242fc2e1db..bee0352d75acee58710ea2b78f5fc518bdee4de5 100644
--- a/src/TNL/Algorithms/detail/Scan.hpp
+++ b/src/TNL/Algorithms/detail/Scan.hpp
@@ -24,18 +24,15 @@ namespace Algorithms {
 namespace detail {
 
 template< ScanType Type, ScanPhaseType PhaseType >
-   template< typename InputArray,
-             typename OutputArray,
-             typename Reduction >
+template< typename InputArray, typename OutputArray, typename Reduction >
 typename OutputArray::ValueType
-Scan< Devices::Sequential, Type, PhaseType >::
-perform( const InputArray& input,
-         OutputArray& output,
-         typename InputArray::IndexType begin,
-         typename InputArray::IndexType end,
-         typename OutputArray::IndexType outputBegin,
-         Reduction&& reduction,
-         typename OutputArray::ValueType identity )
+Scan< Devices::Sequential, Type, PhaseType >::perform( const InputArray& input,
+                                                       OutputArray& output,
+                                                       typename InputArray::IndexType begin,
+                                                       typename InputArray::IndexType end,
+                                                       typename OutputArray::IndexType outputBegin,
+                                                       Reduction&& reduction,
+                                                       typename OutputArray::ValueType identity )
 {
    using ValueType = typename OutputArray::ValueType;
 
@@ -45,7 +42,7 @@ perform( const InputArray& input,
       for( ; begin < end; begin++, outputBegin++ )
          output[ outputBegin ] = aux = reduction( aux, input[ begin ] );
    }
-   else // Exclusive scan
+   else  // Exclusive scan
    {
       for( ; begin < end; begin++, outputBegin++ ) {
          const ValueType x = input[ begin ];
@@ -58,18 +55,15 @@ perform( const InputArray& input,
 }
 
 template< ScanType Type, ScanPhaseType PhaseType >
-   template< typename InputArray,
-             typename OutputArray,
-             typename Reduction >
+template< typename InputArray, typename OutputArray, typename Reduction >
 auto
-Scan< Devices::Sequential, Type, PhaseType >::
-performFirstPhase( const InputArray& input,
-                   OutputArray& output,
-                   typename InputArray::IndexType begin,
-                   typename InputArray::IndexType end,
-                   typename OutputArray::IndexType outputBegin,
-                   Reduction&& reduction,
-                   typename OutputArray::ValueType identity )
+Scan< Devices::Sequential, Type, PhaseType >::performFirstPhase( const InputArray& input,
+                                                                 OutputArray& output,
+                                                                 typename InputArray::IndexType begin,
+                                                                 typename InputArray::IndexType end,
+                                                                 typename OutputArray::IndexType outputBegin,
+                                                                 Reduction&& reduction,
+                                                                 typename OutputArray::ValueType identity )
 {
    if( end <= begin ) {
       Containers::Array< typename OutputArray::ValueType, Devices::Sequential > block_results( 1 );
@@ -77,79 +71,70 @@ performFirstPhase( const InputArray& input,
       return block_results;
    }
 
-   switch( PhaseType )
-   {
+   switch( PhaseType ) {
       case ScanPhaseType::WriteInFirstPhase:
-      {
-         // artificial second phase - pre-scan the block
-         Containers::Array< typename OutputArray::ValueType, Devices::Sequential > block_results( 2 );
-         block_results[ 0 ] = identity;
-         block_results[ 1 ] = perform( input, output, begin, end, outputBegin, reduction, identity );
-         return block_results;
-      }
+         {
+            // artificial second phase - pre-scan the block
+            Containers::Array< typename OutputArray::ValueType, Devices::Sequential > block_results( 2 );
+            block_results[ 0 ] = identity;
+            block_results[ 1 ] = perform( input, output, begin, end, outputBegin, reduction, identity );
+            return block_results;
+         }
 
       case ScanPhaseType::WriteInSecondPhase:
-      {
-         // artificial first phase - only reduce the block
-         Containers::Array< typename OutputArray::ValueType, Devices::Sequential > block_results( 2 );
-         block_results[ 0 ] = identity;
-         block_results[ 1 ] = reduce< Devices::Sequential >( begin, end, input, reduction, identity );
-         return block_results;
-      }
+         {
+            // artificial first phase - only reduce the block
+            Containers::Array< typename OutputArray::ValueType, Devices::Sequential > block_results( 2 );
+            block_results[ 0 ] = identity;
+            block_results[ 1 ] = reduce< Devices::Sequential >( begin, end, input, reduction, identity );
+            return block_results;
+         }
    };
 }
 
 template< ScanType Type, ScanPhaseType PhaseType >
-   template< typename InputArray,
-             typename OutputArray,
-             typename BlockShifts,
-             typename Reduction >
+template< typename InputArray, typename OutputArray, typename BlockShifts, typename Reduction >
 void
-Scan< Devices::Sequential, Type, PhaseType >::
-performSecondPhase( const InputArray& input,
-                    OutputArray& output,
-                    const BlockShifts& blockShifts,
-                    typename InputArray::IndexType begin,
-                    typename InputArray::IndexType end,
-                    typename OutputArray::IndexType outputBegin,
-                    Reduction&& reduction,
-                    typename OutputArray::ValueType identity,
-                    typename OutputArray::ValueType shift )
+Scan< Devices::Sequential, Type, PhaseType >::performSecondPhase( const InputArray& input,
+                                                                  OutputArray& output,
+                                                                  const BlockShifts& blockShifts,
+                                                                  typename InputArray::IndexType begin,
+                                                                  typename InputArray::IndexType end,
+                                                                  typename OutputArray::IndexType outputBegin,
+                                                                  Reduction&& reduction,
+                                                                  typename OutputArray::ValueType identity,
+                                                                  typename OutputArray::ValueType shift )
 {
-   switch( PhaseType )
-   {
+   switch( PhaseType ) {
       case ScanPhaseType::WriteInFirstPhase:
-      {
-         // artificial second phase - uniform shift of a pre-scanned block
-         shift = reduction( shift, blockShifts[ 0 ] );
-         typename InputArray::IndexType outputEnd = outputBegin + end - begin;
-         for( typename InputArray::IndexType i = outputBegin; i < outputEnd; i++ )
-            output[ i ] = reduction( output[ i ], shift );
-         break;
-      }
+         {
+            // artificial second phase - uniform shift of a pre-scanned block
+            shift = reduction( shift, blockShifts[ 0 ] );
+            typename InputArray::IndexType outputEnd = outputBegin + end - begin;
+            for( typename InputArray::IndexType i = outputBegin; i < outputEnd; i++ )
+               output[ i ] = reduction( output[ i ], shift );
+            break;
+         }
 
       case ScanPhaseType::WriteInSecondPhase:
-      {
-         // artificial second phase - only one block, use the shift as the initial value
-         perform( input, output, begin, end, outputBegin, reduction, reduction( shift, blockShifts[ 0 ] ) );
-         break;
-      }
+         {
+            // artificial second phase - only one block, use the shift as the initial value
+            perform( input, output, begin, end, outputBegin, reduction, reduction( shift, blockShifts[ 0 ] ) );
+            break;
+         }
    }
 }
 
 template< ScanType Type, ScanPhaseType PhaseType >
-   template< typename InputArray,
-             typename OutputArray,
-             typename Reduction >
+template< typename InputArray, typename OutputArray, typename Reduction >
 void
-Scan< Devices::Host, Type, PhaseType >::
-perform( const InputArray& input,
-         OutputArray& output,
-         typename InputArray::IndexType begin,
-         typename InputArray::IndexType end,
-         typename OutputArray::IndexType outputBegin,
-         Reduction&& reduction,
-         typename OutputArray::ValueType identity )
+Scan< Devices::Host, Type, PhaseType >::perform( const InputArray& input,
+                                                 OutputArray& output,
+                                                 typename InputArray::IndexType begin,
+                                                 typename InputArray::IndexType end,
+                                                 typename OutputArray::IndexType outputBegin,
+                                                 Reduction&& reduction,
+                                                 typename OutputArray::ValueType identity )
 {
 #ifdef HAVE_OPENMP
    using ValueType = typename OutputArray::ValueType;
@@ -175,48 +160,52 @@ perform( const InputArray& input,
          const IndexType block_end = TNL::min( block_begin + block_size, end );
          const IndexType block_output_begin = outputBegin + block_offset;
 
-         switch( PhaseType )
-         {
+         switch( PhaseType ) {
             case ScanPhaseType::WriteInFirstPhase:
-            {
-               // step 1: pre-scan the block and save the result of the block reduction
-               block_results[ block_idx ] = Scan< Devices::Sequential, Type >::perform( input, output, block_begin, block_end, block_output_begin, reduction, identity );
-
-               #pragma omp barrier
-
-               // step 2: scan the block results
-               #pragma omp single
                {
-                  Scan< Devices::Sequential, ScanType::Exclusive >::perform( block_results, block_results, 0, blocks + 1, 0, reduction, identity );
+                  // step 1: pre-scan the block and save the result of the block reduction
+                  block_results[ block_idx ] = Scan< Devices::Sequential, Type >::perform(
+                     input, output, block_begin, block_end, block_output_begin, reduction, identity );
+
+                  #pragma omp barrier
+
+                  // step 2: scan the block results
+                  #pragma omp single
+                  {
+                     Scan< Devices::Sequential, ScanType::Exclusive >::perform(
+                        block_results, block_results, 0, blocks + 1, 0, reduction, identity );
+                  }
+
+                  // step 3: uniform shift of the pre-scanned block
+                  const ValueType block_shift = block_results[ block_idx ];
+                  const IndexType block_output_end = block_output_begin + block_end - block_begin;
+                  for( IndexType i = block_output_begin; i < block_output_end; i++ )
+                     output[ i ] = reduction( output[ i ], block_shift );
+
+                  break;
                }
 
-               // step 3: uniform shift of the pre-scanned block
-               const ValueType block_shift = block_results[ block_idx ];
-               const IndexType block_output_end = block_output_begin + block_end - block_begin;
-               for( IndexType i = block_output_begin; i < block_output_end; i++ )
-                  output[ i ] = reduction( output[ i ], block_shift );
-
-               break;
-            }
-
             case ScanPhaseType::WriteInSecondPhase:
-            {
-               // step 1: per-block reductions, write the result into the buffer
-               block_results[ block_idx ] = reduce< Devices::Sequential >( block_begin, block_end, input, reduction, identity );
+               {
+                  // step 1: per-block reductions, write the result into the buffer
+                  block_results[ block_idx ] =
+                     reduce< Devices::Sequential >( block_begin, block_end, input, reduction, identity );
 
-               #pragma omp barrier
+                  #pragma omp barrier
 
-               // step 2: scan the block results
-               #pragma omp single
-               {
-                  Scan< Devices::Sequential, ScanType::Exclusive >::perform( block_results, block_results, 0, blocks + 1, 0, reduction, identity );
-               }
+                  // step 2: scan the block results
+                  #pragma omp single
+                  {
+                     Scan< Devices::Sequential, ScanType::Exclusive >::perform(
+                        block_results, block_results, 0, blocks + 1, 0, reduction, identity );
+                  }
 
-               // step 3: per-block scan using the block results as initial values
-               Scan< Devices::Sequential, Type >::perform( input, output, block_begin, block_end, block_output_begin, reduction, block_results[ block_idx ] );
+                  // step 3: per-block scan using the block results as initial values
+                  Scan< Devices::Sequential, Type >::perform(
+                     input, output, block_begin, block_end, block_output_begin, reduction, block_results[ block_idx ] );
 
-               break;
-            }
+                  break;
+               }
          }
       }
    }
@@ -226,18 +215,15 @@ perform( const InputArray& input,
 }
 
 template< ScanType Type, ScanPhaseType PhaseType >
-   template< typename InputArray,
-             typename OutputArray,
-             typename Reduction >
+template< typename InputArray, typename OutputArray, typename Reduction >
 auto
-Scan< Devices::Host, Type, PhaseType >::
-performFirstPhase( const InputArray& input,
-                   OutputArray& output,
-                   typename InputArray::IndexType begin,
-                   typename InputArray::IndexType end,
-                   typename OutputArray::IndexType outputBegin,
-                   Reduction&& reduction,
-                   typename OutputArray::ValueType identity )
+Scan< Devices::Host, Type, PhaseType >::performFirstPhase( const InputArray& input,
+                                                           OutputArray& output,
+                                                           typename InputArray::IndexType begin,
+                                                           typename InputArray::IndexType end,
+                                                           typename OutputArray::IndexType outputBegin,
+                                                           Reduction&& reduction,
+                                                           typename OutputArray::ValueType identity )
 {
 #ifdef HAVE_OPENMP
    using ValueType = typename OutputArray::ValueType;
@@ -266,51 +252,50 @@ performFirstPhase( const InputArray& input,
          const IndexType block_end = TNL::min( block_begin + block_size, end );
          const IndexType block_output_begin = outputBegin + block_offset;
 
-         switch( PhaseType )
-         {
+         switch( PhaseType ) {
             case ScanPhaseType::WriteInFirstPhase:
-            {
-               // pre-scan the block, write the result of the block reduction into the buffer
-               block_results[ block_idx ] = Scan< Devices::Sequential, Type >::perform( input, output, block_begin, block_end, block_output_begin, reduction, identity );
-               break;
-            }
+               {
+                  // pre-scan the block, write the result of the block reduction into the buffer
+                  block_results[ block_idx ] = Scan< Devices::Sequential, Type >::perform(
+                     input, output, block_begin, block_end, block_output_begin, reduction, identity );
+                  break;
+               }
 
             case ScanPhaseType::WriteInSecondPhase:
-            {
-               // upsweep: per-block reductions, write the result into the buffer
-               block_results[ block_idx ] = reduce< Devices::Sequential >( block_begin, block_end, input, reduction, identity );
-               break;
-            }
+               {
+                  // upsweep: per-block reductions, write the result into the buffer
+                  block_results[ block_idx ] =
+                     reduce< Devices::Sequential >( block_begin, block_end, input, reduction, identity );
+                  break;
+               }
          }
       }
 
       // spine step: scan the block results
-      Scan< Devices::Sequential, ScanType::Exclusive >::perform( block_results, block_results, 0, blocks + 1, 0, reduction, identity );
+      Scan< Devices::Sequential, ScanType::Exclusive >::perform(
+         block_results, block_results, 0, blocks + 1, 0, reduction, identity );
 
       // block_results now contains shift values for each block - to be used in the second phase
       return block_results;
    }
    else
 #endif
-      return Scan< Devices::Sequential, Type >::performFirstPhase( input, output, begin, end, outputBegin, reduction, identity );
+      return Scan< Devices::Sequential, Type >::performFirstPhase(
+         input, output, begin, end, outputBegin, reduction, identity );
 }
 
 template< ScanType Type, ScanPhaseType PhaseType >
-   template< typename InputArray,
-             typename OutputArray,
-             typename BlockShifts,
-             typename Reduction >
+template< typename InputArray, typename OutputArray, typename BlockShifts, typename Reduction >
 void
-Scan< Devices::Host, Type, PhaseType >::
-performSecondPhase( const InputArray& input,
-                    OutputArray& output,
-                    const BlockShifts& blockShifts,
-                    typename InputArray::IndexType begin,
-                    typename InputArray::IndexType end,
-                    typename OutputArray::IndexType outputBegin,
-                    Reduction&& reduction,
-                    typename OutputArray::ValueType identity,
-                    typename OutputArray::ValueType shift )
+Scan< Devices::Host, Type, PhaseType >::performSecondPhase( const InputArray& input,
+                                                            OutputArray& output,
+                                                            const BlockShifts& blockShifts,
+                                                            typename InputArray::IndexType begin,
+                                                            typename InputArray::IndexType end,
+                                                            typename OutputArray::IndexType outputBegin,
+                                                            Reduction&& reduction,
+                                                            typename OutputArray::ValueType identity,
+                                                            typename OutputArray::ValueType shift )
 {
 #ifdef HAVE_OPENMP
    using ValueType = typename OutputArray::ValueType;
@@ -336,75 +321,64 @@ performSecondPhase( const InputArray& input,
 
          const ValueType block_shift = reduction( shift, blockShifts[ block_idx ] );
 
-         switch( PhaseType )
-         {
+         switch( PhaseType ) {
             case ScanPhaseType::WriteInFirstPhase:
-            {
-               // uniform shift of a pre-scanned block
-               const IndexType block_output_end = block_output_begin + block_end - block_begin;
-               for( IndexType i = block_output_begin; i < block_output_end; i++ )
-                  output[ i ] = reduction( output[ i ], block_shift );
-               break;
-            }
+               {
+                  // uniform shift of a pre-scanned block
+                  const IndexType block_output_end = block_output_begin + block_end - block_begin;
+                  for( IndexType i = block_output_begin; i < block_output_end; i++ )
+                     output[ i ] = reduction( output[ i ], block_shift );
+                  break;
+               }
 
             case ScanPhaseType::WriteInSecondPhase:
-            {
-               // downsweep: per-block scan using the block results as initial values
-               Scan< Devices::Sequential, Type >::perform( input, output, block_begin, block_end, block_output_begin, reduction, block_shift );
-               break;
-            }
+               {
+                  // downsweep: per-block scan using the block results as initial values
+                  Scan< Devices::Sequential, Type >::perform(
+                     input, output, block_begin, block_end, block_output_begin, reduction, block_shift );
+                  break;
+               }
          }
       }
    }
    else
 #endif
-      Scan< Devices::Sequential, Type >::performSecondPhase( input, output, blockShifts, begin, end, outputBegin, reduction, identity, shift );
+      Scan< Devices::Sequential, Type >::performSecondPhase(
+         input, output, blockShifts, begin, end, outputBegin, reduction, identity, shift );
 }
 
 template< ScanType Type, ScanPhaseType PhaseType >
-   template< typename InputArray,
-             typename OutputArray,
-             typename Reduction >
+template< typename InputArray, typename OutputArray, typename Reduction >
 void
-Scan< Devices::Cuda, Type, PhaseType >::
-perform( const InputArray& input,
-         OutputArray& output,
-         typename InputArray::IndexType begin,
-         typename InputArray::IndexType end,
-         typename OutputArray::IndexType outputBegin,
-         Reduction&& reduction,
-         typename OutputArray::ValueType identity )
+Scan< Devices::Cuda, Type, PhaseType >::perform( const InputArray& input,
+                                                 OutputArray& output,
+                                                 typename InputArray::IndexType begin,
+                                                 typename InputArray::IndexType end,
+                                                 typename OutputArray::IndexType outputBegin,
+                                                 Reduction&& reduction,
+                                                 typename OutputArray::ValueType identity )
 {
 #ifdef HAVE_CUDA
    if( end <= begin )
       return;
 
    detail::CudaScanKernelLauncher< Type, PhaseType, typename OutputArray::ValueType >::perform(
-      input,
-      output,
-      begin,
-      end,
-      outputBegin,
-      std::forward< Reduction >( reduction ),
-      identity );
+      input, output, begin, end, outputBegin, std::forward< Reduction >( reduction ), identity );
 #else
    throw Exceptions::CudaSupportMissing();
 #endif
 }
 
 template< ScanType Type, ScanPhaseType PhaseType >
-   template< typename InputArray,
-             typename OutputArray,
-             typename Reduction >
+template< typename InputArray, typename OutputArray, typename Reduction >
 auto
-Scan< Devices::Cuda, Type, PhaseType >::
-performFirstPhase( const InputArray& input,
-                   OutputArray& output,
-                   typename InputArray::IndexType begin,
-                   typename InputArray::IndexType end,
-                   typename OutputArray::IndexType outputBegin,
-                   Reduction&& reduction,
-                   typename OutputArray::ValueType identity )
+Scan< Devices::Cuda, Type, PhaseType >::performFirstPhase( const InputArray& input,
+                                                           OutputArray& output,
+                                                           typename InputArray::IndexType begin,
+                                                           typename InputArray::IndexType end,
+                                                           typename OutputArray::IndexType outputBegin,
+                                                           Reduction&& reduction,
+                                                           typename OutputArray::ValueType identity )
 {
 #ifdef HAVE_CUDA
    if( end <= begin ) {
@@ -414,54 +388,36 @@ performFirstPhase( const InputArray& input,
    }
 
    return detail::CudaScanKernelLauncher< Type, PhaseType, typename OutputArray::ValueType >::performFirstPhase(
-      input,
-      output,
-      begin,
-      end,
-      outputBegin,
-      std::forward< Reduction >( reduction ),
-      identity );
+      input, output, begin, end, outputBegin, std::forward< Reduction >( reduction ), identity );
 #else
    throw Exceptions::CudaSupportMissing();
 #endif
 }
 
 template< ScanType Type, ScanPhaseType PhaseType >
-   template< typename InputArray,
-             typename OutputArray,
-             typename BlockShifts,
-             typename Reduction >
+template< typename InputArray, typename OutputArray, typename BlockShifts, typename Reduction >
 void
-Scan< Devices::Cuda, Type, PhaseType >::
-performSecondPhase( const InputArray& input,
-                    OutputArray& output,
-                    const BlockShifts& blockShifts,
-                    typename InputArray::IndexType begin,
-                    typename InputArray::IndexType end,
-                    typename OutputArray::IndexType outputBegin,
-                    Reduction&& reduction,
-                    typename OutputArray::ValueType identity,
-                    typename OutputArray::ValueType shift )
+Scan< Devices::Cuda, Type, PhaseType >::performSecondPhase( const InputArray& input,
+                                                            OutputArray& output,
+                                                            const BlockShifts& blockShifts,
+                                                            typename InputArray::IndexType begin,
+                                                            typename InputArray::IndexType end,
+                                                            typename OutputArray::IndexType outputBegin,
+                                                            Reduction&& reduction,
+                                                            typename OutputArray::ValueType identity,
+                                                            typename OutputArray::ValueType shift )
 {
 #ifdef HAVE_CUDA
    if( end <= begin )
       return;
 
    detail::CudaScanKernelLauncher< Type, PhaseType, typename OutputArray::ValueType >::performSecondPhase(
-      input,
-      output,
-      blockShifts,
-      begin,
-      end,
-      outputBegin,
-      std::forward< Reduction >( reduction ),
-      identity,
-      shift );
+      input, output, blockShifts, begin, end, outputBegin, std::forward< Reduction >( reduction ), identity, shift );
 #else
    throw Exceptions::CudaSupportMissing();
 #endif
 }
 
-} // namespace detail
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace detail
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/detail/ScanType.h b/src/TNL/Algorithms/detail/ScanType.h
index 07761fb84cd31aaeb492ccb6cb8a9656e07388e4..d5f9c845ab886f9233ff4f986a94c7a57aeb30a5 100644
--- a/src/TNL/Algorithms/detail/ScanType.h
+++ b/src/TNL/Algorithms/detail/ScanType.h
@@ -12,16 +12,18 @@ namespace TNL {
 namespace Algorithms {
 namespace detail {
 
-enum class ScanType {
+enum class ScanType
+{
    Exclusive,
    Inclusive
 };
 
-enum class ScanPhaseType {
+enum class ScanPhaseType
+{
    WriteInFirstPhase,
    WriteInSecondPhase
 };
 
-} // namespace detail
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace detail
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/distributedScan.h b/src/TNL/Algorithms/distributedScan.h
index 76981c9908b57a6930f3a6964affa908b9e3231d..5ab0311e436cc2e319c0b3a7981d82db9d44c283 100644
--- a/src/TNL/Algorithms/distributedScan.h
+++ b/src/TNL/Algorithms/distributedScan.h
@@ -44,9 +44,7 @@ namespace Algorithms {
  * auto reduction = [] __cuda_callable__ ( const Result& a, const Result& b ) { return ... };
  * ```
  */
-template< typename InputDistributedArray,
-          typename OutputDistributedArray,
-          typename Reduction >
+template< typename InputDistributedArray, typename OutputDistributedArray, typename Reduction >
 void
 distributedInclusiveScan( const InputDistributedArray& input,
                           OutputDistributedArray& output,
@@ -55,13 +53,16 @@ distributedInclusiveScan( const InputDistributedArray& input,
                           Reduction&& reduction,
                           typename OutputDistributedArray::ValueType identity )
 {
-   static_assert( std::is_same< typename InputDistributedArray::DeviceType, typename OutputDistributedArray::DeviceType >::value,
-                  "The input and output arrays must have the same device type." );
-   TNL_ASSERT_EQ( input.getCommunicator(), output.getCommunicator(),
-                  "The input and output arrays must have the same MPI communicator." );
-   TNL_ASSERT_EQ( input.getLocalRange(), output.getLocalRange(),
+   static_assert(
+      std::is_same< typename InputDistributedArray::DeviceType, typename OutputDistributedArray::DeviceType >::value,
+      "The input and output arrays must have the same device type." );
+   TNL_ASSERT_EQ(
+      input.getCommunicator(), output.getCommunicator(), "The input and output arrays must have the same MPI communicator." );
+   TNL_ASSERT_EQ( input.getLocalRange(),
+                  output.getLocalRange(),
                   "The input and output arrays must have the same local range on all ranks." );
-   // TODO: check if evaluating the input is expensive (e.g. a vector expression), otherwise use WriteInSecondPhase (optimal for array-to-array)
+   // TODO: check if evaluating the input is expensive (e.g. a vector expression), otherwise use WriteInSecondPhase (optimal for
+   // array-to-array)
    using Scan = detail::DistributedScan< detail::ScanType::Inclusive, detail::ScanPhaseType::WriteInFirstPhase >;
    Scan::perform( input, output, begin, end, std::forward< Reduction >( reduction ), identity );
    output.startSynchronization();
@@ -75,9 +76,7 @@ distributedInclusiveScan( const InputDistributedArray& input,
  * See \ref distributedInclusiveScan for the explanation of other parameters.
  * Note that when `end` equals 0 (the default), it is set to `input.getSize()`.
  */
-template< typename InputDistributedArray,
-          typename OutputDistributedArray,
-          typename Reduction = TNL::Plus >
+template< typename InputDistributedArray, typename OutputDistributedArray, typename Reduction = TNL::Plus >
 void
 distributedInclusiveScan( const InputDistributedArray& input,
                           OutputDistributedArray& output,
@@ -87,7 +86,8 @@ distributedInclusiveScan( const InputDistributedArray& input,
 {
    if( end == 0 )
       end = input.getSize();
-   constexpr typename OutputDistributedArray::ValueType identity = Reduction::template getIdentity< typename OutputDistributedArray::ValueType >();
+   constexpr typename OutputDistributedArray::ValueType identity =
+      Reduction::template getIdentity< typename OutputDistributedArray::ValueType >();
    distributedInclusiveScan( input, output, begin, end, std::forward< Reduction >( reduction ), identity );
 }
 
@@ -119,9 +119,7 @@ distributedInclusiveScan( const InputDistributedArray& input,
  * auto reduction = [] __cuda_callable__ ( const Result& a, const Result& b ) { return ... };
  * ```
  */
-template< typename InputDistributedArray,
-          typename OutputDistributedArray,
-          typename Reduction >
+template< typename InputDistributedArray, typename OutputDistributedArray, typename Reduction >
 void
 distributedExclusiveScan( const InputDistributedArray& input,
                           OutputDistributedArray& output,
@@ -130,13 +128,16 @@ distributedExclusiveScan( const InputDistributedArray& input,
                           Reduction&& reduction,
                           typename OutputDistributedArray::ValueType identity )
 {
-   static_assert( std::is_same< typename InputDistributedArray::DeviceType, typename OutputDistributedArray::DeviceType >::value,
-                  "The input and output arrays must have the same device type." );
-   TNL_ASSERT_EQ( input.getCommunicator(), output.getCommunicator(),
-                  "The input and output arrays must have the same MPI communicator." );
-   TNL_ASSERT_EQ( input.getLocalRange(), output.getLocalRange(),
+   static_assert(
+      std::is_same< typename InputDistributedArray::DeviceType, typename OutputDistributedArray::DeviceType >::value,
+      "The input and output arrays must have the same device type." );
+   TNL_ASSERT_EQ(
+      input.getCommunicator(), output.getCommunicator(), "The input and output arrays must have the same MPI communicator." );
+   TNL_ASSERT_EQ( input.getLocalRange(),
+                  output.getLocalRange(),
                   "The input and output arrays must have the same local range on all ranks." );
-   // TODO: check if evaluating the input is expensive (e.g. a vector expression), otherwise use WriteInSecondPhase (optimal for array-to-array)
+   // TODO: check if evaluating the input is expensive (e.g. a vector expression), otherwise use WriteInSecondPhase (optimal for
+   // array-to-array)
    using Scan = detail::DistributedScan< detail::ScanType::Exclusive, detail::ScanPhaseType::WriteInFirstPhase >;
    Scan::perform( input, output, begin, end, std::forward< Reduction >( reduction ), identity );
    output.startSynchronization();
@@ -150,9 +151,7 @@ distributedExclusiveScan( const InputDistributedArray& input,
  * See \ref distributedExclusiveScan for the explanation of other parameters.
  * Note that when `end` equals 0 (the default), it is set to `input.getSize()`.
  */
-template< typename InputDistributedArray,
-          typename OutputDistributedArray,
-          typename Reduction = TNL::Plus >
+template< typename InputDistributedArray, typename OutputDistributedArray, typename Reduction = TNL::Plus >
 void
 distributedExclusiveScan( const InputDistributedArray& input,
                           OutputDistributedArray& output,
@@ -162,7 +161,8 @@ distributedExclusiveScan( const InputDistributedArray& input,
 {
    if( end == 0 )
       end = input.getSize();
-   constexpr typename OutputDistributedArray::ValueType identity = Reduction::template getIdentity< typename OutputDistributedArray::ValueType >();
+   constexpr typename OutputDistributedArray::ValueType identity =
+      Reduction::template getIdentity< typename OutputDistributedArray::ValueType >();
    distributedExclusiveScan( input, output, begin, end, std::forward< Reduction >( reduction ), identity );
 }
 
@@ -194,8 +194,7 @@ distributedExclusiveScan( const InputDistributedArray& input,
  * auto reduction = [] __cuda_callable__ ( const Result& a, const Result& b ) { return ... };
  * ```
  */
-template< typename DistributedArray,
-          typename Reduction >
+template< typename DistributedArray, typename Reduction >
 void
 distributedInplaceInclusiveScan( DistributedArray& array,
                                  typename DistributedArray::IndexType begin,
@@ -216,8 +215,7 @@ distributedInplaceInclusiveScan( DistributedArray& array,
  * See \ref distributedInplaceInclusiveScan for the explanation of other parameters.
  * Note that when `end` equals 0 (the default), it is set to `array.getSize()`.
  */
-template< typename DistributedArray,
-          typename Reduction = TNL::Plus >
+template< typename DistributedArray, typename Reduction = TNL::Plus >
 void
 distributedInplaceInclusiveScan( DistributedArray& array,
                                  typename DistributedArray::IndexType begin = 0,
@@ -226,7 +224,8 @@ distributedInplaceInclusiveScan( DistributedArray& array,
 {
    if( end == 0 )
       end = array.getSize();
-   constexpr typename DistributedArray::ValueType identity = Reduction::template getIdentity< typename DistributedArray::ValueType >();
+   constexpr typename DistributedArray::ValueType identity =
+      Reduction::template getIdentity< typename DistributedArray::ValueType >();
    distributedInplaceInclusiveScan( array, begin, end, std::forward< Reduction >( reduction ), identity );
 }
 
@@ -258,8 +257,7 @@ distributedInplaceInclusiveScan( DistributedArray& array,
  * auto reduction = [] __cuda_callable__ ( const Result& a, const Result& b ) { return ... };
  * ```
  */
-template< typename DistributedArray,
-          typename Reduction >
+template< typename DistributedArray, typename Reduction >
 void
 distributedInplaceExclusiveScan( DistributedArray& array,
                                  typename DistributedArray::IndexType begin,
@@ -280,8 +278,7 @@ distributedInplaceExclusiveScan( DistributedArray& array,
  * See \ref distributedInplaceExclusiveScan for the explanation of other parameters.
  * Note that when `end` equals 0 (the default), it is set to `array.getSize()`.
  */
-template< typename DistributedArray,
-          typename Reduction = TNL::Plus >
+template< typename DistributedArray, typename Reduction = TNL::Plus >
 void
 distributedInplaceExclusiveScan( DistributedArray& array,
                                  typename DistributedArray::IndexType begin = 0,
@@ -290,9 +287,10 @@ distributedInplaceExclusiveScan( DistributedArray& array,
 {
    if( end == 0 )
       end = array.getSize();
-   constexpr typename DistributedArray::ValueType identity = Reduction::template getIdentity< typename DistributedArray::ValueType >();
+   constexpr typename DistributedArray::ValueType identity =
+      Reduction::template getIdentity< typename DistributedArray::ValueType >();
    distributedInplaceExclusiveScan( array, begin, end, std::forward< Reduction >( reduction ), identity );
 }
 
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/reduce.h b/src/TNL/Algorithms/reduce.h
index 206ec9c9c7d9aef04ec2bb8d06e20e92dd3ab19b..95beb098f85a27037d25956717c52af3b3987d34 100644
--- a/src/TNL/Algorithms/reduce.h
+++ b/src/TNL/Algorithms/reduce.h
@@ -66,22 +66,12 @@ namespace Algorithms {
  *
  * \include SumExampleWithLambda.out
  */
-template< typename Device,
-          typename Index,
-          typename Result,
-          typename Fetch,
-          typename Reduction >
-Result reduce( const Index begin,
-               const Index end,
-               Fetch&& fetch,
-               Reduction&& reduction,
-               const Result& identity )
+template< typename Device, typename Index, typename Result, typename Fetch, typename Reduction >
+Result
+reduce( Index begin, Index end, Fetch&& fetch, Reduction&& reduction, const Result& identity )
 {
-   return detail::Reduction< Device >::reduce( begin,
-                                               end,
-                                               std::forward< Fetch >( fetch ),
-                                               std::forward< Reduction >( reduction ),
-                                               identity );
+   return detail::Reduction< Device >::reduce(
+      begin, end, std::forward< Fetch >( fetch ), std::forward< Reduction >( reduction ), identity );
 }
 
 /**
@@ -119,16 +109,11 @@ Result reduce( const Index begin,
  *
  * \include SumExampleWithFunctional.out
  */
-template< typename Device,
-          typename Index,
-          typename Fetch,
-          typename Reduction = TNL::Plus >
-auto reduce( const Index begin,
-             const Index end,
-             Fetch&& fetch,
-             Reduction&& reduction = TNL::Plus{} )
+template< typename Device, typename Index, typename Fetch, typename Reduction = TNL::Plus >
+auto
+reduce( Index begin, Index end, Fetch&& fetch, Reduction&& reduction = TNL::Plus{} )
 {
-   using Result = Containers::Expressions::RemoveET< decltype( reduction( fetch(0), fetch(0) ) ) >;
+   using Result = Containers::Expressions::RemoveET< decltype( reduction( fetch( 0 ), fetch( 0 ) ) ) >;
    return reduce< Device >( begin,
                             end,
                             std::forward< Fetch >( fetch ),
@@ -156,19 +141,12 @@ auto reduce( const Index begin,
  *
  * \include reduceArrayExample.out
  */
-template< typename Array,
-          typename Device = typename Array::DeviceType,
-          typename Reduction,
-          typename Result >
-auto reduce( const Array& array,
-             Reduction&& reduction,
-             Result identity )
+template< typename Array, typename Device = typename Array::DeviceType, typename Reduction, typename Result >
+auto
+reduce( const Array& array, Reduction&& reduction, Result identity )
 {
-   return reduce< Device >( (typename Array::IndexType) 0,
-                            array.getSize(),
-                            array.getConstView(),
-                            std::forward< Reduction >( reduction ),
-                            identity );
+   return reduce< Device >(
+      (typename Array::IndexType) 0, array.getSize(), array.getConstView(), std::forward< Reduction >( reduction ), identity );
 }
 
 /**
@@ -195,16 +173,12 @@ auto reduce( const Array& array,
  *
  * \include reduceArrayExample.out
  */
-template< typename Array,
-          typename Device = typename Array::DeviceType,
-          typename Reduction = TNL::Plus >
-auto reduce( const Array& array,
-             Reduction&& reduction = TNL::Plus{} )
+template< typename Array, typename Device = typename Array::DeviceType, typename Reduction = TNL::Plus >
+auto
+reduce( const Array& array, Reduction&& reduction = TNL::Plus{} )
 {
-   using Result = Containers::Expressions::RemoveET< decltype( reduction( array(0), array(0) ) ) >;
-   return reduce< Array, Device >( array,
-                                   std::forward< Reduction >( reduction ),
-                                   reduction.template getIdentity< Result >() );
+   using Result = Containers::Expressions::RemoveET< decltype( reduction( array( 0 ), array( 0 ) ) ) >;
+   return reduce< Array, Device >( array, std::forward< Reduction >( reduction ), reduction.template getIdentity< Result >() );
 }
 
 /**
@@ -253,23 +227,12 @@ auto reduce( const Array& array,
  *
  * \include ReductionWithArgument.out
  */
-template< typename Device,
-          typename Index,
-          typename Result,
-          typename Fetch,
-          typename Reduction >
+template< typename Device, typename Index, typename Result, typename Fetch, typename Reduction >
 std::pair< Result, Index >
-reduceWithArgument( const Index begin,
-                    const Index end,
-                    Fetch&& fetch,
-                    Reduction&& reduction,
-                    const Result& identity )
+reduceWithArgument( Index begin, Index end, Fetch&& fetch, Reduction&& reduction, const Result& identity )
 {
-   return detail::Reduction< Device >::reduceWithArgument( begin,
-                                                           end,
-                                                           std::forward< Fetch >( fetch ),
-                                                           std::forward< Reduction >( reduction ),
-                                                           identity );
+   return detail::Reduction< Device >::reduceWithArgument(
+      begin, end, std::forward< Fetch >( fetch ), std::forward< Reduction >( reduction ), identity );
 }
 
 /**
@@ -316,17 +279,11 @@ reduceWithArgument( const Index begin,
  *
  * \include ReductionWithArgumentWithFunctional.out
  */
-template< typename Device,
-          typename Index,
-          typename Fetch,
-          typename Reduction >
+template< typename Device, typename Index, typename Fetch, typename Reduction >
 auto
-reduceWithArgument( const Index begin,
-                    const Index end,
-                    Fetch&& fetch,
-                    Reduction&& reduction )
+reduceWithArgument( Index begin, Index end, Fetch&& fetch, Reduction&& reduction )
 {
-   using Result = Containers::Expressions::RemoveET< decltype( fetch(0) ) >;
+   using Result = Containers::Expressions::RemoveET< decltype( fetch( 0 ) ) >;
    return reduceWithArgument< Device >( begin,
                                         end,
                                         std::forward< Fetch >( fetch ),
@@ -354,19 +311,12 @@ reduceWithArgument( const Index begin,
  *
  * \include reduceWithArgumentArrayExample.out
  */
-template< typename Array,
-          typename Device = typename Array::DeviceType,
-          typename Reduction,
-          typename Result >
-auto reduceWithArgument( const Array& array,
-                         Reduction&& reduction,
-                         Result identity )
+template< typename Array, typename Device = typename Array::DeviceType, typename Reduction, typename Result >
+auto
+reduceWithArgument( const Array& array, Reduction&& reduction, Result identity )
 {
-   return reduceWithArgument< Device >( (typename Array::IndexType) 0,
-                                        array.getSize(),
-                                        array.getConstView(),
-                                        std::forward< Reduction >( reduction ),
-                                        identity );
+   return reduceWithArgument< Device >(
+      (typename Array::IndexType) 0, array.getSize(), array.getConstView(), std::forward< Reduction >( reduction ), identity );
 }
 
 /**
@@ -391,17 +341,14 @@ auto reduceWithArgument( const Array& array,
  *
  * \include reduceWithArgumentArrayExample.out
  */
-template< typename Array,
-          typename Device = typename Array::DeviceType,
-          typename Reduction >
-auto reduceWithArgument( const Array& array,
-                         Reduction&& reduction )
+template< typename Array, typename Device = typename Array::DeviceType, typename Reduction >
+auto
+reduceWithArgument( const Array& array, Reduction&& reduction )
 {
-   using Result = Containers::Expressions::RemoveET< decltype( array(0) ) >;
-   return reduceWithArgument< Array, Device >( array,
-                                               std::forward< Reduction >( reduction ),
-                                               reduction.template getIdentity< Result >() );
+   using Result = Containers::Expressions::RemoveET< decltype( array( 0 ) ) >;
+   return reduceWithArgument< Array, Device >(
+      array, std::forward< Reduction >( reduction ), reduction.template getIdentity< Result >() );
 }
 
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/scan.h b/src/TNL/Algorithms/scan.h
index ea4e06e5d87d939144a88c90943342f2fbaedd9d..d80f0fc63d9aa48e00001dea0211fc76c05351a9 100644
--- a/src/TNL/Algorithms/scan.h
+++ b/src/TNL/Algorithms/scan.h
@@ -58,9 +58,7 @@ namespace Algorithms {
  *
  * \include inclusiveScanExample.out
  */
-template< typename InputArray,
-          typename OutputArray,
-          typename Reduction >
+template< typename InputArray, typename OutputArray, typename Reduction >
 void
 inclusiveScan( const InputArray& input,
                OutputArray& output,
@@ -72,10 +70,11 @@ inclusiveScan( const InputArray& input,
 {
    static_assert( std::is_same< typename InputArray::DeviceType, typename OutputArray::DeviceType >::value,
                   "The input and output arrays must have the same device type." );
-   TNL_ASSERT_EQ( reduction( identity, identity ), identity,
-                  "identity is not an identity element of the reduction operation" );
-   // TODO: check if evaluating the input is expensive (e.g. a vector expression), otherwise use WriteInSecondPhase (optimal for array-to-array)
-   using Scan = detail::Scan< typename OutputArray::DeviceType, detail::ScanType::Inclusive, detail::ScanPhaseType::WriteInFirstPhase >;
+   TNL_ASSERT_EQ( reduction( identity, identity ), identity, "identity is not an identity element of the reduction operation" );
+   // TODO: check if evaluating the input is expensive (e.g. a vector expression), otherwise use WriteInSecondPhase (optimal for
+   // array-to-array)
+   using Scan =
+      detail::Scan< typename OutputArray::DeviceType, detail::ScanType::Inclusive, detail::ScanPhaseType::WriteInFirstPhase >;
    Scan::perform( input, output, begin, end, outputBegin, std::forward< Reduction >( reduction ), identity );
 }
 
@@ -88,9 +87,7 @@ inclusiveScan( const InputArray& input,
  * See \ref inclusiveScan for the explanation of other parameters.
  * Note that when `end` equals 0 (the default), it is set to `input.getSize()`.
  */
-template< typename InputArray,
-          typename OutputArray,
-          typename Reduction = TNL::Plus >
+template< typename InputArray, typename OutputArray, typename Reduction = TNL::Plus >
 void
 inclusiveScan( const InputArray& input,
                OutputArray& output,
@@ -101,7 +98,7 @@ inclusiveScan( const InputArray& input,
 {
    if( end == 0 )
       end = input.getSize();
-   constexpr typename OutputArray::ValueType identity = Reduction::template getIdentity< typename OutputArray::ValueType >();
+   constexpr auto identity = Reduction::template getIdentity< typename OutputArray::ValueType >();
    inclusiveScan( input, output, begin, end, outputBegin, std::forward< Reduction >( reduction ), identity );
 }
 
@@ -147,9 +144,7 @@ inclusiveScan( const InputArray& input,
  *
  * \include exclusiveScanExample.out
  */
-template< typename InputArray,
-          typename OutputArray,
-          typename Reduction >
+template< typename InputArray, typename OutputArray, typename Reduction >
 void
 exclusiveScan( const InputArray& input,
                OutputArray& output,
@@ -161,10 +156,11 @@ exclusiveScan( const InputArray& input,
 {
    static_assert( std::is_same< typename InputArray::DeviceType, typename OutputArray::DeviceType >::value,
                   "The input and output arrays must have the same device type." );
-   TNL_ASSERT_EQ( reduction( identity, identity ), identity,
-                  "identity is not an identity element of the reduction operation" );
-   // TODO: check if evaluating the input is expensive (e.g. a vector expression), otherwise use WriteInSecondPhase (optimal for array-to-array)
-   using Scan = detail::Scan< typename OutputArray::DeviceType, detail::ScanType::Exclusive, detail::ScanPhaseType::WriteInFirstPhase >;
+   TNL_ASSERT_EQ( reduction( identity, identity ), identity, "identity is not an identity element of the reduction operation" );
+   // TODO: check if evaluating the input is expensive (e.g. a vector expression), otherwise use WriteInSecondPhase (optimal for
+   // array-to-array)
+   using Scan =
+      detail::Scan< typename OutputArray::DeviceType, detail::ScanType::Exclusive, detail::ScanPhaseType::WriteInFirstPhase >;
    Scan::perform( input, output, begin, end, outputBegin, std::forward< Reduction >( reduction ), identity );
 }
 
@@ -177,9 +173,7 @@ exclusiveScan( const InputArray& input,
  * See \ref exclusiveScan for the explanation of other parameters.
  * Note that when `end` equals 0 (the default), it is set to `input.getSize()`.
  */
-template< typename InputArray,
-          typename OutputArray,
-          typename Reduction = TNL::Plus >
+template< typename InputArray, typename OutputArray, typename Reduction = TNL::Plus >
 void
 exclusiveScan( const InputArray& input,
                OutputArray& output,
@@ -190,7 +184,7 @@ exclusiveScan( const InputArray& input,
 {
    if( end == 0 )
       end = input.getSize();
-   constexpr typename OutputArray::ValueType identity = Reduction::template getIdentity< typename OutputArray::ValueType >();
+   constexpr auto identity = Reduction::template getIdentity< typename OutputArray::ValueType >();
    exclusiveScan( input, output, begin, end, outputBegin, std::forward< Reduction >( reduction ), identity );
 }
 
@@ -230,8 +224,7 @@ exclusiveScan( const InputArray& input,
  *
  * \include inplaceInclusiveScanExample.out
  */
-template< typename Array,
-          typename Reduction >
+template< typename Array, typename Reduction >
 void
 inplaceInclusiveScan( Array& array,
                       typename Array::IndexType begin,
@@ -239,9 +232,9 @@ inplaceInclusiveScan( Array& array,
                       Reduction&& reduction,
                       typename Array::ValueType identity )
 {
-   TNL_ASSERT_EQ( reduction( identity, identity ), identity,
-                  "identity is not an identity element of the reduction operation" );
-   using Scan = detail::Scan< typename Array::DeviceType, detail::ScanType::Inclusive, detail::ScanPhaseType::WriteInSecondPhase >;
+   TNL_ASSERT_EQ( reduction( identity, identity ), identity, "identity is not an identity element of the reduction operation" );
+   using Scan =
+      detail::Scan< typename Array::DeviceType, detail::ScanType::Inclusive, detail::ScanPhaseType::WriteInSecondPhase >;
    Scan::perform( array, array, begin, end, begin, std::forward< Reduction >( reduction ), identity );
 }
 
@@ -254,8 +247,7 @@ inplaceInclusiveScan( Array& array,
  * See \ref inplaceInclusiveScan for the explanation of other parameters.
  * Note that when `end` equals 0 (the default), it is set to `array.getSize()`.
  */
-template< typename Array,
-          typename Reduction = TNL::Plus >
+template< typename Array, typename Reduction = TNL::Plus >
 void
 inplaceInclusiveScan( Array& array,
                       typename Array::IndexType begin = 0,
@@ -264,7 +256,7 @@ inplaceInclusiveScan( Array& array,
 {
    if( end == 0 )
       end = array.getSize();
-   constexpr typename Array::ValueType identity = Reduction::template getIdentity< typename Array::ValueType >();
+   constexpr auto identity = Reduction::template getIdentity< typename Array::ValueType >();
    inplaceInclusiveScan( array, begin, end, std::forward< Reduction >( reduction ), identity );
 }
 
@@ -304,8 +296,7 @@ inplaceInclusiveScan( Array& array,
  *
  * \include inplaceExclusiveScanExample.out
  */
-template< typename Array,
-          typename Reduction >
+template< typename Array, typename Reduction >
 void
 inplaceExclusiveScan( Array& array,
                       typename Array::IndexType begin,
@@ -313,9 +304,9 @@ inplaceExclusiveScan( Array& array,
                       Reduction&& reduction,
                       typename Array::ValueType identity )
 {
-   TNL_ASSERT_EQ( reduction( identity, identity ), identity,
-                  "identity is not an identity element of the reduction operation" );
-   using Scan = detail::Scan< typename Array::DeviceType, detail::ScanType::Exclusive, detail::ScanPhaseType::WriteInSecondPhase >;
+   TNL_ASSERT_EQ( reduction( identity, identity ), identity, "identity is not an identity element of the reduction operation" );
+   using Scan =
+      detail::Scan< typename Array::DeviceType, detail::ScanType::Exclusive, detail::ScanPhaseType::WriteInSecondPhase >;
    Scan::perform( array, array, begin, end, begin, std::forward< Reduction >( reduction ), identity );
 }
 
@@ -328,8 +319,7 @@ inplaceExclusiveScan( Array& array,
  * See \ref inplaceExclusiveScan for the explanation of other parameters.
  * Note that when `end` equals 0 (the default), it is set to `array.getSize()`.
  */
-template< typename Array,
-          typename Reduction = TNL::Plus >
+template< typename Array, typename Reduction = TNL::Plus >
 void
 inplaceExclusiveScan( Array& array,
                       typename Array::IndexType begin = 0,
@@ -338,9 +328,9 @@ inplaceExclusiveScan( Array& array,
 {
    if( end == 0 )
       end = array.getSize();
-   constexpr typename Array::ValueType identity = Reduction::template getIdentity< typename Array::ValueType >();
+   constexpr auto identity = Reduction::template getIdentity< typename Array::ValueType >();
    inplaceExclusiveScan( array, begin, end, std::forward< Reduction >( reduction ), identity );
 }
 
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/sort.h b/src/TNL/Algorithms/sort.h
index 27ede770744b4fc0d6f8f949eb3cebb62a70a1b4..0d55707270f5fae885717680e9968501433ea306 100644
--- a/src/TNL/Algorithms/sort.h
+++ b/src/TNL/Algorithms/sort.h
@@ -11,15 +11,15 @@
 #include <TNL/Algorithms/Sorting/DefaultSorter.h>
 
 namespace TNL {
-   namespace Algorithms {
+namespace Algorithms {
 
 /**
  * \brief Function for sorting elements of array or vector in ascending order.
  *
- * \tparam Array is a type of container to be sorted. It can be, for example, \ref TNL::Containers::Array, \ref TNL::Containers::ArrayView,
- *    \ref TNL::Containers::Vector, \ref TNL::Containers::VectorView.
- * \tparam Sorter is an algorithm for sorting. It can be, \ref TNL::Algorithms::Sorting::STLSort for sorting on host and \ref TNL::Algorithms::Sorting::Quicksort
- *    or \ref TNL::Algorithms::Sorting::BitonicSort for sorting on CUDA GPU.
+ * \tparam Array is a type of container to be sorted. It can be, for example, \ref TNL::Containers::Array, \ref
+ * TNL::Containers::ArrayView, \ref TNL::Containers::Vector, \ref TNL::Containers::VectorView. \tparam Sorter is an algorithm
+ * for sorting. It can be, \ref TNL::Algorithms::Sorting::STLSort for sorting on host and \ref
+ * TNL::Algorithms::Sorting::Quicksort or \ref TNL::Algorithms::Sorting::BitonicSort for sorting on CUDA GPU.
  *
  * \param array is an instance of array/array view/vector/vector view for sorting.
  * \param sorter is an instance of sorter.
@@ -33,21 +33,25 @@ namespace TNL {
  * \include SortingExample.out
  *
  */
-template< typename Array,
-          typename Sorter = typename Sorting::DefaultSorter< typename Array::DeviceType >::SorterType >
-void ascendingSort( Array& array, const Sorter& sorter = Sorter{} )
+template< typename Array, typename Sorter = typename Sorting::DefaultSorter< typename Array::DeviceType >::SorterType >
+void
+ascendingSort( Array& array, const Sorter& sorter = Sorter{} )
 {
    using ValueType = typename Array::ValueType;
-   sorter.sort( array, [] __cuda_callable__ ( const ValueType& a, const ValueType& b ) { return a < b; } );
+   sorter.sort( array,
+                [] __cuda_callable__( const ValueType& a, const ValueType& b )
+                {
+                   return a < b;
+                } );
 }
 
 /**
  * \brief Function for sorting elements of array or vector in descending order.
  *
- * \tparam Array is a type of container to be sorted. It can be, for example, \ref TNL::Containers::Array, \ref TNL::Containers::ArrayView,
- *    \ref TNL::Containers::Vector, \ref TNL::Containers::VectorView.
- * \tparam Sorter is an algorithm for sorting. It can be, \ref TNL::Algorithms::Sorting::STLSort for sorting on host and \ref TNL::Algorithms::Sorting::Quicksort
- *    or \ref TNL::Algorithms::Sorting::BitonicSort for sorting on CUDA GPU.
+ * \tparam Array is a type of container to be sorted. It can be, for example, \ref TNL::Containers::Array, \ref
+ * TNL::Containers::ArrayView, \ref TNL::Containers::Vector, \ref TNL::Containers::VectorView. \tparam Sorter is an algorithm
+ * for sorting. It can be, \ref TNL::Algorithms::Sorting::STLSort for sorting on host and \ref
+ * TNL::Algorithms::Sorting::Quicksort or \ref TNL::Algorithms::Sorting::BitonicSort for sorting on CUDA GPU.
  *
  * \param array is an instance of array/array view/vector/vector view for sorting.
  * \param sorter is an instance of sorter.
@@ -61,26 +65,30 @@ void ascendingSort( Array& array, const Sorter& sorter = Sorter{} )
  * \include SortingExample.out
  *
  */
-template< typename Array,
-          typename Sorter = typename Sorting::DefaultSorter< typename Array::DeviceType >::SorterType >
-void descendingSort( Array& array, const Sorter& sorter = Sorter{} )
+template< typename Array, typename Sorter = typename Sorting::DefaultSorter< typename Array::DeviceType >::SorterType >
+void
+descendingSort( Array& array, const Sorter& sorter = Sorter{} )
 {
    using ValueType = typename Array::ValueType;
-   sorter.sort( array, [] __cuda_callable__ ( const ValueType& a, const ValueType& b ) { return a < b; } );
+   sorter.sort( array,
+                [] __cuda_callable__( const ValueType& a, const ValueType& b )
+                {
+                   return a < b;
+                } );
 }
 
 /**
  * \brief Function for sorting elements of array or vector based on a user defined comparison lambda function.
  *
- * \tparam Array is a type of container to be sorted. It can be, for example, \ref TNL::Containers::Array, \ref TNL::Containers::ArrayView,
- *    \ref TNL::Containers::Vector, \ref TNL::Containers::VectorView.
- * \tparam Compare is a lambda function for comparing of two elements. It returns true if the first argument should be ordered before the second. The
- *    lambda function is supposed to be defined as follows (`ValueType` is type of the array elements):
+ * \tparam Array is a type of container to be sorted. It can be, for example, \ref TNL::Containers::Array, \ref
+ * TNL::Containers::ArrayView, \ref TNL::Containers::Vector, \ref TNL::Containers::VectorView. \tparam Compare is a lambda
+ * function for comparing of two elements. It returns true if the first argument should be ordered before the second. The lambda
+ * function is supposed to be defined as follows (`ValueType` is type of the array elements):
  *  ```
  *  auto compare = [] __cuda_callable__ ( const ValueType& a , const ValueType& b ) -> bool { return .... };
  *  ```
- * \tparam Sorter is an algorithm for sorting. It can be, \ref TNL::Algorithms::Sorting::STLSort for sorting on host and \ref TNL::Algorithms::Sorting::Quicksort
- *    or \ref TNL::Algorithms::Sorting::BitonicSort for sorting on CUDA GPU.
+ * \tparam Sorter is an algorithm for sorting. It can be, \ref TNL::Algorithms::Sorting::STLSort for sorting on host and \ref
+ * TNL::Algorithms::Sorting::Quicksort or \ref TNL::Algorithms::Sorting::BitonicSort for sorting on CUDA GPU.
  *
  * \param array is an instance of array/array view/vector/vector view for sorting.
  * \param compare is an instance of the lambda function for comparison of two elements.
@@ -98,7 +106,8 @@ void descendingSort( Array& array, const Sorter& sorter = Sorter{} )
 template< typename Array,
           typename Compare,
           typename Sorter = typename Sorting::DefaultSorter< typename Array::DeviceType >::SorterType >
-void sort( Array& array, const Compare& compare, const Sorter& sorter = Sorter{} )
+void
+sort( Array& array, const Compare& compare, const Sorter& sorter = Sorter{} )
 {
    sorter.sort( array, compare );
 }
@@ -108,17 +117,19 @@ void sort( Array& array, const Compare& compare, const Sorter& sorter = Sorter{}
  *
  * \tparam Device is device on which the sorting algorithms should be executed.
  * \tparam Index is type used for indexing of the sorted data.
- * \tparam Compare is a lambda function for comparing of two elements. It returns true if the first argument should be ordered before the second - both are given
- *  by indices representing their positions. The lambda function is supposed to be defined as follows:
+ * \tparam Compare is a lambda function for comparing of two elements. It returns true if the first argument should be ordered
+ * before the second - both are given by indices representing their positions. The lambda function is supposed to be defined as
+ * follows:
  *  ```
  *  auto compare = [=] __cuda_callable__ ( const Index& a , const Index& b ) -> bool { return .... };
  *  ```
- * \tparam Swap is a lambda function for swaping of two elements which are ordered wrong way. Both elements are represented by indices as well.  It supposed to
- *  be defined as:
+ * \tparam Swap is a lambda function for swaping of two elements which are ordered wrong way. Both elements are represented by
+ * indices as well.  It supposed to be defined as:
  * ```
  * auto swap = [=] __cuda_callable__ (  const Index& a , const Index& b ) mutable { swap( ....); };
  * ```
- * \tparam Sorter is an algorithm for sorting. It can be \ref TNL::Algorithms::Sorting::BitonicSort for sorting on CUDA GPU. Currently there is no algorithm for CPU :(.
+ * \tparam Sorter is an algorithm for sorting. It can be \ref TNL::Algorithms::Sorting::BitonicSort for sorting on CUDA GPU.
+ * Currently there is no algorithm for CPU :(.
  *
  * \param array is an instance of array/array view/vector/vector view for sorting.
  * \param compare is an instance of the lambda function for comparison of two elements.
@@ -138,7 +149,8 @@ template< typename Device,
           typename Compare,
           typename Swap,
           typename Sorter = typename Sorting::DefaultInplaceSorter< Device >::SorterType >
-void sort( const Index begin, const Index end, Compare&& compare, Swap&& swap, const Sorter& sorter = Sorter{} )
+void
+sort( const Index begin, const Index end, Compare&& compare, Swap&& swap, const Sorter& sorter = Sorter{} )
 {
    sorter.template inplaceSort< Device, Index >( begin, end, compare, swap );
 }
@@ -146,10 +158,10 @@ void sort( const Index begin, const Index end, Compare&& compare, Swap&& swap, c
 /**
  * \brief Functions returning true if the array elements are sorted according to the lmabda function `comparison`.
  *
- * \tparam Array is the type of array/vector. It can be, for example,  \ref TNL::Containers::Array, \ref TNL::Containers::ArrayView,
- *    \ref TNL::Containers::Vector, \ref TNL::Containers::VectorView.
- * \tparam Compare is a lambda function for comparing of two elements. It returns true if the first argument should be ordered before the second - both are given
- *  by indices representing their positions. The lambda function is supposed to be defined as follows:
+ * \tparam Array is the type of array/vector. It can be, for example,  \ref TNL::Containers::Array, \ref
+ * TNL::Containers::ArrayView, \ref TNL::Containers::Vector, \ref TNL::Containers::VectorView. \tparam Compare is a lambda
+ * function for comparing of two elements. It returns true if the first argument should be ordered before the second - both are
+ * given by indices representing their positions. The lambda function is supposed to be defined as follows:
  *  ```
  *  auto compare = [=] __cuda_callable__ ( const Index& a , const Index& b ) -> bool { return .... };
  *  ```
@@ -161,23 +173,30 @@ void sort( const Index begin, const Index end, Compare&& compare, Swap&& swap, c
  * \return false  if the array is NOT sorted in ascending order.
  */
 template< typename Array, typename Compare >
-bool isSorted( const Array& arr, const Compare& compare )
+bool
+isSorted( const Array& arr, const Compare& compare )
 {
    using Device = typename Array::DeviceType;
-   if (arr.getSize() <= 1)
+   if( arr.getSize() <= 1 )
       return true;
 
    auto view = arr.getConstView();
-   auto fetch = [=] __cuda_callable__(int i) { return ! compare( view[ i ], view[ i - 1 ] ); };
-   auto reduction = [] __cuda_callable__(bool a, bool b) { return a && b; };
+   auto fetch = [ = ] __cuda_callable__( int i )
+   {
+      return ! compare( view[ i ], view[ i - 1 ] );
+   };
+   auto reduction = [] __cuda_callable__( bool a, bool b )
+   {
+      return a && b;
+   };
    return TNL::Algorithms::reduce< Device >( 1, arr.getSize(), fetch, reduction, true );
 }
 
 /**
  * \brief Functions returning true if the array elements are sorted in ascending order.
  *
- * \tparam Array is the type of array/vector. It can be, for example,  \ref TNL::Containers::Array, \ref TNL::Containers::ArrayView,
- *    \ref TNL::Containers::Vector, \ref TNL::Containers::VectorView.
+ * \tparam Array is the type of array/vector. It can be, for example,  \ref TNL::Containers::Array, \ref
+ * TNL::Containers::ArrayView, \ref TNL::Containers::Vector, \ref TNL::Containers::VectorView.
  *
  * \param arr is an instance of tested array.
  *
@@ -185,17 +204,22 @@ bool isSorted( const Array& arr, const Compare& compare )
  * \return false  if the array is NOT sorted in ascending order.
  */
 template< typename Array >
-bool isAscending( const Array& arr )
+bool
+isAscending( const Array& arr )
 {
    using Value = typename Array::ValueType;
-   return isSorted( arr, [] __cuda_callable__( const Value& a, const Value& b ) { return a < b; });
+   return isSorted( arr,
+                    [] __cuda_callable__( const Value& a, const Value& b )
+                    {
+                       return a < b;
+                    } );
 }
 
 /**
  * \brief Functions returning true if the array elements are sorted in descending order.
  *
- * \tparam Array is the type of array/vector. It can be, for example,  \ref TNL::Containers::Array, \ref TNL::Containers::ArrayView,
- *    \ref TNL::Containers::Vector, \ref TNL::Containers::VectorView.
+ * \tparam Array is the type of array/vector. It can be, for example,  \ref TNL::Containers::Array, \ref
+ * TNL::Containers::ArrayView, \ref TNL::Containers::Vector, \ref TNL::Containers::VectorView.
  *
  * \param arr is an instance of tested array.
  *
@@ -203,11 +227,16 @@ bool isAscending( const Array& arr )
  * \return false  if the array is NOT sorted in descending order.
  */
 template< typename Array >
-bool isDescending( const Array& arr)
+bool
+isDescending( const Array& arr )
 {
    using Value = typename Array::ValueType;
-   return isSorted( arr, [] __cuda_callable__( const Value& a, const Value& b ) { return a > b; });
+   return isSorted( arr,
+                    [] __cuda_callable__( const Value& a, const Value& b )
+                    {
+                       return a > b;
+                    } );
 }
 
-   } // namespace Algorithms
-} // namespace TNL
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/staticFor.h b/src/TNL/Algorithms/staticFor.h
index dadd9aea65075d3573d41d27020ef84d8fd6694d..b97edc1fabff4972206f75120ab55b55016e5692 100644
--- a/src/TNL/Algorithms/staticFor.h
+++ b/src/TNL/Algorithms/staticFor.h
@@ -15,32 +15,28 @@ namespace Algorithms {
 namespace detail {
 
 // special dispatch for `begin >= end` (i.e. empty loop)
-template< typename Index, Index begin, Index end,  typename Func >
-constexpr std::enable_if_t< (begin >= end) >
-static_for_dispatch( Func &&f )
+template< typename Index, Index begin, Index end, typename Func >
+constexpr std::enable_if_t< ( begin >= end ) >
+static_for_dispatch( Func&& f )
 {}
 
 #if __cplusplus >= 201703L
 
 // C++17 version using fold expression
-template< typename Index, Index begin,  typename Func, Index... idx, typename... ArgTypes >
-constexpr void static_for_impl( Func &&f, std::integer_sequence< Index, idx... >, ArgTypes&&... args )
+template< typename Index, Index begin, typename Func, Index... idx, typename... ArgTypes >
+constexpr void
+static_for_impl( Func&& f, std::integer_sequence< Index, idx... >, ArgTypes&&... args )
 {
-   ( f( std::integral_constant< Index, begin + idx >{},
-        std::forward< ArgTypes >( args )... ),
-     ... );
+   ( f( std::integral_constant< Index, begin + idx >{}, std::forward< ArgTypes >( args )... ), ... );
 }
 
 // general dispatch for `begin < end`
-template< typename Index, Index begin, Index end,  typename Func, typename... ArgTypes >
-constexpr std::enable_if_t< (begin < end) >
-static_for_dispatch( Func &&f, ArgTypes&&... args )
+template< typename Index, Index begin, Index end, typename Func, typename... ArgTypes >
+constexpr std::enable_if_t< ( begin < end ) >
+static_for_dispatch( Func&& f, ArgTypes&&... args )
 {
    static_for_impl< Index, begin >(
-         std::forward< Func >( f ),
-         std::make_integer_sequence< Index, end - begin >{},
-         std::forward< ArgTypes >( args )...
-   );
+      std::forward< Func >( f ), std::make_integer_sequence< Index, end - begin >{}, std::forward< ArgTypes >( args )... );
 }
 
 #else
@@ -51,29 +47,26 @@ static_for_dispatch( Func &&f, ArgTypes&&... args )
 // the recursion depth.)
 
 // special dispatch for 1 iteration
-template< typename Index, Index begin, Index end,  typename Func, typename... ArgTypes >
-constexpr std::enable_if_t< (begin < end && end - begin == 1) >
-static_for_dispatch( Func &&f, ArgTypes&&... args )
+template< typename Index, Index begin, Index end, typename Func, typename... ArgTypes >
+constexpr std::enable_if_t< ( begin < end && end - begin == 1 ) >
+static_for_dispatch( Func&& f, ArgTypes&&... args )
 {
-   f( std::integral_constant< Index, begin >{},
-      std::forward< ArgTypes >( args )... );
+   f( std::integral_constant< Index, begin >{}, std::forward< ArgTypes >( args )... );
 }
 
 // general dispatch for at least 2 iterations
-template< typename Index, Index begin, Index end,  typename Func, typename... ArgTypes >
-constexpr std::enable_if_t< (begin < end && end - begin >= 2) >
-static_for_dispatch( Func &&f, ArgTypes&&... args )
+template< typename Index, Index begin, Index end, typename Func, typename... ArgTypes >
+constexpr std::enable_if_t< ( begin < end && end - begin >= 2 ) >
+static_for_dispatch( Func&& f, ArgTypes&&... args )
 {
-   constexpr Index mid = begin + (end - begin) / 2;
-   static_for_dispatch< Index, begin, mid >( std::forward< Func >( f ),
-                                             std::forward< ArgTypes >( args )... );
-   static_for_dispatch< Index, mid, end >( std::forward< Func >( f ),
-                                           std::forward< ArgTypes >( args )... );
+   constexpr Index mid = begin + ( end - begin ) / 2;
+   static_for_dispatch< Index, begin, mid >( std::forward< Func >( f ), std::forward< ArgTypes >( args )... );
+   static_for_dispatch< Index, mid, end >( std::forward< Func >( f ), std::forward< ArgTypes >( args )... );
 }
 
 #endif
 
-} // namespace detail
+}  // namespace detail
 
 /**
  * \brief Generic loop with constant bounds and indices usable in constant
@@ -110,12 +103,12 @@ static_for_dispatch( Func &&f, ArgTypes&&... args )
  * \par Output
  * \include staticForExample.out
  */
-template< typename Index, Index begin, Index end,  typename Func, typename... ArgTypes >
-constexpr void staticFor( Func&& f, ArgTypes&&... args )
+template< typename Index, Index begin, Index end, typename Func, typename... ArgTypes >
+constexpr void
+staticFor( Func&& f, ArgTypes&&... args )
 {
-   detail::static_for_dispatch< Index, begin, end >( std::forward< Func >( f ),
-                                                     std::forward< ArgTypes >( args )... );
+   detail::static_for_dispatch< Index, begin, end >( std::forward< Func >( f ), std::forward< ArgTypes >( args )... );
 }
 
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Algorithms/unrolledFor.h b/src/TNL/Algorithms/unrolledFor.h
index 94a3fd7de838ee36644d112feec0241482026c07..38fb22c21bb8abe43802aab572c30fabb3b38705 100644
--- a/src/TNL/Algorithms/unrolledFor.h
+++ b/src/TNL/Algorithms/unrolledFor.h
@@ -14,39 +14,39 @@ namespace Algorithms {
 namespace detail {
 
 // special dispatch for empty loop
-template< typename Index, Index begin, Index end, Index unrollFactor,  typename Func >
-constexpr std::enable_if_t< (begin >= end) >
+template< typename Index, Index begin, Index end, Index unrollFactor, typename Func >
+constexpr std::enable_if_t< ( begin >= end ) >
 unrolled_for_dispatch( Func&& f )
 {}
 
 // special dispatch for 1 iteration
-template< typename Index, Index begin, Index end, Index unrollFactor,  typename Func >
-constexpr std::enable_if_t< (begin < end && end - begin == 1) >
+template< typename Index, Index begin, Index end, Index unrollFactor, typename Func >
+constexpr std::enable_if_t< ( begin < end && end - begin == 1 ) >
 unrolled_for_dispatch( Func&& f )
 {
    f( begin );
 }
 
 // specialization for unrolling short loops (at least 2, but at most unrollFactor iterations)
-template< typename Index, Index begin, Index end, Index unrollFactor,  typename Func >
-constexpr std::enable_if_t< (begin < end && end - begin >= 2 && end - begin <= unrollFactor) >
+template< typename Index, Index begin, Index end, Index unrollFactor, typename Func >
+constexpr std::enable_if_t< ( begin < end && end - begin >= 2 && end - begin <= unrollFactor ) >
 unrolled_for_dispatch( Func&& f )
 {
-   constexpr Index mid = begin + (end - begin) / 2;
+   constexpr Index mid = begin + ( end - begin ) / 2;
    unrolled_for_dispatch< Index, begin, mid, unrollFactor >( std::forward< Func >( f ) );
    unrolled_for_dispatch< Index, mid, end, unrollFactor >( std::forward< Func >( f ) );
 }
 
 // specialization for long loops - normal for-loop
-template< typename Index, Index begin, Index end, Index unrollFactor,  typename Func >
-constexpr std::enable_if_t< (begin < end && end - begin > 1 && end - begin > unrollFactor) >
+template< typename Index, Index begin, Index end, Index unrollFactor, typename Func >
+constexpr std::enable_if_t< ( begin< end && end - begin > 1 && end - begin > unrollFactor ) >
 unrolled_for_dispatch( Func&& f )
 {
    for( Index i = begin; i < end; i++ )
       f( i );
 }
 
-} // namespace detail
+}  // namespace detail
 
 /**
  * \brief Generic for-loop with explicit unrolling.
@@ -76,11 +76,12 @@ unrolled_for_dispatch( Func&& f )
  * \par Output
  * \include unrolledForExample.out
  */
-template< typename Index, Index begin, Index end, Index unrollFactor = 8,  typename Func >
-constexpr void unrolledFor( Func&& f )
+template< typename Index, Index begin, Index end, Index unrollFactor = 8, typename Func >
+constexpr void
+unrolledFor( Func&& f )
 {
    detail::unrolled_for_dispatch< Index, begin, end, unrollFactor >( std::forward< Func >( f ) );
 }
 
-} // namespace Algorithms
-} // namespace TNL
+}  // namespace Algorithms
+}  // namespace TNL
diff --git a/src/TNL/Allocators/Cuda.h b/src/TNL/Allocators/Cuda.h
index e6cbd2dfa89263001fac6c683d473067506ca59b..b279f8a877ba0ce678a27968c245546b4366ea91 100644
--- a/src/TNL/Allocators/Cuda.h
+++ b/src/TNL/Allocators/Cuda.h
@@ -30,10 +30,12 @@ struct Cuda
 
    Cuda() = default;
    Cuda( const Cuda& ) = default;
-   Cuda( Cuda&& ) = default;
+   Cuda( Cuda&& ) noexcept = default;
 
-   Cuda& operator=( const Cuda& ) = default;
-   Cuda& operator=( Cuda&& ) = default;
+   Cuda&
+   operator=( const Cuda& ) = default;
+   Cuda&
+   operator=( Cuda&& ) noexcept = default;
 
    template< class U >
    Cuda( const Cuda< U >& )
@@ -44,23 +46,26 @@ struct Cuda
    {}
 
    template< class U >
-   Cuda& operator=( const Cuda< U >& )
+   Cuda&
+   operator=( const Cuda< U >& )
    {
       return *this;
    }
 
    template< class U >
-   Cuda& operator=( Cuda< U >&& )
+   Cuda&
+   operator=( Cuda< U >&& )
    {
       return *this;
    }
 
-   value_type* allocate( size_type n )
+   value_type*
+   allocate( size_type n )
    {
 #ifdef HAVE_CUDA
       TNL_CHECK_CUDA_DEVICE;
       value_type* result = nullptr;
-      if( cudaMalloc( (void**) &result, n * sizeof(value_type) ) != cudaSuccess )
+      if( cudaMalloc( (void**) &result, n * sizeof( value_type ) ) != cudaSuccess )
          throw Exceptions::CudaBadAlloc();
       TNL_CHECK_CUDA_DEVICE;
       return result;
@@ -69,7 +74,8 @@ struct Cuda
 #endif
    }
 
-   void deallocate(value_type* ptr, size_type)
+   void
+   deallocate( value_type* ptr, size_type )
    {
 #ifdef HAVE_CUDA
       TNL_CHECK_CUDA_DEVICE;
@@ -81,17 +87,19 @@ struct Cuda
    }
 };
 
-template<class T1, class T2>
-bool operator==(const Cuda<T1>&, const Cuda<T2>&)
+template< class T1, class T2 >
+bool
+operator==( const Cuda< T1 >&, const Cuda< T2 >& )
 {
    return true;
 }
 
-template<class T1, class T2>
-bool operator!=(const Cuda<T1>& lhs, const Cuda<T2>& rhs)
+template< class T1, class T2 >
+bool
+operator!=( const Cuda< T1 >& lhs, const Cuda< T2 >& rhs )
 {
-   return !(lhs == rhs);
+   return ! ( lhs == rhs );
 }
 
-} // namespace Allocators
-} // namespace TNL
+}  // namespace Allocators
+}  // namespace TNL
diff --git a/src/TNL/Allocators/CudaHost.h b/src/TNL/Allocators/CudaHost.h
index 4c0c97ed1bde86c75765854439a6b347c1dd0bb1..facf7f292734da84c6f7bc6db02f56a1cec101c9 100644
--- a/src/TNL/Allocators/CudaHost.h
+++ b/src/TNL/Allocators/CudaHost.h
@@ -30,10 +30,12 @@ struct CudaHost
 
    CudaHost() = default;
    CudaHost( const CudaHost& ) = default;
-   CudaHost( CudaHost&& ) = default;
+   CudaHost( CudaHost&& ) noexcept = default;
 
-   CudaHost& operator=( const CudaHost& ) = default;
-   CudaHost& operator=( CudaHost&& ) = default;
+   CudaHost&
+   operator=( const CudaHost& ) = default;
+   CudaHost&
+   operator=( CudaHost&& ) noexcept = default;
 
    template< class U >
    CudaHost( const CudaHost< U >& )
@@ -44,18 +46,21 @@ struct CudaHost
    {}
 
    template< class U >
-   CudaHost& operator=( const CudaHost< U >& )
+   CudaHost&
+   operator=( const CudaHost< U >& )
    {
       return *this;
    }
 
    template< class U >
-   CudaHost& operator=( CudaHost< U >&& )
+   CudaHost&
+   operator=( CudaHost< U >&& )
    {
       return *this;
    }
 
-   value_type* allocate( size_type n )
+   value_type*
+   allocate( size_type n )
    {
 #ifdef HAVE_CUDA
       TNL_CHECK_CUDA_DEVICE;
@@ -67,7 +72,8 @@ struct CudaHost
       // on all devices visible to the application, in which case the pointer returned by cudaMallocHost can
       // be used directly by all devices without having to call cudaHostGetDevicePointer. See the reference:
       // https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1gc00502b44e5f1bdc0b424487ebb08db0
-      if( cudaMallocHost( (void**) &result, n * sizeof(value_type), cudaHostAllocPortable | cudaHostAllocMapped ) != cudaSuccess )
+      if( cudaMallocHost( (void**) &result, n * sizeof( value_type ), cudaHostAllocPortable | cudaHostAllocMapped )
+          != cudaSuccess )
          throw Exceptions::CudaBadAlloc();
       TNL_CHECK_CUDA_DEVICE;
       return result;
@@ -76,7 +82,8 @@ struct CudaHost
 #endif
    }
 
-   void deallocate(value_type* ptr, size_type)
+   void
+   deallocate( value_type* ptr, size_type )
    {
 #ifdef HAVE_CUDA
       TNL_CHECK_CUDA_DEVICE;
@@ -88,17 +95,19 @@ struct CudaHost
    }
 };
 
-template<class T1, class T2>
-bool operator==(const CudaHost<T1>&, const CudaHost<T2>&)
+template< class T1, class T2 >
+bool
+operator==( const CudaHost< T1 >&, const CudaHost< T2 >& )
 {
    return true;
 }
 
-template<class T1, class T2>
-bool operator!=(const CudaHost<T1>& lhs, const CudaHost<T2>& rhs)
+template< class T1, class T2 >
+bool
+operator!=( const CudaHost< T1 >& lhs, const CudaHost< T2 >& rhs )
 {
-   return !(lhs == rhs);
+   return ! ( lhs == rhs );
 }
 
-} // namespace Allocators
-} // namespace TNL
+}  // namespace Allocators
+}  // namespace TNL
diff --git a/src/TNL/Allocators/CudaManaged.h b/src/TNL/Allocators/CudaManaged.h
index 8d2a42e7dcbf38f5868368a0bfc41dcffeb74097..097c2b59e21afcab28fdd94307399bd1ac3907ed 100644
--- a/src/TNL/Allocators/CudaManaged.h
+++ b/src/TNL/Allocators/CudaManaged.h
@@ -32,10 +32,12 @@ struct CudaManaged
 
    CudaManaged() = default;
    CudaManaged( const CudaManaged& ) = default;
-   CudaManaged( CudaManaged&& ) = default;
+   CudaManaged( CudaManaged&& ) noexcept = default;
 
-   CudaManaged& operator=( const CudaManaged& ) = default;
-   CudaManaged& operator=( CudaManaged&& ) = default;
+   CudaManaged&
+   operator=( const CudaManaged& ) = default;
+   CudaManaged&
+   operator=( CudaManaged&& ) noexcept = default;
 
    template< class U >
    CudaManaged( const CudaManaged< U >& )
@@ -46,23 +48,26 @@ struct CudaManaged
    {}
 
    template< class U >
-   CudaManaged& operator=( const CudaManaged< U >& )
+   CudaManaged&
+   operator=( const CudaManaged< U >& )
    {
       return *this;
    }
 
    template< class U >
-   CudaManaged& operator=( CudaManaged< U >&& )
+   CudaManaged&
+   operator=( CudaManaged< U >&& )
    {
       return *this;
    }
 
-   value_type* allocate( size_type n )
+   value_type*
+   allocate( size_type n )
    {
 #ifdef HAVE_CUDA
       TNL_CHECK_CUDA_DEVICE;
       value_type* result = nullptr;
-      if( cudaMallocManaged( &result, n * sizeof(value_type) ) != cudaSuccess )
+      if( cudaMallocManaged( &result, n * sizeof( value_type ) ) != cudaSuccess )
          throw Exceptions::CudaBadAlloc();
       TNL_CHECK_CUDA_DEVICE;
       return result;
@@ -71,7 +76,8 @@ struct CudaManaged
 #endif
    }
 
-   void deallocate(value_type* ptr, size_type)
+   void
+   deallocate( value_type* ptr, size_type )
    {
 #ifdef HAVE_CUDA
       TNL_CHECK_CUDA_DEVICE;
@@ -83,17 +89,19 @@ struct CudaManaged
    }
 };
 
-template<class T1, class T2>
-bool operator==(const CudaManaged<T1>&, const CudaManaged<T2>&)
+template< class T1, class T2 >
+bool
+operator==( const CudaManaged< T1 >&, const CudaManaged< T2 >& )
 {
    return true;
 }
 
-template<class T1, class T2>
-bool operator!=(const CudaManaged<T1>& lhs, const CudaManaged<T2>& rhs)
+template< class T1, class T2 >
+bool
+operator!=( const CudaManaged< T1 >& lhs, const CudaManaged< T2 >& rhs )
 {
-   return !(lhs == rhs);
+   return ! ( lhs == rhs );
 }
 
-} // namespace Allocators
-} // namespace TNL
+}  // namespace Allocators
+}  // namespace TNL
diff --git a/src/TNL/Allocators/Default.h b/src/TNL/Allocators/Default.h
index 0be8a61f92984b5cb65ca9945ab73916f7cfb5a7..28b21fbfe8b05dd7352d6df51656e050478bca23 100644
--- a/src/TNL/Allocators/Default.h
+++ b/src/TNL/Allocators/Default.h
@@ -48,5 +48,5 @@ struct Default< Devices::Cuda >
    using Allocator = Allocators::Cuda< T >;
 };
 
-} // namespace Allocators
-} // namespace TNL
+}  // namespace Allocators
+}  // namespace TNL
diff --git a/src/TNL/Allocators/Host.h b/src/TNL/Allocators/Host.h
index 6ec2032182ec8140ef72537fbef34803c755d763..b9ba52665fbd2e9599372d0a8b6d71e646b7ed64 100644
--- a/src/TNL/Allocators/Host.h
+++ b/src/TNL/Allocators/Host.h
@@ -27,5 +27,5 @@ namespace Allocators {
 template< class T >
 using Host = std::allocator< T >;
 
-} // namespace Allocators
-} // namespace TNL
+}  // namespace Allocators
+}  // namespace TNL
diff --git a/src/TNL/Arithmetics/Double.h b/src/TNL/Arithmetics/Double.h
index 65517ec6efd9b34d1cf1f85058516489cf61de5b..baa866ba0cc610f2e5bdf070484d62ff8591becc 100644
--- a/src/TNL/Arithmetics/Double.h
+++ b/src/TNL/Arithmetics/Double.h
@@ -14,57 +14,83 @@
 
 namespace TNL {
 namespace Arithmetics {
-    
-template <class T>
+
+template< class T >
 class Double
 {
 public:
-    T data[2];
-    
-    Double();
-    Double(const Double<T>& value);
-    explicit Double(const T& value);
-    explicit Double(int value);
-    
-    Double<T>& operator=(const Double<T>& rhs);
-    Double<T>& operator-();
-    Double<T>& operator+();
-    Double<T>& operator+=(const Double<T>& rhs);
-    Double<T>& operator-=(const Double<T>& rhs);
-    Double<T>& operator*=(const Double<T>& rhs);
-    Double<T>& operator/=(const Double<T>& rhs);
-    Double<T> operator+(const Double<T>& rhs) const;
-    Double<T> operator-(const Double<T>& rhs) const;
-    Double<T> operator*(const Double<T>& rhs) const;
-    Double<T> operator/(const Double<T>& rhs) const;
-    bool operator==(const Double<T>& rhs) const;
-    bool operator!=(const Double<T>& rhs) const;
-    bool operator<(const Double<T>& rhs) const;
-    bool operator>(const Double<T>& rhs) const;
-    bool operator>=(const Double<T>& rhs) const;
-    bool operator<=(const Double<T>& rhs) const;
-    explicit operator T() const;
+   T data[ 2 ];
+
+   Double();
+   Double( const Double< T >& value );
+   explicit Double( const T& value );
+   explicit Double( int value );
+
+   Double< T >&
+   operator=( const Double< T >& rhs );
+   Double< T >&
+   operator-();
+   Double< T >&
+   operator+();
+   Double< T >&
+   operator+=( const Double< T >& rhs );
+   Double< T >&
+   operator-=( const Double< T >& rhs );
+   Double< T >&
+   operator*=( const Double< T >& rhs );
+   Double< T >&
+   operator/=( const Double< T >& rhs );
+   Double< T >
+   operator+( const Double< T >& rhs ) const;
+   Double< T >
+   operator-( const Double< T >& rhs ) const;
+   Double< T >
+   operator*( const Double< T >& rhs ) const;
+   Double< T >
+   operator/( const Double< T >& rhs ) const;
+   bool
+   operator==( const Double< T >& rhs ) const;
+   bool
+   operator!=( const Double< T >& rhs ) const;
+   bool
+   operator<( const Double< T >& rhs ) const;
+   bool
+   operator>( const Double< T >& rhs ) const;
+   bool
+   operator>=( const Double< T >& rhs ) const;
+   bool
+   operator<=( const Double< T >& rhs ) const;
+   explicit operator T() const;
 };
 
 /// TODO
-template <typename T>
-void zeroDouble(T *d);
-template <typename T>
-void twoSum(T a, T b, T *s, T *e);
-template <typename T>
-void quickTwoSum(T a, T b, T *s, T *e);
-template <typename T>
-void split(T a, T *a_hi, T *a_lo);
-template <typename T>
-void twoProduct(T a, T b, T *p, T *e);
-template <typename T>
-void renormalize(T *a, T *b);
-template <typename T>
-void doubleAdd(const T *a, const T *b, T *s);
-template <typename T>
-void doubleMul(const T *a, const T *b, T *s);
-template <typename T>
-void printDouble(T *d);
+template< typename T >
+void
+zeroDouble( T* d );
+template< typename T >
+void
+twoSum( T a, T b, T* s, T* e );
+template< typename T >
+void
+quickTwoSum( T a, T b, T* s, T* e );
+template< typename T >
+void
+split( T a, T* a_hi, T* a_lo );
+template< typename T >
+void
+twoProduct( T a, T b, T* p, T* e );
+template< typename T >
+void
+renormalize( T* a, T* b );
+template< typename T >
+void
+doubleAdd( const T* a, const T* b, T* s );
+template< typename T >
+void
+doubleMul( const T* a, const T* b, T* s );
+template< typename T >
+void
+printDouble( T* d );
 
-} // namespace Arithmetics
-} // namespace TNL
\ No newline at end of file
+}  // namespace Arithmetics
+}  // namespace TNL
\ No newline at end of file
diff --git a/src/TNL/Arithmetics/Double_impl.h b/src/TNL/Arithmetics/Double_impl.h
index db7f0c440ce0cf4b457e3aa10ea7dfff7085286a..216f7e4efa8bd4000dbcba87d1032e9d4d0f68b8 100644
--- a/src/TNL/Arithmetics/Double_impl.h
+++ b/src/TNL/Arithmetics/Double_impl.h
@@ -19,68 +19,82 @@
 
 namespace TNL {
 namespace Arithmetics {
-    
-template <class T>
-Double<T>::Double() {
-    zeroDouble(data);
+
+template< class T >
+Double< T >::Double()
+{
+   zeroDouble( data );
 }
 
-template <class T>
-Double<T>::Double(const T& value) {
-    data[0] = value;
-    data[1] = 0;
+template< class T >
+Double< T >::Double( const T& value )
+{
+   data[ 0 ] = value;
+   data[ 1 ] = 0;
 }
 
-template <class T>
-Double<T>::Double(int value) {
-    data[0] = (T)value;
-    data[1] = 0;
+template< class T >
+Double< T >::Double( int value )
+{
+   data[ 0 ] = (T) value;
+   data[ 1 ] = 0;
 }
 
-template <class T>
-Double<T>::Double(const Double<T>& other) {
-    data[0] = other[0];
-    data[1] = other[1];
+template< class T >
+Double< T >::Double( const Double< T >& other )
+{
+   data[ 0 ] = other[ 0 ];
+   data[ 1 ] = other[ 1 ];
 }
 
-template <class T>
-Double<T>& Double<T>::operator =(const Double<T>& rhs) {
-    data[0] = rhs[0];
-    data[1] = rhs[1];
-    return *this;
+template< class T >
+Double< T >&
+Double< T >::operator=( const Double< T >& rhs )
+{
+   data[ 0 ] = rhs[ 0 ];
+   data[ 1 ] = rhs[ 1 ];
+   return *this;
 }
 
-template <class T>
-Double<T> Double<T>::operator +(const Double<T>& rhs) const{
-    Double<T> lhs(*this);
-    lhs += rhs;
-    return qd;
+template< class T >
+Double< T >
+Double< T >::operator+( const Double< T >& rhs ) const
+{
+   Double< T > lhs( *this );
+   lhs += rhs;
+   return qd;
 }
 
-template <class T>
-Double<T> Double<T>::operator -(const Double<T>& rhs) const{
-    Double<T> lhs(*this);
-    lhs += rhs;
-    return qd;
+template< class T >
+Double< T >
+Double< T >::operator-( const Double< T >& rhs ) const
+{
+   Double< T > lhs( *this );
+   lhs += rhs;
+   return qd;
 }
 
-template <class T>
-Double<T> Double<T>::operator *(const Double<T>& rhs) const{
-    Double<T> lhs(*this);
-    lhs *= rhs;
-    return qd;
+template< class T >
+Double< T >
+Double< T >::operator*( const Double< T >& rhs ) const
+{
+   Double< T > lhs( *this );
+   lhs *= rhs;
+   return qd;
 }
 
-template <class T>
-Double<T> Double<T>::operator /(const Double<T>& rhs) const{
-    Double<T> lhs(*this);
-    lhs /= rhs;
-    return qd;
+template< class T >
+Double< T >
+Double< T >::operator/( const Double< T >& rhs ) const
+{
+   Double< T > lhs( *this );
+   lhs /= rhs;
+   return qd;
 }
 
 /*
  TODO COMPARISON OPERATORS
  */
 
-} // namespace Arithmetics
-} // namespace TNL
\ No newline at end of file
+}  // namespace Arithmetics
+}  // namespace TNL
\ No newline at end of file
diff --git a/src/TNL/Arithmetics/FlopsCounter.cpp b/src/TNL/Arithmetics/FlopsCounter.cpp
index 4c72a6dde66add8d94324d21c2f778d1c3046737..3cbe6632df1cfe8cca32a9fa84f6edefe587fccf 100644
--- a/src/TNL/Arithmetics/FlopsCounter.cpp
+++ b/src/TNL/Arithmetics/FlopsCounter.cpp
@@ -10,4 +10,4 @@ namespace TNL {
 
 tnlFlopsCounter tnl_flops_counter;
 
-} // namespace TNL
+}  // namespace TNL
diff --git a/src/TNL/Arithmetics/FlopsCounter.h b/src/TNL/Arithmetics/FlopsCounter.h
index 7fe4d722f3afc544993b2cb886259aa2aad31e0f..003dfee7d13b1f446fe38f03d14dc9f06f41136f 100644
--- a/src/TNL/Arithmetics/FlopsCounter.h
+++ b/src/TNL/Arithmetics/FlopsCounter.h
@@ -10,70 +10,75 @@ namespace TNL {
 
 class tnlFlopsCounter
 {
-	bool compute_flops;
-
-	long int adding_flops;
-
-	long int multiplying_flops;
-
-	long int dividing_flops;
-
-	long int functions_flops;
-
-	public:
-
-	tnlFlopsCounter()
-	: compute_flops( true ),
-      adding_flops( 0 ),
-      multiplying_flops( 0 ),
-      dividing_flops( 0 )
-	{};
-
-	void recordAdding( const int ops = 1 )
-	{
-	   if( compute_flops ) adding_flops += ops;
-	};
-
-	void recordMultiplying( const int ops = 1 )
-	{
-		if( compute_flops ) multiplying_flops += ops;
-	};
-
-	void recordDividing( const int ops = 1 )
-	{
-		if( compute_flops ) dividing_flops += ops;
-	};
-
-       void recordFunction( const int ops = 1 )
-       {
-          if( compute_flops ) functions_flops += ops;
-       };
-
-
-	void turnFlopsCountingOn()
-	{
-		compute_flops = true;
-	};
-
-	void turnFlopsCountingOff()
-	{
-		compute_flops = false;
-	};
-
-	long int getFlops()
-	{
-		return adding_flops + multiplying_flops + dividing_flops + functions_flops;
-	};
-
-	void resetFlops()
-	{
-		adding_flops = 0;
-		multiplying_flops = 0;
-	   dividing_flops = 0;
-	   functions_flops = 0;
-	};
+   bool compute_flops;
+
+   long int adding_flops;
+
+   long int multiplying_flops;
+
+   long int dividing_flops;
+
+   long int functions_flops;
+
+public:
+   tnlFlopsCounter() : compute_flops( true ), adding_flops( 0 ), multiplying_flops( 0 ), dividing_flops( 0 ){};
+
+   void
+   recordAdding( const int ops = 1 )
+   {
+      if( compute_flops )
+         adding_flops += ops;
+   };
+
+   void
+   recordMultiplying( const int ops = 1 )
+   {
+      if( compute_flops )
+         multiplying_flops += ops;
+   };
+
+   void
+   recordDividing( const int ops = 1 )
+   {
+      if( compute_flops )
+         dividing_flops += ops;
+   };
+
+   void
+   recordFunction( const int ops = 1 )
+   {
+      if( compute_flops )
+         functions_flops += ops;
+   };
+
+   void
+   turnFlopsCountingOn()
+   {
+      compute_flops = true;
+   };
+
+   void
+   turnFlopsCountingOff()
+   {
+      compute_flops = false;
+   };
+
+   long int
+   getFlops()
+   {
+      return adding_flops + multiplying_flops + dividing_flops + functions_flops;
+   };
+
+   void
+   resetFlops()
+   {
+      adding_flops = 0;
+      multiplying_flops = 0;
+      dividing_flops = 0;
+      functions_flops = 0;
+   };
 };
 
 extern tnlFlopsCounter tnl_flops_counter;
 
-} // namespace TNL
+}  // namespace TNL
diff --git a/src/TNL/Arithmetics/MultiPrecision.cpp b/src/TNL/Arithmetics/MultiPrecision.cpp
index f12647dc0bc3127b187311df0af8ef30b040d378..6cde61b8ea4744c21c0019fb796cbd6199b669b5 100644
--- a/src/TNL/Arithmetics/MultiPrecision.cpp
+++ b/src/TNL/Arithmetics/MultiPrecision.cpp
@@ -12,154 +12,194 @@
 
 #ifdef HAVE_GMP
 
-#include "MultiPrecision.h"
+   #include "MultiPrecision.h"
 
 namespace TNL {
 namespace Arithmetics {
 
 /* CONSTRUCTORS */
 
-MultiPrecision::MultiPrecision(){
-    mpf_init (number);
+MultiPrecision::MultiPrecision()
+{
+   mpf_init( number );
 }
 
-MultiPrecision::MultiPrecision(int i){
-    signed long int sli = i;
-    mpf_init_set_si (number, sli);
+MultiPrecision::MultiPrecision( int i )
+{
+   signed long int sli = i;
+   mpf_init_set_si( number, sli );
 }
 
-MultiPrecision::MultiPrecision(double d){
-    mpf_init_set_d (number, d);
+MultiPrecision::MultiPrecision( double d )
+{
+   mpf_init_set_d( number, d );
 }
 
 /* OPERATORS IMPLEMENTATION */
 
-MultiPrecision& MultiPrecision::operator=(const MultiPrecision& mp){
-    mpf_set(number, mp.number);
-    return *this;
+MultiPrecision&
+MultiPrecision::operator=( const MultiPrecision& mp )
+{
+   mpf_set( number, mp.number );
+   return *this;
 }
 
-MultiPrecision& MultiPrecision::operator-(){
-    mpf_neg(this->number, this->number);
-    return *this;
+MultiPrecision&
+MultiPrecision::operator-()
+{
+   mpf_neg( this->number, this->number );
+   return *this;
 }
 
-MultiPrecision& MultiPrecision::operator+=(const MultiPrecision& mp){
-    mpf_add(this->number, this->number, mp.number);
-    return *this;
+MultiPrecision&
+MultiPrecision::operator+=( const MultiPrecision& mp )
+{
+   mpf_add( this->number, this->number, mp.number );
+   return *this;
 }
 
-MultiPrecision& MultiPrecision::operator-=(const MultiPrecision& mp){
-    mpf_sub(this->number, this->number, mp.number);
-    return *this;
+MultiPrecision&
+MultiPrecision::operator-=( const MultiPrecision& mp )
+{
+   mpf_sub( this->number, this->number, mp.number );
+   return *this;
+}
+
+MultiPrecision&
+MultiPrecision::operator*=( const MultiPrecision& mp )
+{
+   mpf_mul( this->number, this->number, mp.number );
+   return *this;
 }
 
-MultiPrecision& MultiPrecision::operator*=(const MultiPrecision& mp){
-    mpf_mul(this->number, this->number, mp.number);
-    return *this;
+MultiPrecision&
+MultiPrecision::operator/=( const MultiPrecision& mp )
+{
+   mpf_div( this->number, this->number, mp.number );
+   return *this;
 }
 
-MultiPrecision& MultiPrecision::operator/=(const MultiPrecision& mp){
-    mpf_div(this->number, this->number, mp.number);
-    return *this;
+MultiPrecision
+MultiPrecision::operator+( const MultiPrecision& mp ) const
+{
+   MultiPrecision result = MultiPrecision( *this );
+   result += mp;
+   return result;
 }
 
-MultiPrecision MultiPrecision::operator+(const MultiPrecision& mp) const{
-    MultiPrecision result = MultiPrecision(*this);
-    result += mp;
-    return result;
+MultiPrecision
+MultiPrecision::operator-( const MultiPrecision& mp ) const
+{
+   MultiPrecision result( *this );
+   result -= mp;
+   return result;
 }
 
-MultiPrecision MultiPrecision::operator-(const MultiPrecision& mp) const{
-    MultiPrecision result (*this);
-    result -= mp;
-    return result;
+MultiPrecision
+MultiPrecision::operator*( const MultiPrecision& mp ) const
+{
+   MultiPrecision result( *this );
+   result *= mp;
+   return result;
 }
 
-MultiPrecision MultiPrecision::operator*(const MultiPrecision& mp) const{
-    MultiPrecision result (*this);
-    result *= mp;
-    return result;
+MultiPrecision
+MultiPrecision::operator/( const MultiPrecision& mp ) const
+{
+   MultiPrecision result( *this );
+   result /= mp;
+   return result;
 }
 
-MultiPrecision MultiPrecision::operator/(const MultiPrecision& mp) const{
-    MultiPrecision result (*this);
-    result /= mp;
-    return result;
+bool
+MultiPrecision::operator==( const MultiPrecision& mp ) const
+{
+   MultiPrecision m( *this );
+   if( mpf_cmp( m.number, mp.number ) == 0 )
+      return true;
+   else
+      return false;
 }
 
-bool MultiPrecision::operator==(const MultiPrecision &mp) const{
-    MultiPrecision m (*this);
-    if (mpf_cmp(m.number, mp.number) == 0)
-        return true;
-    else
-        return false;
+bool
+MultiPrecision::operator!=( const MultiPrecision& mp ) const
+{
+   return ! ( *this == mp );
 }
 
-bool MultiPrecision::operator!=(const MultiPrecision &mp) const{
-    return !(*this == mp);
+bool
+MultiPrecision::operator<( const MultiPrecision& mp ) const
+{
+   MultiPrecision m( *this );
+   if( mpf_cmp( m.number, mp.number ) < 0 )
+      return true;
+   else
+      return false;
 }
 
-bool MultiPrecision::operator<(const MultiPrecision &mp) const{
-    MultiPrecision m (*this);
-    if (mpf_cmp(m.number, mp.number) < 0)
-        return true;
-    else
-        return false;
+bool
+MultiPrecision::operator>( const MultiPrecision& mp ) const
+{
+   MultiPrecision m( *this );
+   if( mpf_cmp( m.number, mp.number ) > 0 )
+      return true;
+   else
+      return false;
 }
 
-bool MultiPrecision::operator>(const MultiPrecision &mp) const{
-    MultiPrecision m (*this);
-    if (mpf_cmp(m.number, mp.number) > 0)
-        return true;
-    else
-        return false;
+bool
+MultiPrecision::operator>=( const MultiPrecision& mp ) const
+{
+   MultiPrecision m( *this );
+   if( mpf_cmp( m.number, mp.number ) >= 0 )
+      return true;
+   else
+      return false;
 }
 
-bool MultiPrecision::operator>=(const MultiPrecision &mp) const{
-    MultiPrecision m (*this);
-    if (mpf_cmp(m.number, mp.number) >= 0)
-        return true;
-    else
-        return false;
-}
-
-bool MultiPrecision::operator<=(const MultiPrecision &mp) const{
-    MultiPrecision m (*this);
-    if (mpf_cmp(m.number, mp.number) <= 0)
-        return true;
-    else
-        return false;
+bool
+MultiPrecision::operator<=( const MultiPrecision& mp ) const
+{
+   MultiPrecision m( *this );
+   if( mpf_cmp( m.number, mp.number ) <= 0 )
+      return true;
+   else
+      return false;
 }
 
 /* OPERATORS FOR GOOGLE TEST */
 
-bool MultiPrecision::operator==(const mpf_t &GMPnumber) const{
-    MultiPrecision m (*this);
-    if (mpf_cmp(m.number, GMPnumber) == 0)
-        return true;
-    else
-        return false;
+bool
+MultiPrecision::operator==( const mpf_t& GMPnumber ) const
+{
+   MultiPrecision m( *this );
+   if( mpf_cmp( m.number, GMPnumber ) == 0 )
+      return true;
+   else
+      return false;
 }
 
 /* METHODS */
 
-MultiPrecision MultiPrecision::setPrecision(int precision){
-    mpf_set_default_prec (precision);
+MultiPrecision
+MultiPrecision::setPrecision( int precision )
+{
+   mpf_set_default_prec( precision );
 }
 
-void MultiPrecision::printMP(){
-    int precision = mpf_get_default_prec();
-    mpf_out_str(stdout, 10, precision, this->number); std::cout <<std::endl;
+void
+MultiPrecision::printMP()
+{
+   int precision = mpf_get_default_prec();
+   mpf_out_str( stdout, 10, precision, this->number );
+   std::cout << std::endl;
 }
 
 /* DESTRUCTOR */
 
-MultiPrecision::~MultiPrecision(){
-}
-
-} // namespace Arithmetics
-} // namespace TNL
+MultiPrecision::~MultiPrecision() {}
 
+}  // namespace Arithmetics
+}  // namespace TNL
 
 #endif
\ No newline at end of file
diff --git a/src/TNL/Arithmetics/MultiPrecision.h b/src/TNL/Arithmetics/MultiPrecision.h
index cdcfa4a534641cc63dee3f81f37eb32f6350c3a0..71eb7a192f1a304afb43898536e2cfc64979d912 100644
--- a/src/TNL/Arithmetics/MultiPrecision.h
+++ b/src/TNL/Arithmetics/MultiPrecision.h
@@ -17,62 +17,87 @@
 #pragma once
 
 #ifdef HAVE_GMP
-#include <gmp.h>
+   #include <gmp.h>
 #endif
 
 namespace TNL {
 namespace Arithmetics {
-    
+
 class MultiPrecision
 {
-   public:
+public:
+#ifdef HAVE_GMP
+   /* CONSTRUCTORS */
+   MultiPrecision();                     // initialize number to 0
+   explicit MultiPrecision( int );       // assignment of signed long integer
+   explicit MultiPrecision( double d );  // assignment of double
+
+   /* OPERATORS */
+   MultiPrecision&
+   operator=( const MultiPrecision& mp );
+   MultiPrecision&
+   operator-();
+   MultiPrecision&
+   operator+=( const MultiPrecision& mp );
+   MultiPrecision&
+   operator-=( const MultiPrecision& mp );
+   MultiPrecision&
+   operator*=( const MultiPrecision& mp );
+   MultiPrecision&
+   operator/=( const MultiPrecision& mp );
+   MultiPrecision
+   operator+( const MultiPrecision& mp ) const;
+   MultiPrecision
+   operator-( const MultiPrecision& mp ) const;
+   MultiPrecision
+   operator*( const MultiPrecision& mp ) const;
+   MultiPrecision
+   operator/( const MultiPrecision& mp ) const;
+   bool
+   operator==( const MultiPrecision& mp ) const;
+   bool
+   operator!=( const MultiPrecision& mp ) const;
+   bool
+   operator<( const MultiPrecision& mp ) const;
+   bool
+   operator>( const MultiPrecision& mp ) const;
+   bool
+   operator>=( const MultiPrecision& mp ) const;
+   bool
+   operator<=( const MultiPrecision& mp ) const;
+   MultiPrecision&
+   operator++();
+   MultiPrecision&
+   operator--();
+   MultiPrecision
+   operator++( int );
+   MultiPrecision
+   operator--( int );
 
-#ifdef HAVE_GMP    
-    /* CONSTRUCTORS */
-    MultiPrecision(); // initialize number to 0
-    explicit MultiPrecision(int); // assignment of signed long integer
-    explicit MultiPrecision(double d); // assignment of double
+   /* OPERATORS FOR GOOGLE TEST*/
+   bool
+   operator==( const mpf_t& GMPnumber ) const;
 
-    /* OPERATORS */
-    MultiPrecision& operator=(const MultiPrecision& mp);
-    MultiPrecision& operator-();
-    MultiPrecision& operator+=(const MultiPrecision& mp);
-    MultiPrecision& operator-=(const MultiPrecision& mp);
-    MultiPrecision& operator*=(const MultiPrecision& mp);
-    MultiPrecision& operator/=(const MultiPrecision& mp);
-    MultiPrecision operator+(const MultiPrecision& mp) const;
-    MultiPrecision operator-(const MultiPrecision& mp) const;
-    MultiPrecision operator*(const MultiPrecision& mp) const;
-    MultiPrecision operator/(const MultiPrecision& mp) const;
-    bool operator==(const MultiPrecision &mp) const;
-    bool operator!=(const MultiPrecision &mp) const;
-    bool operator<(const MultiPrecision &mp) const;
-    bool operator>(const MultiPrecision &mp) const;
-    bool operator>=(const MultiPrecision &mp) const;
-    bool operator<=(const MultiPrecision &mp) const;
-    MultiPrecision& operator++();
-    MultiPrecision& operator--();
-    MultiPrecision operator++(int);
-    MultiPrecision operator--(int);
+   /* METHODS */
+   void
+   printMP();
+   static MultiPrecision
+   setPrecision( int );  // sets the default precision
+   /// TODO void printNumber(int digits, ostream& str = std::cout );
 
-    /* OPERATORS FOR GOOGLE TEST*/
-    bool operator==(const mpf_t &GMPnumber) const;
-    
-    /* METHODS */
-    void printMP();
-    static MultiPrecision setPrecision(int); // sets the default precision
-    /// TODO void printNumber(int digits, ostream& str = std::cout );
+   /* DESTRUCTOR */
+   ~MultiPrecision();
 
-    /* DESTRUCTOR */
-    ~MultiPrecision();
-    
-    mpf_t number;
+   mpf_t number;
 #endif
 };
 
-MultiPrecision abs(const MultiPrecision);
-MultiPrecision sqrt(const MultiPrecision);
-MultiPrecision cqrt(const MultiPrecision);
+MultiPrecision
+abs( const MultiPrecision );
+MultiPrecision
+sqrt( const MultiPrecision );
+MultiPrecision
+cqrt( const MultiPrecision );
 
-} // namespace Arithmetics
-} // namespace TNL
+}  // namespace Arithmetics
+}  // namespace TNL
diff --git a/src/TNL/Arithmetics/Quad.h b/src/TNL/Arithmetics/Quad.h
index b3b5b3dc712546af3d0a171852d4d81a6e36cbcb..49c3d9ff8fb7ff2925edc3c643fef96ebc50757e 100644
--- a/src/TNL/Arithmetics/Quad.h
+++ b/src/TNL/Arithmetics/Quad.h
@@ -16,99 +16,149 @@
 #include <TNL/String.h>
 
 namespace TNL {
-namespace Arithmetics {    
+namespace Arithmetics {
 
-template <class T>
+template< class T >
 class Quad
 {
 public:
-    /*INIT*/
-    T data[4];
+   /*INIT*/
+   T data[ 4 ];
 
-    Quad();
-    explicit Quad(const T&);
-    explicit Quad(int);
-    Quad(const Quad<T>&);
+   Quad();
+   explicit Quad( const T& );
+   explicit Quad( int );
+   Quad( const Quad< T >& );
 
-    /*OVERLOADED OPERATORS*/
-    T& operator[](int);
-    const T& operator[](int) const;
-    Quad<T>& operator =(const Quad<T>&);
-    Quad<T>& operator +=(const Quad<T>&);
-    Quad<T>& operator -=(const Quad<T>&);
-    Quad<T>& operator *=(const Quad<T>&);
-    Quad<T>& operator /=(const Quad<T>&);
-    Quad<T>& operator =(const T&);
-    Quad<T>& operator +=(const T&);
-    Quad<T>& operator -=(const T&);
-    Quad<T>& operator *=(const T&);
-    Quad<T>& operator /=(const T&);
-    Quad<T> operator +(const Quad<T>&) const;
-    Quad<T> operator -(const Quad<T>&) const;
-    Quad<T> operator *(const Quad<T>&) const;
-    Quad<T> operator /(const Quad<T>&) const;
-    Quad<T> operator +(const T&) const;
-    Quad<T> operator -(const T&) const;
-    Quad<T> operator *(const T&) const;
-    Quad<T> operator /(const T&) const;
-    Quad<T> operator +();
-    Quad<T> operator -();
-    Quad<T> operator +() const;
-    Quad<T> operator -() const;
-    bool operator ==(const Quad<T>&) const;
-    bool operator !=(const Quad<T>&) const;
-    bool operator <(const Quad<T>&) const;
-    bool operator >(const Quad<T>&) const;
-    bool operator >=(const Quad<T>&) const;
-    bool operator <=(const Quad<T>&) const;
-    explicit operator T() const;
+   /*OVERLOADED OPERATORS*/
+   T&
+   operator[]( int );
+   const T&
+   operator[]( int ) const;
+   Quad< T >&
+   operator=( const Quad< T >& );
+   Quad< T >&
+   operator+=( const Quad< T >& );
+   Quad< T >&
+   operator-=( const Quad< T >& );
+   Quad< T >&
+   operator*=( const Quad< T >& );
+   Quad< T >&
+   operator/=( const Quad< T >& );
+   Quad< T >&
+   operator=( const T& );
+   Quad< T >&
+   operator+=( const T& );
+   Quad< T >&
+   operator-=( const T& );
+   Quad< T >&
+   operator*=( const T& );
+   Quad< T >&
+   operator/=( const T& );
+   Quad< T >
+   operator+( const Quad< T >& ) const;
+   Quad< T >
+   operator-( const Quad< T >& ) const;
+   Quad< T >
+   operator*( const Quad< T >& ) const;
+   Quad< T >
+   operator/( const Quad< T >& ) const;
+   Quad< T >
+   operator+( const T& ) const;
+   Quad< T >
+   operator-( const T& ) const;
+   Quad< T >
+   operator*( const T& ) const;
+   Quad< T >
+   operator/( const T& ) const;
+   Quad< T >
+   operator+();
+   Quad< T >
+   operator-();
+   Quad< T >
+   operator+() const;
+   Quad< T >
+   operator-() const;
+   bool
+   operator==( const Quad< T >& ) const;
+   bool
+   operator!=( const Quad< T >& ) const;
+   bool
+   operator<( const Quad< T >& ) const;
+   bool
+   operator>( const Quad< T >& ) const;
+   bool
+   operator>=( const Quad< T >& ) const;
+   bool
+   operator<=( const Quad< T >& ) const;
+   explicit operator T() const;
 };
 
+template< typename T >
+Quad< T >
+operator+( const T&, const Quad< T >& );
+template< typename T >
+Quad< T >
+operator-( const T&, const Quad< T >& );
+template< typename T >
+Quad< T >
+operator*( const T&, const Quad< T >& );
+template< typename T >
+Quad< T >
+operator/( const T&, const Quad< T >& );
 
-template <typename T>
-Quad<T> operator +(const T&, const Quad<T>&);
-template <typename T>
-Quad<T> operator -(const T&, const Quad<T>&);
-template <typename T>
-Quad<T> operator *(const T&, const Quad<T>&);
-template <typename T>
-Quad<T> operator /(const T&, const Quad<T>&);
+template< typename T >
+Quad< T >
+abs( const Quad< T >& );
+template< typename T >
+Quad< T >
+sqrt( const Quad< T >& );
 
-template <typename T>
-Quad<T> abs(const Quad<T>&);
-template <typename T>
-Quad<T> sqrt(const Quad<T>&);
+template< typename T >
+void
+quickTwoSum( T a, T b, T* s, T* e );  // Addition of two doubles
+template< typename T >
+void
+twoSum( T a, T b, T* s, T* e );  // Addition of two doubles
+template< typename T >
+void
+split( T a, T* a_hi, T* a_lo );  // Split double into two 26 bits parts
+template< typename T >
+void
+twoProd( T a, T b, T* p, T* e );  // Multiplication of two doubles
+template< typename T >
+void
+renormalize( T* a, T* b );  // Normalization of number a
+template< typename T >
+void
+doublePlusQuad( T b, const T* a, T* s );  // Addition of double and quad-double
+template< typename T >
+void
+doubleTimesQuad( T b, const T* a, T* s );  // Multiplication of double and quad-double
+template< typename T >
+void
+quadDivDouble( const T* a, T b, T* s );  // Division of two doubles
+template< typename T >
+void
+quadAdd( const T* a, const T* b, T* s );  // Addition of two quad-doubles
+template< typename T >
+void
+quadAddAccurate( const T* a, const T* b, T* s );  // Addition of two quad-doubles ! slower algorhitm
+template< typename T >
+void
+quadMul( const T* a, const T* b, T* s );  // Multiplication of two quad-doubles
+template< typename T >
+void
+quadMulQuick( const T* a, const T* b, T* s );  // Multiplication of two quad-doubles ! faster algorithm
+template< typename T >
+void
+quadDiv( const T* a, const T* b, T* s );  // Division of two quad-doubles
+template< typename T >
+void
+zeroQuad( T* a );  // Reset quad-double
+template< typename T >
+void
+printQuad( T* a );  // Print of quad-double
 
-template <typename T>
-void quickTwoSum(T a, T b, T *s, T *e); // Addition of two doubles
-template <typename T>
-void twoSum(T a, T b, T *s, T *e); // Addition of two doubles
-template <typename T>
-void split(T a, T *a_hi, T *a_lo); // Split double into two 26 bits parts
-template <typename T>
-void twoProd(T a, T b, T *p, T *e); // Multiplication of two doubles
-template <typename T>
-void renormalize(T *a, T *b); // Normalization of number a
-template <typename T>
-void doublePlusQuad(T b, const T *a, T *s); // Addition of double and quad-double
-template <typename T>
-void doubleTimesQuad(T b, const T *a, T *s); // Multiplication of double and quad-double
-template <typename T>
-void quadDivDouble(const T *a, T b, T *s); // Division of two doubles
-template <typename T>
-void quadAdd(const T *a, const T *b, T *s); // Addition of two quad-doubles
-template <typename T>
-void quadAddAccurate(const T *a, const T *b, T *s); // Addition of two quad-doubles ! slower algorhitm
-template <typename T>
-void quadMul(const T *a, const T *b, T *s); // Multiplication of two quad-doubles
-template <typename T>
-void quadMulQuick(const T *a, const T *b, T *s); // Multiplication of two quad-doubles ! faster algorithm
-template <typename T>
-void quadDiv(const T *a, const T *b, T *s); // Division of two quad-doubles
-template <typename T>
-void zeroQuad(T *a); // Reset quad-double
-template <typename T>
-void printQuad(T *a); // Print of quad-double
-
-} // namespace Arithmetics
-} //namespace TNL
+}  // namespace Arithmetics
+}  // namespace TNL
diff --git a/src/TNL/Arithmetics/Quad_impl.h b/src/TNL/Arithmetics/Quad_impl.h
index cfe5f34c9c228873a99ed469d805826c07d9361e..39d76a80993c7f2544b57d5d7d6c61b9bda220ae 100644
--- a/src/TNL/Arithmetics/Quad_impl.h
+++ b/src/TNL/Arithmetics/Quad_impl.h
@@ -18,620 +18,740 @@
 
 #include "Quad.h"
 
-#define ABS(n) ((n) > 0 ? (n): -(n))
+#define ABS( n ) ( ( n ) > 0 ? ( n ) : -( n ) )
 
 namespace TNL {
 namespace Arithmetics {
 
-template <class T>
-Quad<T>::Quad() {
-    zeroQuad(data);
-}
-
-template <class T>
-Quad<T>::Quad(const T& value) {
-    data[0] = value;
-    data[1] = 0;
-    data[2] = 0;
-    data[3] = 0;
-}
-
-template <class T>
-Quad<T>::Quad(int value) {
-    data[0] = (T)value;
-    data[1] = 0;
-    data[2] = 0;
-    data[3] = 0;
-}
-
-template <class T>
-Quad<T>::Quad(const Quad<T>& other) {
-    data[0] = other[0];
-    data[1] = other[1];
-    data[2] = other[2];
-    data[3] = other[3];
-}
-
-template <class T>
-T& Quad<T>::operator [](int idx) {
-    return data[idx];
-}
-
-template <class T>
-const T& Quad<T>::operator [](int idx) const{
-    return data[idx];
-}
-
-template <class T>
-Quad<T>& Quad<T>::operator =(const Quad<T>& rhs) {
-    data[0] = rhs[0];
-    data[1] = rhs[1];
-    data[2] = rhs[2];
-    data[3] = rhs[3];
-    return *this;
-}
-
-template <class T>
-Quad<T>& Quad<T>::operator +=(const Quad<T>& rhs) {
-    quadAddAccurate(data, rhs.data, data);
-    return *this;
-}
-
-template <class T>
-Quad<T>& Quad<T>::operator -=(const Quad<T>& rhs) {
-    quadAddAccurate(data, (-rhs).data, data);
-    return *this;
-}
-
-template <class T>
-Quad<T>& Quad<T>::operator *=(const Quad<T>& rhs) {
-    quadMul(data, rhs.data, data);
-    return *this;
-}
-
-template <class T>
-Quad<T>& Quad<T>::operator /=(const Quad<T>& rhs) {
-    quadDiv(data, rhs.data, data);
-    return *this;
-}
-
-template <class T>
-Quad<T>& Quad<T>::operator =(const T& rhs) {
-    data[0] = rhs;
-    data[1] = 0;
-    data[2] = 0;
-    data[3] = 0;
-    return *this;
-}
-
-template <class T>
-Quad<T>& Quad<T>::operator +=(const T& rhs) {
-    doublePlusQuad(rhs, data, data);
-    return *this;
-}
-
-template <class T>
-Quad<T>& Quad<T>::operator -=(const T& rhs) {
-    doublePlusQuad(-rhs, data, data);
-    return *this;
-}
-
-template <class T>
-Quad<T>& Quad<T>::operator *=(const T& rhs) {
-    doubleTimesQuad(rhs, data, data);
-    return *this;
-}
-
-template <class T>
-Quad<T>& Quad<T>::operator /=(const T& rhs) {
-    quadDivDouble(data, rhs, data);
-    return *this;
-}
-
-template <class T>
-Quad<T> Quad<T>::operator +(const Quad<T>& value) const{
-    Quad<T> qd(*this);
-    qd += value;
-    return qd;
-}
-
-template <class T>
-Quad<T> Quad<T>::operator -(const Quad<T>& value) const{
-    Quad<T> qd(*this);
-    qd -= value;
-    return qd;
-}
-
-template <class T>
-Quad<T> Quad<T>::operator *(const Quad<T>& value) const{
-    Quad<T> qd(*this);
-    qd *= value;
-    return qd;
-}
-
-template <class T>
-Quad<T> Quad<T>::operator /(const Quad<T>& value) const{
-    Quad<T> qd(*this);
-    qd /= value;
-    return qd;
-}
-
-template <class T>
-Quad<T> Quad<T>::operator +(const T& value) const {
-    Quad<T> qd(*this);
-    qd += value;
-    return qd;
-}
-
-template <class T>
-Quad<T> Quad<T>::operator -(const T& value) const {
-    Quad<T> qd(*this);
-    qd -= value;
-    return qd;
-}
-
-template <class T>
-Quad<T> Quad<T>::operator *(const T& value) const {
-    Quad<T> qd(*this);
-    qd *= value;
-    return qd;
-}
-
-template <class T>
-Quad<T> Quad<T>::operator /(const T& value) const {
-    Quad<T> qd(*this);
-    qd /= value;
-    return qd;
-}
-
-template <class T>
-Quad<T> Quad<T>::operator +() {
-    Quad<T> qd(*this);
-    return qd;
-}
-
-template <class T>
-Quad<T> Quad<T>::operator -() {
-    Quad<T> qd(*this);
-    qd[0] = -qd[0];
-    qd[1] = -qd[1];
-    qd[2] = -qd[2];
-    qd[3] = -qd[3];
-    return qd;
-}
-
-template <class T>
-Quad<T> Quad<T>::operator +() const {
-    Quad<T> qd(*this);
-    return qd;
-}
-
-template <class T>
-Quad<T> Quad<T>::operator -() const {
-    Quad<T> qd(*this);
-    qd[0] = -qd[0];
-    qd[1] = -qd[1];
-    qd[2] = -qd[2];
-    qd[3] = -qd[3];
-    return qd;
-}
-
-template <class T>
-bool Quad<T>::operator ==(const Quad<T>& rhs) const {
-    if (data[0] == rhs[0] && data[1] == rhs[1] && data[2] == rhs[2] && data[3] == rhs[3]) {
-        return true;
-    }
-    return false;
-}
+template< class T >
+Quad< T >::Quad()
+{
+   zeroQuad( data );
+}
+
+template< class T >
+Quad< T >::Quad( const T& value )
+{
+   data[ 0 ] = value;
+   data[ 1 ] = 0;
+   data[ 2 ] = 0;
+   data[ 3 ] = 0;
+}
+
+template< class T >
+Quad< T >::Quad( int value )
+{
+   data[ 0 ] = (T) value;
+   data[ 1 ] = 0;
+   data[ 2 ] = 0;
+   data[ 3 ] = 0;
+}
+
+template< class T >
+Quad< T >::Quad( const Quad< T >& other )
+{
+   data[ 0 ] = other[ 0 ];
+   data[ 1 ] = other[ 1 ];
+   data[ 2 ] = other[ 2 ];
+   data[ 3 ] = other[ 3 ];
+}
 
-template <class T>
-bool Quad<T>::operator !=(const Quad<T>& rhs) const {
-    return !(*this == rhs);
-}
-
-template <class T>
-bool Quad<T>::operator <(const Quad<T>& rhs) const {
-    Quad<T> qd(*this);
-    qd -= rhs;
-    if (qd[0] < 0.) {
-        return true;
-    }
-    return false;
-}
-
-template <class T>
-bool Quad<T>::operator >(const Quad<T>& rhs) const {
-    Quad<T> qd(*this);
-    qd -= rhs;
-    if (qd[0] > 0.) {
-        return true;
-    }
-    return false;
-}
-
-template <class T>
-bool Quad<T>::operator >=(const Quad<T>& rhs) const {
-    Quad<T> qd(*this);
-    qd -= rhs;
-    if (qd[0] >= 0.) {
-        return true;
-    }
-    return false;
-}
-
-template <class T>
-bool Quad<T>::operator <=(const Quad<T>& rhs) const  {
-    Quad<T> qd(*this);
-    qd -= rhs;
-    if (qd[0] <= 0.) {
-        return true;
-    }
-    return false;
-}
-
-template <class T>
-Quad<T>::operator T() const{
-    return data[0];
-}
-
-template <typename T>
-Quad<T> operator+(const T& v1, const Quad<T>& v2) {
-    Quad<T> qd(v1);
-    qd += v2;
-    return qd;
-}
-
-template <typename T>
-Quad<T> operator-(const T& v1, const Quad<T>& v2) {
-    Quad<T> qd(v1);
-    qd -= v2;
-    return qd;
-}
-
-template <typename T>
-Quad<T> operator*(const T& v1, const Quad<T>& v2) {
-    Quad<T> qd(v1);
-    qd *= v2;
-    return qd;
-}
-
-template <typename T>
-Quad<T> operator/(const T& v1, const Quad<T>& v2) {
-    Quad<T> qd(v1);
-    qd /= v2;
-    return qd;
-}
-
-template <typename T>
-Quad<T> abs(const Quad<T>& value) {
-    Quad<T> qd(value);
-    if (value[0] < 0) {
-        qd = -qd;
-    }
-    return qd;
-}
-
-template <typename T>
-Quad<T> sqrt(const Quad<T>& value) {
-    Quad<T> qd(value);
-    Quad<T> x(1/sqrt((T)qd));
-    Quad<T> step;
-    //TODO zjednodušit dělení 2
-    step = x * (1. - qd * x * x);
-    step[0] /= 2;
-    step[1] /= 2;
-    step[2] /= 2;
-    step[3] /= 2;
-    x += step;
-    step = x * (1. - qd * x * x);
-    step[0] /= 2;
-    step[1] /= 2;
-    step[2] /= 2;
-    step[3] /= 2;
-    x += step;
-    step = x * (1. - qd * x * x);
-    step[0] /= 2;
-    step[1] /= 2;
-    step[2] /= 2;
-    step[3] /= 2;
-    x += step;
-    qd *= x;
-    return qd;
-}
-
-template <typename T>
-void threeThreeSum(T i0, T i1, T i2, T *o0, T *o1, T *o2) {
-    twoSum(i0, i1, &i1, &i0); // 1
-    twoSum(i1, i2, o0, &i1); // 2
-    twoSum(i0, i1, o1, o2); // 3
-}
-
-template <typename T>
-void threeTwoSum(T i0, T i1, T i2, T *o0, T *o1) {
-    twoSum(i0, i1, &i1, &i0); // 1
-    twoSum(i1, i2, o0, &i1); // 2
-    *o1 = i1 + i0; // 3
-}
-
-template <typename T>
-void fourTwoSum(T i0, T i1, T i2, T i3, T *o0, T *o1) {
-    twoSum(i0, i2, &i0, &i2); // 1
-    twoSum(i1, i3, &i1, &i3); // 2
-    i2 += i1; // 3
-    quickTwoSum(i0, i2, &i0, &i2); // 4
-    i3 += i2; // 5
-    quickTwoSum(i0, i3, o0, o1); // 6
-}
-
-template <typename T>
-void sixThreeSum(T i0, T i1, T i2, T i3, T i4, T i5, T *o0, T *o1,
-                 T *o2) {
-    threeThreeSum(i0, i1, i2, &i2, &i0, &i1); // 1
-    threeThreeSum(i3, i4, i5, &i5, &i3, &i4); // 2
-    twoSum(i2, i5, o0, &i5); // 3
-    twoSum(i0, i3, &i0, &i3); // 4
-    twoSum(i0, i5, o1, &i5); // 5
-    *o2 = i1 + i4 + i3 + i5; // 6
-}
-
-template <typename T>
-void sixTwoSum(T i0, T i1, T i2, T i3, T i4, T i5, T *o0, T *o1) {
-    threeTwoSum(i0, i1, i2, &i1, &i0);	// 1
-    threeTwoSum(i3, i4, i5, &i4, &i3);	// 2
-    twoSum(i1, i4, o0, &i1);	// 3
-    *o1 = i0 + i3 + i1;	// 4
-}
-
-template <typename T>
-void nineTwoSum(T i0, T i1, T i2, T i3, T i4, T i5, T i6, T i7,
-                T i8, T *o0, T *o1) {
-    twoSum(i5, i6, &i5, &i6); // 1
-    twoSum(i4, i7, &i4, &i7); // 2
-    twoSum(i1, i2, &i1, &i2); // 3
-    twoSum(i0, i3, &i0, &i3); // 4
-    fourTwoSum(i4, i7, i5, i6, &i4, &i7); // 5
-    fourTwoSum(i0, i3, i1, i2, &i0, &i3); // 6
-    fourTwoSum(i0, i3, i4, i7, &i0, &i3); // 7
-    threeTwoSum(i3, i0, i8, o0, o1); // 8
-}
-
-template <typename T>
-void doubleAccumulate(T i0, T i1, T i2, T *o0, T *o1, T *o2) {
-    twoSum(i1, i2, o0, o2);
-    twoSum(i0, *o0, o0, o1);
-    if (*o1 == 0) {
-        *o1 = *o0;
-        *o0 = 0;
-    }
-    if (*o2 == 0) {
-        *o2 = *o1;
-        *o1 = *o0;
-        *o0 = 0;
-    }
-}
-
-template <typename T>
-void quickTwoSum(T a, T b, T *s, T *e) {
-    *s = a + b;
-    *e = b - (*s - a);
-}
-
-template <typename T>
-void twoSum(T a, T b, T *s, T *e) {
-    *s = a + b;
-    T v = *s - a;
-    *e = (a - (*s - v)) + (b - v);
-}
-
-template <typename T>
-void split(T a, T *a_hi, T *a_lo) {
-    T t = 134217729 * a;
-    *a_hi = t - (t - a);
-    *a_lo = a - *a_hi;
-}
-
-template <typename T>
-void twoProd(T a, T b, T *p, T *e) {
-    *p = a * b;
-    T a_hi, a_lo, b_hi, b_lo;
-    split(a, &a_hi, &a_lo);
-    split(b, &b_hi, &b_lo);
-    *e = ((a_hi * b_hi - *p) + a_hi * b_lo + a_lo * b_hi) + a_lo * b_lo;
-}
-
-template <typename T>
-void renormalize(T *a, T *b) {
-    T s;
-    T t[5];
-    int k = 0;
-    T e;
-    quickTwoSum(a[3], a[4], &s, t + 4);
-    quickTwoSum(a[2], s, &s, t + 3);
-    quickTwoSum(a[1], s, &s, t + 2);
-    quickTwoSum(a[0], s, t, t + 1);
-    s = *t;
-    int i;
-    zeroQuad(b);
-    for (i = 1; i < 5; i++) {
-        quickTwoSum(s, t[i], &s, &e);
-        if (s != 0) {
-            b[k] = s;
-            s = e;
-            k++;
-        }
-    }
-}
-
-template <typename T>
-void doublePlusQuad(T b, const T *a, T *s) {
-    T m[5];
-    T e = b;
-    int i;
-    for (i = 0; i < 4; i++) {
-        twoSum(e, a[i], m + i, &e);
-    }
-    m[4] = e;
-    renormalize(m, s);
-}
-
-template <typename T>
-void doubleTimesQuad(T b, const T *a, T *s) {
-    T m[7];
-    twoProd(b, a[0], m, m + 1); // 1
-    twoProd(b, a[1], m + 2, m + 3); // 2
-    twoSum(m[1], m[2], m + 1, m + 2); // 3
-    twoProd(b, a[2], m + 4, m + 5); // 4
-    threeThreeSum(m[4], m[3], m[2], m + 2, m + 3, m + 4); // 5
-    m[6] = b * a[3]; // 6
-    threeTwoSum(m[6], m[5], m[3], m + 3, m + 5); // 7
-    m[4] += m[5]; // 8
-    renormalize(m, s);
-}
-
-template <typename T>
-void quadDivDouble(const T *a, T b, T *s) {
-    //double b1[] = {b, 0, 0, 0};
-    //quadDiv(a, b1, s);
-    T m[13];
-    int i; // ten půjde odstranit
-    m[5] = a[0];
-    m[6] = a[1];
-    m[7] = a[2];
-    m[8] = a[3];
-    m[11] = 0;
-    m[12] = 0;
-    for (i = 0; i < 5; i++) {
-        m[i] = m[5] / b;
-        twoProd(-m[i], b, m + 9, m + 10);
-        //doubleTimesQuad(-m[i], b, m + 9);
-        quadAddAccurate(m + 5, m + 9, m + 5);
-    }
-    renormalize(m, s);
-}
-
-template <typename T>
-void quadAdd(const T *a, const T *b, T *s) {
-    T m[8];
-    twoSum(a[0], b[0], m, m + 1); // 1
-    twoSum(a[1], b[1], m + 2, m + 3); // 2
-    twoSum(m[2], m[1], m + 1, m + 2); // 3
-    twoSum(a[2], b[2], m + 4, m + 5); // 4
-    // blok 1							   5
-    threeThreeSum(m[4], m[3], m[2], m + 2, m + 3, m + 4);
-    twoSum(a[3], b[3], m + 6, m + 7); // 6
-    // blok 2							   7
-    threeTwoSum(m[6], m[5], m[3], m + 3, m + 5);
-    m[4] += m[5] + m[7];		// 8
-    renormalize(m, s);
-}
-
-template <typename T>
-void quadAddAccurate(const T *a, const T *b, T *s) {
-    T m[11];
-    int i = 0;
-    int j = 0;
-    int k = 0;
-    for (;i < 4 && j < 4;k++) {
-        if (ABS(a[i]) > ABS(b[j])) {
-            m[k] = a[i];
-            i++;
-        } else {
-            m[k] = b[j];
-            j++;
-        }
-    }
-    for (; i < 4; i++) {
-        m[k] = a[i];
-        k++;
-    }
-    for (; j < 4; j++) {
-        m[k] = b[j];
-        k++;
-    }
-    m[9] = 0.;
-    m[10] = 0.;
-    k = 0;
-    for (i = 0; k < 4 && i < 8; i++) {
-        doubleAccumulate(m[9], m[10], m[i], m + 8, m + 9, m + 10);
-        if (m[8] != 0) {
-            m[k] = m[8];
-            k++;
-        }
-    }
-    m[k] = m[9];
-    m[k + 1] = m[10];
-    for (i = k + 2; i < 5; i++) {
-        m[i] = 0;
-    }
-    renormalize(m, s);
-}
-
-template <typename T>
-void quadMul(const T *a, const T *b, T *s) {
-    T m[20];
-    twoProd(a[0], b[0], m, m + 1); // 1
-    twoProd(a[0], b[1], m + 2, m + 3); // 2
-    twoProd(a[1], b[0], m + 4, m + 5); // 3
-    threeThreeSum(m[1], m[2], m[4], m + 1, m + 2, m + 4); // 4
-    twoProd(a[0], b[2], m + 6, m + 7); // 5
-    twoProd(a[1], b[1], m + 8, m + 9); // 6
-    twoProd(a[2], b[0], m + 10, m + 11); // 7
-    sixThreeSum(m[2], m[3], m[5], m[6], m[8], m[10], m + 2, m + 3, m + 5); // 8
-    twoProd(a[0], b[3], m + 12, m + 13); // 9
-    twoProd(a[1], b[2], m + 14, m + 15); // 10
-    twoProd(a[2], b[1], m + 16, m + 17); // 11
-    twoProd(a[3], b[0], m + 18, m + 19); // 12
-    nineTwoSum(m[4], m[3], m[7], m[9], m[11], m[12], m[14], m[16], m[18], m + 3, m + 4); // 13
-    m[4] += m[5] + m[13] + m[15] + m[17] + m[19] + a[1] * b[3] + a[2] * b[2] + a[3] * b[1]; // 14
-    renormalize(m, s);
-}
-
-template <typename T>
-void quadMulQuick(const T *a, const T *b, T *s) {
-    T m[12];
-    twoProd(a[0], b[0], m, m + 1); // 1
-    twoProd(a[0], b[1], m + 2, m + 3); // 2
-    twoProd(a[1], b[0], m + 4, m + 5); // 3
-    threeThreeSum(m[1], m[2], m[4], m + 1, m + 2, m + 4); // 4
-    twoProd(a[0], b[2], m + 6, m + 7); // 5
-    twoProd(a[1], b[1], m + 8, m + 9); // 6
-    twoProd(a[2], b[0], m + 10, m + 11); // 7
-    sixTwoSum(m[2], m[3], m[5], m[6], m[8], m[10], m + 2, m + 3); // 8
-    m[3] += m[4] + m[7] + m[9] + m[11] + a[0] * b[3] + a[1] * b[2] + a[2] * b[1] + a[3] * b[0];  // 9
-    m[4] = 0;	// 10
-    renormalize(m, s);
-}
-
-template <typename T>
-void quadDiv(const T *a, const T *b, T *s) {
-    T m[13];
-    //double n[4];
-    //double k[4];
-    int i; // ten půjde odstranit
-    m[5] = a[0];
-    m[6] = a[1];
-    m[7] = a[2];
-    m[8] = a[3];
-    for (i = 0; i < 5; i++) {
-        m[i] = m[5] / b[0];
-        doubleTimesQuad(-m[i], b, m + 9);
-        quadAddAccurate(m + 5, m + 9, m + 5);
-    }
-    renormalize(m, s);
-}
-
-template <typename T>
-void zeroQuad(T *a) {
-    a[0] = 0;
-    a[1] = 0;
-    a[2] = 0;
-    a[3] = 0;
-}
-
-template <typename T>
-void printQuad(T *a) {
-    printf("%.15le + %.15le + %.15le + %.15le\n", a[0], a[1], a[2], a[3]);
-}
-
-} // namespace Arithmetics
-} // namespace TNL
+template< class T >
+T&
+Quad< T >::operator[]( int idx )
+{
+   return data[ idx ];
+}
+
+template< class T >
+const T&
+Quad< T >::operator[]( int idx ) const
+{
+   return data[ idx ];
+}
+
+template< class T >
+Quad< T >&
+Quad< T >::operator=( const Quad< T >& rhs )
+{
+   data[ 0 ] = rhs[ 0 ];
+   data[ 1 ] = rhs[ 1 ];
+   data[ 2 ] = rhs[ 2 ];
+   data[ 3 ] = rhs[ 3 ];
+   return *this;
+}
+
+template< class T >
+Quad< T >&
+Quad< T >::operator+=( const Quad< T >& rhs )
+{
+   quadAddAccurate( data, rhs.data, data );
+   return *this;
+}
+
+template< class T >
+Quad< T >&
+Quad< T >::operator-=( const Quad< T >& rhs )
+{
+   quadAddAccurate( data, ( -rhs ).data, data );
+   return *this;
+}
+
+template< class T >
+Quad< T >&
+Quad< T >::operator*=( const Quad< T >& rhs )
+{
+   quadMul( data, rhs.data, data );
+   return *this;
+}
+
+template< class T >
+Quad< T >&
+Quad< T >::operator/=( const Quad< T >& rhs )
+{
+   quadDiv( data, rhs.data, data );
+   return *this;
+}
+
+template< class T >
+Quad< T >&
+Quad< T >::operator=( const T& rhs )
+{
+   data[ 0 ] = rhs;
+   data[ 1 ] = 0;
+   data[ 2 ] = 0;
+   data[ 3 ] = 0;
+   return *this;
+}
+
+template< class T >
+Quad< T >&
+Quad< T >::operator+=( const T& rhs )
+{
+   doublePlusQuad( rhs, data, data );
+   return *this;
+}
+
+template< class T >
+Quad< T >&
+Quad< T >::operator-=( const T& rhs )
+{
+   doublePlusQuad( -rhs, data, data );
+   return *this;
+}
+
+template< class T >
+Quad< T >&
+Quad< T >::operator*=( const T& rhs )
+{
+   doubleTimesQuad( rhs, data, data );
+   return *this;
+}
+
+template< class T >
+Quad< T >&
+Quad< T >::operator/=( const T& rhs )
+{
+   quadDivDouble( data, rhs, data );
+   return *this;
+}
+
+template< class T >
+Quad< T >
+Quad< T >::operator+( const Quad< T >& value ) const
+{
+   Quad< T > qd( *this );
+   qd += value;
+   return qd;
+}
+
+template< class T >
+Quad< T >
+Quad< T >::operator-( const Quad< T >& value ) const
+{
+   Quad< T > qd( *this );
+   qd -= value;
+   return qd;
+}
+
+template< class T >
+Quad< T >
+Quad< T >::operator*( const Quad< T >& value ) const
+{
+   Quad< T > qd( *this );
+   qd *= value;
+   return qd;
+}
+
+template< class T >
+Quad< T >
+Quad< T >::operator/( const Quad< T >& value ) const
+{
+   Quad< T > qd( *this );
+   qd /= value;
+   return qd;
+}
+
+template< class T >
+Quad< T >
+Quad< T >::operator+( const T& value ) const
+{
+   Quad< T > qd( *this );
+   qd += value;
+   return qd;
+}
+
+template< class T >
+Quad< T >
+Quad< T >::operator-( const T& value ) const
+{
+   Quad< T > qd( *this );
+   qd -= value;
+   return qd;
+}
+
+template< class T >
+Quad< T >
+Quad< T >::operator*( const T& value ) const
+{
+   Quad< T > qd( *this );
+   qd *= value;
+   return qd;
+}
+
+template< class T >
+Quad< T >
+Quad< T >::operator/( const T& value ) const
+{
+   Quad< T > qd( *this );
+   qd /= value;
+   return qd;
+}
+
+template< class T >
+Quad< T >
+Quad< T >::operator+()
+{
+   Quad< T > qd( *this );
+   return qd;
+}
+
+template< class T >
+Quad< T >
+Quad< T >::operator-()
+{
+   Quad< T > qd( *this );
+   qd[ 0 ] = -qd[ 0 ];
+   qd[ 1 ] = -qd[ 1 ];
+   qd[ 2 ] = -qd[ 2 ];
+   qd[ 3 ] = -qd[ 3 ];
+   return qd;
+}
+
+template< class T >
+Quad< T >
+Quad< T >::operator+() const
+{
+   Quad< T > qd( *this );
+   return qd;
+}
+
+template< class T >
+Quad< T >
+Quad< T >::operator-() const
+{
+   Quad< T > qd( *this );
+   qd[ 0 ] = -qd[ 0 ];
+   qd[ 1 ] = -qd[ 1 ];
+   qd[ 2 ] = -qd[ 2 ];
+   qd[ 3 ] = -qd[ 3 ];
+   return qd;
+}
+
+template< class T >
+bool
+Quad< T >::operator==( const Quad< T >& rhs ) const
+{
+   if( data[ 0 ] == rhs[ 0 ] && data[ 1 ] == rhs[ 1 ] && data[ 2 ] == rhs[ 2 ] && data[ 3 ] == rhs[ 3 ] ) {
+      return true;
+   }
+   return false;
+}
+
+template< class T >
+bool
+Quad< T >::operator!=( const Quad< T >& rhs ) const
+{
+   return ! ( *this == rhs );
+}
+
+template< class T >
+bool
+Quad< T >::operator<( const Quad< T >& rhs ) const
+{
+   Quad< T > qd( *this );
+   qd -= rhs;
+   if( qd[ 0 ] < 0. ) {
+      return true;
+   }
+   return false;
+}
+
+template< class T >
+bool
+Quad< T >::operator>( const Quad< T >& rhs ) const
+{
+   Quad< T > qd( *this );
+   qd -= rhs;
+   if( qd[ 0 ] > 0. ) {
+      return true;
+   }
+   return false;
+}
+
+template< class T >
+bool
+Quad< T >::operator>=( const Quad< T >& rhs ) const
+{
+   Quad< T > qd( *this );
+   qd -= rhs;
+   if( qd[ 0 ] >= 0. ) {
+      return true;
+   }
+   return false;
+}
+
+template< class T >
+bool
+Quad< T >::operator<=( const Quad< T >& rhs ) const
+{
+   Quad< T > qd( *this );
+   qd -= rhs;
+   if( qd[ 0 ] <= 0. ) {
+      return true;
+   }
+   return false;
+}
+
+template< class T >
+Quad< T >::operator T() const
+{
+   return data[ 0 ];
+}
+
+template< typename T >
+Quad< T >
+operator+( const T& v1, const Quad< T >& v2 )
+{
+   Quad< T > qd( v1 );
+   qd += v2;
+   return qd;
+}
+
+template< typename T >
+Quad< T >
+operator-( const T& v1, const Quad< T >& v2 )
+{
+   Quad< T > qd( v1 );
+   qd -= v2;
+   return qd;
+}
+
+template< typename T >
+Quad< T >
+operator*( const T& v1, const Quad< T >& v2 )
+{
+   Quad< T > qd( v1 );
+   qd *= v2;
+   return qd;
+}
+
+template< typename T >
+Quad< T >
+operator/( const T& v1, const Quad< T >& v2 )
+{
+   Quad< T > qd( v1 );
+   qd /= v2;
+   return qd;
+}
+
+template< typename T >
+Quad< T >
+abs( const Quad< T >& value )
+{
+   Quad< T > qd( value );
+   if( value[ 0 ] < 0 ) {
+      qd = -qd;
+   }
+   return qd;
+}
+
+template< typename T >
+Quad< T >
+sqrt( const Quad< T >& value )
+{
+   Quad< T > qd( value );
+   Quad< T > x( 1 / sqrt( (T) qd ) );
+   Quad< T > step;
+   // TODO zjednodušit dělení 2
+   step = x * ( 1. - qd * x * x );
+   step[ 0 ] /= 2;
+   step[ 1 ] /= 2;
+   step[ 2 ] /= 2;
+   step[ 3 ] /= 2;
+   x += step;
+   step = x * ( 1. - qd * x * x );
+   step[ 0 ] /= 2;
+   step[ 1 ] /= 2;
+   step[ 2 ] /= 2;
+   step[ 3 ] /= 2;
+   x += step;
+   step = x * ( 1. - qd * x * x );
+   step[ 0 ] /= 2;
+   step[ 1 ] /= 2;
+   step[ 2 ] /= 2;
+   step[ 3 ] /= 2;
+   x += step;
+   qd *= x;
+   return qd;
+}
+
+template< typename T >
+void
+threeThreeSum( T i0, T i1, T i2, T* o0, T* o1, T* o2 )
+{
+   twoSum( i0, i1, &i1, &i0 );  // 1
+   twoSum( i1, i2, o0, &i1 );   // 2
+   twoSum( i0, i1, o1, o2 );    // 3
+}
+
+template< typename T >
+void
+threeTwoSum( T i0, T i1, T i2, T* o0, T* o1 )
+{
+   twoSum( i0, i1, &i1, &i0 );  // 1
+   twoSum( i1, i2, o0, &i1 );   // 2
+   *o1 = i1 + i0;               // 3
+}
+
+template< typename T >
+void
+fourTwoSum( T i0, T i1, T i2, T i3, T* o0, T* o1 )
+{
+   twoSum( i0, i2, &i0, &i2 );       // 1
+   twoSum( i1, i3, &i1, &i3 );       // 2
+   i2 += i1;                         // 3
+   quickTwoSum( i0, i2, &i0, &i2 );  // 4
+   i3 += i2;                         // 5
+   quickTwoSum( i0, i3, o0, o1 );    // 6
+}
+
+template< typename T >
+void
+sixThreeSum( T i0, T i1, T i2, T i3, T i4, T i5, T* o0, T* o1, T* o2 )
+{
+   threeThreeSum( i0, i1, i2, &i2, &i0, &i1 );  // 1
+   threeThreeSum( i3, i4, i5, &i5, &i3, &i4 );  // 2
+   twoSum( i2, i5, o0, &i5 );                   // 3
+   twoSum( i0, i3, &i0, &i3 );                  // 4
+   twoSum( i0, i5, o1, &i5 );                   // 5
+   *o2 = i1 + i4 + i3 + i5;                     // 6
+}
+
+template< typename T >
+void
+sixTwoSum( T i0, T i1, T i2, T i3, T i4, T i5, T* o0, T* o1 )
+{
+   threeTwoSum( i0, i1, i2, &i1, &i0 );  // 1
+   threeTwoSum( i3, i4, i5, &i4, &i3 );  // 2
+   twoSum( i1, i4, o0, &i1 );            // 3
+   *o1 = i0 + i3 + i1;                   // 4
+}
+
+template< typename T >
+void
+nineTwoSum( T i0, T i1, T i2, T i3, T i4, T i5, T i6, T i7, T i8, T* o0, T* o1 )
+{
+   twoSum( i5, i6, &i5, &i6 );              // 1
+   twoSum( i4, i7, &i4, &i7 );              // 2
+   twoSum( i1, i2, &i1, &i2 );              // 3
+   twoSum( i0, i3, &i0, &i3 );              // 4
+   fourTwoSum( i4, i7, i5, i6, &i4, &i7 );  // 5
+   fourTwoSum( i0, i3, i1, i2, &i0, &i3 );  // 6
+   fourTwoSum( i0, i3, i4, i7, &i0, &i3 );  // 7
+   threeTwoSum( i3, i0, i8, o0, o1 );       // 8
+}
+
+template< typename T >
+void
+doubleAccumulate( T i0, T i1, T i2, T* o0, T* o1, T* o2 )
+{
+   twoSum( i1, i2, o0, o2 );
+   twoSum( i0, *o0, o0, o1 );
+   if( *o1 == 0 ) {
+      *o1 = *o0;
+      *o0 = 0;
+   }
+   if( *o2 == 0 ) {
+      *o2 = *o1;
+      *o1 = *o0;
+      *o0 = 0;
+   }
+}
+
+template< typename T >
+void
+quickTwoSum( T a, T b, T* s, T* e )
+{
+   *s = a + b;
+   *e = b - ( *s - a );
+}
+
+template< typename T >
+void
+twoSum( T a, T b, T* s, T* e )
+{
+   *s = a + b;
+   T v = *s - a;
+   *e = ( a - ( *s - v ) ) + ( b - v );
+}
+
+template< typename T >
+void
+split( T a, T* a_hi, T* a_lo )
+{
+   T t = 134217729 * a;
+   *a_hi = t - ( t - a );
+   *a_lo = a - *a_hi;
+}
+
+template< typename T >
+void
+twoProd( T a, T b, T* p, T* e )
+{
+   *p = a * b;
+   T a_hi, a_lo, b_hi, b_lo;
+   split( a, &a_hi, &a_lo );
+   split( b, &b_hi, &b_lo );
+   *e = ( ( a_hi * b_hi - *p ) + a_hi * b_lo + a_lo * b_hi ) + a_lo * b_lo;
+}
+
+template< typename T >
+void
+renormalize( T* a, T* b )
+{
+   T s;
+   T t[ 5 ];
+   int k = 0;
+   T e;
+   quickTwoSum( a[ 3 ], a[ 4 ], &s, t + 4 );
+   quickTwoSum( a[ 2 ], s, &s, t + 3 );
+   quickTwoSum( a[ 1 ], s, &s, t + 2 );
+   quickTwoSum( a[ 0 ], s, t, t + 1 );
+   s = *t;
+   int i;
+   zeroQuad( b );
+   for( i = 1; i < 5; i++ ) {
+      quickTwoSum( s, t[ i ], &s, &e );
+      if( s != 0 ) {
+         b[ k ] = s;
+         s = e;
+         k++;
+      }
+   }
+}
+
+template< typename T >
+void
+doublePlusQuad( T b, const T* a, T* s )
+{
+   T m[ 5 ];
+   T e = b;
+   int i;
+   for( i = 0; i < 4; i++ ) {
+      twoSum( e, a[ i ], m + i, &e );
+   }
+   m[ 4 ] = e;
+   renormalize( m, s );
+}
+
+template< typename T >
+void
+doubleTimesQuad( T b, const T* a, T* s )
+{
+   T m[ 7 ];
+   twoProd( b, a[ 0 ], m, m + 1 );                                // 1
+   twoProd( b, a[ 1 ], m + 2, m + 3 );                            // 2
+   twoSum( m[ 1 ], m[ 2 ], m + 1, m + 2 );                        // 3
+   twoProd( b, a[ 2 ], m + 4, m + 5 );                            // 4
+   threeThreeSum( m[ 4 ], m[ 3 ], m[ 2 ], m + 2, m + 3, m + 4 );  // 5
+   m[ 6 ] = b * a[ 3 ];                                           // 6
+   threeTwoSum( m[ 6 ], m[ 5 ], m[ 3 ], m + 3, m + 5 );           // 7
+   m[ 4 ] += m[ 5 ];                                              // 8
+   renormalize( m, s );
+}
+
+template< typename T >
+void
+quadDivDouble( const T* a, T b, T* s )
+{
+   // double b1[] = {b, 0, 0, 0};
+   // quadDiv(a, b1, s);
+   T m[ 13 ];
+   int i;  // ten půjde odstranit
+   m[ 5 ] = a[ 0 ];
+   m[ 6 ] = a[ 1 ];
+   m[ 7 ] = a[ 2 ];
+   m[ 8 ] = a[ 3 ];
+   m[ 11 ] = 0;
+   m[ 12 ] = 0;
+   for( i = 0; i < 5; i++ ) {
+      m[ i ] = m[ 5 ] / b;
+      twoProd( -m[ i ], b, m + 9, m + 10 );
+      // doubleTimesQuad(-m[i], b, m + 9);
+      quadAddAccurate( m + 5, m + 9, m + 5 );
+   }
+   renormalize( m, s );
+}
+
+template< typename T >
+void
+quadAdd( const T* a, const T* b, T* s )
+{
+   T m[ 8 ];
+   twoSum( a[ 0 ], b[ 0 ], m, m + 1 );      // 1
+   twoSum( a[ 1 ], b[ 1 ], m + 2, m + 3 );  // 2
+   twoSum( m[ 2 ], m[ 1 ], m + 1, m + 2 );  // 3
+   twoSum( a[ 2 ], b[ 2 ], m + 4, m + 5 );  // 4
+   // blok 1							   5
+   threeThreeSum( m[ 4 ], m[ 3 ], m[ 2 ], m + 2, m + 3, m + 4 );
+   twoSum( a[ 3 ], b[ 3 ], m + 6, m + 7 );  // 6
+   // blok 2							   7
+   threeTwoSum( m[ 6 ], m[ 5 ], m[ 3 ], m + 3, m + 5 );
+   m[ 4 ] += m[ 5 ] + m[ 7 ];  // 8
+   renormalize( m, s );
+}
+
+template< typename T >
+void
+quadAddAccurate( const T* a, const T* b, T* s )
+{
+   T m[ 11 ];
+   int i = 0;
+   int j = 0;
+   int k = 0;
+   for( ; i < 4 && j < 4; k++ ) {
+      if( ABS( a[ i ] ) > ABS( b[ j ] ) ) {
+         m[ k ] = a[ i ];
+         i++;
+      }
+      else {
+         m[ k ] = b[ j ];
+         j++;
+      }
+   }
+   for( ; i < 4; i++ ) {
+      m[ k ] = a[ i ];
+      k++;
+   }
+   for( ; j < 4; j++ ) {
+      m[ k ] = b[ j ];
+      k++;
+   }
+   m[ 9 ] = 0.;
+   m[ 10 ] = 0.;
+   k = 0;
+   for( i = 0; k < 4 && i < 8; i++ ) {
+      doubleAccumulate( m[ 9 ], m[ 10 ], m[ i ], m + 8, m + 9, m + 10 );
+      if( m[ 8 ] != 0 ) {
+         m[ k ] = m[ 8 ];
+         k++;
+      }
+   }
+   m[ k ] = m[ 9 ];
+   m[ k + 1 ] = m[ 10 ];
+   for( i = k + 2; i < 5; i++ ) {
+      m[ i ] = 0;
+   }
+   renormalize( m, s );
+}
+
+template< typename T >
+void
+quadMul( const T* a, const T* b, T* s )
+{
+   T m[ 20 ];
+   twoProd( a[ 0 ], b[ 0 ], m, m + 1 );                                                                             // 1
+   twoProd( a[ 0 ], b[ 1 ], m + 2, m + 3 );                                                                         // 2
+   twoProd( a[ 1 ], b[ 0 ], m + 4, m + 5 );                                                                         // 3
+   threeThreeSum( m[ 1 ], m[ 2 ], m[ 4 ], m + 1, m + 2, m + 4 );                                                    // 4
+   twoProd( a[ 0 ], b[ 2 ], m + 6, m + 7 );                                                                         // 5
+   twoProd( a[ 1 ], b[ 1 ], m + 8, m + 9 );                                                                         // 6
+   twoProd( a[ 2 ], b[ 0 ], m + 10, m + 11 );                                                                       // 7
+   sixThreeSum( m[ 2 ], m[ 3 ], m[ 5 ], m[ 6 ], m[ 8 ], m[ 10 ], m + 2, m + 3, m + 5 );                             // 8
+   twoProd( a[ 0 ], b[ 3 ], m + 12, m + 13 );                                                                       // 9
+   twoProd( a[ 1 ], b[ 2 ], m + 14, m + 15 );                                                                       // 10
+   twoProd( a[ 2 ], b[ 1 ], m + 16, m + 17 );                                                                       // 11
+   twoProd( a[ 3 ], b[ 0 ], m + 18, m + 19 );                                                                       // 12
+   nineTwoSum( m[ 4 ], m[ 3 ], m[ 7 ], m[ 9 ], m[ 11 ], m[ 12 ], m[ 14 ], m[ 16 ], m[ 18 ], m + 3, m + 4 );         // 13
+   m[ 4 ] += m[ 5 ] + m[ 13 ] + m[ 15 ] + m[ 17 ] + m[ 19 ] + a[ 1 ] * b[ 3 ] + a[ 2 ] * b[ 2 ] + a[ 3 ] * b[ 1 ];  // 14
+   renormalize( m, s );
+}
+
+template< typename T >
+void
+quadMulQuick( const T* a, const T* b, T* s )
+{
+   T m[ 12 ];
+   twoProd( a[ 0 ], b[ 0 ], m, m + 1 );                                                                                   // 1
+   twoProd( a[ 0 ], b[ 1 ], m + 2, m + 3 );                                                                               // 2
+   twoProd( a[ 1 ], b[ 0 ], m + 4, m + 5 );                                                                               // 3
+   threeThreeSum( m[ 1 ], m[ 2 ], m[ 4 ], m + 1, m + 2, m + 4 );                                                          // 4
+   twoProd( a[ 0 ], b[ 2 ], m + 6, m + 7 );                                                                               // 5
+   twoProd( a[ 1 ], b[ 1 ], m + 8, m + 9 );                                                                               // 6
+   twoProd( a[ 2 ], b[ 0 ], m + 10, m + 11 );                                                                             // 7
+   sixTwoSum( m[ 2 ], m[ 3 ], m[ 5 ], m[ 6 ], m[ 8 ], m[ 10 ], m + 2, m + 3 );                                            // 8
+   m[ 3 ] += m[ 4 ] + m[ 7 ] + m[ 9 ] + m[ 11 ] + a[ 0 ] * b[ 3 ] + a[ 1 ] * b[ 2 ] + a[ 2 ] * b[ 1 ] + a[ 3 ] * b[ 0 ];  // 9
+   m[ 4 ] = 0;                                                                                                            // 10
+   renormalize( m, s );
+}
+
+template< typename T >
+void
+quadDiv( const T* a, const T* b, T* s )
+{
+   T m[ 13 ];
+   // double n[4];
+   // double k[4];
+   int i;  // ten půjde odstranit
+   m[ 5 ] = a[ 0 ];
+   m[ 6 ] = a[ 1 ];
+   m[ 7 ] = a[ 2 ];
+   m[ 8 ] = a[ 3 ];
+   for( i = 0; i < 5; i++ ) {
+      m[ i ] = m[ 5 ] / b[ 0 ];
+      doubleTimesQuad( -m[ i ], b, m + 9 );
+      quadAddAccurate( m + 5, m + 9, m + 5 );
+   }
+   renormalize( m, s );
+}
+
+template< typename T >
+void
+zeroQuad( T* a )
+{
+   a[ 0 ] = 0;
+   a[ 1 ] = 0;
+   a[ 2 ] = 0;
+   a[ 3 ] = 0;
+}
+
+template< typename T >
+void
+printQuad( T* a )
+{
+   printf( "%.15le + %.15le + %.15le + %.15le\n", a[ 0 ], a[ 1 ], a[ 2 ], a[ 3 ] );
+}
+
+}  // namespace Arithmetics
+}  // namespace TNL
diff --git a/src/TNL/Arithmetics/Real.h b/src/TNL/Arithmetics/Real.h
index 8f726de55c79d2f465b2fa7a3a9fbbe7af1e416e..a710902d2656d396562ee9214b4378390b013605 100644
--- a/src/TNL/Arithmetics/Real.h
+++ b/src/TNL/Arithmetics/Real.h
@@ -12,412 +12,506 @@
 
 namespace TNL {
 
-template< class T > class Real
+template< class T >
+class Real
 {
    T data;
 
-   public:
-
-   Real()
-   : data( 0 )
-     {};
+public:
+   Real() : data( 0 ){};
 
-   template< class S >Real( const S& d )
-   : data( d )
-     {}
+   template< class S >
+   Real( const S& d ) : data( d )
+   {}
 
-   Real( const Real& v )
-   : data( v. data )
-     {};
+   Real( const Real& v ) : data( v.data ){};
 
-   T& Data()
+   T&
+   Data()
    {
       return data;
    };
 
-   const T& Data() const
+   const T&
+   Data() const
    {
       return data;
    };
 
-   const Real& operator += ( const Real& v )
+   const Real&
+   operator+=( const Real& v )
+   {
+      data += v.data;
+      tnl_flops_counter.recordAdding();
+      return *this;
+   };
+
+   template< class S >
+   const Real&
+   operator+=( const S& v )
+   {
+      data += v;
+      tnl_flops_counter.recordAdding();
+      return *this;
+   }
+
+   const Real&
+   operator-=( const Real& v )
+   {
+      data -= v.data;
+      tnl_flops_counter.recordAdding();
+      return *this;
+   };
+
+   template< class S >
+   const Real&
+   operator-=( const S& v )
+   {
+      data -= v;
+      tnl_flops_counter.recordAdding();
+      return *this;
+   }
+
+   const Real&
+   operator*=( const Real& v )
+   {
+      data *= v.data;
+      tnl_flops_counter.recordMultiplying();
+      return *this;
+   };
+
+   template< class S >
+   const Real&
+   operator*=( const S& v )
+   {
+      data *= v;
+      tnl_flops_counter.recordMultiplying();
+      return *this;
+   }
+
+   const Real&
+   operator/=( const Real& v )
+   {
+      data /= v.data;
+      tnl_flops_counter.recordDividing();
+      return *this;
+   };
+
+   template< class S >
+   const Real&
+   operator/=( const S& v )
+   {
+      data /= v;
+      tnl_flops_counter.recordDividing();
+      return *this;
+   }
+
+   const Real&
+   operator+( const Real& v ) const
+   {
+      return Real( *this ) += v;
+   };
+
+   template< class S >
+   const Real&
+   operator+( const S& v ) const
    {
-      data += v. data;
-      tnl_flops_counter. recordAdding();
+      return Real( *this ) += v;
+   }
+
+   const Real&
+   operator-( const Real& v ) const
+   {
+      return Real( *this ) -= v;
+   };
+
+   template< class S >
+   const Real&
+   operator-( const S& v ) const
+   {
+      return Real( *this ) -= v;
+   }
+
+   const Real&
+   operator-() const
+   {
+      return Real( *this ) *= -1.0;
+   };
+
+   const Real&
+   operator*( const Real& v ) const
+   {
+      return Real( *this ) *= v;
+   };
+
+   template< class S >
+   const Real&
+   operator*( const S& v ) const
+   {
+      return Real( *this ) *= v;
+   }
+
+   const Real&
+   operator/( const Real& v ) const
+   {
+      return Real( *this ) /= v;
+   };
+
+   template< class S >
+   const Real&
+   operator/( const S& v ) const
+   {
+      return Real( *this ) /= v;
+   }
+
+   const Real&
+   operator=( const Real& v )
+   {
+      data = v.data;
+      return *this;
+   };
+
+   const Real&
+   operator=( const T& v )
+   {
+      data = v;
       return *this;
    };
 
-	template< class S > const Real& operator += ( const S& v )
-	{
-		data += v;
-		tnl_flops_counter. recordAdding();
-		return *this;
-	}
-
-	const Real& operator -= ( const Real& v )
-	{
-		data -= v. data;
-		tnl_flops_counter. recordAdding();
-		return *this;
-	};
-
-	template< class S > const Real& operator -= ( const S& v )
-	{
-		data -= v;
-		tnl_flops_counter. recordAdding();
-		return *this;
-	}
-
-	const Real& operator *= ( const Real& v )
-	{
-		data *= v. data;
-		tnl_flops_counter. recordMultiplying();
-		return *this;
-	};
-
-	template< class S > const Real& operator *= ( const S& v )
-	{
-		data *= v;
-		tnl_flops_counter. recordMultiplying();
-		return *this;
-	}
-
-	const Real& operator /= ( const Real& v )
-	{
-		data /= v. data;
-		tnl_flops_counter. recordDividing();
-		return *this;
-	};
-
-	template< class S > const Real& operator /= ( const S& v )
-	{
-		data /= v;
-		tnl_flops_counter. recordDividing();
-		return *this;
-	}
-
-	const Real& operator + ( const Real& v ) const
-	{
-		return Real( *this ) += v;
-	};
-
-	template< class S > const Real& operator + ( const S& v ) const
-	{
-		return Real( *this ) += v;
-	}
-
-	const Real& operator - ( const Real& v ) const
-	{
-		return Real( *this ) -= v;
-	};
-
-	template< class S > const Real& operator - ( const S& v ) const
-	{
-		return Real( *this ) -= v;
-	}
-
-	const Real& operator - () const
-	{
-		return Real( *this ) *= -1.0;
-	};
-
-	const Real& operator * ( const Real& v ) const
-	{
-		return Real( *this ) *= v;
-	};
-
-	template< class S > const Real& operator * ( const S& v ) const
-	{
-		return Real( *this ) *= v;
-	}
-
-	const Real& operator / ( const Real& v ) const
-	{
-		return Real( *this ) /= v;
-	};
-
-	template< class S > const Real& operator / ( const S& v ) const
-	{
-		return Real( *this ) /= v;
-	}
-
-	const Real& operator = ( const Real& v )
-	{
-		data = v. data;
-		return *this;
-	};
-
-	const Real& operator = ( const T& v )
-	{
-		data = v;
-		return *this;
-	};
-
-	bool operator == ( const Real& v ) const
-	{
-		return data == v.data;
-	};
-
-	bool operator == ( const T& v ) const
-	{
-		return data == v;
-	};
-
-	bool operator != ( const T& v ) const
-	{
-		return data != v;
-	};
-
-	bool operator != ( const Real& v ) const
-	{
-		return data != v.data;
-	};
-
-	bool operator <= ( const T& v ) const
-	{
-		return data <= v;
-	};
-
-	bool operator <= ( const Real& v ) const
-	{
-		return data <= v.data;
-	};
-
-	bool operator >= ( const T& v ) const
-	{
-		return data >= v;
-	};
-
-	bool operator >= ( const Real& v ) const
-	{
-		return data >= v.data;
-	};
-
-	bool operator < ( const T& v ) const
-	{
-		return data < v;
-	};
-
-	bool operator < ( const Real& v ) const
-	{
-		return data < v.data;
-	};
-
-	bool operator > ( const T& v ) const
-	{
-		return data > v;
-	};
-
-	bool operator > ( const Real& v ) const
-	{
-		return data > v.data;
-	};
-
-	bool operator || ( const Real& v ) const
-    {
-		return data || v.data;
-    };
-
-	bool operator && ( const Real& v ) const
-    {
-		return data && v.data;
-    };
-
-	bool operator ! () const
-   {
-	   return ! data;
+   bool
+   operator==( const Real& v ) const
+   {
+      return data == v.data;
    };
 
-    /*operator bool () const
-    {
-	   return ( bool ) data;
-	};*/
+   bool
+   operator==( const T& v ) const
+   {
+      return data == v;
+   };
 
-	operator int () const
-	{
-	   return ( int ) data;
-	};
+   bool
+   operator!=( const T& v ) const
+   {
+      return data != v;
+   };
 
-	/*operator float () const
-	{
-		return ( float ) data;
-	};*/
+   bool
+   operator!=( const Real& v ) const
+   {
+      return data != v.data;
+   };
 
-	operator double () const
-    {
-		return ( double ) data;
-    };
+   bool
+   operator<=( const T& v ) const
+   {
+      return data <= v;
+   };
 
+   bool
+   operator<=( const Real& v ) const
+   {
+      return data <= v.data;
+   };
+
+   bool
+   operator>=( const T& v ) const
+   {
+      return data >= v;
+   };
+
+   bool
+   operator>=( const Real& v ) const
+   {
+      return data >= v.data;
+   };
+
+   bool
+   operator<( const T& v ) const
+   {
+      return data < v;
+   };
+
+   bool
+   operator<( const Real& v ) const
+   {
+      return data < v.data;
+   };
+
+   bool
+   operator>( const T& v ) const
+   {
+      return data > v;
+   };
+
+   bool
+   operator>( const Real& v ) const
+   {
+      return data > v.data;
+   };
+
+   bool
+   operator||( const Real& v ) const
+   {
+      return data || v.data;
+   };
+
+   bool
+   operator&&( const Real& v ) const
+   {
+      return data && v.data;
+   };
+
+   bool
+   operator!() const
+   {
+      return ! data;
+   };
+
+   /*operator bool () const
+   {
+          return ( bool ) data;
+       };*/
+
+   operator int() const
+   {
+      return (int) data;
+   };
+
+   /*operator float () const
+   {
+           return ( float ) data;
+   };*/
+
+   operator double() const
+   {
+      return (double) data;
+   };
 };
 
-template< class T, class S > const Real< T >& operator + ( const S& v1, const Real< T >& v2 )
+template< class T, class S >
+const Real< T >&
+operator+( const S& v1, const Real< T >& v2 )
 {
-   return Real< T >( v1 ) += v2. Data();
+   return Real< T >( v1 ) += v2.Data();
 };
 
-template< class T, class S > const Real< T >& operator - ( const S& v1, const Real< T >& v2 )
+template< class T, class S >
+const Real< T >&
+operator-( const S& v1, const Real< T >& v2 )
 {
-   return Real< T >( v1 ) -= v2. Data();
+   return Real< T >( v1 ) -= v2.Data();
 };
 
-template< class T, class S > const Real< T >& operator * ( const S& v1, const Real< T >& v2 )
+template< class T, class S >
+const Real< T >&
+operator*( const S& v1, const Real< T >& v2 )
 {
-   return Real< T >( v1 ) *= v2. Data();
+   return Real< T >( v1 ) *= v2.Data();
 };
 
-template< class T, class S > const Real< T >& operator / ( const S& v1, const Real< T >& v2 )
+template< class T, class S >
+const Real< T >&
+operator/( const S& v1, const Real< T >& v2 )
 {
-   return Real< T >( v1 ) /= v2. Data();
+   return Real< T >( v1 ) /= v2.Data();
 };
 
-template< class T > bool operator == ( const T& v1, const Real< T >& v2 )
+template< class T >
+bool
+operator==( const T& v1, const Real< T >& v2 )
 {
-   return v1 == v2. Data();
+   return v1 == v2.Data();
 };
 
-template< class T > bool operator != ( const T& v1, const Real< T >& v2 )
+template< class T >
+bool
+operator!=( const T& v1, const Real< T >& v2 )
 {
-   return v1 != v2. Data();
+   return v1 != v2.Data();
 };
 
-template< class T > bool operator <= ( const T& v1, const Real< T >& v2 )
+template< class T >
+bool
+operator<=( const T& v1, const Real< T >& v2 )
 {
-   return v1 <= v2. Data();
+   return v1 <= v2.Data();
 };
 
-template< class T > bool operator >= ( const T& v1, const Real< T >& v2 )
+template< class T >
+bool
+operator>=( const T& v1, const Real< T >& v2 )
 {
-   return v1 >= v2. Data();
+   return v1 >= v2.Data();
 };
 
-template< class T > bool operator < ( const T& v1, const Real< T >& v2 )
+template< class T >
+bool
+operator<( const T& v1, const Real< T >& v2 )
 {
-   return v1 < v2. Data();
+   return v1 < v2.Data();
 };
 
-template< class T > bool operator > ( const T& v1, const Real< T >& v2 )
+template< class T >
+bool
+operator>( const T& v1, const Real< T >& v2 )
 {
-   return v1 > v2. Data();
+   return v1 > v2.Data();
 };
 
-template< class T > const Real< T > fabs( const Real< T >& v )
+template< class T >
+const Real< T >
+fabs( const Real< T >& v )
 {
-   tnl_flops_counter. recordFunction();
-   return Real< T >( fabs( v. Data() ) );
+   tnl_flops_counter.recordFunction();
+   return Real< T >( fabs( v.Data() ) );
 };
 
-template< class T > const Real< T > sqrt( const Real< T >& v )
+template< class T >
+const Real< T >
+sqrt( const Real< T >& v )
 {
-   tnl_flops_counter. recordFunction();
-   return Real< T >( std::sqrt( v. Data() ) );
+   tnl_flops_counter.recordFunction();
+   return Real< T >( std::sqrt( v.Data() ) );
 };
 
-template< class T > const Real< T > pow( const Real< T >& x, const Real< T >& exp )
+template< class T >
+const Real< T >
+pow( const Real< T >& x, const Real< T >& exp )
 {
-   tnl_flops_counter. recordFunction();
-   return Real< T >( std::pow( x. Data(), exp. Data() ) );
+   tnl_flops_counter.recordFunction();
+   return Real< T >( std::pow( x.Data(), exp.Data() ) );
 };
 
-template< class T > const Real< T > pow( const Real< T >& x, const T& exp )
+template< class T >
+const Real< T >
+pow( const Real< T >& x, const T& exp )
 {
-   tnl_flops_counter. recordFunction();
-   return Real< T >( std::pow( x. Data(), exp ) );
+   tnl_flops_counter.recordFunction();
+   return Real< T >( std::pow( x.Data(), exp ) );
 };
 
-template< class T > const Real< T > cos( const Real< T >& x )
+template< class T >
+const Real< T >
+cos( const Real< T >& x )
 {
-   tnl_flops_counter. recordFunction();
-   return Real< T >( std::cos( x. Data() ) );
+   tnl_flops_counter.recordFunction();
+   return Real< T >( std::cos( x.Data() ) );
 };
 
-template< class T > const Real< T > sin( const Real< T >& x )
+template< class T >
+const Real< T >
+sin( const Real< T >& x )
 {
-   tnl_flops_counter. recordFunction();
-   return Real< T >( std::sin( x. Data() ) );
+   tnl_flops_counter.recordFunction();
+   return Real< T >( std::sin( x.Data() ) );
 };
 
-template< class T > const Real< T > tan( const Real< T >& x )
+template< class T >
+const Real< T >
+tan( const Real< T >& x )
 {
-   tnl_flops_counter. recordFunction();
-   return Real< T >( std::tan( x. Data() ) );
+   tnl_flops_counter.recordFunction();
+   return Real< T >( std::tan( x.Data() ) );
 };
 
-template< class T > const Real< T > acos( const Real< T >& x )
+template< class T >
+const Real< T >
+acos( const Real< T >& x )
 {
-   tnl_flops_counter. recordFunction();
-   return Real< T >( std::acos( x. Data() ) );
+   tnl_flops_counter.recordFunction();
+   return Real< T >( std::acos( x.Data() ) );
 };
 
-template< class T > const Real< T > asin( const Real< T >& x )
+template< class T >
+const Real< T >
+asin( const Real< T >& x )
 {
-   tnl_flops_counter. recordFunction();
-   return Real< T >( std::asin( x. Data() ) );
+   tnl_flops_counter.recordFunction();
+   return Real< T >( std::asin( x.Data() ) );
 };
 
-template< class T > const Real< T > atan( const Real< T >& x )
+template< class T >
+const Real< T >
+atan( const Real< T >& x )
 {
-   tnl_flops_counter. recordFunction();
-   return Real< T >( std::atan( x. Data() ) );
+   tnl_flops_counter.recordFunction();
+   return Real< T >( std::atan( x.Data() ) );
 };
 
-template< class T > const Real< T > atan2( const Real< T >& x, const Real< T >& exp )
+template< class T >
+const Real< T >
+atan2( const Real< T >& x, const Real< T >& exp )
 {
-   tnl_flops_counter. recordFunction();
-   return Real< T >( std::atan2( x. Data(), exp. Data() ) );
+   tnl_flops_counter.recordFunction();
+   return Real< T >( std::atan2( x.Data(), exp.Data() ) );
 };
 
-template< class T > const Real< T > atan2( const Real< T >& x, const T& exp )
+template< class T >
+const Real< T >
+atan2( const Real< T >& x, const T& exp )
 {
-   tnl_flops_counter. recordFunction();
-   return Real< T >( std::atan2( x. Data(), exp ) );
+   tnl_flops_counter.recordFunction();
+   return Real< T >( std::atan2( x.Data(), exp ) );
 };
 
-
-template< class T > const Real< T > cosh( const Real< T >& x )
+template< class T >
+const Real< T >
+cosh( const Real< T >& x )
 {
-   tnl_flops_counter. recordFunction();
-   return Real< T >( std::cosh( x. Data() ) );
+   tnl_flops_counter.recordFunction();
+   return Real< T >( std::cosh( x.Data() ) );
 };
 
-template< class T > const Real< T > sinh( const Real< T >& x )
+template< class T >
+const Real< T >
+sinh( const Real< T >& x )
 {
-   tnl_flops_counter. recordFunction();
-   return Real< T >( std::sinh( x. Data() ) );
+   tnl_flops_counter.recordFunction();
+   return Real< T >( std::sinh( x.Data() ) );
 };
 
-template< class T > const Real< T > tanh( const Real< T >& x )
+template< class T >
+const Real< T >
+tanh( const Real< T >& x )
 {
-   tnl_flops_counter. recordFunction();
-   return Real< T >( std::tanh( x. Data() ) );
+   tnl_flops_counter.recordFunction();
+   return Real< T >( std::tanh( x.Data() ) );
 };
 
-
-template< class T > const Real< T > exp( const Real< T >& x )
+template< class T >
+const Real< T >
+exp( const Real< T >& x )
 {
-   tnl_flops_counter. recordFunction();
-   return Real< T >( std::exp( x. Data() ) );
+   tnl_flops_counter.recordFunction();
+   return Real< T >( std::exp( x.Data() ) );
 };
 
-template< class T > const Real< T > log( const Real< T >& x )
+template< class T >
+const Real< T >
+log( const Real< T >& x )
 {
-   tnl_flops_counter. recordFunction();
-   return Real< T >( std::log( x. Data() ) );
+   tnl_flops_counter.recordFunction();
+   return Real< T >( std::log( x.Data() ) );
 };
 
-template< class T > const Real< T > log10( const Real< T >& x )
+template< class T >
+const Real< T >
+log10( const Real< T >& x )
 {
-   tnl_flops_counter. recordFunction();
-   return Real< T >( std::log10( x. Data() ) );
+   tnl_flops_counter.recordFunction();
+   return Real< T >( std::log10( x.Data() ) );
 };
 
 template< class T >
-std::ostream& operator << ( std::ostream& str, const Real< T >& v )
+std::ostream&
+operator<<( std::ostream& str, const Real< T >& v )
 {
-   str << v. Data();
+   str << v.Data();
    return str;
 };
 
 typedef Real< float > tnlFloat;
 typedef Real< double > tnlDouble;
 
-} // namespace TNL
+}  // namespace TNL
diff --git a/src/TNL/Assert.h b/src/TNL/Assert.h
index f84196016a7aca7802bc7f6ac71cdf02650223d7..48f05053651ea16af7b1b481cc570f43aa63a36d 100644
--- a/src/TNL/Assert.h
+++ b/src/TNL/Assert.h
@@ -36,87 +36,87 @@
 
 #ifdef NDEBUG
 
-// empty macros for optimized build
-/**
- * \brief Asserts that the expression \e val evaluates to \e true.
- *
- * The assertion succeeds if, and only if, \e val evaluates to equal to \e true.
- * On success the test continues without any side effects.
- * On failure the test is terminated with the error message \e msg.
- */
-#define TNL_ASSERT_TRUE( val, msg )
-/**
- * \brief Asserts that the expression \e val evaluates to \e false.
- *
- * The assertion succeeds if, and only if, \e val evaluates to equal to \e false.
- * On success the test continues without any side effects.
- * On failure the test is terminated with the error message \e msg.
- */
-#define TNL_ASSERT_FALSE( val, msg )
-/**
- * \brief Asserts that the expression \e val1 is equal to \e val2.
- *
- * The assertion succeeds if, and only if, \e val1 and \e val2 are equal.
- * On success the test continues without any side effects.
- * On failure the test is terminated with the error message \e msg.
- */
-#define TNL_ASSERT_EQ( val1, val2, msg )
-/**
- * \brief Asserts that the expression \e val1 is not equal to \e val2.
- *
- * The assertion succeeds if, and only if, \e val1 and \e val2 are not equal.
- * On success the test continues without any side effects.
- * On failure the test is terminated with the error message \e msg.
- */
-#define TNL_ASSERT_NE( val1, val2, msg )
-/**
- * \brief Asserts that the expression \e val1 is less than or equal to \e val2.
- *
- * The assertion succeeds if, and only if, \e val1 is less than or equal to \e val2.
- * On success the test continues without any side effects.
- * On failure the test is terminated with the error message \e msg.
- */
-#define TNL_ASSERT_LE( val1, val2, msg )
-/**
- * \brief Asserts that the expression \e val1 is less than \e val2.
- *
- * The assertion succeeds if, and only if, \e val1 is less than \e val2.
- * On success the test continues without any side effects.
- * On failure the test is terminated with the error message \e msg.
- */
-#define TNL_ASSERT_LT( val1, val2, msg )
-/**
- * \brief Asserts that the expression \e val1 is greater than or equal to \e val2.
- *
- * The assertion succeeds if, and only if, \e val1 is greater than or equal to \e val2.
- * On success the test continues without any side effects.
- * On failure the test is terminated with the error message \e msg.
- */
-#define TNL_ASSERT_GE( val1, val2, msg )
-/**
- * \brief Asserts that the expression \e val1 is greater than \e val2.
- *
- * The assertion succeeds if, and only if, \e val1 is greater than \e val2.
- * On success the test continues without any side effects.
- * On failure the test is terminated with the error message \e msg.
- */
-#define TNL_ASSERT_GT( val1, val2, msg )
-/**
- * \brief Asserts that the specified \e ___tnl__assert_condition is valid.
- *
- * The assertion succeeds if, and only if, ___tnl__assert_condition is valid.
- * On success the test continues without any side effects.
- * On failure the test is terminated with the error message \e ___tnl__assert_command.
- */
-#define TNL_ASSERT( ___tnl__assert_condition, ___tnl__assert_command )
+   // empty macros for optimized build
+   /**
+    * \brief Asserts that the expression \e val evaluates to \e true.
+    *
+    * The assertion succeeds if, and only if, \e val evaluates to equal to \e true.
+    * On success the test continues without any side effects.
+    * On failure the test is terminated with the error message \e msg.
+    */
+   #define TNL_ASSERT_TRUE( val, msg )
+   /**
+    * \brief Asserts that the expression \e val evaluates to \e false.
+    *
+    * The assertion succeeds if, and only if, \e val evaluates to equal to \e false.
+    * On success the test continues without any side effects.
+    * On failure the test is terminated with the error message \e msg.
+    */
+   #define TNL_ASSERT_FALSE( val, msg )
+   /**
+    * \brief Asserts that the expression \e val1 is equal to \e val2.
+    *
+    * The assertion succeeds if, and only if, \e val1 and \e val2 are equal.
+    * On success the test continues without any side effects.
+    * On failure the test is terminated with the error message \e msg.
+    */
+   #define TNL_ASSERT_EQ( val1, val2, msg )
+   /**
+    * \brief Asserts that the expression \e val1 is not equal to \e val2.
+    *
+    * The assertion succeeds if, and only if, \e val1 and \e val2 are not equal.
+    * On success the test continues without any side effects.
+    * On failure the test is terminated with the error message \e msg.
+    */
+   #define TNL_ASSERT_NE( val1, val2, msg )
+   /**
+    * \brief Asserts that the expression \e val1 is less than or equal to \e val2.
+    *
+    * The assertion succeeds if, and only if, \e val1 is less than or equal to \e val2.
+    * On success the test continues without any side effects.
+    * On failure the test is terminated with the error message \e msg.
+    */
+   #define TNL_ASSERT_LE( val1, val2, msg )
+   /**
+    * \brief Asserts that the expression \e val1 is less than \e val2.
+    *
+    * The assertion succeeds if, and only if, \e val1 is less than \e val2.
+    * On success the test continues without any side effects.
+    * On failure the test is terminated with the error message \e msg.
+    */
+   #define TNL_ASSERT_LT( val1, val2, msg )
+   /**
+    * \brief Asserts that the expression \e val1 is greater than or equal to \e val2.
+    *
+    * The assertion succeeds if, and only if, \e val1 is greater than or equal to \e val2.
+    * On success the test continues without any side effects.
+    * On failure the test is terminated with the error message \e msg.
+    */
+   #define TNL_ASSERT_GE( val1, val2, msg )
+   /**
+    * \brief Asserts that the expression \e val1 is greater than \e val2.
+    *
+    * The assertion succeeds if, and only if, \e val1 is greater than \e val2.
+    * On success the test continues without any side effects.
+    * On failure the test is terminated with the error message \e msg.
+    */
+   #define TNL_ASSERT_GT( val1, val2, msg )
+   /**
+    * \brief Asserts that the specified \e ___tnl__assert_condition is valid.
+    *
+    * The assertion succeeds if, and only if, ___tnl__assert_condition is valid.
+    * On success the test continues without any side effects.
+    * On failure the test is terminated with the error message \e ___tnl__assert_command.
+    */
+   #define TNL_ASSERT( ___tnl__assert_condition, ___tnl__assert_command )
 
 #else /* #ifdef NDEBUG */
 
-#include <sstream>
-#include <iostream>
-#include <stdio.h>
+   #include <sstream>
+   #include <iostream>
+   #include <cstdio>
 
-#include <TNL/Cuda/CudaCallable.h>
+   #include <TNL/Cuda/CudaCallable.h>
 
 namespace TNL {
 /**
@@ -124,23 +124,22 @@ namespace TNL {
  */
 namespace Assert {
 
-#ifdef TNL_THROW_ASSERTION_ERROR
+   #ifdef TNL_THROW_ASSERTION_ERROR
 // This will be used by the code for Python bindings to translate assertion
 // failures to the Python's AssertionError exception.
 class AssertionError
 {
 public:
-    AssertionError( const std::string& msg )
-       : msg( msg )
-    {}
+   AssertionError( const std::string& msg ) : msg( msg ) {}
 
-    const char* what() const
-    {
-       return msg.c_str();
-    }
+   const char*
+   what() const
+   {
+      return msg.c_str();
+   }
 
 private:
-    std::string msg;
+   std::string msg;
 };
 
 inline void
@@ -157,12 +156,13 @@ printDiagnosticsHost( const char* assertion,
        << "File: " << file << "\n"
        << "Function: " << function << "\n"
        << "Line: " << line << "\n"
-       << "Diagnostics:\n" << diagnostics << std::endl;
+       << "Diagnostics:\n"
+       << diagnostics << std::endl;
 
    throw AssertionError( str.str() );
 }
 
-#else // TNL_THROW_ASSERTION_ERROR
+   #else   // TNL_THROW_ASSERTION_ERROR
 
 // This will be used in regular C++ code
 inline void
@@ -178,9 +178,10 @@ printDiagnosticsHost( const char* assertion,
              << "File: " << file << "\n"
              << "Function: " << function << "\n"
              << "Line: " << line << "\n"
-             << "Diagnostics:\n" << diagnostics << std::endl;
+             << "Diagnostics:\n"
+             << diagnostics << std::endl;
 }
-#endif // TNL_THROW_ASSERTION_ERROR
+   #endif  // TNL_THROW_ASSERTION_ERROR
 
 __cuda_callable__
 inline void
@@ -191,26 +192,31 @@ printDiagnosticsCuda( const char* assertion,
                       int line,
                       const char* diagnostics )
 {
-   printf( "Assertion '%s' failed !!!\n"
-           "Message: %s\n"
-           "File: %s\n"
-           "Function: %s\n"
-           "Line: %d\n"
-           "Diagnostics: %s\n",
-           assertion, message, file, function, line, diagnostics );
+   std::printf( "Assertion '%s' failed !!!\n"
+                "Message: %s\n"
+                "File: %s\n"
+                "Function: %s\n"
+                "Line: %d\n"
+                "Diagnostics: %s\n",
+                assertion,
+                message,
+                file,
+                function,
+                line,
+                diagnostics );
 }
 
 __cuda_callable__
 inline void
 fatalFailure()
 {
-#ifdef __CUDA_ARCH__
+   #ifdef __CUDA_ARCH__
    // https://devtalk.nvidia.com/default/topic/509584/how-to-cancel-a-running-cuda-kernel-/
    // TODO: it is reported as "illegal instruction", but that leads to an abort as well...
-   asm("trap;");
-#else
+   asm( "trap;" );
+   #else
    throw EXIT_FAILURE;
-#endif
+   #endif
 }
 
 template< typename T >
@@ -231,8 +237,10 @@ struct Formatter< bool >
    static std::string
    printToString( const bool& value )
    {
-      if( value ) return "true";
-      else return "false";
+      if( value )
+         return "true";
+      else
+         return "false";
    }
 };
 
@@ -243,13 +251,14 @@ struct Formatter< std::pair< T, U > >
    printToString( const std::pair< T, U >& pair )
    {
       ::std::stringstream ss;
-      ss << '(' << pair.first << ',' <<  pair.second << ')';
+      ss << '(' << pair.first << ',' << pair.second << ')';
       return ss.str();
    }
 };
 
 template< typename T1, typename T2 >
-__cuda_callable__ void
+__cuda_callable__
+void
 cmpHelperOpFailure( const char* assertion,
                     const char* message,
                     const char* file,
@@ -261,16 +270,15 @@ cmpHelperOpFailure( const char* assertion,
                     const T2& rhs_value,
                     const char* op )
 {
-#ifdef __CUDA_ARCH__
+   #ifdef __CUDA_ARCH__
    // diagnostics is not supported - we don't have the machinery
    // to construct the dynamic error message
-   printDiagnosticsCuda( assertion, message, file, function, line,
-                         "Not supported in CUDA kernels." );
-#else
+   printDiagnosticsCuda( assertion, message, file, function, line, "Not supported in CUDA kernels." );
+   #else
    const std::string formatted_lhs_value = Formatter< T1 >::printToString( lhs_value );
    const std::string formatted_rhs_value = Formatter< T2 >::printToString( rhs_value );
    std::stringstream str;
-   if( std::string(op) == "==" ) {
+   if( std::string( op ) == "==" ) {
       str << "      Expected: " << lhs_expression;
       if( formatted_lhs_value != lhs_expression ) {
          str << "\n      Which is: " << formatted_lhs_value;
@@ -285,15 +293,15 @@ cmpHelperOpFailure( const char* assertion,
       str << "Expected: (" << lhs_expression << ") " << op << " (" << rhs_expression << "), "
           << "actual: " << formatted_lhs_value << " vs " << formatted_rhs_value << std::endl;
    }
-   printDiagnosticsHost( assertion, message, file, function, line,
-                         str.str().c_str() );
-#endif
+   printDiagnosticsHost( assertion, message, file, function, line, str.str().c_str() );
+   #endif
    fatalFailure();
 }
 
 TNL_NVCC_HD_WARNING_DISABLE
 template< typename T1, typename T2 >
-__cuda_callable__ void
+__cuda_callable__
+void
 cmpHelperTrue( const char* assertion,
                const char* message,
                const char* file,
@@ -306,13 +314,13 @@ cmpHelperTrue( const char* assertion,
 {
    // explicit cast is necessary, because T1::operator! might not be defined
    if( ! (bool) val1 )
-      ::TNL::Assert::cmpHelperOpFailure( assertion, message, file, function, line,
-                                         expr1, "true", val1, true, "==" );
+      ::TNL::Assert::cmpHelperOpFailure( assertion, message, file, function, line, expr1, "true", val1, true, "==" );
 }
 
 TNL_NVCC_HD_WARNING_DISABLE
 template< typename T1, typename T2 >
-__cuda_callable__ void
+__cuda_callable__
+void
 cmpHelperFalse( const char* assertion,
                 const char* message,
                 const char* file,
@@ -324,29 +332,27 @@ cmpHelperFalse( const char* assertion,
                 const T2& val2 )
 {
    if( val1 )
-      ::TNL::Assert::cmpHelperOpFailure( assertion, message, file, function, line,
-                                         expr1, "false", val1, false, "==" );
+      ::TNL::Assert::cmpHelperOpFailure( assertion, message, file, function, line, expr1, "false", val1, false, "==" );
 }
 
-// A macro for implementing the helper functions needed to implement
-// TNL_ASSERT_??. It is here just to avoid copy-and-paste of similar code.
-#define TNL_IMPL_CMP_HELPER_( op_name, op ) \
-template< typename T1, typename T2 > \
-__cuda_callable__ void \
-cmpHelper##op_name( const char* assertion, \
-                    const char* message, \
-                    const char* file, \
-                    const char* function, \
-                    int line, \
-                    const char* expr1, \
-                    const char* expr2, \
-                    const T1& val1, \
-                    const T2& val2 ) \
-{\
-   if( ! ( (val1) op (val2) ) ) \
-      ::TNL::Assert::cmpHelperOpFailure( assertion, message, file, function, line, \
-                                         expr1, expr2, val1, val2, #op );\
-}
+   // A macro for implementing the helper functions needed to implement
+   // TNL_ASSERT_??. It is here just to avoid copy-and-paste of similar code.
+   #define TNL_IMPL_CMP_HELPER_( op_name, op )                                                                            \
+      template< typename T1, typename T2 >                                                                                \
+      __cuda_callable__                                                                                                   \
+      void cmpHelper##op_name( const char* assertion,                                                                     \
+                               const char* message,                                                                       \
+                               const char* file,                                                                          \
+                               const char* function,                                                                      \
+                               int line,                                                                                  \
+                               const char* expr1,                                                                         \
+                               const char* expr2,                                                                         \
+                               const T1& val1,                                                                            \
+                               const T2& val2 )                                                                           \
+      {                                                                                                                   \
+         if( ! ( (val1) op( val2 ) ) )                                                                                    \
+            ::TNL::Assert::cmpHelperOpFailure( assertion, message, file, function, line, expr1, expr2, val1, val2, #op ); \
+      }
 
 // Implements the helper function for TNL_ASSERT_EQ
 TNL_NVCC_HD_WARNING_DISABLE
@@ -367,111 +373,98 @@ TNL_IMPL_CMP_HELPER_( GE, >= );
 TNL_NVCC_HD_WARNING_DISABLE
 TNL_IMPL_CMP_HELPER_( GT, > );
 
-#undef TNL_IMPL_CMP_HELPER_
-
-} // namespace Assert
-} // namespace TNL
-
-// Internal macro wrapping the __PRETTY_FUNCTION__ "magic".
-#if defined( __NVCC__ ) && ( __CUDACC_VER_MAJOR__ < 8 )
-    #define __TNL_PRETTY_FUNCTION "(not known in CUDA 7.5 or older)"
-#else
-    #define __TNL_PRETTY_FUNCTION __PRETTY_FUNCTION__
-#endif
-
-// On Linux, __STRING is defined in glibc's sys/cdefs.h, but there is no such
-// header on Windows and possibly other platforms.
-#ifndef __STRING
-   #define __STRING(arg) #arg
-#endif
-
-// Internal macro to compose the string representing the assertion.
-// We can't do it easily at runtime, because we have to support assertions
-// in CUDA kernels, which can't use std::string objects. Instead, we do it
-// at compile time - adjacent strings are joined at the language level.
-#define __TNL_JOIN_STRINGS( val1, op, val2 ) \
-   __STRING( val1 ) " " __STRING( op ) " " __STRING( val2 )
-
-// Internal macro to pass all the arguments to the specified cmpHelperOP
-#define __TNL_ASSERT_PRED2( pred, op, val1, val2, msg ) \
-   pred( __TNL_JOIN_STRINGS( val1, op, val2 ), \
-         msg, __FILE__, __TNL_PRETTY_FUNCTION, __LINE__, \
-         #val1, #val2, val1, val2 )
-
-// Main definitions of the TNL_ASSERT_* macros
-// unary
-#define TNL_ASSERT_TRUE( val, msg ) \
-   __TNL_ASSERT_PRED2( ::TNL::Assert::cmpHelperTrue, ==, val, true, msg )
-#define TNL_ASSERT_FALSE( val, msg ) \
-   __TNL_ASSERT_PRED2( ::TNL::Assert::cmpHelperFalse, ==, val, false, msg )
-// binary
-#define TNL_ASSERT_EQ( val1, val2, msg ) \
-   __TNL_ASSERT_PRED2( ::TNL::Assert::cmpHelperEQ, ==, val1, val2, msg )
-#define TNL_ASSERT_NE( val1, val2, msg ) \
-   __TNL_ASSERT_PRED2( ::TNL::Assert::cmpHelperNE, !=, val1, val2, msg )
-#define TNL_ASSERT_LE( val1, val2, msg ) \
-   __TNL_ASSERT_PRED2( ::TNL::Assert::cmpHelperLE, <=, val1, val2, msg )
-#define TNL_ASSERT_LT( val1, val2, msg ) \
-   __TNL_ASSERT_PRED2( ::TNL::Assert::cmpHelperLT, <,  val1, val2, msg )
-#define TNL_ASSERT_GE( val1, val2, msg ) \
-   __TNL_ASSERT_PRED2( ::TNL::Assert::cmpHelperGE, >=, val1, val2, msg )
-#define TNL_ASSERT_GT( val1, val2, msg ) \
-   __TNL_ASSERT_PRED2( ::TNL::Assert::cmpHelperGT, >,  val1, val2, msg )
-
-
-
-
-/****
- * Original assert macro with custom command for diagnostics.
- */
-
-// __CUDA_ARCH__ is defined by the compiler only for code executed on GPU
-#ifdef __CUDA_ARCH__
-#define TNL_ASSERT( ___tnl__assert_condition, ___tnl__assert_command )                                         \
-   if( ! ( ___tnl__assert_condition ) )                                                                        \
-   {                                                                                                           \
-      printf( "Assertion '%s' failed !!! \n File: %s \n Line: %d \n Diagnostics: Not supported with CUDA.\n",  \
-              __STRING( ___tnl__assert_condition ),                                                            \
-              __FILE__,                                                                                        \
-              __LINE__ );                                                                                      \
-      asm("trap;");                                                                                            \
-   }
-
-#else // #ifdef __CUDA_ARCH__
-#ifdef TNL_THROW_ASSERTION_ERROR
-// This will be used by the code for Python bindings to translate assertion
-// failures to the Python's AssertionError exception.
-#define TNL_ASSERT( ___tnl__assert_condition, ___tnl__assert_command )                                   \
-   if( ! ( ___tnl__assert_condition ) )                                                                  \
-   {                                                                                                     \
-      std::stringstream buffer;                                                                          \
-      auto old = std::cerr.rdbuf( buffer.rdbuf() );                                                      \
-                                                                                                         \
-      std::cerr << "Assertion '" << __STRING( ___tnl__assert_condition ) << "' failed !!!" << std::endl  \
-                << "File: " << __FILE__ << std::endl                                                     \
-                << "Function: " << __PRETTY_FUNCTION__ << std::endl                                      \
-                << "Line: " << __LINE__ << std::endl                                                     \
-                << "Diagnostics: ";                                                                      \
-      ___tnl__assert_command;                                                                            \
-                                                                                                         \
-      std::string msg = buffer.str();                                                                    \
-      std::cerr.rdbuf( old );                                                                            \
-      throw ::TNL::Assert::AssertionError( msg );                                                        \
-   }
-#else // #ifdef TNL_THROW_ASSERTION_ERROR
-// This will be used in regular C++ code
-#define TNL_ASSERT( ___tnl__assert_condition, ___tnl__assert_command )                                   \
-   if( ! ( ___tnl__assert_condition ) )                                                                  \
-   {                                                                                                     \
-      std::cerr << "Assertion '" << __STRING( ___tnl__assert_condition ) << "' failed !!!" << std::endl  \
-                << "File: " << __FILE__ << std::endl                                                     \
-                << "Function: " << __TNL_PRETTY_FUNCTION << std::endl                                    \
-                << "Line: " << __LINE__ << std::endl                                                     \
-                << "Diagnostics: ";                                                                      \
-      ___tnl__assert_command;                                                                            \
-      throw EXIT_FAILURE;                                                                                \
-   }
-#endif // #ifdef TNL_THROW_ASSERTION_ERROR
-#endif // #ifdef __CUDA_ARCH__
-
-#endif // #ifdef NDEBUG
+   #undef TNL_IMPL_CMP_HELPER_
+
+}  // namespace Assert
+}  // namespace TNL
+
+   // Internal macro wrapping the __PRETTY_FUNCTION__ "magic".
+   #if defined( __NVCC__ ) && ( __CUDACC_VER_MAJOR__ < 8 )
+      #define __TNL_PRETTY_FUNCTION "(not known in CUDA 7.5 or older)"
+   #else
+      #define __TNL_PRETTY_FUNCTION __PRETTY_FUNCTION__
+   #endif
+
+   // On Linux, __STRING is defined in glibc's sys/cdefs.h, but there is no such
+   // header on Windows and possibly other platforms.
+   #ifndef __STRING
+      #define __STRING( arg ) #arg
+   #endif
+
+   // Internal macro to compose the string representing the assertion.
+   // We can't do it easily at runtime, because we have to support assertions
+   // in CUDA kernels, which can't use std::string objects. Instead, we do it
+   // at compile time - adjacent strings are joined at the language level.
+   #define __TNL_JOIN_STRINGS( val1, op, val2 ) __STRING( val1 ) " " __STRING( op ) " " __STRING( val2 )
+
+   // Internal macro to pass all the arguments to the specified cmpHelperOP
+   #define __TNL_ASSERT_PRED2( pred, op, val1, val2, msg ) \
+      pred( __TNL_JOIN_STRINGS( val1, op, val2 ), msg, __FILE__, __TNL_PRETTY_FUNCTION, __LINE__, #val1, #val2, val1, val2 )
+
+   // Main definitions of the TNL_ASSERT_* macros
+   // unary
+   #define TNL_ASSERT_TRUE( val, msg ) __TNL_ASSERT_PRED2( ::TNL::Assert::cmpHelperTrue, ==, val, true, msg )
+   #define TNL_ASSERT_FALSE( val, msg ) __TNL_ASSERT_PRED2( ::TNL::Assert::cmpHelperFalse, ==, val, false, msg )
+   // binary
+   #define TNL_ASSERT_EQ( val1, val2, msg ) __TNL_ASSERT_PRED2( ::TNL::Assert::cmpHelperEQ, ==, val1, val2, msg )
+   #define TNL_ASSERT_NE( val1, val2, msg ) __TNL_ASSERT_PRED2( ::TNL::Assert::cmpHelperNE, !=, val1, val2, msg )
+   #define TNL_ASSERT_LE( val1, val2, msg ) __TNL_ASSERT_PRED2( ::TNL::Assert::cmpHelperLE, <=, val1, val2, msg )
+   #define TNL_ASSERT_LT( val1, val2, msg ) __TNL_ASSERT_PRED2( ::TNL::Assert::cmpHelperLT, <, val1, val2, msg )
+   #define TNL_ASSERT_GE( val1, val2, msg ) __TNL_ASSERT_PRED2( ::TNL::Assert::cmpHelperGE, >=, val1, val2, msg )
+   #define TNL_ASSERT_GT( val1, val2, msg ) __TNL_ASSERT_PRED2( ::TNL::Assert::cmpHelperGT, >, val1, val2, msg )
+
+   /****
+    * Original assert macro with custom command for diagnostics.
+    */
+
+   // __CUDA_ARCH__ is defined by the compiler only for code executed on GPU
+   #ifdef __CUDA_ARCH__
+      #define TNL_ASSERT( ___tnl__assert_condition, ___tnl__assert_command )                                             \
+         if( ! ( ___tnl__assert_condition ) ) {                                                                          \
+            std::printf( "Assertion '%s' failed !!! \n File: %s \n Line: %d \n Diagnostics: Not supported with CUDA.\n", \
+                         __STRING( ___tnl__assert_condition ),                                                           \
+                         __FILE__,                                                                                       \
+                         __LINE__ );                                                                                     \
+            asm( "trap;" );                                                                                              \
+         }
+
+   #else  // #ifdef __CUDA_ARCH__
+      #ifdef TNL_THROW_ASSERTION_ERROR
+
+         // This will be used by the code for Python bindings to translate assertion
+         // failures to the Python's AssertionError exception.
+         #define TNL_ASSERT( ___tnl__assert_condition, ___tnl__assert_command )                                  \
+            if( ! ( ___tnl__assert_condition ) ) {                                                               \
+               std::stringstream buffer;                                                                         \
+               auto old = std::cerr.rdbuf( buffer.rdbuf() );                                                     \
+                                                                                                                 \
+               std::cerr << "Assertion '" << __STRING( ___tnl__assert_condition ) << "' failed !!!" << std::endl \
+                         << "File: " << __FILE__ << std::endl                                                    \
+                         << "Function: " << __PRETTY_FUNCTION__ << std::endl                                     \
+                         << "Line: " << __LINE__ << std::endl                                                    \
+                         << "Diagnostics: ";                                                                     \
+               ___tnl__assert_command;                                                                           \
+                                                                                                                 \
+               std::string msg = buffer.str();                                                                   \
+               std::cerr.rdbuf( old );                                                                           \
+               throw ::TNL::Assert::AssertionError( msg );                                                       \
+            }
+
+      #else  // #ifdef TNL_THROW_ASSERTION_ERROR
+
+         // This will be used in regular C++ code
+         #define TNL_ASSERT( ___tnl__assert_condition, ___tnl__assert_command )                                  \
+            if( ! ( ___tnl__assert_condition ) ) {                                                               \
+               std::cerr << "Assertion '" << __STRING( ___tnl__assert_condition ) << "' failed !!!" << std::endl \
+                         << "File: " << __FILE__ << std::endl                                                    \
+                         << "Function: " << __TNL_PRETTY_FUNCTION << std::endl                                   \
+                         << "Line: " << __LINE__ << std::endl                                                    \
+                         << "Diagnostics: ";                                                                     \
+               ___tnl__assert_command;                                                                           \
+               throw EXIT_FAILURE;                                                                               \
+            }
+
+      #endif  // #ifdef TNL_THROW_ASSERTION_ERROR
+   #endif     // #ifdef __CUDA_ARCH__
+
+#endif  // #ifdef NDEBUG
diff --git a/src/TNL/Atomic.h b/src/TNL/Atomic.h
index ff114d05a59cb1c82ffaf35a84033d96dae23a54..94ac5dfc8cf4993f35a03f81a5d3e1ccbcd3c344 100644
--- a/src/TNL/Atomic.h
+++ b/src/TNL/Atomic.h
@@ -17,27 +17,26 @@
 // double-precision atomicAdd function for Maxwell and older GPUs
 // copied from: https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#atomic-functions
 #ifdef HAVE_CUDA
-#if __CUDA_ARCH__ < 600
+   #if __CUDA_ARCH__ < 600
 namespace {
-   __device__ double atomicAdd(double* address, double val)
-   {
-       unsigned long long int* address_as_ull =
-                                 (unsigned long long int*)address;
-       unsigned long long int old = *address_as_ull, assumed;
+__device__
+double
+atomicAdd( double* address, double val )
+{
+   unsigned long long int* address_as_ull = (unsigned long long int*) address;
+   unsigned long long int old = *address_as_ull, assumed;
 
-       do {
-           assumed = old;
-           old = atomicCAS(address_as_ull, assumed,
-                           __double_as_longlong(val +
-                                  __longlong_as_double(assumed)));
+   do {
+      assumed = old;
+      old = atomicCAS( address_as_ull, assumed, __double_as_longlong( val + __longlong_as_double( assumed ) ) );
 
-       // Note: uses integer comparison to avoid hang in case of NaN (since NaN != NaN)
-       } while (assumed != old);
+      // Note: uses integer comparison to avoid hang in case of NaN (since NaN != NaN)
+   } while( assumed != old );
 
-       return __longlong_as_double(old);
-   }
-} // namespace
-#endif
+   return __longlong_as_double( old );
+}
+}  // namespace
+   #endif
 #endif
 
 namespace TNL {
@@ -46,8 +45,7 @@ template< typename T, typename Device >
 class Atomic;
 
 template< typename T >
-class Atomic< T, Devices::Host >
-: public std::atomic< T >
+class Atomic< T, Devices::Host > : public std::atomic< T >
 {
 public:
    Atomic() noexcept = default;
@@ -59,35 +57,35 @@ public:
    // an explanation), but we need copyability for TNL::Containers::Array. Note that
    // this copy-constructor and copy-assignment operator are not atomic as they
    // synchronize only with respect to one or the other object.
-   Atomic( const Atomic& desired ) noexcept
-   : std::atomic< T >()
+   Atomic( const Atomic& desired ) noexcept : std::atomic< T >()
    {
-      this->store(desired.load());
+      this->store( desired.load() );
    }
-   Atomic& operator=( const Atomic& desired ) noexcept
+   Atomic&
+   operator=( const Atomic& desired ) noexcept
    {
-      this->store(desired.load());
+      this->store( desired.load() );
       return *this;
    }
 
    // CAS loops for updating maximum and minimum
    // reference: https://stackoverflow.com/a/16190791
-   T fetch_max( T value ) noexcept
+   T
+   fetch_max( T value ) noexcept
    {
       const T old = *this;
       T prev_value = old;
-      while(prev_value < value &&
-            ! this->compare_exchange_weak(prev_value, value))
+      while( prev_value < value && ! this->compare_exchange_weak( prev_value, value ) )
          ;
       return old;
    }
 
-   T fetch_min( T value ) noexcept
+   T
+   fetch_min( T value ) noexcept
    {
       const T old = *this;
       T prev_value = old;
-      while(prev_value > value &&
-            ! this->compare_exchange_weak(prev_value, value))
+      while( prev_value > value && ! this->compare_exchange_weak( prev_value, value ) )
          ;
       return old;
    }
@@ -97,8 +95,8 @@ template< typename T >
 class Atomic< T, Devices::Sequential > : public Atomic< T, Devices::Host >
 {
    using Base = Atomic< T, Devices::Host >;
-   public:
 
+public:
    using Base::Atomic;
    using Base::operator=;
    using Base::fetch_max;
@@ -111,16 +109,17 @@ class Atomic< T, Devices::Cuda >
 public:
    using value_type = T;
    // FIXME
-//   using difference_type = typename std::atomic< T >::difference_type;
+   //   using difference_type = typename std::atomic< T >::difference_type;
 
    __cuda_callable__
    Atomic() noexcept = default;
 
    __cuda_callable__
-   constexpr Atomic( T desired ) noexcept : value(desired) {}
+   constexpr Atomic( T desired ) noexcept : value( desired ) {}
 
    __cuda_callable__
-   T operator=( T desired ) noexcept
+   T
+   operator=( T desired ) noexcept
    {
       store( desired );
       return desired;
@@ -134,44 +133,49 @@ public:
    Atomic( const Atomic& desired ) noexcept
    {
       // FIXME
-//      *this = desired.load();
+      //      *this = desired.load();
       *this = desired.value;
    }
    __cuda_callable__
-   Atomic& operator=( const Atomic& desired ) noexcept
+   Atomic&
+   operator=( const Atomic& desired ) noexcept
    {
       // FIXME
-//      *this = desired.load();
+      //      *this = desired.load();
       *this = desired.value;
       return *this;
    }
 
-   bool is_lock_free() const noexcept
+   bool
+   is_lock_free() const noexcept
    {
       return true;
    }
 
-   constexpr bool is_always_lock_free() const noexcept
+   constexpr bool
+   is_always_lock_free() const noexcept
    {
       return true;
    }
 
    __cuda_callable__
-   void store( T desired ) noexcept
+   void
+   store( T desired ) noexcept
    {
       // CUDA does not have a native atomic store, but it can be emulated with atomic exchange
       exchange( desired );
    }
 
    __cuda_callable__
-   T load() const noexcept
+   T
+   load() const noexcept
    {
       // CUDA does not have a native atomic load:
       // https://stackoverflow.com/questions/32341081/how-to-have-atomic-load-in-cuda
 
       // const-cast on pointer fails in CUDA 10.1.105
-//      return const_cast<Atomic*>(this)->fetch_add( 0 );
-      return const_cast<Atomic&>(*this).fetch_add( 0 );
+      //      return const_cast<Atomic*>(this)->fetch_add( 0 );
+      return const_cast< Atomic& >( *this ).fetch_add( 0 );
    }
 
    __cuda_callable__
@@ -181,7 +185,8 @@ public:
    }
 
    __cuda_callable__
-   T exchange( T desired ) noexcept
+   T
+   exchange( T desired ) noexcept
    {
 #ifdef __CUDA_ARCH__
       return atomicExch( &value, desired );
@@ -193,13 +198,15 @@ public:
    }
 
    __cuda_callable__
-   bool compare_exchange_weak( T& expected, T desired ) noexcept
+   bool
+   compare_exchange_weak( T& expected, T desired ) noexcept
    {
       return compare_exchange_strong( expected, desired );
    }
 
    __cuda_callable__
-   bool compare_exchange_strong( T& expected, T desired ) noexcept
+   bool
+   compare_exchange_strong( T& expected, T desired ) noexcept
    {
 #ifdef __CUDA_ARCH__
       const T old = atomicCAS( &value, expected, desired );
@@ -219,7 +226,8 @@ public:
    }
 
    __cuda_callable__
-   T fetch_add( T arg )
+   T
+   fetch_add( T arg )
    {
 #ifdef __CUDA_ARCH__
       return atomicAdd( &value, arg );
@@ -231,7 +239,8 @@ public:
    }
 
    __cuda_callable__
-   T fetch_sub( T arg )
+   T
+   fetch_sub( T arg )
    {
 #ifdef __CUDA_ARCH__
       return atomicSub( &value, arg );
@@ -243,7 +252,8 @@ public:
    }
 
    __cuda_callable__
-   T fetch_and( T arg )
+   T
+   fetch_and( T arg )
    {
 #ifdef __CUDA_ARCH__
       return atomicAnd( &value, arg );
@@ -255,7 +265,8 @@ public:
    }
 
    __cuda_callable__
-   T fetch_or( T arg )
+   T
+   fetch_or( T arg )
    {
 #ifdef __CUDA_ARCH__
       return atomicOr( &value, arg );
@@ -267,7 +278,8 @@ public:
    }
 
    __cuda_callable__
-   T fetch_xor( T arg )
+   T
+   fetch_xor( T arg )
    {
 #ifdef __CUDA_ARCH__
       return atomicXor( &value, arg );
@@ -279,67 +291,77 @@ public:
    }
 
    __cuda_callable__
-   T operator+=( T arg ) noexcept
+   T
+   operator+=( T arg ) noexcept
    {
       return fetch_add( arg ) + arg;
    }
 
    __cuda_callable__
-   T operator-=( T arg ) noexcept
+   T
+   operator-=( T arg ) noexcept
    {
       return fetch_sub( arg ) - arg;
    }
 
    __cuda_callable__
-   T operator&=( T arg ) noexcept
+   T
+   operator&=( T arg ) noexcept
    {
       return fetch_and( arg ) & arg;
    }
 
    __cuda_callable__
-   T operator|=( T arg ) noexcept
+   T
+   operator|=( T arg ) noexcept
    {
       return fetch_or( arg ) | arg;
    }
 
    __cuda_callable__
-   T operator^=( T arg ) noexcept
+   T
+   operator^=( T arg ) noexcept
    {
       return fetch_xor( arg ) ^ arg;
    }
 
    // pre-increment
    __cuda_callable__
-   T operator++() noexcept
+   T
+   operator++() noexcept
    {
-      return fetch_add(1) + 1;
+      return fetch_add( 1 ) + 1;
    }
 
    // post-increment
    __cuda_callable__
-   T operator++(int) noexcept
+   T
+   operator++( int ) noexcept
    {
-      return fetch_add(1);
+      return fetch_add( 1 );
    }
 
    // pre-decrement
    __cuda_callable__
-   T operator--() noexcept
+   T
+   operator--() noexcept
    {
-      return fetch_sub(1) - 1;
+      return fetch_sub( 1 ) - 1;
    }
 
    // post-decrement
    __cuda_callable__
-   T operator--(int) noexcept
+   T
+   operator--( int ) noexcept
    {
-      return fetch_sub(1);
+      return fetch_sub( 1 );
    }
 
    // extensions (methods not present in C++ standards)
 
    __cuda_callable__
-   T fetch_max( T arg ) noexcept
+   T
+   fetch_max( T arg ) noexcept
    {
 #ifdef __CUDA_ARCH__
       return atomicMax( &value, arg );
@@ -351,7 +373,8 @@ public:
    }
 
    __cuda_callable__
-   T fetch_min( T arg ) noexcept
+   T
+   fetch_min( T arg ) noexcept
    {
 #ifdef __CUDA_ARCH__
       return atomicMin( &value, arg );
@@ -366,4 +389,4 @@ protected:
    T value;
 };
 
-} // namespace TNL
+}  // namespace TNL
diff --git a/src/TNL/Benchmarks/Benchmarks.h b/src/TNL/Benchmarks/Benchmarks.h
index 8c1c9d7b9cbab458c792efbcbaa478a93237089e..60be02796b84dd93d76efe234680589e6df01163 100644
--- a/src/TNL/Benchmarks/Benchmarks.h
+++ b/src/TNL/Benchmarks/Benchmarks.h
@@ -27,22 +27,25 @@ struct BenchmarkResult
    using RowElements = typename Logging::RowElements;
 
    int loops = 0;
-   double time = std::numeric_limits<double>::quiet_NaN();
-   double stddev = std::numeric_limits<double>::quiet_NaN();
-   double bandwidth = std::numeric_limits<double>::quiet_NaN();
-   double speedup = std::numeric_limits<double>::quiet_NaN();
+   double time = std::numeric_limits< double >::quiet_NaN();
+   double stddev = std::numeric_limits< double >::quiet_NaN();
+   double bandwidth = std::numeric_limits< double >::quiet_NaN();
+   double speedup = std::numeric_limits< double >::quiet_NaN();
 
-   virtual HeaderElements getTableHeader() const
+   virtual HeaderElements
+   getTableHeader() const
    {
-      return HeaderElements({ "time", "stddev", "stddev/time", "loops", "bandwidth", "speedup" });
+      return HeaderElements( { "time", "stddev", "stddev/time", "loops", "bandwidth", "speedup" } );
    }
 
-   virtual std::vector< int > getColumnWidthHints() const
+   virtual std::vector< int >
+   getColumnWidthHints() const
    {
-      return std::vector< int >({ 14, 14, 14, 6, 14, 14 });
+      return std::vector< int >( { 14, 14, 14, 6, 14, 14 } );
    }
 
-   virtual RowElements getRowElements() const
+   virtual RowElements
+   getRowElements() const
    {
       RowElements elements;
       // write in scientific format to avoid precision loss
@@ -58,104 +61,106 @@ struct BenchmarkResult
 template< typename Logger = JsonLogging >
 class Benchmark
 {
-   public:
-      using MetadataElement = typename Logger::MetadataElement;
-      using MetadataColumns = typename Logger::MetadataColumns;
-      using SolverMonitorType = Solvers::IterativeSolverMonitor< double, int >;
+public:
+   using MetadataElement = typename Logger::MetadataElement;
+   using MetadataColumns = typename Logger::MetadataColumns;
+   using SolverMonitorType = Solvers::IterativeSolverMonitor< double, int >;
 
-      Benchmark( std::ostream& output, int loops = 10, bool verbose = true );
+   Benchmark( std::ostream& output, int loops = 10, int verbose = 1 );
 
-      static void configSetup( Config::ConfigDescription& config );
+   static void
+   configSetup( Config::ConfigDescription& config );
 
-      void setup( const Config::ParameterContainer& parameters );
+   void
+   setup( const Config::ParameterContainer& parameters );
 
-      void setLoops( int loops );
+   void
+   setLoops( int loops );
 
-      void setMinTime( double minTime );
+   void
+   setMinTime( double minTime );
 
-      bool isResetingOn() const;
+   bool
+   isResetingOn() const;
 
-      // Sets metadata columns -- values used for all subsequent rows until
-      // the next call to this function.
-      void setMetadataColumns( const MetadataColumns & metadata );
+   // Sets metadata columns -- values used for all subsequent rows until
+   // the next call to this function.
+   void
+   setMetadataColumns( const MetadataColumns& metadata );
 
-      // Sets the value of one metadata column -- useful for iteratively
-      // changing MetadataColumns that were set using the previous method.
-      void setMetadataElement( const typename MetadataColumns::value_type & element );
+   // Sets the value of one metadata column -- useful for iteratively
+   // changing MetadataColumns that were set using the previous method.
+   void
+   setMetadataElement( const typename MetadataColumns::value_type& element );
 
-      // Sets the width of metadata columns when printed to the terminal.
-      void setMetadataWidths( const std::map< std::string, int > & widths );
+   // Sets the width of metadata columns when printed to the terminal.
+   void
+   setMetadataWidths( const std::map< std::string, int >& widths );
 
-      // Sets the dataset size and base time for the calculations of bandwidth
-      // and speedup in the benchmarks result.
-      void setDatasetSize( const double datasetSize = 0.0, // in GB
-                           const double baseTime = 0.0 );
+   // Sets the dataset size and base time for the calculations of bandwidth
+   // and speedup in the benchmarks result.
+   void
+   setDatasetSize( double datasetSize = 0.0,  // in GB
+                   double baseTime = 0.0 );
 
-      // Sets current operation -- operations expand the table vertically
-      //  - baseTime should be reset to 0.0 for most operations, but sometimes
-      //    it is useful to override it
-      //  - Order of operations inside a "Benchmark" does not matter, rows can be
-      //    easily sorted while converting to HTML.)
-      void
-      setOperation( const String & operation,
-                    const double datasetSize = 0.0, // in GB
-                    const double baseTime = 0.0 );
+   // Sets current operation -- operations expand the table vertically
+   //  - baseTime should be reset to 0.0 for most operations, but sometimes
+   //    it is useful to override it
+   //  - Order of operations inside a "Benchmark" does not matter, rows can be
+   //    easily sorted while converting to HTML.)
+   void
+   setOperation( const String& operation,
+                 double datasetSize = 0.0,  // in GB
+                 double baseTime = 0.0 );
 
-      // Times a single ComputeFunction. Subsequent calls implicitly split
-      // the current operation into sub-columns identified by "performer",
-      // which are further split into "bandwidth", "time" and "speedup" columns.
-      template< typename Device,
-                typename ResetFunction,
-                typename ComputeFunction >
-      void time( ResetFunction reset,
-                 const String & performer,
-                 ComputeFunction & compute,
-                 BenchmarkResult & result );
+   // Times a single ComputeFunction. Subsequent calls implicitly split
+   // the current operation into sub-columns identified by "performer",
+   // which are further split into "bandwidth", "time" and "speedup" columns.
+   template< typename Device, typename ResetFunction, typename ComputeFunction >
+   void
+   time( ResetFunction reset, const String& performer, ComputeFunction& compute, BenchmarkResult& result );
 
-      template< typename Device,
-                typename ResetFunction,
-                typename ComputeFunction >
-      BenchmarkResult time( ResetFunction reset,
-                            const String & performer,
-                            ComputeFunction & compute );
+   template< typename Device, typename ResetFunction, typename ComputeFunction >
+   BenchmarkResult
+   time( ResetFunction reset, const String& performer, ComputeFunction& compute );
 
-      // The same methods as above but without the reset function
-      template< typename Device,
-                typename ComputeFunction >
-      void time( const String & performer,
-                 ComputeFunction & compute,
-                 BenchmarkResult & result );
+   // The same methods as above but without the reset function
+   template< typename Device, typename ComputeFunction >
+   void
+   time( const String& performer, ComputeFunction& compute, BenchmarkResult& result );
 
-      template< typename Device,
-                typename ComputeFunction >
-      BenchmarkResult time( const String & performer,
-                            ComputeFunction & compute );
+   template< typename Device, typename ComputeFunction >
+   BenchmarkResult
+   time( const String& performer, ComputeFunction& compute );
 
-      // Adds an error message to the log. Should be called in places where the
-      // "time" method could not be called (e.g. due to failed allocation).
-      void addErrorMessage( const std::string& message );
+   // Adds an error message to the log. Should be called in places where the
+   // "time" method could not be called (e.g. due to failed allocation).
+   void
+   addErrorMessage( const std::string& message );
 
-      SolverMonitorType& getMonitor();
+   SolverMonitorType&
+   getMonitor();
 
-      double getBaseTime() const;
+   double
+   getBaseTime() const;
 
-   protected:
-      Logger logger;
+protected:
+   Logger logger;
 
-      int loops = 1;
+   int loops = 1;
 
-      double minTime = 0.0;
+   double minTime = 0.0;
 
-      double datasetSize = 0.0;
+   double datasetSize = 0.0;
 
-      double baseTime = 0.0;
+   double baseTime = 0.0;
 
-      bool reset = true;
+   bool reset = true;
 
-      SolverMonitorType monitor;
+   SolverMonitorType monitor;
 };
 
-} // namespace Benchmarks
-} // namespace TNL
+}  // namespace Benchmarks
+}  // namespace TNL
 
 #include "Benchmarks.hpp"
diff --git a/src/TNL/Benchmarks/Benchmarks.hpp b/src/TNL/Benchmarks/Benchmarks.hpp
index 29be2c81218e56863b3c699b241d98f8297452d1..e564dd2b2161d9e83ef47fa9f3249ce3181fdb0b 100644
--- a/src/TNL/Benchmarks/Benchmarks.hpp
+++ b/src/TNL/Benchmarks/Benchmarks.hpp
@@ -18,17 +18,13 @@
 namespace TNL {
 namespace Benchmarks {
 
-
 template< typename Logger >
-Benchmark< Logger >::
-Benchmark( std::ostream& output, int loops, bool verbose )
-: logger(output, verbose), loops(loops)
+Benchmark< Logger >::Benchmark( std::ostream& output, int loops, int verbose ) : logger( output, verbose ), loops( loops )
 {}
 
 template< typename Logger >
 void
-Benchmark< Logger >::
-configSetup( Config::ConfigDescription& config )
+Benchmark< Logger >::configSetup( Config::ConfigDescription& config )
 {
    config.addEntry< int >( "loops", "Number of iterations for every computation.", 10 );
    config.addEntry< bool >( "reset", "Call reset function between loops.", true );
@@ -38,8 +34,7 @@ configSetup( Config::ConfigDescription& config )
 
 template< typename Logger >
 void
-Benchmark< Logger >::
-setup( const Config::ParameterContainer& parameters )
+Benchmark< Logger >::setup( const Config::ParameterContainer& parameters )
 {
    this->loops = parameters.getParameter< int >( "loops" );
    this->reset = parameters.getParameter< bool >( "reset" );
@@ -50,57 +45,49 @@ setup( const Config::ParameterContainer& parameters )
 
 template< typename Logger >
 void
-Benchmark< Logger >::
-setLoops( int loops )
+Benchmark< Logger >::setLoops( int loops )
 {
    this->loops = loops;
 }
 
 template< typename Logger >
 void
-Benchmark< Logger >::
-setMinTime( double minTime )
+Benchmark< Logger >::setMinTime( double minTime )
 {
    this->minTime = minTime;
 }
 
 template< typename Logger >
 bool
-Benchmark< Logger >::
-isResetingOn() const
+Benchmark< Logger >::isResetingOn() const
 {
    return reset;
 }
 
 template< typename Logger >
 void
-Benchmark< Logger >::
-setMetadataColumns( const MetadataColumns & metadata )
+Benchmark< Logger >::setMetadataColumns( const MetadataColumns& metadata )
 {
    logger.setMetadataColumns( metadata );
 }
 
 template< typename Logger >
 void
-Benchmark< Logger >::
-setMetadataElement( const typename MetadataColumns::value_type & element )
+Benchmark< Logger >::setMetadataElement( const typename MetadataColumns::value_type& element )
 {
    logger.setMetadataElement( element );
 }
 
 template< typename Logger >
 void
-Benchmark< Logger >::
-setMetadataWidths( const std::map< std::string, int > & widths )
+Benchmark< Logger >::setMetadataWidths( const std::map< std::string, int >& widths )
 {
    logger.setMetadataWidths( widths );
 }
 
 template< typename Logger >
 void
-Benchmark< Logger >::
-setDatasetSize( const double datasetSize,
-                const double baseTime )
+Benchmark< Logger >::setDatasetSize( double datasetSize, double baseTime )
 {
    this->datasetSize = datasetSize;
    this->baseTime = baseTime;
@@ -108,29 +95,20 @@ setDatasetSize( const double datasetSize,
 
 template< typename Logger >
 void
-Benchmark< Logger >::
-setOperation( const String & operation,
-              const double datasetSize,
-              const double baseTime )
+Benchmark< Logger >::setOperation( const String& operation, double datasetSize, double baseTime )
 {
    monitor.setStage( operation.getString() );
-   logger.setMetadataElement( {"operation", operation}, 0 );
+   logger.setMetadataElement( { "operation", operation }, 0 );
    setDatasetSize( datasetSize, baseTime );
 }
 
 template< typename Logger >
-   template< typename Device,
-             typename ResetFunction,
-             typename ComputeFunction >
+template< typename Device, typename ResetFunction, typename ComputeFunction >
 void
-Benchmark< Logger >::
-time( ResetFunction reset,
-      const String & performer,
-      ComputeFunction & compute,
-      BenchmarkResult & result )
+Benchmark< Logger >::time( ResetFunction reset, const String& performer, ComputeFunction& compute, BenchmarkResult& result )
 {
-   result.time = std::numeric_limits<double>::quiet_NaN();
-   result.stddev = std::numeric_limits<double>::quiet_NaN();
+   result.time = std::numeric_limits< double >::quiet_NaN();
+   result.stddev = std::numeric_limits< double >::quiet_NaN();
 
    // run the monitor main loop
    Solvers::SolverMonitorThread monitor_thread( monitor );
@@ -141,14 +119,16 @@ time( ResetFunction reset,
    std::string errorMessage;
    try {
       if( this->reset )
-         std::tie( result.loops, result.time, result.stddev ) = timeFunction< Device >( compute, reset, loops, minTime, monitor );
+         std::tie( result.loops, result.time, result.stddev ) =
+            timeFunction< Device >( compute, reset, loops, minTime, monitor );
       else {
-         auto noReset = [] () {};
-         std::tie( result.loops, result.time, result.stddev ) = timeFunction< Device >( compute, noReset, loops, minTime, monitor );
+         auto noReset = []() {};
+         std::tie( result.loops, result.time, result.stddev ) =
+            timeFunction< Device >( compute, noReset, loops, minTime, monitor );
       }
    }
-   catch ( const std::exception& e ) {
-      errorMessage = "timeFunction failed due to a C++ exception with description: " + std::string(e.what());
+   catch( const std::exception& e ) {
+      errorMessage = "timeFunction failed due to a C++ exception with description: " + std::string( e.what() );
       std::cerr << errorMessage << std::endl;
    }
 
@@ -161,14 +141,9 @@ time( ResetFunction reset,
 }
 
 template< typename Logger >
-   template< typename Device,
-             typename ResetFunction,
-             typename ComputeFunction >
+template< typename Device, typename ResetFunction, typename ComputeFunction >
 BenchmarkResult
-Benchmark< Logger >::
-time( ResetFunction reset,
-      const String& performer,
-      ComputeFunction& compute )
+Benchmark< Logger >::time( ResetFunction reset, const String& performer, ComputeFunction& compute )
 {
    BenchmarkResult result;
    time< Device >( reset, performer, compute, result );
@@ -176,25 +151,18 @@ time( ResetFunction reset,
 }
 
 template< typename Logger >
-   template< typename Device,
-             typename ComputeFunction >
+template< typename Device, typename ComputeFunction >
 void
-Benchmark< Logger >::
-time( const String & performer,
-      ComputeFunction & compute,
-      BenchmarkResult & result )
+Benchmark< Logger >::time( const String& performer, ComputeFunction& compute, BenchmarkResult& result )
 {
-   auto noReset = [] () {};
+   auto noReset = []() {};
    time< Device >( noReset, performer, compute, result );
 }
 
 template< typename Logger >
-   template< typename Device,
-             typename ComputeFunction >
+template< typename Device, typename ComputeFunction >
 BenchmarkResult
-Benchmark< Logger >::
-time( const String & performer,
-      ComputeFunction & compute )
+Benchmark< Logger >::time( const String& performer, ComputeFunction& compute )
 {
    BenchmarkResult result;
    time< Device >( performer, compute, result );
@@ -203,8 +171,7 @@ time( const String & performer,
 
 template< typename Logger >
 void
-Benchmark< Logger >::
-addErrorMessage( const std::string& message )
+Benchmark< Logger >::addErrorMessage( const std::string& message )
 {
    logger.writeErrorMessage( message );
    std::cerr << message << std::endl;
@@ -212,19 +179,17 @@ addErrorMessage( const std::string& message )
 
 template< typename Logger >
 auto
-Benchmark< Logger >::
-getMonitor() -> SolverMonitorType&
+Benchmark< Logger >::getMonitor() -> SolverMonitorType&
 {
    return monitor;
 }
 
 template< typename Logger >
 double
-Benchmark< Logger >::
-getBaseTime() const
+Benchmark< Logger >::getBaseTime() const
 {
    return baseTime;
 }
 
-} // namespace Benchmarks
-} // namespace TNL
+}  // namespace Benchmarks
+}  // namespace TNL
diff --git a/src/TNL/Benchmarks/CustomLogging.h b/src/TNL/Benchmarks/CustomLogging.h
index 7fc6adf520017c7de7715a5f7895e63e8f8f5bcc..fcbea35a58cd2ef0c00db708dac0e9c739cf9fe6 100644
--- a/src/TNL/Benchmarks/CustomLogging.h
+++ b/src/TNL/Benchmarks/CustomLogging.h
@@ -15,20 +15,18 @@
 namespace TNL {
 namespace Benchmarks {
 
-class CustomLogging
-: public Logging
+class CustomLogging : public Logging
 {
 public:
    // inherit constructors
    using Logging::Logging;
 
    void
-   writeTableHeader( const std::string & spanningElement,
-                     const HeaderElements & subElements )
+   writeTableHeader( const std::string& spanningElement, const HeaderElements& subElements )
    {
-      if( verbose && header_changed ) {
-         for( auto & it : metadataColumns ) {
-            const int width = (metadataWidths.count( it.first )) ? metadataWidths[ it.first ] : 15;
+      if( verbose > 0 && header_changed ) {
+         for( const auto& it : metadataColumns ) {
+            const int width = ( metadataWidths.count( it.first ) ) ? metadataWidths[ it.first ] : 15;
             std::cout << std::setw( width ) << it.first;
          }
 
@@ -36,7 +34,7 @@ public:
          // but is excluded from header
          std::cout << std::setw( 15 ) << "";
 
-         for( auto & it : subElements ) {
+         for( const auto& it : subElements ) {
             std::cout << std::setw( 15 ) << it;
          }
          std::cout << std::endl;
@@ -46,29 +44,27 @@ public:
 
       // initial indent string
       log << std::endl;
-      for( auto & it : metadataColumns ) {
+      for( const auto& it : metadataColumns ) {
          log << "! " << it.first << std::endl;
       }
 
       log << "! " << spanningElement << std::endl;
-      for( auto & it : subElements ) {
+      for( const auto& it : subElements ) {
          log << "!! " << it << std::endl;
       }
    }
 
    void
-   writeTableRow( const std::string & spanningElement,
-                  const RowElements & subElements,
-                  const std::string & errorMessage )
+   writeTableRow( const std::string& spanningElement, const RowElements& subElements, const std::string& errorMessage )
    {
-      if( verbose ) {
-         for( auto & it : metadataColumns ) {
-            const int width = (metadataWidths.count( it.first )) ? metadataWidths[ it.first ] : 15;
+      if( verbose > 0 ) {
+         for( const auto& it : metadataColumns ) {
+            const int width = ( metadataWidths.count( it.first ) ) ? metadataWidths[ it.first ] : 15;
             std::cout << std::setw( width ) << it.second;
          }
          // spanning element is printed as usual column to stdout
          std::cout << std::setw( 15 ) << spanningElement;
-         for( auto & it : subElements ) {
+         for( const auto& it : subElements ) {
             std::cout << std::setw( 15 ) << it;
          }
          std::cout << std::endl;
@@ -76,14 +72,14 @@ public:
 
       // only when changed (the header has been already adjusted)
       // print each element on separate line
-      for( auto & it : metadataColumns ) {
+      for( const auto& it : metadataColumns ) {
          log << it.second << std::endl;
       }
 
       if( errorMessage.empty() ) {
          // benchmark data are indented
          const std::string indent = "    ";
-         for( auto & it : subElements ) {
+         for( const auto& it : subElements ) {
             log << indent << it << std::endl;
          }
       }
@@ -93,7 +89,7 @@ public:
       }
    }
 
-   virtual void
+   void
    logResult( const std::string& performer,
               const HeaderElements& headerElements,
               const RowElements& rowElements,
@@ -106,18 +102,18 @@ public:
       writeTableRow( performer, rowElements, errorMessage );
    }
 
-   virtual void
+   void
    writeErrorMessage( const std::string& message ) override
    {
       // initial indent string
       log << std::endl;
-      for( auto & it : metadataColumns ) {
+      for( const auto& it : metadataColumns ) {
          log << "! " << it.first << std::endl;
       }
 
       // only when changed (the header has been already adjusted)
       // print each element on separate line
-      for( auto & it : metadataColumns ) {
+      for( const auto& it : metadataColumns ) {
          log << it.second << std::endl;
       }
 
@@ -140,5 +136,5 @@ protected:
    }
 };
 
-} // namespace Benchmarks
-} // namespace TNL
+}  // namespace Benchmarks
+}  // namespace TNL
diff --git a/src/TNL/Benchmarks/JsonLogging.h b/src/TNL/Benchmarks/JsonLogging.h
index 19ef96bfc8d7c4f97867e08880f9cdc517c0cb45..a160cfd0cb17bf2f7402be98f4d3090e91db3765 100644
--- a/src/TNL/Benchmarks/JsonLogging.h
+++ b/src/TNL/Benchmarks/JsonLogging.h
@@ -15,20 +15,19 @@
 namespace TNL {
 namespace Benchmarks {
 
-class JsonLogging
-: public Logging
+class JsonLogging : public Logging
 {
 public:
    // inherit constructors
    using Logging::Logging;
 
-   void writeHeader( const HeaderElements& headerElements, const WidthHints& widths )
+   void
+   writeHeader( const HeaderElements& headerElements, const WidthHints& widths )
    {
       TNL_ASSERT_EQ( headerElements.size(), widths.size(), "elements must have equal sizes" );
-      if( verbose && header_changed )
-      {
-         for( auto & lg : metadataColumns ) {
-            const int width = (metadataWidths.count( lg.first )) ? metadataWidths[ lg.first ] : 14;
+      if( verbose > 0 && header_changed ) {
+         for( const auto& lg : metadataColumns ) {
+            const int width = ( metadataWidths.count( lg.first ) > 0 ) ? metadataWidths[ lg.first ] : 14;
             std::cout << std::setw( width ) << lg.first;
          }
          for( std::size_t i = 0; i < headerElements.size(); i++ )
@@ -38,10 +37,11 @@ public:
       }
    }
 
-   void writeRow( const HeaderElements& headerElements,
-                  const RowElements& rowElements,
-                  const WidthHints& widths,
-                  const std::string& errorMessage )
+   void
+   writeRow( const HeaderElements& headerElements,
+             const RowElements& rowElements,
+             const WidthHints& widths,
+             const std::string& errorMessage )
    {
       TNL_ASSERT_EQ( headerElements.size(), rowElements.size(), "elements must have equal sizes" );
       TNL_ASSERT_EQ( headerElements.size(), widths.size(), "elements must have equal sizes" );
@@ -50,10 +50,9 @@ public:
 
       // write common logs
       int idx( 0 );
-      for( auto lg : this->metadataColumns )
-      {
-         if( verbose ) {
-            const int width = (metadataWidths.count( lg.first )) ? metadataWidths[ lg.first ] : 14;
+      for( const auto& lg : this->metadataColumns ) {
+         if( verbose > 0 ) {
+            const int width = ( metadataWidths.count( lg.first ) > 0 ) ? metadataWidths[ lg.first ] : 14;
             std::cout << std::setw( width ) << lg.second;
          }
          if( idx++ > 0 )
@@ -62,9 +61,8 @@ public:
       }
 
       std::size_t i = 0;
-      for( auto el : rowElements )
-      {
-         if( verbose )
+      for( const auto& el : rowElements ) {
+         if( verbose > 0 )
             std::cout << std::setw( widths[ i ] ) << el;
          if( idx++ > 0 )
             log << ", ";
@@ -77,31 +75,30 @@ public:
          log << "\"error\": \"" << errorMessage << "\"";
       }
       log << "}" << std::endl;
-      if( verbose )
+      if( verbose > 0 )
          std::cout << std::endl;
    }
 
-   virtual void
+   void
    logResult( const std::string& performer,
               const HeaderElements& headerElements,
               const RowElements& rowElements,
               const WidthHints& columnWidthHints,
               const std::string& errorMessage = "" ) override
    {
-      setMetadataElement({ "performer", performer });
+      setMetadataElement( { "performer", performer } );
       writeHeader( headerElements, columnWidthHints );
       writeRow( headerElements, rowElements, columnWidthHints, errorMessage );
    }
 
-   virtual void
+   void
    writeErrorMessage( const std::string& message ) override
    {
       log << "{";
 
       // write common logs
       int idx( 0 );
-      for( auto lg : this->metadataColumns )
-      {
+      for( const auto& lg : this->metadataColumns ) {
          if( idx++ > 0 )
             log << ", ";
          log << "\"" << lg.first << "\": \"" << lg.second << "\"";
@@ -122,12 +119,12 @@ protected:
       std::stringstream str;
       if( fixed )
          str << std::fixed;
-      if( precision )
+      if( precision > 0 )
          str << std::setprecision( precision );
       str << num;
-      return std::string( str.str().data() );
+      return str.str();
    }
 };
 
-} // namespace Benchmarks
-} // namespace TNL
+}  // namespace Benchmarks
+}  // namespace TNL
diff --git a/src/TNL/Benchmarks/Logging.h b/src/TNL/Benchmarks/Logging.h
index 21e078767fe6ef203cd151e88719bdf79eb03252..6f8d1942d2642d0a4d2503618539b2f601a521fb 100644
--- a/src/TNL/Benchmarks/Logging.h
+++ b/src/TNL/Benchmarks/Logging.h
@@ -22,53 +22,83 @@ namespace Benchmarks {
 
 class LoggingRowElements
 {
-   public:
-
-      LoggingRowElements()
-      {
-         stream << std::setprecision( 6 ) << std::fixed;
-      }
+public:
+   LoggingRowElements()
+   {
+      stream << std::setprecision( 6 ) << std::fixed;
+   }
 
-      template< typename T >
-      LoggingRowElements& operator << ( const T& b )
-      {
-         stream << b;
-         elements.push_back( stream.str() );
-         stream.str( std::string() );
-         return *this;
-      }
+   template< typename T >
+   LoggingRowElements&
+   operator<<( const T& b )
+   {
+      stream << b;
+      elements.push_back( stream.str() );
+      stream.str( std::string() );
+      return *this;
+   }
 
-      LoggingRowElements& operator << ( decltype( std::setprecision( 2 ) )& setprec )
-      {
-         stream << setprec;
-         return *this;
-      }
+   LoggingRowElements&
+   operator<<( decltype( std::setprecision( 2 ) )& setprec )
+   {
+      stream << setprec;
+      return *this;
+   }
 
-      LoggingRowElements& operator << ( decltype( std::fixed )& setfixed ) // the same works also for std::scientific
-      {
-         stream << setfixed;
-         return *this;
-      }
+   LoggingRowElements&
+   operator<<( decltype( std::fixed )& setfixed )  // the same works also for std::scientific
+   {
+      stream << setfixed;
+      return *this;
+   }
 
-      std::size_t size() const noexcept { return elements.size(); };
+   std::size_t
+   size() const noexcept
+   {
+      return elements.size();
+   };
 
-      // iterators
-      auto begin() noexcept { return elements.begin(); }
+   // iterators
+   auto
+   begin() noexcept
+   {
+      return elements.begin();
+   }
 
-      auto begin() const noexcept { return elements.begin(); }
+   auto
+   begin() const noexcept
+   {
+      return elements.begin();
+   }
 
-      auto cbegin() const noexcept { return elements.cbegin(); }
+   auto
+   cbegin() const noexcept
+   {
+      return elements.cbegin();
+   }
 
-      auto end() noexcept { return elements.end(); }
+   auto
+   end() noexcept
+   {
+      return elements.end();
+   }
 
-      auto end() const noexcept { return elements.end(); }
+   auto
+   end() const noexcept
+   {
+      return elements.end();
+   }
 
-      auto cend() const noexcept { return elements.cend(); }
+   auto
+   cend() const noexcept
+   {
+      return elements.cend();
+   }
 
-   protected:
-      std::list< std::string > elements;
+protected:
+   std::list< std::string > elements;
 
-      std::stringstream stream;
+   std::stringstream stream;
 };
 
 class Logging
@@ -81,12 +111,11 @@ public:
    using RowElements = LoggingRowElements;
    using WidthHints = std::vector< int >;
 
-   Logging( std::ostream& log, int verbose = true )
-   : log(log), verbose(verbose)
+   Logging( std::ostream& log, int verbose = 1 ) : log( log ), verbose( verbose )
    {
       try {
          // check if we got an open file
-         std::ofstream& file = dynamic_cast< std::ofstream& >( log );
+         auto& file = dynamic_cast< std::ofstream& >( log );
          if( file.is_open() )
             // enable exceptions, but only if we got an open file
             // (under MPI, only the master rank typically opens the log file and thus
@@ -105,12 +134,14 @@ public:
       this->verbose = verbose;
    }
 
-   int getVerbose() const
+   int
+   getVerbose() const
    {
       return verbose;
    }
 
-   virtual void setMetadataColumns( const MetadataColumns& elements )
+   virtual void
+   setMetadataColumns( const MetadataColumns& elements )
    {
       // check if a header element changed (i.e. a first item of the pairs)
       if( metadataColumns.size() != elements.size() )
@@ -125,11 +156,11 @@ public:
    }
 
    virtual void
-   setMetadataElement( const typename MetadataColumns::value_type & element,
+   setMetadataElement( const typename MetadataColumns::value_type& element,
                        int insertPosition = -1 /* negative values insert from the end */ )
    {
       bool found = false;
-      for( auto & it : metadataColumns )
+      for( auto& it : metadataColumns )
          if( it.first == element.first ) {
             if( it.second != element.second )
                it.second = element.second;
@@ -146,10 +177,10 @@ public:
    }
 
    virtual void
-   setMetadataWidths( const std::map< std::string, int > & widths )
+   setMetadataWidths( const std::map< std::string, int >& widths )
    {
-      for( auto & it : widths )
-         if( metadataWidths.count( it.first ) )
+      for( const auto& it : widths )
+         if( metadataWidths.count( it.first ) > 0 )
             metadataWidths[ it.first ] = it.second;
          else
             metadataWidths.insert( it );
@@ -162,7 +193,8 @@ public:
               const WidthHints& columnWidthHints,
               const std::string& errorMessage = "" ) = 0;
 
-   virtual void writeErrorMessage( const std::string& message ) = 0;
+   virtual void
+   writeErrorMessage( const std::string& message ) = 0;
 
 protected:
    std::ostream& log;
@@ -173,5 +205,5 @@ protected:
    bool header_changed = true;
 };
 
-} // namespace Benchmarks
-} // namespace TNL
+}  // namespace Benchmarks
+}  // namespace TNL
diff --git a/src/TNL/Benchmarks/Utils.h b/src/TNL/Benchmarks/Utils.h
index a96eaf121b6737eb562b6d0a342062bc01accda2..76af847740bfffe652ab306c949dc355d6628682 100644
--- a/src/TNL/Benchmarks/Utils.h
+++ b/src/TNL/Benchmarks/Utils.h
@@ -36,11 +36,7 @@ template< typename Device,
           typename ResetFunction,
           typename Monitor = TNL::Solvers::IterativeSolverMonitor< double, int > >
 std::tuple< int, double, double >
-timeFunction( ComputeFunction compute,
-              ResetFunction reset,
-              int maxLoops,
-              const double& minTime,
-              Monitor && monitor = Monitor() )
+timeFunction( ComputeFunction compute, ResetFunction reset, int maxLoops, const double& minTime, Monitor&& monitor = Monitor() )
 {
    // the timer is constructed zero-initialized and stopped
    Timer timer;
@@ -56,10 +52,7 @@ timeFunction( ComputeFunction compute,
    results.setValue( 0.0 );
 
    int loops;
-   for( loops = 0;
-        loops < maxLoops || sum( results ) < minTime;
-        loops++ )
-   {
+   for( loops = 0; loops < maxLoops || sum( results ) < minTime; loops++ ) {
       // abuse the monitor's "time" for loops
       monitor.setTime( loops + 1 );
       reset();
@@ -88,18 +81,17 @@ timeFunction( ComputeFunction compute,
    if( loops > 1 )
       stddev = 1.0 / std::sqrt( loops - 1 ) * l2Norm( results - mean );
    else
-      stddev = std::numeric_limits<double>::quiet_NaN();
+      stddev = std::numeric_limits< double >::quiet_NaN();
    return std::make_tuple( loops, mean, stddev );
 }
 
-inline std::map< std::string, std::string > getHardwareMetadata()
+inline std::map< std::string, std::string >
+getHardwareMetadata()
 {
    const int cpu_id = 0;
    const CacheSizes cacheSizes = SystemInfo::getCPUCacheSizes( cpu_id );
-   const std::string cacheInfo = std::to_string( cacheSizes.L1data ) + ", "
-                               + std::to_string( cacheSizes.L1instruction ) + ", "
-                               + std::to_string( cacheSizes.L2 ) + ", "
-                               + std::to_string( cacheSizes.L3 );
+   const std::string cacheInfo = std::to_string( cacheSizes.L1data ) + ", " + std::to_string( cacheSizes.L1instruction ) + ", "
+                               + std::to_string( cacheSizes.L2 ) + ", " + std::to_string( cacheSizes.L3 );
 #ifdef HAVE_CUDA
    const int activeGPU = Cuda::DeviceInfo::getActiveDevice();
    const std::string deviceArch = std::to_string( Cuda::DeviceInfo::getArchitectureMajor( activeGPU ) ) + "."
@@ -114,38 +106,39 @@ inline std::map< std::string, std::string > getHardwareMetadata()
       nproc = TNL::MPI::GetSize();
 #endif
 
-   std::map< std::string, std::string > metadata {
-       { "host name", SystemInfo::getHostname() },
-       { "architecture", SystemInfo::getArchitecture() },
-       { "system", SystemInfo::getSystemName() },
-       { "system release", SystemInfo::getSystemRelease() },
-       { "start time", SystemInfo::getCurrentTime() },
+   std::map< std::string, std::string > metadata{
+      { "host name", SystemInfo::getHostname() },
+      { "architecture", SystemInfo::getArchitecture() },
+      { "system", SystemInfo::getSystemName() },
+      { "system release", SystemInfo::getSystemRelease() },
+      { "start time", SystemInfo::getCurrentTime() },
 #ifdef HAVE_MPI
-       { "number of MPI processes", std::to_string( nproc ) },
+      { "number of MPI processes", std::to_string( nproc ) },
 #endif
-       { "OpenMP enabled", std::to_string( Devices::Host::isOMPEnabled() ) },
-       { "OpenMP threads", std::to_string( Devices::Host::getMaxThreadsCount() ) },
-       { "CPU model name", SystemInfo::getCPUModelName( cpu_id ) },
-       { "CPU cores", std::to_string( SystemInfo::getNumberOfCores( cpu_id ) ) },
-       { "CPU threads per core", std::to_string( SystemInfo::getNumberOfThreads( cpu_id ) / SystemInfo::getNumberOfCores( cpu_id ) ) },
-       { "CPU max frequency (MHz)", std::to_string( SystemInfo::getCPUMaxFrequency( cpu_id ) / 1e3 ) },
-       { "CPU cache sizes (L1d, L1i, L2, L3) (kiB)", cacheInfo },
+      { "OpenMP enabled", Devices::Host::isOMPEnabled() ? "yes" : "no" },
+      { "OpenMP threads", std::to_string( Devices::Host::getMaxThreadsCount() ) },
+      { "CPU model name", SystemInfo::getCPUModelName( cpu_id ) },
+      { "CPU cores", std::to_string( SystemInfo::getNumberOfCores( cpu_id ) ) },
+      { "CPU threads per core",
+        std::to_string( SystemInfo::getNumberOfThreads( cpu_id ) / SystemInfo::getNumberOfCores( cpu_id ) ) },
+      { "CPU max frequency (MHz)", std::to_string( SystemInfo::getCPUMaxFrequency( cpu_id ) / 1e3 ) },
+      { "CPU cache sizes (L1d, L1i, L2, L3) (kiB)", cacheInfo },
 #ifdef HAVE_CUDA
-       { "GPU name", Cuda::DeviceInfo::getDeviceName( activeGPU ) },
-       { "GPU architecture", deviceArch },
-       { "GPU CUDA cores", std::to_string( Cuda::DeviceInfo::getCudaCores( activeGPU ) ) },
-       { "GPU clock rate (MHz)", std::to_string( (double) Cuda::DeviceInfo::getClockRate( activeGPU ) / 1e3 ) },
-       { "GPU global memory (GB)", std::to_string( (double) Cuda::DeviceInfo::getGlobalMemory( activeGPU ) / 1e9 ) },
-       { "GPU memory clock rate (MHz)", std::to_string( (double) Cuda::DeviceInfo::getMemoryClockRate( activeGPU ) / 1e3 ) },
-       { "GPU memory ECC enabled", std::to_string( Cuda::DeviceInfo::getECCEnabled( activeGPU ) ) },
+      { "GPU name", Cuda::DeviceInfo::getDeviceName( activeGPU ) },
+      { "GPU architecture", deviceArch },
+      { "GPU CUDA cores", std::to_string( Cuda::DeviceInfo::getCudaCores( activeGPU ) ) },
+      { "GPU clock rate (MHz)", std::to_string( (double) Cuda::DeviceInfo::getClockRate( activeGPU ) / 1e3 ) },
+      { "GPU global memory (GB)", std::to_string( (double) Cuda::DeviceInfo::getGlobalMemory( activeGPU ) / 1e9 ) },
+      { "GPU memory clock rate (MHz)", std::to_string( (double) Cuda::DeviceInfo::getMemoryClockRate( activeGPU ) / 1e3 ) },
+      { "GPU memory ECC enabled", std::to_string( Cuda::DeviceInfo::getECCEnabled( activeGPU ) ) },
 #endif
    };
 
    return metadata;
 }
 
-inline void writeMapAsJson( const std::map< std::string, std::string >& data,
-                            std::ostream& out )
+inline void
+writeMapAsJson( const std::map< std::string, std::string >& data, std::ostream& out )
 {
    out << "{\n";
    for( auto it = data.begin(); it != data.end(); ) {
@@ -160,13 +153,12 @@ inline void writeMapAsJson( const std::map< std::string, std::string >& data,
    out << "}\n" << std::flush;
 }
 
-inline void writeMapAsJson( const std::map< std::string, std::string >& data,
-                            std::string filename,
-                            std::string newExtension = "" )
+inline void
+writeMapAsJson( const std::map< std::string, std::string >& data, std::string filename, const std::string& newExtension = "" )
 {
    namespace fs = std::experimental::filesystem;
 
-   if( newExtension != "" ) {
+   if( ! newExtension.empty() ) {
       const fs::path oldPath = filename;
       const fs::path newPath = oldPath.parent_path() / ( oldPath.stem().string() + newExtension );
       filename = newPath;
@@ -178,5 +170,5 @@ inline void writeMapAsJson( const std::map< std::string, std::string >& data,
    writeMapAsJson( data, file );
 }
 
-} // namespace Benchmarks
-} // namespace TNL
+}  // namespace Benchmarks
+}  // namespace TNL
diff --git a/src/TNL/Config/ConfigDelimiter.h b/src/TNL/Config/ConfigDelimiter.h
index 62a4d39faae1b7ebb6d4138d7f7a2b3ebfaebbf9..8eac7300f7298e98eb6acb5adfc173a1a5378a05 100644
--- a/src/TNL/Config/ConfigDelimiter.h
+++ b/src/TNL/Config/ConfigDelimiter.h
@@ -16,14 +16,20 @@ namespace Config {
 class ConfigDelimiter : public ConfigEntryBase
 {
 public:
-   ConfigDelimiter( const std::string& delimiter )
-   : ConfigEntryBase( "", delimiter, false )
-   {}
-
-   virtual bool isDelimiter() const override { return true; };
-
-   virtual std::string getUIEntryType() const override { return ""; };
+   ConfigDelimiter( const std::string& delimiter ) : ConfigEntryBase( "", delimiter, false ) {}
+
+   bool
+   isDelimiter() const override
+   {
+      return true;
+   };
+
+   std::string
+   getUIEntryType() const override
+   {
+      return "";
+   };
 };
 
-} //namespace Config
-} //namespace TNL
+}  // namespace Config
+}  // namespace TNL
diff --git a/src/TNL/Config/ConfigDescription.h b/src/TNL/Config/ConfigDescription.h
index 20251a1e695b5ff0b6eed33761749b08f10d10f4..df5d5cc480ab7ee8bc6f93f0104856d1bdc39f01 100644
--- a/src/TNL/Config/ConfigDescription.h
+++ b/src/TNL/Config/ConfigDescription.h
@@ -30,8 +30,8 @@ public:
     * \param description More specific information about the entry.
     */
    template< typename EntryType >
-   void addEntry( const std::string& name,
-                  const std::string& description )
+   void
+   addEntry( const std::string& name, const std::string& description )
    {
       using CoercedEntryType = typename ParameterTypeCoercion< EntryType >::type;
       entries.push_back( std::make_unique< ConfigEntry< CoercedEntryType > >( name, description, false ) );
@@ -47,8 +47,8 @@ public:
     * \param description More specific information about the entry.
     */
    template< typename EntryType >
-   void addRequiredEntry( const std::string& name,
-                          const std::string& description )
+   void
+   addRequiredEntry( const std::string& name, const std::string& description )
    {
       using CoercedEntryType = typename ParameterTypeCoercion< EntryType >::type;
       entries.push_back( std::make_unique< ConfigEntry< CoercedEntryType > >( name, description, true ) );
@@ -65,13 +65,13 @@ public:
     * \param defaultValue Default value of the entry.
     */
    template< typename EntryType >
-   void addEntry( const std::string& name,
-                  const std::string& description,
-                  const EntryType& defaultValue )
+   void
+   addEntry( const std::string& name, const std::string& description, const EntryType& defaultValue )
    {
       using CoercedEntryType = typename ParameterTypeCoercion< EntryType >::type;
       const auto convertedDefaultValue = ParameterTypeCoercion< EntryType >::convert( defaultValue );
-      entries.push_back( std::make_unique< ConfigEntry< CoercedEntryType > >( name, description, false, convertedDefaultValue ) );
+      entries.push_back(
+         std::make_unique< ConfigEntry< CoercedEntryType > >( name, description, false, convertedDefaultValue ) );
       currentEntry = entries.back().get();
       isCurrentEntryList = false;
    }
@@ -84,8 +84,8 @@ public:
     * \param description More specific information about the list.
     */
    template< typename EntryType >
-   void addList( const std::string& name,
-                 const std::string& description )
+   void
+   addList( const std::string& name, const std::string& description )
    {
       using CoercedEntryType = typename ParameterTypeCoercion< EntryType >::type;
       entries.push_back( std::make_unique< ConfigEntryList< CoercedEntryType > >( name, description, false ) );
@@ -101,8 +101,8 @@ public:
     * \param description More specific information about the list.
     */
    template< typename EntryType >
-   void addRequiredList( const std::string& name,
-                         const std::string& description )
+   void
+   addRequiredList( const std::string& name, const std::string& description )
    {
       using CoercedEntryType = typename ParameterTypeCoercion< EntryType >::type;
       entries.push_back( std::make_unique< ConfigEntryList< CoercedEntryType > >( name, description, true ) );
@@ -119,13 +119,13 @@ public:
     * \param defaultValue Default value of the list.
     */
    template< typename EntryType >
-   void addList( const std::string& name,
-                 const std::string& description,
-                 const std::vector< EntryType >& defaultValue )
+   void
+   addList( const std::string& name, const std::string& description, const std::vector< EntryType >& defaultValue )
    {
       using CoercedEntryType = typename ParameterTypeCoercion< EntryType >::type;
       const auto convertedDefaultValue = ParameterTypeCoercion< std::vector< EntryType > >::convert( defaultValue );
-      entries.push_back( std::make_unique< ConfigEntryList< CoercedEntryType > >( name, description, false, convertedDefaultValue ) );
+      entries.push_back(
+         std::make_unique< ConfigEntryList< CoercedEntryType > >( name, description, false, convertedDefaultValue ) );
       currentEntry = entries.back().get();
       isCurrentEntryList = true;
    }
@@ -138,18 +138,19 @@ public:
     * \param entryEnum Value of the entry enumeration.
     */
    template< typename EntryType = std::string >
-   void addEntryEnum( const EntryType entryEnum = EntryType{} )
+   void
+   addEntryEnum( const EntryType entryEnum = EntryType{} )
    {
       if( this->currentEntry == nullptr )
          throw Exceptions::ConfigError( "there is no current entry" );
 
       using CoercedEntryType = typename ParameterTypeCoercion< EntryType >::type;
       if( isCurrentEntryList ) {
-         ConfigEntryList< CoercedEntryType >& entry = dynamic_cast< ConfigEntryList< CoercedEntryType >& >( *currentEntry );
+         auto& entry = dynamic_cast< ConfigEntryList< CoercedEntryType >& >( *currentEntry );
          entry.getEnumValues().push_back( ParameterTypeCoercion< EntryType >::convert( entryEnum ) );
       }
       else {
-         ConfigEntry< CoercedEntryType >& entry = dynamic_cast< ConfigEntry< CoercedEntryType >& >( *currentEntry );
+         auto& entry = dynamic_cast< ConfigEntry< CoercedEntryType >& >( *currentEntry );
          entry.getEnumValues().push_back( ParameterTypeCoercion< EntryType >::convert( entryEnum ) );
       }
    }
@@ -159,7 +160,8 @@ public:
     *
     * \param delimeter String that defines how the delimeter looks like.
     */
-   void addDelimiter( const std::string& delimiter )
+   void
+   addDelimiter( const std::string& delimiter )
    {
       entries.push_back( std::make_unique< ConfigDelimiter >( delimiter ) );
       currentEntry = nullptr;
@@ -170,7 +172,8 @@ public:
     *
     * \param name Name of the entry.
     */
-   const ConfigEntryBase* getEntry( const std::string& name ) const
+   const ConfigEntryBase*
+   getEntry( const std::string& name ) const
    {
       // ConfigDelimiter has empty name
       if( name.empty() )
@@ -184,12 +187,36 @@ public:
    }
 
    // iterators
-   auto begin() noexcept { return entries.begin(); }
-   auto begin() const noexcept { return entries.begin(); }
-   auto cbegin() const noexcept { return entries.cbegin(); }
-   auto end() noexcept { return entries.end(); }
-   auto end() const noexcept { return entries.end(); }
-   auto cend() const noexcept { return entries.cend(); }
+   auto
+   begin() noexcept
+   {
+      return entries.begin();
+   }
+   auto
+   begin() const noexcept
+   {
+      return entries.begin();
+   }
+   auto
+   cbegin() const noexcept
+   {
+      return entries.cbegin();
+   }
+   auto
+   end() noexcept
+   {
+      return entries.end();
+   }
+   auto
+   end() const noexcept
+   {
+      return entries.end();
+   }
+   auto
+   cend() const noexcept
+   {
+      return entries.cend();
+   }
 
 protected:
    std::vector< std::unique_ptr< ConfigEntryBase > > entries;
@@ -197,5 +224,5 @@ protected:
    bool isCurrentEntryList = false;
 };
 
-} // namespace Config
-} // namespace TNL
+}  // namespace Config
+}  // namespace TNL
diff --git a/src/TNL/Config/ConfigEntry.h b/src/TNL/Config/ConfigEntry.h
index 8b39352a018bc1f4368cfa603a3d90b89093a699..f7f777b228ff6fbb916e937155dedcc604109c1c 100644
--- a/src/TNL/Config/ConfigEntry.h
+++ b/src/TNL/Config/ConfigEntry.h
@@ -8,6 +8,7 @@
 
 #pragma once
 
+#include <utility>
 #include <vector>
 #include <sstream>
 
@@ -20,7 +21,8 @@ namespace Config {
 template< typename EntryType, typename DefaultValueType = EntryType >
 class ConfigEntry : public ConfigEntryBase
 {
-   static_assert( std::is_same< EntryType, DefaultValueType >::value || std::is_same< std::vector< EntryType >, DefaultValueType >::value,
+   static_assert( std::is_same< EntryType, DefaultValueType >::value
+                     || std::is_same< std::vector< EntryType >, DefaultValueType >::value,
                   "DefaultValueType must be the same as either EntryType or std::vector< EntryType >" );
 
    DefaultValueType defaultValue;
@@ -28,48 +30,40 @@ class ConfigEntry : public ConfigEntryBase
    std::vector< EntryType > enumValues;
 
 public:
-   ConfigEntry( const std::string& name,
-                const std::string& description,
-                bool required )
-   : ConfigEntryBase( name,
-                      description,
-                      required )
+   ConfigEntry( const std::string& name, const std::string& description, bool required )
+   : ConfigEntryBase( name, description, required )
    {
       _hasDefaultValue = false;
    }
 
-   ConfigEntry( const std::string& name,
-                const std::string& description,
-                bool required,
-                const DefaultValueType& defaultValue)
-   : ConfigEntryBase( name,
-                      description,
-                      required ),
-     defaultValue( defaultValue )
+   ConfigEntry( const std::string& name, const std::string& description, bool required, DefaultValueType defaultValue )
+   : ConfigEntryBase( name, description, required ), defaultValue( std::move( defaultValue ) )
    {
       _hasDefaultValue = true;
    }
 
-   virtual std::string getUIEntryType() const override
+   std::string
+   getUIEntryType() const override
    {
       return Config::getUIEntryType< DefaultValueType >();
    }
 
-   virtual std::string printDefaultValue() const override
+   std::string
+   printDefaultValue() const override
    {
       // printDefaultValue must be compilable even if DefaultValueType is std::vector,
       // so we can't override the method in ConfigEntryList
       return _print_value( defaultValue );
    }
 
-   virtual bool hasEnumValues() const override
+   bool
+   hasEnumValues() const override
    {
-      if( enumValues.size() > 0 )
-         return true;
-      return false;
+      return ! enumValues.empty();
    }
 
-   virtual void printEnumValues( std::ostream& str ) const override
+   void
+   printEnumValues( std::ostream& str ) const override
    {
       str << "- Can be:           ";
       int i;
@@ -79,30 +73,35 @@ public:
       str << " ";
    }
 
-   virtual DefaultValueType getDefaultValue() const
+   virtual DefaultValueType
+   getDefaultValue() const
    {
       return defaultValue;
    }
 
-   virtual std::vector< EntryType >& getEnumValues()
+   virtual std::vector< EntryType >&
+   getEnumValues()
    {
       return enumValues;
    }
 
-   virtual const std::vector< EntryType >& getEnumValues() const
+   virtual const std::vector< EntryType >&
+   getEnumValues() const
    {
       return enumValues;
    }
 
 private:
-   static std::string _print_value( const EntryType& value )
+   static std::string
+   _print_value( const EntryType& value )
    {
       std::stringstream str;
       str << value;
       return str.str();
    }
 
-   static std::string _print_value( const std::vector< EntryType >& vec )
+   static std::string
+   _print_value( const std::vector< EntryType >& vec )
    {
       std::stringstream str;
       str << "[ ";
@@ -114,5 +113,5 @@ private:
    }
 };
 
-} // namespace Config
-} // namespace TNL
+}  // namespace Config
+}  // namespace TNL
diff --git a/src/TNL/Config/ConfigEntryBase.h b/src/TNL/Config/ConfigEntryBase.h
index dda080034deb4952a188ed5dcf935afe050b73f0..fade58e81d71f55f87039e4ab33bfd244947ee29 100644
--- a/src/TNL/Config/ConfigEntryBase.h
+++ b/src/TNL/Config/ConfigEntryBase.h
@@ -9,6 +9,7 @@
 #pragma once
 
 #include <string>
+#include <utility>
 
 namespace TNL {
 namespace Config {
@@ -25,35 +26,61 @@ protected:
    bool _hasDefaultValue;
 
 public:
-   ConfigEntryBase( const std::string& name,
-                    const std::string& description,
-                    bool required )
-      : name( name ),
-        description( description ),
-        required( required ),
-        _hasDefaultValue( false )
+   ConfigEntryBase( std::string name, std::string description, bool required )
+   : name( std::move( name ) ), description( std::move( description ) ), required( required ), _hasDefaultValue( false )
    {}
 
-   const std::string& getName() const { return name; }
-
-   const std::string& getDescription() const { return description; }
-
-   bool isRequired() const { return required; }
-
-   bool hasDefaultValue() const { return _hasDefaultValue; }
-
-   virtual std::string getUIEntryType() const = 0;
-
-   virtual bool isDelimiter() const { return false; }
-
-   virtual std::string printDefaultValue() const { return ""; }
-
-   virtual bool hasEnumValues() const { return false; }
-
-   virtual void printEnumValues( std::ostream& str ) const {}
+   const std::string&
+   getName() const
+   {
+      return name;
+   }
+
+   const std::string&
+   getDescription() const
+   {
+      return description;
+   }
+
+   bool
+   isRequired() const
+   {
+      return required;
+   }
+
+   bool
+   hasDefaultValue() const
+   {
+      return _hasDefaultValue;
+   }
+
+   virtual std::string
+   getUIEntryType() const = 0;
+
+   virtual bool
+   isDelimiter() const
+   {
+      return false;
+   }
+
+   virtual std::string
+   printDefaultValue() const
+   {
+      return "";
+   }
+
+   virtual bool
+   hasEnumValues() const
+   {
+      return false;
+   }
+
+   virtual void
+   printEnumValues( std::ostream& str ) const
+   {}
 
    virtual ~ConfigEntryBase() = default;
 };
 
-} // namespace Config
-} // namespace TNL
+}  // namespace Config
+}  // namespace TNL
diff --git a/src/TNL/Config/ConfigEntryList.h b/src/TNL/Config/ConfigEntryList.h
index 03bb380c24b14d3a98ca1c4f3eec0f76ab78575b..7c2e072b21e7a3ad7d427ea313f7620bad4c1096 100644
--- a/src/TNL/Config/ConfigEntryList.h
+++ b/src/TNL/Config/ConfigEntryList.h
@@ -21,5 +21,5 @@ public:
    using ConfigEntry< EntryType, std::vector< EntryType > >::ConfigEntry;
 };
 
-} // namespace Config
-} // namespace TNL
+}  // namespace Config
+}  // namespace TNL
diff --git a/src/TNL/Config/ConfigEntryType.h b/src/TNL/Config/ConfigEntryType.h
index b970a547d36dbf9355743681b7dc01256c1953d2..f2dc8532e76461845c378163ac38feee1b0a757a 100644
--- a/src/TNL/Config/ConfigEntryType.h
+++ b/src/TNL/Config/ConfigEntryType.h
@@ -14,15 +14,15 @@
 #include <vector>
 #include <string>
 #include <stdexcept>
-#include <mpark/variant.hpp>   // backport of std::variant from C++17
+#include <mpark/variant.hpp>  // backport of std::variant from C++17
 
 namespace TNL {
 namespace Config {
 
-using mpark::variant;
 using mpark::get;
-using mpark::monostate;
 using mpark::holds_alternative;
+using mpark::monostate;
+using mpark::variant;
 
 // aliases for integer types
 using UnsignedInteger = std::size_t;
@@ -38,30 +38,39 @@ using Parameter = variant< monostate,
                            std::vector< Integer >,
                            std::vector< UnsignedInteger >,
                            std::vector< double >,
-                           std::vector< std::string >
-                         >;
+                           std::vector< std::string > >;
 
 template< typename T >
 struct ParameterTypeCoercion
 {
-   using type =
-      std::conditional_t< std::is_same< T, bool >::value, bool,
-         std::conditional_t< std::is_integral< T >::value && std::is_signed< T >::value, Integer,
-            std::conditional_t< std::is_integral< T >::value && std::is_unsigned< T >::value, UnsignedInteger,
-               std::conditional_t< std::is_floating_point< T >::value, double,
-                  std::conditional_t< std::is_base_of< std::string, T >::value, std::string,
-                     std::conditional_t< std::is_same< std::decay_t< T >, const char* >::value, std::string,
-                        T
-                     >
-                  >
-               >
-            >
-         >
-      >;
-
-   static type convert( const T& v ) { return v; }
+   using type = std::conditional_t<
+      std::is_same< T, bool >::value,
+      bool,
+      std::conditional_t<
+         std::is_integral< T >::value && std::is_signed< T >::value,
+         Integer,
+         std::conditional_t<
+            std::is_integral< T >::value && std::is_unsigned< T >::value,
+            UnsignedInteger,
+            std::conditional_t<
+               std::is_floating_point< T >::value,
+               double,
+               std::conditional_t<
+                  std::is_base_of< std::string, T >::value,
+                  std::string,
+                  std::conditional_t< std::is_same< std::decay_t< T >, const char* >::value, std::string, T > > > > > >;
+
+   static type
+   convert( const T& v )
+   {
+      return v;
+   }
    template< typename Result >
-   static Result convert_back( const type& v ) { return v; }
+   static Result
+   convert_back( const type& v )
+   {
+      return v;
+   }
 };
 
 template< typename T >
@@ -69,38 +78,94 @@ struct ParameterTypeCoercion< std::vector< T > >
 {
    using type = std::vector< typename ParameterTypeCoercion< T >::type >;
 
-   static type convert( const std::vector< T >& vec )
+   static type
+   convert( const std::vector< T >& vec )
    {
       type new_vec;
-      for( auto value : vec )
+      for( const auto& value : vec )
          new_vec.push_back( value );
       return new_vec;
    }
 
    template< typename Result >
-   static Result convert_back( const type& vec )
+   static Result
+   convert_back( const type& vec )
    {
       Result new_vec;
-      for( auto value : vec )
+      for( const auto& value : vec )
          new_vec.push_back( value );
       return new_vec;
    }
 };
 
 template< typename EntryType >
-std::string getUIEntryType() { throw std::logic_error( "getUIEntryType called with unknown type." ); };
-
-template<> inline std::string getUIEntryType< bool >()             { return "bool"; };
-template<> inline std::string getUIEntryType< Integer >()          { return "integer"; };
-template<> inline std::string getUIEntryType< UnsignedInteger >()  { return "unsigned integer"; };
-template<> inline std::string getUIEntryType< double >()           { return "real"; };
-template<> inline std::string getUIEntryType< std::string >()      { return "string"; };
-
-template<> inline std::string getUIEntryType< std::vector< bool > >()             { return "list of bool"; };
-template<> inline std::string getUIEntryType< std::vector< Integer > >()          { return "list of integer"; };
-template<> inline std::string getUIEntryType< std::vector< UnsignedInteger > >()  { return "list of unsigned integer"; };
-template<> inline std::string getUIEntryType< std::vector< double > >()           { return "list of real"; };
-template<> inline std::string getUIEntryType< std::vector< std::string > >()      { return "list of string"; };
-
-} // namespace Config
-} // namespace TNL
+std::string
+getUIEntryType()
+{
+   throw std::logic_error( "getUIEntryType called with unknown type." );
+};
+
+template<>
+inline std::string
+getUIEntryType< bool >()
+{
+   return "bool";
+};
+template<>
+inline std::string
+getUIEntryType< Integer >()
+{
+   return "integer";
+};
+template<>
+inline std::string
+getUIEntryType< UnsignedInteger >()
+{
+   return "unsigned integer";
+};
+template<>
+inline std::string
+getUIEntryType< double >()
+{
+   return "real";
+};
+template<>
+inline std::string
+getUIEntryType< std::string >()
+{
+   return "string";
+};
+
+template<>
+inline std::string
+getUIEntryType< std::vector< bool > >()
+{
+   return "list of bool";
+};
+template<>
+inline std::string
+getUIEntryType< std::vector< Integer > >()
+{
+   return "list of integer";
+};
+template<>
+inline std::string
+getUIEntryType< std::vector< UnsignedInteger > >()
+{
+   return "list of unsigned integer";
+};
+template<>
+inline std::string
+getUIEntryType< std::vector< double > >()
+{
+   return "list of real";
+};
+template<>
+inline std::string
+getUIEntryType< std::vector< std::string > >()
+{
+   return "list of string";
+};
+
+}  // namespace Config
+}  // namespace TNL
diff --git a/src/TNL/Config/ParameterContainer.h b/src/TNL/Config/ParameterContainer.h
index 01e94a7e3cbe45d84633a99a5fd29a7e5aab659d..a83bbd629953b8bd3a91c862d0645b103e4f2d66 100644
--- a/src/TNL/Config/ParameterContainer.h
+++ b/src/TNL/Config/ParameterContainer.h
@@ -28,8 +28,8 @@ public:
     * \param value Value assigned to the parameter.
     */
    template< class T >
-   void addParameter( const std::string& name,
-                      const T& value )
+   void
+   addParameter( const std::string& name, const T& value )
    {
       parameters.emplace( name, ParameterTypeCoercion< T >::convert( value ) );
    }
@@ -41,8 +41,8 @@ public:
     * \param value Value assigned to the parameter.
     */
    template< class T >
-   void addParameter( const std::string& name,
-                      const std::vector< T >& value )
+   void
+   addParameter( const std::string& name, const std::vector< T >& value )
    {
       parameters.emplace( name, ParameterTypeCoercion< std::vector< T > >::convert( value ) );
    }
@@ -54,8 +54,8 @@ public:
     * \param value Vector of values assigned to the parameter.
     */
    template< class T >
-   void addList( const std::string& name,
-                 const std::vector< T >& value )
+   void
+   addList( const std::string& name, const std::vector< T >& value )
    {
       addParameter( name, value );
    }
@@ -68,11 +68,10 @@ public:
     * \param values Other values assigned to the parameter.
     */
    template< class T, class... Ts >
-   void addList( const std::string& name,
-                 const T& value,
-                 const Ts&... values )
+   void
+   addList( const std::string& name, const T& value, const Ts&... values )
    {
-      addParameter( name, std::vector< T >{value, values...} );
+      addParameter( name, std::vector< T >{ value, values... } );
    }
 
    /**
@@ -80,9 +79,10 @@ public:
     *
     * \param name Name of the parameter.
     */
-   bool checkParameter( const std::string& name ) const
+   bool
+   checkParameter( const std::string& name ) const
    {
-      return parameters.count( name );
+      return parameters.count( name ) > 0;
    }
 
    /**
@@ -90,9 +90,10 @@ public:
     *
     * \param names List of the parameter names.
     */
-   bool checkParameters( std::initializer_list< String > names ) const
+   bool
+   checkParameters( std::initializer_list< std::string > names ) const
    {
-      for( auto name : names )
+      for( const auto& name : names )
          if( ! checkParameter( name ) )
             return false;
       return true;
@@ -104,7 +105,8 @@ public:
     * \param name Name of the parameter.
     */
    template< class T >
-   bool checkParameterType( const std::string& name ) const
+   bool
+   checkParameterType( const std::string& name ) const
    {
       using CoercedType = typename ParameterTypeCoercion< T >::type;
       auto search = parameters.find( name );
@@ -123,8 +125,8 @@ public:
     * \param value Value of type T assigned to the parameter.
     */
    template< class T >
-   void setParameter( const std::string& name,
-                      const T& value )
+   void
+   setParameter( const std::string& name, const T& value )
    {
       using CoercedType = typename ParameterTypeCoercion< T >::type;
       auto search = parameters.find( name );
@@ -133,10 +135,14 @@ public:
             search->second = (CoercedType) value;
          }
          else {
-            throw std::logic_error( "Parameter " + name + " already exists with different type. "
-                                    "Current type index is " + std::to_string( search->second.index() ) +
-                                    " (variant type is " + std::string( TNL::getType< Parameter >() ) + "), "
-                                    "tried to set value of type " + std::string( TNL::getType< T >() ) + "." );
+            throw std::logic_error( "Parameter " + name
+                                    + " already exists with different type. "
+                                      "Current type index is "
+                                    + std::to_string( search->second.index() ) + " (variant type is "
+                                    + std::string( TNL::getType< Parameter >() )
+                                    + "), "
+                                      "tried to set value of type "
+                                    + std::string( TNL::getType< T >() ) + "." );
          }
       }
       addParameter< T >( name, value );
@@ -148,7 +154,8 @@ public:
     * \param name Name of the parameter.
     */
    template< class T >
-   T getParameter( const std::string& name ) const
+   T
+   getParameter( const std::string& name ) const
    {
       using CoercedType = typename ParameterTypeCoercion< T >::type;
       auto search = parameters.find( name );
@@ -156,10 +163,14 @@ public:
          if( holds_alternative< CoercedType >( search->second ) )
             return ParameterTypeCoercion< T >::template convert_back< T >( get< CoercedType >( search->second ) );
          else
-            throw Exceptions::ConfigError( "Parameter " + name + " holds a value of different type than requested. "
-                                           "Current type index is " + std::to_string( search->second.index() ) +
-                                           " (variant type is " + std::string( TNL::getType< Parameter >() ) + "), "
-                                           "tried to get value of type " + std::string( TNL::getType< T >() ) + "." );
+            throw Exceptions::ConfigError( "Parameter " + name
+                                           + " holds a value of different type than requested. "
+                                             "Current type index is "
+                                           + std::to_string( search->second.index() ) + " (variant type is "
+                                           + std::string( TNL::getType< Parameter >() )
+                                           + "), "
+                                             "tried to get value of type "
+                                           + std::string( TNL::getType< T >() ) + "." );
       }
       throw Exceptions::ConfigError( "The program attempts to get unknown parameter " + name + "." );
    }
@@ -170,7 +181,8 @@ public:
     * \param name Name of the parameter list.
     */
    template< class T >
-   std::vector< T > getList( const std::string& name ) const
+   std::vector< T >
+   getList( const std::string& name ) const
    {
       return getParameter< std::vector< T > >( name );
    }
@@ -182,7 +194,8 @@ public:
     *               \e prefix-y and \e prefix-z.
     */
    template< class StaticArray >
-   StaticArray getXyz( const std::string& prefix ) const
+   StaticArray
+   getXyz( const std::string& prefix ) const
    {
       StaticArray result;
       result[ 0 ] = getParameter< typename StaticArray::ValueType >( prefix + "-x" );
@@ -197,5 +210,5 @@ protected:
    std::unordered_map< std::string, Parameter > parameters;
 };
 
-} // namespace Config
-} // namespace TNL
+}  // namespace Config
+}  // namespace TNL
diff --git a/src/TNL/Config/parseCommandLine.h b/src/TNL/Config/parseCommandLine.h
index 180abf23f1a4bad70c2ff9a9fa6eabfd0581e788..4582ee4301cc6c9b093760ce2e2f644557fa5848 100644
--- a/src/TNL/Config/parseCommandLine.h
+++ b/src/TNL/Config/parseCommandLine.h
@@ -12,6 +12,7 @@
 #include <sstream>
 #include <iomanip>
 
+#include <TNL/String.h>
 #include <TNL/Config/ConfigDescription.h>
 #include <TNL/Config/ParameterContainer.h>
 
@@ -21,71 +22,69 @@ namespace Config {
 /**
  * \brief Fills in the parameters from the \e parameters.
  *
- * Parameters which were not defined in the command line by user but have their default value are added to the congiguration description.
- * If there is missing entry with defined default value in the Config::ParameterContainer it is going to be added.
+ * Parameters which were not defined in the command line by user but have their default value are added to the congiguration
+ * description. If there is missing entry with defined default value in the Config::ParameterContainer it is going to be added.
  * \param parameters Name of the ParameterContainer object.
  */
 inline void
 addDefaultValues( const ConfigDescription& config, ParameterContainer& parameters )
 {
-   for( const auto& entryBase : config )
-   {
+   for( const auto& entryBase : config ) {
       const std::string entry_name = entryBase->getName();
-      if( entryBase->hasDefaultValue() && ! parameters.checkParameter( entry_name ) )
-      {
+      if( entryBase->hasDefaultValue() && ! parameters.checkParameter( entry_name ) ) {
          if( entryBase->getUIEntryType() == "bool" ) {
-            ConfigEntry< bool >& entry = dynamic_cast< ConfigEntry< bool >& >( *entryBase );
+            auto& entry = dynamic_cast< ConfigEntry< bool >& >( *entryBase );
             parameters.addParameter< bool >( entry_name, entry.getDefaultValue() );
             continue;
          }
          else if( entryBase->getUIEntryType() == "integer" ) {
-            ConfigEntry< Integer >& entry = dynamic_cast< ConfigEntry< Integer >& >( *entryBase );
+            auto& entry = dynamic_cast< ConfigEntry< Integer >& >( *entryBase );
             parameters.addParameter< Integer >( entry_name, entry.getDefaultValue() );
             continue;
          }
          else if( entryBase->getUIEntryType() == "unsigned integer" ) {
-            ConfigEntry< UnsignedInteger >& entry = dynamic_cast< ConfigEntry< UnsignedInteger >& >( *entryBase );
+            auto& entry = dynamic_cast< ConfigEntry< UnsignedInteger >& >( *entryBase );
             parameters.addParameter< UnsignedInteger >( entry_name, entry.getDefaultValue() );
             continue;
          }
          else if( entryBase->getUIEntryType() == "real" ) {
-            ConfigEntry< double >& entry = dynamic_cast< ConfigEntry< double >& >( *entryBase );
+            auto& entry = dynamic_cast< ConfigEntry< double >& >( *entryBase );
             parameters.addParameter< double >( entry_name, entry.getDefaultValue() );
             continue;
          }
          else if( entryBase->getUIEntryType() == "string" ) {
-            ConfigEntry< std::string >& entry = dynamic_cast< ConfigEntry< std::string >& >( *entryBase );
+            auto& entry = dynamic_cast< ConfigEntry< std::string >& >( *entryBase );
             parameters.addParameter< std::string >( entry_name, entry.getDefaultValue() );
             continue;
          }
          else if( entryBase->getUIEntryType() == "list of bool" ) {
-            ConfigEntryList< bool >& entry = dynamic_cast< ConfigEntryList< bool >& >( *entryBase );
+            auto& entry = dynamic_cast< ConfigEntryList< bool >& >( *entryBase );
             parameters.addList< bool >( entry_name, entry.getDefaultValue() );
             continue;
          }
          else if( entryBase->getUIEntryType() == "list of integer" ) {
-            ConfigEntryList< Integer >& entry = dynamic_cast< ConfigEntryList< Integer >& >( *entryBase );
+            auto& entry = dynamic_cast< ConfigEntryList< Integer >& >( *entryBase );
             parameters.addList< Integer >( entry_name, entry.getDefaultValue() );
             continue;
          }
          else if( entryBase->getUIEntryType() == "list of unsigned integer" ) {
-            ConfigEntryList< UnsignedInteger >& entry = dynamic_cast< ConfigEntryList< UnsignedInteger >& >( *entryBase );
+            auto& entry = dynamic_cast< ConfigEntryList< UnsignedInteger >& >( *entryBase );
             parameters.addList< UnsignedInteger >( entry_name, entry.getDefaultValue() );
             continue;
          }
          else if( entryBase->getUIEntryType() == "list of real" ) {
-            ConfigEntryList< double >& entry = dynamic_cast< ConfigEntryList< double >& >( *entryBase );
+            auto& entry = dynamic_cast< ConfigEntryList< double >& >( *entryBase );
             parameters.addList< double >( entry_name, entry.getDefaultValue() );
             continue;
          }
          else if( entryBase->getUIEntryType() == "list of string" ) {
-            ConfigEntryList< std::string >& entry = dynamic_cast< ConfigEntryList< std::string >& >( *entryBase );
+            auto& entry = dynamic_cast< ConfigEntryList< std::string >& >( *entryBase );
             parameters.addList< std::string >( entry_name, entry.getDefaultValue() );
             continue;
          }
          else
-            throw std::runtime_error( "Function addDefaultValues encountered unsupported entry type: " +
-                                      entryBase->getUIEntryType() );
+            throw std::runtime_error( "Function addDefaultValues encountered unsupported entry type: "
+                                      + entryBase->getUIEntryType() );
       }
    }
 }
@@ -108,36 +107,29 @@ printUsage( const ConfigDescription& config, const char* program_name )
          max_type_length = std::max( max_type_length, entry->getUIEntryType().length() );
       }
    }
-   max_name_length += 2; // this is for "--"
+   max_name_length += 2;  // this is for "--"
 
    for( const auto& entry : config ) {
-      if( entry->isDelimiter() )
-      {
+      if( entry->isDelimiter() ) {
          std::cout << std::endl;
          std::cout << entry->getDescription();
          std::cout << std::endl << std::endl;
       }
-      else
-      {
-         std::cout << std::setw( max_name_length + 3 ) << "--" << entry->getName()
-                   << std::setw( max_type_length + 5 ) << entry->getUIEntryType()
-                   << "    " << entry->getDescription();
+      else {
+         std::cout << std::setw( max_name_length + 3 ) << "--" << entry->getName() << std::setw( max_type_length + 5 )
+                   << entry->getUIEntryType() << "    " << entry->getDescription();
          if( entry->isRequired() )
             std::cout << " *** REQUIRED ***";
-         if( entry->hasEnumValues() )
-         {
+         if( entry->hasEnumValues() ) {
             std::cout << std::endl
-                 << std::setw( max_name_length + 3 ) << ""
-                 << std::setw( max_type_length + 5 ) << ""
-                 << "    ";
+                      << std::setw( max_name_length + 3 ) << "" << std::setw( max_type_length + 5 ) << ""
+                      << "    ";
             entry->printEnumValues( std::cout );
          }
-         if( entry->hasDefaultValue() )
-         {
+         if( entry->hasDefaultValue() ) {
             std::cout << std::endl
-                 << std::setw( max_name_length + 3 ) << ""
-                 << std::setw( max_type_length + 5 ) << ""
-                 << "    ";
+                      << std::setw( max_name_length + 3 ) << "" << std::setw( max_type_length + 5 ) << ""
+                      << "    ";
             std::cout << "- Default value is: " << entry->printDefaultValue();
          }
          std::cout << std::endl;
@@ -159,15 +151,15 @@ checkMissingEntries( const ConfigDescription& config,
    for( const auto& entryBase : config ) {
       const std::string entry_name = entryBase->getName();
       if( entryBase->isRequired() && ! parameters.checkParameter( entry_name ) )
-          missingParameters.push_back( entry_name );
+         missingParameters.push_back( entry_name );
    }
-   if( missingParameters.size() > 0 ) {
+   if( ! missingParameters.empty() ) {
       std::cerr << "Some mandatory parameters are misssing. They are listed at the end." << std::endl;
       if( printUsage )
          Config::printUsage( config, programName );
       std::cerr << "Add the following missing parameters to the command line:" << std::endl << "   ";
-      for( int i = 0; i < (int) missingParameters.size(); i++ )
-         std::cerr << "--" << missingParameters[ i ] << " ... ";
+      for( auto& missingParameter : missingParameters )
+         std::cerr << "--" << missingParameter << " ... ";
       std::cerr << std::endl;
       return false;
    }
@@ -179,7 +171,7 @@ void
 checkEnumValues( const ConfigEntry< EntryType, DefaultValueType >& entry, const std::string& name, const EntryType& value )
 {
    if( entry.getEnumValues().size() > 0 ) {
-      for( auto enumValue : entry.getEnumValues() )
+      for( const auto& enumValue : entry.getEnumValues() )
          if( value == enumValue )
             return;
       std::stringstream str;
@@ -191,7 +183,9 @@ checkEnumValues( const ConfigEntry< EntryType, DefaultValueType >& entry, const
 
 template< typename EntryType, typename DefaultValueType >
 void
-checkEnumValues( const ConfigEntry< EntryType, DefaultValueType >& entry, const std::string& name, const std::vector< EntryType >& values )
+checkEnumValues( const ConfigEntry< EntryType, DefaultValueType >& entry,
+                 const std::string& name,
+                 const std::vector< EntryType >& values )
 {
    if( entry.getEnumValues().size() > 0 ) {
       for( auto value : values )
@@ -201,20 +195,21 @@ checkEnumValues( const ConfigEntry< EntryType, DefaultValueType >& entry, const
 
 template< typename T >
 T
-convertStringValue( const String& value, const String& param )
+convertStringValue( const std::string& value, const std::string& param )
 {
    T v;
    std::stringstream str;
    str << value;
    str >> v;
    if( str.fail() )
-      throw Exceptions::ConfigError( "Value '" + value + "' could not be converted to type " + TNL::getType<T>().getString() +
-                                     " as required for the parameter " + param + "." );
+      throw Exceptions::ConfigError( "Value '" + value + "' could not be converted to type " + TNL::getType< T >()
+                                     + " as required for the parameter " + param + "." );
    return v;
 }
 
 inline bool
-parseCommandLine( int argc, char* argv[],
+parseCommandLine( int argc,
+                  char* argv[],
                   const Config::ConfigDescription& config_description,
                   Config::ParameterContainer& parameters,
                   bool printUsage = true )
@@ -224,12 +219,12 @@ parseCommandLine( int argc, char* argv[],
       if( a.size() != b.size() )
          return false;
       for( unsigned int i = 0; i < a.size(); i++ )
-         if( std::tolower(a[i]) != std::tolower(b[i]) )
+         if( std::tolower( a[ i ] ) != std::tolower( b[ i ] ) )
             return false;
       return true;
    };
 
-   auto matob = [iequals]( const std::string& value, const std::string& option ) -> int
+   auto matob = [ iequals ]( const std::string& value, const std::string& option ) -> bool
    {
       if( iequals( value, "yes" ) || iequals( value, "true" ) )
          return true;
@@ -240,19 +235,19 @@ parseCommandLine( int argc, char* argv[],
 
    int i;
    try {
-      for( i = 1; i < argc; i++ )
-      {
+      for( i = 1; i < argc; i++ ) {
          const std::string _option = argv[ i ];
          if( _option.length() < 3 || _option[ 0 ] != '-' || _option[ 1 ] != '-' )
             throw Exceptions::ConfigError( "Unknown option " + _option + ". Options must be prefixed with \"--\"." );
          if( _option == "--help" ) {
             Config::printUsage( config_description, argv[ 0 ] );
-            // FIXME: false here indicates that the program should terminate, but the exit code should indicate success instead of failure
+            // FIXME: false here indicates that the program should terminate, but the exit code should indicate success instead
+            // of failure
             return false;
          }
-         const std::string option = _option.substr(2);
+         const std::string option = _option.substr( 2 );
          const ConfigEntryBase* entryBase = config_description.getEntry( option );
-         if( entryBase == NULL )
+         if( entryBase == nullptr )
             throw Exceptions::ConfigError( "Unknown parameter " + _option + "." );
          const String entryType = entryBase->getUIEntryType();
          if( i == argc - 1 )
@@ -261,18 +256,16 @@ parseCommandLine( int argc, char* argv[],
          if( value.empty() )
             throw Exceptions::ConfigError( "Missing value for the parameter " + option + "." );
          const std::vector< String > parsedEntryType = entryType.split();
-         if( parsedEntryType.size() == 0 )
+         if( parsedEntryType.empty() )
             throw Exceptions::ConfigError( "Internal error: Unknown config entry type " + entryType + "." );
-         if( parsedEntryType[ 0 ] == "list" )
-         {
+         if( parsedEntryType[ 0 ] == "list" ) {
             std::vector< bool > bool_list;
             std::vector< Integer > integer_list;
             std::vector< UnsignedInteger > unsigned_integer_list;
             std::vector< double > real_list;
             std::vector< std::string > string_list;
 
-            while( i < argc && std::string( argv[ i ] ).substr(0, 2) != "--" )
-            {
+            while( i < argc && std::string( argv[ i ] ).substr( 0, 2 ) != "--" ) {
                const std::string value = argv[ i++ ];
                if( entryType == "list of bool" ) {
                   const bool v = matob( value, option );
@@ -280,24 +273,24 @@ parseCommandLine( int argc, char* argv[],
                }
                else if( entryType == "list of integer" ) {
                   const Integer v = convertStringValue< Integer >( value, option );
-                  const ConfigEntryList< Integer >& entry = dynamic_cast< const ConfigEntryList< Integer >& >( *entryBase );
+                  const auto& entry = dynamic_cast< const ConfigEntryList< Integer >& >( *entryBase );
                   checkEnumValues( entry, option, v );
                   integer_list.push_back( v );
                }
                else if( entryType == "list of unsigned integer" ) {
-                  const UnsignedInteger v = convertStringValue< UnsignedInteger >( value, option );
-                  const ConfigEntryList< UnsignedInteger >& entry = dynamic_cast< const ConfigEntryList< UnsignedInteger >& >( *entryBase );
+                  const auto v = convertStringValue< UnsignedInteger >( value, option );
+                  const auto& entry = dynamic_cast< const ConfigEntryList< UnsignedInteger >& >( *entryBase );
                   checkEnumValues( entry, option, v );
                   unsigned_integer_list.push_back( v );
                }
                else if( entryType == "list of real" ) {
                   const double v = convertStringValue< double >( value, option );
-                  const ConfigEntryList< double >& entry = dynamic_cast< const ConfigEntryList< double >& >( *entryBase );
+                  const auto& entry = dynamic_cast< const ConfigEntryList< double >& >( *entryBase );
                   checkEnumValues( entry, option, v );
                   real_list.push_back( v );
                }
                else if( entryType == "list of string" ) {
-                  const ConfigEntryList< std::string >& entry = dynamic_cast< const ConfigEntryList< std::string >& >( *entryBase );
+                  const auto& entry = dynamic_cast< const ConfigEntryList< std::string >& >( *entryBase );
                   checkEnumValues( entry, option, value );
                   string_list.push_back( value );
                }
@@ -305,43 +298,42 @@ parseCommandLine( int argc, char* argv[],
                   // this will not happen if all entry types are handled above
                   throw std::runtime_error( "Function parseCommandLine encountered unsupported entry type: " + entryType );
             }
-            if( bool_list.size() )
+            if( ! bool_list.empty() )
                parameters.addParameter< std::vector< bool > >( option, bool_list );
-            if( integer_list.size() )
+            if( ! integer_list.empty() )
                parameters.addParameter< std::vector< Integer > >( option, integer_list );
-            if( unsigned_integer_list.size() )
+            if( ! unsigned_integer_list.empty() )
                parameters.addParameter< std::vector< UnsignedInteger > >( option, unsigned_integer_list );
-            if( real_list.size() )
+            if( ! real_list.empty() )
                parameters.addParameter< std::vector< double > >( option, real_list );
-            if( string_list.size() )
+            if( ! string_list.empty() )
                parameters.addParameter< std::vector< std::string > >( option, string_list );
          }
-         else
-         {
+         else {
             if( entryType == "bool" ) {
                const bool v = matob( value, option );
                parameters.addParameter< bool >( option, v );
             }
             else if( entryType == "integer" ) {
                const Integer v = convertStringValue< Integer >( value, option );
-               const ConfigEntry< Integer >& entry = dynamic_cast< const ConfigEntry< Integer >& >( *entryBase );
+               const auto& entry = dynamic_cast< const ConfigEntry< Integer >& >( *entryBase );
                checkEnumValues( entry, option, v );
                parameters.addParameter< Integer >( option, v );
             }
             else if( entryType == "unsigned integer" ) {
-               const UnsignedInteger v = convertStringValue< UnsignedInteger >( value, option );
-               const ConfigEntry< UnsignedInteger >& entry = dynamic_cast< const ConfigEntry< UnsignedInteger >& >( *entryBase );
+               const auto v = convertStringValue< UnsignedInteger >( value, option );
+               const auto& entry = dynamic_cast< const ConfigEntry< UnsignedInteger >& >( *entryBase );
                checkEnumValues( entry, option, v );
                parameters.addParameter< UnsignedInteger >( option, v );
             }
             else if( entryType == "real" ) {
                const double v = convertStringValue< double >( value, option );
-               const ConfigEntry< double >& entry = dynamic_cast< const ConfigEntry< double >& >( *entryBase );
+               const auto& entry = dynamic_cast< const ConfigEntry< double >& >( *entryBase );
                checkEnumValues( entry, option, v );
                parameters.addParameter< double >( option, v );
             }
             else if( entryType == "string" ) {
-               const ConfigEntry< std::string >& entry = dynamic_cast< const ConfigEntry< std::string >& >( *entryBase );
+               const auto& entry = dynamic_cast< const ConfigEntry< std::string >& >( *entryBase );
                checkEnumValues( entry, option, (std::string) value );
                parameters.addParameter< std::string >( option, value );
             }
@@ -351,17 +343,15 @@ parseCommandLine( int argc, char* argv[],
          }
       }
    }
-   catch ( const Exceptions::ConfigError& e ) {
+   catch( const Exceptions::ConfigError& e ) {
       std::cerr << argv[ 0 ] << ": failed to parse the command line due to the following error:\n" << e.what() << std::endl;
       if( printUsage )
          Config::printUsage( config_description, argv[ 0 ] );
       return false;
    }
    addDefaultValues( config_description, parameters );
-   if( ! checkMissingEntries( config_description, parameters, printUsage, argv[ 0 ] ) )
-      return false;
-   return true;
+   return checkMissingEntries( config_description, parameters, printUsage, argv[ 0 ] );
 }
 
-} // namespace Config
-} // namespace TNL
+}  // namespace Config
+}  // namespace TNL
diff --git a/src/TNL/Config/parseINIConfigFile.h b/src/TNL/Config/parseINIConfigFile.h
index ad78e0c614e96fe53703911c7fc7c5164f619353..fed4a9dd533a2ba780cddf3137a50fda1b2bd276 100644
--- a/src/TNL/Config/parseINIConfigFile.h
+++ b/src/TNL/Config/parseINIConfigFile.h
@@ -12,7 +12,7 @@
 
 #include <TNL/Config/ConfigDescription.h>
 #include <TNL/Config/ParameterContainer.h>
-#include <TNL/Config/parseCommandLine.h>    // for addDefaultValues and checkEnumValues
+#include <TNL/Config/parseCommandLine.h>  // for addDefaultValues and checkEnumValues
 
 #include <Leksys/iniparser.hpp>
 
@@ -20,106 +20,105 @@ namespace TNL {
 namespace Config {
 
 ParameterContainer
-parseINIConfigFile( const std::string& configPath,
-                    const ConfigDescription& description )
+parseINIConfigFile( const std::string& configPath, const ConfigDescription& description )
 {
-    ParameterContainer parameters;
+   ParameterContainer parameters;
 
-    INI::File file;
-    if( ! file.Load( configPath ) )
-        throw std::runtime_error( file.LastResult().GetErrorDesc() );
+   INI::File file;
+   if( ! file.Load( configPath ) )
+      throw std::runtime_error( file.LastResult().GetErrorDesc() );
 
-    // aggregated sets
-    std::set< std::string > undefinedOptions;
+   // aggregated sets
+   std::set< std::string > undefinedOptions;
 
-    // iterate over all entries in the global section
-    const INI::Section* section = file.GetSection( "" );
-    for( auto e = section->ValuesBegin(); e != section->ValuesEnd(); e++ ) {
-        const std::string name = e->first;
-        const auto* entryBase = description.getEntry( name );
-        if( entryBase == nullptr ) {
-            undefinedOptions.insert( name );
-            continue;
-        }
-        const std::string entryType = entryBase->getUIEntryType();
-        const auto value = e->second;
-        if( value.AsString().empty() )
-            throw std::runtime_error( "Missing value for the parameter " + name + "." );
+   // iterate over all entries in the global section
+   const INI::Section* section = file.GetSection( "" );
+   for( auto e = section->ValuesBegin(); e != section->ValuesEnd(); e++ ) {
+      const std::string name = e->first;
+      const auto* entryBase = description.getEntry( name );
+      if( entryBase == nullptr ) {
+         undefinedOptions.insert( name );
+         continue;
+      }
+      const std::string entryType = entryBase->getUIEntryType();
+      const auto value = e->second;
+      if( value.AsString().empty() )
+         throw std::runtime_error( "Missing value for the parameter " + name + "." );
 
-        if( entryType == "bool" ) {
-            parameters.addParameter< bool >( name, value.AsBool() );
-            continue;
-        }
-        else if( entryType == "integer" ) {
-            const auto v = value.AsT< Integer >();
-            const ConfigEntry< Integer >& entry = dynamic_cast< const ConfigEntry< Integer >& >( *entryBase );
-            checkEnumValues( entry, name, v );
-            parameters.addParameter< Integer >( name, v );
-        }
-        else if( entryType == "unsigned integer" ) {
-            const auto v = value.AsT< UnsignedInteger >();
-            const ConfigEntry< UnsignedInteger >& entry = dynamic_cast< const ConfigEntry< UnsignedInteger >& >( *entryBase );
-            checkEnumValues( entry, name, v );
-            parameters.addParameter< UnsignedInteger >( name, v );
-        }
-        else if( entryType == "real" ) {
-            const auto v = value.AsDouble();
-            const ConfigEntry< double >& entry = dynamic_cast< const ConfigEntry< double >& >( *entryBase );
-            checkEnumValues( entry, name, v );
-            parameters.addParameter< double >( name, v );
-        }
-        else if( entryType == "string" ) {
-            const auto v = value.AsString();
-            const ConfigEntry< std::string >& entry = dynamic_cast< const ConfigEntry< std::string >& >( *entryBase );
-            checkEnumValues( entry, name, v );
-            parameters.addParameter< std::string >( name, v );
-            continue;
-        }
-        else if( entryType == "list of bool" ) {
-            const auto list = value.AsArray().ToVector< bool >();
-            parameters.addList< bool >( name, list );
-        }
-        else if( entryType == "list of integer" ) {
-            const auto list = value.AsArray().ToVector< Integer >();
-            const ConfigEntry< Integer >& entry = dynamic_cast< const ConfigEntry< Integer >& >( *entryBase );
-            checkEnumValues( entry, name, list );
-            parameters.addList< Integer >( name, list );
-        }
-        else if( entryType == "list of unsigned integer" ) {
-            const auto list = value.AsArray().ToVector< UnsignedInteger >();
-            const ConfigEntry< UnsignedInteger >& entry = dynamic_cast< const ConfigEntry< UnsignedInteger >& >( *entryBase );
-            checkEnumValues( entry, name, list );
-            parameters.addList< UnsignedInteger >( name, list );
-        }
-        else if( entryType == "list of real" ) {
-            const auto list = value.AsArray().ToVector< double >();
-            const ConfigEntry< double >& entry = dynamic_cast< const ConfigEntry< double >& >( *entryBase );
-            checkEnumValues( entry, name, list );
-            parameters.addList< double >( name, list );
-        }
-        else if( entryType == "list of string" ) {
-            const auto list = value.AsArray().ToVector< std::string >();
-            const ConfigEntry< std::string >& entry = dynamic_cast< const ConfigEntry< std::string >& >( *entryBase );
-            checkEnumValues( entry, name, list );
-            parameters.addList< std::string >( name, list );
-        }
-        else
-            // this will not happen if all entry types are handled above
-            throw std::runtime_error( "Function parseINIConfigFil encountered unsupported entry type: " + entryType );
-    }
+      if( entryType == "bool" ) {
+         parameters.addParameter< bool >( name, value.AsBool() );
+         continue;
+      }
+      else if( entryType == "integer" ) {
+         const auto v = value.AsT< Integer >();
+         const ConfigEntry< Integer >& entry = dynamic_cast< const ConfigEntry< Integer >& >( *entryBase );
+         checkEnumValues( entry, name, v );
+         parameters.addParameter< Integer >( name, v );
+      }
+      else if( entryType == "unsigned integer" ) {
+         const auto v = value.AsT< UnsignedInteger >();
+         const ConfigEntry< UnsignedInteger >& entry = dynamic_cast< const ConfigEntry< UnsignedInteger >& >( *entryBase );
+         checkEnumValues( entry, name, v );
+         parameters.addParameter< UnsignedInteger >( name, v );
+      }
+      else if( entryType == "real" ) {
+         const auto v = value.AsDouble();
+         const ConfigEntry< double >& entry = dynamic_cast< const ConfigEntry< double >& >( *entryBase );
+         checkEnumValues( entry, name, v );
+         parameters.addParameter< double >( name, v );
+      }
+      else if( entryType == "string" ) {
+         const auto v = value.AsString();
+         const ConfigEntry< std::string >& entry = dynamic_cast< const ConfigEntry< std::string >& >( *entryBase );
+         checkEnumValues( entry, name, v );
+         parameters.addParameter< std::string >( name, v );
+         continue;
+      }
+      else if( entryType == "list of bool" ) {
+         const auto list = value.AsArray().ToVector< bool >();
+         parameters.addList< bool >( name, list );
+      }
+      else if( entryType == "list of integer" ) {
+         const auto list = value.AsArray().ToVector< Integer >();
+         const ConfigEntry< Integer >& entry = dynamic_cast< const ConfigEntry< Integer >& >( *entryBase );
+         checkEnumValues( entry, name, list );
+         parameters.addList< Integer >( name, list );
+      }
+      else if( entryType == "list of unsigned integer" ) {
+         const auto list = value.AsArray().ToVector< UnsignedInteger >();
+         const ConfigEntry< UnsignedInteger >& entry = dynamic_cast< const ConfigEntry< UnsignedInteger >& >( *entryBase );
+         checkEnumValues( entry, name, list );
+         parameters.addList< UnsignedInteger >( name, list );
+      }
+      else if( entryType == "list of real" ) {
+         const auto list = value.AsArray().ToVector< double >();
+         const ConfigEntry< double >& entry = dynamic_cast< const ConfigEntry< double >& >( *entryBase );
+         checkEnumValues( entry, name, list );
+         parameters.addList< double >( name, list );
+      }
+      else if( entryType == "list of string" ) {
+         const auto list = value.AsArray().ToVector< std::string >();
+         const ConfigEntry< std::string >& entry = dynamic_cast< const ConfigEntry< std::string >& >( *entryBase );
+         checkEnumValues( entry, name, list );
+         parameters.addList< std::string >( name, list );
+      }
+      else
+         // this will not happen if all entry types are handled above
+         throw std::runtime_error( "Function parseINIConfigFil encountered unsupported entry type: " + entryType );
+   }
 
-    if( ! undefinedOptions.empty() ) {
-        std::string msg = "The configuration file contains the following options which are not defined in the program:\n";
-        for( auto option : undefinedOptions )
-            msg += " - " + option + "\n";
-        throw std::runtime_error( msg );
-    }
+   if( ! undefinedOptions.empty() ) {
+      std::string msg = "The configuration file contains the following options which are not defined in the program:\n";
+      for( auto option : undefinedOptions )
+         msg += " - " + option + "\n";
+      throw std::runtime_error( msg );
+   }
 
-    // add default values to the parameters
-    addDefaultValues( description, parameters );
+   // add default values to the parameters
+   addDefaultValues( description, parameters );
 
-    return parameters;
+   return parameters;
 }
 
-} // namespace Config
-} // namespace TNL
+}  // namespace Config
+}  // namespace TNL
diff --git a/src/TNL/Containers/Array.h b/src/TNL/Containers/Array.h
index 6767d137056c3d0ecb67b0d0434a29b4cdf394c8..f67779040ad4ae0b6995e2ada3c8b21f0c33e79a 100644
--- a/src/TNL/Containers/Array.h
+++ b/src/TNL/Containers/Array.h
@@ -20,7 +20,8 @@ namespace TNL {
  */
 namespace Containers {
 
-template< int, typename > class StaticArray;
+template< int, typename >
+class StaticArray;
 
 /**
  * \brief \e Array is responsible for memory management, access to array
@@ -67,693 +68,726 @@ template< typename Value,
           typename Allocator = typename Allocators::Default< Device >::template Allocator< Value > >
 class Array
 {
-   static_assert( std::is_same< std::remove_cv_t< Value>, std::remove_cv_t< typename Allocator::value_type > >::value, "Mismatch of Array::Value and Allocator::value_type. The type must be the same." );
-   public:
-      /**
-       * \brief Type of elements stored in this array.
-       */
-      using ValueType = Value;
-
-      /**
-       * \brief Device where the array is allocated.
-       *
-       * See \ref Devices::Host or \ref Devices::Cuda.
-       */
-      using DeviceType = Device;
-
-      /**
-       * \brief Type being used for the array elements indexing.
-       */
-      using IndexType = Index;
-
-      /**
-       * \brief Allocator type used for allocating this array.
-       *
-       * See \ref Allocators::Cuda, \ref Allocators::CudaHost, \ref Allocators::CudaManaged, \ref Allocators::Host or \ref Allocators:Default.
-       */
-      using AllocatorType = Allocator;
-
-      /**
-       * \brief Compatible ArrayView type.
-       */
-      using ViewType = ArrayView< Value, Device, Index >;
-
-      /**
-       * \brief Compatible constant ArrayView type.
-       */
-      using ConstViewType = ArrayView< std::add_const_t< Value >, Device, Index >;
-
-      /**
-       * \brief A template which allows to quickly obtain an \ref Array type with changed template parameters.
-       */
-      template< typename _Value,
-                typename _Device = Device,
-                typename _Index = Index,
-                typename _Allocator = typename Allocators::Default< _Device >::template Allocator< _Value > >
-      using Self = Array< _Value, _Device, _Index, _Allocator >;
-
-
-      /**
-       * \brief Constructs an empty array with zero size.
-       */
-      Array() = default;
-
-      /**
-       * \brief Constructs an empty array and sets the provided allocator.
-       *
-       * \param allocator The allocator to be associated with this array.
-       */
-      explicit Array( const AllocatorType& allocator );
-
-      /**
-       * \brief Constructs an array with given size.
-       *
-       * \param size The number of array elements to be allocated.
-       * \param allocator The allocator to be associated with this array.
-       */
-      explicit Array( IndexType size, const AllocatorType& allocator = AllocatorType() );
-
-      /**
-       * \brief Constructs an array with given size and value.
-       *
-       * \param size The number of array elements to be allocated.
-       * \param value The value all elements will be set to.
-       * \param allocator The allocator to be associated with this array.
-       */
-      explicit Array( IndexType size, ValueType value, const AllocatorType& allocator = AllocatorType() );
-
-      /**
-       * \brief Constructs an array with given size and copies data from given
-       * pointer.
-       *
-       * \param data The pointer to the data to be copied to the array.
-       * \param size The number of array elements to be copied to the array.
-       * \param allocator The allocator to be associated with this array.
-       */
-      Array( ValueType* data,
-             IndexType size,
-             const AllocatorType& allocator = AllocatorType() );
-
-      /**
-       * \brief Copy constructor (makes a deep copy).
-       *
-       * \param array The array to be copied.
-       */
-      explicit Array( const Array& array );
-
-      /**
-       * \brief Copy constructor with a specific allocator (makes a deep copy).
-       *
-       * \param array The array to be copied.
-       * \param allocator The allocator to be associated with this array.
-       */
-      explicit Array( const Array& array, const AllocatorType& allocator );
-
-      /**
-       * \brief Copy constructor (makes a deep copy).
-       *
-       * \param array The array to be copied.
-       * \param begin The first index which should be copied.
-       * \param size The number of elements that should be copied.
-       * \param allocator The allocator to be associated with this array.
-       */
-      Array( const Array& array,
-             IndexType begin,
-             IndexType size = 0,
-             const AllocatorType& allocator = AllocatorType() );
-
-      /**
-       * \brief Move constructor for initialization from \e rvalues.
-       *
-       * \param array The array to be moved.
-       */
-      Array( Array&& array );
-
-
-      /**
-       * \brief Copy constructor from array with different template parameters.
-       *
-       * \tparam Value_ Value type of the input array.
-       * \tparam Device_ Device type of the input array.
-       * \tparam Index_ Index type of the input array.
-       * \tparam Allocator_ Allocator type of the input array.
-       * \param a the input array.
-       */
-      template< typename Value_,
-                typename Device_,
-                typename Index_,
-                typename Allocator_ >
-      explicit Array( const Array< Value_, Device_, Index_, Allocator_ >& a );
-
-      /**
-       * \brief Constructor which initializes the array by copying elements from
-       * \ref std::initializer_list, e.g. `{...}`.
-       *
-       * \param list The initializer list containing elements to be copied.
-       * \param allocator The allocator to be associated with this array.
-       */
-      template< typename InValue >
-      Array( const std::initializer_list< InValue >& list,
-             const AllocatorType& allocator = AllocatorType() );
-
-      /**
-       * \brief Constructor which initializes the array by copying elements from
-       * \ref std::list.
-       *
-       * \param list The STL list containing elements to be copied.
-       * \param allocator The allocator to be associated with this array.
-       */
-      template< typename InValue >
-      Array( const std::list< InValue >& list,
-             const AllocatorType& allocator = AllocatorType() );
-
-
-      /**
-       * \brief Constructor which initializes the array by copying elements from
-       * \ref std::vector.
-       *
-       * \param vector The STL vector containing elements to be copied.
-       * \param allocator The allocator to be associated with this array.
-       */
-      template< typename InValue >
-      Array( const std::vector< InValue >& vector,
-             const AllocatorType& allocator = AllocatorType() );
-
-
-      /**
-       * \brief Returns the allocator associated with the array.
-       */
-      AllocatorType getAllocator() const;
-
-      /**
-       * \brief Returns a \ref String representation of the array type in C++ style,
-       * with a placeholder in place of \e Device and \e Allocator.
-       */
-      static String getSerializationType();
-
-      /**
-       * \brief Returns a \ref String representation of the array type in C++ style,
-       * with a placeholder in place of \e Device and \e Allocator.
-       */
-      virtual String getSerializationTypeVirtual() const;
-
-      /**
-       * \brief Method for resizing the array.
-       *
-       * The method resizes the array to the given size:
-       *
-       * - If the current size is greater than count, the array is reduced to
-       *   its first \e size elements.
-       * - If the current size is less than \e size, additional elements are
-       *   appended (see the note below on initialization).
-       * - If the current size is equal to \e size, nothing happens.
-       *
-       * If the array size changes, the current data will be deallocated, thus
-       * all pointers and views to the array alements will become invalid.
-       *
-       * Note that this method differs from \ref std::vector::resize with respect
-       * to the initialization of array elements:
-       *
-       * - if \e ValueType is a [fundamental type](https://en.cppreference.com/w/cpp/types/is_fundamental),
-       *   the elements are [default-initialized](https://en.cppreference.com/w/cpp/language/default_initialization)
-       *   (i.e., the elements are initialized to indeterminate values).
-       * - otherwise, the elements are [value-initialized](https://en.cppreference.com/w/cpp/language/value_initialization)
-       *   (like in \ref std::vector::resize).
-       *
-       * \param size The new size of the array.
-       */
-      void resize( IndexType size );
-
-      /**
-       * \brief Method for resizing the array with an initial value.
-       *
-       * The method resizes the array to the given size:
-       *
-       * - If the current size is greater than count, the array is reduced to
-       *   its first \e size elements.
-       * - If the current size is less than \e size, additional copies of
-       *   \e value are appended.
-       * - If the current size is equal to \e size, nothing happens.
-       *
-       * If the array size changes, the current data will be deallocated, thus
-       * all pointers and views to the array alements will become invalid.
-       *
-       * \param size The new size of the array.
-       * \param value The value to initialize new elements with.
-       */
-      void resize( IndexType size, ValueType value );
-
-      /**
-       * \brief Method for setting the array size.
-       *
-       * This method behaves almost like \ref resize, but when the array size
-       * is changed, old elements are not copied to the new memory location.
-       * Hence, this is a shortcut for deallocating the array with \e resize(0)
-       * followed by setting the new size with \e resize(size)
-       *
-       * \param size The new size of the array.
-       */
-      void setSize( IndexType size );
-
-      /**
-       * \brief Returns the current array size.
-       *
-       * This method can be called from device kernels.
-       */
-      __cuda_callable__ IndexType getSize() const;
-
-      /**
-       * \brief Sets the same size as the size of an existing array.
-       *
-       * If the array size changes, the current data will be deallocated, thus
-       * all pointers and views to the array alements will become invalid.
-       *
-       * Note that this method uses \ref setSize rather than \ref resize.
-       *
-       * \tparam ArrayT The type of the parameter can be any type which provides
-       *         the method \ref getSize() with the same signature as \e Array.
-       * \param array The array whose size is to be taken.
-       */
-      template< typename ArrayT >
-      void setLike( const ArrayT& array );
-
-      /**
-       * \brief Returns a modifiable view of the array.
-       *
-       * By default, a view for the whole array is returned. If \e begin or
-       * \e end is set to a non-zero value, a view only for the sub-interval
-       * `[begin, end)` is returned.
-       *
-       * \param begin The beginning of the array sub-interval. It is 0 by
-       *              default.
-       * \param end The end of the array sub-interval. The default value is 0
-       *            which is, however, replaced with the array size.
-       */
-      ViewType getView( IndexType begin = 0, IndexType end = 0 );
-
-      /**
-       * \brief Returns a non-modifiable view of the array.
-       *
-       * By default, a view for the whole array is returned. If \e begin or
-       * \e end is set to a non-zero value, a view only for the sub-interval
-       * `[begin, end)` is returned.
-       *
-       * \param begin The beginning of the array sub-interval. It is 0 by
-       *              default.
-       * \param end The end of the array sub-interval. The default value is 0
-       *            which is, however, replaced with the array size.
-       */
-      ConstViewType getConstView( IndexType begin = 0, IndexType end = 0 ) const;
-
-      /**
-       * \brief Conversion operator to a modifiable view of the array.
-       */
-      operator ViewType();
-
-      /**
-       * \brief Conversion operator to a non-modifiable view of the array.
-       */
-      operator ConstViewType() const;
-
-      /**
-       * \brief Swaps this array with another.
-       *
-       * Swapping is done in a shallow way, i.e. only pointers and sizes are
-       * swapped.
-       *
-       * \param array The array to be swapped with this array.
-       */
-      void swap( Array& array );
-
-      /**
-       * \brief Resets the array to the empty state.
-       *
-       * The current data will be deallocated, thus all pointers and views to
-       * the array elements will become invalid.
-       */
-      void reset();
-
-      /**
-       * \brief Returns \e true if the current array size is zero.
-       *
-       * This method can be called from device kernels.
-       */
-      __cuda_callable__
-      bool empty() const;
-
-      /**
-       * \brief Returns a \e const-qualified raw pointer to the data.
-       *
-       * This method can be called from device kernels.
-       */
-      __cuda_callable__ const Value* getData() const;
-
-      /**
-       * \brief Returns a raw pointer to the data.
-       *
-       * This method can be called from device kernels.
-       */
-      __cuda_callable__ Value* getData();
-
-      /**
-       * \brief Returns a \e const-qualified raw pointer to the data.
-       *
-       * Use this method in algorithms where you want to emphasize that
-       * C-style array pointer is required.
-       *
-       * This method can be called from device kernels.
-       */
-      __cuda_callable__ const Value* getArrayData() const;
-
-      /**
-       * \brief Returns a raw pointer to the data.
-       *
-       * Use this method in algorithms where you want to emphasize that
-       * C-style array pointer is required.
-       *
-       * This method can be called from device kernels.
-       */
-      __cuda_callable__ Value* getArrayData();
-
-
-      /**
-       * \brief Sets the value of the \e i-th element to \e v.
-       *
-       * This method can be called from both the host system and the device
-       * where the array is allocated.
-       *
-       * \param i The index of the element to be set.
-       * \param value The new value of the element.
-       */
-      __cuda_callable__
-      void setElement( IndexType i, ValueType value );
-
-      /**
-       * \brief Returns the value of the \e i-th element.
-       *
-       * This method can be called from both the host system and the device
-       * where the array is allocated.
-       *
-       * \param i The index of the element to be returned.
-       */
-      __cuda_callable__
-      ValueType getElement( IndexType i ) const;
-
-      /**
-       * \brief Accesses the \e i-th element of the array.
-       *
-       * This method can be called only from the device which has direct access
-       * to the memory space where the array was allocated. For example, if the
-       * array was allocated in the host memory, it can be called only from
-       * host, and if the array was allocated in the device memory, it can be
-       * called only from device kernels. If NDEBUG is not defined, assertions
-       * inside this methods performs runtime checks for cross-device memory
-       * accesses which lead to segmentation fault. If you need to do just a
-       * pointer arithmetics use \e getData instead.
-       *
-       * \param i The index of the element to be accessed.
-       * \return Reference to the \e i-th element.
-       */
-      __cuda_callable__ Value& operator[]( IndexType i );
-
-      /**
-       * \brief Accesses the \e i-th element of the array.
-       *
-       * This method can be called only from the device which has direct access
-       * to the memory space where the array was allocated. For example, if the
-       * array was allocated in the host memory, it can be called only from
-       * host, and if the array was allocated in the device memory, it can be
-       * called only from device kernels. If NDEBUG is not defined, assertions
-       * inside this methods performs runtime checks for cross-device memory
-       * accesses which lead to segmentation fault. If you need to do just a
-       * pointer arithmetics use \e getData instead.
-       *
-       * \param i The index of the element to be accessed.
-       * \return Constant reference to the \e i-th element.
-       */
-      __cuda_callable__ const Value& operator[]( IndexType i ) const;
-
-      /**
-       * \brief Accesses the \e i-th element of the array.
-       *
-       * Equivalent to \ref operator[], with the same notes and caveats.
-       */
-      __cuda_callable__ Value& operator()( IndexType i );
-
-      /**
-       * \brief Accesses the \e i-th element of the array.
-       *
-       * Equivalent to \ref operator[], with the same notes and caveats.
-       */
-      __cuda_callable__ const Value& operator()( IndexType i ) const;
-
-      /**
-       * \brief Copy-assignment operator for copying data from another array.
-       *
-       * \param array Reference to the source array.
-       * \return Reference to this array.
-       */
-      Array& operator=( const Array& array );
-
-      /**
-       * \brief Move-assignment operator for acquiring data from \e rvalues.
-       *
-       * \param array Reference to the source array.
-       * \return Reference to this array.
-       */
-      Array& operator=( Array&& array );
-
-      /**
-       * \brief Assigns either array-like container or a single value.
-       *
-       * If \e T is an array type, e.g. \ref Array, \ref ArrayView,
-       * \ref StaticArray, \ref Vector, \ref VectorView, or \ref StaticVector,
-       * the elements from \e data are copied into this array. Otherwise, if it
-       * is a type convertible to \ref ValueType, all array elements are set to
-       * the value \e data.
-       *
-       * \tparam T The type of the source array or value.
-       * \param data Reference to the source array or value.
-       * \return Reference to this array.
-       */
-      template< typename T,
-                typename...,
-                typename = std::enable_if_t< std::is_convertible< T, ValueType >::value || IsArrayType< T >::value > >
-      Array& operator=( const T& data );
-
-      /**
-       * \brief Copies elements from \ref std::list to this array.
-       *
-       * \param list The STL list containing elements to be copied.
-       * \return Reference to this array.
-       */
-      template< typename InValue >
-      Array& operator=( const std::list< InValue >& list );
-
-      /**
-       * \brief Copies elements from \ref std::vector to this array.
-       *
-       * \param list The STL vector containing elements to be copied.
-       * \return Reference to this array.
-       */
-      template< typename InValue >
-      Array& operator=( const std::vector< InValue >& vector );
-
-      /**
-       * \brief Compares the array with another array-like container.
-       *
-       * \tparam ArrayT The type of the parameter can be any array-like
-       *         container, e.g. \ref Array, \ref ArrayView, \ref Vector,
-       *         \ref VectorView, etc.
-       * \param array Reference to the array-like container.
-       * \return `true` if both arrays are element-wise equal and `false`
-       *         otherwise.
-       */
-      template< typename ArrayT >
-      bool operator==( const ArrayT& array ) const;
-
-      /**
-       * \brief Compares the array with another array-like container.
-       *
-       * \tparam ArrayT The type of the parameter can be any array-like
-       *         container, e.g. \ref Array, \ref ArrayView, \ref Vector,
-       *         \ref VectorView, etc.
-       * \param array Reference to the array-like container.
-       * \return The negated result of \ref operator==.
-       */
-      template< typename ArrayT >
-      bool operator!=( const ArrayT& array ) const;
-
-      /**
-       * \brief Sets elements of the array to given value.
-       *
-       * By default, all array elements are set to the given value. If \e begin
-       * or \e end is set to a non-zero value, only elements in the sub-interval
-       * `[begin, end)` are set.
-       *
-       * \param value The new value for the array elements.
-       * \param begin The beginning of the array sub-interval. It is 0 by
-       *              default.
-       * \param end The end of the array sub-interval. The default value is 0
-       *            which is, however, replaced with the array size.
-       */
-      void setValue( ValueType value,
-                     IndexType begin = 0,
-                     IndexType end = 0 );
-
-      /**
-       * \brief Process the lambda function \e f for each array element in interval [ \e begin, \e end).
-       *
-       * The lambda function is supposed to be declared as
-       *
-       * ```
-       * f( IndexType elementIdx, ValueType& elementValue )
-       * ```
-       *
-       * where
-       *
-       * - \e elementIdx is an index of the array element being currently processed
-       * - \e elementValue is a value of the array element being currently processed
-       *
-       * This is performed at the same place where the array is allocated,
-       * i.e. it is efficient even on GPU.
-       *
-       * \param begin The beginning of the array elements interval.
-       * \param end The end of the array elements interval.
-       * \param f The lambda function to be processed.
-       *
-       * \par Example
-       * \include Containers/ArrayExample_forElements.cpp
-       * \par Output
-       * \include ArrayExample_forElements.out
-       *
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function&& f );
-
-      /**
-       * \brief Process the lambda function \e f for each array element in interval [ \e begin, \e end) for constant instances of the array.
-       *
-       * The lambda function is supposed to be declared as
-       *
-       * ```
-       * f( IndexType elementIdx, const ValueType& elementValue )
-       * ```
-       *
-       * where
-       *
-       * - \e elementIdx is an index of the array element being currently processed
-       * - \e elementValue is a value of the array element being currently processed
-       *
-       * This is performed at the same place where the array is allocated,
-       * i.e. it is efficient even on GPU.
-       *
-       * \param begin The beginning of the array elements interval.
-       * \param end The end of the array elements interval.
-       * \param f The lambda function to be processed.
-       *
-       * \par Example
-       * \include Containers/ArrayExample_forElements.cpp
-       * \par Output
-       * \include ArrayExample_forElements.out
-       *
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function&& f ) const;
-
-      /**
-       * \brief Process the lambda function \e f for each array element.
-       *
-       * The lambda function is supposed to be declared as
-       *
-       * ```
-       * f( IndexType elementIdx, ValueType& elementValue )
-       * ```
-       *
-       * where
-       *
-       * - \e elementIdx is an index of the array element being currently processed
-       * - \e elementValue is a value of the array element being currently processed
-       *
-       * This is performed at the same place where the array is allocated,
-       * i.e. it is efficient even on GPU.
-       *
-       * \param f The lambda function to be processed.
-       *
-       * \par Example
-       * \include Containers/ArrayExample_forElements.cpp
-       * \par Output
-       * \include ArrayExample_forElements.out
-       *
-       */
-      template< typename Function >
-      void forAllElements( Function&& f );
-
-      /**
-       * \brief Process the lambda function \e f for each array element for constant instances.
-       *
-       * The lambda function is supposed to be declared as
-       *
-       * ```
-       * f( IndexType elementIdx, const ValueType& elementValue )
-       * ```
-       *
-       * where
-       *
-       * - \e elementIdx is an index of the array element being currently processed
-       * - \e elementValue is a value of the array element being currently processed
-       *
-       * This is performed at the same place where the array is allocated,
-       * i.e. it is efficient even on GPU.
-       *
-       * \param f The lambda function to be processed.
-       *
-       * \par Example
-       * \include Containers/ArrayExample_forElements.cpp
-       * \par Output
-       * \include ArrayExample_forElements.out
-       *
-       */
-      template< typename Function >
-      void forAllElements( Function&& f ) const;
-
-      /**
-       * \brief Method for saving the array to a binary file \e fileName.
-       *
-       * \param fileName The output file name.
-       */
-      void save( const String& fileName ) const;
-
-      /**
-       * \brief Method for loading the array from a binary file \e fileName.
-       *
-       * \param fileName The input file name.
-       */
-      void load( const String& fileName );
-
-      /** \brief Destructor. */
-      virtual ~Array();
-
-   protected:
-
-      /** \brief Internal method for releasing (deallocating) array data. */
-      void releaseData();
-
-      /** \brief Internal method for reallocating array elements. Used only
-       * from the two overloads of \ref resize.
-       */
-      void reallocate( IndexType size );
-
-      /** \brief Pointer to the data. */
-      Value* data = nullptr;
-
-      /** \brief Number of elements in the array. */
-      IndexType size = 0;
-
-      /**
-       * \brief The internal allocator instance.
-       */
-      Allocator allocator;
+   static_assert( std::is_same< std::remove_cv_t< Value >, std::remove_cv_t< typename Allocator::value_type > >::value,
+                  "Mismatch of Array::Value and Allocator::value_type. The type must be the same." );
+
+public:
+   /**
+    * \brief Type of elements stored in this array.
+    */
+   using ValueType = Value;
+
+   /**
+    * \brief Device where the array is allocated.
+    *
+    * See \ref Devices::Host or \ref Devices::Cuda.
+    */
+   using DeviceType = Device;
+
+   /**
+    * \brief Type being used for the array elements indexing.
+    */
+   using IndexType = Index;
+
+   /**
+    * \brief Allocator type used for allocating this array.
+    *
+    * See \ref Allocators::Cuda, \ref Allocators::CudaHost, \ref Allocators::CudaManaged, \ref Allocators::Host or \ref
+    * Allocators:Default.
+    */
+   using AllocatorType = Allocator;
+
+   /**
+    * \brief Compatible ArrayView type.
+    */
+   using ViewType = ArrayView< Value, Device, Index >;
+
+   /**
+    * \brief Compatible constant ArrayView type.
+    */
+   using ConstViewType = ArrayView< std::add_const_t< Value >, Device, Index >;
+
+   /**
+    * \brief A template which allows to quickly obtain an \ref Array type with changed template parameters.
+    */
+   template< typename _Value,
+             typename _Device = Device,
+             typename _Index = Index,
+             typename _Allocator = typename Allocators::Default< _Device >::template Allocator< _Value > >
+   using Self = Array< _Value, _Device, _Index, _Allocator >;
+
+   /**
+    * \brief Constructs an empty array with zero size.
+    */
+   Array() = default;
+
+   /**
+    * \brief Constructs an empty array and sets the provided allocator.
+    *
+    * \param allocator The allocator to be associated with this array.
+    */
+   explicit Array( const AllocatorType& allocator );
+
+   /**
+    * \brief Constructs an array with given size.
+    *
+    * \param size The number of array elements to be allocated.
+    * \param allocator The allocator to be associated with this array.
+    */
+   explicit Array( IndexType size, const AllocatorType& allocator = AllocatorType() );
+
+   /**
+    * \brief Constructs an array with given size and value.
+    *
+    * \param size The number of array elements to be allocated.
+    * \param value The value all elements will be set to.
+    * \param allocator The allocator to be associated with this array.
+    */
+   explicit Array( IndexType size, ValueType value, const AllocatorType& allocator = AllocatorType() );
+
+   /**
+    * \brief Constructs an array with given size and copies data from given
+    * pointer.
+    *
+    * \param data The pointer to the data to be copied to the array.
+    * \param size The number of array elements to be copied to the array.
+    * \param allocator The allocator to be associated with this array.
+    */
+   Array( ValueType* data, IndexType size, const AllocatorType& allocator = AllocatorType() );
+
+   /**
+    * \brief Copy constructor (makes a deep copy).
+    *
+    * \param array The array to be copied.
+    */
+   explicit Array( const Array& array );
+
+   /**
+    * \brief Copy constructor with a specific allocator (makes a deep copy).
+    *
+    * \param array The array to be copied.
+    * \param allocator The allocator to be associated with this array.
+    */
+   explicit Array( const Array& array, const AllocatorType& allocator );
+
+   /**
+    * \brief Copy constructor (makes a deep copy).
+    *
+    * \param array The array to be copied.
+    * \param begin The first index which should be copied.
+    * \param size The number of elements that should be copied.
+    * \param allocator The allocator to be associated with this array.
+    */
+   Array( const Array& array, IndexType begin, IndexType size = 0, const AllocatorType& allocator = AllocatorType() );
+
+   /**
+    * \brief Move constructor for initialization from \e rvalues.
+    *
+    * \param array The array to be moved.
+    */
+   Array( Array&& array ) noexcept;
+
+   /**
+    * \brief Copy constructor from array with different template parameters.
+    *
+    * \tparam Value_ Value type of the input array.
+    * \tparam Device_ Device type of the input array.
+    * \tparam Index_ Index type of the input array.
+    * \tparam Allocator_ Allocator type of the input array.
+    * \param a the input array.
+    */
+   template< typename Value_, typename Device_, typename Index_, typename Allocator_ >
+   explicit Array( const Array< Value_, Device_, Index_, Allocator_ >& a );
+
+   /**
+    * \brief Constructor which initializes the array by copying elements from
+    * \ref std::initializer_list, e.g. `{...}`.
+    *
+    * \param list The initializer list containing elements to be copied.
+    * \param allocator The allocator to be associated with this array.
+    */
+   template< typename InValue >
+   Array( const std::initializer_list< InValue >& list, const AllocatorType& allocator = AllocatorType() );
+
+   /**
+    * \brief Constructor which initializes the array by copying elements from
+    * \ref std::list.
+    *
+    * \param list The STL list containing elements to be copied.
+    * \param allocator The allocator to be associated with this array.
+    */
+   template< typename InValue >
+   Array( const std::list< InValue >& list, const AllocatorType& allocator = AllocatorType() );
+
+   /**
+    * \brief Constructor which initializes the array by copying elements from
+    * \ref std::vector.
+    *
+    * \param vector The STL vector containing elements to be copied.
+    * \param allocator The allocator to be associated with this array.
+    */
+   template< typename InValue >
+   Array( const std::vector< InValue >& vector, const AllocatorType& allocator = AllocatorType() );
+
+   /**
+    * \brief Returns the allocator associated with the array.
+    */
+   AllocatorType
+   getAllocator() const;
+
+   /**
+    * \brief Returns a \ref String representation of the array type in C++ style,
+    * with a placeholder in place of \e Device and \e Allocator.
+    */
+   static std::string
+   getSerializationType();
+
+   /**
+    * \brief Returns a \ref String representation of the array type in C++ style,
+    * with a placeholder in place of \e Device and \e Allocator.
+    */
+   virtual std::string
+   getSerializationTypeVirtual() const;
+
+   /**
+    * \brief Method for resizing the array.
+    *
+    * The method resizes the array to the given size:
+    *
+    * - If the current size is greater than count, the array is reduced to
+    *   its first \e size elements.
+    * - If the current size is less than \e size, additional elements are
+    *   appended (see the note below on initialization).
+    * - If the current size is equal to \e size, nothing happens.
+    *
+    * If the array size changes, the current data will be deallocated, thus
+    * all pointers and views to the array alements will become invalid.
+    *
+    * Note that this method differs from \ref std::vector::resize with respect
+    * to the initialization of array elements:
+    *
+    * - if \e ValueType is a [fundamental type](https://en.cppreference.com/w/cpp/types/is_fundamental),
+    *   the elements are [default-initialized](https://en.cppreference.com/w/cpp/language/default_initialization)
+    *   (i.e., the elements are initialized to indeterminate values).
+    * - otherwise, the elements are [value-initialized](https://en.cppreference.com/w/cpp/language/value_initialization)
+    *   (like in \ref std::vector::resize).
+    *
+    * \param size The new size of the array.
+    */
+   void
+   resize( IndexType size );
+
+   /**
+    * \brief Method for resizing the array with an initial value.
+    *
+    * The method resizes the array to the given size:
+    *
+    * - If the current size is greater than count, the array is reduced to
+    *   its first \e size elements.
+    * - If the current size is less than \e size, additional copies of
+    *   \e value are appended.
+    * - If the current size is equal to \e size, nothing happens.
+    *
+    * If the array size changes, the current data will be deallocated, thus
+    * all pointers and views to the array alements will become invalid.
+    *
+    * \param size The new size of the array.
+    * \param value The value to initialize new elements with.
+    */
+   void
+   resize( IndexType size, ValueType value );
+
+   /**
+    * \brief Method for setting the array size.
+    *
+    * This method behaves almost like \ref resize, but when the array size
+    * is changed, old elements are not copied to the new memory location.
+    * Hence, this is a shortcut for deallocating the array with \e resize(0)
+    * followed by setting the new size with \e resize(size)
+    *
+    * \param size The new size of the array.
+    */
+   void
+   setSize( IndexType size );
+
+   /**
+    * \brief Returns the current array size.
+    *
+    * This method can be called from device kernels.
+    */
+   __cuda_callable__
+   IndexType
+   getSize() const;
+
+   /**
+    * \brief Sets the same size as the size of an existing array.
+    *
+    * If the array size changes, the current data will be deallocated, thus
+    * all pointers and views to the array alements will become invalid.
+    *
+    * Note that this method uses \ref setSize rather than \ref resize.
+    *
+    * \tparam ArrayT The type of the parameter can be any type which provides
+    *         the method \ref getSize() with the same signature as \e Array.
+    * \param array The array whose size is to be taken.
+    */
+   template< typename ArrayT >
+   void
+   setLike( const ArrayT& array );
+
+   /**
+    * \brief Returns a modifiable view of the array.
+    *
+    * By default, a view for the whole array is returned. If \e begin or
+    * \e end is set to a non-zero value, a view only for the sub-interval
+    * `[begin, end)` is returned.
+    *
+    * \param begin The beginning of the array sub-interval. It is 0 by
+    *              default.
+    * \param end The end of the array sub-interval. The default value is 0
+    *            which is, however, replaced with the array size.
+    */
+   ViewType
+   getView( IndexType begin = 0, IndexType end = 0 );
+
+   /**
+    * \brief Returns a non-modifiable view of the array.
+    *
+    * By default, a view for the whole array is returned. If \e begin or
+    * \e end is set to a non-zero value, a view only for the sub-interval
+    * `[begin, end)` is returned.
+    *
+    * \param begin The beginning of the array sub-interval. It is 0 by
+    *              default.
+    * \param end The end of the array sub-interval. The default value is 0
+    *            which is, however, replaced with the array size.
+    */
+   ConstViewType
+   getConstView( IndexType begin = 0, IndexType end = 0 ) const;
+
+   /**
+    * \brief Conversion operator to a modifiable view of the array.
+    */
+   operator ViewType();
+
+   /**
+    * \brief Conversion operator to a non-modifiable view of the array.
+    */
+   operator ConstViewType() const;
+
+   /**
+    * \brief Swaps this array with another.
+    *
+    * Swapping is done in a shallow way, i.e. only pointers and sizes are
+    * swapped.
+    *
+    * \param array The array to be swapped with this array.
+    */
+   void
+   swap( Array& array );
+
+   /**
+    * \brief Resets the array to the empty state.
+    *
+    * The current data will be deallocated, thus all pointers and views to
+    * the array elements will become invalid.
+    */
+   void
+   reset();
+
+   /**
+    * \brief Returns \e true if the current array size is zero.
+    *
+    * This method can be called from device kernels.
+    */
+   __cuda_callable__
+   bool
+   empty() const;
+
+   /**
+    * \brief Returns a \e const-qualified raw pointer to the data.
+    *
+    * This method can be called from device kernels.
+    */
+   __cuda_callable__
+   const Value*
+   getData() const;
+
+   /**
+    * \brief Returns a raw pointer to the data.
+    *
+    * This method can be called from device kernels.
+    */
+   __cuda_callable__
+   Value*
+   getData();
+
+   /**
+    * \brief Returns a \e const-qualified raw pointer to the data.
+    *
+    * Use this method in algorithms where you want to emphasize that
+    * C-style array pointer is required.
+    *
+    * This method can be called from device kernels.
+    */
+   __cuda_callable__
+   const Value*
+   getArrayData() const;
+
+   /**
+    * \brief Returns a raw pointer to the data.
+    *
+    * Use this method in algorithms where you want to emphasize that
+    * C-style array pointer is required.
+    *
+    * This method can be called from device kernels.
+    */
+   __cuda_callable__
+   Value*
+   getArrayData();
+
+   /**
+    * \brief Sets the value of the \e i-th element to \e v.
+    *
+    * This method can be called from both the host system and the device
+    * where the array is allocated.
+    *
+    * \param i The index of the element to be set.
+    * \param value The new value of the element.
+    */
+   __cuda_callable__
+   void
+   setElement( IndexType i, ValueType value );
+
+   /**
+    * \brief Returns the value of the \e i-th element.
+    *
+    * This method can be called from both the host system and the device
+    * where the array is allocated.
+    *
+    * \param i The index of the element to be returned.
+    */
+   __cuda_callable__
+   ValueType
+   getElement( IndexType i ) const;
+
+   /**
+    * \brief Accesses the \e i-th element of the array.
+    *
+    * This method can be called only from the device which has direct access
+    * to the memory space where the array was allocated. For example, if the
+    * array was allocated in the host memory, it can be called only from
+    * host, and if the array was allocated in the device memory, it can be
+    * called only from device kernels. If NDEBUG is not defined, assertions
+    * inside this methods performs runtime checks for cross-device memory
+    * accesses which lead to segmentation fault. If you need to do just a
+    * pointer arithmetics use \e getData instead.
+    *
+    * \param i The index of the element to be accessed.
+    * \return Reference to the \e i-th element.
+    */
+   __cuda_callable__
+   Value&
+   operator[]( IndexType i );
+
+   /**
+    * \brief Accesses the \e i-th element of the array.
+    *
+    * This method can be called only from the device which has direct access
+    * to the memory space where the array was allocated. For example, if the
+    * array was allocated in the host memory, it can be called only from
+    * host, and if the array was allocated in the device memory, it can be
+    * called only from device kernels. If NDEBUG is not defined, assertions
+    * inside this methods performs runtime checks for cross-device memory
+    * accesses which lead to segmentation fault. If you need to do just a
+    * pointer arithmetics use \e getData instead.
+    *
+    * \param i The index of the element to be accessed.
+    * \return Constant reference to the \e i-th element.
+    */
+   __cuda_callable__
+   const Value&
+   operator[]( IndexType i ) const;
+
+   /**
+    * \brief Accesses the \e i-th element of the array.
+    *
+    * Equivalent to \ref operator[], with the same notes and caveats.
+    */
+   __cuda_callable__
+   Value&
+   operator()( IndexType i );
+
+   /**
+    * \brief Accesses the \e i-th element of the array.
+    *
+    * Equivalent to \ref operator[], with the same notes and caveats.
+    */
+   __cuda_callable__
+   const Value&
+   operator()( IndexType i ) const;
+
+   /**
+    * \brief Copy-assignment operator for copying data from another array.
+    *
+    * \param array Reference to the source array.
+    * \return Reference to this array.
+    */
+   Array&
+   operator=( const Array& array );
+
+   /**
+    * \brief Move-assignment operator for acquiring data from \e rvalues.
+    *
+    * \param array Reference to the source array.
+    * \return Reference to this array.
+    */
+   Array&
+   operator=( Array&& array ) noexcept;
+
+   /**
+    * \brief Assigns either array-like container or a single value.
+    *
+    * If \e T is an array type, e.g. \ref Array, \ref ArrayView,
+    * \ref StaticArray, \ref Vector, \ref VectorView, or \ref StaticVector,
+    * the elements from \e data are copied into this array. Otherwise, if it
+    * is a type convertible to \ref ValueType, all array elements are set to
+    * the value \e data.
+    *
+    * \tparam T The type of the source array or value.
+    * \param data Reference to the source array or value.
+    * \return Reference to this array.
+    */
+   template< typename T,
+             typename...,
+             typename = std::enable_if_t< std::is_convertible< T, ValueType >::value || IsArrayType< T >::value > >
+   Array&
+   operator=( const T& data );
+
+   /**
+    * \brief Copies elements from \ref std::list to this array.
+    *
+    * \param list The STL list containing elements to be copied.
+    * \return Reference to this array.
+    */
+   template< typename InValue >
+   Array&
+   operator=( const std::list< InValue >& list );
+
+   /**
+    * \brief Copies elements from \ref std::vector to this array.
+    *
+    * \param list The STL vector containing elements to be copied.
+    * \return Reference to this array.
+    */
+   template< typename InValue >
+   Array&
+   operator=( const std::vector< InValue >& vector );
+
+   /**
+    * \brief Compares the array with another array-like container.
+    *
+    * \tparam ArrayT The type of the parameter can be any array-like
+    *         container, e.g. \ref Array, \ref ArrayView, \ref Vector,
+    *         \ref VectorView, etc.
+    * \param array Reference to the array-like container.
+    * \return `true` if both arrays are element-wise equal and `false`
+    *         otherwise.
+    */
+   template< typename ArrayT >
+   bool
+   operator==( const ArrayT& array ) const;
+
+   /**
+    * \brief Compares the array with another array-like container.
+    *
+    * \tparam ArrayT The type of the parameter can be any array-like
+    *         container, e.g. \ref Array, \ref ArrayView, \ref Vector,
+    *         \ref VectorView, etc.
+    * \param array Reference to the array-like container.
+    * \return The negated result of \ref operator==.
+    */
+   template< typename ArrayT >
+   bool
+   operator!=( const ArrayT& array ) const;
+
+   /**
+    * \brief Sets elements of the array to given value.
+    *
+    * By default, all array elements are set to the given value. If \e begin
+    * or \e end is set to a non-zero value, only elements in the sub-interval
+    * `[begin, end)` are set.
+    *
+    * \param value The new value for the array elements.
+    * \param begin The beginning of the array sub-interval. It is 0 by
+    *              default.
+    * \param end The end of the array sub-interval. The default value is 0
+    *            which is, however, replaced with the array size.
+    */
+   void
+   setValue( ValueType value, IndexType begin = 0, IndexType end = 0 );
+
+   /**
+    * \brief Process the lambda function \e f for each array element in interval [ \e begin, \e end).
+    *
+    * The lambda function is supposed to be declared as
+    *
+    * ```
+    * f( IndexType elementIdx, ValueType& elementValue )
+    * ```
+    *
+    * where
+    *
+    * - \e elementIdx is an index of the array element being currently processed
+    * - \e elementValue is a value of the array element being currently processed
+    *
+    * This is performed at the same place where the array is allocated,
+    * i.e. it is efficient even on GPU.
+    *
+    * \param begin The beginning of the array elements interval.
+    * \param end The end of the array elements interval.
+    * \param f The lambda function to be processed.
+    *
+    * \par Example
+    * \include Containers/ArrayExample_forElements.cpp
+    * \par Output
+    * \include ArrayExample_forElements.out
+    *
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function&& f );
+
+   /**
+    * \brief Process the lambda function \e f for each array element in interval [ \e begin, \e end) for constant instances of
+    * the array.
+    *
+    * The lambda function is supposed to be declared as
+    *
+    * ```
+    * f( IndexType elementIdx, const ValueType& elementValue )
+    * ```
+    *
+    * where
+    *
+    * - \e elementIdx is an index of the array element being currently processed
+    * - \e elementValue is a value of the array element being currently processed
+    *
+    * This is performed at the same place where the array is allocated,
+    * i.e. it is efficient even on GPU.
+    *
+    * \param begin The beginning of the array elements interval.
+    * \param end The end of the array elements interval.
+    * \param f The lambda function to be processed.
+    *
+    * \par Example
+    * \include Containers/ArrayExample_forElements.cpp
+    * \par Output
+    * \include ArrayExample_forElements.out
+    *
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function&& f ) const;
+
+   /**
+    * \brief Process the lambda function \e f for each array element.
+    *
+    * The lambda function is supposed to be declared as
+    *
+    * ```
+    * f( IndexType elementIdx, ValueType& elementValue )
+    * ```
+    *
+    * where
+    *
+    * - \e elementIdx is an index of the array element being currently processed
+    * - \e elementValue is a value of the array element being currently processed
+    *
+    * This is performed at the same place where the array is allocated,
+    * i.e. it is efficient even on GPU.
+    *
+    * \param f The lambda function to be processed.
+    *
+    * \par Example
+    * \include Containers/ArrayExample_forElements.cpp
+    * \par Output
+    * \include ArrayExample_forElements.out
+    *
+    */
+   template< typename Function >
+   void
+   forAllElements( Function&& f );
+
+   /**
+    * \brief Process the lambda function \e f for each array element for constant instances.
+    *
+    * The lambda function is supposed to be declared as
+    *
+    * ```
+    * f( IndexType elementIdx, const ValueType& elementValue )
+    * ```
+    *
+    * where
+    *
+    * - \e elementIdx is an index of the array element being currently processed
+    * - \e elementValue is a value of the array element being currently processed
+    *
+    * This is performed at the same place where the array is allocated,
+    * i.e. it is efficient even on GPU.
+    *
+    * \param f The lambda function to be processed.
+    *
+    * \par Example
+    * \include Containers/ArrayExample_forElements.cpp
+    * \par Output
+    * \include ArrayExample_forElements.out
+    *
+    */
+   template< typename Function >
+   void
+   forAllElements( Function&& f ) const;
+
+   /**
+    * \brief Method for saving the array to a binary file \e fileName.
+    *
+    * \param fileName The output file name.
+    */
+   void
+   save( const String& fileName ) const;
+
+   /**
+    * \brief Method for loading the array from a binary file \e fileName.
+    *
+    * \param fileName The input file name.
+    */
+   void
+   load( const String& fileName );
+
+   /** \brief Destructor. */
+   virtual ~Array();
+
+protected:
+   /** \brief Internal method for releasing (deallocating) array data. */
+   void
+   releaseData();
+
+   /** \brief Internal method for reallocating array elements. Used only
+    * from the two overloads of \ref resize.
+    */
+   void
+   reallocate( IndexType size );
+
+   /** \brief Pointer to the data. */
+   Value* data = nullptr;
+
+   /** \brief Number of elements in the array. */
+   IndexType size = 0;
+
+   /**
+    * \brief The internal allocator instance.
+    */
+   Allocator allocator;
 };
 
 /**
@@ -769,27 +803,32 @@ class Array
  * \return a reference on the output stream \ref std::ostream&.
  */
 template< typename Value, typename Device, typename Index, typename Allocator >
-std::ostream& operator<<( std::ostream& str, const Array< Value, Device, Index, Allocator >& array );
+std::ostream&
+operator<<( std::ostream& str, const Array< Value, Device, Index, Allocator >& array );
 
 /**
  * \brief Serialization of arrays into binary files.
  */
 template< typename Value, typename Device, typename Index, typename Allocator >
-File& operator<<( File& file, const Array< Value, Device, Index, Allocator >& array );
+File&
+operator<<( File& file, const Array< Value, Device, Index, Allocator >& array );
 
 template< typename Value, typename Device, typename Index, typename Allocator >
-File& operator<<( File&& file, const Array< Value, Device, Index, Allocator >& array );
+File&
+operator<<( File&& file, const Array< Value, Device, Index, Allocator >& array );
 
 /**
  * \brief Deserialization of arrays from binary files.
  */
 template< typename Value, typename Device, typename Index, typename Allocator >
-File& operator>>( File& file, Array< Value, Device, Index, Allocator >& array );
+File&
+operator>>( File& file, Array< Value, Device, Index, Allocator >& array );
 
 template< typename Value, typename Device, typename Index, typename Allocator >
-File& operator>>( File&& file, Array< Value, Device, Index, Allocator >& array );
+File&
+operator>>( File&& file, Array< Value, Device, Index, Allocator >& array );
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
 
 #include <TNL/Containers/Array.hpp>
diff --git a/src/TNL/Containers/Array.hpp b/src/TNL/Containers/Array.hpp
index 3a4a0830065664a7f8aa2ec83bf45dab0089cef2..ccebdda7a334e5c202af101ed8c71221240790d6 100644
--- a/src/TNL/Containers/Array.hpp
+++ b/src/TNL/Containers/Array.hpp
@@ -20,99 +20,60 @@
 namespace TNL {
 namespace Containers {
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-Array< Value, Device, Index, Allocator >::
-Array( Array&& array )
-: data( std::move(array.data) ),
-  size( std::move(array.size) ),
-  allocator( std::move(array.allocator) )
+template< typename Value, typename Device, typename Index, typename Allocator >
+Array< Value, Device, Index, Allocator >::Array( Array&& array ) noexcept
+: data( std::move( array.data ) ), size( std::move( array.size ) ), allocator( std::move( array.allocator ) )
 {
    array.data = nullptr;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-Array< Value, Device, Index, Allocator >::
-Array( const Allocator& allocator )
-: allocator( allocator )
-{
-}
+template< typename Value, typename Device, typename Index, typename Allocator >
+Array< Value, Device, Index, Allocator >::Array( const Allocator& allocator ) : allocator( allocator )
+{}
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-Array< Value, Device, Index, Allocator >::
-Array( IndexType size, const AllocatorType& allocator )
-: allocator( allocator )
+template< typename Value, typename Device, typename Index, typename Allocator >
+Array< Value, Device, Index, Allocator >::Array( IndexType size, const AllocatorType& allocator ) : allocator( allocator )
 {
    this->setSize( size );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-Array< Value, Device, Index, Allocator >::
-Array( IndexType size, ValueType value, const AllocatorType& allocator )
+template< typename Value, typename Device, typename Index, typename Allocator >
+Array< Value, Device, Index, Allocator >::Array( IndexType size, ValueType value, const AllocatorType& allocator )
 : allocator( allocator )
 {
    this->setSize( size );
    *this = value;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-Array< Value, Device, Index, Allocator >::
-Array( ValueType* data,
-       IndexType size,
-       const AllocatorType& allocator )
+template< typename Value, typename Device, typename Index, typename Allocator >
+Array< Value, Device, Index, Allocator >::Array( ValueType* data, IndexType size, const AllocatorType& allocator )
 : allocator( allocator )
 {
    this->setSize( size );
    Algorithms::MemoryOperations< Device >::copy( this->getData(), data, size );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-Array< Value, Device, Index, Allocator >::
-Array( const Array< Value, Device, Index, Allocator >& array )
+template< typename Value, typename Device, typename Index, typename Allocator >
+Array< Value, Device, Index, Allocator >::Array( const Array< Value, Device, Index, Allocator >& array )
 {
    this->setSize( array.getSize() );
    Algorithms::MemoryOperations< Device >::copy( this->getData(), array.getData(), array.getSize() );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-Array< Value, Device, Index, Allocator >::
-Array( const Array< Value, Device, Index, Allocator >& array,
-       const AllocatorType& allocator )
+template< typename Value, typename Device, typename Index, typename Allocator >
+Array< Value, Device, Index, Allocator >::Array( const Array< Value, Device, Index, Allocator >& array,
+                                                 const AllocatorType& allocator )
 : allocator( allocator )
 {
    this->setSize( array.getSize() );
    Algorithms::MemoryOperations< Device >::copy( this->getData(), array.getData(), array.getSize() );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-Array< Value, Device, Index, Allocator >::
-Array( const Array< Value, Device, Index, Allocator >& array,
-       IndexType begin,
-       IndexType size,
-       const AllocatorType& allocator )
+template< typename Value, typename Device, typename Index, typename Allocator >
+Array< Value, Device, Index, Allocator >::Array( const Array< Value, Device, Index, Allocator >& array,
+                                                 IndexType begin,
+                                                 IndexType size,
+                                                 const AllocatorType& allocator )
 : allocator( allocator )
 {
    if( size == 0 )
@@ -124,28 +85,16 @@ Array( const Array< Value, Device, Index, Allocator >& array,
    Algorithms::MemoryOperations< Device >::copy( this->getData(), &array.getData()[ begin ], size );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-      template< typename Value_,
-                typename Device_,
-                typename Index_,
-                typename Allocator_ >
-Array< Value, Device, Index, Allocator >::
-Array( const Array< Value_, Device_, Index_, Allocator_ >& a )
+template< typename Value, typename Device, typename Index, typename Allocator >
+template< typename Value_, typename Device_, typename Index_, typename Allocator_ >
+Array< Value, Device, Index, Allocator >::Array( const Array< Value_, Device_, Index_, Allocator_ >& a )
 {
    *this = a;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename InValue >
-Array< Value, Device, Index, Allocator >::
-Array( const std::initializer_list< InValue >& list,
-       const AllocatorType& allocator )
+template< typename Value, typename Device, typename Index, typename Allocator >
+template< typename InValue >
+Array< Value, Device, Index, Allocator >::Array( const std::initializer_list< InValue >& list, const AllocatorType& allocator )
 : allocator( allocator )
 {
    this->setSize( list.size() );
@@ -155,74 +104,48 @@ Array( const std::initializer_list< InValue >& list,
    Algorithms::MultiDeviceMemoryOperations< Device, Devices::Host >::copy( this->getData(), &( *list.begin() ), list.size() );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename InValue >
-Array< Value, Device, Index, Allocator >::
-Array( const std::list< InValue >& list,
-       const AllocatorType& allocator )
+template< typename Value, typename Device, typename Index, typename Allocator >
+template< typename InValue >
+Array< Value, Device, Index, Allocator >::Array( const std::list< InValue >& list, const AllocatorType& allocator )
 : allocator( allocator )
 {
    this->setSize( list.size() );
    Algorithms::MemoryOperations< Device >::copyFromIterator( this->getData(), this->getSize(), list.cbegin(), list.cend() );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename InValue >
-Array< Value, Device, Index, Allocator >::
-Array( const std::vector< InValue >& vector,
-       const AllocatorType& allocator )
+template< typename Value, typename Device, typename Index, typename Allocator >
+template< typename InValue >
+Array< Value, Device, Index, Allocator >::Array( const std::vector< InValue >& vector, const AllocatorType& allocator )
 : allocator( allocator )
 {
    this->setSize( vector.size() );
    Algorithms::MultiDeviceMemoryOperations< Device, Devices::Host >::copy( this->getData(), vector.data(), vector.size() );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 Allocator
-Array< Value, Device, Index, Allocator >::
-getAllocator() const
+Array< Value, Device, Index, Allocator >::getAllocator() const
 {
    return allocator;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-String
-Array< Value, Device, Index, Allocator >::
-getSerializationType()
+template< typename Value, typename Device, typename Index, typename Allocator >
+std::string
+Array< Value, Device, Index, Allocator >::getSerializationType()
 {
    return detail::ArrayIO< Value, Device, Index >::getSerializationType();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-String
-Array< Value, Device, Index, Allocator >::
-getSerializationTypeVirtual() const
+template< typename Value, typename Device, typename Index, typename Allocator >
+std::string
+Array< Value, Device, Index, Allocator >::getSerializationTypeVirtual() const
 {
    return this->getSerializationType();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 void
-Array< Value, Device, Index, Allocator >::
-releaseData()
+Array< Value, Device, Index, Allocator >::releaseData()
 {
    if( this->data ) {
       if( ! std::is_fundamental< ValueType >::value )
@@ -234,13 +157,9 @@ releaseData()
    this->size = 0;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 void
-Array< Value, Device, Index, Allocator >::
-reallocate( IndexType size )
+Array< Value, Device, Index, Allocator >::reallocate( IndexType size )
 {
    TNL_ASSERT_GE( size, (Index) 0, "Array size must be non-negative." );
 
@@ -262,8 +181,7 @@ reallocate( IndexType size )
          Algorithms::MemoryOperations< Device >::construct( this->data, size );
 
       this->size = size;
-      TNL_ASSERT_TRUE( this->data,
-                       "This should never happen - allocator did not throw on an error." );
+      TNL_ASSERT_TRUE( this->data, "This should never happen - allocator did not throw on an error." );
       return;
    }
 
@@ -271,20 +189,15 @@ reallocate( IndexType size )
    Array aux( size );
 
    // copy the old elements into aux
-   Algorithms::MemoryOperations< Device >::
-         copy( aux.getData(), this->getData(), TNL::min( this->size, size ) );
+   Algorithms::MemoryOperations< Device >::copy( aux.getData(), this->getData(), TNL::min( this->size, size ) );
 
    // swap *this with aux, old data will be released
    this->swap( aux );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 void
-Array< Value, Device, Index, Allocator >::
-resize( IndexType size )
+Array< Value, Device, Index, Allocator >::resize( IndexType size )
 {
    // remember the old size and reallocate the array
    const IndexType old_size = this->size;
@@ -296,13 +209,9 @@ resize( IndexType size )
          Algorithms::MemoryOperations< Device >::construct( this->data + old_size, size - old_size );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 void
-Array< Value, Device, Index, Allocator >::
-resize( IndexType size, ValueType value )
+Array< Value, Device, Index, Allocator >::resize( IndexType size, ValueType value )
 {
    // remember the old size and reallocate the array
    const IndexType old_size = this->size;
@@ -313,13 +222,9 @@ resize( IndexType size, ValueType value )
       Algorithms::MemoryOperations< Device >::construct( this->data + old_size, size - old_size, value );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 void
-Array< Value, Device, Index, Allocator >::
-setSize( IndexType size )
+Array< Value, Device, Index, Allocator >::setSize( IndexType size )
 {
    TNL_ASSERT_GE( size, (Index) 0, "Array size must be non-negative." );
 
@@ -332,275 +237,191 @@ setSize( IndexType size )
    this->resize( size );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 __cuda_callable__
 Index
-Array< Value, Device, Index, Allocator >::
-getSize() const
+Array< Value, Device, Index, Allocator >::getSize() const
 {
    return this->size;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename ArrayT >
+template< typename Value, typename Device, typename Index, typename Allocator >
+template< typename ArrayT >
 void
-Array< Value, Device, Index, Allocator >::
-setLike( const ArrayT& array )
+Array< Value, Device, Index, Allocator >::setLike( const ArrayT& array )
 {
    setSize( array.getSize() );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 typename Array< Value, Device, Index, Allocator >::ViewType
-Array< Value, Device, Index, Allocator >::
-getView( IndexType begin, IndexType end )
+Array< Value, Device, Index, Allocator >::getView( IndexType begin, IndexType end )
 {
    if( end == 0 )
       end = getSize();
    return ViewType( getData() + begin, end - begin );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 typename Array< Value, Device, Index, Allocator >::ConstViewType
-Array< Value, Device, Index, Allocator >::
-getConstView( IndexType begin, IndexType end ) const
+Array< Value, Device, Index, Allocator >::getConstView( IndexType begin, IndexType end ) const
 {
    if( end == 0 )
       end = getSize();
    return ConstViewType( getData() + begin, end - begin );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-Array< Value, Device, Index, Allocator >::
-operator ViewType()
+template< typename Value, typename Device, typename Index, typename Allocator >
+Array< Value, Device, Index, Allocator >::operator ViewType()
 {
    return getView();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-Array< Value, Device, Index, Allocator >::
-operator ConstViewType() const
+template< typename Value, typename Device, typename Index, typename Allocator >
+Array< Value, Device, Index, Allocator >::operator ConstViewType() const
 {
    return getConstView();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 void
-Array< Value, Device, Index, Allocator >::
-swap( Array< Value, Device, Index, Allocator >& array )
+Array< Value, Device, Index, Allocator >::swap( Array< Value, Device, Index, Allocator >& array )
 {
    TNL::swap( this->size, array.size );
    TNL::swap( this->data, array.data );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 void
-Array< Value, Device, Index, Allocator >::
-reset()
+Array< Value, Device, Index, Allocator >::reset()
 {
    this->releaseData();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-bool
-__cuda_callable__
-Array< Value, Device, Index, Allocator >::
-empty() const
+template< typename Value, typename Device, typename Index, typename Allocator >
+bool __cuda_callable__
+Array< Value, Device, Index, Allocator >::empty() const
 {
    return data == nullptr;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 __cuda_callable__
 const Value*
-Array< Value, Device, Index, Allocator >::
-getData() const
+Array< Value, Device, Index, Allocator >::getData() const
 {
    return this->data;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 __cuda_callable__
 Value*
-Array< Value, Device, Index, Allocator >::
-getData()
+Array< Value, Device, Index, Allocator >::getData()
 {
    return this->data;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 __cuda_callable__
 const Value*
-Array< Value, Device, Index, Allocator >::
-getArrayData() const
+Array< Value, Device, Index, Allocator >::getArrayData() const
 {
    return this->data;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 __cuda_callable__
 Value*
-Array< Value, Device, Index, Allocator >::
-getArrayData()
+Array< Value, Device, Index, Allocator >::getArrayData()
 {
    return this->data;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 __cuda_callable__
 void
-Array< Value, Device, Index, Allocator >::
-setElement( IndexType i, ValueType x )
+Array< Value, Device, Index, Allocator >::setElement( IndexType i, ValueType x )
 {
    TNL_ASSERT_GE( i, (Index) 0, "Element index must be non-negative." );
    TNL_ASSERT_LT( i, this->getSize(), "Element index is out of bounds." );
    Algorithms::MemoryOperations< Device >::setElement( &( this->data[ i ] ), x );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 __cuda_callable__
 Value
-Array< Value, Device, Index, Allocator >::
-getElement( IndexType i ) const
+Array< Value, Device, Index, Allocator >::getElement( IndexType i ) const
 {
    TNL_ASSERT_GE( i, (Index) 0, "Element index must be non-negative." );
    TNL_ASSERT_LT( i, this->getSize(), "Element index is out of bounds." );
-   return Algorithms::MemoryOperations< Device >::getElement( & ( this->data[ i ] ) );
+   return Algorithms::MemoryOperations< Device >::getElement( &( this->data[ i ] ) );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 __cuda_callable__
 Value&
-Array< Value, Device, Index, Allocator >::
-operator[]( IndexType i )
+Array< Value, Device, Index, Allocator >::operator[]( IndexType i )
 {
 #ifdef __CUDA_ARCH__
-   TNL_ASSERT_TRUE( (std::is_same< Device, Devices::Cuda >{}()), "Attempt to access data not allocated on CUDA device from CUDA device." );
+   TNL_ASSERT_TRUE( ( std::is_same< Device, Devices::Cuda >{}() ),
+                    "Attempt to access data not allocated on CUDA device from CUDA device." );
 #else
-   TNL_ASSERT_FALSE( (std::is_same< Device, Devices::Cuda >{}()), "Attempt to access data not allocated on the host from the host." );
+   TNL_ASSERT_FALSE( ( std::is_same< Device, Devices::Cuda >{}() ),
+                     "Attempt to access data not allocated on the host from the host." );
 #endif
    TNL_ASSERT_GE( i, (Index) 0, "Element index must be non-negative." );
    TNL_ASSERT_LT( i, this->getSize(), "Element index is out of bounds." );
    return this->data[ i ];
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 __cuda_callable__
 const Value&
-Array< Value, Device, Index, Allocator >::
-operator[]( IndexType i ) const
+Array< Value, Device, Index, Allocator >::operator[]( IndexType i ) const
 {
 #ifdef __CUDA_ARCH__
-   TNL_ASSERT_TRUE( (std::is_same< Device, Devices::Cuda >{}()), "Attempt to access data not allocated on CUDA device from CUDA device." );
+   TNL_ASSERT_TRUE( ( std::is_same< Device, Devices::Cuda >{}() ),
+                    "Attempt to access data not allocated on CUDA device from CUDA device." );
 #else
-   TNL_ASSERT_FALSE( (std::is_same< Device, Devices::Cuda >{}()), "Attempt to access data not allocated on the host from the host." );
+   TNL_ASSERT_FALSE( ( std::is_same< Device, Devices::Cuda >{}() ),
+                     "Attempt to access data not allocated on the host from the host." );
 #endif
    TNL_ASSERT_GE( i, (Index) 0, "Element index must be non-negative." );
    TNL_ASSERT_LT( i, this->getSize(), "Element index is out of bounds." );
    return this->data[ i ];
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 __cuda_callable__
 Value&
-Array< Value, Device, Index, Allocator >::
-operator()( IndexType i )
+Array< Value, Device, Index, Allocator >::operator()( IndexType i )
 {
    return operator[]( i );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 __cuda_callable__
 const Value&
-Array< Value, Device, Index, Allocator >::
-operator()( IndexType i ) const
+Array< Value, Device, Index, Allocator >::operator()( IndexType i ) const
 {
    return operator[]( i );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 Array< Value, Device, Index, Allocator >&
-Array< Value, Device, Index, Allocator >::
-operator=( const Array< Value, Device, Index, Allocator >& array )
+Array< Value, Device, Index, Allocator >::operator=( const Array< Value, Device, Index, Allocator >& array )
 {
-   //TNL_ASSERT_EQ( array.getSize(), this->getSize(), "Array sizes must be the same." );
+   // TNL_ASSERT_EQ( array.getSize(), this->getSize(), "Array sizes must be the same." );
    if( this->getSize() != array.getSize() )
       this->setLike( array );
    if( this->getSize() > 0 )
-      Algorithms::MemoryOperations< Device >::
-         copy( this->getData(),
-                     array.getData(),
-                     array.getSize() );
+      Algorithms::MemoryOperations< Device >::copy( this->getData(), array.getData(), array.getSize() );
    return *this;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 Array< Value, Device, Index, Allocator >&
-Array< Value, Device, Index, Allocator >::
-operator=( Array< Value, Device, Index, Allocator >&& array )
+Array< Value, Device, Index, Allocator >::operator=( Array< Value, Device, Index, Allocator >&& array ) noexcept
 {
    reset();
 
@@ -611,43 +432,30 @@ operator=( Array< Value, Device, Index, Allocator >&& array )
    return *this;
 }
 
-
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename T, typename..., typename >
+template< typename Value, typename Device, typename Index, typename Allocator >
+template< typename T, typename..., typename >
 Array< Value, Device, Index, Allocator >&
-Array< Value, Device, Index, Allocator >::
-operator=( const T& data )
+Array< Value, Device, Index, Allocator >::operator=( const T& data )
 {
    detail::ArrayAssignment< Array, T >::resize( *this, data );
    detail::ArrayAssignment< Array, T >::assign( *this, data );
    return *this;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename InValue >
+template< typename Value, typename Device, typename Index, typename Allocator >
+template< typename InValue >
 Array< Value, Device, Index, Allocator >&
-Array< Value, Device, Index, Allocator >::
-operator=( const std::list< InValue >& list )
+Array< Value, Device, Index, Allocator >::operator=( const std::list< InValue >& list )
 {
    this->setSize( list.size() );
    Algorithms::MemoryOperations< Device >::copyFromIterator( this->getData(), this->getSize(), list.cbegin(), list.cend() );
    return *this;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename InValue >
+template< typename Value, typename Device, typename Index, typename Allocator >
+template< typename InValue >
 Array< Value, Device, Index, Allocator >&
-Array< Value, Device, Index, Allocator >::
-operator=( const std::vector< InValue >& vector )
+Array< Value, Device, Index, Allocator >::operator=( const std::vector< InValue >& vector )
 {
    if( (std::size_t) this->getSize() != vector.size() )
       this->setSize( vector.size() );
@@ -655,141 +463,95 @@ operator=( const std::vector< InValue >& vector )
    return *this;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename ArrayT >
+template< typename Value, typename Device, typename Index, typename Allocator >
+template< typename ArrayT >
 bool
-Array< Value, Device, Index, Allocator >::
-operator==( const ArrayT& array ) const
+Array< Value, Device, Index, Allocator >::operator==( const ArrayT& array ) const
 {
    if( array.getSize() != this->getSize() )
       return false;
    if( this->getSize() == 0 )
       return true;
-   return Algorithms::MultiDeviceMemoryOperations< Device, typename ArrayT::DeviceType >::
-            compare( this->getData(), array.getData(), array.getSize() );
+   return Algorithms::MultiDeviceMemoryOperations< Device, typename ArrayT::DeviceType >::compare(
+      this->getData(), array.getData(), array.getSize() );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename ArrayT >
+template< typename Value, typename Device, typename Index, typename Allocator >
+template< typename ArrayT >
 bool
-Array< Value, Device, Index, Allocator >::
-operator!=( const ArrayT& array ) const
+Array< Value, Device, Index, Allocator >::operator!=( const ArrayT& array ) const
 {
    return ! ( *this == array );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 void
-Array< Value, Device, Index, Allocator >::
-setValue( ValueType v,
-          IndexType begin,
-          IndexType end )
+Array< Value, Device, Index, Allocator >::setValue( ValueType v, IndexType begin, IndexType end )
 {
    if( end == 0 )
       end = this->getSize();
    Algorithms::MemoryOperations< Device >::set( &this->getData()[ begin ], v, end - begin );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename Function >
+template< typename Value, typename Device, typename Index, typename Allocator >
+template< typename Function >
 void
-Array< Value, Device, Index, Allocator >::
-forElements( IndexType begin,
-             IndexType end,
-             Function&& f )
+Array< Value, Device, Index, Allocator >::forElements( IndexType begin, IndexType end, Function&& f )
 {
    this->getView().forElements( begin, end, f );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename Function >
+template< typename Value, typename Device, typename Index, typename Allocator >
+template< typename Function >
 void
-Array< Value, Device, Index, Allocator >::
-forElements( IndexType begin,
-             IndexType end,
-             Function&& f ) const
+Array< Value, Device, Index, Allocator >::forElements( IndexType begin, IndexType end, Function&& f ) const
 {
    this->getConstView().forElements( begin, end, f );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename Function >
+template< typename Value, typename Device, typename Index, typename Allocator >
+template< typename Function >
 void
-Array< Value, Device, Index, Allocator >::
-forAllElements( Function&& f )
+Array< Value, Device, Index, Allocator >::forAllElements( Function&& f )
 {
    this->getView().forAllElements( f );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename Function >
+template< typename Value, typename Device, typename Index, typename Allocator >
+template< typename Function >
 void
-Array< Value, Device, Index, Allocator >::
-forAllElements( Function&& f ) const
+Array< Value, Device, Index, Allocator >::forAllElements( Function&& f ) const
 {
    const auto view = this->getConstView();
    view.forAllElements( f );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 void
-Array< Value, Device, Index, Allocator >::
-save( const String& fileName ) const
+Array< Value, Device, Index, Allocator >::save( const String& fileName ) const
 {
    File( fileName, std::ios_base::out ) << *this;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 void
-Array< Value, Device, Index, Allocator >::
-load( const String& fileName )
+Array< Value, Device, Index, Allocator >::load( const String& fileName )
 {
    File( fileName, std::ios_base::in ) >> *this;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-Array< Value, Device, Index, Allocator >::
-~Array()
+template< typename Value, typename Device, typename Index, typename Allocator >
+Array< Value, Device, Index, Allocator >::~Array()
 {
    this->releaseData();
 }
 
 template< typename Value, typename Device, typename Index, typename Allocator >
-std::ostream& operator<<( std::ostream& str, const Array< Value, Device, Index, Allocator >& array )
+std::ostream&
+operator<<( std::ostream& str, const Array< Value, Device, Index, Allocator >& array )
 {
    str << "[ ";
-   if( array.getSize() > 0 )
-   {
+   if( array.getSize() > 0 ) {
       str << array.getElement( 0 );
       for( Index i = 1; i < array.getSize(); i++ )
          str << ", " << array.getElement( i );
@@ -800,7 +562,8 @@ std::ostream& operator<<( std::ostream& str, const Array< Value, Device, Index,
 
 // Serialization of arrays into binary files.
 template< typename Value, typename Device, typename Index, typename Allocator >
-File& operator<<( File& file, const Array< Value, Device, Index, Allocator >& array )
+File&
+operator<<( File& file, const Array< Value, Device, Index, Allocator >& array )
 {
    using IO = detail::ArrayIO< Value, Index, Allocator >;
    saveObjectType( file, IO::getSerializationType() );
@@ -811,7 +574,8 @@ File& operator<<( File& file, const Array< Value, Device, Index, Allocator >& ar
 }
 
 template< typename Value, typename Device, typename Index, typename Allocator >
-File& operator<<( File&& file, const Array< Value, Device, Index, Allocator >& array )
+File&
+operator<<( File&& file, const Array< Value, Device, Index, Allocator >& array )
 {
    File& f = file;
    return f << array;
@@ -819,27 +583,30 @@ File& operator<<( File&& file, const Array< Value, Device, Index, Allocator >& a
 
 // Deserialization of arrays from binary files.
 template< typename Value, typename Device, typename Index, typename Allocator >
-File& operator>>( File& file, Array< Value, Device, Index, Allocator >& array )
+File&
+operator>>( File& file, Array< Value, Device, Index, Allocator >& array )
 {
    using IO = detail::ArrayIO< Value, Index, Allocator >;
-   const String type = getObjectType( file );
+   const std::string type = getObjectType( file );
    if( type != IO::getSerializationType() )
-      throw Exceptions::FileDeserializationError( file.getFileName(), "object type does not match (expected " + IO::getSerializationType() + ", found " + type + ")." );
+      throw Exceptions::FileDeserializationError(
+         file.getFileName(), "object type does not match (expected " + IO::getSerializationType() + ", found " + type + ")." );
    Index _size;
    file.load( &_size );
    if( _size < 0 )
-      throw Exceptions::FileDeserializationError( file.getFileName(), "invalid array size: " + std::to_string(_size) );
+      throw Exceptions::FileDeserializationError( file.getFileName(), "invalid array size: " + std::to_string( _size ) );
    array.setSize( _size );
    IO::load( file, array.getData(), array.getSize() );
    return file;
 }
 
 template< typename Value, typename Device, typename Index, typename Allocator >
-File& operator>>( File&& file, Array< Value, Device, Index, Allocator >& array )
+File&
+operator>>( File&& file, Array< Value, Device, Index, Allocator >& array )
 {
    File& f = file;
    return f >> array;
 }
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/ArrayView.h b/src/TNL/Containers/ArrayView.h
index 0d45117eb4c406a5f72875d96445360274ea4bdd..7f421a343abd71fc6b611080807f4f0e1be5dff1 100644
--- a/src/TNL/Containers/ArrayView.h
+++ b/src/TNL/Containers/ArrayView.h
@@ -55,9 +55,7 @@ namespace Containers {
  * \par Output
  * \include ArrayViewExample.out
  */
-template< typename Value,
-          typename Device = Devices::Host,
-          typename Index = int >
+template< typename Value, typename Device = Devices::Host, typename Index = int >
 class ArrayView
 {
 public:
@@ -91,12 +89,9 @@ public:
    /**
     * \brief A template which allows to quickly obtain an \ref ArrayView type with changed template parameters.
     */
-   template< typename _Value,
-             typename _Device = Device,
-             typename _Index = Index >
+   template< typename _Value, typename _Device = Device, typename _Index = Index >
    using Self = ArrayView< _Value, _Device, _Index >;
 
-
    /**
     * \brief Constructs an empty array view.
     *
@@ -138,8 +133,7 @@ public:
     */
    template< typename Value_ >
    __cuda_callable__
-   ArrayView( const ArrayView< Value_, Device, Index >& view )
-   : data(view.getData()), size(view.getSize()) {}
+   ArrayView( const ArrayView< Value_, Device, Index >& view ) : data( view.getData() ), size( view.getSize() ) {}
 
    /**
     * \brief Move constructor for initialization from \e rvalues.
@@ -149,7 +143,7 @@ public:
     * \param view The array view to be moved.
     */
    __cuda_callable__
-   ArrayView( ArrayView&& view ) = default;
+   ArrayView( ArrayView&& view ) noexcept = default;
 
    /**
     * \brief Method for rebinding (reinitialization) using a raw pointer and
@@ -161,7 +155,8 @@ public:
     * \param size The number of elements in the array view.
     */
    __cuda_callable__
-   void bind( ValueType* data, IndexType size );
+   void
+   bind( ValueType* data, IndexType size );
 
    /**
     * \brief Method for rebinding (reinitialization) using another array view.
@@ -174,7 +169,8 @@ public:
     * \param view The array view to be bound.
     */
    __cuda_callable__
-   void bind( ArrayView view );
+   void
+   bind( ArrayView view );
 
    /**
     * \brief Returns a modifiable view of the array view.
@@ -189,7 +185,8 @@ public:
     *            which is, however, replaced with the array size.
     */
    __cuda_callable__
-   ViewType getView( IndexType begin = 0, IndexType end = 0 );
+   ViewType
+   getView( IndexType begin = 0, IndexType end = 0 );
 
    /**
     * \brief Returns a non-modifiable view of the array view.
@@ -204,7 +201,8 @@ public:
     *            which is, however, replaced with the array size.
     */
    __cuda_callable__
-   ConstViewType getConstView( IndexType begin = 0, IndexType end = 0 ) const;
+   ConstViewType
+   getConstView( IndexType begin = 0, IndexType end = 0 ) const;
 
    /**
     * \brief Deep copy assignment operator for copying data from another array
@@ -213,7 +211,8 @@ public:
     * \param view Reference to the source array view.
     * \return Reference to this array view.
     */
-   ArrayView& operator=( const ArrayView& view );
+   ArrayView&
+   operator=( const ArrayView& view );
 
    /**
     * \brief Assigns either array-like container or a single value.
@@ -231,7 +230,8 @@ public:
    template< typename T,
              typename...,
              typename = std::enable_if_t< std::is_convertible< T, ValueType >::value || IsArrayType< T >::value > >
-   ArrayView& operator=( const T& array );
+   ArrayView&
+   operator=( const T& array );
 
    /**
     * \brief Swaps this array view with another.
@@ -242,7 +242,8 @@ public:
     * \param view The array view to be swapped with this array view.
     */
    __cuda_callable__
-   void swap( ArrayView& view );
+   void
+   swap( ArrayView& view );
 
    /***
     * \brief Resets the array view to the empty state.
@@ -250,7 +251,8 @@ public:
     * This method can be called from device kernels.
     */
    __cuda_callable__
-   void reset();
+   void
+   reset();
 
    /**
     * \brief Returns \e true if the current array view size is zero.
@@ -258,7 +260,8 @@ public:
     * This method can be called from device kernels.
     */
    __cuda_callable__
-   bool empty() const;
+   bool
+   empty() const;
 
    /**
     * \brief Returns a \e const-qualified raw pointer to the data.
@@ -266,7 +269,8 @@ public:
     * This method can be called from device kernels.
     */
    __cuda_callable__
-   const ValueType* getData() const;
+   const ValueType*
+   getData() const;
 
    /**
     * \brief Returns a raw pointer to the data.
@@ -274,7 +278,8 @@ public:
     * This method can be called from device kernels.
     */
    __cuda_callable__
-   ValueType* getData();
+   ValueType*
+   getData();
 
    /**
     * \brief Returns a \e const-qualified raw pointer to the data.
@@ -285,7 +290,8 @@ public:
     * This method can be called from device kernels.
     */
    __cuda_callable__
-   const ValueType* getArrayData() const;
+   const ValueType*
+   getArrayData() const;
 
    /**
     * \brief Returns a raw pointer to the data.
@@ -296,7 +302,8 @@ public:
     * This method can be called from device kernels.
     */
    __cuda_callable__
-   ValueType* getArrayData();
+   ValueType*
+   getArrayData();
 
    /**
     * \brief Returns the current size of the array view.
@@ -304,7 +311,8 @@ public:
     * This method can be called from device kernels.
     */
    __cuda_callable__
-   IndexType getSize() const;
+   IndexType
+   getSize() const;
 
    /**
     * \brief Sets the value of the \e i-th element to \e v.
@@ -316,7 +324,8 @@ public:
     * \param value The new value of the element.
     */
    __cuda_callable__
-   void setElement( IndexType i, ValueType value );
+   void
+   setElement( IndexType i, ValueType value );
 
    /**
     * \brief Returns the value of the \e i-th element.
@@ -327,7 +336,8 @@ public:
     * \param i The index of the element to be returned.
     */
    __cuda_callable__
-   ValueType getElement( IndexType i ) const;
+   ValueType
+   getElement( IndexType i ) const;
 
    /**
     * \brief Accesses the \e i-th element of the array view.
@@ -345,7 +355,8 @@ public:
     * \return Reference to the \e i-th element.
     */
    __cuda_callable__
-   Value& operator[]( IndexType i );
+   Value&
+   operator[]( IndexType i );
 
    /**
     * \brief Accesses the \e i-th element of the array view.
@@ -363,21 +374,26 @@ public:
     * \return Constant reference to the \e i-th element.
     */
    __cuda_callable__
-   const Value& operator[]( IndexType i ) const;
+   const Value&
+   operator[]( IndexType i ) const;
 
    /**
     * \brief Accesses the \e i-th element of the array.
     *
     * Equivalent to \ref operator[], with the same notes and caveats.
     */
-   __cuda_callable__ Value& operator()( IndexType i );
+   __cuda_callable__
+   Value&
+   operator()( IndexType i );
 
    /**
     * \brief Accesses the \e i-th element of the array.
     *
     * Equivalent to \ref operator[], with the same notes and caveats.
     */
-   __cuda_callable__ const Value& operator()( IndexType i ) const;
+   __cuda_callable__
+   const Value&
+   operator()( IndexType i ) const;
 
    /**
     * \brief Compares the array view with another array-like container.
@@ -390,7 +406,8 @@ public:
     *         array-like container and \ref false otherwise.
     */
    template< typename ArrayT >
-   bool operator==( const ArrayT& array ) const;
+   bool
+   operator==( const ArrayT& array ) const;
 
    /**
     * \brief Compares the array view with another array-like container.
@@ -402,7 +419,8 @@ public:
     * \return The negated result of \ref operator==.
     */
    template< typename ArrayT >
-   bool operator!=( const ArrayT& array ) const;
+   bool
+   operator!=( const ArrayT& array ) const;
 
    /**
     * \brief Sets elements of the array view to given value.
@@ -417,9 +435,8 @@ public:
     * \param end The end of the array view sub-interval. The default value is 0
     *            which is, however, replaced with the array view size.
     */
-   void setValue( ValueType value,
-                  IndexType begin = 0,
-                  IndexType end = 0 );
+   void
+   setValue( ValueType value, IndexType begin = 0, IndexType end = 0 );
 
    /**
     * \brief Process the lambda function \e f for each array element in interval [ \e begin, \e end).
@@ -449,10 +466,12 @@ public:
     *
     */
    template< typename Function >
-   void forElements( IndexType begin, IndexType end, Function&& f );
+   void
+   forElements( IndexType begin, IndexType end, Function&& f );
 
    /**
-    * \brief Process the lambda function \e f for each array element in interval [ \e begin, \e end) for constant instances of the array.
+    * \brief Process the lambda function \e f for each array element in interval [ \e begin, \e end) for constant instances of
+    * the array.
     *
     * The lambda function is supposed to be declared as
     *
@@ -478,7 +497,8 @@ public:
     * \include ArrayViewExample_forElements.out
     */
    template< typename Function >
-   void forElements( IndexType begin, IndexType end, Function&& f ) const;
+   void
+   forElements( IndexType begin, IndexType end, Function&& f ) const;
 
    /**
     * \brief Process the lambda function \e f for each array element.
@@ -506,7 +526,8 @@ public:
     *
     */
    template< typename Function >
-   void forAllElements( Function&& f );
+   void
+   forAllElements( Function&& f );
 
    /**
     * \brief Process the lambda function \e f for each array element for constant instances.
@@ -534,21 +555,24 @@ public:
     *
     */
    template< typename Function >
-   void forAllElements( Function&& f ) const;
+   void
+   forAllElements( Function&& f ) const;
 
    /**
     * \brief Method for saving the data to a binary file \e fileName.
     *
     * \param fileName The output file name.
     */
-   void save( const String& fileName ) const;
+   void
+   save( const String& fileName ) const;
 
    /**
     * \brief Method for loading the data from a binary file \e fileName.
     *
     * \param fileName The input file name.
     */
-   void load( const String& fileName );
+   void
+   load( const String& fileName );
 
 protected:
    //! Pointer to the data
@@ -571,27 +595,32 @@ protected:
  * \return a reference on the output stream \ref std::ostream&.
  */
 template< typename Value, typename Device, typename Index >
-std::ostream& operator<<( std::ostream& str, const ArrayView< Value, Device, Index >& view );
+std::ostream&
+operator<<( std::ostream& str, const ArrayView< Value, Device, Index >& view );
 
 /**
  * \brief Serialization of array views into binary files.
  */
 template< typename Value, typename Device, typename Index >
-File& operator<<( File& file, const ArrayView< Value, Device, Index > view );
+File&
+operator<<( File& file, ArrayView< Value, Device, Index > view );
 
 template< typename Value, typename Device, typename Index >
-File& operator<<( File&& file, const ArrayView< Value, Device, Index > view );
+File&
+operator<<( File&& file, ArrayView< Value, Device, Index > view );
 
 /**
  * \brief Deserialization of array views from binary files.
  */
 template< typename Value, typename Device, typename Index >
-File& operator>>( File& file, ArrayView< Value, Device, Index > view );
+File&
+operator>>( File& file, ArrayView< Value, Device, Index > view );
 
 template< typename Value, typename Device, typename Index >
-File& operator>>( File&& file, ArrayView< Value, Device, Index > view );
+File&
+operator>>( File&& file, ArrayView< Value, Device, Index > view );
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
 
 #include <TNL/Containers/ArrayView.hpp>
diff --git a/src/TNL/Containers/ArrayView.hpp b/src/TNL/Containers/ArrayView.hpp
index 38d4ad2d268ae55907dce571bc27a3a62a24a4c1..c94e9e05f8b166ea3f1ea46824c0d6bc10182544 100644
--- a/src/TNL/Containers/ArrayView.hpp
+++ b/src/TNL/Containers/ArrayView.hpp
@@ -23,67 +23,52 @@ namespace TNL {
 namespace Containers {
 
 // explicit initialization by raw data pointer and size
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 __cuda_callable__
-ArrayView< Value, Device, Index >::
-ArrayView( ValueType* data, IndexType size )
-: data(data), size(size)
+ArrayView< Value, Device, Index >::ArrayView( ValueType* data, IndexType size ) : data( data ), size( size )
 {
    TNL_ASSERT_GE( size, (Index) 0, "ArrayView size was initialized with a negative size." );
-   TNL_ASSERT_TRUE( (data == nullptr && size == 0) || (data != nullptr && size > 0),
+   TNL_ASSERT_TRUE( ( data == nullptr && size == 0 ) || ( data != nullptr && size > 0 ),
                     "ArrayView was initialized with a positive address and zero size or zero address and positive size." );
 }
 
 // methods for rebinding (reinitialization)
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 __cuda_callable__
 void
-ArrayView< Value, Device, Index >::
-bind( ValueType* data, IndexType size )
+ArrayView< Value, Device, Index >::bind( ValueType* data, IndexType size )
 {
    TNL_ASSERT_GE( size, (Index) 0, "ArrayView size was initialized with a negative size." );
-   TNL_ASSERT_TRUE( (data == nullptr && size == 0) || (data != nullptr && size > 0),
+   TNL_ASSERT_TRUE( ( data == nullptr && size == 0 ) || ( data != nullptr && size > 0 ),
                     "ArrayView was initialized with a positive address and zero size or zero address and positive size." );
 
    this->data = data;
    this->size = size;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 __cuda_callable__
 void
-ArrayView< Value, Device, Index >::
-bind( ArrayView view )
+ArrayView< Value, Device, Index >::bind( ArrayView view )
 {
    bind( view.getData(), view.getSize() );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 __cuda_callable__
 typename ArrayView< Value, Device, Index >::ViewType
-ArrayView< Value, Device, Index >::
-getView( IndexType begin, IndexType end )
+ArrayView< Value, Device, Index >::getView( IndexType begin, IndexType end )
 {
    if( end == 0 )
       end = this->getSize();
-   return ViewType( getData() + begin, end - begin );;
+   return ViewType( getData() + begin, end - begin );
+   ;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 __cuda_callable__
 typename ArrayView< Value, Device, Index >::ConstViewType
-ArrayView< Value, Device, Index >::
-getConstView( IndexType begin, IndexType end ) const
+ArrayView< Value, Device, Index >::getConstView( IndexType begin, IndexType end ) const
 {
    if( end == 0 )
       end = this->getSize();
@@ -92,12 +77,9 @@ getConstView( IndexType begin, IndexType end ) const
 
 // Copy-assignment does deep copy, just like regular array, but the sizes
 // must match (i.e. copy-assignment cannot resize).
-template< typename Value,
-           typename Device,
-           typename Index >
+template< typename Value, typename Device, typename Index >
 ArrayView< Value, Device, Index >&
-ArrayView< Value, Device, Index >::
-operator=( const ArrayView& view )
+ArrayView< Value, Device, Index >::operator=( const ArrayView& view )
 {
    TNL_ASSERT_EQ( getSize(), view.getSize(), "The sizes of the array views must be equal, views are not resizable." );
    if( getSize() > 0 )
@@ -105,317 +87,247 @@ operator=( const ArrayView& view )
    return *this;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
-   template< typename T, typename..., typename >
+template< typename Value, typename Device, typename Index >
+template< typename T, typename..., typename >
 ArrayView< Value, Device, Index >&
-ArrayView< Value, Device, Index >::
-operator=( const T& data )
+ArrayView< Value, Device, Index >::operator=( const T& data )
 {
    detail::ArrayAssignment< ArrayView, T >::assign( *this, data );
    return *this;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 __cuda_callable__
 void
-ArrayView< Value, Device, Index >::
-swap( ArrayView& array )
+ArrayView< Value, Device, Index >::swap( ArrayView& array )
 {
    TNL::swap( data, array.data );
    TNL::swap( size, array.size );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 __cuda_callable__
 void
-ArrayView< Value, Device, Index >::
-reset()
+ArrayView< Value, Device, Index >::reset()
 {
    data = nullptr;
    size = 0;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 __cuda_callable__
 bool
-ArrayView< Value, Device, Index >::
-empty() const
+ArrayView< Value, Device, Index >::empty() const
 {
    return data == nullptr;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 __cuda_callable__
 const Value*
-ArrayView< Value, Device, Index >::
-getData() const
+ArrayView< Value, Device, Index >::getData() const
 {
    return data;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 __cuda_callable__
 Value*
-ArrayView< Value, Device, Index >::
-getData()
+ArrayView< Value, Device, Index >::getData()
 {
    return data;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 __cuda_callable__
 const Value*
-ArrayView< Value, Device, Index >::
-getArrayData() const
+ArrayView< Value, Device, Index >::getArrayData() const
 {
    return data;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 __cuda_callable__
 Value*
-ArrayView< Value, Device, Index >::
-getArrayData()
+ArrayView< Value, Device, Index >::getArrayData()
 {
    return data;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 __cuda_callable__
 Index
-ArrayView< Value, Device, Index >::
-getSize() const
+ArrayView< Value, Device, Index >::getSize() const
 {
    return size;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 __cuda_callable__
 void
-ArrayView< Value, Device, Index >::
-setElement( IndexType i, ValueType value )
+ArrayView< Value, Device, Index >::setElement( IndexType i, ValueType value )
 {
    TNL_ASSERT_GE( i, (Index) 0, "Element index must be non-negative." );
    TNL_ASSERT_LT( i, this->getSize(), "Element index is out of bounds." );
    Algorithms::MemoryOperations< Device >::setElement( &this->data[ i ], value );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 __cuda_callable__
 Value
-ArrayView< Value, Device, Index >::
-getElement( IndexType i ) const
+ArrayView< Value, Device, Index >::getElement( IndexType i ) const
 {
    TNL_ASSERT_GE( i, (Index) 0, "Element index must be non-negative." );
    TNL_ASSERT_LT( i, this->getSize(), "Element index is out of bounds." );
    return Algorithms::MemoryOperations< Device >::getElement( &data[ i ] );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 __cuda_callable__
 Value&
-ArrayView< Value, Device, Index >::
-operator[]( IndexType i )
+ArrayView< Value, Device, Index >::operator[]( IndexType i )
 {
 #ifdef __CUDA_ARCH__
-   TNL_ASSERT_TRUE( (std::is_same< Device, Devices::Cuda >{}()), "Attempt to access data not allocated on CUDA device from CUDA device." );
+   TNL_ASSERT_TRUE( ( std::is_same< Device, Devices::Cuda >{}() ),
+                    "Attempt to access data not allocated on CUDA device from CUDA device." );
 #else
-   TNL_ASSERT_FALSE( (std::is_same< Device, Devices::Cuda >{}()), "Attempt to access data not allocated on the host from the host." );
+   TNL_ASSERT_FALSE( ( std::is_same< Device, Devices::Cuda >{}() ),
+                     "Attempt to access data not allocated on the host from the host." );
 #endif
    TNL_ASSERT_GE( i, (Index) 0, "Element index must be non-negative." );
    TNL_ASSERT_LT( i, this->getSize(), "Element index is out of bounds." );
    return data[ i ];
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 __cuda_callable__
 const Value&
-ArrayView< Value, Device, Index >::
-operator[]( IndexType i ) const
+ArrayView< Value, Device, Index >::operator[]( IndexType i ) const
 {
 #ifdef __CUDA_ARCH__
-   TNL_ASSERT_TRUE( (std::is_same< Device, Devices::Cuda >{}()), "Attempt to access data not allocated on CUDA device from CUDA device." );
+   TNL_ASSERT_TRUE( ( std::is_same< Device, Devices::Cuda >{}() ),
+                    "Attempt to access data not allocated on CUDA device from CUDA device." );
 #else
-   TNL_ASSERT_FALSE( (std::is_same< Device, Devices::Cuda >{}()), "Attempt to access data not allocated on the host from the host." );
+   TNL_ASSERT_FALSE( ( std::is_same< Device, Devices::Cuda >{}() ),
+                     "Attempt to access data not allocated on the host from the host." );
 #endif
    TNL_ASSERT_GE( i, (Index) 0, "Element index must be non-negative." );
    TNL_ASSERT_LT( i, this->getSize(), "Element index is out of bounds." );
    return data[ i ];
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 __cuda_callable__
 Value&
-ArrayView< Value, Device, Index >::
-operator()( IndexType i )
+ArrayView< Value, Device, Index >::operator()( IndexType i )
 {
    return operator[]( i );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 __cuda_callable__
 const Value&
-ArrayView< Value, Device, Index >::
-operator()( IndexType i ) const
+ArrayView< Value, Device, Index >::operator()( IndexType i ) const
 {
    return operator[]( i );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
-   template< typename ArrayT >
+template< typename Value, typename Device, typename Index >
+template< typename ArrayT >
 bool
-ArrayView< Value, Device, Index >::
-operator==( const ArrayT& array ) const
+ArrayView< Value, Device, Index >::operator==( const ArrayT& array ) const
 {
    if( array.getSize() != this->getSize() )
       return false;
    if( this->getSize() == 0 )
       return true;
-   return Algorithms::MultiDeviceMemoryOperations< DeviceType, typename ArrayT::DeviceType >::
-            compare( this->getData(),
-                           array.getData(),
-                           array.getSize() );
+   return Algorithms::MultiDeviceMemoryOperations< DeviceType, typename ArrayT::DeviceType >::compare(
+      this->getData(), array.getData(), array.getSize() );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
-   template< typename ArrayT >
+template< typename Value, typename Device, typename Index >
+template< typename ArrayT >
 bool
-ArrayView< Value, Device, Index >::
-operator!=( const ArrayT& array ) const
+ArrayView< Value, Device, Index >::operator!=( const ArrayT& array ) const
 {
    return ! ( *this == array );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 void
-ArrayView< Value, Device, Index >::
-setValue( ValueType value, IndexType begin, IndexType end )
+ArrayView< Value, Device, Index >::setValue( ValueType value, IndexType begin, IndexType end )
 {
    if( end == 0 )
       end = this->getSize();
    Algorithms::MemoryOperations< Device >::set( &getData()[ begin ], value, end - begin );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
-   template< typename Function >
+template< typename Value, typename Device, typename Index >
+template< typename Function >
 void
-ArrayView< Value, Device, Index >::
-forElements( IndexType begin, IndexType end, Function&& f )
+ArrayView< Value, Device, Index >::forElements( IndexType begin, IndexType end, Function&& f )
 {
    if( ! this->data )
       return;
 
-   auto g = [] __cuda_callable__ ( IndexType i, Function f, ArrayView view )
+   auto g = [] __cuda_callable__( IndexType i, Function f, ArrayView view )
    {
       f( i, view[ i ] );
    };
    Algorithms::ParallelFor< DeviceType >::exec( begin, end, g, f, *this );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
-   template< typename Function >
+template< typename Value, typename Device, typename Index >
+template< typename Function >
 void
-ArrayView< Value, Device, Index >::
-forElements( IndexType begin, IndexType end, Function&& f ) const
+ArrayView< Value, Device, Index >::forElements( IndexType begin, IndexType end, Function&& f ) const
 {
    if( ! this->data )
       return;
 
-   auto g = [] __cuda_callable__ ( IndexType i, Function f, ArrayView view )
+   auto g = [] __cuda_callable__( IndexType i, Function f, ArrayView view )
    {
       f( i, view[ i ] );
    };
    Algorithms::ParallelFor< DeviceType >::exec( begin, end, g, f, *this );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
-   template< typename Function >
+template< typename Value, typename Device, typename Index >
+template< typename Function >
 void
-ArrayView< Value, Device, Index >::
-forAllElements( Function&& f )
+ArrayView< Value, Device, Index >::forAllElements( Function&& f )
 {
    this->forElements( 0, this->getSize(), f );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
-   template< typename Function >
+template< typename Value, typename Device, typename Index >
+template< typename Function >
 void
-ArrayView< Value, Device, Index >::
-forAllElements( Function&& f ) const
+ArrayView< Value, Device, Index >::forAllElements( Function&& f ) const
 {
    this->forElements( 0, this->getSize(), f );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 void
-ArrayView< Value, Device, Index >::
-save( const String& fileName ) const
+ArrayView< Value, Device, Index >::save( const String& fileName ) const
 {
    File( fileName, std::ios_base::out ) << *this;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 void
-ArrayView< Value, Device, Index >::
-load( const String& fileName )
+ArrayView< Value, Device, Index >::load( const String& fileName )
 {
    File( fileName, std::ios_base::in ) >> *this;
 }
 
 template< typename Value, typename Device, typename Index >
-std::ostream& operator<<( std::ostream& str, const ArrayView< Value, Device, Index >& view )
+std::ostream&
+operator<<( std::ostream& str, const ArrayView< Value, Device, Index >& view )
 {
    str << "[ ";
-   if( view.getSize() > 0 )
-   {
+   if( view.getSize() > 0 ) {
       str << view.getElement( 0 );
       for( Index i = 1; i < view.getSize(); i++ )
          str << ", " << view.getElement( i );
@@ -426,7 +338,8 @@ std::ostream& operator<<( std::ostream& str, const ArrayView< Value, Device, Ind
 
 // Serialization of array views into binary files.
 template< typename Value, typename Device, typename Index >
-File& operator<<( File& file, const ArrayView< Value, Device, Index > view )
+File&
+operator<<( File& file, const ArrayView< Value, Device, Index > view )
 {
    using IO = detail::ArrayIO< Value, Index, typename Allocators::Default< Device >::template Allocator< Value > >;
    saveObjectType( file, IO::getSerializationType() );
@@ -437,7 +350,8 @@ File& operator<<( File& file, const ArrayView< Value, Device, Index > view )
 }
 
 template< typename Value, typename Device, typename Index >
-File& operator<<( File&& file, const ArrayView< Value, Device, Index > view )
+File&
+operator<<( File&& file, const ArrayView< Value, Device, Index > view )
 {
    File& f = file;
    return f << view;
@@ -445,26 +359,31 @@ File& operator<<( File&& file, const ArrayView< Value, Device, Index > view )
 
 // Deserialization of array views from binary files.
 template< typename Value, typename Device, typename Index >
-File& operator>>( File& file, ArrayView< Value, Device, Index > view )
+File&
+operator>>( File& file, ArrayView< Value, Device, Index > view )
 {
    using IO = detail::ArrayIO< Value, Index, typename Allocators::Default< Device >::template Allocator< Value > >;
-   const String type = getObjectType( file );
+   const std::string type = getObjectType( file );
    if( type != IO::getSerializationType() )
-      throw Exceptions::FileDeserializationError( file.getFileName(), "object type does not match (expected " + IO::getSerializationType() + ", found " + type + ")." );
+      throw Exceptions::FileDeserializationError(
+         file.getFileName(), "object type does not match (expected " + IO::getSerializationType() + ", found " + type + ")." );
    Index _size;
    file.load( &_size );
    if( _size != view.getSize() )
-      throw Exceptions::FileDeserializationError( file.getFileName(), "invalid array size: " + std::to_string(_size) + " (expected " + std::to_string( view.getSize() ) + ")." );
+      throw Exceptions::FileDeserializationError( file.getFileName(),
+                                                  "invalid array size: " + std::to_string( _size ) + " (expected "
+                                                     + std::to_string( view.getSize() ) + ")." );
    IO::load( file, view.getData(), view.getSize() );
    return file;
 }
 
 template< typename Value, typename Device, typename Index >
-File& operator>>( File&& file, ArrayView< Value, Device, Index > view )
+File&
+operator>>( File&& file, ArrayView< Value, Device, Index > view )
 {
    File& f = file;
    return f >> view;
 }
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/ByteArraySynchronizer.h b/src/TNL/Containers/ByteArraySynchronizer.h
index 2b8902263949abbcd41d485d597b057ef572fdbe..29b49b3d6539f176dcce79a23d5c609957a3f3ff 100644
--- a/src/TNL/Containers/ByteArraySynchronizer.h
+++ b/src/TNL/Containers/ByteArraySynchronizer.h
@@ -40,18 +40,21 @@ public:
    using ByteArrayView = ArrayView< std::uint8_t, Device, Index >;
    using RequestsVector = std::vector< MPI_Request >;
 
-   enum class AsyncPolicy {
+   enum class AsyncPolicy
+   {
       synchronous,
       deferred,
       threadpool,
       async,
    };
 
-   ByteArraySynchronizer() : tp(1) {}
+   ByteArraySynchronizer() : tp( 1 ) {}
 
-   virtual void synchronizeByteArray( ByteArrayView array, int bytesPerValue ) = 0;
+   virtual void
+   synchronizeByteArray( ByteArrayView array, int bytesPerValue ) = 0;
 
-   virtual RequestsVector synchronizeByteArrayAsyncWorker( ByteArrayView array, int bytesPerValue ) = 0;
+   virtual RequestsVector
+   synchronizeByteArrayAsyncWorker( ByteArrayView array, int bytesPerValue ) = 0;
 
    /**
     * \brief An asynchronous version of \ref synchronizeByteArray.
@@ -62,7 +65,8 @@ public:
     * Note that at most one async operation may be active at a time, the
     * following calls will block until the pending operation is finished.
     */
-   void synchronizeByteArrayAsync( ByteArrayView array, int bytesPerValue, AsyncPolicy policy = AsyncPolicy::synchronous )
+   void
+   synchronizeByteArrayAsync( ByteArrayView array, int bytesPerValue, AsyncPolicy policy = AsyncPolicy::synchronous )
    {
       // wait for any previous synchronization (multiple objects can share the
       // same synchronizer)
@@ -74,20 +78,21 @@ public:
 
       async_start_timer.start();
 
-      // GOTCHA: https://devblogs.nvidia.com/cuda-pro-tip-always-set-current-device-avoid-multithreading-bugs/
-      #ifdef HAVE_CUDA
+// GOTCHA: https://devblogs.nvidia.com/cuda-pro-tip-always-set-current-device-avoid-multithreading-bugs/
+#ifdef HAVE_CUDA
       if( std::is_same< Device, Devices::Cuda >::value )
-         cudaGetDevice(&gpu_id);
-      #endif
+         cudaGetDevice( &gpu_id );
+#endif
 
       if( policy == AsyncPolicy::threadpool || policy == AsyncPolicy::async ) {
          // everything offloaded to a separate thread
-         auto worker = [=] () {
-            // GOTCHA: https://devblogs.nvidia.com/cuda-pro-tip-always-set-current-device-avoid-multithreading-bugs/
-            #ifdef HAVE_CUDA
+         auto worker = [ = ]()
+         {
+// GOTCHA: https://devblogs.nvidia.com/cuda-pro-tip-always-set-current-device-avoid-multithreading-bugs/
+#ifdef HAVE_CUDA
             if( std::is_same< Device, Devices::Cuda >::value )
-               cudaSetDevice(this->gpu_id);
-            #endif
+               cudaSetDevice( this->gpu_id );
+#endif
 
             this->synchronizeByteArray( array, bytesPerValue );
          };
@@ -100,7 +105,8 @@ public:
       else if( policy == AsyncPolicy::deferred ) {
          // immediate start, deferred synchronization (but still in the same thread)
          auto requests = synchronizeByteArrayAsyncWorker( array, bytesPerValue );
-         auto worker = [requests] () mutable {
+         auto worker = [ requests ]() mutable
+         {
             MPI::Waitall( requests.data(), requests.size() );
          };
          this->async_op = std::async( std::launch::deferred, worker );
@@ -139,5 +145,5 @@ public:
    std::size_t async_ops_count = 0;
 };
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/DistributedArray.h b/src/TNL/Containers/DistributedArray.h
index 0c68425c8027c9b7ab60ce6fb77becd9f4dc4823..b05fdf0322d067deebcbb455bb6703754d602650 100644
--- a/src/TNL/Containers/DistributedArray.h
+++ b/src/TNL/Containers/DistributedArray.h
@@ -43,7 +43,6 @@ public:
              typename _Allocator = typename Allocators::Default< _Device >::template Allocator< _Value > >
    using Self = DistributedArray< _Value, _Device, _Index, _Allocator >;
 
-
    ~DistributedArray();
 
    /**
@@ -65,6 +64,9 @@ public:
     */
    explicit DistributedArray( const DistributedArray& array );
 
+   // default move-constructor
+   DistributedArray( DistributedArray&& ) noexcept = default;
+
    /**
     * \brief Copy constructor with a specific allocator (makes a deep copy).
     *
@@ -73,65 +75,85 @@ public:
     */
    explicit DistributedArray( const DistributedArray& array, const AllocatorType& allocator );
 
-   DistributedArray( LocalRangeType localRange, Index ghosts, Index globalSize, MPI_Comm communicator, const AllocatorType& allocator = AllocatorType() );
+   DistributedArray( LocalRangeType localRange,
+                     Index ghosts,
+                     Index globalSize,
+                     MPI_Comm communicator,
+                     const AllocatorType& allocator = AllocatorType() );
 
-   void setDistribution( LocalRangeType localRange, Index ghosts, Index globalSize, MPI_Comm communicator );
+   void
+   setDistribution( LocalRangeType localRange, Index ghosts, Index globalSize, MPI_Comm communicator );
 
-   const LocalRangeType& getLocalRange() const;
+   const LocalRangeType&
+   getLocalRange() const;
 
-   IndexType getGhosts() const;
+   IndexType
+   getGhosts() const;
 
-   MPI_Comm getCommunicator() const;
+   MPI_Comm
+   getCommunicator() const;
 
-   AllocatorType getAllocator() const;
+   AllocatorType
+   getAllocator() const;
 
    /**
     * \brief Returns a modifiable view of the local part of the array.
     */
-   LocalViewType getLocalView();
+   LocalViewType
+   getLocalView();
 
    /**
     * \brief Returns a non-modifiable view of the local part of the array.
     */
-   ConstLocalViewType getConstLocalView() const;
+   ConstLocalViewType
+   getConstLocalView() const;
 
    /**
     * \brief Returns a modifiable view of the local part of the array,
     * including ghost values.
     */
-   LocalViewType getLocalViewWithGhosts();
+   LocalViewType
+   getLocalViewWithGhosts();
 
    /**
     * \brief Returns a non-modifiable view of the local part of the array,
     * including ghost values.
     */
-   ConstLocalViewType getConstLocalViewWithGhosts() const;
+   ConstLocalViewType
+   getConstLocalViewWithGhosts() const;
 
-   void copyFromGlobal( ConstLocalViewType globalArray );
+   void
+   copyFromGlobal( ConstLocalViewType globalArray );
 
    // synchronizer stuff
-   void setSynchronizer( std::shared_ptr< SynchronizerType > synchronizer, int valuesPerElement = 1 );
+   void
+   setSynchronizer( std::shared_ptr< SynchronizerType > synchronizer, int valuesPerElement = 1 );
 
-   std::shared_ptr< SynchronizerType > getSynchronizer() const;
+   std::shared_ptr< SynchronizerType >
+   getSynchronizer() const;
 
-   int getValuesPerElement() const;
+   int
+   getValuesPerElement() const;
 
-   void startSynchronization();
-
-   void waitForSynchronization() const;
+   void
+   startSynchronization();
 
+   void
+   waitForSynchronization() const;
 
    // Usual Array methods follow below.
 
    /**
     * \brief Returns a modifiable view of the array.
     */
-   ViewType getView();
+   ViewType
+   getView();
 
    /**
     * \brief Returns a non-modifiable view of the array.
     */
-   ConstViewType getConstView() const;
+   ConstViewType
+   getConstView() const;
 
    /**
     * \brief Conversion operator to a modifiable view of the array.
@@ -144,50 +166,65 @@ public:
    operator ConstViewType() const;
 
    template< typename Array >
-   void setLike( const Array& array );
+   void
+   setLike( const Array& array );
 
    // Resets the array to the empty state.
-   void reset();
+   void
+   reset();
 
    // Returns true if the current array size is zero.
-   bool empty() const;
+   bool
+   empty() const;
 
    // TODO: swap
 
    // Returns the *global* size
-   IndexType getSize() const;
+   IndexType
+   getSize() const;
 
    // Sets all elements of the array to the given value
-   void setValue( ValueType value );
+   void
+   setValue( ValueType value );
 
    // Safe device-independent element setter
-   void setElement( IndexType i, ValueType value );
+   void
+   setElement( IndexType i, ValueType value );
 
    // Safe device-independent element getter
-   ValueType getElement( IndexType i ) const;
+   ValueType
+   getElement( IndexType i ) const;
 
    // Unsafe element accessor usable only from the Device
    __cuda_callable__
-   ValueType& operator[]( IndexType i );
+   ValueType&
+   operator[]( IndexType i );
 
    // Unsafe element accessor usable only from the Device
    __cuda_callable__
-   const ValueType& operator[]( IndexType i ) const;
+   const ValueType&
+   operator[]( IndexType i ) const;
 
    // Copy-assignment operator
-   DistributedArray& operator=( const DistributedArray& array );
+   DistributedArray&
+   operator=( const DistributedArray& array );
+
+   // Move-assignment operator
+   DistributedArray&
+   operator=( DistributedArray&& ) noexcept = default;
 
-   template< typename Array,
-             typename...,
-             typename = std::enable_if_t< HasSubscriptOperator<Array>::value > >
-   DistributedArray& operator=( const Array& array );
+   template< typename Array, typename..., typename = std::enable_if_t< HasSubscriptOperator< Array >::value > >
+   DistributedArray&
+   operator=( const Array& array );
 
    // Comparison operators
    template< typename Array >
-   bool operator==( const Array& array ) const;
+   bool
+   operator==( const Array& array ) const;
 
    template< typename Array >
-   bool operator!=( const Array& array ) const;
+   bool
+   operator!=( const Array& array ) const;
 
    /**
     * \brief Process the lambda function \e f for each array element in interval [ \e begin, \e end).
@@ -211,10 +248,12 @@ public:
     * \param f The lambda function to be processed.
     */
    template< typename Function >
-   void forElements( IndexType begin, IndexType end, Function&& f );
+   void
+   forElements( IndexType begin, IndexType end, Function&& f );
 
    /**
-    * \brief Process the lambda function \e f for each array element in interval [ \e begin, \e end) for constant instances of the array.
+    * \brief Process the lambda function \e f for each array element in interval [ \e begin, \e end) for constant instances of
+    * the array.
     *
     * The lambda function is supposed to be declared as
     *
@@ -235,7 +274,8 @@ public:
     * \param f The lambda function to be processed.
     */
    template< typename Function >
-   void forElements( IndexType begin, IndexType end, Function&& f ) const;
+   void
+   forElements( IndexType begin, IndexType end, Function&& f ) const;
 
 protected:
    ViewType view;
@@ -243,15 +283,18 @@ protected:
 
 private:
    template< typename Array, std::enable_if_t< std::is_same< typename Array::DeviceType, DeviceType >::value, bool > = true >
-   static void setSynchronizerHelper( ViewType& view, const Array& array )
+   static void
+   setSynchronizerHelper( ViewType& view, const Array& array )
    {
       view.setSynchronizer( array.getSynchronizer(), array.getValuesPerElement() );
    }
    template< typename Array, std::enable_if_t< ! std::is_same< typename Array::DeviceType, DeviceType >::value, bool > = true >
-   static void setSynchronizerHelper( ViewType& view, const Array& array ) {}
+   static void
+   setSynchronizerHelper( ViewType& view, const Array& array )
+   {}
 };
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
 
 #include "DistributedArray.hpp"
diff --git a/src/TNL/Containers/DistributedArray.hpp b/src/TNL/Containers/DistributedArray.hpp
index a12403d72e9606f0689f70533d6da049f6d7f851..367633d8fc9040c994f8d9584aa4b558709c845b 100644
--- a/src/TNL/Containers/DistributedArray.hpp
+++ b/src/TNL/Containers/DistributedArray.hpp
@@ -13,69 +13,51 @@
 namespace TNL {
 namespace Containers {
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-DistributedArray< Value, Device, Index, Allocator >::
-~DistributedArray()
+template< typename Value, typename Device, typename Index, typename Allocator >
+DistributedArray< Value, Device, Index, Allocator >::~DistributedArray()
 {
    // Wait for pending async operation, otherwise the synchronizer would crash
    // if the array goes out of scope.
    waitForSynchronization();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-DistributedArray< Value, Device, Index, Allocator >::
-DistributedArray( const Allocator& allocator )
-: localData( allocator )
-{
-}
+template< typename Value, typename Device, typename Index, typename Allocator >
+DistributedArray< Value, Device, Index, Allocator >::DistributedArray( const Allocator& allocator ) : localData( allocator )
+{}
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-DistributedArray< Value, Device, Index, Allocator >::
-DistributedArray( const DistributedArray& array )
+template< typename Value, typename Device, typename Index, typename Allocator >
+DistributedArray< Value, Device, Index, Allocator >::DistributedArray( const DistributedArray& array )
 {
    setLike( array );
    view = array;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-DistributedArray< Value, Device, Index, Allocator >::
-DistributedArray( const DistributedArray& array, const Allocator& allocator )
+template< typename Value, typename Device, typename Index, typename Allocator >
+DistributedArray< Value, Device, Index, Allocator >::DistributedArray( const DistributedArray& array,
+                                                                       const Allocator& allocator )
 : localData( allocator )
 {
    setLike( array );
    view = array;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-DistributedArray< Value, Device, Index, Allocator >::
-DistributedArray( LocalRangeType localRange, IndexType ghosts, IndexType globalSize, MPI_Comm communicator, const Allocator& allocator )
+template< typename Value, typename Device, typename Index, typename Allocator >
+DistributedArray< Value, Device, Index, Allocator >::DistributedArray( LocalRangeType localRange,
+                                                                       IndexType ghosts,
+                                                                       IndexType globalSize,
+                                                                       MPI_Comm communicator,
+                                                                       const Allocator& allocator )
 : localData( allocator )
 {
    setDistribution( localRange, ghosts, globalSize, communicator );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 void
-DistributedArray< Value, Device, Index, Allocator >::
-setDistribution( LocalRangeType localRange, IndexType ghosts, IndexType globalSize, MPI_Comm communicator )
+DistributedArray< Value, Device, Index, Allocator >::setDistribution( LocalRangeType localRange,
+                                                                      IndexType ghosts,
+                                                                      IndexType globalSize,
+                                                                      MPI_Comm communicator )
 {
    TNL_ASSERT_LE( localRange.getEnd(), globalSize, "end of the local range is outside of the global range" );
    if( communicator != MPI_COMM_NULL )
@@ -83,216 +65,139 @@ setDistribution( LocalRangeType localRange, IndexType ghosts, IndexType globalSi
    view.bind( localRange, ghosts, globalSize, communicator, localData.getView() );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 const Subrange< Index >&
-DistributedArray< Value, Device, Index, Allocator >::
-getLocalRange() const
+DistributedArray< Value, Device, Index, Allocator >::getLocalRange() const
 {
    return view.getLocalRange();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 Index
-DistributedArray< Value, Device, Index, Allocator >::
-getGhosts() const
+DistributedArray< Value, Device, Index, Allocator >::getGhosts() const
 {
    return view.getGhosts();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 MPI_Comm
-DistributedArray< Value, Device, Index, Allocator >::
-getCommunicator() const
+DistributedArray< Value, Device, Index, Allocator >::getCommunicator() const
 {
    return view.getCommunicator();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 Allocator
-DistributedArray< Value, Device, Index, Allocator >::
-getAllocator() const
+DistributedArray< Value, Device, Index, Allocator >::getAllocator() const
 {
    return localData.getAllocator();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 typename DistributedArray< Value, Device, Index, Allocator >::LocalViewType
-DistributedArray< Value, Device, Index, Allocator >::
-getLocalView()
+DistributedArray< Value, Device, Index, Allocator >::getLocalView()
 {
    return view.getLocalView();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 typename DistributedArray< Value, Device, Index, Allocator >::ConstLocalViewType
-DistributedArray< Value, Device, Index, Allocator >::
-getConstLocalView() const
+DistributedArray< Value, Device, Index, Allocator >::getConstLocalView() const
 {
    return view.getConstLocalView();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 typename DistributedArray< Value, Device, Index, Allocator >::LocalViewType
-DistributedArray< Value, Device, Index, Allocator >::
-getLocalViewWithGhosts()
+DistributedArray< Value, Device, Index, Allocator >::getLocalViewWithGhosts()
 {
    return view.getLocalViewWithGhosts();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 typename DistributedArray< Value, Device, Index, Allocator >::ConstLocalViewType
-DistributedArray< Value, Device, Index, Allocator >::
-getConstLocalViewWithGhosts() const
+DistributedArray< Value, Device, Index, Allocator >::getConstLocalViewWithGhosts() const
 {
    return view.getConstLocalViewWithGhosts();
 }
 
-
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 void
-DistributedArray< Value, Device, Index, Allocator >::
-copyFromGlobal( ConstLocalViewType globalArray )
+DistributedArray< Value, Device, Index, Allocator >::copyFromGlobal( ConstLocalViewType globalArray )
 {
    view.copyFromGlobal( globalArray );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 void
-DistributedArray< Value, Device, Index, Allocator >::
-setSynchronizer( std::shared_ptr< SynchronizerType > synchronizer, int valuesPerElement )
+DistributedArray< Value, Device, Index, Allocator >::setSynchronizer( std::shared_ptr< SynchronizerType > synchronizer,
+                                                                      int valuesPerElement )
 {
    view.setSynchronizer( synchronizer, valuesPerElement );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 std::shared_ptr< typename DistributedArrayView< Value, Device, Index >::SynchronizerType >
-DistributedArray< Value, Device, Index, Allocator >::
-getSynchronizer() const
+DistributedArray< Value, Device, Index, Allocator >::getSynchronizer() const
 {
    return view.getSynchronizer();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 int
-DistributedArray< Value, Device, Index, Allocator >::
-getValuesPerElement() const
+DistributedArray< Value, Device, Index, Allocator >::getValuesPerElement() const
 {
    return view.getValuesPerElement();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 void
-DistributedArray< Value, Device, Index, Allocator >::
-startSynchronization()
+DistributedArray< Value, Device, Index, Allocator >::startSynchronization()
 {
    view.startSynchronization();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 void
-DistributedArray< Value, Device, Index, Allocator >::
-waitForSynchronization() const
+DistributedArray< Value, Device, Index, Allocator >::waitForSynchronization() const
 {
    view.waitForSynchronization();
 }
 
-
 /*
  * Usual Array methods follow below.
  */
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 typename DistributedArray< Value, Device, Index, Allocator >::ViewType
-DistributedArray< Value, Device, Index, Allocator >::
-getView()
+DistributedArray< Value, Device, Index, Allocator >::getView()
 {
    return view;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 typename DistributedArray< Value, Device, Index, Allocator >::ConstViewType
-DistributedArray< Value, Device, Index, Allocator >::
-getConstView() const
+DistributedArray< Value, Device, Index, Allocator >::getConstView() const
 {
    return view.getConstView();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-DistributedArray< Value, Device, Index, Allocator >::
-operator ViewType()
+template< typename Value, typename Device, typename Index, typename Allocator >
+DistributedArray< Value, Device, Index, Allocator >::operator ViewType()
 {
    return getView();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-DistributedArray< Value, Device, Index, Allocator >::
-operator ConstViewType() const
+template< typename Value, typename Device, typename Index, typename Allocator >
+DistributedArray< Value, Device, Index, Allocator >::operator ConstViewType() const
 {
    return getConstView();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename Array >
+template< typename Value, typename Device, typename Index, typename Allocator >
+template< typename Array >
 void
-DistributedArray< Value, Device, Index, Allocator >::
-setLike( const Array& array )
+DistributedArray< Value, Device, Index, Allocator >::setLike( const Array& array )
 {
    localData.setLike( array.getConstLocalViewWithGhosts() );
    view.bind( array.getLocalRange(), array.getGhosts(), array.getSize(), array.getCommunicator(), localData.getView() );
@@ -301,171 +206,115 @@ setLike( const Array& array )
       setSynchronizerHelper( view, array );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 void
-DistributedArray< Value, Device, Index, Allocator >::
-reset()
+DistributedArray< Value, Device, Index, Allocator >::reset()
 {
    view.reset();
    localData.reset();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 bool
-DistributedArray< Value, Device, Index, Allocator >::
-empty() const
+DistributedArray< Value, Device, Index, Allocator >::empty() const
 {
    return view.empty();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 Index
-DistributedArray< Value, Device, Index, Allocator >::
-getSize() const
+DistributedArray< Value, Device, Index, Allocator >::getSize() const
 {
    return view.getSize();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 void
-DistributedArray< Value, Device, Index, Allocator >::
-setValue( ValueType value )
+DistributedArray< Value, Device, Index, Allocator >::setValue( ValueType value )
 {
    view.setValue( value );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 void
-DistributedArray< Value, Device, Index, Allocator >::
-setElement( IndexType i, ValueType value )
+DistributedArray< Value, Device, Index, Allocator >::setElement( IndexType i, ValueType value )
 {
    view.setElement( i, value );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 Value
-DistributedArray< Value, Device, Index, Allocator >::
-getElement( IndexType i ) const
+DistributedArray< Value, Device, Index, Allocator >::getElement( IndexType i ) const
 {
    return view.getElement( i );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 __cuda_callable__
 Value&
-DistributedArray< Value, Device, Index, Allocator >::
-operator[]( IndexType i )
+DistributedArray< Value, Device, Index, Allocator >::operator[]( IndexType i )
 {
    return view[ i ];
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 __cuda_callable__
 const Value&
-DistributedArray< Value, Device, Index, Allocator >::
-operator[]( IndexType i ) const
+DistributedArray< Value, Device, Index, Allocator >::operator[]( IndexType i ) const
 {
    return view[ i ];
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 DistributedArray< Value, Device, Index, Allocator >&
-DistributedArray< Value, Device, Index, Allocator >::
-operator=( const DistributedArray& array )
+DistributedArray< Value, Device, Index, Allocator >::operator=( const DistributedArray& array )
 {
    setLike( array );
    view = array;
    return *this;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename Array, typename..., typename >
+template< typename Value, typename Device, typename Index, typename Allocator >
+template< typename Array, typename..., typename >
 DistributedArray< Value, Device, Index, Allocator >&
-DistributedArray< Value, Device, Index, Allocator >::
-operator=( const Array& array )
+DistributedArray< Value, Device, Index, Allocator >::operator=( const Array& array )
 {
    setLike( array );
    view = array;
    return *this;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename Array >
+template< typename Value, typename Device, typename Index, typename Allocator >
+template< typename Array >
 bool
-DistributedArray< Value, Device, Index, Allocator >::
-operator==( const Array& array ) const
+DistributedArray< Value, Device, Index, Allocator >::operator==( const Array& array ) const
 {
    return view == array;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename Array >
+template< typename Value, typename Device, typename Index, typename Allocator >
+template< typename Array >
 bool
-DistributedArray< Value, Device, Index, Allocator >::
-operator!=( const Array& array ) const
+DistributedArray< Value, Device, Index, Allocator >::operator!=( const Array& array ) const
 {
    return view != array;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename Function >
+template< typename Value, typename Device, typename Index, typename Allocator >
+template< typename Function >
 void
-DistributedArray< Value, Device, Index, Allocator >::
-forElements( IndexType begin, IndexType end, Function&& f )
+DistributedArray< Value, Device, Index, Allocator >::forElements( IndexType begin, IndexType end, Function&& f )
 {
    view.forElements( begin, end, f );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename Function >
+template< typename Value, typename Device, typename Index, typename Allocator >
+template< typename Function >
 void
-DistributedArray< Value, Device, Index, Allocator >::
-forElements( IndexType begin, IndexType end, Function&& f ) const
+DistributedArray< Value, Device, Index, Allocator >::forElements( IndexType begin, IndexType end, Function&& f ) const
 {
    view.forElements( begin, end, f );
 }
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/DistributedArrayView.h b/src/TNL/Containers/DistributedArrayView.h
index a67869a75f729c26d2a5c1a337e03b66333b8332..0c4a616b2852895c80bba3fe6b8a0eefc14c4655 100644
--- a/src/TNL/Containers/DistributedArrayView.h
+++ b/src/TNL/Containers/DistributedArrayView.h
@@ -18,9 +18,7 @@
 namespace TNL {
 namespace Containers {
 
-template< typename Value,
-          typename Device = Devices::Host,
-          typename Index = int >
+template< typename Value, typename Device = Devices::Host, typename Index = int >
 class DistributedArrayView
 {
 public:
@@ -37,19 +35,21 @@ public:
    /**
     * \brief A template which allows to quickly obtain a \ref DistributedArrayView type with changed template parameters.
     */
-   template< typename _Value,
-             typename _Device = Device,
-             typename _Index = Index >
+   template< typename _Value, typename _Device = Device, typename _Index = Index >
    using Self = DistributedArrayView< _Value, _Device, _Index >;
 
-
    ~DistributedArrayView();
 
    // Initialization by raw data
-   DistributedArrayView( const LocalRangeType& localRange, IndexType ghosts, IndexType globalSize, MPI_Comm communicator, LocalViewType localData )
-   : localRange(localRange), ghosts(ghosts), globalSize(globalSize), communicator(communicator), localData(localData)
+   DistributedArrayView( const LocalRangeType& localRange,
+                         IndexType ghosts,
+                         IndexType globalSize,
+                         MPI_Comm communicator,
+                         LocalViewType localData )
+   : localRange( localRange ), ghosts( ghosts ), globalSize( globalSize ), communicator( communicator ), localData( localData )
    {
-      TNL_ASSERT_EQ( localData.getSize(), localRange.getSize() + ghosts,
+      TNL_ASSERT_EQ( localData.getSize(),
+                     localRange.getSize() + ghosts,
                      "The local array size does not match the local range of the distributed array." );
       TNL_ASSERT_GE( ghosts, 0, "The ghosts count must be non-negative." );
    }
@@ -64,49 +64,68 @@ public:
    DistributedArrayView( const DistributedArrayView< Value_, Device, Index >& );
 
    // default move-constructor
-   DistributedArrayView( DistributedArrayView&& ) = default;
+   DistributedArrayView( DistributedArrayView&& ) noexcept = default;
 
    // method for rebinding (reinitialization) to raw data
-   void bind( const LocalRangeType& localRange, IndexType ghosts, IndexType globalSize, MPI_Comm communicator, LocalViewType localData );
+   void
+   bind( const LocalRangeType& localRange,
+         IndexType ghosts,
+         IndexType globalSize,
+         MPI_Comm communicator,
+         LocalViewType localData );
 
    // Note that you can also bind directly to DistributedArray and other types implicitly
    // convertible to DistributedArrayView.
-   void bind( DistributedArrayView view );
+   void
+   bind( DistributedArrayView view );
 
    // binding to local array via raw pointer
    // (local range, ghosts, global size and communicators are preserved)
    template< typename Value_ >
-   void bind( Value_* data, IndexType localSize );
+   void
+   bind( Value_* data, IndexType localSize );
 
-   const LocalRangeType& getLocalRange() const;
+   const LocalRangeType&
+   getLocalRange() const;
 
-   IndexType getGhosts() const;
+   IndexType
+   getGhosts() const;
 
-   MPI_Comm getCommunicator() const;
+   MPI_Comm
+   getCommunicator() const;
 
-   LocalViewType getLocalView();
+   LocalViewType
+   getLocalView();
 
-   ConstLocalViewType getConstLocalView() const;
+   ConstLocalViewType
+   getConstLocalView() const;
 
-   LocalViewType getLocalViewWithGhosts();
+   LocalViewType
+   getLocalViewWithGhosts();
 
-   ConstLocalViewType getConstLocalViewWithGhosts() const;
+   ConstLocalViewType
+   getConstLocalViewWithGhosts() const;
 
-   void copyFromGlobal( ConstLocalViewType globalArray );
+   void
+   copyFromGlobal( ConstLocalViewType globalArray );
 
    // synchronizer stuff
-   void setSynchronizer( std::shared_ptr< SynchronizerType > synchronizer, int valuesPerElement = 1 );
+   void
+   setSynchronizer( std::shared_ptr< SynchronizerType > synchronizer, int valuesPerElement = 1 );
 
-   std::shared_ptr< SynchronizerType > getSynchronizer() const;
+   std::shared_ptr< SynchronizerType >
+   getSynchronizer() const;
 
-   int getValuesPerElement() const;
+   int
+   getValuesPerElement() const;
 
    // Note that this method is not thread-safe - only the thread which created
    // and "owns" the instance of this object can call this method.
-   void startSynchronization();
-
-   void waitForSynchronization() const;
+   void
+   startSynchronization();
 
+   void
+   waitForSynchronization() const;
 
    /*
     * Usual ArrayView methods follow below.
@@ -115,56 +134,72 @@ public:
    /**
     * \brief Returns a modifiable view of the array view.
     */
-   ViewType getView();
+   ViewType
+   getView();
 
    /**
     * \brief Returns a non-modifiable view of the array view.
     */
-   ConstViewType getConstView() const;
+   ConstViewType
+   getConstView() const;
 
    // Resets the array view to the empty state.
-   void reset();
+   void
+   reset();
 
    // Returns true if the current array view size is zero.
-   bool empty() const;
+   bool
+   empty() const;
 
    // TODO: swap
 
    // Returns the *global* size
-   IndexType getSize() const;
+   IndexType
+   getSize() const;
 
    // Sets all elements of the array to the given value
-   void setValue( ValueType value );
+   void
+   setValue( ValueType value );
 
    // Safe device-independent element setter
-   void setElement( IndexType i, ValueType value );
+   void
+   setElement( IndexType i, ValueType value );
 
    // Safe device-independent element getter
-   ValueType getElement( IndexType i ) const;
+   ValueType
+   getElement( IndexType i ) const;
 
    // Unsafe element accessor usable only from the Device
    __cuda_callable__
-   ValueType& operator[]( IndexType i );
+   ValueType&
+   operator[]( IndexType i );
 
    // Unsafe element accessor usable only from the Device
    __cuda_callable__
-   const ValueType& operator[]( IndexType i ) const;
+   const ValueType&
+   operator[]( IndexType i ) const;
 
    // Copy-assignment does deep copy, just like regular array, but the sizes
    // must match (i.e. copy-assignment cannot resize).
-   DistributedArrayView& operator=( const DistributedArrayView& view );
+   DistributedArrayView&
+   operator=( const DistributedArrayView& view );
+
+   // Move-assignment operator
+   DistributedArrayView&
+   operator=( DistributedArrayView&& ) noexcept = default;
 
-   template< typename Array,
-             typename...,
-             typename = std::enable_if_t< HasSubscriptOperator<Array>::value > >
-   DistributedArrayView& operator=( const Array& array );
+   template< typename Array, typename..., typename = std::enable_if_t< HasSubscriptOperator< Array >::value > >
+   DistributedArrayView&
+   operator=( const Array& array );
 
    // Comparison operators
    template< typename Array >
-   bool operator==( const Array& array ) const;
+   bool
+   operator==( const Array& array ) const;
 
    template< typename Array >
-   bool operator!=( const Array& array ) const;
+   bool
+   operator!=( const Array& array ) const;
 
    /**
     * \brief Process the lambda function \e f for each array element in interval [ \e begin, \e end).
@@ -188,10 +223,12 @@ public:
     * \param f The lambda function to be processed.
     */
    template< typename Function >
-   void forElements( IndexType begin, IndexType end, Function&& f );
+   void
+   forElements( IndexType begin, IndexType end, Function&& f );
 
    /**
-    * \brief Process the lambda function \e f for each array element in interval [ \e begin, \e end) for constant instances of the array.
+    * \brief Process the lambda function \e f for each array element in interval [ \e begin, \e end) for constant instances of
+    * the array.
     *
     * The lambda function is supposed to be declared as
     *
@@ -212,7 +249,8 @@ public:
     * \param f The lambda function to be processed.
     */
    template< typename Function >
-   void forElements( IndexType begin, IndexType end, Function&& f ) const;
+   void
+   forElements( IndexType begin, IndexType end, Function&& f ) const;
 
 protected:
    LocalRangeType localRange;
@@ -225,7 +263,7 @@ protected:
    int valuesPerElement = 1;
 };
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
 
 #include "DistributedArrayView.hpp"
diff --git a/src/TNL/Containers/DistributedArrayView.hpp b/src/TNL/Containers/DistributedArrayView.hpp
index b3d0ebb418d0d1178be2a77e0db543e306de8a57..f260c005f8a7e0880df1ffda00ca936359a68759 100644
--- a/src/TNL/Containers/DistributedArrayView.hpp
+++ b/src/TNL/Containers/DistributedArrayView.hpp
@@ -15,11 +15,8 @@
 namespace TNL {
 namespace Containers {
 
-template< typename Value,
-          typename Device,
-          typename Index >
-DistributedArrayView< Value, Device, Index >::
-~DistributedArrayView()
+template< typename Value, typename Device, typename Index >
+DistributedArrayView< Value, Device, Index >::~DistributedArrayView()
 {
    // Wait for pending async operation, otherwise the synchronizer might crash
    // if the view goes out of scope.
@@ -28,29 +25,24 @@ DistributedArrayView< Value, Device, Index >::
    waitForSynchronization();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
-   template< typename Value_ >
-DistributedArrayView< Value, Device, Index >::
-DistributedArrayView( const DistributedArrayView< Value_, Device, Index >& view )
-: localRange( view.getLocalRange() ),
-  ghosts( view.getGhosts() ),
-  globalSize( view.getSize() ),
-  communicator( view.getCommunicator() ),
-  localData( view.getConstLocalViewWithGhosts() ),
-  synchronizer( view.getSynchronizer() ),
-  valuesPerElement( view.getValuesPerElement() )
+template< typename Value, typename Device, typename Index >
+template< typename Value_ >
+DistributedArrayView< Value, Device, Index >::DistributedArrayView( const DistributedArrayView< Value_, Device, Index >& view )
+: localRange( view.getLocalRange() ), ghosts( view.getGhosts() ), globalSize( view.getSize() ),
+  communicator( view.getCommunicator() ), localData( view.getConstLocalViewWithGhosts() ),
+  synchronizer( view.getSynchronizer() ), valuesPerElement( view.getValuesPerElement() )
 {}
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 void
-DistributedArrayView< Value, Device, Index >::
-bind( const LocalRangeType& localRange, IndexType ghosts, IndexType globalSize, MPI_Comm communicator, LocalViewType localData )
-{
-   TNL_ASSERT_EQ( localData.getSize(), localRange.getSize() + ghosts,
+DistributedArrayView< Value, Device, Index >::bind( const LocalRangeType& localRange,
+                                                    IndexType ghosts,
+                                                    IndexType globalSize,
+                                                    MPI_Comm communicator,
+                                                    LocalViewType localData )
+{
+   TNL_ASSERT_EQ( localData.getSize(),
+                  localRange.getSize() + ghosts,
                   "The local array size does not match the local range of the distributed array." );
    TNL_ASSERT_GE( ghosts, 0, "The ghosts count must be non-negative." );
 
@@ -61,12 +53,9 @@ bind( const LocalRangeType& localRange, IndexType ghosts, IndexType globalSize,
    this->localData.bind( localData );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 void
-DistributedArrayView< Value, Device, Index >::
-bind( DistributedArrayView view )
+DistributedArrayView< Value, Device, Index >::bind( DistributedArrayView view )
 {
    localRange = view.getLocalRange();
    ghosts = view.getGhosts();
@@ -78,103 +67,76 @@ bind( DistributedArrayView view )
       setSynchronizer( view.getSynchronizer(), view.getValuesPerElement() );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
-   template< typename Value_ >
+template< typename Value, typename Device, typename Index >
+template< typename Value_ >
 void
-DistributedArrayView< Value, Device, Index >::
-bind( Value_* data, IndexType localSize )
+DistributedArrayView< Value, Device, Index >::bind( Value_* data, IndexType localSize )
 {
-   TNL_ASSERT_EQ( localSize, localRange.getSize() + ghosts,
+   TNL_ASSERT_EQ( localSize,
+                  localRange.getSize() + ghosts,
                   "The local array size does not match the local range of the distributed array." );
    localData.bind( data, localSize );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 const Subrange< Index >&
-DistributedArrayView< Value, Device, Index >::
-getLocalRange() const
+DistributedArrayView< Value, Device, Index >::getLocalRange() const
 {
    return localRange;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 Index
-DistributedArrayView< Value, Device, Index >::
-getGhosts() const
+DistributedArrayView< Value, Device, Index >::getGhosts() const
 {
    return ghosts;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 MPI_Comm
-DistributedArrayView< Value, Device, Index >::
-getCommunicator() const
+DistributedArrayView< Value, Device, Index >::getCommunicator() const
 {
    return communicator;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 typename DistributedArrayView< Value, Device, Index >::LocalViewType
-DistributedArrayView< Value, Device, Index >::
-getLocalView()
+DistributedArrayView< Value, Device, Index >::getLocalView()
 {
    return LocalViewType( localData.getData(), localRange.getSize() );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 typename DistributedArrayView< Value, Device, Index >::ConstLocalViewType
-DistributedArrayView< Value, Device, Index >::
-getConstLocalView() const
+DistributedArrayView< Value, Device, Index >::getConstLocalView() const
 {
    return ConstLocalViewType( localData.getData(), localRange.getSize() );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 typename DistributedArrayView< Value, Device, Index >::LocalViewType
-DistributedArrayView< Value, Device, Index >::
-getLocalViewWithGhosts()
+DistributedArrayView< Value, Device, Index >::getLocalViewWithGhosts()
 {
    return localData;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 typename DistributedArrayView< Value, Device, Index >::ConstLocalViewType
-DistributedArrayView< Value, Device, Index >::
-getConstLocalViewWithGhosts() const
+DistributedArrayView< Value, Device, Index >::getConstLocalViewWithGhosts() const
 {
    return localData;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 void
-DistributedArrayView< Value, Device, Index >::
-copyFromGlobal( ConstLocalViewType globalArray )
+DistributedArrayView< Value, Device, Index >::copyFromGlobal( ConstLocalViewType globalArray )
 {
-   TNL_ASSERT_EQ( getSize(), globalArray.getSize(),
-                  "given global array has different size than the distributed array view" );
+   TNL_ASSERT_EQ( getSize(), globalArray.getSize(), "given global array has different size than the distributed array view" );
 
    LocalViewType localView = getLocalView();
    const LocalRangeType localRange = getLocalRange();
 
-   auto kernel = [=] __cuda_callable__ ( IndexType i ) mutable
+   auto kernel = [ = ] __cuda_callable__( IndexType i ) mutable
    {
       localView[ i ] = globalArray[ localRange.getGlobalIndex( i ) ];
    };
@@ -183,43 +145,32 @@ copyFromGlobal( ConstLocalViewType globalArray )
    startSynchronization();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 void
-DistributedArrayView< Value, Device, Index >::
-setSynchronizer( std::shared_ptr< SynchronizerType > synchronizer, int valuesPerElement )
+DistributedArrayView< Value, Device, Index >::setSynchronizer( std::shared_ptr< SynchronizerType > synchronizer,
+                                                               int valuesPerElement )
 {
    this->synchronizer = synchronizer;
    this->valuesPerElement = valuesPerElement;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 std::shared_ptr< typename DistributedArrayView< Value, Device, Index >::SynchronizerType >
-DistributedArrayView< Value, Device, Index >::
-getSynchronizer() const
+DistributedArrayView< Value, Device, Index >::getSynchronizer() const
 {
    return synchronizer;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 int
-DistributedArrayView< Value, Device, Index >::
-getValuesPerElement() const
+DistributedArrayView< Value, Device, Index >::getValuesPerElement() const
 {
    return valuesPerElement;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 void
-DistributedArrayView< Value, Device, Index >::
-startSynchronization()
+DistributedArrayView< Value, Device, Index >::startSynchronization()
 {
    if( ghosts == 0 )
       return;
@@ -230,16 +181,13 @@ startSynchronization()
    TNL_ASSERT_TRUE( synchronizer, "the synchronizer was not set" );
 
    typename SynchronizerType::ByteArrayView bytes;
-   bytes.bind( reinterpret_cast<std::uint8_t*>( localData.getData() ), sizeof(ValueType) * localData.getSize() );
-   synchronizer->synchronizeByteArrayAsync( bytes, sizeof(ValueType) * valuesPerElement );
+   bytes.bind( reinterpret_cast< std::uint8_t* >( localData.getData() ), sizeof( ValueType ) * localData.getSize() );
+   synchronizer->synchronizeByteArrayAsync( bytes, sizeof( ValueType ) * valuesPerElement );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 void
-DistributedArrayView< Value, Device, Index >::
-waitForSynchronization() const
+DistributedArrayView< Value, Device, Index >::waitForSynchronization() const
 {
    if( synchronizer && synchronizer->async_op.valid() ) {
       synchronizer->async_wait_timer.start();
@@ -248,33 +196,23 @@ waitForSynchronization() const
    }
 }
 
-
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 typename DistributedArrayView< Value, Device, Index >::ViewType
-DistributedArrayView< Value, Device, Index >::
-getView()
+DistributedArrayView< Value, Device, Index >::getView()
 {
    return *this;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 typename DistributedArrayView< Value, Device, Index >::ConstViewType
-DistributedArrayView< Value, Device, Index >::
-getConstView() const
+DistributedArrayView< Value, Device, Index >::getConstView() const
 {
    return *this;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 void
-DistributedArrayView< Value, Device, Index >::
-reset()
+DistributedArrayView< Value, Device, Index >::reset()
 {
    localRange.reset();
    ghosts = 0;
@@ -283,91 +221,67 @@ reset()
    localData.reset();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 bool
-DistributedArrayView< Value, Device, Index >::
-empty() const
+DistributedArrayView< Value, Device, Index >::empty() const
 {
    return getSize() == 0;
 }
 
 // TODO: swap
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 Index
-DistributedArrayView< Value, Device, Index >::
-getSize() const
+DistributedArrayView< Value, Device, Index >::getSize() const
 {
    return globalSize;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 void
-DistributedArrayView< Value, Device, Index >::
-setValue( ValueType value )
+DistributedArrayView< Value, Device, Index >::setValue( ValueType value )
 {
    localData.setValue( value );
    startSynchronization();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 void
-DistributedArrayView< Value, Device, Index >::
-setElement( IndexType i, ValueType value )
+DistributedArrayView< Value, Device, Index >::setElement( IndexType i, ValueType value )
 {
    const IndexType li = localRange.getLocalIndex( i );
    localData.setElement( li, value );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 Value
-DistributedArrayView< Value, Device, Index >::
-getElement( IndexType i ) const
+DistributedArrayView< Value, Device, Index >::getElement( IndexType i ) const
 {
    const IndexType li = localRange.getLocalIndex( i );
    return localData.getElement( li );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 __cuda_callable__
 Value&
-DistributedArrayView< Value, Device, Index >::
-operator[]( IndexType i )
+DistributedArrayView< Value, Device, Index >::operator[]( IndexType i )
 {
    const IndexType li = localRange.getLocalIndex( i );
    return localData[ li ];
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 __cuda_callable__
 const Value&
-DistributedArrayView< Value, Device, Index >::
-operator[]( IndexType i ) const
+DistributedArrayView< Value, Device, Index >::operator[]( IndexType i ) const
 {
    const IndexType li = localRange.getLocalIndex( i );
    return localData[ li ];
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 DistributedArrayView< Value, Device, Index >&
-DistributedArrayView< Value, Device, Index >::
-operator=( const DistributedArrayView& view )
+DistributedArrayView< Value, Device, Index >::operator=( const DistributedArrayView& view )
 {
    TNL_ASSERT_EQ( getSize(), view.getSize(), "The sizes of the array views must be equal, views are not resizable." );
    TNL_ASSERT_EQ( getLocalRange(), view.getLocalRange(), "The local ranges must be equal, views are not resizable." );
@@ -383,13 +297,10 @@ operator=( const DistributedArrayView& view )
    return *this;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
-   template< typename Array, typename..., typename >
+template< typename Value, typename Device, typename Index >
+template< typename Array, typename..., typename >
 DistributedArrayView< Value, Device, Index >&
-DistributedArrayView< Value, Device, Index >::
-operator=( const Array& array )
+DistributedArrayView< Value, Device, Index >::operator=( const Array& array )
 {
    TNL_ASSERT_EQ( getSize(), array.getSize(), "The global sizes must be equal, views are not resizable." );
    TNL_ASSERT_EQ( getLocalRange(), array.getLocalRange(), "The local ranges must be equal, views are not resizable." );
@@ -405,75 +316,65 @@ operator=( const Array& array )
    return *this;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
-   template< typename Array >
+template< typename Value, typename Device, typename Index >
+template< typename Array >
 bool
-DistributedArrayView< Value, Device, Index >::
-operator==( const Array& array ) const
+DistributedArrayView< Value, Device, Index >::operator==( const Array& array ) const
 {
    // we can't run allreduce if the communicators are different
    if( communicator != array.getCommunicator() )
       return false;
-   const bool localResult =
-         localRange == array.getLocalRange() &&
-         ghosts == array.getGhosts() &&
-         globalSize == array.getSize() &&
-         // compare without ghosts
-         getConstLocalView() == array.getConstLocalView();
+   const bool localResult = localRange == array.getLocalRange() && ghosts == array.getGhosts() && globalSize == array.getSize()
+                         &&
+                            // compare without ghosts
+                            getConstLocalView() == array.getConstLocalView();
    bool result = true;
    if( communicator != MPI_COMM_NULL )
       MPI::Allreduce( &localResult, &result, 1, MPI_LAND, communicator );
    return result;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
-   template< typename Array >
+template< typename Value, typename Device, typename Index >
+template< typename Array >
 bool
-DistributedArrayView< Value, Device, Index >::
-operator!=( const Array& array ) const
+DistributedArrayView< Value, Device, Index >::operator!=( const Array& array ) const
 {
-   return ! (*this == array);
+   return ! ( *this == array );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
-   template< typename Function >
+template< typename Value, typename Device, typename Index >
+template< typename Function >
 void
-DistributedArrayView< Value, Device, Index >::
-forElements( IndexType begin, IndexType end, Function&& f )
+DistributedArrayView< Value, Device, Index >::forElements( IndexType begin, IndexType end, Function&& f )
 {
-   // GOTCHA: we can't use localRange.getLocalIndex to calculate localEnd, because localRange.getEnd() does not return a valid local index
+   // GOTCHA: we can't use localRange.getLocalIndex to calculate localEnd, because localRange.getEnd() does not return a valid
+   // local index
    const IndexType localBegin = max( begin, localRange.getBegin() ) - localRange.getBegin();
-   const IndexType localEnd   = min( end,   localRange.getEnd()   ) - localRange.getBegin();
+   const IndexType localEnd = min( end, localRange.getEnd() ) - localRange.getBegin();
    const LocalRangeType localRange = getLocalRange();
-   auto local_f = [=] __cuda_callable__ ( IndexType idx, ValueType& value ) mutable {
+   auto local_f = [ = ] __cuda_callable__( IndexType idx, ValueType & value ) mutable
+   {
       f( localRange.getGlobalIndex( idx ), value );
    };
    localData.forElements( localBegin, localEnd, local_f );
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
-   template< typename Function >
+template< typename Value, typename Device, typename Index >
+template< typename Function >
 void
-DistributedArrayView< Value, Device, Index >::
-forElements( IndexType begin, IndexType end, Function&& f ) const
+DistributedArrayView< Value, Device, Index >::forElements( IndexType begin, IndexType end, Function&& f ) const
 {
-   // GOTCHA: we can't use localRange.getLocalIndex to calculate localEnd, because localRange.getEnd() does not return a valid local index
+   // GOTCHA: we can't use localRange.getLocalIndex to calculate localEnd, because localRange.getEnd() does not return a valid
+   // local index
    const IndexType localBegin = max( begin, localRange.getBegin() ) - localRange.getBegin();
-   const IndexType localEnd   = min( end,   localRange.getEnd()   ) - localRange.getBegin();
+   const IndexType localEnd = min( end, localRange.getEnd() ) - localRange.getBegin();
    const LocalRangeType localRange = getLocalRange();
-   auto local_f = [=] __cuda_callable__ ( IndexType idx, const ValueType& value ) {
+   auto local_f = [ = ] __cuda_callable__( IndexType idx, const ValueType& value )
+   {
       f( localRange.getGlobalIndex( idx ), value );
    };
    localData.forElements( localBegin, localEnd, local_f );
 }
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/DistributedNDArray.h b/src/TNL/Containers/DistributedNDArray.h
index 43343b545ebbd151ad4b566a9b6eaf6a45ce636f..4f9e99c26b70f04ebc937d2026bf8de204df0827 100644
--- a/src/TNL/Containers/DistributedNDArray.h
+++ b/src/TNL/Containers/DistributedNDArray.h
@@ -43,23 +43,25 @@ public:
    explicit DistributedNDArray( const DistributedNDArray& ) = default;
 
    // Copy constructor with a specific allocator (makes a deep copy).
-   explicit DistributedNDArray( const DistributedNDArray& other, const AllocatorType& allocator )
-   : localArray( allocator )
+   explicit DistributedNDArray( const DistributedNDArray& other, const AllocatorType& allocator ) : localArray( allocator )
    {
       *this = other;
    }
 
    // Standard copy-semantics with deep copy, just like regular 1D array.
    // Mismatched sizes cause reallocations.
-   DistributedNDArray& operator=( const DistributedNDArray& other ) = default;
+   DistributedNDArray&
+   operator=( const DistributedNDArray& other ) = default;
 
    // default move-semantics
-   DistributedNDArray( DistributedNDArray&& ) = default;
-   DistributedNDArray& operator=( DistributedNDArray&& ) = default;
+   DistributedNDArray( DistributedNDArray&& ) noexcept = default;
+   DistributedNDArray&
+   operator=( DistributedNDArray&& ) noexcept = default;
 
    // Templated copy-assignment
    template< typename OtherArray >
-   DistributedNDArray& operator=( const OtherArray& other )
+   DistributedNDArray&
+   operator=( const OtherArray& other )
    {
       globalSizes = other.getSizes();
       localBegins = other.getLocalBegins();
@@ -69,62 +71,73 @@ public:
       return *this;
    }
 
-   static constexpr std::size_t getDimension()
+   static constexpr std::size_t
+   getDimension()
    {
       return NDArray::getDimension();
    }
 
-   AllocatorType getAllocator() const
+   AllocatorType
+   getAllocator() const
    {
       return localArray.getAllocator();
    }
 
-   MPI_Comm getCommunicator() const
+   MPI_Comm
+   getCommunicator() const
    {
       return communicator;
    }
 
    // Returns the *global* sizes
-   const SizesHolderType& getSizes() const
+   const SizesHolderType&
+   getSizes() const
    {
       return globalSizes;
    }
 
    // Returns the *global* size
    template< std::size_t level >
-   IndexType getSize() const
+   IndexType
+   getSize() const
    {
       return globalSizes.template getSize< level >();
    }
 
-   LocalBeginsType getLocalBegins() const
+   LocalBeginsType
+   getLocalBegins() const
    {
       return localBegins;
    }
 
-   SizesHolderType getLocalEnds() const
+   SizesHolderType
+   getLocalEnds() const
    {
       return localEnds;
    }
 
    template< std::size_t level >
-   LocalRangeType getLocalRange() const
+   LocalRangeType
+   getLocalRange() const
    {
       return LocalRangeType( localBegins.template getSize< level >(), localEnds.template getSize< level >() );
    }
 
    // returns the local storage size
-   IndexType getLocalStorageSize() const
+   IndexType
+   getLocalStorageSize() const
    {
       return localArray.getStorageSize();
    }
 
-   LocalViewType getLocalView()
+   LocalViewType
+   getLocalView()
    {
       return localArray.getView();
    }
 
-   ConstLocalViewType getConstLocalView() const
+   ConstLocalViewType
+   getConstLocalView() const
    {
       return localArray.getConstView();
    }
@@ -136,24 +149,26 @@ public:
    {
       static_assert( sizeof...( indices ) == SizesHolderType::getDimension(), "got wrong number of indices" );
       __ndarray_impl::assertIndicesInRange( localBegins, localEnds, OverlapsType{}, std::forward< IndexTypes >( indices )... );
-      auto getStorageIndex = [this]( auto&&... indices )
+      auto getStorageIndex = [ this ]( auto&&... indices )
       {
-         return this->localArray.getStorageIndex( std::forward< decltype(indices) >( indices )... );
+         return this->localArray.getStorageIndex( std::forward< decltype( indices ) >( indices )... );
       };
-      return __ndarray_impl::host_call_with_unshifted_indices< LocalBeginsType >( localBegins, getStorageIndex, std::forward< IndexTypes >( indices )... );
+      return __ndarray_impl::host_call_with_unshifted_indices< LocalBeginsType >(
+         localBegins, getStorageIndex, std::forward< IndexTypes >( indices )... );
    }
 
-   ValueType* getData()
+   ValueType*
+   getData()
    {
       return localArray.getData();
    }
 
-   std::add_const_t< ValueType >* getData() const
+   std::add_const_t< ValueType >*
+   getData() const
    {
       return localArray.getData();
    }
 
-
    template< typename... IndexTypes >
    __cuda_callable__
    ValueType&
@@ -161,7 +176,8 @@ public:
    {
       static_assert( sizeof...( indices ) == getDimension(), "got wrong number of indices" );
       __ndarray_impl::assertIndicesInRange( localBegins, localEnds, OverlapsType{}, std::forward< IndexTypes >( indices )... );
-      return __ndarray_impl::call_with_unshifted_indices< LocalBeginsType >( localBegins, localArray, std::forward< IndexTypes >( indices )... );
+      return __ndarray_impl::call_with_unshifted_indices< LocalBeginsType >(
+         localBegins, localArray, std::forward< IndexTypes >( indices )... );
    }
 
    template< typename... IndexTypes >
@@ -171,7 +187,8 @@ public:
    {
       static_assert( sizeof...( indices ) == getDimension(), "got wrong number of indices" );
       __ndarray_impl::assertIndicesInRange( localBegins, localEnds, OverlapsType{}, std::forward< IndexTypes >( indices )... );
-      return __ndarray_impl::call_with_unshifted_indices< LocalBeginsType >( localBegins, localArray, std::forward< IndexTypes >( indices )... );
+      return __ndarray_impl::call_with_unshifted_indices< LocalBeginsType >(
+         localBegins, localArray, std::forward< IndexTypes >( indices )... );
    }
 
    // bracket operator for 1D arrays
@@ -193,41 +210,43 @@ public:
       return localArray[ index - localBegins.template getSize< 0 >() ];
    }
 
-   ViewType getView()
+   ViewType
+   getView()
    {
       return ViewType( localArray.getView(), globalSizes, localBegins, localEnds, communicator );
    }
 
-   ConstViewType getConstView() const
+   ConstViewType
+   getConstView() const
    {
       return ConstViewType( localArray.getConstView(), globalSizes, localBegins, localEnds, communicator );
    }
 
    // TODO: overlaps should be skipped, otherwise it works only after synchronization
-   bool operator==( const DistributedNDArray& other ) const
+   bool
+   operator==( const DistributedNDArray& other ) const
    {
       // we can't run allreduce if the communicators are different
       if( communicator != other.getCommunicator() )
          return false;
-      const bool localResult =
-            globalSizes == other.globalSizes &&
-            localBegins == other.localBegins &&
-            localEnds == other.localEnds &&
-            localArray == other.localArray;
+      const bool localResult = globalSizes == other.globalSizes && localBegins == other.localBegins
+                            && localEnds == other.localEnds && localArray == other.localArray;
       bool result = true;
       if( communicator != MPI_COMM_NULL )
          MPI::Allreduce( &localResult, &result, 1, MPI_LAND, communicator );
       return result;
    }
 
-   bool operator!=( const DistributedNDArray& other ) const
+   bool
+   operator!=( const DistributedNDArray& other ) const
    {
-      return ! (*this == other);
+      return ! ( *this == other );
    }
 
    // iterate over all local elements
    template< typename Device2 = DeviceType, typename Func >
-   void forAll( Func f ) const
+   void
+   forAll( Func f ) const
    {
       __ndarray_impl::ExecutorDispatcher< PermutationType, Device2 > dispatch;
       dispatch( localBegins, localEnds, f );
@@ -235,7 +254,8 @@ public:
 
    // iterate over local elements which are not neighbours of *global* boundaries
    template< typename Device2 = DeviceType, typename Func >
-   void forInternal( Func f ) const
+   void
+   forInternal( Func f ) const
    {
       // add static sizes
       using Begins = __ndarray_impl::LocalBeginsHolder< SizesHolderType, 1 >;
@@ -257,7 +277,8 @@ public:
 
    // iterate over local elements inside the given [begins, ends) range specified by global indices
    template< typename Device2 = DeviceType, typename Func, typename Begins, typename Ends >
-   void forInternal( Func f, const Begins& begins, const Ends& ends ) const
+   void
+   forInternal( Func f, const Begins& begins, const Ends& ends ) const
    {
       // TODO: assert "localBegins <= begins <= localEnds", "localBegins <= ends <= localEnds"
       __ndarray_impl::ExecutorDispatcher< PermutationType, Device2 > dispatch;
@@ -266,7 +287,8 @@ public:
 
    // iterate over local elements which are neighbours of *global* boundaries
    template< typename Device2 = DeviceType, typename Func >
-   void forBoundary( Func f ) const
+   void
+   forBoundary( Func f ) const
    {
       // add static sizes
       using SkipBegins = __ndarray_impl::LocalBeginsHolder< SizesHolderType, 1 >;
@@ -288,7 +310,8 @@ public:
 
    // iterate over local elements outside the given [skipBegins, skipEnds) range specified by global indices
    template< typename Device2 = DeviceType, typename Func, typename SkipBegins, typename SkipEnds >
-   void forBoundary( Func f, const SkipBegins& skipBegins, const SkipEnds& skipEnds ) const
+   void
+   forBoundary( Func f, const SkipBegins& skipBegins, const SkipEnds& skipEnds ) const
    {
       // TODO: assert "localBegins <= skipBegins <= localEnds", "localBegins <= skipEnds <= localEnds"
       __ndarray_impl::BoundaryExecutorDispatcher< PermutationType, Device2 > dispatch;
@@ -297,7 +320,8 @@ public:
 
    // iterate over local elements which are not neighbours of overlaps (if all overlaps are 0, it is equivalent to forAll)
    template< typename Device2 = DeviceType, typename Func >
-   void forLocalInternal( Func f ) const
+   void
+   forLocalInternal( Func f ) const
    {
       // add overlaps to dynamic sizes
       LocalBeginsType begins;
@@ -305,7 +329,8 @@ public:
 
       // subtract overlaps from dynamic sizes
       SizesHolderType ends;
-      __ndarray_impl::SetSizesSubtractOverlapsHelper< SizesHolderType, SizesHolderType, OverlapsType >::subtract( ends, localEnds );
+      __ndarray_impl::SetSizesSubtractOverlapsHelper< SizesHolderType, SizesHolderType, OverlapsType >::subtract( ends,
+                                                                                                                  localEnds );
 
       __ndarray_impl::ExecutorDispatcher< PermutationType, Device2 > dispatch;
       dispatch( begins, ends, f );
@@ -313,15 +338,18 @@ public:
 
    // iterate over local elements which are neighbours of overlaps (if all overlaps are 0, it has no effect)
    template< typename Device2 = DeviceType, typename Func >
-   void forLocalBoundary( Func f ) const
+   void
+   forLocalBoundary( Func f ) const
    {
       // add overlaps to dynamic sizes
       LocalBeginsType skipBegins;
-      __ndarray_impl::SetSizesAddOverlapsHelper< LocalBeginsType, SizesHolderType, OverlapsType >::add( skipBegins, localBegins );
+      __ndarray_impl::SetSizesAddOverlapsHelper< LocalBeginsType, SizesHolderType, OverlapsType >::add( skipBegins,
+                                                                                                        localBegins );
 
       // subtract overlaps from dynamic sizes
       SizesHolderType skipEnds;
-      __ndarray_impl::SetSizesSubtractOverlapsHelper< SizesHolderType, SizesHolderType, OverlapsType >::subtract( skipEnds, localEnds );
+      __ndarray_impl::SetSizesSubtractOverlapsHelper< SizesHolderType, SizesHolderType, OverlapsType >::subtract( skipEnds,
+                                                                                                                  localEnds );
 
       __ndarray_impl::BoundaryExecutorDispatcher< PermutationType, Device2 > dispatch;
       dispatch( localBegins, skipBegins, skipEnds, localEnds, f );
@@ -329,11 +357,13 @@ public:
 
    // iterate over elements of overlaps (if all overlaps are 0, it has no effect)
    template< typename Device2 = DeviceType, typename Func >
-   void forOverlaps( Func f ) const
+   void
+   forOverlaps( Func f ) const
    {
       // subtract overlaps from dynamic sizes
       LocalBeginsType begins;
-      __ndarray_impl::SetSizesSubtractOverlapsHelper< LocalBeginsType, SizesHolderType, OverlapsType >::subtract( begins, localBegins );
+      __ndarray_impl::SetSizesSubtractOverlapsHelper< LocalBeginsType, SizesHolderType, OverlapsType >::subtract( begins,
+                                                                                                                  localBegins );
 
       // add overlaps to dynamic sizes
       SizesHolderType ends;
@@ -343,12 +373,12 @@ public:
       dispatch( begins, localBegins, localEnds, ends, f );
    }
 
-
    // extra methods
 
    // Sets the *global* size, but does not allocate storage
    template< typename... IndexTypes >
-   void setSizes( IndexTypes&&... sizes )
+   void
+   setSizes( IndexTypes&&... sizes )
    {
       static_assert( sizeof...( sizes ) == getDimension(), "got wrong number of sizes" );
       __ndarray_impl::setSizesHelper( globalSizes, std::forward< IndexTypes >( sizes )... );
@@ -358,9 +388,11 @@ public:
    }
 
    template< std::size_t level >
-   void setDistribution( IndexType begin, IndexType end, MPI_Comm communicator = MPI_COMM_WORLD )
+   void
+   setDistribution( IndexType begin, IndexType end, MPI_Comm communicator = MPI_COMM_WORLD )
    {
-      static_assert( SizesHolderType::template getStaticSize< level >() == 0, "NDArray cannot be distributed in static dimensions." );
+      static_assert( SizesHolderType::template getStaticSize< level >() == 0,
+                     "NDArray cannot be distributed in static dimensions." );
       TNL_ASSERT_GE( begin, 0, "begin must be non-negative" );
       TNL_ASSERT_LE( end, globalSizes.template getSize< level >(), "end must not be greater than global size" );
       TNL_ASSERT_LT( begin, end, "begin must be lesser than end" );
@@ -372,11 +404,13 @@ public:
    }
 
    // Computes the distributed storage size and allocates the local array
-   void allocate()
+   void
+   allocate()
    {
       SizesHolderType localSizes;
       Algorithms::staticFor< std::size_t, 0, SizesHolderType::getDimension() >(
-         [&] ( auto level ) {
+         [ & ]( auto level )
+         {
             if( SizesHolderType::template getStaticSize< level >() != 0 )
                return;
 
@@ -385,16 +419,18 @@ public:
             if( begin == end )
                localSizes.template setSize< level >( globalSizes.template getSize< level >() );
             else {
-               TNL_ASSERT_GE( end - begin, (decltype(end)) __ndarray_impl::get<level>( OverlapsType{} ), "local size is less than the size of overlaps" );
-               //localSizes.template setSize< level >( end - begin + 2 * __ndarray_impl::get<level>( OverlapsType{} ) );
+               TNL_ASSERT_GE( end - begin,
+                              (decltype( end )) __ndarray_impl::get< level >( OverlapsType{} ),
+                              "local size is less than the size of overlaps" );
+               // localSizes.template setSize< level >( end - begin + 2 * __ndarray_impl::get<level>( OverlapsType{} ) );
                localSizes.template setSize< level >( end - begin );
             }
-         }
-      );
+         } );
       localArray.setSize( localSizes );
    }
 
-   void setLike( const DistributedNDArray& other )
+   void
+   setLike( const DistributedNDArray& other )
    {
       localArray.setLike( other.localArray );
       communicator = other.getCommunicator();
@@ -403,7 +439,8 @@ public:
       localEnds = other.localEnds;
    }
 
-   void reset()
+   void
+   reset()
    {
       localArray.reset();
       communicator = MPI_COMM_NULL;
@@ -419,14 +456,16 @@ public:
    {
       static_assert( sizeof...( indices ) == getDimension(), "got wrong number of indices" );
       __ndarray_impl::assertIndicesInRange( localBegins, localEnds, OverlapsType{}, std::forward< IndexTypes >( indices )... );
-      auto getElement = [this]( auto&&... indices )
+      auto getElement = [ this ]( auto&&... indices )
       {
-         return this->localArray.getElement( std::forward< decltype(indices) >( indices )... );
+         return this->localArray.getElement( std::forward< decltype( indices ) >( indices )... );
       };
-      return __ndarray_impl::host_call_with_unshifted_indices< LocalBeginsType >( localBegins, getElement, std::forward< IndexTypes >( indices )... );
+      return __ndarray_impl::host_call_with_unshifted_indices< LocalBeginsType >(
+         localBegins, getElement, std::forward< IndexTypes >( indices )... );
    }
 
-   void setValue( ValueType value )
+   void
+   setValue( ValueType value )
    {
       localArray.setValue( value );
    }
@@ -440,5 +479,5 @@ protected:
    SizesHolderType localEnds;
 };
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/DistributedNDArraySynchronizer.h b/src/TNL/Containers/DistributedNDArraySynchronizer.h
index b9d84c14fe0c76031d855b42feb0ebf82a30949d..18ab87590d76740c99482f3b09c331a141292bd0 100644
--- a/src/TNL/Containers/DistributedNDArraySynchronizer.h
+++ b/src/TNL/Containers/DistributedNDArraySynchronizer.h
@@ -19,7 +19,8 @@
 namespace TNL {
 namespace Containers {
 
-enum class SyncDirection : std::uint8_t {
+enum class SyncDirection : std::uint8_t
+{
    // special - sync in all directions
    All = 0xff,
    // sync directions like in LBM
@@ -69,7 +70,7 @@ enum class SyncDirection : std::uint8_t {
 inline bool
 operator&( SyncDirection a, SyncDirection b )
 {
-   return std::uint8_t(a) & std::uint8_t(b);
+   return std::uint8_t( a ) & std::uint8_t( b );
 }
 
 template< typename DistributedNDArray,
@@ -96,7 +97,8 @@ private:
 
    int tag_offset = 0;
 
-   static int reserve_tags(int count)
+   static int
+   reserve_tags( int count )
    {
       static int offset = 0;
       // we could use a post-increment, but we don't have to start from 0 either...
@@ -106,20 +108,21 @@ private:
 public:
    using RequestsVector = std::vector< MPI_Request >;
 
-   enum class AsyncPolicy {
+   enum class AsyncPolicy
+   {
       synchronous,
       deferred,
       threadpool,
       async,
    };
 
-//   DistributedNDArraySynchronizer(int max_threads = std::thread::hardware_concurrency())
-   DistributedNDArraySynchronizer(int max_threads = 1)
-   : tp(max_threads),
-     tag_offset(reserve_tags(2))  // reserve 2 communication tags (for left and right)
+   //   DistributedNDArraySynchronizer(int max_threads = std::thread::hardware_concurrency())
+   DistributedNDArraySynchronizer( int max_threads = 1 )
+   : tp( max_threads ), tag_offset( reserve_tags( 2 ) )  // reserve 2 communication tags (for left and right)
    {}
 
-   void synchronize( DistributedNDArray& array )
+   void
+   synchronize( DistributedNDArray& array )
    {
       synchronizeAsync( array, AsyncPolicy::synchronous );
    }
@@ -128,7 +131,10 @@ public:
    // instance of this object can call this method.
    // Also note that if (buffered == true), this method must not be called again until
    // the previous asynchronous operation has finished.
-   void synchronizeAsync( DistributedNDArray& array, AsyncPolicy policy = AsyncPolicy::synchronous, SyncDirection mask = SyncDirection::All )
+   void
+   synchronizeAsync( DistributedNDArray& array,
+                     AsyncPolicy policy = AsyncPolicy::synchronous,
+                     SyncDirection mask = SyncDirection::All )
    {
       // wait for any previous synchronization (multiple objects can share the
       // same synchronizer)
@@ -136,27 +142,25 @@ public:
 
       async_start_timer.start();
 
-      // GOTCHA: https://devblogs.nvidia.com/cuda-pro-tip-always-set-current-device-avoid-multithreading-bugs/
-      #ifdef HAVE_CUDA
+// GOTCHA: https://devblogs.nvidia.com/cuda-pro-tip-always-set-current-device-avoid-multithreading-bugs/
+#ifdef HAVE_CUDA
       if( std::is_same< typename DistributedNDArray::DeviceType, Devices::Cuda >::value )
-         cudaGetDevice(&this->gpu_id);
-      #endif
+         cudaGetDevice( &this->gpu_id );
+#endif
 
       // skip allocation on repeated calls - compare only sizes, not the actual data
-      if( array_view.getCommunicator() != array.getCommunicator() ||
-          array_view.getSizes() != array.getSizes() ||
-          array_view.getLocalBegins() != array.getLocalBegins() ||
-          array_view.getLocalEnds() != array.getLocalEnds() )
+      if( array_view.getCommunicator() != array.getCommunicator() || array_view.getSizes() != array.getSizes()
+          || array_view.getLocalBegins() != array.getLocalBegins() || array_view.getLocalEnds() != array.getLocalEnds() )
       {
          array_view.bind( array.getView() );
          this->mask = mask;
 
          // allocate buffers
          Algorithms::staticFor< std::size_t, 0, DistributedNDArray::getDimension() >(
-            [&] ( auto dim ) {
+            [ & ]( auto dim )
+            {
                allocateHelper< dim >( buffers, array_view );
-            }
-         );
+            } );
       }
       else {
          // only bind to the actual data
@@ -166,12 +170,13 @@ public:
 
       if( policy == AsyncPolicy::threadpool || policy == AsyncPolicy::async ) {
          // everything offloaded to a separate thread
-         auto worker = [this] () {
-            // GOTCHA: https://devblogs.nvidia.com/cuda-pro-tip-always-set-current-device-avoid-multithreading-bugs/
-            #ifdef HAVE_CUDA
+         auto worker = [ this ]()
+         {
+// GOTCHA: https://devblogs.nvidia.com/cuda-pro-tip-always-set-current-device-avoid-multithreading-bugs/
+#ifdef HAVE_CUDA
             if( std::is_same< typename DistributedNDArray::DeviceType, Devices::Cuda >::value )
-               cudaSetDevice(this->gpu_id);
-            #endif
+               cudaSetDevice( this->gpu_id );
+#endif
 
             auto requests = this->worker_init();
             MPI::Waitall( requests.data(), requests.size() );
@@ -186,7 +191,8 @@ public:
       else if( policy == AsyncPolicy::deferred ) {
          // immediate start, deferred synchronization (but still in the same thread)
          auto requests = worker_init();
-         auto worker = [this, requests] () mutable {
+         auto worker = [ this, requests ]() mutable
+         {
             MPI::Waitall( requests.data(), requests.size() );
             this->worker_finish();
          };
@@ -203,7 +209,8 @@ public:
       async_start_timer.stop();
    }
 
-   void wait()
+   void
+   wait()
    {
       if( async_op.valid() ) {
          async_wait_timer.start();
@@ -236,39 +243,42 @@ protected:
    SyncDirection mask = SyncDirection::All;
    Buffers buffers;
 
-   RequestsVector worker_init()
+   RequestsVector
+   worker_init()
    {
       // fill send buffers
       Algorithms::staticFor< std::size_t, 0, DistributedNDArray::getDimension() >(
-         [&] ( auto dim ) {
+         [ & ]( auto dim )
+         {
             copyHelper< dim >( buffers, array_view, true, mask );
-         }
-      );
+         } );
 
       // issue all send and receive async operations
       RequestsVector requests;
       const MPI_Comm communicator = array_view.getCommunicator();
       Algorithms::staticFor< std::size_t, 0, DistributedNDArray::getDimension() >(
-         [&] ( auto dim ) {
+         [ & ]( auto dim )
+         {
             sendHelper< dim >( buffers, requests, communicator, tag_offset, mask );
-         }
-      );
+         } );
 
       return requests;
    }
 
-   void worker_finish()
+   void
+   worker_finish()
    {
       // copy data from receive buffers
       Algorithms::staticFor< std::size_t, 0, DistributedNDArray::getDimension() >(
-         [&] ( auto dim ) {
+         [ & ]( auto dim )
+         {
             copyHelper< dim >( buffers, array_view, false, mask );
-         }
-      );
+         } );
    }
 
    template< std::size_t dim >
-   static void allocateHelper( Buffers& buffers, const DistributedNDArrayView& array_view )
+   static void
+   allocateHelper( Buffers& buffers, const DistributedNDArrayView& array_view )
    {
       auto& dim_buffers = buffers.template getDimBuffers< dim >();
 
@@ -298,7 +308,8 @@ protected:
       dim_buffers.right_send_view.bind( dim_buffers.right_send_buffer.getView() );
       dim_buffers.right_recv_view.bind( dim_buffers.right_recv_buffer.getView() );
 
-      // TODO: check overlap offsets for 2D and 3D distributions (watch out for the corners - maybe use SetSizesSubtractOverlapsHelper?)
+      // TODO: check overlap offsets for 2D and 3D distributions (watch out for the corners - maybe use
+      // SetSizesSubtractOverlapsHelper?)
 
       // offsets for left-send
       dim_buffers.left_send_offsets = localBegins;
@@ -317,14 +328,15 @@ protected:
 
       // FIXME: set proper neighbor IDs !!!
       const MPI_Comm communicator = array_view.getCommunicator();
-      const int rank = MPI::GetRank(communicator);
-      const int nproc = MPI::GetSize(communicator);
-      dim_buffers.left_neighbor = (rank + nproc - 1) % nproc;
-      dim_buffers.right_neighbor = (rank + 1) % nproc;
+      const int rank = MPI::GetRank( communicator );
+      const int nproc = MPI::GetSize( communicator );
+      dim_buffers.left_neighbor = ( rank + nproc - 1 ) % nproc;
+      dim_buffers.right_neighbor = ( rank + 1 ) % nproc;
    }
 
    template< std::size_t dim >
-   static void copyHelper( Buffers& buffers, DistributedNDArrayView& array_view, bool to_buffer, SyncDirection mask )
+   static void
+   copyHelper( Buffers& buffers, DistributedNDArrayView& array_view, bool to_buffer, SyncDirection mask )
    {
       // skip if there are no overlaps
       constexpr std::size_t overlap = DistributedNDArrayView::LocalViewType::IndexerType::template getOverlap< dim >();
@@ -335,7 +347,7 @@ protected:
 
       if( buffered ) {
          // TODO: specify CUDA stream for the copy, otherwise async won't work !!!
-         CopyKernel< decltype(dim_buffers.left_send_view) > copy_kernel;
+         CopyKernel< decltype( dim_buffers.left_send_view ) > copy_kernel;
          copy_kernel.array_view.bind( array_view );
          copy_kernel.to_buffer = to_buffer;
 
@@ -373,11 +385,11 @@ protected:
          dim_buffers.right_send_view.bind( &call_with_offsets( dim_buffers.right_send_offsets, array_view ) );
          dim_buffers.right_recv_view.bind( &call_with_offsets( dim_buffers.right_recv_offsets, array_view ) );
       }
-
    }
 
    template< std::size_t dim >
-   static void sendHelper( Buffers& buffers, RequestsVector& requests, MPI_Comm communicator, int tag_offset, SyncDirection mask )
+   static void
+   sendHelper( Buffers& buffers, RequestsVector& requests, MPI_Comm communicator, int tag_offset, SyncDirection mask )
    {
       constexpr std::size_t overlap = DistributedNDArrayView::LocalViewType::IndexerType::template getOverlap< dim >();
       if( overlap == 0 )
@@ -389,33 +401,51 @@ protected:
          if( mask & SyncDirection::Left ) {
             requests.push_back( MPI::Isend( dim_buffers.left_send_view.getData(),
                                             dim_buffers.left_send_view.getStorageSize(),
-                                            dim_buffers.left_neighbor, tag_offset + 0, communicator ) );
+                                            dim_buffers.left_neighbor,
+                                            tag_offset + 0,
+                                            communicator ) );
             requests.push_back( MPI::Irecv( dim_buffers.right_recv_view.getData(),
                                             dim_buffers.right_recv_view.getStorageSize(),
-                                            dim_buffers.right_neighbor, tag_offset + 0, communicator ) );
+                                            dim_buffers.right_neighbor,
+                                            tag_offset + 0,
+                                            communicator ) );
          }
          if( mask & SyncDirection::Right ) {
             requests.push_back( MPI::Isend( dim_buffers.right_send_view.getData(),
                                             dim_buffers.right_send_view.getStorageSize(),
-                                            dim_buffers.right_neighbor, tag_offset + 1, communicator ) );
+                                            dim_buffers.right_neighbor,
+                                            tag_offset + 1,
+                                            communicator ) );
             requests.push_back( MPI::Irecv( dim_buffers.left_recv_view.getData(),
                                             dim_buffers.left_recv_view.getStorageSize(),
-                                            dim_buffers.left_neighbor, tag_offset + 1, communicator ) );
+                                            dim_buffers.left_neighbor,
+                                            tag_offset + 1,
+                                            communicator ) );
          }
       }
       else {
          requests.push_back( MPI::Isend( dim_buffers.left_send_view.getData() + 0,
                                          dim_buffers.left_send_view.getStorageSize() / 27 * 9,
-                                         dim_buffers.left_neighbor, tag_offset + 0, communicator ) );
-         requests.push_back( MPI::Irecv( dim_buffers.left_recv_view.getData() + dim_buffers.left_recv_view.getStorageSize() / 27 * 18,
-                                         dim_buffers.left_recv_view.getStorageSize() / 27 * 9,
-                                         dim_buffers.left_neighbor, tag_offset + 1, communicator ) );
-         requests.push_back( MPI::Isend( dim_buffers.right_send_view.getData() + dim_buffers.left_recv_view.getStorageSize() / 27 * 18,
-                                         dim_buffers.right_send_view.getStorageSize() / 27 * 9,
-                                         dim_buffers.right_neighbor, tag_offset + 1, communicator ) );
+                                         dim_buffers.left_neighbor,
+                                         tag_offset + 0,
+                                         communicator ) );
+         requests.push_back(
+            MPI::Irecv( dim_buffers.left_recv_view.getData() + dim_buffers.left_recv_view.getStorageSize() / 27 * 18,
+                        dim_buffers.left_recv_view.getStorageSize() / 27 * 9,
+                        dim_buffers.left_neighbor,
+                        tag_offset + 1,
+                        communicator ) );
+         requests.push_back(
+            MPI::Isend( dim_buffers.right_send_view.getData() + dim_buffers.left_recv_view.getStorageSize() / 27 * 18,
+                        dim_buffers.right_send_view.getStorageSize() / 27 * 9,
+                        dim_buffers.right_neighbor,
+                        tag_offset + 1,
+                        communicator ) );
          requests.push_back( MPI::Irecv( dim_buffers.right_recv_view.getData() + 0,
                                          dim_buffers.right_recv_view.getStorageSize() / 27 * 9,
-                                         dim_buffers.right_neighbor, tag_offset + 0, communicator ) );
+                                         dim_buffers.right_neighbor,
+                                         tag_offset + 0,
+                                         communicator ) );
       }
    }
 
@@ -435,7 +465,8 @@ public:
 
       template< typename... Indices >
       __cuda_callable__
-      void operator()( Indices... indices )
+      void
+      operator()( Indices... indices )
       {
          if( to_buffer )
             buffer_view( indices... ) = call_with_shifted_indices( array_offsets, array_view, indices... );
@@ -445,5 +476,5 @@ public:
    };
 };
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/DistributedNDArrayView.h b/src/TNL/Containers/DistributedNDArrayView.h
index ad6a3dc54ed0ec52a7ef45ac603c556facf9af87..f77d4d8d9e9d4037eb12e3f50f057c7c8a9e9e5e 100644
--- a/src/TNL/Containers/DistributedNDArrayView.h
+++ b/src/TNL/Containers/DistributedNDArrayView.h
@@ -36,25 +36,33 @@ public:
    DistributedNDArrayView() = default;
 
    // explicit initialization by local array view, global sizes and local begins and ends
-   DistributedNDArrayView( NDArrayView localView, SizesHolderType globalSizes, LocalBeginsType localBegins, SizesHolderType localEnds, MPI_Comm communicator )
-   : localView(localView), communicator(communicator), globalSizes(globalSizes), localBegins(localBegins), localEnds(localEnds) {}
+   DistributedNDArrayView( NDArrayView localView,
+                           SizesHolderType globalSizes,
+                           LocalBeginsType localBegins,
+                           SizesHolderType localEnds,
+                           MPI_Comm communicator )
+   : localView( localView ), communicator( communicator ), globalSizes( globalSizes ), localBegins( localBegins ),
+     localEnds( localEnds )
+   {}
 
    // copy-constructor does shallow copy
    DistributedNDArrayView( const DistributedNDArrayView& ) = default;
 
    // default move-constructor
-   DistributedNDArrayView( DistributedNDArrayView&& ) = default;
+   DistributedNDArrayView( DistributedNDArrayView&& ) noexcept = default;
 
    // Copy-assignment does deep copy, just like regular array, but the sizes
    // must match (i.e. copy-assignment cannot resize).
-   DistributedNDArrayView& operator=( const DistributedNDArrayView& other ) = default;
+   DistributedNDArrayView&
+   operator=( const DistributedNDArrayView& other ) = default;
 
    // There is no move-assignment operator, so expressions like `a = b.getView()`
    // are resolved as copy-assignment.
 
    // Templated copy-assignment
    template< typename OtherArray >
-   DistributedNDArrayView& operator=( const OtherArray& other )
+   DistributedNDArrayView&
+   operator=( const OtherArray& other )
    {
       globalSizes = other.getSizes();
       localBegins = other.getLocalBegins();
@@ -65,7 +73,8 @@ public:
    }
 
    // methods for rebinding (reinitialization)
-   void bind( DistributedNDArrayView view )
+   void
+   bind( DistributedNDArrayView view )
    {
       localView.bind( view.localView );
       communicator = view.communicator;
@@ -75,18 +84,21 @@ public:
    }
 
    // binds to the given raw pointer and changes the indexer
-   void bind( ValueType* data, typename LocalViewType::IndexerType indexer )
+   void
+   bind( ValueType* data, typename LocalViewType::IndexerType indexer )
    {
       localView.bind( data, indexer );
    }
 
    // binds to the given raw pointer and preserves the current indexer
-   void bind( ValueType* data )
+   void
+   bind( ValueType* data )
    {
       localView.bind( data );
    }
 
-   void reset()
+   void
+   reset()
    {
       localView.reset();
       communicator = MPI_COMM_NULL;
@@ -95,57 +107,67 @@ public:
       localEnds = SizesHolderType{};
    }
 
-   static constexpr std::size_t getDimension()
+   static constexpr std::size_t
+   getDimension()
    {
       return NDArrayView::getDimension();
    }
 
-   MPI_Comm getCommunicator() const
+   MPI_Comm
+   getCommunicator() const
    {
       return communicator;
    }
 
    // Returns the *global* sizes
-   const SizesHolderType& getSizes() const
+   const SizesHolderType&
+   getSizes() const
    {
       return globalSizes;
    }
 
    // Returns the *global* size
    template< std::size_t level >
-   IndexType getSize() const
+   IndexType
+   getSize() const
    {
       return globalSizes.template getSize< level >();
    }
 
-   LocalBeginsType getLocalBegins() const
+   LocalBeginsType
+   getLocalBegins() const
    {
       return localBegins;
    }
 
-   SizesHolderType getLocalEnds() const
+   SizesHolderType
+   getLocalEnds() const
    {
       return localEnds;
    }
 
    template< std::size_t level >
-   LocalRangeType getLocalRange() const
+   LocalRangeType
+   getLocalRange() const
    {
       return LocalRangeType( localBegins.template getSize< level >(), localEnds.template getSize< level >() );
    }
 
    // returns the local storage size
-   IndexType getLocalStorageSize() const
+   IndexType
+   getLocalStorageSize() const
    {
       return localView.getStorageSize();
    }
 
-   LocalViewType getLocalView()
+   LocalViewType
+   getLocalView()
    {
       return localView;
    }
 
-   ConstLocalViewType getConstLocalView() const
+   ConstLocalViewType
+   getConstLocalView() const
    {
       return localView.getConstView();
    }
@@ -157,24 +179,26 @@ public:
    {
       static_assert( sizeof...( indices ) == SizesHolderType::getDimension(), "got wrong number of indices" );
       __ndarray_impl::assertIndicesInRange( localBegins, localEnds, OverlapsType{}, std::forward< IndexTypes >( indices )... );
-      auto getStorageIndex = [this]( auto&&... indices )
+      auto getStorageIndex = [ this ]( auto&&... indices )
       {
-         return this->localView.getStorageIndex( std::forward< decltype(indices) >( indices )... );
+         return this->localView.getStorageIndex( std::forward< decltype( indices ) >( indices )... );
       };
-      return __ndarray_impl::host_call_with_unshifted_indices< LocalBeginsType >( localBegins, getStorageIndex, std::forward< IndexTypes >( indices )... );
+      return __ndarray_impl::host_call_with_unshifted_indices< LocalBeginsType >(
+         localBegins, getStorageIndex, std::forward< IndexTypes >( indices )... );
    }
 
-   ValueType* getData()
+   ValueType*
+   getData()
    {
       return localView.getData();
    }
 
-   std::add_const_t< ValueType >* getData() const
+   std::add_const_t< ValueType >*
+   getData() const
    {
       return localView.getData();
    }
 
-
    template< typename... IndexTypes >
    __cuda_callable__
    ValueType&
@@ -182,7 +206,8 @@ public:
    {
       static_assert( sizeof...( indices ) == getDimension(), "got wrong number of indices" );
       __ndarray_impl::assertIndicesInRange( localBegins, localEnds, OverlapsType{}, std::forward< IndexTypes >( indices )... );
-      return __ndarray_impl::call_with_unshifted_indices< LocalBeginsType >( localBegins, localView, std::forward< IndexTypes >( indices )... );
+      return __ndarray_impl::call_with_unshifted_indices< LocalBeginsType >(
+         localBegins, localView, std::forward< IndexTypes >( indices )... );
    }
 
    template< typename... IndexTypes >
@@ -192,7 +217,8 @@ public:
    {
       static_assert( sizeof...( indices ) == getDimension(), "got wrong number of indices" );
       __ndarray_impl::assertIndicesInRange( localBegins, localEnds, OverlapsType{}, std::forward< IndexTypes >( indices )... );
-      return __ndarray_impl::call_with_unshifted_indices< LocalBeginsType >( localBegins, localView, std::forward< IndexTypes >( indices )... );
+      return __ndarray_impl::call_with_unshifted_indices< LocalBeginsType >(
+         localBegins, localView, std::forward< IndexTypes >( indices )... );
    }
 
    // bracket operator for 1D arrays
@@ -214,41 +240,43 @@ public:
       return localView[ index - localBegins.template getSize< 0 >() ];
    }
 
-   ViewType getView()
+   ViewType
+   getView()
    {
       return ViewType( *this );
    }
 
-   ConstViewType getConstView() const
+   ConstViewType
+   getConstView() const
    {
       return ConstViewType( localView, globalSizes, localBegins, localEnds, communicator );
    }
 
    // TODO: overlaps should be skipped, otherwise it works only after synchronization
-   bool operator==( const DistributedNDArrayView& other ) const
+   bool
+   operator==( const DistributedNDArrayView& other ) const
    {
       // we can't run allreduce if the communicators are different
       if( communicator != other.getCommunicator() )
          return false;
-      const bool localResult =
-            globalSizes == other.globalSizes &&
-            localBegins == other.localBegins &&
-            localEnds == other.localEnds &&
-            localView == other.localView;
+      const bool localResult = globalSizes == other.globalSizes && localBegins == other.localBegins
+                            && localEnds == other.localEnds && localView == other.localView;
       bool result = true;
       if( communicator != MPI_COMM_NULL )
          MPI::Allreduce( &localResult, &result, 1, MPI_LAND, communicator );
       return result;
    }
 
-   bool operator!=( const DistributedNDArrayView& other ) const
+   bool
+   operator!=( const DistributedNDArrayView& other ) const
    {
-      return ! (*this == other);
+      return ! ( *this == other );
    }
 
    // iterate over all local elements
    template< typename Device2 = DeviceType, typename Func >
-   void forAll( Func f ) const
+   void
+   forAll( Func f ) const
    {
       __ndarray_impl::ExecutorDispatcher< PermutationType, Device2 > dispatch;
       dispatch( localBegins, localEnds, f );
@@ -256,7 +284,8 @@ public:
 
    // iterate over local elements which are not neighbours of *global* boundaries
    template< typename Device2 = DeviceType, typename Func >
-   void forInternal( Func f ) const
+   void
+   forInternal( Func f ) const
    {
       // add static sizes
       using Begins = __ndarray_impl::LocalBeginsHolder< SizesHolderType, 1 >;
@@ -278,7 +307,8 @@ public:
 
    // iterate over local elements inside the given [begins, ends) range specified by global indices
    template< typename Device2 = DeviceType, typename Func, typename Begins, typename Ends >
-   void forInternal( Func f, const Begins& begins, const Ends& ends ) const
+   void
+   forInternal( Func f, const Begins& begins, const Ends& ends ) const
    {
       // TODO: assert "localBegins <= begins <= localEnds", "localBegins <= ends <= localEnds"
       __ndarray_impl::ExecutorDispatcher< PermutationType, Device2 > dispatch;
@@ -287,7 +317,8 @@ public:
 
    // iterate over local elements which are neighbours of *global* boundaries
    template< typename Device2 = DeviceType, typename Func >
-   void forBoundary( Func f ) const
+   void
+   forBoundary( Func f ) const
    {
       // add static sizes
       using SkipBegins = __ndarray_impl::LocalBeginsHolder< SizesHolderType, 1 >;
@@ -309,7 +340,8 @@ public:
 
    // iterate over local elements outside the given [skipBegins, skipEnds) range specified by global indices
    template< typename Device2 = DeviceType, typename Func, typename SkipBegins, typename SkipEnds >
-   void forBoundary( Func f, const SkipBegins& skipBegins, const SkipEnds& skipEnds ) const
+   void
+   forBoundary( Func f, const SkipBegins& skipBegins, const SkipEnds& skipEnds ) const
    {
       // TODO: assert "localBegins <= skipBegins <= localEnds", "localBegins <= skipEnds <= localEnds"
       __ndarray_impl::BoundaryExecutorDispatcher< PermutationType, Device2 > dispatch;
@@ -318,7 +350,8 @@ public:
 
    // iterate over local elements which are not neighbours of overlaps (if all overlaps are 0, it is equivalent to forAll)
    template< typename Device2 = DeviceType, typename Func >
-   void forLocalInternal( Func f ) const
+   void
+   forLocalInternal( Func f ) const
    {
       // add overlaps to dynamic sizes
       LocalBeginsType begins;
@@ -326,7 +359,8 @@ public:
 
       // subtract overlaps from dynamic sizes
       SizesHolderType ends;
-      __ndarray_impl::SetSizesSubtractOverlapsHelper< SizesHolderType, SizesHolderType, OverlapsType >::subtract( ends, localEnds );
+      __ndarray_impl::SetSizesSubtractOverlapsHelper< SizesHolderType, SizesHolderType, OverlapsType >::subtract( ends,
+                                                                                                                  localEnds );
 
       __ndarray_impl::ExecutorDispatcher< PermutationType, Device2 > dispatch;
       dispatch( begins, ends, f );
@@ -334,15 +368,18 @@ public:
 
    // iterate over local elements which are neighbours of overlaps (if all overlaps are 0, it has no effect)
    template< typename Device2 = DeviceType, typename Func >
-   void forLocalBoundary( Func f ) const
+   void
+   forLocalBoundary( Func f ) const
    {
       // add overlaps to dynamic sizes
       LocalBeginsType skipBegins;
-      __ndarray_impl::SetSizesAddOverlapsHelper< LocalBeginsType, SizesHolderType, OverlapsType >::add( skipBegins, localBegins );
+      __ndarray_impl::SetSizesAddOverlapsHelper< LocalBeginsType, SizesHolderType, OverlapsType >::add( skipBegins,
+                                                                                                        localBegins );
 
       // subtract overlaps from dynamic sizes
       SizesHolderType skipEnds;
-      __ndarray_impl::SetSizesSubtractOverlapsHelper< SizesHolderType, SizesHolderType, OverlapsType >::subtract( skipEnds, localEnds );
+      __ndarray_impl::SetSizesSubtractOverlapsHelper< SizesHolderType, SizesHolderType, OverlapsType >::subtract( skipEnds,
+                                                                                                                  localEnds );
 
       __ndarray_impl::BoundaryExecutorDispatcher< PermutationType, Device2 > dispatch;
       dispatch( localBegins, skipBegins, skipEnds, localEnds, f );
@@ -350,11 +387,13 @@ public:
 
    // iterate over elements of overlaps (if all overlaps are 0, it has no effect)
    template< typename Device2 = DeviceType, typename Func >
-   void forOverlaps( Func f ) const
+   void
+   forOverlaps( Func f ) const
    {
       // subtract overlaps from dynamic sizes
       LocalBeginsType begins;
-      __ndarray_impl::SetSizesSubtractOverlapsHelper< LocalBeginsType, SizesHolderType, OverlapsType >::subtract( begins, localBegins );
+      __ndarray_impl::SetSizesSubtractOverlapsHelper< LocalBeginsType, SizesHolderType, OverlapsType >::subtract( begins,
+                                                                                                                  localBegins );
 
       // add overlaps to dynamic sizes
       SizesHolderType ends;
@@ -373,5 +412,5 @@ protected:
    SizesHolderType localEnds;
 };
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/DistributedVector.h b/src/TNL/Containers/DistributedVector.h
index f81094b43135448f2d73a73ef2ac0d4030af3008..fd50363b91c86810e78c751d875eb6e79846897a 100644
--- a/src/TNL/Containers/DistributedVector.h
+++ b/src/TNL/Containers/DistributedVector.h
@@ -18,10 +18,10 @@ template< typename Real,
           typename Device = Devices::Host,
           typename Index = int,
           typename Allocator = typename Allocators::Default< Device >::template Allocator< Real > >
-class DistributedVector
-: public DistributedArray< Real, Device, Index, Allocator >
+class DistributedVector : public DistributedArray< Real, Device, Index, Allocator >
 {
    using BaseType = DistributedArray< Real, Device, Index, Allocator >;
+
 public:
    using RealType = Real;
    using DeviceType = Device;
@@ -41,10 +41,9 @@ public:
              typename _Allocator = typename Allocators::Default< _Device >::template Allocator< _Real > >
    using Self = DistributedVector< _Real, _Device, _Index, _Allocator >;
 
-
    // inherit all constructors and assignment operators from Array
    using BaseType::DistributedArray;
-#if !defined(__CUDACC_VER_MAJOR__) || __CUDACC_VER_MAJOR__ < 11
+#if ! defined( __CUDACC_VER_MAJOR__ ) || __CUDACC_VER_MAJOR__ < 11
    using BaseType::operator=;
 #endif
 
@@ -63,49 +62,57 @@ public:
    /**
     * \brief Default move constructor.
     */
-   DistributedVector( DistributedVector&& ) = default;
+   DistributedVector( DistributedVector&& ) noexcept = default;
 
    /**
     * \brief Copy-assignment operator for copying data from another vector.
     */
-   DistributedVector& operator=( const DistributedVector& ) = default;
+   DistributedVector&
+   operator=( const DistributedVector& ) = default;
 
    /**
     * \brief Move-assignment operator for acquiring data from \e rvalues.
     */
-   DistributedVector& operator=( DistributedVector&& ) = default;
+   DistributedVector&
+   operator=( DistributedVector&& ) noexcept = default;
 
    /**
     * \brief Returns a modifiable view of the local part of the vector.
     */
-   LocalViewType getLocalView();
+   LocalViewType
+   getLocalView();
 
    /**
     * \brief Returns a non-modifiable view of the local part of the vector.
     */
-   ConstLocalViewType getConstLocalView() const;
+   ConstLocalViewType
+   getConstLocalView() const;
 
    /**
     * \brief Returns a modifiable view of the local part of the vector,
     * including ghost values.
     */
-   LocalViewType getLocalViewWithGhosts();
+   LocalViewType
+   getLocalViewWithGhosts();
 
    /**
     * \brief Returns a non-modifiable view of the local part of the vector,
     * including ghost values.
     */
-   ConstLocalViewType getConstLocalViewWithGhosts() const;
+   ConstLocalViewType
+   getConstLocalViewWithGhosts() const;
 
    /**
     * \brief Returns a modifiable view of the vector.
     */
-   ViewType getView();
+   ViewType
+   getView();
 
    /**
     * \brief Returns a non-modifiable view of the vector.
     */
-   ConstViewType getConstView() const;
+   ConstViewType
+   getConstView() const;
 
    /**
     * \brief Conversion operator to a modifiable view of the vector.
@@ -117,80 +124,66 @@ public:
     */
    operator ConstViewType() const;
 
-
    /*
     * Usual Vector methods follow below.
     */
-   template< typename Scalar,
-             typename...,
-             typename = std::enable_if_t< ! HasSubscriptOperator<Scalar>::value > >
-   DistributedVector& operator=( Scalar c );
-
-   template< typename Scalar,
-             typename...,
-             typename = std::enable_if_t< ! HasSubscriptOperator<Scalar>::value > >
-   DistributedVector& operator+=( Scalar c );
-
-   template< typename Scalar,
-             typename...,
-             typename = std::enable_if_t< ! HasSubscriptOperator<Scalar>::value > >
-   DistributedVector& operator-=( Scalar c );
-
-   template< typename Scalar,
-             typename...,
-             typename = std::enable_if_t< ! HasSubscriptOperator<Scalar>::value > >
-   DistributedVector& operator*=( Scalar c );
-
-   template< typename Scalar,
-             typename...,
-             typename = std::enable_if_t< ! HasSubscriptOperator<Scalar>::value > >
-   DistributedVector& operator/=( Scalar c );
-
-   template< typename Scalar,
-             typename...,
-             typename = std::enable_if_t< ! HasSubscriptOperator<Scalar>::value > >
-   DistributedVector& operator%=( Scalar c );
-
-   template< typename Vector,
-             typename...,
-             typename = std::enable_if_t< HasSubscriptOperator<Vector>::value > >
-   DistributedVector& operator=( const Vector& vector );
-
-   template< typename Vector,
-             typename...,
-             typename = std::enable_if_t< HasSubscriptOperator<Vector>::value > >
-   DistributedVector& operator+=( const Vector& vector );
-
-   template< typename Vector,
-             typename...,
-             typename = std::enable_if_t< HasSubscriptOperator<Vector>::value > >
-   DistributedVector& operator-=( const Vector& vector );
-
-   template< typename Vector,
-             typename...,
-             typename = std::enable_if_t< HasSubscriptOperator<Vector>::value > >
-   DistributedVector& operator*=( const Vector& vector );
-
-   template< typename Vector,
-             typename...,
-             typename = std::enable_if_t< HasSubscriptOperator<Vector>::value > >
-   DistributedVector& operator/=( const Vector& vector );
-
-   template< typename Vector,
-             typename...,
-             typename = std::enable_if_t< HasSubscriptOperator<Vector>::value > >
-   DistributedVector& operator%=( const Vector& vector );
+   template< typename Scalar, typename..., typename = std::enable_if_t< ! HasSubscriptOperator< Scalar >::value > >
+   DistributedVector&
+   operator=( Scalar c );
+
+   template< typename Scalar, typename..., typename = std::enable_if_t< ! HasSubscriptOperator< Scalar >::value > >
+   DistributedVector&
+   operator+=( Scalar c );
+
+   template< typename Scalar, typename..., typename = std::enable_if_t< ! HasSubscriptOperator< Scalar >::value > >
+   DistributedVector&
+   operator-=( Scalar c );
+
+   template< typename Scalar, typename..., typename = std::enable_if_t< ! HasSubscriptOperator< Scalar >::value > >
+   DistributedVector&
+   operator*=( Scalar c );
+
+   template< typename Scalar, typename..., typename = std::enable_if_t< ! HasSubscriptOperator< Scalar >::value > >
+   DistributedVector&
+   operator/=( Scalar c );
+
+   template< typename Scalar, typename..., typename = std::enable_if_t< ! HasSubscriptOperator< Scalar >::value > >
+   DistributedVector&
+   operator%=( Scalar c );
+
+   template< typename Vector, typename..., typename = std::enable_if_t< HasSubscriptOperator< Vector >::value > >
+   DistributedVector&
+   operator=( const Vector& vector );
+
+   template< typename Vector, typename..., typename = std::enable_if_t< HasSubscriptOperator< Vector >::value > >
+   DistributedVector&
+   operator+=( const Vector& vector );
+
+   template< typename Vector, typename..., typename = std::enable_if_t< HasSubscriptOperator< Vector >::value > >
+   DistributedVector&
+   operator-=( const Vector& vector );
+
+   template< typename Vector, typename..., typename = std::enable_if_t< HasSubscriptOperator< Vector >::value > >
+   DistributedVector&
+   operator*=( const Vector& vector );
+
+   template< typename Vector, typename..., typename = std::enable_if_t< HasSubscriptOperator< Vector >::value > >
+   DistributedVector&
+   operator/=( const Vector& vector );
+
+   template< typename Vector, typename..., typename = std::enable_if_t< HasSubscriptOperator< Vector >::value > >
+   DistributedVector&
+   operator%=( const Vector& vector );
 };
 
 // Enable expression templates for DistributedVector
 namespace Expressions {
-   template< typename Real, typename Device, typename Index, typename Allocator >
-   struct HasEnabledDistributedExpressionTemplates< DistributedVector< Real, Device, Index, Allocator > >
-   : std::true_type
-   {};
-} // namespace Expressions
-
-} // namespace Containers
-} // namespace TNL
+template< typename Real, typename Device, typename Index, typename Allocator >
+struct HasEnabledDistributedExpressionTemplates< DistributedVector< Real, Device, Index, Allocator > > : std::true_type
+{};
+}  // namespace Expressions
+
+}  // namespace Containers
+}  // namespace TNL
 
 #include <TNL/Containers/DistributedVector.hpp>
diff --git a/src/TNL/Containers/DistributedVector.hpp b/src/TNL/Containers/DistributedVector.hpp
index 35e9d720e2b10b3755f757c729d86bc86c429b37..ba7e94fe30be6a3d4d753d5a87987da8fad4d84e 100644
--- a/src/TNL/Containers/DistributedVector.hpp
+++ b/src/TNL/Containers/DistributedVector.hpp
@@ -13,263 +13,178 @@
 namespace TNL {
 namespace Containers {
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
-DistributedVector< Real, Device, Index, Allocator >::
-DistributedVector( const DistributedVector& vector, const AllocatorType& allocator )
+template< typename Real, typename Device, typename Index, typename Allocator >
+DistributedVector< Real, Device, Index, Allocator >::DistributedVector( const DistributedVector& vector,
+                                                                        const AllocatorType& allocator )
 : BaseType::DistributedArray( vector, allocator )
-{
-}
+{}
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Real, typename Device, typename Index, typename Allocator >
 typename DistributedVector< Real, Device, Index, Allocator >::LocalViewType
-DistributedVector< Real, Device, Index, Allocator >::
-getLocalView()
+DistributedVector< Real, Device, Index, Allocator >::getLocalView()
 {
    return BaseType::getLocalView();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Real, typename Device, typename Index, typename Allocator >
 typename DistributedVector< Real, Device, Index, Allocator >::ConstLocalViewType
-DistributedVector< Real, Device, Index, Allocator >::
-getConstLocalView() const
+DistributedVector< Real, Device, Index, Allocator >::getConstLocalView() const
 {
    return BaseType::getConstLocalView();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Real, typename Device, typename Index, typename Allocator >
 typename DistributedVector< Real, Device, Index, Allocator >::LocalViewType
-DistributedVector< Real, Device, Index, Allocator >::
-getLocalViewWithGhosts()
+DistributedVector< Real, Device, Index, Allocator >::getLocalViewWithGhosts()
 {
    return BaseType::getLocalViewWithGhosts();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Real, typename Device, typename Index, typename Allocator >
 typename DistributedVector< Real, Device, Index, Allocator >::ConstLocalViewType
-DistributedVector< Real, Device, Index, Allocator >::
-getConstLocalViewWithGhosts() const
+DistributedVector< Real, Device, Index, Allocator >::getConstLocalViewWithGhosts() const
 {
    return BaseType::getConstLocalViewWithGhosts();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 typename DistributedVector< Value, Device, Index, Allocator >::ViewType
-DistributedVector< Value, Device, Index, Allocator >::
-getView()
+DistributedVector< Value, Device, Index, Allocator >::getView()
 {
    return BaseType::getView();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Device, typename Index, typename Allocator >
 typename DistributedVector< Value, Device, Index, Allocator >::ConstViewType
-DistributedVector< Value, Device, Index, Allocator >::
-getConstView() const
+DistributedVector< Value, Device, Index, Allocator >::getConstView() const
 {
    return BaseType::getConstView();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-DistributedVector< Value, Device, Index, Allocator >::
-operator ViewType()
+template< typename Value, typename Device, typename Index, typename Allocator >
+DistributedVector< Value, Device, Index, Allocator >::operator ViewType()
 {
    return getView();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index,
-          typename Allocator >
-DistributedVector< Value, Device, Index, Allocator >::
-operator ConstViewType() const
+template< typename Value, typename Device, typename Index, typename Allocator >
+DistributedVector< Value, Device, Index, Allocator >::operator ConstViewType() const
 {
    return getConstView();
 }
 
-
 /*
  * Usual Vector methods follow below.
  */
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename Vector, typename..., typename >
+template< typename Real, typename Device, typename Index, typename Allocator >
+template< typename Vector, typename..., typename >
 DistributedVector< Real, Device, Index, Allocator >&
-DistributedVector< Real, Device, Index, Allocator >::
-operator=( const Vector& vector )
+DistributedVector< Real, Device, Index, Allocator >::operator=( const Vector& vector )
 {
    this->setLike( vector );
    getView() = vector;
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename Vector, typename..., typename >
+template< typename Real, typename Device, typename Index, typename Allocator >
+template< typename Vector, typename..., typename >
 DistributedVector< Real, Device, Index, Allocator >&
-DistributedVector< Real, Device, Index, Allocator >::
-operator+=( const Vector& vector )
+DistributedVector< Real, Device, Index, Allocator >::operator+=( const Vector& vector )
 {
    getView() += vector;
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename Vector, typename..., typename >
+template< typename Real, typename Device, typename Index, typename Allocator >
+template< typename Vector, typename..., typename >
 DistributedVector< Real, Device, Index, Allocator >&
-DistributedVector< Real, Device, Index, Allocator >::
-operator-=( const Vector& vector )
+DistributedVector< Real, Device, Index, Allocator >::operator-=( const Vector& vector )
 {
    getView() -= vector;
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename Vector, typename..., typename >
+template< typename Real, typename Device, typename Index, typename Allocator >
+template< typename Vector, typename..., typename >
 DistributedVector< Real, Device, Index, Allocator >&
-DistributedVector< Real, Device, Index, Allocator >::
-operator*=( const Vector& vector )
+DistributedVector< Real, Device, Index, Allocator >::operator*=( const Vector& vector )
 {
    getView() *= vector;
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename Vector, typename..., typename >
+template< typename Real, typename Device, typename Index, typename Allocator >
+template< typename Vector, typename..., typename >
 DistributedVector< Real, Device, Index, Allocator >&
-DistributedVector< Real, Device, Index, Allocator >::
-operator/=( const Vector& vector )
+DistributedVector< Real, Device, Index, Allocator >::operator/=( const Vector& vector )
 {
    getView() /= vector;
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename Vector, typename..., typename >
+template< typename Real, typename Device, typename Index, typename Allocator >
+template< typename Vector, typename..., typename >
 DistributedVector< Real, Device, Index, Allocator >&
-DistributedVector< Real, Device, Index, Allocator >::
-operator%=( const Vector& vector )
+DistributedVector< Real, Device, Index, Allocator >::operator%=( const Vector& vector )
 {
    getView() %= vector;
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename Scalar, typename..., typename >
+template< typename Real, typename Device, typename Index, typename Allocator >
+template< typename Scalar, typename..., typename >
 DistributedVector< Real, Device, Index, Allocator >&
-DistributedVector< Real, Device, Index, Allocator >::
-operator=( Scalar c )
+DistributedVector< Real, Device, Index, Allocator >::operator=( Scalar c )
 {
    getView() = c;
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename Scalar, typename..., typename >
+template< typename Real, typename Device, typename Index, typename Allocator >
+template< typename Scalar, typename..., typename >
 DistributedVector< Real, Device, Index, Allocator >&
-DistributedVector< Real, Device, Index, Allocator >::
-operator+=( Scalar c )
+DistributedVector< Real, Device, Index, Allocator >::operator+=( Scalar c )
 {
    getView() += c;
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename Scalar, typename..., typename >
+template< typename Real, typename Device, typename Index, typename Allocator >
+template< typename Scalar, typename..., typename >
 DistributedVector< Real, Device, Index, Allocator >&
-DistributedVector< Real, Device, Index, Allocator >::
-operator-=( Scalar c )
+DistributedVector< Real, Device, Index, Allocator >::operator-=( Scalar c )
 {
    getView() -= c;
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename Scalar, typename..., typename >
+template< typename Real, typename Device, typename Index, typename Allocator >
+template< typename Scalar, typename..., typename >
 DistributedVector< Real, Device, Index, Allocator >&
-DistributedVector< Real, Device, Index, Allocator >::
-operator*=( Scalar c )
+DistributedVector< Real, Device, Index, Allocator >::operator*=( Scalar c )
 {
    getView() *= c;
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename Scalar, typename..., typename >
+template< typename Real, typename Device, typename Index, typename Allocator >
+template< typename Scalar, typename..., typename >
 DistributedVector< Real, Device, Index, Allocator >&
-DistributedVector< Real, Device, Index, Allocator >::
-operator/=( Scalar c )
+DistributedVector< Real, Device, Index, Allocator >::operator/=( Scalar c )
 {
    getView() /= c;
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename Scalar, typename..., typename >
+template< typename Real, typename Device, typename Index, typename Allocator >
+template< typename Scalar, typename..., typename >
 DistributedVector< Real, Device, Index, Allocator >&
-DistributedVector< Real, Device, Index, Allocator >::
-operator%=( Scalar c )
+DistributedVector< Real, Device, Index, Allocator >::operator%=( Scalar c )
 {
    getView() %= c;
    return *this;
 }
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/DistributedVectorView.h b/src/TNL/Containers/DistributedVectorView.h
index 70b470d38c6b45dc22989e48ad4e0a687c9043a1..5c565f848259d7fc83d3f3dc48a0844bac48112e 100644
--- a/src/TNL/Containers/DistributedVectorView.h
+++ b/src/TNL/Containers/DistributedVectorView.h
@@ -15,14 +15,12 @@
 namespace TNL {
 namespace Containers {
 
-template< typename Real,
-          typename Device = Devices::Host,
-          typename Index = int >
-class DistributedVectorView
-: public DistributedArrayView< Real, Device, Index >
+template< typename Real, typename Device = Devices::Host, typename Index = int >
+class DistributedVectorView : public DistributedArrayView< Real, Device, Index >
 {
    using BaseType = DistributedArrayView< Real, Device, Index >;
    using NonConstReal = typename std::remove_const< Real >::type;
+
 public:
    using RealType = Real;
    using DeviceType = Device;
@@ -35,15 +33,12 @@ public:
    /**
     * \brief A template which allows to quickly obtain a \ref VectorView type with changed template parameters.
     */
-   template< typename _Real,
-             typename _Device = Device,
-             typename _Index = Index >
+   template< typename _Real, typename _Device = Device, typename _Index = Index >
    using Self = DistributedVectorView< _Real, _Device, _Index >;
 
-
    // inherit all constructors and assignment operators from ArrayView
    using BaseType::DistributedArrayView;
-#if !defined(__CUDACC_VER_MAJOR__) || __CUDACC_VER_MAJOR__ < 11
+#if ! defined( __CUDACC_VER_MAJOR__ ) || __CUDACC_VER_MAJOR__ < 11
    using BaseType::operator=;
 #endif
 
@@ -54,114 +49,107 @@ public:
 
    // initialization by base class is not a copy constructor so it has to be explicit
    template< typename Real_ >  // template catches both const and non-const qualified Element
-   DistributedVectorView( const Containers::DistributedArrayView< Real_, Device, Index >& view )
-   : BaseType( view ) {}
+   DistributedVectorView( const Containers::DistributedArrayView< Real_, Device, Index >& view ) : BaseType( view )
+   {}
 
    /**
     * \brief Returns a modifiable view of the local part of the vector.
     */
-   LocalViewType getLocalView();
+   LocalViewType
+   getLocalView();
 
    /**
     * \brief Returns a non-modifiable view of the local part of the vector.
     */
-   ConstLocalViewType getConstLocalView() const;
+   ConstLocalViewType
+   getConstLocalView() const;
 
    /**
     * \brief Returns a modifiable view of the local part of the vector,
     * including ghost values.
     */
-   LocalViewType getLocalViewWithGhosts();
+   LocalViewType
+   getLocalViewWithGhosts();
 
    /**
     * \brief Returns a non-modifiable view of the local part of the vector,
     * including ghost values.
     */
-   ConstLocalViewType getConstLocalViewWithGhosts() const;
+   ConstLocalViewType
+   getConstLocalViewWithGhosts() const;
 
    /**
     * \brief Returns a modifiable view of the array view.
     */
-   ViewType getView();
+   ViewType
+   getView();
 
    /**
     * \brief Returns a non-modifiable view of the array view.
     */
-   ConstViewType getConstView() const;
+   ConstViewType
+   getConstView() const;
 
    /*
     * Usual Vector methods follow below.
     */
-   template< typename Scalar,
-             typename...,
-             typename = std::enable_if_t< ! HasSubscriptOperator<Scalar>::value > >
-   DistributedVectorView& operator=( Scalar c );
-
-   template< typename Scalar,
-             typename...,
-             typename = std::enable_if_t< ! HasSubscriptOperator<Scalar>::value > >
-   DistributedVectorView& operator+=( Scalar c );
-
-   template< typename Scalar,
-             typename...,
-             typename = std::enable_if_t< ! HasSubscriptOperator<Scalar>::value > >
-   DistributedVectorView& operator-=( Scalar c );
-
-   template< typename Scalar,
-             typename...,
-             typename = std::enable_if_t< ! HasSubscriptOperator<Scalar>::value > >
-   DistributedVectorView& operator*=( Scalar c );
-
-   template< typename Scalar,
-             typename...,
-             typename = std::enable_if_t< ! HasSubscriptOperator<Scalar>::value > >
-   DistributedVectorView& operator/=( Scalar c );
-
-   template< typename Scalar,
-             typename...,
-             typename = std::enable_if_t< ! HasSubscriptOperator<Scalar>::value > >
-   DistributedVectorView& operator%=( Scalar c );
-
-   template< typename Vector,
-             typename...,
-             typename = std::enable_if_t< HasSubscriptOperator<Vector>::value > >
-   DistributedVectorView& operator=( const Vector& vector );
-
-   template< typename Vector,
-             typename...,
-             typename = std::enable_if_t< HasSubscriptOperator<Vector>::value > >
-   DistributedVectorView& operator+=( const Vector& vector );
-
-   template< typename Vector,
-             typename...,
-             typename = std::enable_if_t< HasSubscriptOperator<Vector>::value > >
-   DistributedVectorView& operator-=( const Vector& vector );
-
-   template< typename Vector,
-             typename...,
-             typename = std::enable_if_t< HasSubscriptOperator<Vector>::value > >
-   DistributedVectorView& operator*=( const Vector& vector );
-
-   template< typename Vector,
-             typename...,
-             typename = std::enable_if_t< HasSubscriptOperator<Vector>::value > >
-   DistributedVectorView& operator/=( const Vector& vector );
-
-   template< typename Vector,
-             typename...,
-             typename = std::enable_if_t< HasSubscriptOperator<Vector>::value > >
-   DistributedVectorView& operator%=( const Vector& vector );
+   template< typename Scalar, typename..., typename = std::enable_if_t< ! HasSubscriptOperator< Scalar >::value > >
+   DistributedVectorView&
+   operator=( Scalar c );
+
+   template< typename Scalar, typename..., typename = std::enable_if_t< ! HasSubscriptOperator< Scalar >::value > >
+   DistributedVectorView&
+   operator+=( Scalar c );
+
+   template< typename Scalar, typename..., typename = std::enable_if_t< ! HasSubscriptOperator< Scalar >::value > >
+   DistributedVectorView&
+   operator-=( Scalar c );
+
+   template< typename Scalar, typename..., typename = std::enable_if_t< ! HasSubscriptOperator< Scalar >::value > >
+   DistributedVectorView&
+   operator*=( Scalar c );
+
+   template< typename Scalar, typename..., typename = std::enable_if_t< ! HasSubscriptOperator< Scalar >::value > >
+   DistributedVectorView&
+   operator/=( Scalar c );
+
+   template< typename Scalar, typename..., typename = std::enable_if_t< ! HasSubscriptOperator< Scalar >::value > >
+   DistributedVectorView&
+   operator%=( Scalar c );
+
+   template< typename Vector, typename..., typename = std::enable_if_t< HasSubscriptOperator< Vector >::value > >
+   DistributedVectorView&
+   operator=( const Vector& vector );
+
+   template< typename Vector, typename..., typename = std::enable_if_t< HasSubscriptOperator< Vector >::value > >
+   DistributedVectorView&
+   operator+=( const Vector& vector );
+
+   template< typename Vector, typename..., typename = std::enable_if_t< HasSubscriptOperator< Vector >::value > >
+   DistributedVectorView&
+   operator-=( const Vector& vector );
+
+   template< typename Vector, typename..., typename = std::enable_if_t< HasSubscriptOperator< Vector >::value > >
+   DistributedVectorView&
+   operator*=( const Vector& vector );
+
+   template< typename Vector, typename..., typename = std::enable_if_t< HasSubscriptOperator< Vector >::value > >
+   DistributedVectorView&
+   operator/=( const Vector& vector );
+
+   template< typename Vector, typename..., typename = std::enable_if_t< HasSubscriptOperator< Vector >::value > >
+   DistributedVectorView&
+   operator%=( const Vector& vector );
 };
 
 // Enable expression templates for DistributedVector
 namespace Expressions {
-   template< typename Real, typename Device, typename Index >
-   struct HasEnabledDistributedExpressionTemplates< DistributedVectorView< Real, Device, Index > >
-   : std::true_type
-   {};
-} // namespace Expressions
-
-} // namespace Containers
-} // namespace TNL
+template< typename Real, typename Device, typename Index >
+struct HasEnabledDistributedExpressionTemplates< DistributedVectorView< Real, Device, Index > > : std::true_type
+{};
+}  // namespace Expressions
+
+}  // namespace Containers
+}  // namespace TNL
 
 #include <TNL/Containers/DistributedVectorView.hpp>
diff --git a/src/TNL/Containers/DistributedVectorView.hpp b/src/TNL/Containers/DistributedVectorView.hpp
index 1c3417fc5124bb246ee4575a5f93fc6e4848ebdc..2993851f17469cdd56f47562f7bb7907a04ab998 100644
--- a/src/TNL/Containers/DistributedVectorView.hpp
+++ b/src/TNL/Containers/DistributedVectorView.hpp
@@ -13,87 +13,61 @@
 namespace TNL {
 namespace Containers {
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 typename DistributedVectorView< Real, Device, Index >::LocalViewType
-DistributedVectorView< Real, Device, Index >::
-getLocalView()
+DistributedVectorView< Real, Device, Index >::getLocalView()
 {
    return BaseType::getLocalView();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 typename DistributedVectorView< Real, Device, Index >::ConstLocalViewType
-DistributedVectorView< Real, Device, Index >::
-getConstLocalView() const
+DistributedVectorView< Real, Device, Index >::getConstLocalView() const
 {
    return BaseType::getConstLocalView();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 typename DistributedVectorView< Real, Device, Index >::LocalViewType
-DistributedVectorView< Real, Device, Index >::
-getLocalViewWithGhosts()
+DistributedVectorView< Real, Device, Index >::getLocalViewWithGhosts()
 {
    return BaseType::getLocalViewWithGhosts();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 typename DistributedVectorView< Real, Device, Index >::ConstLocalViewType
-DistributedVectorView< Real, Device, Index >::
-getConstLocalViewWithGhosts() const
+DistributedVectorView< Real, Device, Index >::getConstLocalViewWithGhosts() const
 {
    return BaseType::getConstLocalViewWithGhosts();
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 typename DistributedVectorView< Value, Device, Index >::ViewType
-DistributedVectorView< Value, Device, Index >::
-getView()
+DistributedVectorView< Value, Device, Index >::getView()
 {
    return *this;
 }
 
-template< typename Value,
-          typename Device,
-          typename Index >
+template< typename Value, typename Device, typename Index >
 typename DistributedVectorView< Value, Device, Index >::ConstViewType
-DistributedVectorView< Value, Device, Index >::
-getConstView() const
+DistributedVectorView< Value, Device, Index >::getConstView() const
 {
    return *this;
 }
 
-
 /*
  * Usual Vector methods follow below.
  */
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename Vector, typename..., typename >
+template< typename Real, typename Device, typename Index >
+template< typename Vector, typename..., typename >
 DistributedVectorView< Real, Device, Index >&
-DistributedVectorView< Real, Device, Index >::
-operator=( const Vector& vector )
+DistributedVectorView< Real, Device, Index >::operator=( const Vector& vector )
 {
-   TNL_ASSERT_EQ( this->getSize(), vector.getSize(),
-                  "The sizes of the array views must be equal, views are not resizable." );
-   TNL_ASSERT_EQ( this->getLocalRange(), vector.getLocalRange(),
-                  "The local ranges must be equal, views are not resizable." );
-   TNL_ASSERT_EQ( this->getGhosts(), vector.getGhosts(),
-                  "Ghosts must be equal, views are not resizable." );
-   TNL_ASSERT_EQ( this->getCommunicator(), vector.getCommunicator(),
-                  "The communicators of the array views must be equal." );
+   TNL_ASSERT_EQ( this->getSize(), vector.getSize(), "The sizes of the array views must be equal, views are not resizable." );
+   TNL_ASSERT_EQ( this->getLocalRange(), vector.getLocalRange(), "The local ranges must be equal, views are not resizable." );
+   TNL_ASSERT_EQ( this->getGhosts(), vector.getGhosts(), "Ghosts must be equal, views are not resizable." );
+   TNL_ASSERT_EQ( this->getCommunicator(), vector.getCommunicator(), "The communicators of the array views must be equal." );
 
    if( this->getCommunicator() != MPI_COMM_NULL ) {
       // TODO: it might be better to split the local and ghost parts and synchronize in the middle
@@ -104,21 +78,18 @@ operator=( const Vector& vector )
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename Vector, typename..., typename >
+template< typename Real, typename Device, typename Index >
+template< typename Vector, typename..., typename >
 DistributedVectorView< Real, Device, Index >&
-DistributedVectorView< Real, Device, Index >::
-operator+=( const Vector& vector )
+DistributedVectorView< Real, Device, Index >::operator+=( const Vector& vector )
 {
-   TNL_ASSERT_EQ( this->getSize(), vector.getSize(),
-                  "Vector sizes must be equal." );
-   TNL_ASSERT_EQ( this->getLocalRange(), vector.getLocalRange(),
+   TNL_ASSERT_EQ( this->getSize(), vector.getSize(), "Vector sizes must be equal." );
+   TNL_ASSERT_EQ( this->getLocalRange(),
+                  vector.getLocalRange(),
                   "Multiary operations are supported only on vectors which are distributed the same way." );
-   TNL_ASSERT_EQ( this->getGhosts(), vector.getGhosts(),
-                  "Ghosts must be equal, views are not resizable." );
-   TNL_ASSERT_EQ( this->getCommunicator(), vector.getCommunicator(),
+   TNL_ASSERT_EQ( this->getGhosts(), vector.getGhosts(), "Ghosts must be equal, views are not resizable." );
+   TNL_ASSERT_EQ( this->getCommunicator(),
+                  vector.getCommunicator(),
                   "Multiary operations are supported only on vectors within the same communicator." );
 
    if( this->getCommunicator() != MPI_COMM_NULL ) {
@@ -130,21 +101,18 @@ operator+=( const Vector& vector )
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename Vector, typename..., typename >
+template< typename Real, typename Device, typename Index >
+template< typename Vector, typename..., typename >
 DistributedVectorView< Real, Device, Index >&
-DistributedVectorView< Real, Device, Index >::
-operator-=( const Vector& vector )
+DistributedVectorView< Real, Device, Index >::operator-=( const Vector& vector )
 {
-   TNL_ASSERT_EQ( this->getSize(), vector.getSize(),
-                  "Vector sizes must be equal." );
-   TNL_ASSERT_EQ( this->getLocalRange(), vector.getLocalRange(),
+   TNL_ASSERT_EQ( this->getSize(), vector.getSize(), "Vector sizes must be equal." );
+   TNL_ASSERT_EQ( this->getLocalRange(),
+                  vector.getLocalRange(),
                   "Multiary operations are supported only on vectors which are distributed the same way." );
-   TNL_ASSERT_EQ( this->getGhosts(), vector.getGhosts(),
-                  "Ghosts must be equal, views are not resizable." );
-   TNL_ASSERT_EQ( this->getCommunicator(), vector.getCommunicator(),
+   TNL_ASSERT_EQ( this->getGhosts(), vector.getGhosts(), "Ghosts must be equal, views are not resizable." );
+   TNL_ASSERT_EQ( this->getCommunicator(),
+                  vector.getCommunicator(),
                   "Multiary operations are supported only on vectors within the same communicator." );
 
    if( this->getCommunicator() != MPI_COMM_NULL ) {
@@ -156,21 +124,18 @@ operator-=( const Vector& vector )
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename Vector, typename..., typename >
+template< typename Real, typename Device, typename Index >
+template< typename Vector, typename..., typename >
 DistributedVectorView< Real, Device, Index >&
-DistributedVectorView< Real, Device, Index >::
-operator*=( const Vector& vector )
+DistributedVectorView< Real, Device, Index >::operator*=( const Vector& vector )
 {
-   TNL_ASSERT_EQ( this->getSize(), vector.getSize(),
-                  "Vector sizes must be equal." );
-   TNL_ASSERT_EQ( this->getLocalRange(), vector.getLocalRange(),
+   TNL_ASSERT_EQ( this->getSize(), vector.getSize(), "Vector sizes must be equal." );
+   TNL_ASSERT_EQ( this->getLocalRange(),
+                  vector.getLocalRange(),
                   "Multiary operations are supported only on vectors which are distributed the same way." );
-   TNL_ASSERT_EQ( this->getGhosts(), vector.getGhosts(),
-                  "Ghosts must be equal, views are not resizable." );
-   TNL_ASSERT_EQ( this->getCommunicator(), vector.getCommunicator(),
+   TNL_ASSERT_EQ( this->getGhosts(), vector.getGhosts(), "Ghosts must be equal, views are not resizable." );
+   TNL_ASSERT_EQ( this->getCommunicator(),
+                  vector.getCommunicator(),
                   "Multiary operations are supported only on vectors within the same communicator." );
 
    if( this->getCommunicator() != MPI_COMM_NULL ) {
@@ -182,21 +147,18 @@ operator*=( const Vector& vector )
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename Vector, typename..., typename >
+template< typename Real, typename Device, typename Index >
+template< typename Vector, typename..., typename >
 DistributedVectorView< Real, Device, Index >&
-DistributedVectorView< Real, Device, Index >::
-operator/=( const Vector& vector )
+DistributedVectorView< Real, Device, Index >::operator/=( const Vector& vector )
 {
-   TNL_ASSERT_EQ( this->getSize(), vector.getSize(),
-                  "Vector sizes must be equal." );
-   TNL_ASSERT_EQ( this->getLocalRange(), vector.getLocalRange(),
+   TNL_ASSERT_EQ( this->getSize(), vector.getSize(), "Vector sizes must be equal." );
+   TNL_ASSERT_EQ( this->getLocalRange(),
+                  vector.getLocalRange(),
                   "Multiary operations are supported only on vectors which are distributed the same way." );
-   TNL_ASSERT_EQ( this->getGhosts(), vector.getGhosts(),
-                  "Ghosts must be equal, views are not resizable." );
-   TNL_ASSERT_EQ( this->getCommunicator(), vector.getCommunicator(),
+   TNL_ASSERT_EQ( this->getGhosts(), vector.getGhosts(), "Ghosts must be equal, views are not resizable." );
+   TNL_ASSERT_EQ( this->getCommunicator(),
+                  vector.getCommunicator(),
                   "Multiary operations are supported only on vectors within the same communicator." );
 
    if( this->getCommunicator() != MPI_COMM_NULL ) {
@@ -208,21 +170,18 @@ operator/=( const Vector& vector )
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename Vector, typename..., typename >
+template< typename Real, typename Device, typename Index >
+template< typename Vector, typename..., typename >
 DistributedVectorView< Real, Device, Index >&
-DistributedVectorView< Real, Device, Index >::
-operator%=( const Vector& vector )
+DistributedVectorView< Real, Device, Index >::operator%=( const Vector& vector )
 {
-   TNL_ASSERT_EQ( this->getSize(), vector.getSize(),
-                  "Vector sizes must be equal." );
-   TNL_ASSERT_EQ( this->getLocalRange(), vector.getLocalRange(),
+   TNL_ASSERT_EQ( this->getSize(), vector.getSize(), "Vector sizes must be equal." );
+   TNL_ASSERT_EQ( this->getLocalRange(),
+                  vector.getLocalRange(),
                   "Multiary operations are supported only on vectors which are distributed the same way." );
-   TNL_ASSERT_EQ( this->getGhosts(), vector.getGhosts(),
-                  "Ghosts must be equal, views are not resizable." );
-   TNL_ASSERT_EQ( this->getCommunicator(), vector.getCommunicator(),
+   TNL_ASSERT_EQ( this->getGhosts(), vector.getGhosts(), "Ghosts must be equal, views are not resizable." );
+   TNL_ASSERT_EQ( this->getCommunicator(),
+                  vector.getCommunicator(),
                   "Multiary operations are supported only on vectors within the same communicator." );
 
    if( this->getCommunicator() != MPI_COMM_NULL ) {
@@ -234,13 +193,10 @@ operator%=( const Vector& vector )
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename Scalar, typename..., typename >
+template< typename Real, typename Device, typename Index >
+template< typename Scalar, typename..., typename >
 DistributedVectorView< Real, Device, Index >&
-DistributedVectorView< Real, Device, Index >::
-operator=( Scalar c )
+DistributedVectorView< Real, Device, Index >::operator=( Scalar c )
 {
    if( this->getCommunicator() != MPI_COMM_NULL ) {
       getLocalView() = c;
@@ -249,13 +205,10 @@ operator=( Scalar c )
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename Scalar, typename..., typename >
+template< typename Real, typename Device, typename Index >
+template< typename Scalar, typename..., typename >
 DistributedVectorView< Real, Device, Index >&
-DistributedVectorView< Real, Device, Index >::
-operator+=( Scalar c )
+DistributedVectorView< Real, Device, Index >::operator+=( Scalar c )
 {
    if( this->getCommunicator() != MPI_COMM_NULL ) {
       getLocalView() += c;
@@ -264,13 +217,10 @@ operator+=( Scalar c )
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename Scalar, typename..., typename >
+template< typename Real, typename Device, typename Index >
+template< typename Scalar, typename..., typename >
 DistributedVectorView< Real, Device, Index >&
-DistributedVectorView< Real, Device, Index >::
-operator-=( Scalar c )
+DistributedVectorView< Real, Device, Index >::operator-=( Scalar c )
 {
    if( this->getCommunicator() != MPI_COMM_NULL ) {
       getLocalView() -= c;
@@ -279,13 +229,10 @@ operator-=( Scalar c )
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename Scalar, typename..., typename >
+template< typename Real, typename Device, typename Index >
+template< typename Scalar, typename..., typename >
 DistributedVectorView< Real, Device, Index >&
-DistributedVectorView< Real, Device, Index >::
-operator*=( Scalar c )
+DistributedVectorView< Real, Device, Index >::operator*=( Scalar c )
 {
    if( this->getCommunicator() != MPI_COMM_NULL ) {
       getLocalView() *= c;
@@ -294,13 +241,10 @@ operator*=( Scalar c )
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename Scalar, typename..., typename >
+template< typename Real, typename Device, typename Index >
+template< typename Scalar, typename..., typename >
 DistributedVectorView< Real, Device, Index >&
-DistributedVectorView< Real, Device, Index >::
-operator/=( Scalar c )
+DistributedVectorView< Real, Device, Index >::operator/=( Scalar c )
 {
    if( this->getCommunicator() != MPI_COMM_NULL ) {
       getLocalView() /= c;
@@ -309,13 +253,10 @@ operator/=( Scalar c )
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename Scalar, typename..., typename >
+template< typename Real, typename Device, typename Index >
+template< typename Scalar, typename..., typename >
 DistributedVectorView< Real, Device, Index >&
-DistributedVectorView< Real, Device, Index >::
-operator%=( Scalar c )
+DistributedVectorView< Real, Device, Index >::operator%=( Scalar c )
 {
    if( this->getCommunicator() != MPI_COMM_NULL ) {
       getLocalView() %= c;
@@ -324,5 +265,5 @@ operator%=( Scalar c )
    return *this;
 }
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/Expressions/Comparison.h b/src/TNL/Containers/Expressions/Comparison.h
index f9e2f0e17598b63d326cecaaba24fddd7b495529..97516b34f329ce5289ac9366957964bc0bfaaaf2 100644
--- a/src/TNL/Containers/Expressions/Comparison.h
+++ b/src/TNL/Containers/Expressions/Comparison.h
@@ -27,8 +27,8 @@ struct Comparison;
 
 template< typename T1,
           typename T2,
-          bool BothAreNonstaticVectors = IsArrayType< T1 >::value && IsArrayType< T2 >::value &&
-                                       ! IsStaticArrayType< T1 >::value && ! IsStaticArrayType< T2 >::value >
+          bool BothAreNonstaticVectors = IsArrayType< T1 >::value&& IsArrayType< T2 >::value && ! IsStaticArrayType< T1 >::value
+                                      && ! IsStaticArrayType< T2 >::value >
 struct VectorComparison;
 
 // If both operands are vectors we compare them using array operations.
@@ -36,13 +36,15 @@ struct VectorComparison;
 template< typename T1, typename T2 >
 struct VectorComparison< T1, T2, true >
 {
-   static bool EQ( const T1& a, const T2& b )
+   static bool
+   EQ( const T1& a, const T2& b )
    {
       if( a.getSize() != b.getSize() )
          return false;
       if( a.getSize() == 0 )
          return true;
-      return Algorithms::MultiDeviceMemoryOperations< typename T1::DeviceType, typename T2::DeviceType >::compare( a.getData(), b.getData(), a.getSize() );
+      return Algorithms::MultiDeviceMemoryOperations< typename T1::DeviceType, typename T2::DeviceType >::compare(
+         a.getData(), b.getData(), a.getSize() );
    }
 };
 
@@ -50,7 +52,8 @@ struct VectorComparison< T1, T2, true >
 template< typename T1, typename T2 >
 struct VectorComparison< T1, T2, false >
 {
-   static bool EQ( const T1& a, const T2& b )
+   static bool
+   EQ( const T1& a, const T2& b )
    {
       static_assert( std::is_same< typename T1::DeviceType, typename T2::DeviceType >::value,
                      "Cannot compare two expressions with different DeviceType." );
@@ -63,28 +66,33 @@ struct VectorComparison< T1, T2, false >
 
       const auto view_a = a.getConstView();
       const auto view_b = b.getConstView();
-      auto fetch = [=] __cuda_callable__ ( IndexType i ) -> bool { return view_a[ i ] == view_b[ i ]; };
-      return Algorithms::reduce< DeviceType >( ( IndexType ) 0, a.getSize(), fetch, std::logical_and<>{}, true );
+      auto fetch = [ = ] __cuda_callable__( IndexType i ) -> bool
+      {
+         return view_a[ i ] == view_b[ i ];
+      };
+      return Algorithms::reduce< DeviceType >( (IndexType) 0, a.getSize(), fetch, std::logical_and<>{}, true );
    }
 };
 
 /////
 // Comparison of two vector expressions
-template< typename T1,
-          typename T2 >
+template< typename T1, typename T2 >
 struct Comparison< T1, T2, VectorExpressionVariable, VectorExpressionVariable >
 {
-   static bool EQ( const T1& a, const T2& b )
+   static bool
+   EQ( const T1& a, const T2& b )
    {
       return VectorComparison< T1, T2 >::EQ( a, b );
    }
 
-   static bool NE( const T1& a, const T2& b )
+   static bool
+   NE( const T1& a, const T2& b )
    {
       return ! EQ( a, b );
    }
 
-   static bool GT( const T1& a, const T2& b )
+   static bool
+   GT( const T1& a, const T2& b )
    {
       static_assert( std::is_same< typename T1::DeviceType, typename T2::DeviceType >::value,
                      "Cannot compare two expressions with different DeviceType." );
@@ -95,11 +103,15 @@ struct Comparison< T1, T2, VectorExpressionVariable, VectorExpressionVariable >
 
       const auto view_a = a.getConstView();
       const auto view_b = b.getConstView();
-      auto fetch = [=] __cuda_callable__ ( IndexType i ) -> bool { return view_a[ i ] > view_b[ i ]; };
-      return Algorithms::reduce< DeviceType >( ( IndexType ) 0, a.getSize(), fetch, std::logical_and<>{}, true );
+      auto fetch = [ = ] __cuda_callable__( IndexType i ) -> bool
+      {
+         return view_a[ i ] > view_b[ i ];
+      };
+      return Algorithms::reduce< DeviceType >( (IndexType) 0, a.getSize(), fetch, std::logical_and<>{}, true );
    }
 
-   static bool GE( const T1& a, const T2& b )
+   static bool
+   GE( const T1& a, const T2& b )
    {
       static_assert( std::is_same< typename T1::DeviceType, typename T2::DeviceType >::value,
                      "Cannot compare two expressions with different DeviceType." );
@@ -110,11 +122,15 @@ struct Comparison< T1, T2, VectorExpressionVariable, VectorExpressionVariable >
 
       const auto view_a = a.getConstView();
       const auto view_b = b.getConstView();
-      auto fetch = [=] __cuda_callable__ ( IndexType i ) -> bool { return view_a[ i ] >= view_b[ i ]; };
-      return Algorithms::reduce< DeviceType >( ( IndexType ) 0, a.getSize(), fetch, std::logical_and<>{}, true );
+      auto fetch = [ = ] __cuda_callable__( IndexType i ) -> bool
+      {
+         return view_a[ i ] >= view_b[ i ];
+      };
+      return Algorithms::reduce< DeviceType >( (IndexType) 0, a.getSize(), fetch, std::logical_and<>{}, true );
    }
 
-   static bool LT( const T1& a, const T2& b )
+   static bool
+   LT( const T1& a, const T2& b )
    {
       static_assert( std::is_same< typename T1::DeviceType, typename T2::DeviceType >::value,
                      "Cannot compare two expressions with different DeviceType." );
@@ -125,11 +141,15 @@ struct Comparison< T1, T2, VectorExpressionVariable, VectorExpressionVariable >
 
       const auto view_a = a.getConstView();
       const auto view_b = b.getConstView();
-      auto fetch = [=] __cuda_callable__ ( IndexType i ) -> bool { return view_a[ i ] < view_b[ i ]; };
-      return Algorithms::reduce< DeviceType >( ( IndexType ) 0, a.getSize(), fetch, std::logical_and<>{}, true );
+      auto fetch = [ = ] __cuda_callable__( IndexType i ) -> bool
+      {
+         return view_a[ i ] < view_b[ i ];
+      };
+      return Algorithms::reduce< DeviceType >( (IndexType) 0, a.getSize(), fetch, std::logical_and<>{}, true );
    }
 
-   static bool LE( const T1& a, const T2& b )
+   static bool
+   LE( const T1& a, const T2& b )
    {
       static_assert( std::is_same< typename T1::DeviceType, typename T2::DeviceType >::value,
                      "Cannot compare two expressions with different DeviceType." );
@@ -140,135 +160,178 @@ struct Comparison< T1, T2, VectorExpressionVariable, VectorExpressionVariable >
 
       const auto view_a = a.getConstView();
       const auto view_b = b.getConstView();
-      auto fetch = [=] __cuda_callable__ ( IndexType i ) -> bool { return view_a[ i ] <= view_b[ i ]; };
-      return Algorithms::reduce< DeviceType >( ( IndexType ) 0, a.getSize(), fetch, std::logical_and<>{}, true );
+      auto fetch = [ = ] __cuda_callable__( IndexType i ) -> bool
+      {
+         return view_a[ i ] <= view_b[ i ];
+      };
+      return Algorithms::reduce< DeviceType >( (IndexType) 0, a.getSize(), fetch, std::logical_and<>{}, true );
    }
 };
 
 /////
 // Comparison of number and vector expression
-template< typename T1,
-          typename T2 >
+template< typename T1, typename T2 >
 struct Comparison< T1, T2, ArithmeticVariable, VectorExpressionVariable >
 {
-   static bool EQ( const T1& a, const T2& b )
+   static bool
+   EQ( const T1& a, const T2& b )
    {
       using DeviceType = typename T2::DeviceType;
       using IndexType = typename T2::IndexType;
 
       const auto view_b = b.getConstView();
-      auto fetch = [=] __cuda_callable__ ( IndexType i ) -> bool { return a == view_b[ i ]; };
-      return Algorithms::reduce< DeviceType >( ( IndexType ) 0, b.getSize(), fetch, std::logical_and<>{}, true );
+      auto fetch = [ = ] __cuda_callable__( IndexType i ) -> bool
+      {
+         return a == view_b[ i ];
+      };
+      return Algorithms::reduce< DeviceType >( (IndexType) 0, b.getSize(), fetch, std::logical_and<>{}, true );
    }
 
-   static bool NE( const T1& a, const T2& b )
+   static bool
+   NE( const T1& a, const T2& b )
    {
       return ! EQ( a, b );
    }
 
-   static bool GT( const T1& a, const T2& b )
+   static bool
+   GT( const T1& a, const T2& b )
    {
       using DeviceType = typename T2::DeviceType;
       using IndexType = typename T2::IndexType;
 
       const auto view_b = b.getConstView();
-      auto fetch = [=] __cuda_callable__ ( IndexType i ) -> bool { return a > view_b[ i ]; };
-      return Algorithms::reduce< DeviceType >( ( IndexType ) 0, b.getSize(), fetch, std::logical_and<>{}, true );
+      auto fetch = [ = ] __cuda_callable__( IndexType i ) -> bool
+      {
+         return a > view_b[ i ];
+      };
+      return Algorithms::reduce< DeviceType >( (IndexType) 0, b.getSize(), fetch, std::logical_and<>{}, true );
    }
 
-   static bool GE( const T1& a, const T2& b )
+   static bool
+   GE( const T1& a, const T2& b )
    {
       using DeviceType = typename T2::DeviceType;
       using IndexType = typename T2::IndexType;
 
       const auto view_b = b.getConstView();
-      auto fetch = [=] __cuda_callable__ ( IndexType i ) -> bool { return a >= view_b[ i ]; };
-      return Algorithms::reduce< DeviceType >( ( IndexType ) 0, b.getSize(), fetch, std::logical_and<>{}, true );
+      auto fetch = [ = ] __cuda_callable__( IndexType i ) -> bool
+      {
+         return a >= view_b[ i ];
+      };
+      return Algorithms::reduce< DeviceType >( (IndexType) 0, b.getSize(), fetch, std::logical_and<>{}, true );
    }
 
-   static bool LT( const T1& a, const T2& b )
+   static bool
+   LT( const T1& a, const T2& b )
    {
       using DeviceType = typename T2::DeviceType;
       using IndexType = typename T2::IndexType;
 
       const auto view_b = b.getConstView();
-      auto fetch = [=] __cuda_callable__ ( IndexType i ) -> bool { return a < view_b[ i ]; };
-      return Algorithms::reduce< DeviceType >( ( IndexType ) 0, b.getSize(), fetch, std::logical_and<>{}, true );
+      auto fetch = [ = ] __cuda_callable__( IndexType i ) -> bool
+      {
+         return a < view_b[ i ];
+      };
+      return Algorithms::reduce< DeviceType >( (IndexType) 0, b.getSize(), fetch, std::logical_and<>{}, true );
    }
 
-   static bool LE( const T1& a, const T2& b )
+   static bool
+   LE( const T1& a, const T2& b )
    {
       using DeviceType = typename T2::DeviceType;
       using IndexType = typename T2::IndexType;
 
       const auto view_b = b.getConstView();
-      auto fetch = [=] __cuda_callable__ ( IndexType i ) -> bool { return a <= view_b[ i ]; };
-      return Algorithms::reduce< DeviceType >( ( IndexType ) 0, b.getSize(), fetch, std::logical_and<>{}, true );
+      auto fetch = [ = ] __cuda_callable__( IndexType i ) -> bool
+      {
+         return a <= view_b[ i ];
+      };
+      return Algorithms::reduce< DeviceType >( (IndexType) 0, b.getSize(), fetch, std::logical_and<>{}, true );
    }
 };
 
 /////
 // Comparison of vector expressions and number
-template< typename T1,
-          typename T2 >
+template< typename T1, typename T2 >
 struct Comparison< T1, T2, VectorExpressionVariable, ArithmeticVariable >
 {
-   static bool EQ( const T1& a, const T2& b )
+   static bool
+   EQ( const T1& a, const T2& b )
    {
       using DeviceType = typename T1::DeviceType;
       using IndexType = typename T1::IndexType;
 
       const auto view_a = a.getConstView();
-      auto fetch = [=] __cuda_callable__ ( IndexType i ) -> bool { return view_a[ i ] == b; };
-      return Algorithms::reduce< DeviceType >( ( IndexType ) 0, a.getSize(), fetch, std::logical_and<>{}, true );
+      auto fetch = [ = ] __cuda_callable__( IndexType i ) -> bool
+      {
+         return view_a[ i ] == b;
+      };
+      return Algorithms::reduce< DeviceType >( (IndexType) 0, a.getSize(), fetch, std::logical_and<>{}, true );
    }
 
-   static bool NE( const T1& a, const T2& b )
+   static bool
+   NE( const T1& a, const T2& b )
    {
       return ! EQ( a, b );
    }
 
-   static bool GT( const T1& a, const T2& b )
+   static bool
+   GT( const T1& a, const T2& b )
    {
       using DeviceType = typename T1::DeviceType;
       using IndexType = typename T1::IndexType;
 
       const auto view_a = a.getConstView();
-      auto fetch = [=] __cuda_callable__ ( IndexType i ) -> bool { return view_a[ i ] > b; };
-      return Algorithms::reduce< DeviceType >( ( IndexType ) 0, a.getSize(), fetch, std::logical_and<>{}, true );
+      auto fetch = [ = ] __cuda_callable__( IndexType i ) -> bool
+      {
+         return view_a[ i ] > b;
+      };
+      return Algorithms::reduce< DeviceType >( (IndexType) 0, a.getSize(), fetch, std::logical_and<>{}, true );
    }
 
-   static bool GE( const T1& a, const T2& b )
+   static bool
+   GE( const T1& a, const T2& b )
    {
       using DeviceType = typename T1::DeviceType;
       using IndexType = typename T1::IndexType;
 
       const auto view_a = a.getConstView();
-      auto fetch = [=] __cuda_callable__ ( IndexType i ) -> bool { return view_a[ i ] >= b; };
-      return Algorithms::reduce< DeviceType >( ( IndexType ) 0, a.getSize(), fetch, std::logical_and<>{}, true );
+      auto fetch = [ = ] __cuda_callable__( IndexType i ) -> bool
+      {
+         return view_a[ i ] >= b;
+      };
+      return Algorithms::reduce< DeviceType >( (IndexType) 0, a.getSize(), fetch, std::logical_and<>{}, true );
    }
 
-   static bool LT( const T1& a, const T2& b )
+   static bool
+   LT( const T1& a, const T2& b )
    {
       using DeviceType = typename T1::DeviceType;
       using IndexType = typename T1::IndexType;
 
       const auto view_a = a.getConstView();
-      auto fetch = [=] __cuda_callable__ ( IndexType i ) -> bool { return view_a[ i ] < b; };
-      return Algorithms::reduce< DeviceType >( ( IndexType ) 0, a.getSize(), fetch, std::logical_and<>{}, true );
+      auto fetch = [ = ] __cuda_callable__( IndexType i ) -> bool
+      {
+         return view_a[ i ] < b;
+      };
+      return Algorithms::reduce< DeviceType >( (IndexType) 0, a.getSize(), fetch, std::logical_and<>{}, true );
    }
 
-   static bool LE( const T1& a, const T2& b )
+   static bool
+   LE( const T1& a, const T2& b )
    {
       using DeviceType = typename T1::DeviceType;
       using IndexType = typename T1::IndexType;
 
       const auto view_a = a.getConstView();
-      auto fetch = [=] __cuda_callable__ ( IndexType i ) -> bool { return view_a[ i ] <= b; };
-      return Algorithms::reduce< DeviceType >( ( IndexType ) 0, a.getSize(), fetch, std::logical_and<>{}, true );
+      auto fetch = [ = ] __cuda_callable__( IndexType i ) -> bool
+      {
+         return view_a[ i ] <= b;
+      };
+      return Algorithms::reduce< DeviceType >( (IndexType) 0, a.getSize(), fetch, std::logical_and<>{}, true );
    }
 };
 
-} // namespace Expressions
-} // namespace Containers
-} // namespace TNL
+}  // namespace Expressions
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/Expressions/DistributedComparison.h b/src/TNL/Containers/Expressions/DistributedComparison.h
index 8197796e3a0bfac8824a9eeadb82826fb88f67a3..7e849b63a667d8b4ac6063e5df17a4f32f5e152e 100644
--- a/src/TNL/Containers/Expressions/DistributedComparison.h
+++ b/src/TNL/Containers/Expressions/DistributedComparison.h
@@ -23,33 +23,33 @@ struct DistributedComparison;
 
 /////
 // Distributed comparison of two vector expressions
-template< typename T1,
-          typename T2 >
+template< typename T1, typename T2 >
 struct DistributedComparison< T1, T2, VectorExpressionVariable, VectorExpressionVariable >
 {
-   static bool EQ( const T1& a, const T2& b )
+   static bool
+   EQ( const T1& a, const T2& b )
    {
       // we can't run allreduce if the communicators are different
       if( a.getCommunicator() != b.getCommunicator() )
          return false;
-      const bool localResult =
-            a.getLocalRange() == b.getLocalRange() &&
-            a.getGhosts() == b.getGhosts() &&
-            a.getSize() == b.getSize() &&
-            // compare without ghosts
-            a.getConstLocalView() == b.getConstLocalView();
+      const bool localResult = a.getLocalRange() == b.getLocalRange() && a.getGhosts() == b.getGhosts()
+                            && a.getSize() == b.getSize() &&
+                               // compare without ghosts
+                               a.getConstLocalView() == b.getConstLocalView();
       bool result = true;
       if( a.getCommunicator() != MPI_COMM_NULL )
          MPI::Allreduce( &localResult, &result, 1, MPI_LAND, a.getCommunicator() );
       return result;
    }
 
-   static bool NE( const T1& a, const T2& b )
+   static bool
+   NE( const T1& a, const T2& b )
    {
       return ! DistributedComparison::EQ( a, b );
    }
 
-   static bool LT( const T1& a, const T2& b )
+   static bool
+   LT( const T1& a, const T2& b )
    {
       TNL_ASSERT_EQ( a.getSize(), b.getSize(), "Sizes of expressions to be compared do not match." );
       TNL_ASSERT_EQ( a.getLocalRange(), b.getLocalRange(), "Local ranges of expressions to be compared do not match." );
@@ -65,7 +65,8 @@ struct DistributedComparison< T1, T2, VectorExpressionVariable, VectorExpression
       return result;
    }
 
-   static bool LE( const T1& a, const T2& b )
+   static bool
+   LE( const T1& a, const T2& b )
    {
       TNL_ASSERT_EQ( a.getSize(), b.getSize(), "Sizes of expressions to be compared do not match." );
       TNL_ASSERT_EQ( a.getLocalRange(), b.getLocalRange(), "Local ranges of expressions to be compared do not match." );
@@ -81,7 +82,8 @@ struct DistributedComparison< T1, T2, VectorExpressionVariable, VectorExpression
       return result;
    }
 
-   static bool GT( const T1& a, const T2& b )
+   static bool
+   GT( const T1& a, const T2& b )
    {
       TNL_ASSERT_EQ( a.getSize(), b.getSize(), "Sizes of expressions to be compared do not match." );
       TNL_ASSERT_EQ( a.getLocalRange(), b.getLocalRange(), "Local ranges of expressions to be compared do not match." );
@@ -97,7 +99,8 @@ struct DistributedComparison< T1, T2, VectorExpressionVariable, VectorExpression
       return result;
    }
 
-   static bool GE( const T1& a, const T2& b )
+   static bool
+   GE( const T1& a, const T2& b )
    {
       TNL_ASSERT_EQ( a.getSize(), b.getSize(), "Sizes of expressions to be compared do not match." );
       TNL_ASSERT_EQ( a.getLocalRange(), b.getLocalRange(), "Local ranges of expressions to be compared do not match." );
@@ -116,11 +119,11 @@ struct DistributedComparison< T1, T2, VectorExpressionVariable, VectorExpression
 
 /////
 // Distributed comparison of number and vector expression
-template< typename T1,
-          typename T2 >
+template< typename T1, typename T2 >
 struct DistributedComparison< T1, T2, ArithmeticVariable, VectorExpressionVariable >
 {
-   static bool EQ( const T1& a, const T2& b )
+   static bool
+   EQ( const T1& a, const T2& b )
    {
       const bool localResult = a == b.getConstLocalView();
       bool result = true;
@@ -129,12 +132,14 @@ struct DistributedComparison< T1, T2, ArithmeticVariable, VectorExpressionVariab
       return result;
    }
 
-   static bool NE( const T1& a, const T2& b )
+   static bool
+   NE( const T1& a, const T2& b )
    {
       return ! DistributedComparison::EQ( a, b );
    }
 
-   static bool LT( const T1& a, const T2& b )
+   static bool
+   LT( const T1& a, const T2& b )
    {
       const bool localResult = a < b.getConstLocalView();
       bool result = true;
@@ -143,7 +148,8 @@ struct DistributedComparison< T1, T2, ArithmeticVariable, VectorExpressionVariab
       return result;
    }
 
-   static bool LE( const T1& a, const T2& b )
+   static bool
+   LE( const T1& a, const T2& b )
    {
       const bool localResult = a <= b.getConstLocalView();
       bool result = true;
@@ -152,7 +158,8 @@ struct DistributedComparison< T1, T2, ArithmeticVariable, VectorExpressionVariab
       return result;
    }
 
-   static bool GT( const T1& a, const T2& b )
+   static bool
+   GT( const T1& a, const T2& b )
    {
       const bool localResult = a > b.getConstLocalView();
       bool result = true;
@@ -161,7 +168,8 @@ struct DistributedComparison< T1, T2, ArithmeticVariable, VectorExpressionVariab
       return result;
    }
 
-   static bool GE( const T1& a, const T2& b )
+   static bool
+   GE( const T1& a, const T2& b )
    {
       const bool localResult = a >= b.getConstLocalView();
       bool result = true;
@@ -173,11 +181,11 @@ struct DistributedComparison< T1, T2, ArithmeticVariable, VectorExpressionVariab
 
 /////
 // Distributed comparison of vector expressions and number
-template< typename T1,
-          typename T2 >
+template< typename T1, typename T2 >
 struct DistributedComparison< T1, T2, VectorExpressionVariable, ArithmeticVariable >
 {
-   static bool EQ( const T1& a, const T2& b )
+   static bool
+   EQ( const T1& a, const T2& b )
    {
       const bool localResult = a.getConstLocalView() == b;
       bool result = true;
@@ -186,12 +194,14 @@ struct DistributedComparison< T1, T2, VectorExpressionVariable, ArithmeticVariab
       return result;
    }
 
-   static bool NE( const T1& a, const T2& b )
+   static bool
+   NE( const T1& a, const T2& b )
    {
       return ! DistributedComparison::EQ( a, b );
    }
 
-   static bool LT( const T1& a, const T2& b )
+   static bool
+   LT( const T1& a, const T2& b )
    {
       const bool localResult = a.getConstLocalView() < b;
       bool result = true;
@@ -200,7 +210,8 @@ struct DistributedComparison< T1, T2, VectorExpressionVariable, ArithmeticVariab
       return result;
    }
 
-   static bool LE( const T1& a, const T2& b )
+   static bool
+   LE( const T1& a, const T2& b )
    {
       const bool localResult = a.getConstLocalView() <= b;
       bool result = true;
@@ -209,7 +220,8 @@ struct DistributedComparison< T1, T2, VectorExpressionVariable, ArithmeticVariab
       return result;
    }
 
-   static bool GT( const T1& a, const T2& b )
+   static bool
+   GT( const T1& a, const T2& b )
    {
       const bool localResult = a.getConstLocalView() > b;
       bool result = true;
@@ -218,7 +230,8 @@ struct DistributedComparison< T1, T2, VectorExpressionVariable, ArithmeticVariab
       return result;
    }
 
-   static bool GE( const T1& a, const T2& b )
+   static bool
+   GE( const T1& a, const T2& b )
    {
       const bool localResult = a.getConstLocalView() >= b;
       bool result = true;
@@ -228,6 +241,6 @@ struct DistributedComparison< T1, T2, VectorExpressionVariable, ArithmeticVariab
    }
 };
 
-} // namespace Expressions
-} // namespace Containers
-} // namespace TNL
+}  // namespace Expressions
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/Expressions/DistributedExpressionTemplates.h b/src/TNL/Containers/Expressions/DistributedExpressionTemplates.h
index ecbedff4615d21ed3d60f2de2bfbe94d1e24d295..86a03b78177d137277210c33bf4240c6fab5473b 100644
--- a/src/TNL/Containers/Expressions/DistributedExpressionTemplates.h
+++ b/src/TNL/Containers/Expressions/DistributedExpressionTemplates.h
@@ -18,14 +18,11 @@ namespace Expressions {
 
 ////
 // Distributed unary expression template
-template< typename T1,
-          typename Operation >
+template< typename T1, typename Operation >
 struct DistributedUnaryExpressionTemplate;
 
-template< typename T1,
-          typename Operation >
-struct HasEnabledDistributedExpressionTemplates< DistributedUnaryExpressionTemplate< T1, Operation > >
-: std::true_type
+template< typename T1, typename Operation >
+struct HasEnabledDistributedExpressionTemplates< DistributedUnaryExpressionTemplate< T1, Operation > > : std::true_type
 {};
 
 ////
@@ -38,51 +35,48 @@ template< typename T1,
 struct DistributedBinaryExpressionTemplate
 {};
 
-template< typename T1,
-          typename T2,
-          typename Operation,
-          ExpressionVariableType T1Type,
-          ExpressionVariableType T2Type >
+template< typename T1, typename T2, typename Operation, ExpressionVariableType T1Type, ExpressionVariableType T2Type >
 struct HasEnabledDistributedExpressionTemplates< DistributedBinaryExpressionTemplate< T1, T2, Operation, T1Type, T2Type > >
 : std::true_type
 {};
 
-template< typename T1,
-          typename T2,
-          typename Operation >
+template< typename T1, typename T2, typename Operation >
 struct DistributedBinaryExpressionTemplate< T1, T2, Operation, VectorExpressionVariable, VectorExpressionVariable >
 {
-   using RealType = decltype( Operation{}( std::declval<T1>()[0], std::declval<T2>()[0] ) );
+   using RealType = decltype( Operation{}( std::declval< T1 >()[ 0 ], std::declval< T2 >()[ 0 ] ) );
    using ValueType = RealType;
    using DeviceType = typename T1::DeviceType;
    using IndexType = typename T1::IndexType;
    using LocalRangeType = typename T1::LocalRangeType;
-   using ConstLocalViewType = BinaryExpressionTemplate< typename T1::ConstLocalViewType,
-                                                        typename T2::ConstLocalViewType,
-                                                        Operation >;
+   using ConstLocalViewType =
+      BinaryExpressionTemplate< typename T1::ConstLocalViewType, typename T2::ConstLocalViewType, Operation >;
    using SynchronizerType = typename T1::SynchronizerType;
 
    static_assert( HasEnabledDistributedExpressionTemplates< T1 >::value,
-                  "Invalid operand in distributed binary expression templates - distributed expression templates are not enabled for the left operand." );
+                  "Invalid operand in distributed binary expression templates - distributed expression templates are not "
+                  "enabled for the left operand." );
    static_assert( HasEnabledDistributedExpressionTemplates< T2 >::value,
-                  "Invalid operand in distributed binary expression templates - distributed expression templates are not enabled for the right operand." );
+                  "Invalid operand in distributed binary expression templates - distributed expression templates are not "
+                  "enabled for the right operand." );
    static_assert( std::is_same< typename T1::DeviceType, typename T2::DeviceType >::value,
                   "Attempt to mix operands which have different DeviceType." );
 
-   DistributedBinaryExpressionTemplate( const T1& a, const T2& b )
-   : op1( a ), op2( b )
+   DistributedBinaryExpressionTemplate( const T1& a, const T2& b ) : op1( a ), op2( b )
    {
-      TNL_ASSERT_EQ( op1.getSize(), op2.getSize(),
-                     "Attempt to mix operands with different sizes." );
-      TNL_ASSERT_EQ( op1.getLocalRange(), op2.getLocalRange(),
+      TNL_ASSERT_EQ( op1.getSize(), op2.getSize(), "Attempt to mix operands with different sizes." );
+      TNL_ASSERT_EQ( op1.getLocalRange(),
+                     op2.getLocalRange(),
                      "Distributed expressions are supported only on vectors which are distributed the same way." );
-      TNL_ASSERT_EQ( op1.getGhosts(), op2.getGhosts(),
+      TNL_ASSERT_EQ( op1.getGhosts(),
+                     op2.getGhosts(),
                      "Distributed expressions are supported only on vectors which are distributed the same way." );
-      TNL_ASSERT_EQ( op1.getCommunicator(), op2.getCommunicator(),
+      TNL_ASSERT_EQ( op1.getCommunicator(),
+                     op2.getCommunicator(),
                      "Distributed expressions are supported only on vectors within the same communicator." );
    }
 
-   RealType getElement( const IndexType i ) const
+   RealType
+   getElement( const IndexType i ) const
    {
       const IndexType li = getLocalRange().getLocalIndex( i );
       return getConstLocalView().getElement( li );
@@ -90,52 +84,62 @@ struct DistributedBinaryExpressionTemplate< T1, T2, Operation, VectorExpressionV
 
    // this is actually never executed, but needed for proper ExpressionVariableTypeGetter
    // selection via HasSubscriptOperator type trait
-   RealType operator[]( const IndexType i ) const
+   RealType
+   operator[]( const IndexType i ) const
    {
       return getConstLocalView()[ i ];
    }
 
-   IndexType getSize() const
+   IndexType
+   getSize() const
    {
       return op1.getSize();
    }
 
-   LocalRangeType getLocalRange() const
+   LocalRangeType
+   getLocalRange() const
    {
       return op1.getLocalRange();
    }
 
-   IndexType getGhosts() const
+   IndexType
+   getGhosts() const
    {
       return op1.getGhosts();
    }
 
-   MPI_Comm getCommunicator() const
+   MPI_Comm
+   getCommunicator() const
    {
       return op1.getCommunicator();
    }
 
-   ConstLocalViewType getConstLocalView() const
+   ConstLocalViewType
+   getConstLocalView() const
    {
       return ConstLocalViewType( op1.getConstLocalView(), op2.getConstLocalView() );
    }
 
-   ConstLocalViewType getConstLocalViewWithGhosts() const
+   ConstLocalViewType
+   getConstLocalViewWithGhosts() const
    {
       return ConstLocalViewType( op1.getConstLocalViewWithGhosts(), op2.getConstLocalViewWithGhosts() );
    }
 
-   std::shared_ptr< SynchronizerType > getSynchronizer() const
+   std::shared_ptr< SynchronizerType >
+   getSynchronizer() const
    {
       return op1.getSynchronizer();
    }
 
-   int getValuesPerElement() const
+   int
+   getValuesPerElement() const
    {
       return op1.getValuesPerElement();
    }
 
-   void waitForSynchronization() const
+   void
+   waitForSynchronization() const
    {
       op1.waitForSynchronization();
       op2.waitForSynchronization();
@@ -146,12 +150,10 @@ protected:
    const T2& op2;
 };
 
-template< typename T1,
-          typename T2,
-          typename Operation >
+template< typename T1, typename T2, typename Operation >
 struct DistributedBinaryExpressionTemplate< T1, T2, Operation, VectorExpressionVariable, ArithmeticVariable >
 {
-   using RealType = decltype( Operation{}( std::declval<T1>()[0], std::declval<T2>() ) );
+   using RealType = decltype( Operation{}( std::declval< T1 >()[ 0 ], std::declval< T2 >() ) );
    using ValueType = RealType;
    using DeviceType = typename T1::DeviceType;
    using IndexType = typename T1::IndexType;
@@ -160,12 +162,13 @@ struct DistributedBinaryExpressionTemplate< T1, T2, Operation, VectorExpressionV
    using SynchronizerType = typename T1::SynchronizerType;
 
    static_assert( HasEnabledDistributedExpressionTemplates< T1 >::value,
-                  "Invalid operand in distributed binary expression templates - distributed expression templates are not enabled for the left operand." );
+                  "Invalid operand in distributed binary expression templates - distributed expression templates are not "
+                  "enabled for the left operand." );
 
-   DistributedBinaryExpressionTemplate( const T1& a, const T2& b )
-   : op1( a ), op2( b ) {}
+   DistributedBinaryExpressionTemplate( const T1& a, const T2& b ) : op1( a ), op2( b ) {}
 
-   RealType getElement( const IndexType i ) const
+   RealType
+   getElement( const IndexType i ) const
    {
       const IndexType li = getLocalRange().getLocalIndex( i );
       return getConstLocalView().getElement( li );
@@ -173,52 +176,62 @@ struct DistributedBinaryExpressionTemplate< T1, T2, Operation, VectorExpressionV
 
    // this is actually never executed, but needed for proper ExpressionVariableTypeGetter
    // selection via HasSubscriptOperator type trait
-   RealType operator[]( const IndexType i ) const
+   RealType
+   operator[]( const IndexType i ) const
    {
       return getConstLocalView()[ i ];
    }
 
-   IndexType getSize() const
+   IndexType
+   getSize() const
    {
       return op1.getSize();
    }
 
-   LocalRangeType getLocalRange() const
+   LocalRangeType
+   getLocalRange() const
    {
       return op1.getLocalRange();
    }
 
-   IndexType getGhosts() const
+   IndexType
+   getGhosts() const
    {
       return op1.getGhosts();
    }
 
-   MPI_Comm getCommunicator() const
+   MPI_Comm
+   getCommunicator() const
    {
       return op1.getCommunicator();
    }
 
-   ConstLocalViewType getConstLocalView() const
+   ConstLocalViewType
+   getConstLocalView() const
    {
       return ConstLocalViewType( op1.getConstLocalView(), op2 );
    }
 
-   ConstLocalViewType getConstLocalViewWithGhosts() const
+   ConstLocalViewType
+   getConstLocalViewWithGhosts() const
    {
       return ConstLocalViewType( op1.getConstLocalViewWithGhosts(), op2 );
    }
 
-   std::shared_ptr< SynchronizerType > getSynchronizer() const
+   std::shared_ptr< SynchronizerType >
+   getSynchronizer() const
    {
       return op1.getSynchronizer();
    }
 
-   int getValuesPerElement() const
+   int
+   getValuesPerElement() const
    {
       return op1.getValuesPerElement();
    }
 
-   void waitForSynchronization() const
+   void
+   waitForSynchronization() const
    {
       op1.waitForSynchronization();
    }
@@ -228,12 +241,10 @@ protected:
    const T2& op2;
 };
 
-template< typename T1,
-          typename T2,
-          typename Operation >
+template< typename T1, typename T2, typename Operation >
 struct DistributedBinaryExpressionTemplate< T1, T2, Operation, ArithmeticVariable, VectorExpressionVariable >
 {
-   using RealType = decltype( Operation{}( std::declval<T1>(), std::declval<T2>()[0] ) );
+   using RealType = decltype( Operation{}( std::declval< T1 >(), std::declval< T2 >()[ 0 ] ) );
    using ValueType = RealType;
    using DeviceType = typename T2::DeviceType;
    using IndexType = typename T2::IndexType;
@@ -242,12 +253,13 @@ struct DistributedBinaryExpressionTemplate< T1, T2, Operation, ArithmeticVariabl
    using SynchronizerType = typename T2::SynchronizerType;
 
    static_assert( HasEnabledDistributedExpressionTemplates< T2 >::value,
-                  "Invalid operand in distributed binary expression templates - distributed expression templates are not enabled for the right operand." );
+                  "Invalid operand in distributed binary expression templates - distributed expression templates are not "
+                  "enabled for the right operand." );
 
-   DistributedBinaryExpressionTemplate( const T1& a, const T2& b )
-   : op1( a ), op2( b ) {}
+   DistributedBinaryExpressionTemplate( const T1& a, const T2& b ) : op1( a ), op2( b ) {}
 
-   RealType getElement( const IndexType i ) const
+   RealType
+   getElement( const IndexType i ) const
    {
       const IndexType li = getLocalRange().getLocalIndex( i );
       return getConstLocalView().getElement( li );
@@ -255,52 +267,62 @@ struct DistributedBinaryExpressionTemplate< T1, T2, Operation, ArithmeticVariabl
 
    // this is actually never executed, but needed for proper ExpressionVariableTypeGetter
    // selection via HasSubscriptOperator type trait
-   RealType operator[]( const IndexType i ) const
+   RealType
+   operator[]( const IndexType i ) const
    {
       return getConstLocalView()[ i ];
    }
 
-   IndexType getSize() const
+   IndexType
+   getSize() const
    {
       return op2.getSize();
    }
 
-   LocalRangeType getLocalRange() const
+   LocalRangeType
+   getLocalRange() const
    {
       return op2.getLocalRange();
    }
 
-   IndexType getGhosts() const
+   IndexType
+   getGhosts() const
    {
       return op2.getGhosts();
    }
 
-   MPI_Comm getCommunicator() const
+   MPI_Comm
+   getCommunicator() const
    {
       return op2.getCommunicator();
    }
 
-   ConstLocalViewType getConstLocalView() const
+   ConstLocalViewType
+   getConstLocalView() const
    {
       return ConstLocalViewType( op1, op2.getConstLocalView() );
    }
 
-   ConstLocalViewType getConstLocalViewWithGhosts() const
+   ConstLocalViewType
+   getConstLocalViewWithGhosts() const
    {
       return ConstLocalViewType( op1, op2.getConstLocalViewWithGhosts() );
    }
 
-   std::shared_ptr< SynchronizerType > getSynchronizer() const
+   std::shared_ptr< SynchronizerType >
+   getSynchronizer() const
    {
       return op2.getSynchronizer();
    }
 
-   int getValuesPerElement() const
+   int
+   getValuesPerElement() const
    {
       return op2.getValuesPerElement();
    }
 
-   void waitForSynchronization() const
+   void
+   waitForSynchronization() const
    {
       op2.waitForSynchronization();
    }
@@ -312,11 +334,10 @@ protected:
 
 ////
 // Distributed unary expression template
-template< typename T1,
-          typename Operation >
+template< typename T1, typename Operation >
 struct DistributedUnaryExpressionTemplate
 {
-   using RealType = decltype( Operation{}( std::declval<T1>()[0] ) );
+   using RealType = decltype( Operation{}( std::declval< T1 >()[ 0 ] ) );
    using ValueType = RealType;
    using DeviceType = typename T1::DeviceType;
    using IndexType = typename T1::IndexType;
@@ -325,12 +346,13 @@ struct DistributedUnaryExpressionTemplate
    using SynchronizerType = typename T1::SynchronizerType;
 
    static_assert( HasEnabledDistributedExpressionTemplates< T1 >::value,
-                  "Invalid operand in distributed unary expression templates - distributed expression templates are not enabled for the operand." );
+                  "Invalid operand in distributed unary expression templates - distributed expression templates are not "
+                  "enabled for the operand." );
 
-   DistributedUnaryExpressionTemplate( const T1& a )
-   : operand( a ) {}
+   DistributedUnaryExpressionTemplate( const T1& a ) : operand( a ) {}
 
-   RealType getElement( const IndexType i ) const
+   RealType
+   getElement( const IndexType i ) const
    {
       const IndexType li = getLocalRange().getLocalIndex( i );
       return getConstLocalView().getElement( li );
@@ -338,52 +360,62 @@ struct DistributedUnaryExpressionTemplate
 
    // this is actually never executed, but needed for proper ExpressionVariableTypeGetter
    // selection via HasSubscriptOperator type trait
-   RealType operator[]( const IndexType i ) const
+   RealType
+   operator[]( const IndexType i ) const
    {
       return getConstLocalView()[ i ];
    }
 
-   IndexType getSize() const
+   IndexType
+   getSize() const
    {
       return operand.getSize();
    }
 
-   LocalRangeType getLocalRange() const
+   LocalRangeType
+   getLocalRange() const
    {
       return operand.getLocalRange();
    }
 
-   IndexType getGhosts() const
+   IndexType
+   getGhosts() const
    {
       return operand.getGhosts();
    }
 
-   MPI_Comm getCommunicator() const
+   MPI_Comm
+   getCommunicator() const
    {
       return operand.getCommunicator();
    }
 
-   ConstLocalViewType getConstLocalView() const
+   ConstLocalViewType
+   getConstLocalView() const
    {
       return ConstLocalViewType( operand.getConstLocalView() );
    }
 
-   ConstLocalViewType getConstLocalViewWithGhosts() const
+   ConstLocalViewType
+   getConstLocalViewWithGhosts() const
    {
       return ConstLocalViewType( operand.getConstLocalViewWithGhosts() );
    }
 
-   std::shared_ptr< SynchronizerType > getSynchronizer() const
+   std::shared_ptr< SynchronizerType >
+   getSynchronizer() const
    {
       return operand.getSynchronizer();
    }
 
-   int getValuesPerElement() const
+   int
+   getValuesPerElement() const
    {
       return operand.getValuesPerElement();
    }
 
-   void waitForSynchronization() const
+   void
+   waitForSynchronization() const
    {
       operand.waitForSynchronization();
    }
@@ -394,23 +426,19 @@ protected:
 
 #ifndef DOXYGEN_ONLY
 
-#define TNL_MAKE_DISTRIBUTED_UNARY_EXPRESSION(fname, functor)                                \
-   template< typename ET1,                                                                   \
-             typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >         \
-   auto                                                                                      \
-   fname( const ET1& a )                                                                     \
-   {                                                                                         \
-      return DistributedUnaryExpressionTemplate< ET1, functor >( a );                        \
-   }                                                                                         \
-
-#define TNL_MAKE_DISTRIBUTED_BINARY_EXPRESSION(fname, functor)                               \
-   template< typename ET1, typename ET2,                                                     \
-             typename..., EnableIfDistributedBinaryExpression_t< ET1, ET2, bool > = true >   \
-   auto                                                                                      \
-   fname( const ET1& a, const ET2& b )                                                       \
-   {                                                                                         \
-      return DistributedBinaryExpressionTemplate< ET1, ET2, functor >( a, b );               \
-   }                                                                                         \
+   #define TNL_MAKE_DISTRIBUTED_UNARY_EXPRESSION( fname, functor )                                    \
+      template< typename ET1, typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true > \
+      auto fname( const ET1& a )                                                                      \
+      {                                                                                               \
+         return DistributedUnaryExpressionTemplate< ET1, functor >( a );                              \
+      }
+
+   #define TNL_MAKE_DISTRIBUTED_BINARY_EXPRESSION( fname, functor )                                                       \
+      template< typename ET1, typename ET2, typename..., EnableIfDistributedBinaryExpression_t< ET1, ET2, bool > = true > \
+      auto fname( const ET1& a, const ET2& b )                                                                            \
+      {                                                                                                                   \
+         return DistributedBinaryExpressionTemplate< ET1, ET2, functor >( a, b );                                         \
+      }
 
 TNL_MAKE_DISTRIBUTED_BINARY_EXPRESSION( operator+, TNL::Plus )
 TNL_MAKE_DISTRIBUTED_BINARY_EXPRESSION( operator-, TNL::Minus )
@@ -445,13 +473,12 @@ TNL_MAKE_DISTRIBUTED_UNARY_EXPRESSION( floor, TNL::Floor )
 TNL_MAKE_DISTRIBUTED_UNARY_EXPRESSION( ceil, TNL::Ceil )
 TNL_MAKE_DISTRIBUTED_UNARY_EXPRESSION( sign, TNL::Sign )
 
-#undef TNL_MAKE_DISTRIBUTED_UNARY_EXPRESSION
-#undef TNL_MAKE_DISTRIBUTED_BINARY_EXPRESSION
+   #undef TNL_MAKE_DISTRIBUTED_UNARY_EXPRESSION
+   #undef TNL_MAKE_DISTRIBUTED_BINARY_EXPRESSION
 
 ////
 // Pow
-template< typename ET1, typename Real,
-          typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename Real, typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
 auto
 pow( const ET1& a, const Real& exp )
 {
@@ -460,9 +487,7 @@ pow( const ET1& a, const Real& exp )
 
 ////
 // Cast
-template< typename ResultType,
-          typename ET1,
-          typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
+template< typename ResultType, typename ET1, typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
 auto
 cast( const ET1& a )
 {
@@ -472,8 +497,7 @@ cast( const ET1& a )
 
 ////
 // Comparison operator ==
-template< typename ET1, typename ET2,
-          typename..., EnableIfDistributedBinaryExpression_t< ET1, ET2, bool > = true >
+template< typename ET1, typename ET2, typename..., EnableIfDistributedBinaryExpression_t< ET1, ET2, bool > = true >
 bool
 operator==( const ET1& a, const ET2& b )
 {
@@ -482,8 +506,7 @@ operator==( const ET1& a, const ET2& b )
 
 ////
 // Comparison operator !=
-template< typename ET1, typename ET2,
-          typename..., EnableIfDistributedBinaryExpression_t< ET1, ET2, bool > = true >
+template< typename ET1, typename ET2, typename..., EnableIfDistributedBinaryExpression_t< ET1, ET2, bool > = true >
 bool
 operator!=( const ET1& a, const ET2& b )
 {
@@ -492,8 +515,7 @@ operator!=( const ET1& a, const ET2& b )
 
 ////
 // Comparison operator <
-template< typename ET1, typename ET2,
-          typename..., EnableIfDistributedBinaryExpression_t< ET1, ET2, bool > = true >
+template< typename ET1, typename ET2, typename..., EnableIfDistributedBinaryExpression_t< ET1, ET2, bool > = true >
 bool
 operator<( const ET1& a, const ET2& b )
 {
@@ -502,8 +524,7 @@ operator<( const ET1& a, const ET2& b )
 
 ////
 // Comparison operator <=
-template< typename ET1, typename ET2,
-          typename..., EnableIfDistributedBinaryExpression_t< ET1, ET2, bool > = true >
+template< typename ET1, typename ET2, typename..., EnableIfDistributedBinaryExpression_t< ET1, ET2, bool > = true >
 bool
 operator<=( const ET1& a, const ET2& b )
 {
@@ -512,8 +533,7 @@ operator<=( const ET1& a, const ET2& b )
 
 ////
 // Comparison operator >
-template< typename ET1, typename ET2,
-          typename..., EnableIfDistributedBinaryExpression_t< ET1, ET2, bool > = true >
+template< typename ET1, typename ET2, typename..., EnableIfDistributedBinaryExpression_t< ET1, ET2, bool > = true >
 bool
 operator>( const ET1& a, const ET2& b )
 {
@@ -522,8 +542,7 @@ operator>( const ET1& a, const ET2& b )
 
 ////
 // Comparison operator >=
-template< typename ET1, typename ET2,
-          typename..., EnableIfDistributedBinaryExpression_t< ET1, ET2, bool > = true >
+template< typename ET1, typename ET2, typename..., EnableIfDistributedBinaryExpression_t< ET1, ET2, bool > = true >
 bool
 operator>=( const ET1& a, const ET2& b )
 {
@@ -540,74 +559,65 @@ operator,( const ET1& a, const ET2& b )
    return DistributedExpressionSum( a * b );
 }
 
-template< typename ET1, typename ET2,
-          typename..., EnableIfDistributedBinaryExpression_t< ET1, ET2, bool > = true >
+template< typename ET1, typename ET2, typename..., EnableIfDistributedBinaryExpression_t< ET1, ET2, bool > = true >
 auto
 dot( const ET1& a, const ET2& b )
 {
-   return (a, b);
+   return ( a, b );
 }
 
 ////
 // Vertical operations
-template< typename ET1,
-          typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
 auto
 min( const ET1& a )
 {
    return DistributedExpressionMin( a );
 }
 
-template< typename ET1,
-          typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
 auto
 argMin( const ET1& a )
 {
    return DistributedExpressionArgMin( a );
 }
 
-template< typename ET1,
-          typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
 auto
 max( const ET1& a )
 {
    return DistributedExpressionMax( a );
 }
 
-template< typename ET1,
-          typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
 auto
 argMax( const ET1& a )
 {
    return DistributedExpressionArgMax( a );
 }
 
-template< typename ET1,
-          typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
 auto
 sum( const ET1& a )
 {
    return DistributedExpressionSum( a );
 }
 
-template< typename ET1,
-          typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
 auto
 maxNorm( const ET1& a )
 {
    return max( abs( a ) );
 }
 
-template< typename ET1,
-          typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
 auto
 l1Norm( const ET1& a )
 {
    return sum( abs( a ) );
 }
 
-template< typename ET1,
-          typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
 auto
 l2Norm( const ET1& a )
 {
@@ -615,13 +625,11 @@ l2Norm( const ET1& a )
    return sqrt( sum( a * a ) );
 }
 
-template< typename ET1,
-          typename Real,
-          typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename Real, typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
 auto
 lpNorm( const ET1& a, const Real& p )
-// since (1.0 / p) has type double, TNL::pow returns double
--> double
+   // since (1.0 / p) has type double, TNL::pow returns double
+   -> double
 {
    if( p == 1.0 )
       return l1Norm( a );
@@ -631,48 +639,42 @@ lpNorm( const ET1& a, const Real& p )
    return pow( sum( pow( abs( a ), p ) ), 1.0 / p );
 }
 
-template< typename ET1,
-          typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
 auto
 product( const ET1& a )
 {
    return DistributedExpressionProduct( a );
 }
 
-template< typename ET1,
-          typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
 auto
 logicalAnd( const ET1& a )
 {
    return DistributedExpressionLogicalAnd( a );
 }
 
-template< typename ET1,
-          typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
 auto
 logicalOr( const ET1& a )
 {
    return DistributedExpressionLogicalOr( a );
 }
 
-template< typename ET1,
-          typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
 auto
 binaryAnd( const ET1& a )
 {
    return DistributedExpressionBinaryAnd( a );
 }
 
-template< typename ET1,
-          typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
 auto
 binaryOr( const ET1& a )
 {
    return DistributedExpressionBinaryOr( a );
 }
 
-template< typename ET1,
-          typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfDistributedUnaryExpression_t< ET1, bool > = true >
 auto
 binaryXor( const ET1& a )
 {
@@ -681,10 +683,9 @@ binaryXor( const ET1& a )
 
 ////
 // Output stream
-template< typename T1,
-          typename T2,
-          typename Operation >
-std::ostream& operator<<( std::ostream& str, const DistributedBinaryExpressionTemplate< T1, T2, Operation >& expression )
+template< typename T1, typename T2, typename Operation >
+std::ostream&
+operator<<( std::ostream& str, const DistributedBinaryExpressionTemplate< T1, T2, Operation >& expression )
 {
    const auto localRange = expression.getLocalRange();
    str << "[ ";
@@ -702,9 +703,9 @@ std::ostream& operator<<( std::ostream& str, const DistributedBinaryExpressionTe
    return str;
 }
 
-template< typename T,
-          typename Operation >
-std::ostream& operator<<( std::ostream& str, const DistributedUnaryExpressionTemplate< T, Operation >& expression )
+template< typename T, typename Operation >
+std::ostream&
+operator<<( std::ostream& str, const DistributedUnaryExpressionTemplate< T, Operation >& expression )
 {
    const auto localRange = expression.getLocalRange();
    str << "[ ";
@@ -722,9 +723,9 @@ std::ostream& operator<<( std::ostream& str, const DistributedUnaryExpressionTem
    return str;
 }
 
-#endif // DOXYGEN_ONLY
+#endif  // DOXYGEN_ONLY
 
-} // namespace Expressions
+}  // namespace Expressions
 
 // Make all operators visible in the TNL::Containers namespace to be considered
 // even for DistributedVector and DistributedVectorView
@@ -733,7 +734,7 @@ using Expressions::operator-;
 using Expressions::operator*;
 using Expressions::operator/;
 using Expressions::operator%;
-using Expressions::operator,;
+using Expressions::operator, ;
 using Expressions::operator==;
 using Expressions::operator!=;
 using Expressions::operator<;
@@ -742,149 +743,145 @@ using Expressions::operator>;
 using Expressions::operator>=;
 
 // Make all functions visible in the TNL::Containers namespace
-using Expressions::dot;
-using Expressions::min;
-using Expressions::max;
 using Expressions::abs;
-using Expressions::pow;
-using Expressions::exp;
-using Expressions::sqrt;
-using Expressions::cbrt;
-using Expressions::log;
-using Expressions::log10;
-using Expressions::log2;
-using Expressions::sin;
-using Expressions::cos;
-using Expressions::tan;
-using Expressions::asin;
 using Expressions::acos;
-using Expressions::atan;
-using Expressions::sinh;
-using Expressions::cosh;
-using Expressions::tanh;
-using Expressions::asinh;
 using Expressions::acosh;
+using Expressions::argMax;
+using Expressions::argMin;
+using Expressions::asin;
+using Expressions::asinh;
+using Expressions::atan;
 using Expressions::atanh;
-using Expressions::floor;
-using Expressions::ceil;
-using Expressions::sign;
+using Expressions::binaryAnd;
+using Expressions::binaryOr;
 using Expressions::cast;
-using Expressions::argMin;
-using Expressions::argMax;
-using Expressions::sum;
-using Expressions::maxNorm;
+using Expressions::cbrt;
+using Expressions::ceil;
+using Expressions::cos;
+using Expressions::cosh;
+using Expressions::dot;
+using Expressions::exp;
+using Expressions::floor;
 using Expressions::l1Norm;
 using Expressions::l2Norm;
-using Expressions::lpNorm;
-using Expressions::product;
+using Expressions::log;
+using Expressions::log10;
+using Expressions::log2;
 using Expressions::logicalAnd;
 using Expressions::logicalOr;
-using Expressions::binaryAnd;
-using Expressions::binaryOr;
+using Expressions::lpNorm;
+using Expressions::max;
+using Expressions::maxNorm;
+using Expressions::min;
+using Expressions::pow;
+using Expressions::product;
+using Expressions::sign;
+using Expressions::sin;
+using Expressions::sinh;
+using Expressions::sqrt;
+using Expressions::sum;
+using Expressions::tan;
+using Expressions::tanh;
 
-} // namespace Containers
+}  // namespace Containers
 
 // Make all functions visible in the main TNL namespace
-using Containers::dot;
-using Containers::min;
-using Containers::max;
 using Containers::abs;
-using Containers::pow;
-using Containers::exp;
-using Containers::sqrt;
-using Containers::cbrt;
-using Containers::log;
-using Containers::log10;
-using Containers::log2;
-using Containers::sin;
-using Containers::cos;
-using Containers::tan;
-using Containers::asin;
 using Containers::acos;
-using Containers::atan;
-using Containers::sinh;
-using Containers::cosh;
-using Containers::tanh;
-using Containers::asinh;
 using Containers::acosh;
+using Containers::argMax;
+using Containers::argMin;
+using Containers::asin;
+using Containers::asinh;
+using Containers::atan;
 using Containers::atanh;
-using Containers::floor;
-using Containers::ceil;
-using Containers::sign;
+using Containers::binaryAnd;
+using Containers::binaryOr;
 using Containers::cast;
-using Containers::argMin;
-using Containers::argMax;
-using Containers::sum;
-using Containers::maxNorm;
+using Containers::cbrt;
+using Containers::ceil;
+using Containers::cos;
+using Containers::cosh;
+using Containers::dot;
+using Containers::exp;
+using Containers::floor;
 using Containers::l1Norm;
 using Containers::l2Norm;
-using Containers::lpNorm;
-using Containers::product;
+using Containers::log;
+using Containers::log10;
+using Containers::log2;
 using Containers::logicalAnd;
 using Containers::logicalOr;
-using Containers::binaryAnd;
-using Containers::binaryOr;
+using Containers::lpNorm;
+using Containers::max;
+using Containers::maxNorm;
+using Containers::min;
+using Containers::pow;
+using Containers::product;
+using Containers::sign;
+using Containers::sin;
+using Containers::sinh;
+using Containers::sqrt;
+using Containers::sum;
+using Containers::tan;
+using Containers::tanh;
 
 ////
 // Evaluation with reduction
-template< typename Vector,
-   typename T1,
-   typename T2,
-   typename Operation,
-   typename Reduction,
-   typename Result >
-Result evaluateAndReduce( Vector& lhs,
-   const Containers::Expressions::DistributedBinaryExpressionTemplate< T1, T2, Operation >& expression,
-   const Reduction& reduction,
-   const Result& zero )
+template< typename Vector, typename T1, typename T2, typename Operation, typename Reduction, typename Result >
+Result
+evaluateAndReduce( Vector& lhs,
+                   const Containers::Expressions::DistributedBinaryExpressionTemplate< T1, T2, Operation >& expression,
+                   const Reduction& reduction,
+                   const Result& zero )
 {
    using RealType = typename Vector::RealType;
    using IndexType = typename Vector::IndexType;
    using DeviceType = typename Vector::DeviceType;
 
    RealType* lhs_data = lhs.getData();
-   auto fetch = [=] __cuda_callable__ ( IndexType i ) -> RealType { return ( lhs_data[ i ] = expression[ i ] ); };
+   auto fetch = [ = ] __cuda_callable__( IndexType i ) -> RealType
+   {
+      return ( lhs_data[ i ] = expression[ i ] );
+   };
    return Algorithms::reduce< DeviceType >( lhs.getSize(), fetch, reduction, zero );
 }
 
-template< typename Vector,
-   typename T1,
-   typename Operation,
-   typename Reduction,
-   typename Result >
-Result evaluateAndReduce( Vector& lhs,
-   const Containers::Expressions::DistributedUnaryExpressionTemplate< T1, Operation >& expression,
-   const Reduction& reduction,
-   const Result& zero )
+template< typename Vector, typename T1, typename Operation, typename Reduction, typename Result >
+Result
+evaluateAndReduce( Vector& lhs,
+                   const Containers::Expressions::DistributedUnaryExpressionTemplate< T1, Operation >& expression,
+                   const Reduction& reduction,
+                   const Result& zero )
 {
    using RealType = typename Vector::RealType;
    using IndexType = typename Vector::IndexType;
    using DeviceType = typename Vector::DeviceType;
 
    RealType* lhs_data = lhs.getData();
-   auto fetch = [=] __cuda_callable__ ( IndexType i ) -> RealType { return ( lhs_data[ i ] = expression[ i ] ); };
+   auto fetch = [ = ] __cuda_callable__( IndexType i ) -> RealType
+   {
+      return ( lhs_data[ i ] = expression[ i ] );
+   };
    return Algorithms::reduce< DeviceType >( lhs.getSize(), fetch, reduction, zero );
 }
 
 ////
 // Addition and reduction
-template< typename Vector,
-   typename T1,
-   typename T2,
-   typename Operation,
-   typename Reduction,
-   typename Result >
-Result addAndReduce( Vector& lhs,
-   const Containers::Expressions::DistributedBinaryExpressionTemplate< T1, T2, Operation >& expression,
-   const Reduction& reduction,
-   const Result& zero )
+template< typename Vector, typename T1, typename T2, typename Operation, typename Reduction, typename Result >
+Result
+addAndReduce( Vector& lhs,
+              const Containers::Expressions::DistributedBinaryExpressionTemplate< T1, T2, Operation >& expression,
+              const Reduction& reduction,
+              const Result& zero )
 {
    using RealType = typename Vector::RealType;
    using IndexType = typename Vector::IndexType;
    using DeviceType = typename Vector::DeviceType;
 
    RealType* lhs_data = lhs.getData();
-   auto fetch = [=] __cuda_callable__ ( IndexType i ) -> RealType {
+   auto fetch = [ = ] __cuda_callable__( IndexType i ) -> RealType
+   {
       const RealType aux = expression[ i ];
       lhs_data[ i ] += aux;
       return aux;
@@ -892,22 +889,20 @@ Result addAndReduce( Vector& lhs,
    return Algorithms::reduce< DeviceType >( lhs.getSize(), fetch, reduction, zero );
 }
 
-template< typename Vector,
-   typename T1,
-   typename Operation,
-   typename Reduction,
-   typename Result >
-Result addAndReduce( Vector& lhs,
-   const Containers::Expressions::DistributedUnaryExpressionTemplate< T1, Operation >& expression,
-   const Reduction& reduction,
-   const Result& zero )
+template< typename Vector, typename T1, typename Operation, typename Reduction, typename Result >
+Result
+addAndReduce( Vector& lhs,
+              const Containers::Expressions::DistributedUnaryExpressionTemplate< T1, Operation >& expression,
+              const Reduction& reduction,
+              const Result& zero )
 {
    using RealType = typename Vector::RealType;
    using IndexType = typename Vector::IndexType;
    using DeviceType = typename Vector::DeviceType;
 
    RealType* lhs_data = lhs.getData();
-   auto fetch = [=] __cuda_callable__ ( IndexType i ) -> RealType {
+   auto fetch = [ = ] __cuda_callable__( IndexType i ) -> RealType
+   {
       const RealType aux = expression[ i ];
       lhs_data[ i ] += aux;
       return aux;
@@ -917,23 +912,20 @@ Result addAndReduce( Vector& lhs,
 
 ////
 // Addition and reduction
-template< typename Vector,
-   typename T1,
-   typename T2,
-   typename Operation,
-   typename Reduction,
-   typename Result >
-Result addAndReduceAbs( Vector& lhs,
-   const Containers::Expressions::DistributedBinaryExpressionTemplate< T1, T2, Operation >& expression,
-   const Reduction& reduction,
-   const Result& zero )
+template< typename Vector, typename T1, typename T2, typename Operation, typename Reduction, typename Result >
+Result
+addAndReduceAbs( Vector& lhs,
+                 const Containers::Expressions::DistributedBinaryExpressionTemplate< T1, T2, Operation >& expression,
+                 const Reduction& reduction,
+                 const Result& zero )
 {
    using RealType = typename Vector::RealType;
    using IndexType = typename Vector::IndexType;
    using DeviceType = typename Vector::DeviceType;
 
    RealType* lhs_data = lhs.getData();
-   auto fetch = [=] __cuda_callable__ ( IndexType i ) -> RealType {
+   auto fetch = [ = ] __cuda_callable__( IndexType i ) -> RealType
+   {
       const RealType aux = expression[ i ];
       lhs_data[ i ] += aux;
       return TNL::abs( aux );
@@ -941,22 +933,20 @@ Result addAndReduceAbs( Vector& lhs,
    return Algorithms::reduce< DeviceType >( lhs.getSize(), fetch, reduction, zero );
 }
 
-template< typename Vector,
-   typename T1,
-   typename Operation,
-   typename Reduction,
-   typename Result >
-Result addAndReduceAbs( Vector& lhs,
-   const Containers::Expressions::DistributedUnaryExpressionTemplate< T1, Operation >& expression,
-   const Reduction& reduction,
-   const Result& zero )
+template< typename Vector, typename T1, typename Operation, typename Reduction, typename Result >
+Result
+addAndReduceAbs( Vector& lhs,
+                 const Containers::Expressions::DistributedUnaryExpressionTemplate< T1, Operation >& expression,
+                 const Reduction& reduction,
+                 const Result& zero )
 {
    using RealType = typename Vector::RealType;
    using IndexType = typename Vector::IndexType;
    using DeviceType = typename Vector::DeviceType;
 
    RealType* lhs_data = lhs.getData();
-   auto fetch = [=] __cuda_callable__ ( IndexType i ) -> RealType {
+   auto fetch = [ = ] __cuda_callable__( IndexType i ) -> RealType
+   {
       const RealType aux = expression[ i ];
       lhs_data[ i ] += aux;
       return TNL::abs( aux );
@@ -964,4 +954,4 @@ Result addAndReduceAbs( Vector& lhs,
    return Algorithms::reduce< DeviceType >( lhs.getSize(), fetch, reduction, zero );
 }
 
-} // namespace TNL
+}  // namespace TNL
diff --git a/src/TNL/Containers/Expressions/DistributedVerticalOperations.h b/src/TNL/Containers/Expressions/DistributedVerticalOperations.h
index 9be70085ff0d4a108d18fb0f437b7c198e76a958..fef677e540b8054719e3ab2bd7e07a34564c1a7a 100644
--- a/src/TNL/Containers/Expressions/DistributedVerticalOperations.h
+++ b/src/TNL/Containers/Expressions/DistributedVerticalOperations.h
@@ -14,9 +14,10 @@ namespace Containers {
 namespace Expressions {
 
 template< typename Expression >
-auto DistributedExpressionMin( const Expression& expression ) -> std::decay_t< decltype( expression[0] ) >
+auto
+DistributedExpressionMin( const Expression& expression ) -> std::decay_t< decltype( expression[ 0 ] ) >
 {
-   using ResultType = std::decay_t< decltype( expression[0] ) >;
+   using ResultType = std::decay_t< decltype( expression[ 0 ] ) >;
 
    static_assert( std::numeric_limits< ResultType >::is_specialized,
                   "std::numeric_limits is not specialized for the reduction's result type" );
@@ -29,10 +30,11 @@ auto DistributedExpressionMin( const Expression& expression ) -> std::decay_t< d
 }
 
 template< typename Expression >
-auto DistributedExpressionArgMin( const Expression& expression )
--> std::pair< std::decay_t< decltype( expression[0] ) >, typename Expression::IndexType >
+auto
+DistributedExpressionArgMin( const Expression& expression )
+   -> std::pair< std::decay_t< decltype( expression[ 0 ] ) >, typename Expression::IndexType >
 {
-   using RealType = std::decay_t< decltype( expression[0] ) >;
+   using RealType = std::decay_t< decltype( expression[ 0 ] ) >;
    using IndexType = typename Expression::IndexType;
    using ResultType = std::pair< RealType, IndexType >;
 
@@ -49,15 +51,21 @@ auto DistributedExpressionArgMin( const Expression& expression )
       // scatter local result to all processes and gather their results
       const int nproc = MPI::GetSize( communicator );
       ResultType dataForScatter[ nproc ];
-      for( int i = 0; i < nproc; i++ ) dataForScatter[ i ] = localResult;
+      for( int i = 0; i < nproc; i++ )
+         dataForScatter[ i ] = localResult;
       ResultType gatheredResults[ nproc ];
       // NOTE: exchanging general data types does not work with MPI
-      //MPI::Alltoall( dataForScatter, 1, gatheredResults, 1, communicator );
-      MPI::Alltoall( (char*) dataForScatter, sizeof(ResultType), (char*) gatheredResults, sizeof(ResultType), communicator );
+      // MPI::Alltoall( dataForScatter, 1, gatheredResults, 1, communicator );
+      MPI::Alltoall(
+         (char*) dataForScatter, sizeof( ResultType ), (char*) gatheredResults, sizeof( ResultType ), communicator );
 
       // reduce the gathered data
-      const auto* _data = gatheredResults;  // workaround for nvcc which does not allow to capture variable-length arrays (even in pure host code!)
-      auto fetch = [_data] ( IndexType i ) { return _data[ i ].first; };
+      //    workaround for nvcc which does not allow to capture variable-length arrays (even in pure host code!)
+      const auto* _data = gatheredResults;
+      auto fetch = [ _data ]( IndexType i )
+      {
+         return _data[ i ].first;
+      };
       result = Algorithms::reduceWithArgument< Devices::Host >( (IndexType) 0, (IndexType) nproc, fetch, TNL::MinWithArg{} );
       result.second = gatheredResults[ result.second ].second;
    }
@@ -65,9 +73,10 @@ auto DistributedExpressionArgMin( const Expression& expression )
 }
 
 template< typename Expression >
-auto DistributedExpressionMax( const Expression& expression ) -> std::decay_t< decltype( expression[0] ) >
+auto
+DistributedExpressionMax( const Expression& expression ) -> std::decay_t< decltype( expression[ 0 ] ) >
 {
-   using ResultType = std::decay_t< decltype( expression[0] ) >;
+   using ResultType = std::decay_t< decltype( expression[ 0 ] ) >;
 
    static_assert( std::numeric_limits< ResultType >::is_specialized,
                   "std::numeric_limits is not specialized for the reduction's result type" );
@@ -80,10 +89,11 @@ auto DistributedExpressionMax( const Expression& expression ) -> std::decay_t< d
 }
 
 template< typename Expression >
-auto DistributedExpressionArgMax( const Expression& expression )
--> std::pair< std::decay_t< decltype( expression[0] ) >, typename Expression::IndexType >
+auto
+DistributedExpressionArgMax( const Expression& expression )
+   -> std::pair< std::decay_t< decltype( expression[ 0 ] ) >, typename Expression::IndexType >
 {
-   using RealType = std::decay_t< decltype( expression[0] ) >;
+   using RealType = std::decay_t< decltype( expression[ 0 ] ) >;
    using IndexType = typename Expression::IndexType;
    using ResultType = std::pair< RealType, IndexType >;
 
@@ -100,25 +110,32 @@ auto DistributedExpressionArgMax( const Expression& expression )
       // scatter local result to all processes and gather their results
       const int nproc = MPI::GetSize( communicator );
       ResultType dataForScatter[ nproc ];
-      for( int i = 0; i < nproc; i++ ) dataForScatter[ i ] = localResult;
+      for( int i = 0; i < nproc; i++ )
+         dataForScatter[ i ] = localResult;
       ResultType gatheredResults[ nproc ];
       // NOTE: exchanging general data types does not work with MPI
-      //MPI::Alltoall( dataForScatter, 1, gatheredResults, 1, communicator );
-      MPI::Alltoall( (char*) dataForScatter, sizeof(ResultType), (char*) gatheredResults, sizeof(ResultType), communicator );
+      // MPI::Alltoall( dataForScatter, 1, gatheredResults, 1, communicator );
+      MPI::Alltoall(
+         (char*) dataForScatter, sizeof( ResultType ), (char*) gatheredResults, sizeof( ResultType ), communicator );
 
       // reduce the gathered data
-      const auto* _data = gatheredResults;  // workaround for nvcc which does not allow to capture variable-length arrays (even in pure host code!)
-      auto fetch = [_data] ( IndexType i ) { return _data[ i ].first; };
-      result = Algorithms::reduceWithArgument< Devices::Host >( ( IndexType ) 0, (IndexType) nproc, fetch, TNL::MaxWithArg{} );
+      //    workaround for nvcc which does not allow to capture variable-length arrays (even in pure host code!)
+      const auto* _data = gatheredResults;
+      auto fetch = [ _data ]( IndexType i )
+      {
+         return _data[ i ].first;
+      };
+      result = Algorithms::reduceWithArgument< Devices::Host >( (IndexType) 0, (IndexType) nproc, fetch, TNL::MaxWithArg{} );
       result.second = gatheredResults[ result.second ].second;
    }
    return result;
 }
 
 template< typename Expression >
-auto DistributedExpressionSum( const Expression& expression ) -> std::decay_t< decltype( expression[0] ) >
+auto
+DistributedExpressionSum( const Expression& expression ) -> std::decay_t< decltype( expression[ 0 ] ) >
 {
-   using ResultType = std::decay_t< decltype( expression[0] ) >;
+   using ResultType = std::decay_t< decltype( expression[ 0 ] ) >;
 
    ResultType result = 0;
    if( expression.getCommunicator() != MPI_COMM_NULL ) {
@@ -129,9 +146,10 @@ auto DistributedExpressionSum( const Expression& expression ) -> std::decay_t< d
 }
 
 template< typename Expression >
-auto DistributedExpressionProduct( const Expression& expression ) -> std::decay_t< decltype( expression[0] * expression[0] ) >
+auto
+DistributedExpressionProduct( const Expression& expression ) -> std::decay_t< decltype( expression[ 0 ] * expression[ 0 ] ) >
 {
-   using ResultType = std::decay_t< decltype( expression[0] ) >;
+   using ResultType = std::decay_t< decltype( expression[ 0 ] ) >;
 
    ResultType result = 1;
    if( expression.getCommunicator() != MPI_COMM_NULL ) {
@@ -142,9 +160,11 @@ auto DistributedExpressionProduct( const Expression& expression ) -> std::decay_
 }
 
 template< typename Expression >
-auto DistributedExpressionLogicalAnd( const Expression& expression ) -> std::decay_t< decltype( expression[0] && expression[0] ) >
+auto
+DistributedExpressionLogicalAnd( const Expression& expression )
+   -> std::decay_t< decltype( expression[ 0 ] && expression[ 0 ] ) >
 {
-   using ResultType = std::decay_t< decltype( expression[0] && expression[0] ) >;
+   using ResultType = std::decay_t< decltype( expression[ 0 ] && expression[ 0 ] ) >;
 
    static_assert( std::numeric_limits< ResultType >::is_specialized,
                   "std::numeric_limits is not specialized for the reduction's result type" );
@@ -157,9 +177,10 @@ auto DistributedExpressionLogicalAnd( const Expression& expression ) -> std::dec
 }
 
 template< typename Expression >
-auto DistributedExpressionLogicalOr( const Expression& expression ) -> std::decay_t< decltype( expression[0] || expression[0] ) >
+auto
+DistributedExpressionLogicalOr( const Expression& expression ) -> std::decay_t< decltype( expression[ 0 ] || expression[ 0 ] ) >
 {
-   using ResultType = std::decay_t< decltype( expression[0] || expression[0] ) >;
+   using ResultType = std::decay_t< decltype( expression[ 0 ] || expression[ 0 ] ) >;
 
    ResultType result = 0;
    if( expression.getCommunicator() != MPI_COMM_NULL ) {
@@ -170,9 +191,10 @@ auto DistributedExpressionLogicalOr( const Expression& expression ) -> std::deca
 }
 
 template< typename Expression >
-auto DistributedExpressionBinaryAnd( const Expression& expression ) -> std::decay_t< decltype( expression[0] & expression[0] ) >
+auto
+DistributedExpressionBinaryAnd( const Expression& expression ) -> std::decay_t< decltype( expression[ 0 ] & expression[ 0 ] ) >
 {
-   using ResultType = std::decay_t< decltype( expression[0] & expression[0] ) >;
+   using ResultType = std::decay_t< decltype( expression[ 0 ] & expression[ 0 ] ) >;
 
    static_assert( std::numeric_limits< ResultType >::is_specialized,
                   "std::numeric_limits is not specialized for the reduction's result type" );
@@ -185,9 +207,10 @@ auto DistributedExpressionBinaryAnd( const Expression& expression ) -> std::deca
 }
 
 template< typename Expression >
-auto DistributedExpressionBinaryOr( const Expression& expression ) -> std::decay_t< decltype( expression[0] | expression[0] ) >
+auto
+DistributedExpressionBinaryOr( const Expression& expression ) -> std::decay_t< decltype( expression[ 0 ] | expression[ 0 ] ) >
 {
-   using ResultType = std::decay_t< decltype( expression[0] | expression[0] ) >;
+   using ResultType = std::decay_t< decltype( expression[ 0 ] | expression[ 0 ] ) >;
 
    ResultType result = 0;
    if( expression.getCommunicator() != MPI_COMM_NULL ) {
@@ -198,9 +221,10 @@ auto DistributedExpressionBinaryOr( const Expression& expression ) -> std::decay
 }
 
 template< typename Expression >
-auto DistributedExpressionBinaryXor( const Expression& expression ) -> std::decay_t< decltype( expression[0] ^ expression[0] ) >
+auto
+DistributedExpressionBinaryXor( const Expression& expression ) -> std::decay_t< decltype( expression[ 0 ] ^ expression[ 0 ] ) >
 {
-   using ResultType = std::decay_t< decltype( expression[0] ^ expression[0] ) >;
+   using ResultType = std::decay_t< decltype( expression[ 0 ] ^ expression[ 0 ] ) >;
 
    ResultType result = 0;
    if( expression.getCommunicator() != MPI_COMM_NULL ) {
@@ -210,6 +234,6 @@ auto DistributedExpressionBinaryXor( const Expression& expression ) -> std::deca
    return result;
 }
 
-} // namespace Expressions
-} // namespace Containers
-} // namespace TNL
+}  // namespace Expressions
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/Expressions/ExpressionTemplates.h b/src/TNL/Containers/Expressions/ExpressionTemplates.h
index 641d1c2c2faf707a33f33963500502751c067a6c..3819be9c204f73fb5f7df53204b9bc0580493321 100644
--- a/src/TNL/Containers/Expressions/ExpressionTemplates.h
+++ b/src/TNL/Containers/Expressions/ExpressionTemplates.h
@@ -20,14 +20,11 @@ namespace TNL {
 namespace Containers {
 namespace Expressions {
 
-template< typename T1,
-          typename Operation >
+template< typename T1, typename Operation >
 struct UnaryExpressionTemplate;
 
-template< typename T1,
-          typename Operation >
-struct HasEnabledExpressionTemplates< UnaryExpressionTemplate< T1, Operation > >
-: std::true_type
+template< typename T1, typename Operation >
+struct HasEnabledExpressionTemplates< UnaryExpressionTemplate< T1, Operation > > : std::true_type
 {};
 
 template< typename T1,
@@ -37,67 +34,64 @@ template< typename T1,
           ExpressionVariableType T2Type = getExpressionVariableType< T2, T1 >() >
 struct BinaryExpressionTemplate;
 
-template< typename T1,
-          typename T2,
-          typename Operation,
-          ExpressionVariableType T1Type,
-          ExpressionVariableType T2Type >
-struct HasEnabledExpressionTemplates< BinaryExpressionTemplate< T1, T2, Operation, T1Type, T2Type > >
-: std::true_type
+template< typename T1, typename T2, typename Operation, ExpressionVariableType T1Type, ExpressionVariableType T2Type >
+struct HasEnabledExpressionTemplates< BinaryExpressionTemplate< T1, T2, Operation, T1Type, T2Type > > : std::true_type
 {};
 
-
 ////
 // Non-static binary expression template
-template< typename T1,
-          typename T2,
-          typename Operation >
+template< typename T1, typename T2, typename Operation >
 struct BinaryExpressionTemplate< T1, T2, Operation, VectorExpressionVariable, VectorExpressionVariable >
 {
-   using RealType = decltype( Operation{}( std::declval<T1>()[0], std::declval<T2>()[0] ) );
+   using RealType = decltype( Operation{}( std::declval< T1 >()[ 0 ], std::declval< T2 >()[ 0 ] ) );
    using ValueType = RealType;
    using DeviceType = typename T1::DeviceType;
    using IndexType = typename T1::IndexType;
    using ConstViewType = BinaryExpressionTemplate;
 
-   static_assert( HasEnabledExpressionTemplates< T1 >::value,
-                  "Invalid operand in binary expression templates - expression templates are not enabled for the left operand." );
-   static_assert( HasEnabledExpressionTemplates< T2 >::value,
-                  "Invalid operand in binary expression templates - expression templates are not enabled for the right operand." );
+   static_assert(
+      HasEnabledExpressionTemplates< T1 >::value,
+      "Invalid operand in binary expression templates - expression templates are not enabled for the left operand." );
+   static_assert(
+      HasEnabledExpressionTemplates< T2 >::value,
+      "Invalid operand in binary expression templates - expression templates are not enabled for the right operand." );
    static_assert( std::is_same< typename T1::DeviceType, typename T2::DeviceType >::value,
                   "Attempt to mix operands which have different DeviceType." );
 
-   BinaryExpressionTemplate( const T1& a, const T2& b )
-   : op1( a.getConstView() ), op2( b.getConstView() )
+   BinaryExpressionTemplate( const T1& a, const T2& b ) : op1( a.getConstView() ), op2( b.getConstView() )
    {
-      TNL_ASSERT_EQ( op1.getSize(), op2.getSize(),
-                     "Attempt to mix operands with different sizes." );
+      TNL_ASSERT_EQ( op1.getSize(), op2.getSize(), "Attempt to mix operands with different sizes." );
    }
 
-   RealType getElement( const IndexType i ) const
+   RealType
+   getElement( const IndexType i ) const
    {
       return Operation{}( op1.getElement( i ), op2.getElement( i ) );
    }
 
    __cuda_callable__
-   RealType operator[]( const IndexType i ) const
+   RealType
+   operator[]( const IndexType i ) const
    {
       return Operation{}( op1[ i ], op2[ i ] );
    }
 
    __cuda_callable__
-   RealType operator()( const IndexType i ) const
+   RealType
+   operator()( const IndexType i ) const
    {
       return operator[]( i );
    }
 
    __cuda_callable__
-   IndexType getSize() const
+   IndexType
+   getSize() const
    {
       return op1.getSize();
    }
 
-   ConstViewType getConstView() const
+   ConstViewType
+   getConstView() const
    {
       return *this;
    }
@@ -107,47 +101,50 @@ protected:
    const typename T2::ConstViewType op2;
 };
 
-template< typename T1,
-          typename T2,
-          typename Operation >
+template< typename T1, typename T2, typename Operation >
 struct BinaryExpressionTemplate< T1, T2, Operation, VectorExpressionVariable, ArithmeticVariable >
 {
-   using RealType = decltype( Operation{}( std::declval<T1>()[0], std::declval<T2>() ) );
+   using RealType = decltype( Operation{}( std::declval< T1 >()[ 0 ], std::declval< T2 >() ) );
    using ValueType = RealType;
    using DeviceType = typename T1::DeviceType;
    using IndexType = typename T1::IndexType;
    using ConstViewType = BinaryExpressionTemplate;
 
-   static_assert( HasEnabledExpressionTemplates< T1 >::value,
-                  "Invalid operand in binary expression templates - expression templates are not enabled for the left operand." );
+   static_assert(
+      HasEnabledExpressionTemplates< T1 >::value,
+      "Invalid operand in binary expression templates - expression templates are not enabled for the left operand." );
 
-   BinaryExpressionTemplate( const T1& a, const T2& b )
-   : op1( a.getConstView() ), op2( b ) {}
+   BinaryExpressionTemplate( const T1& a, const T2& b ) : op1( a.getConstView() ), op2( b ) {}
 
-   RealType getElement( const IndexType i ) const
+   RealType
+   getElement( const IndexType i ) const
    {
       return Operation{}( op1.getElement( i ), op2 );
    }
 
    __cuda_callable__
-   RealType operator[]( const IndexType i ) const
+   RealType
+   operator[]( const IndexType i ) const
    {
       return Operation{}( op1[ i ], op2 );
    }
 
    __cuda_callable__
-   RealType operator()( const IndexType i ) const
+   RealType
+   operator()( const IndexType i ) const
    {
       return operator[]( i );
    }
 
    __cuda_callable__
-   IndexType getSize() const
+   IndexType
+   getSize() const
    {
       return op1.getSize();
    }
 
-   ConstViewType getConstView() const
+   ConstViewType
+   getConstView() const
    {
       return *this;
    }
@@ -157,47 +154,50 @@ protected:
    const T2 op2;
 };
 
-template< typename T1,
-          typename T2,
-          typename Operation >
+template< typename T1, typename T2, typename Operation >
 struct BinaryExpressionTemplate< T1, T2, Operation, ArithmeticVariable, VectorExpressionVariable >
 {
-   using RealType = decltype( Operation{}( std::declval<T1>(), std::declval<T2>()[0] ) );
+   using RealType = decltype( Operation{}( std::declval< T1 >(), std::declval< T2 >()[ 0 ] ) );
    using ValueType = RealType;
    using DeviceType = typename T2::DeviceType;
    using IndexType = typename T2::IndexType;
    using ConstViewType = BinaryExpressionTemplate;
 
-   static_assert( HasEnabledExpressionTemplates< T2 >::value,
-                  "Invalid operand in binary expression templates - expression templates are not enabled for the right operand." );
+   static_assert(
+      HasEnabledExpressionTemplates< T2 >::value,
+      "Invalid operand in binary expression templates - expression templates are not enabled for the right operand." );
 
-   BinaryExpressionTemplate( const T1& a, const T2& b )
-   : op1( a ), op2( b.getConstView() ) {}
+   BinaryExpressionTemplate( const T1& a, const T2& b ) : op1( a ), op2( b.getConstView() ) {}
 
-   RealType getElement( const IndexType i ) const
+   RealType
+   getElement( const IndexType i ) const
    {
       return Operation{}( op1, op2.getElement( i ) );
    }
 
    __cuda_callable__
-   RealType operator[]( const IndexType i ) const
+   RealType
+   operator[]( const IndexType i ) const
    {
       return Operation{}( op1, op2[ i ] );
    }
 
    __cuda_callable__
-   RealType operator()( const IndexType i ) const
+   RealType
+   operator()( const IndexType i ) const
    {
       return operator[]( i );
    }
 
    __cuda_callable__
-   IndexType getSize() const
+   IndexType
+   getSize() const
    {
       return op2.getSize();
    }
 
-   ConstViewType getConstView() const
+   ConstViewType
+   getConstView() const
    {
       return *this;
    }
@@ -209,11 +209,10 @@ protected:
 
 ////
 // Non-static unary expression template
-template< typename T1,
-          typename Operation >
+template< typename T1, typename Operation >
 struct UnaryExpressionTemplate
 {
-   using RealType = decltype( Operation{}( std::declval<T1>()[0] ) );
+   using RealType = decltype( Operation{}( std::declval< T1 >()[ 0 ] ) );
    using ValueType = RealType;
    using DeviceType = typename T1::DeviceType;
    using IndexType = typename T1::IndexType;
@@ -222,33 +221,37 @@ struct UnaryExpressionTemplate
    static_assert( HasEnabledExpressionTemplates< T1 >::value,
                   "Invalid operand in unary expression templates - expression templates are not enabled for the operand." );
 
-   UnaryExpressionTemplate( const T1& a )
-   : operand( a.getConstView() ) {}
+   UnaryExpressionTemplate( const T1& a ) : operand( a.getConstView() ) {}
 
-   RealType getElement( const IndexType i ) const
+   RealType
+   getElement( const IndexType i ) const
    {
       return Operation{}( operand.getElement( i ) );
    }
 
    __cuda_callable__
-   RealType operator[]( const IndexType i ) const
+   RealType
+   operator[]( const IndexType i ) const
    {
       return Operation{}( operand[ i ] );
    }
 
    __cuda_callable__
-   RealType operator()( const IndexType i ) const
+   RealType
+   operator()( const IndexType i ) const
    {
       return operator[]( i );
    }
 
    __cuda_callable__
-   IndexType getSize() const
+   IndexType
+   getSize() const
    {
       return operand.getSize();
    }
 
-   ConstViewType getConstView() const
+   ConstViewType
+   getConstView() const
    {
       return *this;
    }
@@ -259,23 +262,19 @@ protected:
 
 #ifndef DOXYGEN_ONLY
 
-#define TNL_MAKE_UNARY_EXPRESSION(fname, functor)                                \
-   template< typename ET1,                                                       \
-             typename..., EnableIfUnaryExpression_t< ET1, bool > = true >        \
-   auto                                                                          \
-   fname( const ET1& a )                                                         \
-   {                                                                             \
-      return UnaryExpressionTemplate< ET1, functor >( a );                       \
-   }                                                                             \
-
-#define TNL_MAKE_BINARY_EXPRESSION(fname, functor)                               \
-   template< typename ET1, typename ET2,                                         \
-             typename..., EnableIfBinaryExpression_t< ET1, ET2, bool > = true >  \
-   auto                                                                          \
-   fname( const ET1& a, const ET2& b )                                           \
-   {                                                                             \
-      return BinaryExpressionTemplate< ET1, ET2, functor >( a, b );              \
-   }                                                                             \
+   #define TNL_MAKE_UNARY_EXPRESSION( fname, functor )                                     \
+      template< typename ET1, typename..., EnableIfUnaryExpression_t< ET1, bool > = true > \
+      auto fname( const ET1& a )                                                           \
+      {                                                                                    \
+         return UnaryExpressionTemplate< ET1, functor >( a );                              \
+      }
+
+   #define TNL_MAKE_BINARY_EXPRESSION( fname, functor )                                                        \
+      template< typename ET1, typename ET2, typename..., EnableIfBinaryExpression_t< ET1, ET2, bool > = true > \
+      auto fname( const ET1& a, const ET2& b )                                                                 \
+      {                                                                                                        \
+         return BinaryExpressionTemplate< ET1, ET2, functor >( a, b );                                         \
+      }
 
 TNL_MAKE_BINARY_EXPRESSION( operator+, TNL::Plus )
 TNL_MAKE_BINARY_EXPRESSION( operator-, TNL::Minus )
@@ -310,13 +309,12 @@ TNL_MAKE_UNARY_EXPRESSION( floor, TNL::Floor )
 TNL_MAKE_UNARY_EXPRESSION( ceil, TNL::Ceil )
 TNL_MAKE_UNARY_EXPRESSION( sign, TNL::Sign )
 
-#undef TNL_MAKE_UNARY_EXPRESSION
-#undef TNL_MAKE_BINARY_EXPRESSION
+   #undef TNL_MAKE_UNARY_EXPRESSION
+   #undef TNL_MAKE_BINARY_EXPRESSION
 
 ////
 // Pow
-template< typename ET1, typename Real,
-          typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename Real, typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
 auto
 pow( const ET1& a, const Real& exp )
 {
@@ -325,9 +323,7 @@ pow( const ET1& a, const Real& exp )
 
 ////
 // Cast
-template< typename ResultType,
-          typename ET1,
-          typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
+template< typename ResultType, typename ET1, typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
 auto
 cast( const ET1& a )
 {
@@ -337,8 +333,7 @@ cast( const ET1& a )
 
 ////
 // Comparison operator ==
-template< typename ET1, typename ET2,
-          typename..., EnableIfBinaryExpression_t< ET1, ET2, bool > = true >
+template< typename ET1, typename ET2, typename..., EnableIfBinaryExpression_t< ET1, ET2, bool > = true >
 bool
 operator==( const ET1& a, const ET2& b )
 {
@@ -347,8 +342,7 @@ operator==( const ET1& a, const ET2& b )
 
 ////
 // Comparison operator !=
-template< typename ET1, typename ET2,
-          typename..., EnableIfBinaryExpression_t< ET1, ET2, bool > = true >
+template< typename ET1, typename ET2, typename..., EnableIfBinaryExpression_t< ET1, ET2, bool > = true >
 bool
 operator!=( const ET1& a, const ET2& b )
 {
@@ -357,8 +351,7 @@ operator!=( const ET1& a, const ET2& b )
 
 ////
 // Comparison operator <
-template< typename ET1, typename ET2,
-          typename..., EnableIfBinaryExpression_t< ET1, ET2, bool > = true >
+template< typename ET1, typename ET2, typename..., EnableIfBinaryExpression_t< ET1, ET2, bool > = true >
 bool
 operator<( const ET1& a, const ET2& b )
 {
@@ -367,8 +360,7 @@ operator<( const ET1& a, const ET2& b )
 
 ////
 // Comparison operator <=
-template< typename ET1, typename ET2,
-          typename..., EnableIfBinaryExpression_t< ET1, ET2, bool > = true >
+template< typename ET1, typename ET2, typename..., EnableIfBinaryExpression_t< ET1, ET2, bool > = true >
 bool
 operator<=( const ET1& a, const ET2& b )
 {
@@ -377,8 +369,7 @@ operator<=( const ET1& a, const ET2& b )
 
 ////
 // Comparison operator >
-template< typename ET1, typename ET2,
-          typename..., EnableIfBinaryExpression_t< ET1, ET2, bool > = true >
+template< typename ET1, typename ET2, typename..., EnableIfBinaryExpression_t< ET1, ET2, bool > = true >
 bool
 operator>( const ET1& a, const ET2& b )
 {
@@ -387,8 +378,7 @@ operator>( const ET1& a, const ET2& b )
 
 ////
 // Comparison operator >=
-template< typename ET1, typename ET2,
-          typename..., EnableIfBinaryExpression_t< ET1, ET2, bool > = true >
+template< typename ET1, typename ET2, typename..., EnableIfBinaryExpression_t< ET1, ET2, bool > = true >
 bool
 operator>=( const ET1& a, const ET2& b )
 {
@@ -405,74 +395,65 @@ operator,( const ET1& a, const ET2& b )
    return Algorithms::reduce( a * b, TNL::Plus{} );
 }
 
-template< typename ET1, typename ET2,
-          typename..., EnableIfBinaryExpression_t< ET1, ET2, bool > = true >
+template< typename ET1, typename ET2, typename..., EnableIfBinaryExpression_t< ET1, ET2, bool > = true >
 auto
 dot( const ET1& a, const ET2& b )
 {
-   return (a, b);
+   return ( a, b );
 }
 
 ////
 // Vertical operations
-template< typename ET1,
-          typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
 auto
 min( const ET1& a )
 {
    return Algorithms::reduce( a, TNL::Min{} );
 }
 
-template< typename ET1,
-          typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
 auto
 argMin( const ET1& a )
 {
    return Algorithms::reduceWithArgument( a, TNL::MinWithArg{} );
 }
 
-template< typename ET1,
-          typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
 auto
 max( const ET1& a )
 {
    return Algorithms::reduce( a, TNL::Max{} );
 }
 
-template< typename ET1,
-          typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
 auto
 argMax( const ET1& a )
 {
    return Algorithms::reduceWithArgument( a, TNL::MaxWithArg{} );
 }
 
-template< typename ET1,
-          typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
 auto
 sum( const ET1& a )
 {
    return Algorithms::reduce( a, TNL::Plus{} );
 }
 
-template< typename ET1,
-          typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
 auto
 maxNorm( const ET1& a )
 {
    return max( abs( a ) );
 }
 
-template< typename ET1,
-          typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
 auto
 l1Norm( const ET1& a )
 {
    return sum( abs( a ) );
 }
 
-template< typename ET1,
-          typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
 auto
 l2Norm( const ET1& a )
 {
@@ -480,13 +461,11 @@ l2Norm( const ET1& a )
    return sqrt( sum( a * a ) );
 }
 
-template< typename ET1,
-          typename Real,
-          typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename Real, typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
 auto
 lpNorm( const ET1& a, const Real& p )
-// since (1.0 / p) has type double, TNL::pow returns double
--> double
+   // since (1.0 / p) has type double, TNL::pow returns double
+   -> double
 {
    if( p == 1.0 )
       return l1Norm( a );
@@ -496,62 +475,55 @@ lpNorm( const ET1& a, const Real& p )
    return pow( sum( pow( abs( a ), p ) ), 1.0 / p );
 }
 
-template< typename ET1,
-          typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
 auto
 product( const ET1& a )
 {
    return Algorithms::reduce( a, TNL::Multiplies{} );
 }
 
-template< typename ET1,
-          typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
 auto
 logicalAnd( const ET1& a )
 {
    return Algorithms::reduce( a, TNL::LogicalAnd{} );
 }
 
-template< typename ET1,
-          typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
 auto
 logicalOr( const ET1& a )
 {
    return Algorithms::reduce( a, TNL::LogicalOr{} );
 }
 
-template< typename ET1,
-          typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
 auto
 binaryAnd( const ET1& a )
 {
    return Algorithms::reduce( a, TNL::BitAnd{} );
 }
 
-template< typename ET1,
-          typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
 auto
 binaryOr( const ET1& a )
 {
    return Algorithms::reduce( a, TNL::BitOr{} );
 }
 
-template< typename ET1,
-          typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfUnaryExpression_t< ET1, bool > = true >
 auto
 binaryXor( const ET1& a )
 {
    return Algorithms::reduce( a, TNL::BitXor{} );
 }
 
-#endif // DOXYGEN_ONLY
+#endif  // DOXYGEN_ONLY
 
 ////
 // Output stream
-template< typename T1,
-          typename T2,
-          typename Operation >
-std::ostream& operator<<( std::ostream& str, const BinaryExpressionTemplate< T1, T2, Operation >& expression )
+template< typename T1, typename T2, typename Operation >
+std::ostream&
+operator<<( std::ostream& str, const BinaryExpressionTemplate< T1, T2, Operation >& expression )
 {
    str << "[ ";
    for( int i = 0; i < expression.getSize() - 1; i++ )
@@ -560,9 +532,9 @@ std::ostream& operator<<( std::ostream& str, const BinaryExpressionTemplate< T1,
    return str;
 }
 
-template< typename T,
-          typename Operation >
-std::ostream& operator<<( std::ostream& str, const UnaryExpressionTemplate< T, Operation >& expression )
+template< typename T, typename Operation >
+std::ostream&
+operator<<( std::ostream& str, const UnaryExpressionTemplate< T, Operation >& expression )
 {
    str << "[ ";
    for( int i = 0; i < expression.getSize() - 1; i++ )
@@ -571,7 +543,7 @@ std::ostream& operator<<( std::ostream& str, const UnaryExpressionTemplate< T, O
    return str;
 }
 
-} // namespace Expressions
+}  // namespace Expressions
 
 // Make all operators visible in the TNL::Containers namespace to be considered
 // even for Vector and VectorView
@@ -580,7 +552,7 @@ using Expressions::operator-;
 using Expressions::operator*;
 using Expressions::operator/;
 using Expressions::operator%;
-using Expressions::operator,;
+using Expressions::operator, ;
 using Expressions::operator==;
 using Expressions::operator!=;
 using Expressions::operator<;
@@ -589,226 +561,215 @@ using Expressions::operator>;
 using Expressions::operator>=;
 
 // Make all functions visible in the TNL::Containers namespace
-using Expressions::dot;
-using Expressions::min;
-using Expressions::max;
 using Expressions::abs;
-using Expressions::pow;
-using Expressions::exp;
-using Expressions::sqrt;
-using Expressions::cbrt;
-using Expressions::log;
-using Expressions::log10;
-using Expressions::log2;
-using Expressions::sin;
-using Expressions::cos;
-using Expressions::tan;
-using Expressions::asin;
 using Expressions::acos;
-using Expressions::atan;
-using Expressions::sinh;
-using Expressions::cosh;
-using Expressions::tanh;
-using Expressions::asinh;
 using Expressions::acosh;
+using Expressions::argMax;
+using Expressions::argMin;
+using Expressions::asin;
+using Expressions::asinh;
+using Expressions::atan;
 using Expressions::atanh;
-using Expressions::floor;
-using Expressions::ceil;
-using Expressions::sign;
+using Expressions::binaryAnd;
+using Expressions::binaryOr;
 using Expressions::cast;
-using Expressions::argMin;
-using Expressions::argMax;
-using Expressions::sum;
-using Expressions::maxNorm;
+using Expressions::cbrt;
+using Expressions::ceil;
+using Expressions::cos;
+using Expressions::cosh;
+using Expressions::dot;
+using Expressions::exp;
+using Expressions::floor;
 using Expressions::l1Norm;
 using Expressions::l2Norm;
-using Expressions::lpNorm;
-using Expressions::product;
+using Expressions::log;
+using Expressions::log10;
+using Expressions::log2;
 using Expressions::logicalAnd;
 using Expressions::logicalOr;
-using Expressions::binaryAnd;
-using Expressions::binaryOr;
+using Expressions::lpNorm;
+using Expressions::max;
+using Expressions::maxNorm;
+using Expressions::min;
+using Expressions::pow;
+using Expressions::product;
+using Expressions::sign;
+using Expressions::sin;
+using Expressions::sinh;
+using Expressions::sqrt;
+using Expressions::sum;
+using Expressions::tan;
+using Expressions::tanh;
 
-} // namespace Containers
+}  // namespace Containers
 
 // Make all functions visible in the main TNL namespace
-using Containers::dot;
-using Containers::min;
-using Containers::max;
 using Containers::abs;
-using Containers::pow;
-using Containers::exp;
-using Containers::sqrt;
-using Containers::cbrt;
-using Containers::log;
-using Containers::log10;
-using Containers::log2;
-using Containers::sin;
-using Containers::cos;
-using Containers::tan;
-using Containers::asin;
 using Containers::acos;
-using Containers::atan;
-using Containers::sinh;
-using Containers::cosh;
-using Containers::tanh;
-using Containers::asinh;
 using Containers::acosh;
+using Containers::argMax;
+using Containers::argMin;
+using Containers::asin;
+using Containers::asinh;
+using Containers::atan;
 using Containers::atanh;
-using Containers::floor;
-using Containers::ceil;
-using Containers::sign;
+using Containers::binaryAnd;
+using Containers::binaryOr;
 using Containers::cast;
-using Containers::argMin;
-using Containers::argMax;
-using Containers::sum;
-using Containers::maxNorm;
+using Containers::cbrt;
+using Containers::ceil;
+using Containers::cos;
+using Containers::cosh;
+using Containers::dot;
+using Containers::exp;
+using Containers::floor;
 using Containers::l1Norm;
 using Containers::l2Norm;
-using Containers::lpNorm;
-using Containers::product;
+using Containers::log;
+using Containers::log10;
+using Containers::log2;
 using Containers::logicalAnd;
 using Containers::logicalOr;
-using Containers::binaryAnd;
-using Containers::binaryOr;
+using Containers::lpNorm;
+using Containers::max;
+using Containers::maxNorm;
+using Containers::min;
+using Containers::pow;
+using Containers::product;
+using Containers::sign;
+using Containers::sin;
+using Containers::sinh;
+using Containers::sqrt;
+using Containers::sum;
+using Containers::tan;
+using Containers::tanh;
 
 ////
 // Evaluation with reduction
-template< typename Vector,
-   typename T1,
-   typename T2,
-   typename Operation,
-   typename Reduction,
-   typename Result >
-Result evaluateAndReduce( Vector& lhs,
-   const Containers::Expressions::BinaryExpressionTemplate< T1, T2, Operation >& expression,
-   const Reduction& reduction,
-   const Result& zero )
+template< typename Vector, typename T1, typename T2, typename Operation, typename Reduction, typename Result >
+Result
+evaluateAndReduce( Vector& lhs,
+                   const Containers::Expressions::BinaryExpressionTemplate< T1, T2, Operation >& expression,
+                   const Reduction& reduction,
+                   const Result& zero )
 {
    using RealType = typename Vector::RealType;
    using IndexType = typename Vector::IndexType;
    using DeviceType = typename Vector::DeviceType;
 
    RealType* lhs_data = lhs.getData();
-   auto fetch = [=] __cuda_callable__ ( IndexType i ) -> RealType { return ( lhs_data[ i ] = expression[ i ] ); };
-   return Algorithms::reduce< DeviceType >( ( IndexType ) 0, lhs.getSize(), fetch, reduction, zero );
+   auto fetch = [ = ] __cuda_callable__( IndexType i ) -> RealType
+   {
+      return ( lhs_data[ i ] = expression[ i ] );
+   };
+   return Algorithms::reduce< DeviceType >( (IndexType) 0, lhs.getSize(), fetch, reduction, zero );
 }
 
-template< typename Vector,
-   typename T1,
-   typename Operation,
-   typename Reduction,
-   typename Result >
-Result evaluateAndReduce( Vector& lhs,
-   const Containers::Expressions::UnaryExpressionTemplate< T1, Operation >& expression,
-   const Reduction& reduction,
-   const Result& zero )
+template< typename Vector, typename T1, typename Operation, typename Reduction, typename Result >
+Result
+evaluateAndReduce( Vector& lhs,
+                   const Containers::Expressions::UnaryExpressionTemplate< T1, Operation >& expression,
+                   const Reduction& reduction,
+                   const Result& zero )
 {
    using RealType = typename Vector::RealType;
    using IndexType = typename Vector::IndexType;
    using DeviceType = typename Vector::DeviceType;
 
    RealType* lhs_data = lhs.getData();
-   auto fetch = [=] __cuda_callable__ ( IndexType i ) -> RealType { return ( lhs_data[ i ] = expression[ i ] ); };
-   return Algorithms::reduce< DeviceType >( ( IndexType ) 0, lhs.getSize(), fetch, reduction, zero );
+   auto fetch = [ = ] __cuda_callable__( IndexType i ) -> RealType
+   {
+      return ( lhs_data[ i ] = expression[ i ] );
+   };
+   return Algorithms::reduce< DeviceType >( (IndexType) 0, lhs.getSize(), fetch, reduction, zero );
 }
 
 ////
 // Addition and reduction
-template< typename Vector,
-   typename T1,
-   typename T2,
-   typename Operation,
-   typename Reduction,
-   typename Result >
-Result addAndReduce( Vector& lhs,
-   const Containers::Expressions::BinaryExpressionTemplate< T1, T2, Operation >& expression,
-   const Reduction& reduction,
-   const Result& zero )
+template< typename Vector, typename T1, typename T2, typename Operation, typename Reduction, typename Result >
+Result
+addAndReduce( Vector& lhs,
+              const Containers::Expressions::BinaryExpressionTemplate< T1, T2, Operation >& expression,
+              const Reduction& reduction,
+              const Result& zero )
 {
    using RealType = typename Vector::RealType;
    using IndexType = typename Vector::IndexType;
    using DeviceType = typename Vector::DeviceType;
 
    RealType* lhs_data = lhs.getData();
-   auto fetch = [=] __cuda_callable__ ( IndexType i ) -> RealType {
+   auto fetch = [ = ] __cuda_callable__( IndexType i ) -> RealType
+   {
       const RealType aux = expression[ i ];
       lhs_data[ i ] += aux;
       return aux;
    };
-   return Algorithms::reduce< DeviceType >( ( IndexType ) 0, lhs.getSize(), fetch, reduction, zero );
+   return Algorithms::reduce< DeviceType >( (IndexType) 0, lhs.getSize(), fetch, reduction, zero );
 }
 
-template< typename Vector,
-   typename T1,
-   typename Operation,
-   typename Reduction,
-   typename Result >
-Result addAndReduce( Vector& lhs,
-   const Containers::Expressions::UnaryExpressionTemplate< T1, Operation >& expression,
-   const Reduction& reduction,
-   const Result& zero )
+template< typename Vector, typename T1, typename Operation, typename Reduction, typename Result >
+Result
+addAndReduce( Vector& lhs,
+              const Containers::Expressions::UnaryExpressionTemplate< T1, Operation >& expression,
+              const Reduction& reduction,
+              const Result& zero )
 {
    using RealType = typename Vector::RealType;
    using IndexType = typename Vector::IndexType;
    using DeviceType = typename Vector::DeviceType;
 
    RealType* lhs_data = lhs.getData();
-   auto fetch = [=] __cuda_callable__ ( IndexType i ) -> RealType {
+   auto fetch = [ = ] __cuda_callable__( IndexType i ) -> RealType
+   {
       const RealType aux = expression[ i ];
       lhs_data[ i ] += aux;
       return aux;
    };
-   return Algorithms::reduce< DeviceType >( ( IndexType ) 0, lhs.getSize(), fetch, reduction, zero );
+   return Algorithms::reduce< DeviceType >( (IndexType) 0, lhs.getSize(), fetch, reduction, zero );
 }
 
 ////
 // Addition and reduction
-template< typename Vector,
-   typename T1,
-   typename T2,
-   typename Operation,
-   typename Reduction,
-   typename Result >
-Result addAndReduceAbs( Vector& lhs,
-   const Containers::Expressions::BinaryExpressionTemplate< T1, T2, Operation >& expression,
-   const Reduction& reduction,
-   const Result& zero )
+template< typename Vector, typename T1, typename T2, typename Operation, typename Reduction, typename Result >
+Result
+addAndReduceAbs( Vector& lhs,
+                 const Containers::Expressions::BinaryExpressionTemplate< T1, T2, Operation >& expression,
+                 const Reduction& reduction,
+                 const Result& zero )
 {
    using RealType = typename Vector::RealType;
    using IndexType = typename Vector::IndexType;
    using DeviceType = typename Vector::DeviceType;
 
    RealType* lhs_data = lhs.getData();
-   auto fetch = [=] __cuda_callable__ ( IndexType i ) -> RealType {
+   auto fetch = [ = ] __cuda_callable__( IndexType i ) -> RealType
+   {
       const RealType aux = expression[ i ];
       lhs_data[ i ] += aux;
       return TNL::abs( aux );
    };
-   return Algorithms::reduce< DeviceType >( ( IndexType ) 0, lhs.getSize(), fetch, reduction, zero );
+   return Algorithms::reduce< DeviceType >( (IndexType) 0, lhs.getSize(), fetch, reduction, zero );
 }
 
-template< typename Vector,
-   typename T1,
-   typename Operation,
-   typename Reduction,
-   typename Result >
-Result addAndReduceAbs( Vector& lhs,
-   const Containers::Expressions::UnaryExpressionTemplate< T1, Operation >& expression,
-   const Reduction& reduction,
-   const Result& zero )
+template< typename Vector, typename T1, typename Operation, typename Reduction, typename Result >
+Result
+addAndReduceAbs( Vector& lhs,
+                 const Containers::Expressions::UnaryExpressionTemplate< T1, Operation >& expression,
+                 const Reduction& reduction,
+                 const Result& zero )
 {
    using RealType = typename Vector::RealType;
    using IndexType = typename Vector::IndexType;
    using DeviceType = typename Vector::DeviceType;
 
    RealType* lhs_data = lhs.getData();
-   auto fetch = [=] __cuda_callable__ ( IndexType i ) -> RealType {
+   auto fetch = [ = ] __cuda_callable__( IndexType i ) -> RealType
+   {
       const RealType aux = expression[ i ];
       lhs_data[ i ] += aux;
       return TNL::abs( aux );
    };
-   return Algorithms::reduce< DeviceType >( ( IndexType ) 0, lhs.getSize(), fetch, reduction, zero );
+   return Algorithms::reduce< DeviceType >( (IndexType) 0, lhs.getSize(), fetch, reduction, zero );
 }
 
-} // namespace TNL
+}  // namespace TNL
diff --git a/src/TNL/Containers/Expressions/ExpressionVariableType.h b/src/TNL/Containers/Expressions/ExpressionVariableType.h
index 40f796d9455584e82ac6ebf42883ec7326e0a92d..72cf02e42d7f21a796ef3431cdb78ede46fd906b 100644
--- a/src/TNL/Containers/Expressions/ExpressionVariableType.h
+++ b/src/TNL/Containers/Expressions/ExpressionVariableType.h
@@ -12,7 +12,12 @@ namespace TNL {
 namespace Containers {
 namespace Expressions {
 
-enum ExpressionVariableType { ArithmeticVariable, VectorExpressionVariable, OtherVariable };
+enum ExpressionVariableType
+{
+   ArithmeticVariable,
+   VectorExpressionVariable,
+   OtherVariable
+};
 
 template< typename T, typename V = T >
 constexpr ExpressionVariableType
@@ -23,16 +28,14 @@ getExpressionVariableType()
    // vectors must be considered as an arithmetic type when used as RealType in another vector
    if( IsArithmeticSubtype< T, V >::value )
       return ArithmeticVariable;
-   if( HasEnabledExpressionTemplates< T >::value ||
-       HasEnabledStaticExpressionTemplates< T >::value ||
-       HasEnabledDistributedExpressionTemplates< T >::value
-   )
+   if( HasEnabledExpressionTemplates< T >::value || HasEnabledStaticExpressionTemplates< T >::value
+       || HasEnabledDistributedExpressionTemplates< T >::value )
       return VectorExpressionVariable;
    if( IsArrayType< T >::value || IsStaticArrayType< T >::value )
       return VectorExpressionVariable;
    return OtherVariable;
 }
 
-} // namespace Expressions
-} // namespace Containers
-} // namespace TNL
+}  // namespace Expressions
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/Expressions/StaticComparison.h b/src/TNL/Containers/Expressions/StaticComparison.h
index 3c0a4847fc5a4b1b65a489a4760f8976a6a39a12..a4fb04bb2311efa152850d575c53374006ce4b20 100644
--- a/src/TNL/Containers/Expressions/StaticComparison.h
+++ b/src/TNL/Containers/Expressions/StaticComparison.h
@@ -21,63 +21,68 @@ struct StaticComparison;
 
 /////
 // Static comparison of vector expressions
-template< typename T1,
-          typename T2 >
+template< typename T1, typename T2 >
 struct StaticComparison< T1, T2, VectorExpressionVariable, VectorExpressionVariable >
 {
    __cuda_callable__
-   static bool EQ( const T1& a, const T2& b )
+   static bool
+   EQ( const T1& a, const T2& b )
    {
       if( a.getSize() != b.getSize() )
          return false;
       for( int i = 0; i < a.getSize(); i++ )
-         if( ! (a[ i ] == b[ i ]) )
+         if( ! ( a[ i ] == b[ i ] ) )
             return false;
       return true;
    }
 
    __cuda_callable__
-   static bool NE( const T1& a, const T2& b )
+   static bool
+   NE( const T1& a, const T2& b )
    {
       return ! EQ( a, b );
    }
 
    __cuda_callable__
-   static bool GT( const T1& a, const T2& b )
+   static bool
+   GT( 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 ]) )
+         if( ! ( a[ i ] > b[ i ] ) )
             return false;
       return true;
    }
 
    __cuda_callable__
-   static bool GE( const T1& a, const T2& b )
+   static bool
+   GE( 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 ]) )
+         if( ! ( a[ i ] >= b[ i ] ) )
             return false;
       return true;
    }
 
    __cuda_callable__
-   static bool LT( const T1& a, const T2& b )
+   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 ]) )
+         if( ! ( a[ i ] < b[ i ] ) )
             return false;
       return true;
    }
 
    __cuda_callable__
-   static bool LE( const T1& a, const T2& b )
+   static bool
+   LE( 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 ]) )
+         if( ! ( a[ i ] <= b[ i ] ) )
             return false;
       return true;
    }
@@ -85,57 +90,62 @@ struct StaticComparison< T1, T2, VectorExpressionVariable, VectorExpressionVaria
 
 /////
 // Static comparison of number and vector expressions
-template< typename T1,
-          typename T2 >
+template< typename T1, typename T2 >
 struct StaticComparison< T1, T2, ArithmeticVariable, VectorExpressionVariable >
 {
    __cuda_callable__
-   static bool EQ( const T1& a, const T2& b )
+   static bool
+   EQ( const T1& a, const T2& b )
    {
       for( int i = 0; i < b.getSize(); i++ )
-         if( ! (a == b[ i ]) )
+         if( ! ( a == b[ i ] ) )
             return false;
       return true;
    }
 
    __cuda_callable__
-   static bool NE( const T1& a, const T2& b )
+   static bool
+   NE( const T1& a, const T2& b )
    {
       return ! EQ( a, b );
    }
 
    __cuda_callable__
-   static bool GT( const T1& a, const T2& b )
+   static bool
+   GT( const T1& a, const T2& b )
    {
       for( int i = 0; i < b.getSize(); i++ )
-         if( ! (a > b[ i ]) )
+         if( ! ( a > b[ i ] ) )
             return false;
       return true;
    }
 
    __cuda_callable__
-   static bool GE( const T1& a, const T2& b )
+   static bool
+   GE( const T1& a, const T2& b )
    {
       for( int i = 0; i < b.getSize(); i++ )
-         if( ! (a >= b[ i ]) )
+         if( ! ( a >= b[ i ] ) )
             return false;
       return true;
    }
 
    __cuda_callable__
-   static bool LT( const T1& a, const T2& b )
+   static bool
+   LT( const T1& a, const T2& b )
    {
       for( int i = 0; i < b.getSize(); i++ )
-         if( ! (a < b[ i ]) )
+         if( ! ( a < b[ i ] ) )
             return false;
       return true;
    }
 
    __cuda_callable__
-   static bool LE( const T1& a, const T2& b )
+   static bool
+   LE( const T1& a, const T2& b )
    {
       for( int i = 0; i < b.getSize(); i++ )
-         if( ! (a <= b[ i ]) )
+         if( ! ( a <= b[ i ] ) )
             return false;
       return true;
    }
@@ -143,62 +153,67 @@ struct StaticComparison< T1, T2, ArithmeticVariable, VectorExpressionVariable >
 
 /////
 // Static comparison of vector expressions and number
-template< typename T1,
-          typename T2 >
+template< typename T1, typename T2 >
 struct StaticComparison< T1, T2, VectorExpressionVariable, ArithmeticVariable >
 {
    __cuda_callable__
-   static bool EQ( const T1& a, const T2& b )
+   static bool
+   EQ( const T1& a, const T2& b )
    {
       for( int i = 0; i < a.getSize(); i++ )
-         if( ! (a[ i ] == b) )
+         if( ! ( a[ i ] == b ) )
             return false;
       return true;
    }
 
    __cuda_callable__
-   static bool NE( const T1& a, const T2& b )
+   static bool
+   NE( const T1& a, const T2& b )
    {
       return ! EQ( a, b );
    }
 
    __cuda_callable__
-   static bool GT( const T1& a, const T2& b )
+   static bool
+   GT( const T1& a, const T2& b )
    {
       for( int i = 0; i < a.getSize(); i++ )
-         if( ! (a[ i ] > b) )
+         if( ! ( a[ i ] > b ) )
             return false;
       return true;
    }
 
    __cuda_callable__
-   static bool GE( const T1& a, const T2& b )
+   static bool
+   GE( const T1& a, const T2& b )
    {
       for( int i = 0; i < a.getSize(); i++ )
-         if( ! (a[ i ] >= b) )
+         if( ! ( a[ i ] >= b ) )
             return false;
       return true;
    }
 
    __cuda_callable__
-   static bool LT( const T1& a, const T2& b )
+   static bool
+   LT( const T1& a, const T2& b )
    {
       for( int i = 0; i < a.getSize(); i++ )
-         if( ! (a[ i ] < b) )
+         if( ! ( a[ i ] < b ) )
             return false;
       return true;
    }
 
    __cuda_callable__
-   static bool LE( const T1& a, const T2& b )
+   static bool
+   LE( const T1& a, const T2& b )
    {
       for( int i = 0; i < a.getSize(); i++ )
-         if( ! (a[ i ] <= b) )
+         if( ! ( a[ i ] <= b ) )
             return false;
       return true;
    }
 };
 
-} // namespace Expressions
-} // namespace Containers
-} // namespace TNL
+}  // namespace Expressions
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/Expressions/StaticExpressionTemplates.h b/src/TNL/Containers/Expressions/StaticExpressionTemplates.h
index 34b9fa95d18c08c1415978544b4a5af1fe2f0868..e3a2cd50e0d02a7aa3a27500883c4437b1c4b633 100644
--- a/src/TNL/Containers/Expressions/StaticExpressionTemplates.h
+++ b/src/TNL/Containers/Expressions/StaticExpressionTemplates.h
@@ -20,14 +20,11 @@ namespace TNL {
 namespace Containers {
 namespace Expressions {
 
-template< typename T1,
-          typename Operation >
+template< typename T1, typename Operation >
 struct StaticUnaryExpressionTemplate;
 
-template< typename T1,
-          typename Operation >
-struct HasEnabledStaticExpressionTemplates< StaticUnaryExpressionTemplate< T1, Operation > >
-: std::true_type
+template< typename T1, typename Operation >
+struct HasEnabledStaticExpressionTemplates< StaticUnaryExpressionTemplate< T1, Operation > > : std::true_type
 {};
 
 template< typename T1,
@@ -37,25 +34,18 @@ template< typename T1,
           ExpressionVariableType T2Type = getExpressionVariableType< T2, T1 >() >
 struct StaticBinaryExpressionTemplate;
 
-template< typename T1,
-          typename T2,
-          typename Operation,
-          ExpressionVariableType T1Type,
-          ExpressionVariableType T2Type >
+template< typename T1, typename T2, typename Operation, ExpressionVariableType T1Type, ExpressionVariableType T2Type >
 struct HasEnabledStaticExpressionTemplates< StaticBinaryExpressionTemplate< T1, T2, Operation, T1Type, T2Type > >
 : std::true_type
 {};
 
-
 ////
 // Static binary expression template
-template< typename T1,
-          typename T2,
-          typename Operation >
+template< typename T1, typename T2, typename Operation >
 struct StaticBinaryExpressionTemplate< T1, T2, Operation, VectorExpressionVariable, VectorExpressionVariable >
 {
    using VectorOperandType = T1;
-   using RealType = decltype( Operation{}( std::declval<T1>()[0], std::declval<T2>()[0] ) );
+   using RealType = decltype( Operation{}( std::declval< T1 >()[ 0 ], std::declval< T2 >()[ 0 ] ) );
    using ValueType = RealType;
 
    static_assert( IsStaticArrayType< T1 >::value,
@@ -63,40 +53,48 @@ struct StaticBinaryExpressionTemplate< T1, T2, Operation, VectorExpressionVariab
    static_assert( IsStaticArrayType< T2 >::value,
                   "Right-hand side operand of static expression is not static, i.e. based on static vector." );
    static_assert( HasEnabledStaticExpressionTemplates< T1 >::value,
-                  "Invalid operand in static binary expression templates - static expression templates are not enabled for the left operand." );
+                  "Invalid operand in static binary expression templates - static expression templates are not enabled for the "
+                  "left operand." );
    static_assert( HasEnabledStaticExpressionTemplates< T2 >::value,
-                  "Invalid operand in static binary expression templates - static expression templates are not enabled for the right operand." );
-   static_assert( T1::getSize() == T2::getSize(),
-                  "Attempt to mix static operands with different sizes." );
+                  "Invalid operand in static binary expression templates - static expression templates are not enabled for the "
+                  "right operand." );
+   static_assert( T1::getSize() == T2::getSize(), "Attempt to mix static operands with different sizes." );
 
-   static constexpr int getSize() { return T1::getSize(); };
+   static constexpr int
+   getSize()
+   {
+      return T1::getSize();
+   };
 
    __cuda_callable__
-   StaticBinaryExpressionTemplate( const T1& a, const T2& b )
-   : op1( a ), op2( b ) {}
+   StaticBinaryExpressionTemplate( const T1& a, const T2& b ) : op1( a ), op2( b ) {}
 
    __cuda_callable__
-   RealType operator[]( const int i ) const
+   RealType
+   operator[]( const int i ) const
    {
       return Operation{}( op1[ i ], op2[ i ] );
    }
 
    __cuda_callable__
-   RealType x() const
+   RealType
+   x() const
    {
-      return (*this)[ 0 ];
+      return ( *this )[ 0 ];
    }
 
    __cuda_callable__
-   RealType y() const
+   RealType
+   y() const
    {
-      return (*this)[ 1 ];
+      return ( *this )[ 1 ];
    }
 
    __cuda_callable__
-   RealType z() const
+   RealType
+   z() const
    {
-      return (*this)[ 2 ];
+      return ( *this )[ 2 ];
    }
 
 protected:
@@ -104,48 +102,54 @@ protected:
    typename OperandMemberType< T2 >::type op2;
 };
 
-template< typename T1,
-          typename T2,
-          typename Operation >
-struct StaticBinaryExpressionTemplate< T1, T2, Operation, VectorExpressionVariable, ArithmeticVariable  >
+template< typename T1, typename T2, typename Operation >
+struct StaticBinaryExpressionTemplate< T1, T2, Operation, VectorExpressionVariable, ArithmeticVariable >
 {
    using VectorOperandType = T1;
-   using RealType = decltype( Operation{}( std::declval<T1>()[0], std::declval<T2>() ) );
+   using RealType = decltype( Operation{}( std::declval< T1 >()[ 0 ], std::declval< T2 >() ) );
    using ValueType = RealType;
 
    static_assert( IsStaticArrayType< T1 >::value,
                   "Left-hand side operand of static expression is not static, i.e. based on static vector." );
    static_assert( HasEnabledStaticExpressionTemplates< T1 >::value,
-                  "Invalid operand in static binary expression templates - static expression templates are not enabled for the left operand." );
+                  "Invalid operand in static binary expression templates - static expression templates are not enabled for the "
+                  "left operand." );
 
-   static constexpr int getSize() { return T1::getSize(); };
+   static constexpr int
+   getSize()
+   {
+      return T1::getSize();
+   };
 
    __cuda_callable__
-   StaticBinaryExpressionTemplate( const T1& a, const T2& b )
-   : op1( a ), op2( b ) {}
+   StaticBinaryExpressionTemplate( const T1& a, const T2& b ) : op1( a ), op2( b ) {}
 
    __cuda_callable__
-   RealType operator[]( const int i ) const
+   RealType
+   operator[]( const int i ) const
    {
       return Operation{}( op1[ i ], op2 );
    }
 
    __cuda_callable__
-   RealType x() const
+   RealType
+   x() const
    {
-      return (*this)[ 0 ];
+      return ( *this )[ 0 ];
    }
 
    __cuda_callable__
-   RealType y() const
+   RealType
+   y() const
    {
-      return (*this)[ 1 ];
+      return ( *this )[ 1 ];
    }
 
    __cuda_callable__
-   RealType z() const
+   RealType
+   z() const
    {
-      return (*this)[ 2 ];
+      return ( *this )[ 2 ];
    }
 
 protected:
@@ -153,48 +157,54 @@ protected:
    typename OperandMemberType< T2 >::type op2;
 };
 
-template< typename T1,
-          typename T2,
-          typename Operation >
-struct StaticBinaryExpressionTemplate< T1, T2, Operation, ArithmeticVariable, VectorExpressionVariable  >
+template< typename T1, typename T2, typename Operation >
+struct StaticBinaryExpressionTemplate< T1, T2, Operation, ArithmeticVariable, VectorExpressionVariable >
 {
    using VectorOperandType = T2;
-   using RealType = decltype( Operation{}( std::declval<T1>(), std::declval<T2>()[0] ) );
+   using RealType = decltype( Operation{}( std::declval< T1 >(), std::declval< T2 >()[ 0 ] ) );
    using ValueType = RealType;
 
    static_assert( IsStaticArrayType< T2 >::value,
                   "Right-hand side operand of static expression is not static, i.e. based on static vector." );
    static_assert( HasEnabledStaticExpressionTemplates< T2 >::value,
-                  "Invalid operand in static binary expression templates - static expression templates are not enabled for the right operand." );
+                  "Invalid operand in static binary expression templates - static expression templates are not enabled for the "
+                  "right operand." );
 
-   static constexpr int getSize() { return T2::getSize(); };
+   static constexpr int
+   getSize()
+   {
+      return T2::getSize();
+   };
 
    __cuda_callable__
-   StaticBinaryExpressionTemplate( const T1& a, const T2& b )
-   : op1( a ), op2( b ) {}
+   StaticBinaryExpressionTemplate( const T1& a, const T2& b ) : op1( a ), op2( b ) {}
 
    __cuda_callable__
-   RealType operator[]( const int i ) const
+   RealType
+   operator[]( const int i ) const
    {
       return Operation{}( op1, op2[ i ] );
    }
 
    __cuda_callable__
-   RealType x() const
+   RealType
+   x() const
    {
-      return (*this)[ 0 ];
+      return ( *this )[ 0 ];
    }
 
    __cuda_callable__
-   RealType y() const
+   RealType
+   y() const
    {
-      return (*this)[ 1 ];
+      return ( *this )[ 1 ];
    }
 
    __cuda_callable__
-   RealType z() const
+   RealType
+   z() const
    {
-      return (*this)[ 2 ];
+      return ( *this )[ 2 ];
    }
 
 protected:
@@ -204,47 +214,54 @@ protected:
 
 ////
 // Static unary expression template
-template< typename T1,
-          typename Operation >
+template< typename T1, typename Operation >
 struct StaticUnaryExpressionTemplate
 {
    using VectorOperandType = T1;
-   using RealType = decltype( Operation{}( std::declval<T1>()[0] ) );
+   using RealType = decltype( Operation{}( std::declval< T1 >()[ 0 ] ) );
    using ValueType = RealType;
 
    static_assert( IsStaticArrayType< T1 >::value,
                   "The operand of static expression is not static, i.e. based on static vector." );
-   static_assert( HasEnabledStaticExpressionTemplates< T1 >::value,
-                  "Invalid operand in static unary expression templates - static expression templates are not enabled for the operand." );
+   static_assert(
+      HasEnabledStaticExpressionTemplates< T1 >::value,
+      "Invalid operand in static unary expression templates - static expression templates are not enabled for the operand." );
 
-   static constexpr int getSize() { return T1::getSize(); };
+   static constexpr int
+   getSize()
+   {
+      return T1::getSize();
+   };
 
    __cuda_callable__
-   StaticUnaryExpressionTemplate( const T1& a )
-   : operand( a ) {}
+   StaticUnaryExpressionTemplate( const T1& a ) : operand( a ) {}
 
    __cuda_callable__
-   RealType operator[]( const int i ) const
+   RealType
+   operator[]( const int i ) const
    {
       return Operation{}( operand[ i ] );
    }
 
    __cuda_callable__
-   RealType x() const
+   RealType
+   x() const
    {
-      return (*this)[ 0 ];
+      return ( *this )[ 0 ];
    }
 
    __cuda_callable__
-   RealType y() const
+   RealType
+   y() const
    {
-      return (*this)[ 1 ];
+      return ( *this )[ 1 ];
    }
 
    __cuda_callable__
-   RealType z() const
+   RealType
+   z() const
    {
-      return (*this)[ 2 ];
+      return ( *this )[ 2 ];
    }
 
 protected:
@@ -253,25 +270,21 @@ protected:
 
 #ifndef DOXYGEN_ONLY
 
-#define TNL_MAKE_STATIC_UNARY_EXPRESSION(fname, functor)                               \
-   template< typename ET1,                                                             \
-             typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >        \
-   __cuda_callable__                                                                   \
-   auto                                                                                \
-   fname( const ET1& a )                                                               \
-   {                                                                                   \
-      return StaticUnaryExpressionTemplate< ET1, functor >( a );                       \
-   }                                                                                   \
-
-#define TNL_MAKE_STATIC_BINARY_EXPRESSION(fname, functor)                              \
-   template< typename ET1, typename ET2,                                               \
-             typename..., EnableIfStaticBinaryExpression_t< ET1, ET2, bool > = true >  \
-   __cuda_callable__                                                                   \
-   auto                                                                                \
-   fname( const ET1& a, const ET2& b )                                                 \
-   {                                                                                   \
-      return StaticBinaryExpressionTemplate< ET1, ET2, functor >( a, b );              \
-   }                                                                                   \
+   #define TNL_MAKE_STATIC_UNARY_EXPRESSION( fname, functor )                                    \
+      template< typename ET1, typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true > \
+      __cuda_callable__                                                                          \
+      auto fname( const ET1& a )                                                                 \
+      {                                                                                          \
+         return StaticUnaryExpressionTemplate< ET1, functor >( a );                              \
+      }
+
+   #define TNL_MAKE_STATIC_BINARY_EXPRESSION( fname, functor )                                                       \
+      template< typename ET1, typename ET2, typename..., EnableIfStaticBinaryExpression_t< ET1, ET2, bool > = true > \
+      __cuda_callable__                                                                                              \
+      auto fname( const ET1& a, const ET2& b )                                                                       \
+      {                                                                                                              \
+         return StaticBinaryExpressionTemplate< ET1, ET2, functor >( a, b );                                         \
+      }
 
 TNL_MAKE_STATIC_BINARY_EXPRESSION( operator+, TNL::Plus )
 TNL_MAKE_STATIC_BINARY_EXPRESSION( operator-, TNL::Minus )
@@ -306,13 +319,12 @@ TNL_MAKE_STATIC_UNARY_EXPRESSION( floor, TNL::Floor )
 TNL_MAKE_STATIC_UNARY_EXPRESSION( ceil, TNL::Ceil )
 TNL_MAKE_STATIC_UNARY_EXPRESSION( sign, TNL::Sign )
 
-#undef TNL_MAKE_STATIC_UNARY_EXPRESSION
-#undef TNL_MAKE_STATIC_BINARY_EXPRESSION
+   #undef TNL_MAKE_STATIC_UNARY_EXPRESSION
+   #undef TNL_MAKE_STATIC_BINARY_EXPRESSION
 
 ////
 // Pow
-template< typename ET1, typename Real,
-          typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename Real, typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
 __cuda_callable__
 auto
 pow( const ET1& a, const Real& exp )
@@ -322,9 +334,7 @@ pow( const ET1& a, const Real& exp )
 
 ////
 // Cast
-template< typename ResultType,
-          typename ET1,
-          typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
+template< typename ResultType, typename ET1, typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
 __cuda_callable__
 auto
 cast( const ET1& a )
@@ -335,8 +345,7 @@ cast( const ET1& a )
 
 ////
 // Comparison operator ==
-template< typename ET1, typename ET2,
-          typename..., EnableIfStaticBinaryExpression_t< ET1, ET2, bool > = true >
+template< typename ET1, typename ET2, typename..., EnableIfStaticBinaryExpression_t< ET1, ET2, bool > = true >
 __cuda_callable__
 bool
 operator==( const ET1& a, const ET2& b )
@@ -346,8 +355,7 @@ operator==( const ET1& a, const ET2& b )
 
 ////
 // Comparison operator !=
-template< typename ET1, typename ET2,
-          typename..., EnableIfStaticBinaryExpression_t< ET1, ET2, bool > = true >
+template< typename ET1, typename ET2, typename..., EnableIfStaticBinaryExpression_t< ET1, ET2, bool > = true >
 __cuda_callable__
 bool
 operator!=( const ET1& a, const ET2& b )
@@ -357,8 +365,7 @@ operator!=( const ET1& a, const ET2& b )
 
 ////
 // Comparison operator <
-template< typename ET1, typename ET2,
-          typename..., EnableIfStaticBinaryExpression_t< ET1, ET2, bool > = true >
+template< typename ET1, typename ET2, typename..., EnableIfStaticBinaryExpression_t< ET1, ET2, bool > = true >
 __cuda_callable__
 bool
 operator<( const ET1& a, const ET2& b )
@@ -368,8 +375,7 @@ operator<( const ET1& a, const ET2& b )
 
 ////
 // Comparison operator <=
-template< typename ET1, typename ET2,
-          typename..., EnableIfStaticBinaryExpression_t< ET1, ET2, bool > = true >
+template< typename ET1, typename ET2, typename..., EnableIfStaticBinaryExpression_t< ET1, ET2, bool > = true >
 __cuda_callable__
 bool
 operator<=( const ET1& a, const ET2& b )
@@ -379,8 +385,7 @@ operator<=( const ET1& a, const ET2& b )
 
 ////
 // Comparison operator >
-template< typename ET1, typename ET2,
-          typename..., EnableIfStaticBinaryExpression_t< ET1, ET2, bool > = true >
+template< typename ET1, typename ET2, typename..., EnableIfStaticBinaryExpression_t< ET1, ET2, bool > = true >
 __cuda_callable__
 bool
 operator>( const ET1& a, const ET2& b )
@@ -390,8 +395,7 @@ operator>( const ET1& a, const ET2& b )
 
 ////
 // Comparison operator >=
-template< typename ET1, typename ET2,
-          typename..., EnableIfStaticBinaryExpression_t< ET1, ET2, bool > = true >
+template< typename ET1, typename ET2, typename..., EnableIfStaticBinaryExpression_t< ET1, ET2, bool > = true >
 __cuda_callable__
 bool
 operator>=( const ET1& a, const ET2& b )
@@ -401,8 +405,7 @@ operator>=( const ET1& a, const ET2& b )
 
 ////
 // Scalar product
-template< typename ET1, typename ET2,
-          typename..., EnableIfStaticBinaryExpression_t< ET1, ET2, bool > = true >
+template< typename ET1, typename ET2, typename..., EnableIfStaticBinaryExpression_t< ET1, ET2, bool > = true >
 __cuda_callable__
 auto
 operator,( const ET1& a, const ET2& b )
@@ -410,19 +413,17 @@ operator,( const ET1& a, const ET2& b )
    return StaticExpressionSum( a * b );
 }
 
-template< typename ET1, typename ET2,
-          typename..., EnableIfStaticBinaryExpression_t< ET1, ET2, bool > = true >
+template< typename ET1, typename ET2, typename..., EnableIfStaticBinaryExpression_t< ET1, ET2, bool > = true >
 __cuda_callable__
 auto
 dot( const ET1& a, const ET2& b )
 {
-   return (a, b);
+   return ( a, b );
 }
 
 ////
 // Vertical operations
-template< typename ET1,
-          typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
 __cuda_callable__
 auto
 min( const ET1& a )
@@ -430,8 +431,7 @@ min( const ET1& a )
    return StaticExpressionMin( a );
 }
 
-template< typename ET1,
-          typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
 __cuda_callable__
 auto
 argMin( const ET1& a )
@@ -439,8 +439,7 @@ argMin( const ET1& a )
    return StaticExpressionArgMin( a );
 }
 
-template< typename ET1,
-          typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
 __cuda_callable__
 auto
 max( const ET1& a )
@@ -448,8 +447,7 @@ max( const ET1& a )
    return StaticExpressionMax( a );
 }
 
-template< typename ET1,
-          typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
 __cuda_callable__
 auto
 argMax( const ET1& a )
@@ -457,8 +455,7 @@ argMax( const ET1& a )
    return StaticExpressionArgMax( a );
 }
 
-template< typename ET1,
-          typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
 __cuda_callable__
 auto
 sum( const ET1& a )
@@ -466,8 +463,7 @@ sum( const ET1& a )
    return StaticExpressionSum( a );
 }
 
-template< typename ET1,
-          typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
 __cuda_callable__
 auto
 maxNorm( const ET1& a )
@@ -475,8 +471,7 @@ maxNorm( const ET1& a )
    return max( abs( a ) );
 }
 
-template< typename ET1,
-          typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
 __cuda_callable__
 auto
 l1Norm( const ET1& a )
@@ -485,8 +480,9 @@ l1Norm( const ET1& a )
 }
 
 template< typename ET1,
-          typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true,
-          std::enable_if_t< (ET1::getSize() > 1), bool > = true >
+          typename...,
+          EnableIfStaticUnaryExpression_t< ET1, bool > = true,
+          std::enable_if_t< ( ET1::getSize() > 1 ), bool > = true >
 __cuda_callable__
 auto
 l2Norm( const ET1& a )
@@ -496,7 +492,8 @@ l2Norm( const ET1& a )
 }
 
 template< typename ET1,
-          typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true,
+          typename...,
+          EnableIfStaticUnaryExpression_t< ET1, bool > = true,
           std::enable_if_t< ET1::getSize() == 1, bool > = true >
 __cuda_callable__
 auto
@@ -508,13 +505,14 @@ l2Norm( const ET1& a )
 
 template< typename ET1,
           typename Real,
-          typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true,
-          std::enable_if_t< (ET1::getSize() > 1), bool > = true >
+          typename...,
+          EnableIfStaticUnaryExpression_t< ET1, bool > = true,
+          std::enable_if_t< ( ET1::getSize() > 1 ), bool > = true >
 __cuda_callable__
 auto
 lpNorm( const ET1& a, const Real& p )
-// since (1.0 / p) has type double, TNL::pow returns double
--> double
+   // since (1.0 / p) has type double, TNL::pow returns double
+   -> double
 //-> RemoveET< decltype(pow( StaticExpressionLpNorm( a, p ), 1.0 / p )) >
 {
    if( p == 1.0 )
@@ -527,7 +525,8 @@ lpNorm( const ET1& a, const Real& p )
 
 template< typename ET1,
           typename Real,
-          typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true,
+          typename...,
+          EnableIfStaticUnaryExpression_t< ET1, bool > = true,
           std::enable_if_t< ET1::getSize() == 1, bool > = true >
 __cuda_callable__
 auto
@@ -537,8 +536,7 @@ lpNorm( const ET1& a, const Real& p )
    return l1Norm( a );
 }
 
-template< typename ET1,
-          typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
 __cuda_callable__
 auto
 product( const ET1& a )
@@ -546,8 +544,7 @@ product( const ET1& a )
    return StaticExpressionProduct( a );
 }
 
-template< typename ET1,
-          typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
 __cuda_callable__
 auto
 logicalAnd( const ET1& a )
@@ -555,8 +552,7 @@ logicalAnd( const ET1& a )
    return StaticExpressionLogicalAnd( a );
 }
 
-template< typename ET1,
-          typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
 __cuda_callable__
 auto
 logicalOr( const ET1& a )
@@ -564,8 +560,7 @@ logicalOr( const ET1& a )
    return StaticExpressionLogicalOr( a );
 }
 
-template< typename ET1,
-          typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
 __cuda_callable__
 auto
 binaryAnd( const ET1& a )
@@ -573,8 +568,7 @@ binaryAnd( const ET1& a )
    return StaticExpressionBinaryAnd( a );
 }
 
-template< typename ET1,
-          typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
 __cuda_callable__
 auto
 binaryOr( const ET1& a )
@@ -582,8 +576,7 @@ binaryOr( const ET1& a )
    return StaticExpressionBinaryOr( a );
 }
 
-template< typename ET1,
-          typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
+template< typename ET1, typename..., EnableIfStaticUnaryExpression_t< ET1, bool > = true >
 __cuda_callable__
 auto
 binaryXor( const ET1& a )
@@ -591,14 +584,13 @@ binaryXor( const ET1& a )
    return StaticExpressionBinaryXor( a );
 }
 
-#endif // DOXYGEN_ONLY
+#endif  // DOXYGEN_ONLY
 
 ////
 // Output stream
-template< typename T1,
-          typename T2,
-          typename Operation >
-std::ostream& operator<<( std::ostream& str, const StaticBinaryExpressionTemplate< T1, T2, Operation >& expression )
+template< typename T1, typename T2, typename Operation >
+std::ostream&
+operator<<( std::ostream& str, const StaticBinaryExpressionTemplate< T1, T2, Operation >& expression )
 {
    str << "[ ";
    for( int i = 0; i < expression.getSize() - 1; i++ )
@@ -607,9 +599,9 @@ std::ostream& operator<<( std::ostream& str, const StaticBinaryExpressionTemplat
    return str;
 }
 
-template< typename T,
-          typename Operation >
-std::ostream& operator<<( std::ostream& str, const StaticUnaryExpressionTemplate< T, Operation >& expression )
+template< typename T, typename Operation >
+std::ostream&
+operator<<( std::ostream& str, const StaticUnaryExpressionTemplate< T, Operation >& expression )
 {
    str << "[ ";
    for( int i = 0; i < expression.getSize() - 1; i++ )
@@ -618,7 +610,7 @@ std::ostream& operator<<( std::ostream& str, const StaticUnaryExpressionTemplate
    return str;
 }
 
-} // namespace Expressions
+}  // namespace Expressions
 
 // Make all operators visible in the TNL::Containers namespace to be considered
 // even for StaticVector
@@ -627,7 +619,7 @@ using Expressions::operator-;
 using Expressions::operator*;
 using Expressions::operator/;
 using Expressions::operator%;
-using Expressions::operator,;
+using Expressions::operator, ;
 using Expressions::operator==;
 using Expressions::operator!=;
 using Expressions::operator<;
@@ -636,102 +628,98 @@ using Expressions::operator>;
 using Expressions::operator>=;
 
 // Make all functions visible in the TNL::Containers namespace
-using Expressions::dot;
-using Expressions::min;
-using Expressions::max;
 using Expressions::abs;
-using Expressions::pow;
-using Expressions::exp;
-using Expressions::sqrt;
-using Expressions::cbrt;
-using Expressions::log;
-using Expressions::log10;
-using Expressions::log2;
-using Expressions::sin;
-using Expressions::cos;
-using Expressions::tan;
-using Expressions::asin;
 using Expressions::acos;
-using Expressions::atan;
-using Expressions::sinh;
-using Expressions::cosh;
-using Expressions::tanh;
-using Expressions::asinh;
 using Expressions::acosh;
+using Expressions::argMax;
+using Expressions::argMin;
+using Expressions::asin;
+using Expressions::asinh;
+using Expressions::atan;
 using Expressions::atanh;
-using Expressions::floor;
-using Expressions::ceil;
-using Expressions::sign;
+using Expressions::binaryAnd;
+using Expressions::binaryOr;
 using Expressions::cast;
-using Expressions::argMin;
-using Expressions::argMax;
-using Expressions::sum;
-using Expressions::maxNorm;
+using Expressions::cbrt;
+using Expressions::ceil;
+using Expressions::cos;
+using Expressions::cosh;
+using Expressions::dot;
+using Expressions::exp;
+using Expressions::floor;
 using Expressions::l1Norm;
 using Expressions::l2Norm;
-using Expressions::lpNorm;
-using Expressions::product;
+using Expressions::log;
+using Expressions::log10;
+using Expressions::log2;
 using Expressions::logicalAnd;
 using Expressions::logicalOr;
-using Expressions::binaryAnd;
-using Expressions::binaryOr;
+using Expressions::lpNorm;
+using Expressions::max;
+using Expressions::maxNorm;
+using Expressions::min;
+using Expressions::pow;
+using Expressions::product;
+using Expressions::sign;
+using Expressions::sin;
+using Expressions::sinh;
+using Expressions::sqrt;
+using Expressions::sum;
+using Expressions::tan;
+using Expressions::tanh;
 
-} // namespace Containers
+}  // namespace Containers
 
 // Make all functions visible in the main TNL namespace
-using Containers::dot;
-using Containers::min;
-using Containers::max;
 using Containers::abs;
-using Containers::pow;
-using Containers::exp;
-using Containers::sqrt;
-using Containers::cbrt;
-using Containers::log;
-using Containers::log10;
-using Containers::log2;
-using Containers::sin;
-using Containers::cos;
-using Containers::tan;
-using Containers::asin;
 using Containers::acos;
-using Containers::atan;
-using Containers::sinh;
-using Containers::cosh;
-using Containers::tanh;
-using Containers::asinh;
 using Containers::acosh;
+using Containers::argMax;
+using Containers::argMin;
+using Containers::asin;
+using Containers::asinh;
+using Containers::atan;
 using Containers::atanh;
-using Containers::floor;
-using Containers::ceil;
-using Containers::sign;
+using Containers::binaryAnd;
+using Containers::binaryOr;
 using Containers::cast;
-using Containers::argMin;
-using Containers::argMax;
-using Containers::sum;
-using Containers::maxNorm;
+using Containers::cbrt;
+using Containers::ceil;
+using Containers::cos;
+using Containers::cosh;
+using Containers::dot;
+using Containers::exp;
+using Containers::floor;
 using Containers::l1Norm;
 using Containers::l2Norm;
-using Containers::lpNorm;
-using Containers::product;
+using Containers::log;
+using Containers::log10;
+using Containers::log2;
 using Containers::logicalAnd;
 using Containers::logicalOr;
-using Containers::binaryAnd;
-using Containers::binaryOr;
+using Containers::lpNorm;
+using Containers::max;
+using Containers::maxNorm;
+using Containers::min;
+using Containers::pow;
+using Containers::product;
+using Containers::sign;
+using Containers::sin;
+using Containers::sinh;
+using Containers::sqrt;
+using Containers::sum;
+using Containers::tan;
+using Containers::tanh;
 
 ////
 // Evaluation with reduction
-template< typename Vector,
-   typename T1,
-   typename T2,
-   typename Operation,
-   typename Reduction,
-   typename Result >
-__cuda_callable__
-Result evaluateAndReduce( Vector& lhs,
-   const Containers::Expressions::StaticBinaryExpressionTemplate< T1, T2, Operation >& expression,
-   const Reduction& reduction,
-   const Result& zero )
+template< typename Vector, typename T1, typename T2, typename Operation, typename Reduction, typename Result >
+__cuda_callable__
+Result
+evaluateAndReduce( Vector& lhs,
+                   const Containers::Expressions::StaticBinaryExpressionTemplate< T1, T2, Operation >& expression,
+                   const Reduction& reduction,
+                   const Result& zero )
 {
    Result result( zero );
    for( int i = 0; i < Vector::getSize(); i++ )
@@ -739,16 +727,13 @@ Result evaluateAndReduce( Vector& lhs,
    return result;
 }
 
-template< typename Vector,
-   typename T1,
-   typename Operation,
-   typename Reduction,
-   typename Result >
+template< typename Vector, typename T1, typename Operation, typename Reduction, typename Result >
 __cuda_callable__
-Result evaluateAndReduce( Vector& lhs,
-   const Containers::Expressions::StaticUnaryExpressionTemplate< T1, Operation >& expression,
-   const Reduction& reduction,
-   const Result& zero )
+Result
+evaluateAndReduce( Vector& lhs,
+                   const Containers::Expressions::StaticUnaryExpressionTemplate< T1, Operation >& expression,
+                   const Reduction& reduction,
+                   const Result& zero )
 {
    Result result( zero );
    for( int i = 0; i < Vector::getSize(); i++ )
@@ -758,17 +743,13 @@ Result evaluateAndReduce( Vector& lhs,
 
 ////
 // Addition with reduction
-template< typename Vector,
-   typename T1,
-   typename T2,
-   typename Operation,
-   typename Reduction,
-   typename Result >
-__cuda_callable__
-Result addAndReduce( Vector& lhs,
-   const Containers::Expressions::StaticBinaryExpressionTemplate< T1, T2, Operation >& expression,
-   const Reduction& reduction,
-   const Result& zero )
+template< typename Vector, typename T1, typename T2, typename Operation, typename Reduction, typename Result >
+__cuda_callable__
+Result
+addAndReduce( Vector& lhs,
+              const Containers::Expressions::StaticBinaryExpressionTemplate< T1, T2, Operation >& expression,
+              const Reduction& reduction,
+              const Result& zero )
 {
    Result result( zero );
    for( int i = 0; i < Vector::getSize(); i++ ) {
@@ -779,16 +760,13 @@ Result addAndReduce( Vector& lhs,
    return result;
 }
 
-template< typename Vector,
-   typename T1,
-   typename Operation,
-   typename Reduction,
-   typename Result >
+template< typename Vector, typename T1, typename Operation, typename Reduction, typename Result >
 __cuda_callable__
-Result addAndReduce( Vector& lhs,
-   const Containers::Expressions::StaticUnaryExpressionTemplate< T1, Operation >& expression,
-   const Reduction& reduction,
-   const Result& zero )
+Result
+addAndReduce( Vector& lhs,
+              const Containers::Expressions::StaticUnaryExpressionTemplate< T1, Operation >& expression,
+              const Reduction& reduction,
+              const Result& zero )
 {
    Result result( zero );
    for( int i = 0; i < Vector::getSize(); i++ ) {
@@ -801,17 +779,13 @@ Result addAndReduce( Vector& lhs,
 
 ////
 // Addition with reduction of abs
-template< typename Vector,
-   typename T1,
-   typename T2,
-   typename Operation,
-   typename Reduction,
-   typename Result >
-__cuda_callable__
-Result addAndReduceAbs( Vector& lhs,
-   const Containers::Expressions::StaticBinaryExpressionTemplate< T1, T2, Operation >& expression,
-   const Reduction& reduction,
-   const Result& zero )
+template< typename Vector, typename T1, typename T2, typename Operation, typename Reduction, typename Result >
+__cuda_callable__
+Result
+addAndReduceAbs( Vector& lhs,
+                 const Containers::Expressions::StaticBinaryExpressionTemplate< T1, T2, Operation >& expression,
+                 const Reduction& reduction,
+                 const Result& zero )
 {
    Result result( zero );
    for( int i = 0; i < Vector::getSize(); i++ ) {
@@ -822,16 +796,13 @@ Result addAndReduceAbs( Vector& lhs,
    return result;
 }
 
-template< typename Vector,
-   typename T1,
-   typename Operation,
-   typename Reduction,
-   typename Result >
+template< typename Vector, typename T1, typename Operation, typename Reduction, typename Result >
 __cuda_callable__
-Result addAndReduceAbs( Vector& lhs,
-   const Containers::Expressions::StaticUnaryExpressionTemplate< T1, Operation >& expression,
-   const Reduction& reduction,
-   const Result& zero )
+Result
+addAndReduceAbs( Vector& lhs,
+                 const Containers::Expressions::StaticUnaryExpressionTemplate< T1, Operation >& expression,
+                 const Reduction& reduction,
+                 const Result& zero )
 {
    Result result( zero );
    for( int i = 0; i < Vector::getSize(); i++ ) {
@@ -842,4 +813,4 @@ Result addAndReduceAbs( Vector& lhs,
    return result;
 }
 
-} // namespace TNL
+}  // namespace TNL
diff --git a/src/TNL/Containers/Expressions/StaticVerticalOperations.h b/src/TNL/Containers/Expressions/StaticVerticalOperations.h
index 8c119d12c76edc60c76efe6c465791c4a4273d61..84e96cf3c90132eff8d7f202b8b4cf81e53acef3 100644
--- a/src/TNL/Containers/Expressions/StaticVerticalOperations.h
+++ b/src/TNL/Containers/Expressions/StaticVerticalOperations.h
@@ -19,7 +19,8 @@ namespace Expressions {
 
 template< typename Expression >
 __cuda_callable__
-auto StaticExpressionMin( const Expression& expression )
+auto
+StaticExpressionMin( const Expression& expression )
 {
    // use argument-dependent lookup and make TNL::min available for unqualified calls
    using TNL::min;
@@ -32,15 +33,14 @@ auto StaticExpressionMin( const Expression& expression )
 
 template< typename Expression >
 __cuda_callable__
-auto StaticExpressionArgMin( const Expression& expression )
+auto
+StaticExpressionArgMin( const Expression& expression )
 {
    using ResultType = RemoveET< typename Expression::RealType >;
    int arg = 0;
    ResultType value = expression[ 0 ];
-   for( int i = 1; i < expression.getSize(); i++ )
-   {
-      if( expression[ i ] < value )
-      {
+   for( int i = 1; i < expression.getSize(); i++ ) {
+      if( expression[ i ] < value ) {
          value = expression[ i ];
          arg = i;
       }
@@ -50,7 +50,8 @@ auto StaticExpressionArgMin( const Expression& expression )
 
 template< typename Expression >
 __cuda_callable__
-auto StaticExpressionMax( const Expression& expression )
+auto
+StaticExpressionMax( const Expression& expression )
 {
    // use argument-dependent lookup and make TNL::max available for unqualified calls
    using TNL::max;
@@ -63,15 +64,14 @@ auto StaticExpressionMax( const Expression& expression )
 
 template< typename Expression >
 __cuda_callable__
-auto StaticExpressionArgMax( const Expression& expression )
+auto
+StaticExpressionArgMax( const Expression& expression )
 {
    using ResultType = RemoveET< typename Expression::RealType >;
    int arg = 0;
    ResultType value = expression[ 0 ];
-   for( int i = 1; i < expression.getSize(); i++ )
-   {
-      if( expression[ i ] > value )
-      {
+   for( int i = 1; i < expression.getSize(); i++ ) {
+      if( expression[ i ] > value ) {
          value = expression[ i ];
          arg = i;
       }
@@ -81,7 +81,8 @@ auto StaticExpressionArgMax( const Expression& expression )
 
 template< typename Expression >
 __cuda_callable__
-auto StaticExpressionSum( const Expression& expression )
+auto
+StaticExpressionSum( const Expression& expression )
 {
    using ResultType = RemoveET< typename Expression::RealType >;
    ResultType aux = expression[ 0 ];
@@ -92,7 +93,8 @@ auto StaticExpressionSum( const Expression& expression )
 
 template< typename Expression >
 __cuda_callable__
-auto StaticExpressionProduct( const Expression& expression )
+auto
+StaticExpressionProduct( const Expression& expression )
 {
    using ResultType = RemoveET< typename Expression::RealType >;
    ResultType aux = expression[ 0 ];
@@ -103,7 +105,8 @@ auto StaticExpressionProduct( const Expression& expression )
 
 template< typename Expression >
 __cuda_callable__
-bool StaticExpressionLogicalAnd( const Expression& expression )
+bool
+StaticExpressionLogicalAnd( const Expression& expression )
 {
    auto aux = expression[ 0 ];
    for( int i = 1; i < expression.getSize(); i++ )
@@ -113,7 +116,8 @@ bool StaticExpressionLogicalAnd( const Expression& expression )
 
 template< typename Expression >
 __cuda_callable__
-bool StaticExpressionLogicalOr( const Expression& expression )
+bool
+StaticExpressionLogicalOr( const Expression& expression )
 {
    auto aux = expression[ 0 ];
    for( int i = 1; i < expression.getSize(); i++ )
@@ -123,7 +127,8 @@ bool StaticExpressionLogicalOr( const Expression& expression )
 
 template< typename Expression >
 __cuda_callable__
-auto StaticExpressionBinaryAnd( const Expression& expression )
+auto
+StaticExpressionBinaryAnd( const Expression& expression )
 {
    auto aux = expression[ 0 ];
    for( int i = 1; i < expression.getSize(); i++ )
@@ -133,7 +138,8 @@ auto StaticExpressionBinaryAnd( const Expression& expression )
 
 template< typename Expression >
 __cuda_callable__
-auto StaticExpressionBinaryOr( const Expression& expression )
+auto
+StaticExpressionBinaryOr( const Expression& expression )
 {
    auto aux = expression[ 0 ];
    for( int i = 1; i < expression.getSize(); i++ )
@@ -143,7 +149,8 @@ auto StaticExpressionBinaryOr( const Expression& expression )
 
 template< typename Expression >
 __cuda_callable__
-auto StaticExpressionBinaryXor( const Expression& expression )
+auto
+StaticExpressionBinaryXor( const Expression& expression )
 {
    auto aux = expression[ 0 ];
    for( int i = 1; i < expression.getSize(); i++ )
@@ -151,6 +158,6 @@ auto StaticExpressionBinaryXor( const Expression& expression )
    return aux;
 }
 
-} // namespace Expressions
-} // namespace Containers
-} // namespace TNL
+}  // namespace Expressions
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/Expressions/TypeTraits.h b/src/TNL/Containers/Expressions/TypeTraits.h
index 50e6df192bcd44a1276d7cf3dcd540bd0e7b15f5..464500b572cd80f82381cd9576a49cdb7dd70b55 100644
--- a/src/TNL/Containers/Expressions/TypeTraits.h
+++ b/src/TNL/Containers/Expressions/TypeTraits.h
@@ -25,67 +25,48 @@ template< typename T >
 struct HasEnabledDistributedExpressionTemplates : std::false_type
 {};
 
-
 // type aliases for enabling specific operators and functions using SFINAE
 template< typename ET1, typename T = void >
-using EnableIfStaticUnaryExpression_t = std::enable_if_t<
-         HasEnabledStaticExpressionTemplates< std::decay_t< ET1 > >::value,
-      T >;
+using EnableIfStaticUnaryExpression_t =
+   std::enable_if_t< HasEnabledStaticExpressionTemplates< std::decay_t< ET1 > >::value, T >;
 
 template< typename ET1, typename ET2, typename T = void >
-using EnableIfStaticBinaryExpression_t = std::enable_if_t<
-      (
-         HasEnabledStaticExpressionTemplates< std::decay_t< ET1 > >::value ||
-         HasEnabledStaticExpressionTemplates< std::decay_t< ET2 > >::value
-      ) && !
-      (
-         HasEnabledExpressionTemplates< std::decay_t< ET2 > >::value ||
-         HasEnabledExpressionTemplates< std::decay_t< ET1 > >::value ||
-         HasEnabledDistributedExpressionTemplates< std::decay_t< ET2 > >::value ||
-         HasEnabledDistributedExpressionTemplates< std::decay_t< ET1 > >::value
-      ),
-      T >;
+using EnableIfStaticBinaryExpression_t =
+   std::enable_if_t< ( HasEnabledStaticExpressionTemplates< std::decay_t< ET1 > >::value
+                       || HasEnabledStaticExpressionTemplates< std::decay_t< ET2 > >::value )
+                        && ! ( HasEnabledExpressionTemplates< std::decay_t< ET2 > >::value
+                               || HasEnabledExpressionTemplates< std::decay_t< ET1 > >::value
+                               || HasEnabledDistributedExpressionTemplates< std::decay_t< ET2 > >::value
+                               || HasEnabledDistributedExpressionTemplates< std::decay_t< ET1 > >::value ),
+                     T >;
 
 template< typename ET1, typename T = void >
-using EnableIfUnaryExpression_t = std::enable_if_t<
-         HasEnabledExpressionTemplates< std::decay_t< ET1 > >::value,
-      T >;
+using EnableIfUnaryExpression_t = std::enable_if_t< HasEnabledExpressionTemplates< std::decay_t< ET1 > >::value, T >;
 
 template< typename ET1, typename ET2, typename T = void >
 using EnableIfBinaryExpression_t = std::enable_if_t<
-      // we need to avoid ambiguity with operators defined in Array (e.g. Array::operator==)
-      // so the first operand must not be Array
-      (
-         HasAddAssignmentOperator< std::decay_t< ET1 > >::value ||
-         HasEnabledExpressionTemplates< std::decay_t< ET1 > >::value ||
-         std::is_arithmetic< std::decay_t< ET1 > >::value
-      ) &&
-      (
-         HasEnabledExpressionTemplates< std::decay_t< ET2 > >::value ||
-         HasEnabledExpressionTemplates< std::decay_t< ET1 > >::value
-      ),
-      T >;
+   // we need to avoid ambiguity with operators defined in Array (e.g. Array::operator==)
+   // so the first operand must not be Array
+   ( HasAddAssignmentOperator< std::decay_t< ET1 > >::value || HasEnabledExpressionTemplates< std::decay_t< ET1 > >::value
+     || std::is_arithmetic< std::decay_t< ET1 > >::value )
+      && ( HasEnabledExpressionTemplates< std::decay_t< ET2 > >::value
+           || HasEnabledExpressionTemplates< std::decay_t< ET1 > >::value ),
+   T >;
 
 template< typename ET1, typename T = void >
-using EnableIfDistributedUnaryExpression_t = std::enable_if_t<
-         HasEnabledDistributedExpressionTemplates< std::decay_t< ET1 > >::value,
-      T >;
+using EnableIfDistributedUnaryExpression_t =
+   std::enable_if_t< HasEnabledDistributedExpressionTemplates< std::decay_t< ET1 > >::value, T >;
 
 template< typename ET1, typename ET2, typename T = void >
 using EnableIfDistributedBinaryExpression_t = std::enable_if_t<
-      // we need to avoid ambiguity with operators defined in Array (e.g. Array::operator==)
-      // so the first operand must not be Array
-      (
-         HasAddAssignmentOperator< std::decay_t< ET1 > >::value ||
-         HasEnabledDistributedExpressionTemplates< std::decay_t< ET1 > >::value ||
-         std::is_arithmetic< std::decay_t< ET1 > >::value
-      ) &&
-      (
-         HasEnabledDistributedExpressionTemplates< std::decay_t< ET2 > >::value ||
-         HasEnabledDistributedExpressionTemplates< std::decay_t< ET1 > >::value
-      ),
-      T >;
-
+   // we need to avoid ambiguity with operators defined in Array (e.g. Array::operator==)
+   // so the first operand must not be Array
+   ( HasAddAssignmentOperator< std::decay_t< ET1 > >::value
+     || HasEnabledDistributedExpressionTemplates< std::decay_t< ET1 > >::value
+     || std::is_arithmetic< std::decay_t< ET1 > >::value )
+      && ( HasEnabledDistributedExpressionTemplates< std::decay_t< ET2 > >::value
+           || HasEnabledDistributedExpressionTemplates< std::decay_t< ET1 > >::value ),
+   T >;
 
 // helper trait class for recursively turning expression template classes into compatible vectors
 template< typename R, typename Enable = void >
@@ -103,12 +84,10 @@ struct RemoveExpressionTemplate< R, typename enable_if_type< typename std::decay
 template< typename R >
 using RemoveET = typename RemoveExpressionTemplate< R >::type;
 
-
 template< typename T1, typename T2 >
-constexpr std::enable_if_t<
-      ! ( IsStaticArrayType< T1 >::value && IsStaticArrayType< T2 >::value ) &&
-      ! ( IsArrayType< T1 >::value && IsArrayType< T2 >::value )
-, bool >
+constexpr std::enable_if_t< ! ( IsStaticArrayType< T1 >::value && IsStaticArrayType< T2 >::value )
+                               && ! ( IsArrayType< T1 >::value && IsArrayType< T2 >::value ),
+                            bool >
 compatibleForVectorAssignment()
 {
    return IsScalarType< T1 >::value && IsScalarType< T2 >::value;
@@ -118,8 +97,8 @@ template< typename T1, typename T2 >
 constexpr std::enable_if_t< IsStaticArrayType< T1 >::value && IsStaticArrayType< T2 >::value, bool >
 compatibleForVectorAssignment()
 {
-   return T1::getSize() == T2::getSize() &&
-          compatibleForVectorAssignment< typename RemoveET< T1 >::ValueType, typename RemoveET< T2 >::ValueType >();
+   return T1::getSize() == T2::getSize()
+       && compatibleForVectorAssignment< typename RemoveET< T1 >::ValueType, typename RemoveET< T2 >::ValueType >();
 }
 
 template< typename T1, typename T2 >
@@ -129,46 +108,40 @@ compatibleForVectorAssignment()
    return compatibleForVectorAssignment< typename RemoveET< T1 >::ValueType, typename RemoveET< T2 >::ValueType >();
 }
 
-
 // helper trait class for proper classification of expression operands using getExpressionVariableType
-template< typename T, typename V,
-          bool enabled = HasEnabledExpressionTemplates< V >::value ||
-                         HasEnabledStaticExpressionTemplates< V >::value ||
-                         HasEnabledDistributedExpressionTemplates< V >::value >
+template< typename T,
+          typename V,
+          bool enabled = HasEnabledExpressionTemplates< V >::value || HasEnabledStaticExpressionTemplates< V >::value
+                      || HasEnabledDistributedExpressionTemplates< V >::value >
 struct IsArithmeticSubtype
 : public std::integral_constant< bool,
-            // Note that using std::is_same would not be general enough, because e.g.
-            // StaticVector<3, int> may be assigned to StaticVector<3, double>
-            compatibleForVectorAssignment< typename V::RealType, T >() >
+                                 // Note that using std::is_same would not be general enough, because e.g.
+                                 // StaticVector<3, int> may be assigned to StaticVector<3, double>
+                                 compatibleForVectorAssignment< typename V::RealType, T >() >
 {};
 
 template< typename T >
-struct IsArithmeticSubtype< T, T, true >
-: public std::false_type
+struct IsArithmeticSubtype< T, T, true > : public std::false_type
 {};
 
 template< typename T >
-struct IsArithmeticSubtype< T, T, false >
-: public std::false_type
+struct IsArithmeticSubtype< T, T, false > : public std::false_type
 {};
 
 template< typename T, typename V >
-struct IsArithmeticSubtype< T, V, false >
-: public std::is_arithmetic< T >
+struct IsArithmeticSubtype< T, V, false > : public std::is_arithmetic< T >
 {};
 
-
 // helper trait class for Static*ExpressionTemplates classes
 template< typename R, typename Enable = void >
 struct OperandMemberType
 {
    using type = std::conditional_t< std::is_fundamental< R >::value,
-                     // non-reference for fundamental types
-                     std::add_const_t< std::remove_reference_t< R > >,
-                     // lvalue-reference for other types (especially StaticVector)
-                     std::add_lvalue_reference_t< std::add_const_t< R > >
-                  >;
-//   using type = std::add_const_t< std::remove_reference_t< R > >;
+                                    // non-reference for fundamental types
+                                    std::add_const_t< std::remove_reference_t< R > >,
+                                    // lvalue-reference for other types (especially StaticVector)
+                                    std::add_lvalue_reference_t< std::add_const_t< R > > >;
+   //   using type = std::add_const_t< std::remove_reference_t< R > >;
 };
 
 // assuming that only the StaticBinaryExpressionTemplate and StaticUnaryTemplate classes have a VectorOperandType type member
@@ -181,6 +154,6 @@ struct OperandMemberType< R, typename enable_if_type< typename R::VectorOperandT
    using type = std::add_const_t< std::remove_reference_t< R > >;
 };
 
-} // namespace Expressions
-} // namespace Containers
-} // namespace TNL
+}  // namespace Expressions
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/IndexedMap.h b/src/TNL/Containers/IndexedMap.h
index 6e9127458f7b5f2c09d00019f1a6671f68afe3da..7118e9ceccf268749463b27d1b68e24aae50e947 100644
--- a/src/TNL/Containers/IndexedMap.h
+++ b/src/TNL/Containers/IndexedMap.h
@@ -12,9 +12,7 @@
 namespace TNL {
 namespace Containers {
 
-template< typename Value,
-          typename Index,
-          typename Key >
+template< typename Value, typename Index, typename Key >
 class IndexedMap
 {
 public:
@@ -22,22 +20,30 @@ public:
    using IndexType = Index;
    using KeyType = Key;
 
-   void reset();
+   void
+   reset();
 
-   IndexType getSize() const;
+   IndexType
+   getSize() const;
 
-   IndexType insert( const ValueType &data );
+   IndexType
+   insert( const ValueType& data );
 
-   bool find( const ValueType &data, IndexType& index ) const;
+   bool
+   find( const ValueType& data, IndexType& index ) const;
 
    template< typename ArrayType >
-   void toArray( ArrayType& array ) const;
+   void
+   toArray( ArrayType& array ) const;
 
-   const Value& getElement( KeyType key ) const;
+   const Value&
+   getElement( KeyType key ) const;
 
-   Value& getElement( KeyType key );
+   Value&
+   getElement( KeyType key );
 
-   void print( std::ostream& str ) const;
+   void
+   print( std::ostream& str ) const;
 
 protected:
    struct DataWithIndex
@@ -46,12 +52,11 @@ protected:
       // http://stackoverflow.com/questions/22357887/comparing-two-mapiterators-why-does-it-need-the-copy-constructor-of-stdpair
       DataWithIndex(){};
 
-      DataWithIndex( const DataWithIndex& d ) : data( d.data ), index( d.index) {}
+      DataWithIndex( const DataWithIndex& d ) : data( d.data ), index( d.index ) {}
 
-      explicit DataWithIndex( const Value data) : data( data ) {}
+      explicit DataWithIndex( const Value data ) : data( data ) {}
 
-      DataWithIndex( const Value data,
-                     const Index index) : data(data), index(index) {}
+      DataWithIndex( const Value data, const Index index ) : data( data ), index( index ) {}
 
       Value data;
       Index index;
@@ -64,12 +69,11 @@ protected:
    STDMapType map;
 };
 
-template< typename Value,
-          typename Index,
-          typename Key >
-std::ostream& operator <<( std::ostream& str, IndexedMap< Value, Index, Key >& set );
+template< typename Value, typename Index, typename Key >
+std::ostream&
+operator<<( std::ostream& str, IndexedMap< Value, Index, Key >& set );
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
 
 #include <TNL/Containers/IndexedMap_impl.h>
diff --git a/src/TNL/Containers/IndexedMap_impl.h b/src/TNL/Containers/IndexedMap_impl.h
index 022dba32dc511796481321e4e6ad52fc0058177e..ff22f5854d9a80aa8949ffae35f9bf51138328bf 100644
--- a/src/TNL/Containers/IndexedMap_impl.h
+++ b/src/TNL/Containers/IndexedMap_impl.h
@@ -11,99 +11,85 @@
 namespace TNL {
 namespace Containers {
 
-template< typename Value,
-          typename Index,
-          typename Key >
-void IndexedMap< Value, Index, Key >::reset()
+template< typename Value, typename Index, typename Key >
+void
+IndexedMap< Value, Index, Key >::reset()
 {
    map.clear();
 }
 
-template< typename Value,
-          typename Index,
-          typename Key >
-Index IndexedMap< Value, Index, Key >::getSize() const
+template< typename Value, typename Index, typename Key >
+Index
+IndexedMap< Value, Index, Key >::getSize() const
 {
    return map.size();
 }
 
-template< typename Value,
-          typename Index,
-          typename Key >
-Index IndexedMap< Value, Index, Key >::insert( const Value &data )
+template< typename Value, typename Index, typename Key >
+Index
+IndexedMap< Value, Index, Key >::insert( const Value& data )
 {
-   STDMapIteratorType iter = map.insert( STDMapValueType( Key( data ),
-                                         DataWithIndex( data, getSize() ) ) ).first;
+   STDMapIteratorType iter = map.insert( STDMapValueType( Key( data ), DataWithIndex( data, getSize() ) ) ).first;
    return iter->second.index;
 }
 
-template< typename Value,
-          typename Index,
-          typename Key >
-bool IndexedMap< Value, Index, Key >::find( const Value &data, Index& index ) const
+template< typename Value, typename Index, typename Key >
+bool
+IndexedMap< Value, Index, Key >::find( const Value& data, Index& index ) const
 {
    STDMapIteratorType iter = map.find( Key( data ) );
-   if (iter == map.end())
+   if( iter == map.end() )
       return false;
    index = iter->second.index;
    return true;
 }
 
-template< typename Value,
-          typename Index,
-          typename Key >
-   template<typename ArrayType>
-void IndexedMap< Value, Index, Key >::toArray( ArrayType& array ) const
+template< typename Value, typename Index, typename Key >
+template< typename ArrayType >
+void
+IndexedMap< Value, Index, Key >::toArray( ArrayType& array ) const
 {
    TNL_ASSERT( array.getSize() == getSize(),
-               std::cerr << "array.getSize() = " << array.getSize()
-                         << " getSize() = " << getSize() );
+               std::cerr << "array.getSize() = " << array.getSize() << " getSize() = " << getSize() );
 
-   for( STDMapIteratorType iter = map.begin();
-        iter != map.end();
-        ++iter)
+   for( STDMapIteratorType iter = map.begin(); iter != map.end(); ++iter )
       array[ iter->second.index ] = iter->second.data;
 }
 
-template< typename Value,
-          typename Index,
-          typename Key >
-const Value& IndexedMap< Value, Index, Key >::getElement( KeyType key ) const
+template< typename Value, typename Index, typename Key >
+const Value&
+IndexedMap< Value, Index, Key >::getElement( KeyType key ) const
 {
    return map[ key ];
 }
 
-template< typename Value,
-          typename Index,
-          typename Key >
-Value& IndexedMap< Value, Index, Key >::getElement( KeyType key )
+template< typename Value, typename Index, typename Key >
+Value&
+IndexedMap< Value, Index, Key >::getElement( KeyType key )
 {
    return map[ key ];
 }
 
-template< typename Value,
-          typename Index,
-          typename Key >
-void IndexedMap< Value, Index, Key >::print( std::ostream& str ) const
+template< typename Value, typename Index, typename Key >
+void
+IndexedMap< Value, Index, Key >::print( std::ostream& str ) const
 {
    STDMapIteratorType iter = map.begin();
    str << iter->second.data;
    iter++;
-   while( iter != map.end() )
-   {
+   while( iter != map.end() ) {
       str << ", " << iter->second.data;
       iter++;
    }
 }
 
-template< typename Value,
-          typename Index,
-          typename Key >
-std::ostream& operator<<( std::ostream& str, IndexedMap< Value, Index, Key >& set )
+template< typename Value, typename Index, typename Key >
+std::ostream&
+operator<<( std::ostream& str, IndexedMap< Value, Index, Key >& set )
 {
    set.print( str );
    return str;
 }
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/IndexedSet.h b/src/TNL/Containers/IndexedSet.h
index e7d1f65f20347dc049a90026b72006a865ef1b3d..86badb211a7efef22a97633f7c3524c0f1b08220 100644
--- a/src/TNL/Containers/IndexedSet.h
+++ b/src/TNL/Containers/IndexedSet.h
@@ -28,26 +28,33 @@ public:
    using value_type = typename map_type::value_type;
    using size_type = typename map_type::size_type;
 
-   void clear();
+   void
+   clear();
 
-   size_type size() const;
+   size_type
+   size() const;
 
-   Index insert( const Key& key );
+   Index
+   insert( const Key& key );
 
-   bool find( const Key& key, Index& index ) const;
+   bool
+   find( const Key& key, Index& index ) const;
 
-   size_type count( const Key& key ) const;
+   size_type
+   count( const Key& key ) const;
 
-   size_type erase( const Key& key );
+   size_type
+   erase( const Key& key );
 
-   void print( std::ostream& str ) const;
+   void
+   print( std::ostream& str ) const;
 };
 
-template< typename Element,
-          typename Index >
-std::ostream& operator <<( std::ostream& str, IndexedSet< Element, Index >& set );
+template< typename Element, typename Index >
+std::ostream&
+operator<<( std::ostream& str, IndexedSet< Element, Index >& set );
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
 
 #include <TNL/Containers/IndexedSet_impl.h>
diff --git a/src/TNL/Containers/IndexedSet_impl.h b/src/TNL/Containers/IndexedSet_impl.h
index eafb6a5bdbe9ff119f1560352e1844f7eb0d2d98..80a3738f7d6faf305858432fadf5bec84852d162 100644
--- a/src/TNL/Containers/IndexedSet_impl.h
+++ b/src/TNL/Containers/IndexedSet_impl.h
@@ -11,30 +11,21 @@
 namespace TNL {
 namespace Containers {
 
-template< class Key,
-          class Index,
-          class Compare,
-          class Allocator >
+template< class Key, class Index, class Compare, class Allocator >
 void
 IndexedSet< Key, Index, Compare, Allocator >::clear()
 {
    map.clear();
 }
 
-template< class Key,
-          class Index,
-          class Compare,
-          class Allocator >
+template< class Key, class Index, class Compare, class Allocator >
 typename IndexedSet< Key, Index, Compare, Allocator >::size_type
 IndexedSet< Key, Index, Compare, Allocator >::size() const
 {
    return map.size();
 }
 
-template< class Key,
-          class Index,
-          class Compare,
-          class Allocator >
+template< class Key, class Index, class Compare, class Allocator >
 Index
 IndexedSet< Key, Index, Compare, Allocator >::insert( const Key& key )
 {
@@ -42,10 +33,7 @@ IndexedSet< Key, Index, Compare, Allocator >::insert( const Key& key )
    return iter->second;
 }
 
-template< class Key,
-          class Index,
-          class Compare,
-          class Allocator >
+template< class Key, class Index, class Compare, class Allocator >
 bool
 IndexedSet< Key, Index, Compare, Allocator >::find( const Key& key, Index& index ) const
 {
@@ -56,51 +44,40 @@ IndexedSet< Key, Index, Compare, Allocator >::find( const Key& key, Index& index
    return true;
 }
 
-template< class Key,
-          class Index,
-          class Compare,
-          class Allocator >
+template< class Key, class Index, class Compare, class Allocator >
 typename IndexedSet< Key, Index, Compare, Allocator >::size_type
 IndexedSet< Key, Index, Compare, Allocator >::count( const Key& key ) const
 {
    return map.count( key );
 }
 
-template< class Key,
-          class Index,
-          class Compare,
-          class Allocator >
+template< class Key, class Index, class Compare, class Allocator >
 typename IndexedSet< Key, Index, Compare, Allocator >::size_type
 IndexedSet< Key, Index, Compare, Allocator >::erase( const Key& key )
 {
    return map.erase( key );
 }
 
-template< class Key,
-          class Index,
-          class Compare,
-          class Allocator >
-void IndexedSet< Key, Index, Compare, Allocator >::print( std::ostream& str ) const
+template< class Key, class Index, class Compare, class Allocator >
+void
+IndexedSet< Key, Index, Compare, Allocator >::print( std::ostream& str ) const
 {
    auto iter = map.begin();
    str << iter->second.data;
    iter++;
-   while( iter != map.end() )
-   {
+   while( iter != map.end() ) {
       str << ", " << iter->second.data;
       iter++;
    }
 }
 
-template< class Key,
-          class Index,
-          class Compare,
-          class Allocator >
-std::ostream& operator<<( std::ostream& str, IndexedSet< Key, Index, Compare, Allocator >& set )
+template< class Key, class Index, class Compare, class Allocator >
+std::ostream&
+operator<<( std::ostream& str, IndexedSet< Key, Index, Compare, Allocator >& set )
 {
    set.print( str );
    return str;
 }
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/NDArray.h b/src/TNL/Containers/NDArray.h
index e59ef31aa33cf36d9fd0f36e3e99ca31d694599e..4cbd7820c4e6f8cb22557b4237742b890601c061 100644
--- a/src/TNL/Containers/NDArray.h
+++ b/src/TNL/Containers/NDArray.h
@@ -16,25 +16,19 @@
 namespace TNL {
 namespace Containers {
 
-template< std::size_t slicedDimension = 0,
-          std::size_t sliceSize = 0 >
+template< std::size_t slicedDimension = 0, std::size_t sliceSize = 0 >
 struct SliceInfo
 {
    // sliceSize == 0 means no slicing
-   static constexpr std::size_t getSliceSize( std::size_t dimension )
+   static constexpr std::size_t
+   getSliceSize( std::size_t dimension )
    {
-      return (dimension == slicedDimension) ? sliceSize : 0;
+      return ( dimension == slicedDimension ) ? sliceSize : 0;
    }
 };
 
-
-
-
-template< typename Array,
-          typename Indexer,
-          typename Device = typename Array::DeviceType >
-class NDArrayStorage
-: public Indexer
+template< typename Array, typename Indexer, typename Device = typename Array::DeviceType >
+class NDArrayStorage : public Indexer
 {
 public:
    using StorageArray = Array;
@@ -57,20 +51,24 @@ public:
 
    // Standard copy-semantics with deep copy, just like regular 1D array.
    // Mismatched sizes cause reallocations.
-   NDArrayStorage& operator=( const NDArrayStorage& other ) = default;
+   NDArrayStorage&
+   operator=( const NDArrayStorage& other ) = default;
 
    // default move-semantics
    NDArrayStorage( NDArrayStorage&& ) = default;
-   NDArrayStorage& operator=( NDArrayStorage&& ) = default;
+   NDArrayStorage&
+   operator=( NDArrayStorage&& ) = default;
 
    // Templated copy-assignment
    template< typename OtherArray >
-   NDArrayStorage& operator=( const OtherArray& other )
+   NDArrayStorage&
+   operator=( const OtherArray& other )
    {
       static_assert( std::is_same< PermutationType, typename OtherArray::PermutationType >::value,
                      "Arrays must have the same permutation of indices." );
       // update sizes
-      __ndarray_impl::SetSizesCopyHelper< SizesHolderType, typename OtherArray::SizesHolderType >::copy( getSizes(), other.getSizes() );
+      __ndarray_impl::SetSizesCopyHelper< SizesHolderType, typename OtherArray::SizesHolderType >::copy( getSizes(),
+                                                                                                         other.getSizes() );
       // (re)allocate storage if necessary
       array.setSize( getStorageSize() );
       // copy data
@@ -78,68 +76,77 @@ public:
       return *this;
    }
 
-   bool operator==( const NDArrayStorage& other ) const
+   bool
+   operator==( const NDArrayStorage& other ) const
    {
       // FIXME: uninitialized data due to alignment in NDArray and padding in SlicedNDArray
       return getSizes() == other.getSizes() && array == other.array;
    }
 
-   bool operator!=( const NDArrayStorage& other ) const
+   bool
+   operator!=( const NDArrayStorage& other ) const
    {
       // FIXME: uninitialized data due to alignment in NDArray and padding in SlicedNDArray
       return getSizes() != other.getSizes() || array != other.array;
    }
 
    __cuda_callable__
-   ValueType* getData()
+   ValueType*
+   getData()
    {
       return array.getData();
    }
 
    __cuda_callable__
-   std::add_const_t< ValueType >* getData() const
+   std::add_const_t< ValueType >*
+   getData() const
    {
       return array.getData();
    }
 
    // methods from the base class
    using IndexerType::getDimension;
-   using IndexerType::getSizes;
-   using IndexerType::getSize;
-   using IndexerType::getStride;
    using IndexerType::getOverlap;
-   using IndexerType::getStorageSize;
+   using IndexerType::getSize;
+   using IndexerType::getSizes;
    using IndexerType::getStorageIndex;
+   using IndexerType::getStorageSize;
+   using IndexerType::getStride;
 
    __cuda_callable__
-   const IndexerType& getIndexer() const
+   const IndexerType&
+   getIndexer() const
    {
       return *this;
    }
 
    __cuda_callable__
-   ViewType getView()
+   ViewType
+   getView()
    {
       return ViewType( array.getData(), getSizes() );
    }
 
    __cuda_callable__
-   ConstViewType getConstView() const
+   ConstViewType
+   getConstView() const
    {
       return ConstViewType( array.getData(), getSizes() );
    }
 
    template< std::size_t... Dimensions, typename... IndexTypes >
    __cuda_callable__
-   auto getSubarrayView( IndexTypes&&... indices )
+   auto
+   getSubarrayView( IndexTypes&&... indices )
    {
       static_assert( sizeof...( indices ) == getDimension(), "got wrong number of indices" );
-      static_assert( 0 < sizeof...(Dimensions) && sizeof...(Dimensions) <= getDimension(), "got wrong number of dimensions" );
+      static_assert( 0 < sizeof...( Dimensions ) && sizeof...( Dimensions ) <= getDimension(),
+                     "got wrong number of dimensions" );
 // FIXME: nvcc chokes on the variadic brace-initialization
 #ifndef __NVCC__
-      static_assert( __ndarray_impl::all_elements_in_range( 0, PermutationType::size(), {Dimensions...} ),
+      static_assert( __ndarray_impl::all_elements_in_range( 0, PermutationType::size(), { Dimensions... } ),
                      "invalid dimensions" );
-      static_assert( __ndarray_impl::is_increasing_sequence( {Dimensions...} ),
+      static_assert( __ndarray_impl::is_increasing_sequence( { Dimensions... } ),
                      "specifying permuted dimensions is not supported" );
 #endif
 
@@ -148,11 +155,13 @@ public:
       auto& begin = operator()( std::forward< IndexTypes >( indices )... );
       auto subarray_sizes = Getter::filterSizes( getSizes(), std::forward< IndexTypes >( indices )... );
       auto strides = Getter::getStrides( getSizes(), std::forward< IndexTypes >( indices )... );
-      static_assert( Subpermutation::size() == sizeof...(Dimensions), "Bug - wrong subpermutation length." );
-      static_assert( decltype(subarray_sizes)::getDimension() == sizeof...(Dimensions), "Bug - wrong dimension of the new sizes." );
-      static_assert( decltype(strides)::getDimension() == sizeof...(Dimensions), "Bug - wrong dimension of the strides." );
+      static_assert( Subpermutation::size() == sizeof...( Dimensions ), "Bug - wrong subpermutation length." );
+      static_assert( decltype( subarray_sizes )::getDimension() == sizeof...( Dimensions ),
+                     "Bug - wrong dimension of the new sizes." );
+      static_assert( decltype( strides )::getDimension() == sizeof...( Dimensions ), "Bug - wrong dimension of the strides." );
       // TODO: select overlaps for the subarray
-      using Subindexer = NDArrayIndexer< decltype(subarray_sizes), Subpermutation, typename Indexer::NDBaseType, decltype(strides) >;
+      using Subindexer =
+         NDArrayIndexer< decltype( subarray_sizes ), Subpermutation, typename Indexer::NDBaseType, decltype( strides ) >;
       using SubarrayView = NDArrayView< ValueType, Device, Subindexer >;
       return SubarrayView{ &begin, subarray_sizes, strides };
    }
@@ -195,7 +204,8 @@ public:
    }
 
    template< typename Device2 = DeviceType, typename Func >
-   void forAll( Func f ) const
+   void
+   forAll( Func f ) const
    {
       __ndarray_impl::ExecutorDispatcher< PermutationType, Device2 > dispatch;
       using Begins = ConstStaticSizesHolder< IndexType, getDimension(), 0 >;
@@ -203,7 +213,8 @@ public:
    }
 
    template< typename Device2 = DeviceType, typename Func >
-   void forInternal( Func f ) const
+   void
+   forInternal( Func f ) const
    {
       __ndarray_impl::ExecutorDispatcher< PermutationType, Device2 > dispatch;
       using Begins = ConstStaticSizesHolder< IndexType, getDimension(), 1 >;
@@ -216,7 +227,8 @@ public:
    }
 
    template< typename Device2 = DeviceType, typename Func, typename Begins, typename Ends >
-   void forInternal( Func f, const Begins& begins, const Ends& ends ) const
+   void
+   forInternal( Func f, const Begins& begins, const Ends& ends ) const
    {
       // TODO: assert "begins <= sizes", "ends <= sizes"
       __ndarray_impl::ExecutorDispatcher< PermutationType, Device2 > dispatch;
@@ -224,7 +236,8 @@ public:
    }
 
    template< typename Device2 = DeviceType, typename Func >
-   void forBoundary( Func f ) const
+   void
+   forBoundary( Func f ) const
    {
       using Begins = ConstStaticSizesHolder< IndexType, getDimension(), 0 >;
       using SkipBegins = ConstStaticSizesHolder< IndexType, getDimension(), 1 >;
@@ -239,7 +252,8 @@ public:
    }
 
    template< typename Device2 = DeviceType, typename Func, typename SkipBegins, typename SkipEnds >
-   void forBoundary( Func f, const SkipBegins& skipBegins, const SkipEnds& skipEnds ) const
+   void
+   forBoundary( Func f, const SkipBegins& skipBegins, const SkipEnds& skipEnds ) const
    {
       // TODO: assert "skipBegins <= sizes", "skipEnds <= sizes"
       using Begins = ConstStaticSizesHolder< IndexType, getDimension(), 0 >;
@@ -247,31 +261,34 @@ public:
       dispatch( Begins{}, skipBegins, skipEnds, getSizes(), f );
    }
 
-
    // extra methods
 
    // TODO: rename to setSizes and make sure that overloading with the following method works
-   void setSize( const SizesHolderType& sizes )
+   void
+   setSize( const SizesHolderType& sizes )
    {
       getSizes() = sizes;
       array.setSize( getStorageSize() );
    }
 
    template< typename... IndexTypes >
-   void setSizes( IndexTypes&&... sizes )
+   void
+   setSizes( IndexTypes&&... sizes )
    {
       static_assert( sizeof...( sizes ) == getDimension(), "got wrong number of sizes" );
       __ndarray_impl::setSizesHelper( getSizes(), std::forward< IndexTypes >( sizes )... );
       array.setSize( getStorageSize() );
    }
 
-   void setLike( const NDArrayStorage& other )
+   void
+   setLike( const NDArrayStorage& other )
    {
       getSizes() = other.getSizes();
       array.setSize( getStorageSize() );
    }
 
-   void reset()
+   void
+   reset()
    {
       getSizes() = SizesHolderType{};
       TNL_ASSERT_EQ( getStorageSize(), 0, "Failed to reset the sizes." );
@@ -287,17 +304,20 @@ public:
       return array.getElement( getStorageIndex( std::forward< IndexTypes >( indices )... ) );
    }
 
-   const StorageArray& getStorageArray() const
+   const StorageArray&
+   getStorageArray() const
    {
       return array;
    }
 
-   StorageArray& getStorageArray()
+   StorageArray&
+   getStorageArray()
    {
       return array;
    }
 
-   void setValue( ValueType value )
+   void
+   setValue( ValueType value )
    {
       array.setValue( value );
    }
@@ -315,19 +335,21 @@ template< typename Value,
           typename Overlaps = __ndarray_impl::make_constant_index_sequence< SizesHolder::getDimension(), 0 >,
           typename Allocator = typename Allocators::Default< Device >::template Allocator< Value > >
 class NDArray
-: public NDArrayStorage< Array< Value, Device, Index, Allocator >,
-                         NDArrayIndexer< SizesHolder,
-                                         Permutation,
-                                         __ndarray_impl::NDArrayBase< SliceInfo< 0, 0 > >,
-                                         __ndarray_impl::DummyStrideBase< typename SizesHolder::IndexType, SizesHolder::getDimension() >,
-                                         Overlaps > >
+: public NDArrayStorage<
+     Array< Value, Device, Index, Allocator >,
+     NDArrayIndexer< SizesHolder,
+                     Permutation,
+                     __ndarray_impl::NDArrayBase< SliceInfo< 0, 0 > >,
+                     __ndarray_impl::DummyStrideBase< typename SizesHolder::IndexType, SizesHolder::getDimension() >,
+                     Overlaps > >
 {
-   using Base = NDArrayStorage< Array< Value, Device, Index, Allocator >,
-                                NDArrayIndexer< SizesHolder,
-                                                Permutation,
-                                                __ndarray_impl::NDArrayBase< SliceInfo< 0, 0 > >,
-                                                __ndarray_impl::DummyStrideBase< typename SizesHolder::IndexType, SizesHolder::getDimension() >,
-                                                Overlaps > >;
+   using Base = NDArrayStorage<
+      Array< Value, Device, Index, Allocator >,
+      NDArrayIndexer< SizesHolder,
+                      Permutation,
+                      __ndarray_impl::NDArrayBase< SliceInfo< 0, 0 > >,
+                      __ndarray_impl::DummyStrideBase< typename SizesHolder::IndexType, SizesHolder::getDimension() >,
+                      Overlaps > >;
 
 public:
    // inherit all constructors and assignment operators
@@ -355,7 +377,8 @@ public:
       *this = other;
    }
 
-   AllocatorType getAllocator() const
+   AllocatorType
+   getAllocator() const
    {
       return this->array.getAllocator();
    }
@@ -367,15 +390,11 @@ template< typename Value,
           typename Index = typename SizesHolder::IndexType >
 class StaticNDArray
 : public NDArrayStorage< StaticArray< __ndarray_impl::StaticStorageSizeGetter< SizesHolder >::get(), Value >,
-                         NDArrayIndexer< SizesHolder,
-                                         Permutation,
-                                         __ndarray_impl::NDArrayBase< SliceInfo< 0, 0 > > >,
+                         NDArrayIndexer< SizesHolder, Permutation, __ndarray_impl::NDArrayBase< SliceInfo< 0, 0 > > >,
                          Devices::Sequential >
 {
    using Base = NDArrayStorage< StaticArray< __ndarray_impl::StaticStorageSizeGetter< SizesHolder >::get(), Value >,
-                                NDArrayIndexer< SizesHolder,
-                                                Permutation,
-                                                __ndarray_impl::NDArrayBase< SliceInfo< 0, 0 > > >,
+                                NDArrayIndexer< SizesHolder, Permutation, __ndarray_impl::NDArrayBase< SliceInfo< 0, 0 > > >,
                                 Devices::Sequential >;
    static_assert( __ndarray_impl::StaticStorageSizeGetter< SizesHolder >::get() > 0,
                   "All dimensions of a static array must to be positive." );
@@ -388,25 +407,27 @@ public:
 template< typename Value,
           typename SizesHolder,
           typename Permutation = std::make_index_sequence< SizesHolder::getDimension() >,  // identity by default
-          typename SliceInfo = SliceInfo<>,  // no slicing by default
+          typename SliceInfo = SliceInfo<>,                                                // no slicing by default
           typename Device = Devices::Host,
           typename Index = typename SizesHolder::IndexType,
           typename Overlaps = __ndarray_impl::make_constant_index_sequence< SizesHolder::getDimension(), 0 >,
           typename Allocator = typename Allocators::Default< Device >::template Allocator< Value > >
 class SlicedNDArray
-: public NDArrayStorage< Array< Value, Device, Index, Allocator >,
-                         NDArrayIndexer< SizesHolder,
-                                         Permutation,
-                                         __ndarray_impl::SlicedNDArrayBase< SliceInfo >,
-                                         __ndarray_impl::DummyStrideBase< typename SizesHolder::IndexType, SizesHolder::getDimension() >,
-                                         Overlaps > >
+: public NDArrayStorage<
+     Array< Value, Device, Index, Allocator >,
+     NDArrayIndexer< SizesHolder,
+                     Permutation,
+                     __ndarray_impl::SlicedNDArrayBase< SliceInfo >,
+                     __ndarray_impl::DummyStrideBase< typename SizesHolder::IndexType, SizesHolder::getDimension() >,
+                     Overlaps > >
 {
-   using Base = NDArrayStorage< Array< Value, Device, Index, Allocator >,
-                                NDArrayIndexer< SizesHolder,
-                                                Permutation,
-                                                __ndarray_impl::SlicedNDArrayBase< SliceInfo >,
-                                                __ndarray_impl::DummyStrideBase< typename SizesHolder::IndexType, SizesHolder::getDimension() >,
-                                                Overlaps > >;
+   using Base = NDArrayStorage<
+      Array< Value, Device, Index, Allocator >,
+      NDArrayIndexer< SizesHolder,
+                      Permutation,
+                      __ndarray_impl::SlicedNDArrayBase< SliceInfo >,
+                      __ndarray_impl::DummyStrideBase< typename SizesHolder::IndexType, SizesHolder::getDimension() >,
+                      Overlaps > >;
 
 public:
    // inherit all constructors and assignment operators
@@ -434,11 +455,12 @@ public:
       *this = other;
    }
 
-   AllocatorType getAllocator() const
+   AllocatorType
+   getAllocator() const
    {
       return this->array.getAllocator();
    }
 };
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/NDArrayIndexer.h b/src/TNL/Containers/NDArrayIndexer.h
index e3b22616694c656109e3f4c5ef5bc678fe0d7ba5..fd92dfc4f3ae727db38e7b9fc0b6fe210b7f05f5 100644
--- a/src/TNL/Containers/NDArrayIndexer.h
+++ b/src/TNL/Containers/NDArrayIndexer.h
@@ -9,8 +9,8 @@
 #pragma once
 
 #include <TNL/Containers/ndarray/Indexing.h>
-#include <TNL/Containers/ndarray/SizesHolderHelpers.h>   // StorageSizeGetter
-#include <TNL/Containers/ndarray/Subarrays.h>   // DummyStrideBase
+#include <TNL/Containers/ndarray/SizesHolderHelpers.h>  // StorageSizeGetter
+#include <TNL/Containers/ndarray/Subarrays.h>           // DummyStrideBase
 
 namespace TNL {
 namespace Containers {
@@ -18,10 +18,10 @@ namespace Containers {
 template< typename SizesHolder,
           typename Permutation,
           typename Base,
-          typename StridesHolder = __ndarray_impl::DummyStrideBase< typename SizesHolder::IndexType, SizesHolder::getDimension() >,
+          typename StridesHolder =
+             __ndarray_impl::DummyStrideBase< typename SizesHolder::IndexType, SizesHolder::getDimension() >,
           typename Overlaps = __ndarray_impl::make_constant_index_sequence< SizesHolder::getDimension(), 0 > >
-class NDArrayIndexer
-    : public StridesHolder
+class NDArrayIndexer : public StridesHolder
 {
 public:
    using IndexType = typename SizesHolder::IndexType;
@@ -43,23 +43,25 @@ public:
 
    // explicit initialization by sizes and strides
    __cuda_callable__
-   NDArrayIndexer( SizesHolder sizes, StridesHolder strides )
-   : StridesHolder(strides), sizes(sizes) {}
+   NDArrayIndexer( SizesHolder sizes, StridesHolder strides ) : StridesHolder( strides ), sizes( sizes ) {}
 
-   static constexpr std::size_t getDimension()
+   static constexpr std::size_t
+   getDimension()
    {
       return SizesHolder::getDimension();
    }
 
    __cuda_callable__
-   const SizesHolderType& getSizes() const
+   const SizesHolderType&
+   getSizes() const
    {
       return sizes;
    }
 
    template< std::size_t level >
    __cuda_callable__
-   IndexType getSize() const
+   IndexType
+   getSize() const
    {
       return sizes.template getSize< level >();
    }
@@ -68,14 +70,16 @@ public:
    using StridesHolder::getStride;
 
    template< std::size_t level >
-   static constexpr std::size_t getOverlap()
+   static constexpr std::size_t
+   getOverlap()
    {
       return __ndarray_impl::get< level >( Overlaps{} );
    }
 
    // returns the product of the aligned sizes
    __cuda_callable__
-   IndexType getStorageSize() const
+   IndexType
+   getStorageSize() const
    {
       using Alignment = typename Base::template Alignment< Permutation >;
       return __ndarray_impl::StorageSizeGetter< SizesHolder, Alignment, Overlaps >::get( sizes );
@@ -88,16 +92,12 @@ public:
    {
       static_assert( sizeof...( indices ) == SizesHolder::getDimension(), "got wrong number of indices" );
       __ndarray_impl::assertIndicesInBounds( getSizes(), OverlapsType{}, std::forward< IndexTypes >( indices )... );
-      const IndexType result = Base::template getStorageIndex< Permutation, Overlaps >
-                               ( sizes,
-                                 static_cast< const StridesHolder& >( *this ),
-                                 std::forward< IndexTypes >( indices )... );
-      TNL_ASSERT_GE( result, (IndexType) 0,
-                     "storage index out of bounds - either input error or a bug in the indexer" );
+      const IndexType result = Base::template getStorageIndex< Permutation, Overlaps >(
+         sizes, static_cast< const StridesHolder& >( *this ), std::forward< IndexTypes >( indices )... );
+      TNL_ASSERT_GE( result, (IndexType) 0, "storage index out of bounds - either input error or a bug in the indexer" );
       // upper bound can be checked only for contiguous arrays/views
       if( StridesHolder::isContiguous() ) {
-         TNL_ASSERT_LT( result, getStorageSize(),
-                        "storage index out of bounds - either input error or a bug in the indexer" );
+         TNL_ASSERT_LT( result, getStorageSize(), "storage index out of bounds - either input error or a bug in the indexer" );
       }
       return result;
    }
@@ -105,7 +105,8 @@ public:
 protected:
    // non-const reference accessor cannot be public - only subclasses like NDArrayStorage may modify the sizes
    __cuda_callable__
-   SizesHolderType& getSizes()
+   SizesHolderType&
+   getSizes()
    {
       return sizes;
    }
@@ -113,5 +114,5 @@ protected:
    SizesHolder sizes;
 };
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/NDArrayView.h b/src/TNL/Containers/NDArrayView.h
index 726bf4d9b5ee9d035854f0b9e6d1e24eae9c4f1f..ae9cce4cdc96037499dab8581e9d5dc975a07522 100644
--- a/src/TNL/Containers/NDArrayView.h
+++ b/src/TNL/Containers/NDArrayView.h
@@ -20,11 +20,8 @@
 namespace TNL {
 namespace Containers {
 
-template< typename Value,
-          typename Device,
-          typename Indexer >
-class NDArrayView
-: public Indexer
+template< typename Value, typename Device, typename Indexer >
+class NDArrayView : public Indexer
 {
 public:
    using ValueType = Value;
@@ -44,12 +41,12 @@ public:
    // explicit initialization by raw data pointer and sizes and strides
    __cuda_callable__
    NDArrayView( Value* data, SizesHolderType sizes, StridesHolderType strides = StridesHolderType{} )
-   : IndexerType(sizes, strides), array(data) {}
+   : IndexerType( sizes, strides ), array( data )
+   {}
 
    // explicit initialization by raw data pointer and indexer
    __cuda_callable__
-   NDArrayView( Value* data, IndexerType indexer )
-   : IndexerType(indexer), array(data) {}
+   NDArrayView( Value* data, IndexerType indexer ) : IndexerType( indexer ), array( data ) {}
 
    // Copy-constructor does shallow copy, so views can be passed-by-value into
    // CUDA kernels and they can be captured-by-value in __cuda_callable__
@@ -65,7 +62,8 @@ public:
    // must match (i.e. copy-assignment cannot resize).
    TNL_NVCC_HD_WARNING_DISABLE
    __cuda_callable__
-   NDArrayView& operator=( const NDArrayView& other )
+   NDArrayView&
+   operator=( const NDArrayView& other )
    {
       TNL_ASSERT_EQ( getSizes(), other.getSizes(), "The sizes of the array views must be equal, views are not resizable." );
       if( getStorageSize() > 0 )
@@ -77,7 +75,8 @@ public:
    TNL_NVCC_HD_WARNING_DISABLE
    template< typename OtherView >
    __cuda_callable__
-   NDArrayView& operator=( const OtherView& other )
+   NDArrayView&
+   operator=( const OtherView& other )
    {
       static_assert( std::is_same< PermutationType, typename OtherView::PermutationType >::value,
                      "Arrays must have the same permutation of indices." );
@@ -87,7 +86,8 @@ public:
                        "The sizes of the array views must be equal, views are not resizable." );
       if( getStorageSize() > 0 ) {
          TNL_ASSERT_TRUE( array, "Attempted to assign to an empty view." );
-         Algorithms::MultiDeviceMemoryOperations< DeviceType, typename OtherView::DeviceType >::copy( array, other.getData(), getStorageSize() );
+         Algorithms::MultiDeviceMemoryOperations< DeviceType, typename OtherView::DeviceType >::copy(
+            array, other.getData(), getStorageSize() );
       }
       return *this;
    }
@@ -97,7 +97,8 @@ public:
 
    // methods for rebinding (reinitialization)
    __cuda_callable__
-   void bind( NDArrayView view )
+   void
+   bind( NDArrayView view )
    {
       IndexerType::operator=( view );
       array = view.array;
@@ -105,7 +106,8 @@ public:
 
    // binds to the given raw pointer and changes the indexer
    __cuda_callable__
-   void bind( Value* data, IndexerType indexer )
+   void
+   bind( Value* data, IndexerType indexer )
    {
       IndexerType::operator=( indexer );
       array = data;
@@ -113,13 +115,15 @@ public:
 
    // binds to the given raw pointer and preserves the current indexer
    __cuda_callable__
-   void bind( Value* data )
+   void
+   bind( Value* data )
    {
       array = data;
    }
 
    __cuda_callable__
-   void reset()
+   void
+   reset()
    {
       IndexerType::operator=( IndexerType{} );
       array = nullptr;
@@ -127,7 +131,8 @@ public:
 
    TNL_NVCC_HD_WARNING_DISABLE
    __cuda_callable__
-   bool operator==( const NDArrayView& other ) const
+   bool
+   operator==( const NDArrayView& other ) const
    {
       if( getSizes() != other.getSizes() )
          return false;
@@ -138,7 +143,8 @@ public:
 
    TNL_NVCC_HD_WARNING_DISABLE
    __cuda_callable__
-   bool operator!=( const NDArrayView& other ) const
+   bool
+   operator!=( const NDArrayView& other ) const
    {
       if( getSizes() != other.getSizes() )
          return true;
@@ -147,55 +153,62 @@ public:
    }
 
    __cuda_callable__
-   ValueType* getData()
+   ValueType*
+   getData()
    {
       return array;
    }
 
    __cuda_callable__
-   std::add_const_t< ValueType >* getData() const
+   std::add_const_t< ValueType >*
+   getData() const
    {
       return array;
    }
 
    // methods from the base class
    using IndexerType::getDimension;
-   using IndexerType::getSizes;
-   using IndexerType::getSize;
-   using IndexerType::getStride;
    using IndexerType::getOverlap;
-   using IndexerType::getStorageSize;
+   using IndexerType::getSize;
+   using IndexerType::getSizes;
    using IndexerType::getStorageIndex;
+   using IndexerType::getStorageSize;
+   using IndexerType::getStride;
 
    __cuda_callable__
-   const IndexerType& getIndexer() const
+   const IndexerType&
+   getIndexer() const
    {
       return *this;
    }
 
    __cuda_callable__
-   ViewType getView()
+   ViewType
+   getView()
    {
       return ViewType( *this );
    }
 
    __cuda_callable__
-   ConstViewType getConstView() const
+   ConstViewType
+   getConstView() const
    {
       return ConstViewType( array, getIndexer() );
    }
 
    template< std::size_t... Dimensions, typename... IndexTypes >
    __cuda_callable__
-   auto getSubarrayView( IndexTypes&&... indices )
+   auto
+   getSubarrayView( IndexTypes&&... indices )
    {
       static_assert( sizeof...( indices ) == getDimension(), "got wrong number of indices" );
-      static_assert( 0 < sizeof...(Dimensions) && sizeof...(Dimensions) <= getDimension(), "got wrong number of dimensions" );
+      static_assert( 0 < sizeof...( Dimensions ) && sizeof...( Dimensions ) <= getDimension(),
+                     "got wrong number of dimensions" );
 // FIXME: nvcc chokes on the variadic brace-initialization
 #ifndef __NVCC__
-      static_assert( __ndarray_impl::all_elements_in_range( 0, PermutationType::size(), {Dimensions...} ),
+      static_assert( __ndarray_impl::all_elements_in_range( 0, PermutationType::size(), { Dimensions... } ),
                      "invalid dimensions" );
-      static_assert( __ndarray_impl::is_increasing_sequence( {Dimensions...} ),
+      static_assert( __ndarray_impl::is_increasing_sequence( { Dimensions... } ),
                      "specifying permuted dimensions is not supported" );
 #endif
 
@@ -204,11 +217,13 @@ public:
       auto& begin = operator()( std::forward< IndexTypes >( indices )... );
       auto subarray_sizes = Getter::filterSizes( getSizes(), std::forward< IndexTypes >( indices )... );
       auto strides = Getter::getStrides( getSizes(), std::forward< IndexTypes >( indices )... );
-      static_assert( Subpermutation::size() == sizeof...(Dimensions), "Bug - wrong subpermutation length." );
-      static_assert( decltype(subarray_sizes)::getDimension() == sizeof...(Dimensions), "Bug - wrong dimension of the new sizes." );
-      static_assert( decltype(strides)::getDimension() == sizeof...(Dimensions), "Bug - wrong dimension of the strides." );
+      static_assert( Subpermutation::size() == sizeof...( Dimensions ), "Bug - wrong subpermutation length." );
+      static_assert( decltype( subarray_sizes )::getDimension() == sizeof...( Dimensions ),
+                     "Bug - wrong dimension of the new sizes." );
+      static_assert( decltype( strides )::getDimension() == sizeof...( Dimensions ), "Bug - wrong dimension of the strides." );
       // TODO: select overlaps for the subarray
-      using Subindexer = NDArrayIndexer< decltype(subarray_sizes), Subpermutation, typename Indexer::NDBaseType, decltype(strides) >;
+      using Subindexer =
+         NDArrayIndexer< decltype( subarray_sizes ), Subpermutation, typename Indexer::NDBaseType, decltype( strides ) >;
       using SubarrayView = NDArrayView< ValueType, Device, Subindexer >;
       return SubarrayView{ &begin, subarray_sizes, strides };
    }
@@ -251,7 +266,8 @@ public:
    }
 
    template< typename Device2 = DeviceType, typename Func >
-   void forAll( Func f ) const
+   void
+   forAll( Func f ) const
    {
       __ndarray_impl::ExecutorDispatcher< PermutationType, Device2 > dispatch;
       using Begins = ConstStaticSizesHolder< IndexType, getDimension(), 0 >;
@@ -259,7 +275,8 @@ public:
    }
 
    template< typename Device2 = DeviceType, typename Func >
-   void forInternal( Func f ) const
+   void
+   forInternal( Func f ) const
    {
       __ndarray_impl::ExecutorDispatcher< PermutationType, Device2 > dispatch;
       using Begins = ConstStaticSizesHolder< IndexType, getDimension(), 1 >;
@@ -272,7 +289,8 @@ public:
    }
 
    template< typename Device2 = DeviceType, typename Func, typename Begins, typename Ends >
-   void forInternal( Func f, const Begins& begins, const Ends& ends ) const
+   void
+   forInternal( Func f, const Begins& begins, const Ends& ends ) const
    {
       // TODO: assert "begins <= getSizes()", "ends <= getSizes()"
       __ndarray_impl::ExecutorDispatcher< PermutationType, Device2 > dispatch;
@@ -280,7 +298,8 @@ public:
    }
 
    template< typename Device2 = DeviceType, typename Func >
-   void forBoundary( Func f ) const
+   void
+   forBoundary( Func f ) const
    {
       using Begins = ConstStaticSizesHolder< IndexType, getDimension(), 0 >;
       using SkipBegins = ConstStaticSizesHolder< IndexType, getDimension(), 1 >;
@@ -295,7 +314,8 @@ public:
    }
 
    template< typename Device2 = DeviceType, typename Func, typename SkipBegins, typename SkipEnds >
-   void forBoundary( Func f, const SkipBegins& skipBegins, const SkipEnds& skipEnds ) const
+   void
+   forBoundary( Func f, const SkipBegins& skipBegins, const SkipEnds& skipEnds ) const
    {
       // TODO: assert "skipBegins <= getSizes()", "skipEnds <= getSizes()"
       using Begins = ConstStaticSizesHolder< IndexType, getDimension(), 0 >;
@@ -308,5 +328,5 @@ protected:
    IndexerType indexer;
 };
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/Partitioner.h b/src/TNL/Containers/Partitioner.h
index 4c652ce758d9db80b2f47d1d808de6abf5572606..e7240a72cf8a3180b158f31867a66aae8402197d 100644
--- a/src/TNL/Containers/Partitioner.h
+++ b/src/TNL/Containers/Partitioner.h
@@ -24,13 +24,14 @@ class Partitioner
 public:
    using SubrangeType = Subrange< Index >;
 
-   static SubrangeType splitRange( Index globalSize, MPI_Comm communicator )
+   static SubrangeType
+   splitRange( Index globalSize, MPI_Comm communicator )
    {
       if( communicator != MPI_COMM_NULL ) {
          const int rank = MPI::GetRank( communicator );
          const int partitions = MPI::GetSize( communicator );
          const Index begin = TNL::min( globalSize, rank * globalSize / partitions );
-         const Index end = TNL::min( globalSize, (rank + 1) * globalSize / partitions );
+         const Index end = TNL::min( globalSize, ( rank + 1 ) * globalSize / partitions );
          return SubrangeType( begin, end );
       }
       else
@@ -39,7 +40,8 @@ public:
 
    // Gets the owner of given global index.
    __cuda_callable__
-   static int getOwner( Index i, Index globalSize, int partitions )
+   static int
+   getOwner( Index i, Index globalSize, int partitions )
    {
       int owner = i * partitions / globalSize;
       if( owner < partitions - 1 && i >= getOffset( globalSize, owner + 1, partitions ) )
@@ -51,23 +53,24 @@ public:
 
    // Gets the offset of data for given rank.
    __cuda_callable__
-   static Index getOffset( Index globalSize, int rank, int partitions )
+   static Index
+   getOffset( Index globalSize, int rank, int partitions )
    {
       return rank * globalSize / partitions;
    }
 
    // Gets the size of data assigned to given rank.
    __cuda_callable__
-   static Index getSizeForRank( Index globalSize, int rank, int partitions )
+   static Index
+   getSizeForRank( Index globalSize, int rank, int partitions )
    {
       const Index begin = min( globalSize, rank * globalSize / partitions );
-      const Index end = min( globalSize, (rank + 1) * globalSize / partitions );
+      const Index end = min( globalSize, ( rank + 1 ) * globalSize / partitions );
       return end - begin;
    }
 
    template< typename Device >
-   class ArraySynchronizer
-   : public ByteArraySynchronizer< Device, Index >
+   class ArraySynchronizer : public ByteArraySynchronizer< Device, Index >
    {
       using Base = ByteArraySynchronizer< Device, Index >;
 
@@ -89,52 +92,50 @@ public:
       ArraySynchronizer() = delete;
 
       ArraySynchronizer( SubrangeType localRange, int overlaps, MPI_Comm communicator )
-      : localRange(localRange), overlaps(overlaps), communicator(communicator)
+      : localRange( localRange ), overlaps( overlaps ), communicator( communicator )
       {}
 
-      virtual void synchronizeByteArray( ByteArrayView array, int bytesPerValue ) override
+      virtual void
+      synchronizeByteArray( ByteArrayView array, int bytesPerValue ) override
       {
          auto requests = synchronizeByteArrayAsyncWorker( array, bytesPerValue );
          MPI::Waitall( requests.data(), requests.size() );
       }
 
-      virtual RequestsVector synchronizeByteArrayAsyncWorker( ByteArrayView array, int bytesPerValue ) override
+      virtual RequestsVector
+      synchronizeByteArrayAsyncWorker( ByteArrayView array, int bytesPerValue ) override
       {
-         TNL_ASSERT_EQ( array.getSize(), bytesPerValue * (localRange.getSize() + 2 * overlaps),
-                        "unexpected array size" );
+         TNL_ASSERT_EQ( array.getSize(), bytesPerValue * ( localRange.getSize() + 2 * overlaps ), "unexpected array size" );
 
          const int rank = MPI::GetRank( communicator );
          const int nproc = MPI::GetSize( communicator );
-         const int left = (rank > 0) ? rank - 1 : nproc - 1;
-         const int right = (rank < nproc - 1) ? rank + 1 : 0;
+         const int left = ( rank > 0 ) ? rank - 1 : nproc - 1;
+         const int right = ( rank < nproc - 1 ) ? rank + 1 : 0;
 
          // buffer for asynchronous communication requests
          std::vector< MPI_Request > requests;
 
          // issue all async receive operations
          requests.push_back( MPI::Irecv(
-                  array.getData() + bytesPerValue * localRange.getSize(),
-                  bytesPerValue * overlaps,
-                  left, 0, communicator ) );
-         requests.push_back( MPI::Irecv(
-                  array.getData() + bytesPerValue * (localRange.getSize() + overlaps),
-                  bytesPerValue * overlaps,
-                  right, 0, communicator ) );
+            array.getData() + bytesPerValue * localRange.getSize(), bytesPerValue * overlaps, left, 0, communicator ) );
+         requests.push_back( MPI::Irecv( array.getData() + bytesPerValue * ( localRange.getSize() + overlaps ),
+                                         bytesPerValue * overlaps,
+                                         right,
+                                         0,
+                                         communicator ) );
 
          // issue all async send operations
-         requests.push_back( MPI::Isend(
-                  array.getData(),
-                  bytesPerValue * overlaps,
-                  left, 0, communicator ) );
-         requests.push_back( MPI::Isend(
-                  array.getData() + bytesPerValue * (localRange.getSize() - overlaps),
-                  bytesPerValue * overlaps,
-                  right, 0, communicator ) );
+         requests.push_back( MPI::Isend( array.getData(), bytesPerValue * overlaps, left, 0, communicator ) );
+         requests.push_back( MPI::Isend( array.getData() + bytesPerValue * ( localRange.getSize() - overlaps ),
+                                         bytesPerValue * overlaps,
+                                         right,
+                                         0,
+                                         communicator ) );
 
          return requests;
       }
    };
 };
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/StaticArray.h b/src/TNL/Containers/StaticArray.h
index bb10199ad86292b58d5ade24d71d773b2a2152de..50c11b34248618e65189b9ec2e70c46ba4fcf948 100644
--- a/src/TNL/Containers/StaticArray.h
+++ b/src/TNL/Containers/StaticArray.h
@@ -22,7 +22,6 @@ template< int Size, typename Value >
 class StaticArray
 {
 public:
-
    /**
     * \brief Type of elements stored in this array.
     */
@@ -37,13 +36,14 @@ public:
     * \brief Gets size of this array.
     */
    __cuda_callable__
-   static constexpr int getSize();
+   static constexpr int
+   getSize();
 
    /**
     * \brief Default constructor.
     */
    __cuda_callable__
-   StaticArray();
+   StaticArray() = default;
 
    /**
     * \brief Constructor from static array.
@@ -81,7 +81,7 @@ public:
     * @param elems input initializer list
     */
    __cuda_callable__
-   StaticArray( const std::initializer_list< Value > &elems );
+   StaticArray( const std::initializer_list< Value >& elems );
 
    /**
     * \brief Constructor that sets components of arrays with Size = 2.
@@ -102,18 +102,19 @@ public:
    __cuda_callable__
    StaticArray( const Value& v1, const Value& v2, const Value& v3 );
 
-
    /**
     * \brief Gets pointer to data of this static array.
     */
    __cuda_callable__
-   Value* getData();
+   Value*
+   getData();
 
    /**
     * \brief Gets constant pointer to data of this static array.
     */
    __cuda_callable__
-   const Value* getData() const;
+   const Value*
+   getData() const;
 
    /**
     * \brief Accesses specified element at the position \e i and returns a constant reference to its value.
@@ -121,7 +122,8 @@ public:
     * \param i Index position of an element.
     */
    __cuda_callable__
-   const Value& operator[]( int i ) const;
+   const Value&
+   operator[]( int i ) const;
 
    /**
     * \brief Accesses specified element at the position \e i and returns a reference to its value.
@@ -129,7 +131,8 @@ public:
     * \param i Index position of an element.
     */
    __cuda_callable__
-   Value& operator[]( int i );
+   Value&
+   operator[]( int i );
 
    /**
     * \brief Accesses specified element at the position \e i and returns a constant reference to its value.
@@ -137,7 +140,8 @@ public:
     * Equivalent to \ref operator[].
     */
    __cuda_callable__
-   const Value& operator()( int i ) const;
+   const Value&
+   operator()( int i ) const;
 
    /**
     * \brief Accesses specified element at the position \e i and returns a reference to its value.
@@ -145,49 +149,57 @@ public:
     * Equivalent to \ref operator[].
     */
    __cuda_callable__
-   Value& operator()( int i );
+   Value&
+   operator()( int i );
 
    /**
     * \brief Returns reference to the first coordinate.
     */
    __cuda_callable__
-   Value& x();
+   Value&
+   x();
 
    /**
     * \brief Returns constant reference to the first coordinate.
     */
    __cuda_callable__
-   const Value& x() const;
+   const Value&
+   x() const;
 
    /**
     * \brief Returns reference to the second coordinate for arrays with Size >= 2.
     */
    __cuda_callable__
-   Value& y();
+   Value&
+   y();
 
    /**
     * \brief Returns constant reference to the second coordinate for arrays with Size >= 2.
     */
    __cuda_callable__
-   const Value& y() const;
+   const Value&
+   y() const;
 
    /**
     * \brief Returns reference to the third coordinate for arrays with Size >= 3.
     */
    __cuda_callable__
-   Value& z();
+   Value&
+   z();
 
    /**
     * \brief Returns constant reference to the third coordinate for arrays with Size >= 3.
     */
    __cuda_callable__
-   const Value& z() const;
+   const Value&
+   z() const;
 
    /**
     * \brief Assigns another static \e array to this array.
     */
    __cuda_callable__
-   StaticArray< Size, Value >& operator=( const StaticArray< Size, Value >& array );
+   StaticArray< Size, Value >&
+   operator=( const StaticArray< Size, Value >& array );
 
    /**
     * \brief Assigns an object \e v of type \e T.
@@ -201,7 +213,8 @@ public:
     */
    template< typename T >
    __cuda_callable__
-   StaticArray< Size, Value >& operator=( const T& v );
+   StaticArray< Size, Value >&
+   operator=( const T& v );
 
    /**
     * \brief This function checks whether this static array is equal to another \e array.
@@ -210,7 +223,8 @@ public:
     */
    template< typename Array >
    __cuda_callable__
-   bool operator==( const Array& array ) const;
+   bool
+   operator==( const Array& array ) const;
 
    /**
     * \brief This function checks whether this static array is not equal to another \e array.
@@ -219,7 +233,8 @@ public:
     */
    template< typename Array >
    __cuda_callable__
-   bool operator!=( const Array& array ) const;
+   bool
+   operator!=( const Array& array ) const;
 
    /**
     * \brief Cast operator for changing of the \e Value type.
@@ -240,24 +255,28 @@ public:
     * \brief Sets all values of this static array to \e val.
     */
    __cuda_callable__
-   void setValue( const ValueType& val );
+   void
+   setValue( const ValueType& val );
 
    /**
     * \brief Saves this static array into the \e file.
     * \param file Reference to a file.
     */
-   bool save( File& file ) const;
+   bool
+   save( File& file ) const;
 
    /**
     * \brief Loads data from the \e file to this static array.
     * \param file Reference to a file.
     */
-   bool load( File& file);
+   bool
+   load( File& file );
 
    /**
     * \brief Sorts the elements in this static array in ascending order.
     */
-   void sort();
+   void
+   sort();
 
    /**
     * \brief Writes the array values into stream \e str with specified \e separator.
@@ -266,14 +285,16 @@ public:
     * @param separator Character separating the array values in the stream \e str.
     * Is set to " " by default.
     */
-   std::ostream& write( std::ostream& str, const char* separator = " " ) const;
+   std::ostream&
+   write( std::ostream& str, const char* separator = " " ) const;
 
 protected:
    Value data[ Size ];
 };
 
 template< int Size, typename Value >
-std::ostream& operator<<( std::ostream& str, const StaticArray< Size, Value >& a );
+std::ostream&
+operator<<( std::ostream& str, const StaticArray< Size, Value >& a );
 
 /**
  * \brief Serialization of static arrays into binary files.
@@ -282,7 +303,8 @@ std::ostream& operator<<( std::ostream& str, const StaticArray< Size, Value >& a
  * \param array is an array to be written into the output file.
  */
 template< int Size, typename Value >
-File& operator<<( File& file, const StaticArray< Size, Value >& array );
+File&
+operator<<( File& file, const StaticArray< Size, Value >& array );
 
 /**
  * \brief Serialization of static arrays into binary files.
@@ -291,7 +313,8 @@ File& operator<<( File& file, const StaticArray< Size, Value >& array );
  * \param array is an array to be written into the output file.
  */
 template< int Size, typename Value >
-File& operator<<( File&& file, const StaticArray< Size, Value >& array );
+File&
+operator<<( File&& file, const StaticArray< Size, Value >& array );
 
 /**
  * \brief Deserialization of static arrays from binary files.
@@ -300,7 +323,8 @@ File& operator<<( File&& file, const StaticArray< Size, Value >& array );
  * \param array is an array to be read from the input file.
  */
 template< int Size, typename Value >
-File& operator>>( File& file, StaticArray< Size, Value >& array );
+File&
+operator>>( File& file, StaticArray< Size, Value >& array );
 
 /**
  * \brief Deserialization of static arrays from binary files.
@@ -309,10 +333,10 @@ File& operator>>( File& file, StaticArray< Size, Value >& array );
  * \param array is an array to be read from the input file.
  */
 template< int Size, typename Value >
-File& operator>>( File&& file, StaticArray< Size, Value >& array );
-
+File&
+operator>>( File&& file, StaticArray< Size, Value >& array );
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
 
 #include <TNL/Containers/StaticArray.hpp>
diff --git a/src/TNL/Containers/StaticArray.hpp b/src/TNL/Containers/StaticArray.hpp
index ff619d48ab2f6fa4e4c64a464e8c34052fcd6fdb..683346812581fe64fd030b9430883498d27753c8 100644
--- a/src/TNL/Containers/StaticArray.hpp
+++ b/src/TNL/Containers/StaticArray.hpp
@@ -22,8 +22,8 @@ template< int Size, typename LeftValue, typename RightValue, int Index >
 struct StaticArrayComparator
 {
    __cuda_callable__
-   static bool EQ( const StaticArray< Size, LeftValue >& left,
-                   const StaticArray< Size, RightValue >& right )
+   static bool
+   EQ( const StaticArray< Size, LeftValue >& left, const StaticArray< Size, RightValue >& right )
    {
       if( left[ Index ] == right[ Index ] )
          return StaticArrayComparator< Size, LeftValue, RightValue, Index + 1 >::EQ( left, right );
@@ -35,8 +35,8 @@ template< int Size, typename LeftValue, typename RightValue >
 struct StaticArrayComparator< Size, LeftValue, RightValue, Size >
 {
    __cuda_callable__
-   static bool EQ( const StaticArray< Size, LeftValue >& left,
-                   const StaticArray< Size, RightValue >& right )
+   static bool
+   EQ( const StaticArray< Size, LeftValue >& left, const StaticArray< Size, RightValue >& right )
    {
       return true;
    }
@@ -54,9 +54,11 @@ template< int k, int i, typename Value >
 struct StaticArraySort
 {
    __cuda_callable__
-   static void exec( Value* data ) {
-      if( data[ i ] > data[  i + 1 ] )
-         swap( data[ i ], data[ i+1 ] );
+   static void
+   exec( Value* data )
+   {
+      if( data[ i ] > data[ i + 1 ] )
+         swap( data[ i ], data[ i + 1 ] );
       StaticArraySort< k, i + 1, Value >::exec( data );
    }
 };
@@ -65,7 +67,9 @@ template< int k, typename Value >
 struct StaticArraySort< k, k, Value >
 {
    __cuda_callable__
-   static void exec( Value* data ) {
+   static void
+   exec( Value* data )
+   {
       StaticArraySort< k - 1, 0, Value >::exec( data );
    }
 };
@@ -74,35 +78,31 @@ template< typename Value >
 struct StaticArraySort< 0, 0, Value >
 {
    __cuda_callable__
-   static void exec( Value* data ) {}
+   static void
+   exec( Value* data )
+   {}
 };
 
-} // namespace detail
-
+}  // namespace detail
 
 template< int Size, typename Value >
 __cuda_callable__
-constexpr int StaticArray< Size, Value >::getSize()
+constexpr int
+StaticArray< Size, Value >::getSize()
 {
    return Size;
 }
 
 template< int Size, typename Value >
-__cuda_callable__
-StaticArray< Size, Value >::StaticArray()
-{
-}
-
-template< int Size, typename Value >
-   template< typename _unused >
+template< typename _unused >
 __cuda_callable__
 StaticArray< Size, Value >::StaticArray( const Value v[ Size ] )
 {
    Algorithms::unrolledFor< int, 0, Size >(
-      [&] ( int i ) mutable {
-         (*this)[ i ] = v[ i ];
-      }
-   );
+      [ & ]( int i ) mutable
+      {
+         ( *this )[ i ] = v[ i ];
+      } );
 }
 
 template< int Size, typename Value >
@@ -110,10 +110,10 @@ __cuda_callable__
 StaticArray< Size, Value >::StaticArray( const Value& v )
 {
    Algorithms::unrolledFor< int, 0, Size >(
-      [&] ( int i ) mutable {
-         (*this)[ i ] = v;
-      }
-   );
+      [ & ]( int i ) mutable
+      {
+         ( *this )[ i ] = v;
+      } );
 }
 
 template< int Size, typename Value >
@@ -121,23 +121,23 @@ __cuda_callable__
 StaticArray< Size, Value >::StaticArray( const StaticArray< Size, Value >& v )
 {
    Algorithms::unrolledFor< int, 0, Size >(
-      [&] ( int i ) mutable {
-         (*this)[ i ] = v[ i ];
-      }
-   );
+      [ & ]( int i ) mutable
+      {
+         ( *this )[ i ] = v[ i ];
+      } );
 }
 
 template< int Size, typename Value >
 __cuda_callable__
-StaticArray< Size, Value >::StaticArray( const std::initializer_list< Value > &elems)
+StaticArray< Size, Value >::StaticArray( const std::initializer_list< Value >& elems )
 {
-   auto it = elems.begin();
+   const auto* it = elems.begin();
    for( int i = 0; i < getSize(); i++ )
       data[ i ] = *it++;
 }
 
 template< int Size, typename Value >
- __cuda_callable__
+__cuda_callable__
 StaticArray< Size, Value >::StaticArray( const Value& v1, const Value& v2 )
 {
    static_assert( Size == 2, "This constructor can be called only for arrays with Size = 2." );
@@ -146,7 +146,7 @@ StaticArray< Size, Value >::StaticArray( const Value& v1, const Value& v2 )
 }
 
 template< int Size, typename Value >
- __cuda_callable__
+__cuda_callable__
 StaticArray< Size, Value >::StaticArray( const Value& v1, const Value& v2, const Value& v3 )
 {
    static_assert( Size == 3, "This constructor can be called only for arrays with Size = 3." );
@@ -157,21 +157,24 @@ StaticArray< Size, Value >::StaticArray( const Value& v1, const Value& v2, const
 
 template< int Size, typename Value >
 __cuda_callable__
-Value* StaticArray< Size, Value >::getData()
+Value*
+StaticArray< Size, Value >::getData()
 {
    return data;
 }
 
 template< int Size, typename Value >
 __cuda_callable__
-const Value* StaticArray< Size, Value >::getData() const
+const Value*
+StaticArray< Size, Value >::getData() const
 {
    return data;
 }
 
 template< int Size, typename Value >
 __cuda_callable__
-const Value& StaticArray< Size, Value >::operator[]( int i ) const
+const Value&
+StaticArray< Size, Value >::operator[]( int i ) const
 {
    TNL_ASSERT_GE( i, 0, "Element index must be non-negative." );
    TNL_ASSERT_LT( i, Size, "Element index is out of bounds." );
@@ -180,7 +183,8 @@ const Value& StaticArray< Size, Value >::operator[]( int i ) const
 
 template< int Size, typename Value >
 __cuda_callable__
-Value& StaticArray< Size, Value >::operator[]( int i )
+Value&
+StaticArray< Size, Value >::operator[]( int i )
 {
    TNL_ASSERT_GE( i, 0, "Element index must be non-negative." );
    TNL_ASSERT_LT( i, Size, "Element index is out of bounds." );
@@ -189,35 +193,40 @@ Value& StaticArray< Size, Value >::operator[]( int i )
 
 template< int Size, typename Value >
 __cuda_callable__
-const Value& StaticArray< Size, Value >::operator()( int i ) const
+const Value&
+StaticArray< Size, Value >::operator()( int i ) const
 {
    return operator[]( i );
 }
 
 template< int Size, typename Value >
 __cuda_callable__
-Value& StaticArray< Size, Value >::operator()( int i )
+Value&
+StaticArray< Size, Value >::operator()( int i )
 {
    return operator[]( i );
 }
 
 template< int Size, typename Value >
 __cuda_callable__
-Value& StaticArray< Size, Value >::x()
+Value&
+StaticArray< Size, Value >::x()
 {
    return data[ 0 ];
 }
 
 template< int Size, typename Value >
 __cuda_callable__
-const Value& StaticArray< Size, Value >::x() const
+const Value&
+StaticArray< Size, Value >::x() const
 {
    return data[ 0 ];
 }
 
 template< int Size, typename Value >
 __cuda_callable__
-Value& StaticArray< Size, Value >::y()
+Value&
+StaticArray< Size, Value >::y()
 {
    static_assert( Size > 1, "Cannot call StaticArray< Size, Value >::y() for arrays with Size < 2." );
    return data[ 1 ];
@@ -225,7 +234,8 @@ Value& StaticArray< Size, Value >::y()
 
 template< int Size, typename Value >
 __cuda_callable__
-const Value& StaticArray< Size, Value >::y() const
+const Value&
+StaticArray< Size, Value >::y() const
 {
    static_assert( Size > 1, "Cannot call StaticArray< Size, Value >::y() for arrays with Size < 2." );
    return data[ 1 ];
@@ -233,7 +243,8 @@ const Value& StaticArray< Size, Value >::y() const
 
 template< int Size, typename Value >
 __cuda_callable__
-Value& StaticArray< Size, Value >::z()
+Value&
+StaticArray< Size, Value >::z()
 {
    static_assert( Size > 1, "Cannot call StaticArray< Size, Value >::z() for arrays with Size < 3." );
    return data[ 2 ];
@@ -241,7 +252,8 @@ Value& StaticArray< Size, Value >::z()
 
 template< int Size, typename Value >
 __cuda_callable__
-const Value& StaticArray< Size, Value >::z() const
+const Value&
+StaticArray< Size, Value >::z() const
 {
    static_assert( Size > 1, "Cannot call StaticArray< Size, Value >::z() for arrays with Size < 3." );
    return data[ 2 ];
@@ -249,46 +261,49 @@ const Value& StaticArray< Size, Value >::z() const
 
 template< int Size, typename Value >
 __cuda_callable__
-StaticArray< Size, Value >& StaticArray< Size, Value >::operator=( const StaticArray< Size, Value >& array )
+StaticArray< Size, Value >&
+StaticArray< Size, Value >::operator=( const StaticArray< Size, Value >& array )
 {
    Algorithms::unrolledFor< int, 0, Size >(
-      [&] ( int i ) mutable {
-         (*this)[ i ] = array[ i ];
-      }
-   );
+      [ & ]( int i ) mutable
+      {
+         ( *this )[ i ] = array[ i ];
+      } );
    return *this;
 }
 
 template< int Size, typename Value >
-   template< typename T >
+template< typename T >
 __cuda_callable__
-StaticArray< Size, Value >& StaticArray< Size, Value >::operator=( const T& v )
+StaticArray< Size, Value >&
+StaticArray< Size, Value >::operator=( const T& v )
 {
    detail::StaticArrayAssignment< StaticArray, T >::assign( *this, v );
    return *this;
 }
 
 template< int Size, typename Value >
-   template< typename Array >
+template< typename Array >
 __cuda_callable__
-bool StaticArray< Size, Value >::operator==( const Array& array ) const
+bool
+StaticArray< Size, Value >::operator==( const Array& array ) const
 {
    return detail::StaticArrayComparator< Size, Value, typename Array::ValueType, 0 >::EQ( *this, array );
 }
 
 template< int Size, typename Value >
-   template< typename Array >
+template< typename Array >
 __cuda_callable__
-bool StaticArray< Size, Value >::operator!=( const Array& array ) const
+bool
+StaticArray< Size, Value >::operator!=( const Array& array ) const
 {
    return ! this->operator==( array );
 }
 
 template< int Size, typename Value >
-   template< typename OtherValue >
+template< typename OtherValue >
 __cuda_callable__
-StaticArray< Size, Value >::
-operator StaticArray< Size, OtherValue >() const
+StaticArray< Size, Value >::operator StaticArray< Size, OtherValue >() const
 {
    StaticArray< Size, OtherValue > aux;
    aux.operator=( *this );
@@ -297,37 +312,42 @@ operator StaticArray< Size, OtherValue >() const
 
 template< int Size, typename Value >
 __cuda_callable__
-void StaticArray< Size, Value >::setValue( const ValueType& val )
+void
+StaticArray< Size, Value >::setValue( const ValueType& val )
 {
    Algorithms::unrolledFor< int, 0, Size >(
-      [&] ( int i ) mutable {
-         (*this)[ i ] = val;
-      }
-   );
+      [ & ]( int i ) mutable
+      {
+         ( *this )[ i ] = val;
+      } );
 }
 
 template< int Size, typename Value >
-bool StaticArray< Size, Value >::save( File& file ) const
+bool
+StaticArray< Size, Value >::save( File& file ) const
 {
    file.save( getData(), Size );
    return true;
 }
 
 template< int Size, typename Value >
-bool StaticArray< Size, Value >::load( File& file)
+bool
+StaticArray< Size, Value >::load( File& file )
 {
    file.load( getData(), Size );
    return true;
 }
 
 template< int Size, typename Value >
-void StaticArray< Size, Value >::sort()
+void
+StaticArray< Size, Value >::sort()
 {
    detail::StaticArraySort< Size - 1, 0, Value >::exec( getData() );
 }
 
 template< int Size, typename Value >
-std::ostream& StaticArray< Size, Value >::write( std::ostream& str, const char* separator ) const
+std::ostream&
+StaticArray< Size, Value >::write( std::ostream& str, const char* separator ) const
 {
    for( int i = 0; i < Size - 1; i++ )
       str << data[ i ] << separator;
@@ -336,7 +356,8 @@ std::ostream& StaticArray< Size, Value >::write( std::ostream& str, const char*
 }
 
 template< int Size, typename Value >
-std::ostream& operator<<( std::ostream& str, const StaticArray< Size, Value >& a )
+std::ostream&
+operator<<( std::ostream& str, const StaticArray< Size, Value >& a )
 {
    str << "[ ";
    a.write( str, ", " );
@@ -346,7 +367,8 @@ std::ostream& operator<<( std::ostream& str, const StaticArray< Size, Value >& a
 
 // Serialization of arrays into binary files.
 template< int Size, typename Value >
-File& operator<<( File& file, const StaticArray< Size, Value >& array )
+File&
+operator<<( File& file, const StaticArray< Size, Value >& array )
 {
    for( int i = 0; i < Size; i++ )
       file.save( &array[ i ] );
@@ -354,7 +376,8 @@ File& operator<<( File& file, const StaticArray< Size, Value >& array )
 }
 
 template< int Size, typename Value >
-File& operator<<( File&& file, const StaticArray< Size, Value >& array )
+File&
+operator<<( File&& file, const StaticArray< Size, Value >& array )
 {
    File& f = file;
    return f << array;
@@ -362,7 +385,8 @@ File& operator<<( File&& file, const StaticArray< Size, Value >& array )
 
 // Deserialization of arrays from binary files.
 template< int Size, typename Value >
-File& operator>>( File& file, StaticArray< Size, Value >& array )
+File&
+operator>>( File& file, StaticArray< Size, Value >& array )
 {
    for( int i = 0; i < Size; i++ )
       file.load( &array[ i ] );
@@ -370,11 +394,12 @@ File& operator>>( File& file, StaticArray< Size, Value >& array )
 }
 
 template< int Size, typename Value >
-File& operator>>( File&& file, StaticArray< Size, Value >& array )
+File&
+operator>>( File&& file, StaticArray< Size, Value >& array )
 {
    File& f = file;
    return f >> array;
 }
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/StaticVector.h b/src/TNL/Containers/StaticVector.h
index ba1f639cb9eb4544396558de2908fcecbc2c7803..6549de274a713cae0ba1febc0330715007c0bf57 100644
--- a/src/TNL/Containers/StaticVector.h
+++ b/src/TNL/Containers/StaticVector.h
@@ -12,7 +12,7 @@
 namespace TNL {
 namespace Containers {
 
- /**
+/**
  * \brief Vector with constant size.
  *
  * \param Size Size of static vector. Number of its elements.
@@ -22,7 +22,6 @@ template< int Size, typename Real = double >
 class StaticVector : public StaticArray< Size, Real >
 {
 public:
-
    /**
     * \brief Type of numbers stored in this vector.
     */
@@ -49,17 +48,19 @@ public:
     * \brief Default copy-assignment operator.
     */
    __cuda_callable__
-   StaticVector& operator=( const StaticVector& ) = default;
+   StaticVector&
+   operator=( const StaticVector& ) = default;
 
    /**
     * \brief Default move-assignment operator.
     */
    __cuda_callable__
-   StaticVector& operator=( StaticVector&& ) = default;
+   StaticVector&
+   operator=( StaticVector&& ) noexcept = default;
 
    //! Constructors and assignment operators are inherited from the class \ref StaticArray.
    using StaticArray< Size, Real >::StaticArray;
-#if !defined(__CUDACC_VER_MAJOR__) || __CUDACC_VER_MAJOR__ < 11
+#if ! defined( __CUDACC_VER_MAJOR__ ) || __CUDACC_VER_MAJOR__ < 11
    using StaticArray< Size, Real >::operator=;
 #endif
 
@@ -68,9 +69,7 @@ public:
     *
     * \param expr is binary expression.
     */
-   template< typename T1,
-             typename T2,
-             typename Operation >
+   template< typename T1, typename T2, typename Operation >
    __cuda_callable__
    StaticVector( const Expressions::StaticBinaryExpressionTemplate< T1, T2, Operation >& expr );
 
@@ -79,8 +78,7 @@ public:
     *
     * \param expr is unary expression
     */
-   template< typename T,
-             typename Operation >
+   template< typename T, typename Operation >
    __cuda_callable__
    StaticVector( const Expressions::StaticUnaryExpressionTemplate< T, Operation >& expr );
 
@@ -94,7 +92,8 @@ public:
     */
    template< typename VectorExpression >
    __cuda_callable__
-   StaticVector& operator=( const VectorExpression& expression );
+   StaticVector&
+   operator=( const VectorExpression& expression );
 
    /**
     * \brief Addition operator with a vector expression
@@ -106,7 +105,8 @@ public:
     */
    template< typename VectorExpression >
    __cuda_callable__
-   StaticVector& operator+=( const VectorExpression& expression );
+   StaticVector&
+   operator+=( const VectorExpression& expression );
 
    /**
     * \brief Subtraction operator with a vector expression.
@@ -118,7 +118,8 @@ public:
     */
    template< typename VectorExpression >
    __cuda_callable__
-   StaticVector& operator-=( const VectorExpression& expression );
+   StaticVector&
+   operator-=( const VectorExpression& expression );
 
    /**
     * \brief Elementwise multiplication by a vector expression.
@@ -130,7 +131,8 @@ public:
     */
    template< typename VectorExpression >
    __cuda_callable__
-   StaticVector& operator*=( const VectorExpression& expression );
+   StaticVector&
+   operator*=( const VectorExpression& expression );
 
    /**
     * \brief Elementwise division by a vector expression.
@@ -142,7 +144,8 @@ public:
     */
    template< typename VectorExpression >
    __cuda_callable__
-   StaticVector& operator/=( const VectorExpression& expression );
+   StaticVector&
+   operator/=( const VectorExpression& expression );
 
    /**
     * \brief Elementwise modulo by a vector expression.
@@ -154,7 +157,8 @@ public:
     */
    template< typename VectorExpression >
    __cuda_callable__
-   StaticVector& operator%=( const VectorExpression& expression );
+   StaticVector&
+   operator%=( const VectorExpression& expression );
 
    /**
     * \brief Cast operator for changing of the \e Value type.
@@ -174,14 +178,13 @@ public:
 
 // Enable expression templates for StaticVector
 namespace Expressions {
-   template< int Size, typename Real >
-   struct HasEnabledStaticExpressionTemplates< StaticVector< Size, Real > >
-   : std::true_type
-   {};
-} // namespace Expressions
+template< int Size, typename Real >
+struct HasEnabledStaticExpressionTemplates< StaticVector< Size, Real > > : std::true_type
+{};
+}  // namespace Expressions
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
 
 #include <TNL/Containers/StaticVector.hpp>
 
@@ -191,8 +194,8 @@ namespace Containers {
 
 template< typename Real >
 __cuda_callable__
-StaticVector< 3, Real > VectorProduct( const StaticVector< 3, Real >& u,
-                                       const StaticVector< 3, Real >& v )
+StaticVector< 3, Real >
+VectorProduct( const StaticVector< 3, Real >& u, const StaticVector< 3, Real >& v )
 {
    StaticVector< 3, Real > p;
    p[ 0 ] = u[ 1 ] * v[ 2 ] - u[ 2 ] * v[ 1 ];
@@ -203,17 +206,17 @@ StaticVector< 3, Real > VectorProduct( const StaticVector< 3, Real >& u,
 
 template< typename Real >
 __cuda_callable__
-Real TriangleArea( const StaticVector< 2, Real >& a,
-                   const StaticVector< 2, Real >& b,
-                   const StaticVector< 2, Real >& c )
+Real
+TriangleArea( const StaticVector< 2, Real >& a, const StaticVector< 2, Real >& b, const StaticVector< 2, Real >& c )
 {
-   StaticVector< 3, Real > u1, u2;
-   u1. x() = b. x() - a. x();
-   u1. y() = b. y() - a. y();
-   u1. z() = 0.0;
-   u2. x() = c. x() - a. x();
-   u2. y() = c. y() - a. y();
-   u2. z() = 0;
+   StaticVector< 3, Real > u1;
+   StaticVector< 3, Real > u2;
+   u1.x() = b.x() - a.x();
+   u1.y() = b.y() - a.y();
+   u1.z() = 0.0;
+   u2.x() = c.x() - a.x();
+   u2.y() = c.y() - a.y();
+   u2.z() = 0;
 
    const StaticVector< 3, Real > v = VectorProduct( u1, u2 );
    return 0.5 * TNL::sqrt( dot( v, v ) );
@@ -221,21 +224,21 @@ Real TriangleArea( const StaticVector< 2, Real >& a,
 
 template< typename Real >
 __cuda_callable__
-Real TriangleArea( const StaticVector< 3, Real >& a,
-                   const StaticVector< 3, Real >& b,
-                   const StaticVector< 3, Real >& c )
+Real
+TriangleArea( const StaticVector< 3, Real >& a, const StaticVector< 3, Real >& b, const StaticVector< 3, Real >& c )
 {
-   StaticVector< 3, Real > u1, u2;
-   u1. x() = b. x() - a. x();
-   u1. y() = b. y() - a. y();
-   u1. z() = b. z() - a. z();
-   u2. x() = c. x() - a. x();
-   u2. y() = c. y() - a. y();
-   u2. z() = c. z() - a. z();
+   StaticVector< 3, Real > u1;
+   StaticVector< 3, Real > u2;
+   u1.x() = b.x() - a.x();
+   u1.y() = b.y() - a.y();
+   u1.z() = b.z() - a.z();
+   u2.x() = c.x() - a.x();
+   u2.y() = c.y() - a.y();
+   u2.z() = c.z() - a.z();
 
    const StaticVector< 3, Real > v = VectorProduct( u1, u2 );
    return 0.5 * TNL::sqrt( dot( v, v ) );
 }
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/StaticVector.hpp b/src/TNL/Containers/StaticVector.hpp
index ab5717136c36800db59016df7e96be39a8e1d771..b9186a4a37a78937d8a4c7a7c9ac4afe52c29c0a 100644
--- a/src/TNL/Containers/StaticVector.hpp
+++ b/src/TNL/Containers/StaticVector.hpp
@@ -13,27 +13,25 @@ namespace TNL {
 namespace Containers {
 
 template< int Size, typename Real >
-   template< typename T1,
-             typename T2,
-             typename Operation >
+template< typename T1, typename T2, typename Operation >
 __cuda_callable__
 StaticVector< Size, Real >::StaticVector( const Expressions::StaticBinaryExpressionTemplate< T1, T2, Operation >& expr )
 {
-   detail::VectorAssignment< StaticVector< Size, Real >, Expressions::StaticBinaryExpressionTemplate< T1, T2, Operation > >::assignStatic( *this, expr );
+   detail::VectorAssignment< StaticVector< Size, Real >,
+                             Expressions::StaticBinaryExpressionTemplate< T1, T2, Operation > >::assignStatic( *this, expr );
 }
 
-template< int Size,
-          typename Real >
-   template< typename T,
-             typename Operation >
+template< int Size, typename Real >
+template< typename T, typename Operation >
 __cuda_callable__
 StaticVector< Size, Real >::StaticVector( const Expressions::StaticUnaryExpressionTemplate< T, Operation >& expr )
 {
-   detail::VectorAssignment< StaticVector< Size, Real >, Expressions::StaticUnaryExpressionTemplate< T, Operation > >::assignStatic( *this, expr );
+   detail::VectorAssignment< StaticVector< Size, Real >,
+                             Expressions::StaticUnaryExpressionTemplate< T, Operation > >::assignStatic( *this, expr );
 }
 
 template< int Size, typename Real >
-   template< typename VectorExpression >
+template< typename VectorExpression >
 __cuda_callable__
 StaticVector< Size, Real >&
 StaticVector< Size, Real >::operator=( const VectorExpression& expression )
@@ -43,60 +41,64 @@ StaticVector< Size, Real >::operator=( const VectorExpression& expression )
 }
 
 template< int Size, typename Real >
-   template< typename VectorExpression >
+template< typename VectorExpression >
 __cuda_callable__
-StaticVector< Size, Real >& StaticVector< Size, Real >::operator+=( const VectorExpression& expression )
+StaticVector< Size, Real >&
+StaticVector< Size, Real >::operator+=( const VectorExpression& expression )
 {
    detail::VectorAssignmentWithOperation< StaticVector, VectorExpression >::additionStatic( *this, expression );
    return *this;
 }
 
 template< int Size, typename Real >
-   template< typename VectorExpression >
+template< typename VectorExpression >
 __cuda_callable__
-StaticVector< Size, Real >& StaticVector< Size, Real >::operator-=( const VectorExpression& expression )
+StaticVector< Size, Real >&
+StaticVector< Size, Real >::operator-=( const VectorExpression& expression )
 {
    detail::VectorAssignmentWithOperation< StaticVector, VectorExpression >::subtractionStatic( *this, expression );
    return *this;
 }
 
 template< int Size, typename Real >
-   template< typename VectorExpression >
+template< typename VectorExpression >
 __cuda_callable__
-StaticVector< Size, Real >& StaticVector< Size, Real >::operator*=( const VectorExpression& expression )
+StaticVector< Size, Real >&
+StaticVector< Size, Real >::operator*=( const VectorExpression& expression )
 {
    detail::VectorAssignmentWithOperation< StaticVector, VectorExpression >::multiplicationStatic( *this, expression );
    return *this;
 }
 
 template< int Size, typename Real >
-   template< typename VectorExpression >
+template< typename VectorExpression >
 __cuda_callable__
-StaticVector< Size, Real >& StaticVector< Size, Real >::operator/=( const VectorExpression& expression )
+StaticVector< Size, Real >&
+StaticVector< Size, Real >::operator/=( const VectorExpression& expression )
 {
    detail::VectorAssignmentWithOperation< StaticVector, VectorExpression >::divisionStatic( *this, expression );
    return *this;
 }
 
 template< int Size, typename Real >
-   template< typename VectorExpression >
+template< typename VectorExpression >
 __cuda_callable__
-StaticVector< Size, Real >& StaticVector< Size, Real >::operator%=( const VectorExpression& expression )
+StaticVector< Size, Real >&
+StaticVector< Size, Real >::operator%=( const VectorExpression& expression )
 {
    detail::VectorAssignmentWithOperation< StaticVector, VectorExpression >::moduloStatic( *this, expression );
    return *this;
 }
 
 template< int Size, typename Real >
-   template< typename OtherReal >
+template< typename OtherReal >
 __cuda_callable__
-StaticVector< Size, Real >::
-operator StaticVector< Size, OtherReal >() const
+StaticVector< Size, Real >::operator StaticVector< Size, OtherReal >() const
 {
    StaticVector< Size, OtherReal > aux;
    aux.operator=( *this );
    return aux;
 }
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/Subrange.h b/src/TNL/Containers/Subrange.h
index 2efa9d202883be19ca7fe0a03c7cf74d69bd59a2..83c3d9b0d67e36a87ab1656f3a56ccaea3a4bc7a 100644
--- a/src/TNL/Containers/Subrange.h
+++ b/src/TNL/Containers/Subrange.h
@@ -35,7 +35,8 @@ public:
 
    // Sets the local subrange and global range size.
    __cuda_callable__
-   void setSubrange( Index begin, Index end )
+   void
+   setSubrange( Index begin, Index end )
    {
       TNL_ASSERT_LE( begin, end, "begin must be before end" );
       TNL_ASSERT_GE( begin, 0, "begin must be non-negative" );
@@ -44,7 +45,8 @@ public:
    }
 
    __cuda_callable__
-   void reset()
+   void
+   reset()
    {
       begin = 0;
       end = 0;
@@ -52,35 +54,40 @@ public:
 
    // Checks if a global index is in the set of local indices.
    __cuda_callable__
-   bool isLocal( Index i ) const
+   bool
+   isLocal( Index i ) const
    {
       return begin <= i && i < end;
    }
 
    // Gets the begin of the subrange.
    __cuda_callable__
-   Index getBegin() const
+   Index
+   getBegin() const
    {
       return begin;
    }
 
    // Gets the begin of the subrange.
    __cuda_callable__
-   Index getEnd() const
+   Index
+   getEnd() const
    {
       return end;
    }
 
    // Gets number of local indices.
    __cuda_callable__
-   Index getSize() const
+   Index
+   getSize() const
    {
       return end - begin;
    }
 
    // Gets local index for given global index.
    __cuda_callable__
-   Index getLocalIndex( Index i ) const
+   Index
+   getLocalIndex( Index i ) const
    {
       TNL_ASSERT_GE( i, getBegin(), "Given global index was not found in the local index set." );
       TNL_ASSERT_LT( i, getEnd(), "Given global index was not found in the local index set." );
@@ -89,7 +96,8 @@ public:
 
    // Gets global index for given local index.
    __cuda_callable__
-   Index getGlobalIndex( Index i ) const
+   Index
+   getGlobalIndex( Index i ) const
    {
       TNL_ASSERT_GE( i, 0, "Given local index was not found in the local index set." );
       TNL_ASSERT_LT( i, getSize(), "Given local index was not found in the local index set." );
@@ -97,16 +105,17 @@ public:
    }
 
    __cuda_callable__
-   bool operator==( const Subrange& other ) const
+   bool
+   operator==( const Subrange& other ) const
    {
-      return begin == other.begin &&
-             end == other.end;
+      return begin == other.begin && end == other.end;
    }
 
    __cuda_callable__
-   bool operator!=( const Subrange& other ) const
+   bool
+   operator!=( const Subrange& other ) const
    {
-      return ! (*this == other);
+      return ! ( *this == other );
    }
 
 protected:
@@ -116,10 +125,11 @@ protected:
 
 // due to formatting in TNL::Assert
 template< typename Index >
-std::ostream& operator<<( std::ostream& str, const Subrange< Index >& range )
+std::ostream&
+operator<<( std::ostream& str, const Subrange< Index >& range )
 {
    return str << getType< Subrange< Index > >() << "( " << range.getBegin() << ", " << range.getEnd() << " )";
 }
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/UnorderedIndexedSet.h b/src/TNL/Containers/UnorderedIndexedSet.h
index b071bd76777fed07c24cc969a1538253237f60af..75ddb79a712496abe06411727827d61df3f5066c 100644
--- a/src/TNL/Containers/UnorderedIndexedSet.h
+++ b/src/TNL/Containers/UnorderedIndexedSet.h
@@ -16,7 +16,7 @@ template< class Key,
           class Index,
           class Hash = std::hash< Key >,
           class KeyEqual = std::equal_to< Key >,
-          class Allocator = std::allocator< std::pair<const Key, Index> > >
+          class Allocator = std::allocator< std::pair< const Key, Index > > >
 class UnorderedIndexedSet
 {
 protected:
@@ -32,41 +32,55 @@ public:
    using const_iterator = typename map_type::const_iterator;
    using hasher = Hash;
    using key_equal = KeyEqual;
-   
-   void clear();
 
-   size_type size() const;
+   void
+   clear();
 
-   Index insert( const Key& key );
+   size_type
+   size() const;
 
-   Index insert( Key&& key );
+   Index
+   insert( const Key& key );
 
-   std::pair< Index, bool > try_insert( const Key& key );
+   Index
+   insert( Key&& key );
 
-   bool find( const Key& key, Index& index ) const;
+   std::pair< Index, bool >
+   try_insert( const Key& key );
 
-   void reserve( size_type count );
+   bool
+   find( const Key& key, Index& index ) const;
 
-   size_type count( const Key& key ) const;
+   void
+   reserve( size_type count );
 
-   size_type erase( const Key& key );
+   size_type
+   count( const Key& key ) const;
 
-   void print( std::ostream& str ) const;
+   size_type
+   erase( const Key& key );
 
-   iterator begin();
+   void
+   print( std::ostream& str ) const;
 
-   const_iterator begin() const;
+   iterator
+   begin();
 
-   iterator end();
+   const_iterator
+   begin() const;
 
-   const_iterator end() const;
+   iterator
+   end();
+
+   const_iterator
+   end() const;
 };
 
-template< typename Element,
-          typename Index >
-std::ostream& operator <<( std::ostream& str, UnorderedIndexedSet< Element, Index >& set );
+template< typename Element, typename Index >
+std::ostream&
+operator<<( std::ostream& str, UnorderedIndexedSet< Element, Index >& set );
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
 
 #include <TNL/Containers/UnorderedIndexedSet.hpp>
diff --git a/src/TNL/Containers/UnorderedIndexedSet.hpp b/src/TNL/Containers/UnorderedIndexedSet.hpp
index e1ec638c9dea319897e73b85941bae0941e14976..e9328cff0ad3e24fd04b852ad9c1b595394002c5 100644
--- a/src/TNL/Containers/UnorderedIndexedSet.hpp
+++ b/src/TNL/Containers/UnorderedIndexedSet.hpp
@@ -11,33 +11,21 @@
 namespace TNL {
 namespace Containers {
 
-template< class Key,
-          class Index,
-          class Hash,
-          class KeyEqual,
-          class Allocator >
+template< class Key, class Index, class Hash, class KeyEqual, class Allocator >
 void
 UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::clear()
 {
    map.clear();
 }
 
-template< class Key,
-          class Index,
-          class Hash,
-          class KeyEqual,
-          class Allocator >
+template< class Key, class Index, class Hash, class KeyEqual, class Allocator >
 typename UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::size_type
 UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::size() const
 {
    return map.size();
 }
 
-template< class Key,
-          class Index,
-          class Hash,
-          class KeyEqual,
-          class Allocator >
+template< class Key, class Index, class Hash, class KeyEqual, class Allocator >
 Index
 UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::insert( const Key& key )
 {
@@ -45,11 +33,7 @@ UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::insert( const Key&
    return iter->second;
 }
 
-template< class Key,
-          class Index,
-          class Hash,
-          class KeyEqual,
-          class Allocator >
+template< class Key, class Index, class Hash, class KeyEqual, class Allocator >
 Index
 UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::insert( Key&& key )
 {
@@ -57,11 +41,7 @@ UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::insert( Key&& key
    return iter->second;
 }
 
-template< class Key,
-          class Index,
-          class Hash,
-          class KeyEqual,
-          class Allocator >
+template< class Key, class Index, class Hash, class KeyEqual, class Allocator >
 std::pair< Index, bool >
 UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::try_insert( const Key& key )
 {
@@ -69,11 +49,7 @@ UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::try_insert( const
    return std::pair< Index, bool >{ pair.first->second, pair.second };
 }
 
-template< class Key,
-          class Index,
-          class Hash,
-          class KeyEqual,
-          class Allocator >
+template< class Key, class Index, class Hash, class KeyEqual, class Allocator >
 bool
 UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::find( const Key& key, Index& index ) const
 {
@@ -84,110 +60,75 @@ UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::find( const Key& k
    return true;
 }
 
-template< class Key,
-          class Index,
-          class Hash,
-          class KeyEqual,
-          class Allocator >
+template< class Key, class Index, class Hash, class KeyEqual, class Allocator >
 void
 UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::reserve( size_type count )
 {
    map.reserve( count );
 }
 
-template< class Key,
-          class Index,
-          class Hash,
-          class KeyEqual,
-          class Allocator >
+template< class Key, class Index, class Hash, class KeyEqual, class Allocator >
 typename UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::size_type
 UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::count( const Key& key ) const
 {
    return map.count( key );
 }
 
-template< class Key,
-          class Index,
-          class Hash,
-          class KeyEqual,
-          class Allocator >
+template< class Key, class Index, class Hash, class KeyEqual, class Allocator >
 typename UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::size_type
 UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::erase( const Key& key )
 {
    return map.erase( key );
 }
 
-template< class Key,
-          class Index,
-          class Hash,
-          class KeyEqual,
-          class Allocator >
-void UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::print( std::ostream& str ) const
+template< class Key, class Index, class Hash, class KeyEqual, class Allocator >
+void
+UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::print( std::ostream& str ) const
 {
    auto iter = map.begin();
    str << iter->second.data;
    iter++;
-   while( iter != map.end() )
-   {
+   while( iter != map.end() ) {
       str << ", " << iter->second.data;
       iter++;
    }
 }
 
-template< class Key,
-          class Index,
-          class Hash,
-          class KeyEqual,
-          class Allocator >
+template< class Key, class Index, class Hash, class KeyEqual, class Allocator >
 typename UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::iterator
 UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::begin()
 {
    return map.begin();
 }
 
-template< class Key,
-          class Index,
-          class Hash,
-          class KeyEqual,
-          class Allocator >
+template< class Key, class Index, class Hash, class KeyEqual, class Allocator >
 typename UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::const_iterator
 UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::begin() const
 {
    return map.begin();
 }
 
-template< class Key,
-          class Index,
-          class Hash,
-          class KeyEqual,
-          class Allocator >
+template< class Key, class Index, class Hash, class KeyEqual, class Allocator >
 typename UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::iterator
 UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::end()
 {
    return map.end();
 }
 
-template< class Key,
-          class Index,
-          class Hash,
-          class KeyEqual,
-          class Allocator >
+template< class Key, class Index, class Hash, class KeyEqual, class Allocator >
 typename UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::const_iterator
 UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >::end() const
 {
    return map.end();
 }
 
-template< class Key,
-          class Index,
-          class Hash,
-          class KeyEqual,
-          class Allocator >
-std::ostream& operator<<( std::ostream& str, UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >& set )
+template< class Key, class Index, class Hash, class KeyEqual, class Allocator >
+std::ostream&
+operator<<( std::ostream& str, UnorderedIndexedSet< Key, Index, Hash, KeyEqual, Allocator >& set )
 {
    set.print( str );
    return str;
 }
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/Vector.h b/src/TNL/Containers/Vector.h
index 05aa99048ec2f1ba25d62589de2062354af4737b..25e8b67781e56c233f1b67bde816035859aec18b 100644
--- a/src/TNL/Containers/Vector.h
+++ b/src/TNL/Containers/Vector.h
@@ -36,8 +36,7 @@ template< typename Real = double,
           typename Device = Devices::Host,
           typename Index = int,
           typename Allocator = typename Allocators::Default< Device >::template Allocator< Real > >
-class Vector
-: public Array< Real, Device, Index, Allocator >
+class Vector : public Array< Real, Device, Index, Allocator >
 {
 public:
    /**
@@ -60,7 +59,8 @@ public:
    /**
     * \brief Allocator type used for allocating this vector.
     *
-    * See \ref Allocators::Cuda, \ref Allocators::CudaHost, \ref Allocators::CudaManaged, \ref Allocators::Host or \ref Allocators:Default.
+    * See \ref Allocators::Cuda, \ref Allocators::CudaHost, \ref Allocators::CudaManaged, \ref Allocators::Host or \ref
+    * Allocators:Default.
     */
    using AllocatorType = Allocator;
 
@@ -83,7 +83,6 @@ public:
              typename _Allocator = typename Allocators::Default< _Device >::template Allocator< _Real > >
    using Self = Vector< _Real, _Device, _Index, _Allocator >;
 
-
    // constructors and assignment operators inherited from the class Array
    using Array< Real, Device, Index, Allocator >::Array;
    using Array< Real, Device, Index, Allocator >::operator=;
@@ -106,7 +105,7 @@ public:
    /**
     * \brief Default move constructor.
     */
-   Vector( Vector&& ) = default;
+   Vector( Vector&& ) noexcept = default;
 
    /**
     * \brief Constructor from expression template
@@ -115,18 +114,21 @@ public:
     */
    template< typename VectorExpression,
              typename...,
-             typename = std::enable_if_t< Expressions::HasEnabledExpressionTemplates< VectorExpression >::value && ! IsArrayType< VectorExpression >::value > >
+             typename = std::enable_if_t< Expressions::HasEnabledExpressionTemplates< VectorExpression >::value
+                                          && ! IsArrayType< VectorExpression >::value > >
    explicit Vector( const VectorExpression& expression );
 
    /**
     * \brief Copy-assignment operator for copying data from another vector.
     */
-   Vector& operator=( const Vector& ) = default;
+   Vector&
+   operator=( const Vector& ) = default;
 
    /**
     * \brief Move-assignment operator for acquiring data from \e rvalues.
     */
-   Vector& operator=( Vector&& ) = default;
+   Vector&
+   operator=( Vector&& ) noexcept = default;
 
    /**
     * \brief Returns a modifiable view of the vector.
@@ -140,7 +142,8 @@ public:
     * \param end The end of the vector sub-interval. The default value is 0
     *            which is, however, replaced with the array size.
     */
-   ViewType getView( IndexType begin = 0, IndexType end = 0 );
+   ViewType
+   getView( IndexType begin = 0, IndexType end = 0 );
 
    /**
     * \brief Returns a non-modifiable view of the vector.
@@ -154,7 +157,8 @@ public:
     * \param end The end of the vector sub-interval. The default value is 0
     *            which is, however, replaced with the array size.
     */
-   ConstViewType getConstView( IndexType begin = 0, IndexType end = 0 ) const;
+   ConstViewType
+   getConstView( IndexType begin = 0, IndexType end = 0 ) const;
 
    /**
     * \brief Conversion operator to a modifiable view of the vector.
@@ -180,8 +184,10 @@ public:
     */
    template< typename VectorExpression,
              typename...,
-             typename = std::enable_if_t< Expressions::HasEnabledExpressionTemplates< VectorExpression >::value && ! IsArrayType< VectorExpression >::value > >
-   Vector& operator=( const VectorExpression& expression );
+             typename = std::enable_if_t< Expressions::HasEnabledExpressionTemplates< VectorExpression >::value
+                                          && ! IsArrayType< VectorExpression >::value > >
+   Vector&
+   operator=( const VectorExpression& expression );
 
    /**
     * \brief Assigns a value or an array - same as \ref Array::operator=.
@@ -190,14 +196,14 @@ public:
     */
    // operator= from the base class should be hidden according to the C++14 standard,
    // although GCC does not do that - see https://stackoverflow.com/q/57322624
-#if !defined(__CUDACC_VER_MAJOR__) || __CUDACC_VER_MAJOR__ < 11
+#if ! defined( __CUDACC_VER_MAJOR__ ) || __CUDACC_VER_MAJOR__ < 11
    template< typename T,
              typename...,
              typename = std::enable_if_t< std::is_convertible< T, Real >::value || IsArrayType< T >::value > >
    Array< Real, Device, Index, Allocator >&
    operator=( const T& data )
    {
-      return Array< Real, Device, Index, Allocator >::operator=(data);
+      return Array< Real, Device, Index, Allocator >::operator=( data );
    }
 #endif
 
@@ -212,7 +218,8 @@ public:
     * \return Reference to this vector.
     */
    template< typename VectorExpression >
-   Vector& operator+=( const VectorExpression& expression );
+   Vector&
+   operator+=( const VectorExpression& expression );
 
    /**
     * \brief Subtracts elements of this vector and a vector expression and
@@ -225,7 +232,8 @@ public:
     * \return Reference to this vector.
     */
    template< typename VectorExpression >
-   Vector& operator-=( const VectorExpression& expression );
+   Vector&
+   operator-=( const VectorExpression& expression );
 
    /**
     * \brief Multiplies elements of this vector and a vector expression and
@@ -238,7 +246,8 @@ public:
     * \return Reference to this vector.
     */
    template< typename VectorExpression >
-   Vector& operator*=( const VectorExpression& expression );
+   Vector&
+   operator*=( const VectorExpression& expression );
 
    /**
     * \brief Divides elements of this vector and a vector expression and
@@ -251,7 +260,8 @@ public:
     * \return Reference to this vector.
     */
    template< typename VectorExpression >
-   Vector& operator/=( const VectorExpression& expression );
+   Vector&
+   operator/=( const VectorExpression& expression );
 
    /**
     * \brief Modulo assignment operator for vector and a vector expression.
@@ -263,18 +273,18 @@ public:
     * \return Reference to this vector.
     */
    template< typename VectorExpression >
-   Vector& operator%=( const VectorExpression& expression );
+   Vector&
+   operator%=( const VectorExpression& expression );
 };
 
 // Enable expression templates for Vector
 namespace Expressions {
-   template< typename Real, typename Device, typename Index, typename Allocator >
-   struct HasEnabledExpressionTemplates< Vector< Real, Device, Index, Allocator > >
-   : std::true_type
-   {};
-} // namespace Expressions
-
-} // namespace Containers
-} // namespace TNL
+template< typename Real, typename Device, typename Index, typename Allocator >
+struct HasEnabledExpressionTemplates< Vector< Real, Device, Index, Allocator > > : std::true_type
+{};
+}  // namespace Expressions
+
+}  // namespace Containers
+}  // namespace TNL
 
 #include <TNL/Containers/Vector.hpp>
diff --git a/src/TNL/Containers/Vector.hpp b/src/TNL/Containers/Vector.hpp
index 82e0e678b3f47b88f111e951833eae6e215db846..12d2d4337c5bbdbf73147763d792b4de7827fd3a 100644
--- a/src/TNL/Containers/Vector.hpp
+++ b/src/TNL/Containers/Vector.hpp
@@ -11,155 +11,103 @@
 namespace TNL {
 namespace Containers {
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
-Vector< Real, Device, Index, Allocator >::
-Vector( const Vector& vector,
-        const AllocatorType& allocator )
+template< typename Real, typename Device, typename Index, typename Allocator >
+Vector< Real, Device, Index, Allocator >::Vector( const Vector& vector, const AllocatorType& allocator )
 : Array< Real, Device, Index, Allocator >( vector, allocator )
-{
-}
+{}
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename VectorExpression,
-             typename...,
-             typename >
-Vector< Real, Device, Index, Allocator >::
-Vector( const VectorExpression& expression )
+template< typename Real, typename Device, typename Index, typename Allocator >
+template< typename VectorExpression, typename..., typename >
+Vector< Real, Device, Index, Allocator >::Vector( const VectorExpression& expression )
 {
    detail::VectorAssignment< Vector, VectorExpression >::resize( *this, expression );
    detail::VectorAssignment< Vector, VectorExpression >::assign( *this, expression );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Real, typename Device, typename Index, typename Allocator >
 typename Vector< Real, Device, Index, Allocator >::ViewType
-Vector< Real, Device, Index, Allocator >::
-getView( IndexType begin, IndexType end )
+Vector< Real, Device, Index, Allocator >::getView( IndexType begin, IndexType end )
 {
    if( end == 0 )
       end = this->getSize();
    return ViewType( this->getData() + begin, end - begin );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
+template< typename Real, typename Device, typename Index, typename Allocator >
 typename Vector< Real, Device, Index, Allocator >::ConstViewType
-Vector< Real, Device, Index, Allocator >::
-getConstView( IndexType begin, IndexType end ) const
+Vector< Real, Device, Index, Allocator >::getConstView( IndexType begin, IndexType end ) const
 {
    if( end == 0 )
       end = this->getSize();
    return ConstViewType( this->getData() + begin, end - begin );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
-Vector< Real, Device, Index, Allocator >::
-operator ViewType()
+template< typename Real, typename Device, typename Index, typename Allocator >
+Vector< Real, Device, Index, Allocator >::operator ViewType()
 {
    return getView();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
-Vector< Real, Device, Index, Allocator >::
-operator ConstViewType() const
+template< typename Real, typename Device, typename Index, typename Allocator >
+Vector< Real, Device, Index, Allocator >::operator ConstViewType() const
 {
    return getConstView();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename VectorExpression, typename..., typename >
+template< typename Real, typename Device, typename Index, typename Allocator >
+template< typename VectorExpression, typename..., typename >
 Vector< Real, Device, Index, Allocator >&
-Vector< Real, Device, Index, Allocator >::
-operator=( const VectorExpression& expression )
+Vector< Real, Device, Index, Allocator >::operator=( const VectorExpression& expression )
 {
    detail::VectorAssignment< Vector, VectorExpression >::resize( *this, expression );
    detail::VectorAssignment< Vector, VectorExpression >::assign( *this, expression );
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename VectorExpression >
+template< typename Real, typename Device, typename Index, typename Allocator >
+template< typename VectorExpression >
 Vector< Real, Device, Index, Allocator >&
-Vector< Real, Device, Index, Allocator >::
-operator+=( const VectorExpression& expression )
+Vector< Real, Device, Index, Allocator >::operator+=( const VectorExpression& expression )
 {
    detail::VectorAssignmentWithOperation< Vector, VectorExpression >::addition( *this, expression );
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename VectorExpression >
+template< typename Real, typename Device, typename Index, typename Allocator >
+template< typename VectorExpression >
 Vector< Real, Device, Index, Allocator >&
-Vector< Real, Device, Index, Allocator >::
-operator-=( const VectorExpression& expression )
+Vector< Real, Device, Index, Allocator >::operator-=( const VectorExpression& expression )
 {
    detail::VectorAssignmentWithOperation< Vector, VectorExpression >::subtraction( *this, expression );
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename VectorExpression >
+template< typename Real, typename Device, typename Index, typename Allocator >
+template< typename VectorExpression >
 Vector< Real, Device, Index, Allocator >&
-Vector< Real, Device, Index, Allocator >::
-operator*=( const VectorExpression& expression )
+Vector< Real, Device, Index, Allocator >::operator*=( const VectorExpression& expression )
 {
    detail::VectorAssignmentWithOperation< Vector, VectorExpression >::multiplication( *this, expression );
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename VectorExpression >
+template< typename Real, typename Device, typename Index, typename Allocator >
+template< typename VectorExpression >
 Vector< Real, Device, Index, Allocator >&
-Vector< Real, Device, Index, Allocator >::
-operator/=( const VectorExpression& expression )
+Vector< Real, Device, Index, Allocator >::operator/=( const VectorExpression& expression )
 {
    detail::VectorAssignmentWithOperation< Vector, VectorExpression >::division( *this, expression );
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Allocator >
-   template< typename VectorExpression >
+template< typename Real, typename Device, typename Index, typename Allocator >
+template< typename VectorExpression >
 Vector< Real, Device, Index, Allocator >&
-Vector< Real, Device, Index, Allocator >::
-operator%=( const VectorExpression& expression )
+Vector< Real, Device, Index, Allocator >::operator%=( const VectorExpression& expression )
 {
    detail::VectorAssignmentWithOperation< Vector, VectorExpression >::modulo( *this, expression );
    return *this;
 }
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/VectorView.h b/src/TNL/Containers/VectorView.h
index 4e3f38d59fa1a0d25beb8f4ee0f96dbcf6c4b35c..583537a2389c3e7d6e9fc8fda56c400ebf1f5989 100644
--- a/src/TNL/Containers/VectorView.h
+++ b/src/TNL/Containers/VectorView.h
@@ -25,14 +25,12 @@ namespace Containers {
  * \tparam Device The device to be used for the execution of vector operations.
  * \tparam Index  The indexing type.
  */
-template< typename Real = double,
-          typename Device = Devices::Host,
-          typename Index = int >
-class VectorView
-: public ArrayView< Real, Device, Index >
+template< typename Real = double, typename Device = Devices::Host, typename Index = int >
+class VectorView : public ArrayView< Real, Device, Index >
 {
    using BaseType = ArrayView< Real, Device, Index >;
    using NonConstReal = typename std::remove_const< Real >::type;
+
 public:
    /**
     * \brief Type of elements stored in this vector.
@@ -64,12 +62,9 @@ public:
    /**
     * \brief A template which allows to quickly obtain a \ref VectorView type with changed template parameters.
     */
-   template< typename _Real,
-             typename _Device = Device,
-             typename _Index = Index >
+   template< typename _Real, typename _Device = Device, typename _Index = Index >
    using Self = VectorView< _Real, _Device, _Index >;
 
-
    // constructors and assignment operators inherited from the class ArrayView
    using ArrayView< Real, Device, Index >::ArrayView;
    using ArrayView< Real, Device, Index >::operator=;
@@ -87,8 +82,7 @@ public:
    // initialization by base class is not a copy constructor so it has to be explicit
    template< typename Real_ >  // template catches both const and non-const qualified Element
    __cuda_callable__
-   VectorView( const ArrayView< Real_, Device, Index >& view )
-   : BaseType( view ) {}
+   VectorView( const ArrayView< Real_, Device, Index >& view ) : BaseType( view ) {}
 
    /**
     * \brief Returns a modifiable view of the vector view.
@@ -103,7 +97,8 @@ public:
     *            which is, however, replaced with the array size.
     */
    __cuda_callable__
-   ViewType getView( IndexType begin = 0, IndexType end = 0 );
+   ViewType
+   getView( IndexType begin = 0, IndexType end = 0 );
 
    /**
     * \brief Returns a non-modifiable view of the vector view.
@@ -118,7 +113,8 @@ public:
     *            which is, however, replaced with the array size.
     */
    __cuda_callable__
-   ConstViewType getConstView( IndexType begin = 0, IndexType end = 0 ) const;
+   ConstViewType
+   getConstView( IndexType begin = 0, IndexType end = 0 ) const;
 
    /**
     * \brief Assigns a vector expression to this vector view.
@@ -133,8 +129,10 @@ public:
     */
    template< typename VectorExpression,
              typename...,
-             typename = std::enable_if_t< Expressions::HasEnabledExpressionTemplates< VectorExpression >::value && ! IsArrayType< VectorExpression >::value > >
-   VectorView& operator=( const VectorExpression& expression );
+             typename = std::enable_if_t< Expressions::HasEnabledExpressionTemplates< VectorExpression >::value
+                                          && ! IsArrayType< VectorExpression >::value > >
+   VectorView&
+   operator=( const VectorExpression& expression );
 
    /**
     * \brief Assigns a value or an array - same as \ref ArrayView::operator=.
@@ -143,14 +141,14 @@ public:
     */
    // operator= from the base class should be hidden according to the C++14 standard,
    // although GCC does not do that - see https://stackoverflow.com/q/57322624
-#if !defined(__CUDACC_VER_MAJOR__) || __CUDACC_VER_MAJOR__ < 11
+#if ! defined( __CUDACC_VER_MAJOR__ ) || __CUDACC_VER_MAJOR__ < 11
    template< typename T,
              typename...,
              typename = std::enable_if_t< std::is_convertible< T, Real >::value || IsArrayType< T >::value > >
    ArrayView< Real, Device, Index >&
    operator=( const T& data )
    {
-      return ArrayView< Real, Device, Index >::operator=(data);
+      return ArrayView< Real, Device, Index >::operator=( data );
    }
 #endif
 
@@ -166,7 +164,8 @@ public:
     * \return Reference to this vector view.
     */
    template< typename VectorExpression >
-   VectorView& operator+=( const VectorExpression& expression );
+   VectorView&
+   operator+=( const VectorExpression& expression );
 
    /**
     * \brief Subtracts elements of this vector view and a vector expression and
@@ -180,7 +179,8 @@ public:
     * \return Reference to this vector view.
     */
    template< typename VectorExpression >
-   VectorView& operator-=( const VectorExpression& expression );
+   VectorView&
+   operator-=( const VectorExpression& expression );
 
    /**
     * \brief Multiplies elements of this vector view and a vector expression and
@@ -194,7 +194,8 @@ public:
     * \return Reference to this vector view.
     */
    template< typename VectorExpression >
-   VectorView& operator*=( const VectorExpression& expression );
+   VectorView&
+   operator*=( const VectorExpression& expression );
 
    /**
     * \brief Divides elements of this vector view and a vector expression and
@@ -208,7 +209,8 @@ public:
     * \return Reference to this vector view.
     */
    template< typename VectorExpression >
-   VectorView& operator/=( const VectorExpression& expression );
+   VectorView&
+   operator/=( const VectorExpression& expression );
 
    /**
     * \brief Modulo assignment operator for vector view and a vector expression.
@@ -221,18 +223,18 @@ public:
     * \return Reference to this vector.
     */
    template< typename VectorExpression >
-   VectorView& operator%=( const VectorExpression& expression );
+   VectorView&
+   operator%=( const VectorExpression& expression );
 };
 
 // Enable expression templates for VectorView
 namespace Expressions {
-   template< typename Real, typename Device, typename Index >
-   struct HasEnabledExpressionTemplates< VectorView< Real, Device, Index > >
-   : std::true_type
-   {};
-} // namespace Expressions
-
-} // namespace Containers
-} // namespace TNL
+template< typename Real, typename Device, typename Index >
+struct HasEnabledExpressionTemplates< VectorView< Real, Device, Index > > : std::true_type
+{};
+}  // namespace Expressions
+
+}  // namespace Containers
+}  // namespace TNL
 
 #include <TNL/Containers/VectorView.hpp>
diff --git a/src/TNL/Containers/VectorView.hpp b/src/TNL/Containers/VectorView.hpp
index 19d8ecbe02737d63d0d9a87447ffbbe984ced1bd..bc993be309330aa74a2b8cd9196d02f246bd7c7c 100644
--- a/src/TNL/Containers/VectorView.hpp
+++ b/src/TNL/Containers/VectorView.hpp
@@ -12,36 +12,30 @@
 namespace TNL {
 namespace Containers {
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
 typename VectorView< Real, Device, Index >::ViewType
-VectorView< Real, Device, Index >::
-getView( IndexType begin, IndexType end )
+VectorView< Real, Device, Index >::getView( IndexType begin, IndexType end )
 {
    if( end == 0 )
       end = this->getSize();
-   return ViewType( this->getData() + begin, end - begin );;
+   return ViewType( this->getData() + begin, end - begin );
+   ;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
 typename VectorView< Real, Device, Index >::ConstViewType
-VectorView< Real, Device, Index >::
-getConstView( const IndexType begin, IndexType end ) const
+VectorView< Real, Device, Index >::getConstView( const IndexType begin, IndexType end ) const
 {
    if( end == 0 )
       end = this->getSize();
-   return ConstViewType( this->getData() + begin, end - begin );;
+   return ConstViewType( this->getData() + begin, end - begin );
+   ;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename VectorExpression, typename..., typename >
+template< typename Real, typename Device, typename Index >
+template< typename VectorExpression, typename..., typename >
 VectorView< Real, Device, Index >&
 VectorView< Real, Device, Index >::operator=( const VectorExpression& expression )
 {
@@ -49,65 +43,50 @@ VectorView< Real, Device, Index >::operator=( const VectorExpression& expression
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename VectorExpression >
+template< typename Real, typename Device, typename Index >
+template< typename VectorExpression >
 VectorView< Real, Device, Index >&
-VectorView< Real, Device, Index >::
-operator+=( const VectorExpression& expression )
+VectorView< Real, Device, Index >::operator+=( const VectorExpression& expression )
 {
    detail::VectorAssignmentWithOperation< VectorView, VectorExpression >::addition( *this, expression );
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename VectorExpression >
+template< typename Real, typename Device, typename Index >
+template< typename VectorExpression >
 VectorView< Real, Device, Index >&
-VectorView< Real, Device, Index >::
-operator-=( const VectorExpression& expression )
+VectorView< Real, Device, Index >::operator-=( const VectorExpression& expression )
 {
    detail::VectorAssignmentWithOperation< VectorView, VectorExpression >::subtraction( *this, expression );
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename VectorExpression >
+template< typename Real, typename Device, typename Index >
+template< typename VectorExpression >
 VectorView< Real, Device, Index >&
-VectorView< Real, Device, Index >::
-operator*=( const VectorExpression& expression )
+VectorView< Real, Device, Index >::operator*=( const VectorExpression& expression )
 {
    detail::VectorAssignmentWithOperation< VectorView, VectorExpression >::multiplication( *this, expression );
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename VectorExpression >
+template< typename Real, typename Device, typename Index >
+template< typename VectorExpression >
 VectorView< Real, Device, Index >&
-VectorView< Real, Device, Index >::
-operator/=( const VectorExpression& expression )
+VectorView< Real, Device, Index >::operator/=( const VectorExpression& expression )
 {
    detail::VectorAssignmentWithOperation< VectorView, VectorExpression >::division( *this, expression );
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename VectorExpression >
+template< typename Real, typename Device, typename Index >
+template< typename VectorExpression >
 VectorView< Real, Device, Index >&
-VectorView< Real, Device, Index >::
-operator%=( const VectorExpression& expression )
+VectorView< Real, Device, Index >::operator%=( const VectorExpression& expression )
 {
    detail::VectorAssignmentWithOperation< VectorView, VectorExpression >::modulo( *this, expression );
    return *this;
 }
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/detail/ArrayAssignment.h b/src/TNL/Containers/detail/ArrayAssignment.h
index 1042fdf588c1ad6d8745c14841c28d6121af597c..8fe5b238020d6e3880e97c1c3f965e4866e98ef0 100644
--- a/src/TNL/Containers/detail/ArrayAssignment.h
+++ b/src/TNL/Containers/detail/ArrayAssignment.h
@@ -14,33 +14,32 @@ namespace TNL {
 namespace Containers {
 namespace detail {
 
-template< typename Array,
-          typename T,
-          bool isArrayType = IsArrayType< T >::value >
+template< typename Array, typename T, bool isArrayType = IsArrayType< T >::value >
 struct ArrayAssignment;
 
 /**
  * \brief Specialization for array-array assignment with containers implementing
  * getArrayData method.
  */
-template< typename Array,
-          typename T >
+template< typename Array, typename T >
 struct ArrayAssignment< Array, T, true >
 {
-   static void resize( Array& a, const T& t )
+   static void
+   resize( Array& a, const T& t )
    {
       a.setSize( t.getSize() );
    }
 
-   static void assign( Array& a, const T& t )
+   static void
+   assign( Array& a, const T& t )
    {
-      TNL_ASSERT_EQ( a.getSize(), ( decltype( a.getSize() ) ) t.getSize(), "The sizes of the arrays must be equal." );
+      TNL_ASSERT_EQ( a.getSize(), (decltype( a.getSize() )) t.getSize(), "The sizes of the arrays must be equal." );
       // skip assignment of empty arrays
       if( a.getSize() == 0 )
          return;
-      Algorithms::MultiDeviceMemoryOperations< typename Array::DeviceType, typename T::DeviceType >::template
-         copy< typename Array::ValueType, typename T::ValueType, typename Array::IndexType >
-         ( a.getArrayData(), t.getArrayData(), t.getSize() );
+      Algorithms::MultiDeviceMemoryOperations< typename Array::DeviceType, typename T::DeviceType >::
+         template copy< typename Array::ValueType, typename T::ValueType, typename Array::IndexType >(
+            a.getArrayData(), t.getArrayData(), t.getSize() );
    }
 };
 
@@ -48,25 +47,25 @@ struct ArrayAssignment< Array, T, true >
  * \brief Specialization for array-value assignment for other types. We assume
  * that T is convertible to Array::ValueType.
  */
-template< typename Array,
-          typename T >
+template< typename Array, typename T >
 struct ArrayAssignment< Array, T, false >
 {
-   static void resize( Array& a, const T& t )
-   {
-   }
+   static void
+   resize( Array& a, const T& t )
+   {}
 
-   static void assign( Array& a, const T& t )
+   static void
+   assign( Array& a, const T& t )
    {
       // skip assignment to an empty array
       if( a.getSize() == 0 )
          return;
-      Algorithms::MemoryOperations< typename Array::DeviceType >::template
-         set< typename Array::ValueType, typename Array::IndexType >
-         ( a.getArrayData(), ( typename Array::ValueType ) t, a.getSize() );
+      Algorithms::MemoryOperations< typename Array::DeviceType >::template set< typename Array::ValueType,
+                                                                                typename Array::IndexType >(
+         a.getArrayData(), (typename Array::ValueType) t, a.getSize() );
    }
 };
 
-} // namespace detail
-} // namespace Containers
-} // namespace TNL
+}  // namespace detail
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/detail/ArrayIO.h b/src/TNL/Containers/detail/ArrayIO.h
index 72a26ec794e31aeadbf9c396d5a80bdc830ccbef..a97caf6d1b8e0dc62cf6a7a9c09f8d0f090519dc 100644
--- a/src/TNL/Containers/detail/ArrayIO.h
+++ b/src/TNL/Containers/detail/ArrayIO.h
@@ -16,103 +16,90 @@ namespace TNL {
 namespace Containers {
 namespace detail {
 
-template< typename Value,
-          typename Index,
-          typename Allocator,
-          bool Elementwise = std::is_base_of< Object, Value >::value >
+template< typename Value, typename Index, typename Allocator, bool Elementwise = std::is_base_of< Object, Value >::value >
 struct ArrayIO
 {};
 
-template< typename Value,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Index, typename Allocator >
 struct ArrayIO< Value, Index, Allocator, true >
 {
-   static String getSerializationType()
+   static std::string
+   getSerializationType()
    {
-      return String( "Containers::Array< " ) +
-             TNL::getSerializationType< Value >() + ", [any_device], " +
-             TNL::getSerializationType< Index >() + ", [any_allocator] >";
+      return "Containers::Array< " + TNL::getSerializationType< Value >() + ", [any_device], "
+           + TNL::getSerializationType< Index >() + ", [any_allocator] >";
    }
 
-   static void save( File& file,
-                     const Value* data,
-                     const Index elements )
+   static void
+   save( File& file, const Value* data, const Index elements )
    {
       Index i;
-      try
-      {
+      try {
          for( i = 0; i < elements; i++ )
             data[ i ].save( file );
       }
-      catch(...)
-      {
-         throw Exceptions::FileSerializationError( file.getFileName(), "unable to write the " + std::to_string(i) + "-th array element of " + std::to_string(elements) + " into the file." );
+      catch( ... ) {
+         throw Exceptions::FileSerializationError( file.getFileName(),
+                                                   "unable to write the " + std::to_string( i ) + "-th array element of "
+                                                      + std::to_string( elements ) + " into the file." );
       }
    }
 
-   static void load( File& file,
-                     Value* data,
-                     const Index elements )
+   static void
+   load( File& file, Value* data, const Index elements )
    {
       Index i = 0;
-      try
-      {
+      try {
          for( i = 0; i < elements; i++ )
             data[ i ].load( file );
       }
-      catch(...)
-      {
-         throw Exceptions::FileDeserializationError( file.getFileName(), "unable to read the " + std::to_string(i) + "-th array element of " + std::to_string(elements) + " from the file." );
+      catch( ... ) {
+         throw Exceptions::FileDeserializationError( file.getFileName(),
+                                                     "unable to read the " + std::to_string( i ) + "-th array element of "
+                                                        + std::to_string( elements ) + " from the file." );
       }
    }
 };
 
-template< typename Value,
-          typename Index,
-          typename Allocator >
+template< typename Value, typename Index, typename Allocator >
 struct ArrayIO< Value, Index, Allocator, false >
 {
-   static String getSerializationType()
+   static std::string
+   getSerializationType()
    {
-      return String( "Containers::Array< " ) +
-             TNL::getSerializationType< Value >() + ", [any_device], " +
-             TNL::getSerializationType< Index >() + ", [any_allocator] >";
+      return "Containers::Array< " + TNL::getSerializationType< Value >() + ", [any_device], "
+           + TNL::getSerializationType< Index >() + ", [any_allocator] >";
    }
 
-   static void save( File& file,
-                     const Value* data,
-                     const Index elements )
+   static void
+   save( File& file, const Value* data, const Index elements )
    {
       if( elements == 0 )
          return;
-      try
-      {
+      try {
          file.save< Value, Value, Allocator >( data, elements );
       }
-      catch(...)
-      {
-         throw Exceptions::FileSerializationError( file.getFileName(), "unable to write " + std::to_string(elements) + " array elements into the file." );
+      catch( ... ) {
+         throw Exceptions::FileSerializationError(
+            file.getFileName(), "unable to write " + std::to_string( elements ) + " array elements into the file." );
       }
    }
 
-   static void load( File& file,
-                     Value* data,
-                     const Index elements )
+   static void
+   load( File& file, Value* data, const Index elements )
    {
       if( elements == 0 )
          return;
-      try
-      {
+      try {
          file.load< Value, Value, Allocator >( data, elements );
       }
-      catch(...)
-      {
-         throw Exceptions::FileDeserializationError( file.getFileName(), "unable to read " + std::to_string(elements) + " array elements from the file." );
+      catch( ... ) {
+         throw Exceptions::FileDeserializationError(
+            file.getFileName(), "unable to read " + std::to_string( elements ) + " array elements from the file." );
       }
    }
 };
 
-} // namespace detail
-} // namespace Containers
-} // namespace TNL
+}  // namespace detail
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/detail/StaticArrayAssignment.h b/src/TNL/Containers/detail/StaticArrayAssignment.h
index af2055424aa533cef3ef1c9abcc88edf88ee47cf..a6e4c6022104a70b96854564c598f0c8872546ee 100644
--- a/src/TNL/Containers/detail/StaticArrayAssignment.h
+++ b/src/TNL/Containers/detail/StaticArrayAssignment.h
@@ -13,27 +13,24 @@ namespace TNL {
 namespace Containers {
 namespace detail {
 
-template< typename StaticArray,
-          typename T,
-          bool isStaticArrayType = IsStaticArrayType< T >::value >
+template< typename StaticArray, typename T, bool isStaticArrayType = IsStaticArrayType< T >::value >
 struct StaticArrayAssignment;
 
 /**
  * \brief Specialization for array-array assignment.
  */
-template< typename StaticArray,
-          typename T >
+template< typename StaticArray, typename T >
 struct StaticArrayAssignment< StaticArray, T, true >
 {
-   static constexpr void assign( StaticArray& a, const T& v )
+   static constexpr void
+   assign( StaticArray& a, const T& v )
    {
-      static_assert( StaticArray::getSize() == T::getSize(),
-                     "Cannot assign static arrays with different size." );
+      static_assert( StaticArray::getSize() == T::getSize(), "Cannot assign static arrays with different size." );
       Algorithms::unrolledFor< int, 0, StaticArray::getSize() >(
-         [&] ( int i ) mutable {
+         [ & ]( int i ) mutable
+         {
             a[ i ] = v[ i ];
-         }
-      );
+         } );
    }
 };
 
@@ -41,20 +38,20 @@ struct StaticArrayAssignment< StaticArray, T, true >
  * \brief Specialization for array-value assignment for other types. We assume
  * that T is convertible to StaticArray::ValueType.
  */
-template< typename StaticArray,
-          typename T >
+template< typename StaticArray, typename T >
 struct StaticArrayAssignment< StaticArray, T, false >
 {
-   static constexpr void assign( StaticArray& a, const T& v )
+   static constexpr void
+   assign( StaticArray& a, const T& v )
    {
       Algorithms::unrolledFor< int, 0, StaticArray::getSize() >(
-         [&] ( int i ) mutable {
+         [ & ]( int i ) mutable
+         {
             a[ i ] = v;
-         }
-      );
+         } );
    }
 };
 
-} // namespace detail
-} // namespace Containers
-} // namespace TNL
+}  // namespace detail
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/detail/VectorAssignment.h b/src/TNL/Containers/detail/VectorAssignment.h
index 5945cc6c02799b6e457758887739f4c1f5b492bf..c61df080ca1d09a675581d8bfd1e54a1d91ba58f 100644
--- a/src/TNL/Containers/detail/VectorAssignment.h
+++ b/src/TNL/Containers/detail/VectorAssignment.h
@@ -19,7 +19,8 @@ namespace detail {
  */
 template< typename Vector,
           typename T,
-          bool vectorVectorAssignment = HasSubscriptOperator< T >::value && ! Expressions::IsArithmeticSubtype< T, Vector >::value >
+          bool vectorVectorAssignment =
+             HasSubscriptOperator< T >::value && ! Expressions::IsArithmeticSubtype< T, Vector >::value >
 struct VectorAssignment;
 
 /**
@@ -27,31 +28,34 @@ struct VectorAssignment;
  */
 template< typename Vector,
           typename T,
-          bool vectorVectorAssignment = HasSubscriptOperator< T >::value && ! Expressions::IsArithmeticSubtype< T, Vector >::value,
+          bool vectorVectorAssignment =
+             HasSubscriptOperator< T >::value && ! Expressions::IsArithmeticSubtype< T, Vector >::value,
           bool hasSetSizeMethod = HasSetSizeMethod< T >::value >
 struct VectorAssignmentWithOperation;
 
 /**
  * \brief Specialization for vector-vector assignment.
  */
-template< typename Vector,
-          typename T >
+template< typename Vector, typename T >
 struct VectorAssignment< Vector, T, true >
 {
-   static void resize( Vector& v, const T& t )
+   static void
+   resize( Vector& v, const T& t )
    {
       v.setSize( t.getSize() );
    }
 
    __cuda_callable__
-   static void assignStatic( Vector& v, const T& t )
+   static void
+   assignStatic( Vector& v, const T& t )
    {
       TNL_ASSERT_EQ( v.getSize(), t.getSize(), "The sizes of the vectors must be equal." );
       for( decltype( v.getSize() ) i = 0; i < v.getSize(); i++ )
          v[ i ] = t[ i ];
    }
 
-   static void assign( Vector& v, const T& t )
+   static void
+   assign( Vector& v, const T& t )
    {
       static_assert( std::is_same< typename Vector::DeviceType, typename T::DeviceType >::value,
                      "Cannot assign an expression to a vector allocated on a different device." );
@@ -61,44 +65,45 @@ struct VectorAssignment< Vector, T, true >
       using IndexType = typename Vector::IndexType;
 
       RealType* data = v.getData();
-      auto assignment = [=] __cuda_callable__ ( IndexType i )
+      auto assignment = [ = ] __cuda_callable__( IndexType i )
       {
          data[ i ] = t[ i ];
       };
-      Algorithms::ParallelFor< DeviceType >::exec( ( IndexType ) 0, v.getSize(), assignment );
+      Algorithms::ParallelFor< DeviceType >::exec( (IndexType) 0, v.getSize(), assignment );
    }
 };
 
 /**
  * \brief Specialization for vector-value assignment. We assume that T is assignable to Vector::RealType.
  */
-template< typename Vector,
-          typename T >
+template< typename Vector, typename T >
 struct VectorAssignment< Vector, T, false >
 {
-   static void resize( Vector& v, const T& t )
-   {
-   }
+   static void
+   resize( Vector& v, const T& t )
+   {}
 
    __cuda_callable__
-   static void assignStatic( Vector& v, const T& t )
+   static void
+   assignStatic( Vector& v, const T& t )
    {
       for( decltype( v.getSize() ) i = 0; i < v.getSize(); i++ )
          v[ i ] = t;
    }
 
-   static void assign( Vector& v, const T& t )
+   static void
+   assign( Vector& v, const T& t )
    {
       using RealType = typename Vector::RealType;
       using DeviceType = typename Vector::DeviceType;
       using IndexType = typename Vector::IndexType;
 
       RealType* data = v.getData();
-      auto assignment = [=] __cuda_callable__ ( IndexType i )
+      auto assignment = [ = ] __cuda_callable__( IndexType i )
       {
          data[ i ] = t;
       };
-      Algorithms::ParallelFor< DeviceType >::exec( ( IndexType ) 0, v.getSize(), assignment );
+      Algorithms::ParallelFor< DeviceType >::exec( (IndexType) 0, v.getSize(), assignment );
    }
 };
 
@@ -109,26 +114,29 @@ struct VectorAssignment< Vector, T, false >
  * This is necessary, because Vectors cannot be passed-by-value to CUDA kernels
  * so we have to do it with views.
  */
-template< typename Vector,
-          typename T >
+template< typename Vector, typename T >
 struct VectorAssignmentWithOperation< Vector, T, true, true >
 {
-   static void addition( Vector& v, const T& t )
+   static void
+   addition( Vector& v, const T& t )
    {
       VectorAssignmentWithOperation< Vector, typename T::ConstViewType >::addition( v, t.getConstView() );
    }
 
-   static void subtraction( Vector& v, const T& t )
+   static void
+   subtraction( Vector& v, const T& t )
    {
       VectorAssignmentWithOperation< Vector, typename T::ConstViewType >::subtraction( v, t.getConstView() );
    }
 
-   static void multiplication( Vector& v, const T& t )
+   static void
+   multiplication( Vector& v, const T& t )
    {
       VectorAssignmentWithOperation< Vector, typename T::ConstViewType >::multiplication( v, t.getConstView() );
    }
 
-   static void division( Vector& v, const T& t )
+   static void
+   division( Vector& v, const T& t )
    {
       VectorAssignmentWithOperation< Vector, typename T::ConstViewType >::subtraction( v, t.getConstView() );
    }
@@ -138,19 +146,20 @@ struct VectorAssignmentWithOperation< Vector, T, true, true >
  * \brief Specialization for types with subscript operator, but without setSize
  *        method - i.e. for expressions, views and static vectors.
  */
-template< typename Vector,
-          typename T >
+template< typename Vector, typename T >
 struct VectorAssignmentWithOperation< Vector, T, true, false >
 {
    __cuda_callable__
-   static void additionStatic( Vector& v, const T& t )
+   static void
+   additionStatic( Vector& v, const T& t )
    {
       TNL_ASSERT_EQ( v.getSize(), t.getSize(), "The sizes of the vectors must be equal." );
       for( decltype( v.getSize() ) i = 0; i < v.getSize(); i++ )
          v[ i ] += t[ i ];
    }
 
-   static void addition( Vector& v, const T& t )
+   static void
+   addition( Vector& v, const T& t )
    {
       static_assert( std::is_same< typename Vector::DeviceType, typename T::DeviceType >::value,
                      "Cannot assign an expression to a vector allocated on a different device." );
@@ -160,22 +169,24 @@ struct VectorAssignmentWithOperation< Vector, T, true, false >
       using IndexType = typename Vector::IndexType;
 
       RealType* data = v.getData();
-      auto add = [=] __cuda_callable__ ( IndexType i )
+      auto add = [ = ] __cuda_callable__( IndexType i )
       {
          data[ i ] += t[ i ];
       };
-      Algorithms::ParallelFor< DeviceType >::exec( ( IndexType ) 0, v.getSize(), add );
+      Algorithms::ParallelFor< DeviceType >::exec( (IndexType) 0, v.getSize(), add );
    }
 
    __cuda_callable__
-   static void subtractionStatic( Vector& v, const T& t )
+   static void
+   subtractionStatic( Vector& v, const T& t )
    {
       TNL_ASSERT_EQ( v.getSize(), t.getSize(), "The sizes of the vectors must be equal." );
       for( decltype( v.getSize() ) i = 0; i < v.getSize(); i++ )
          v[ i ] -= t[ i ];
    }
 
-   static void subtraction( Vector& v, const T& t )
+   static void
+   subtraction( Vector& v, const T& t )
    {
       static_assert( std::is_same< typename Vector::DeviceType, typename T::DeviceType >::value,
                      "Cannot assign an expression to a vector allocated on a different device." );
@@ -185,22 +196,24 @@ struct VectorAssignmentWithOperation< Vector, T, true, false >
       using IndexType = typename Vector::IndexType;
 
       RealType* data = v.getData();
-      auto subtract = [=] __cuda_callable__ ( IndexType i )
+      auto subtract = [ = ] __cuda_callable__( IndexType i )
       {
          data[ i ] -= t[ i ];
       };
-      Algorithms::ParallelFor< DeviceType >::exec( ( IndexType ) 0, v.getSize(), subtract );
+      Algorithms::ParallelFor< DeviceType >::exec( (IndexType) 0, v.getSize(), subtract );
    }
 
    __cuda_callable__
-   static void multiplicationStatic( Vector& v, const T& t )
+   static void
+   multiplicationStatic( Vector& v, const T& t )
    {
       TNL_ASSERT_EQ( v.getSize(), t.getSize(), "The sizes of the vectors must be equal." );
       for( decltype( v.getSize() ) i = 0; i < v.getSize(); i++ )
          v[ i ] *= t[ i ];
    }
 
-   static void multiplication( Vector& v, const T& t )
+   static void
+   multiplication( Vector& v, const T& t )
    {
       static_assert( std::is_same< typename Vector::DeviceType, typename T::DeviceType >::value,
                      "Cannot assign an expression to a vector allocated on a different device." );
@@ -210,22 +223,24 @@ struct VectorAssignmentWithOperation< Vector, T, true, false >
       using IndexType = typename Vector::IndexType;
 
       RealType* data = v.getData();
-      auto multiply = [=] __cuda_callable__ ( IndexType i )
+      auto multiply = [ = ] __cuda_callable__( IndexType i )
       {
          data[ i ] *= t[ i ];
       };
-      Algorithms::ParallelFor< DeviceType >::exec( ( IndexType ) 0, v.getSize(), multiply );
+      Algorithms::ParallelFor< DeviceType >::exec( (IndexType) 0, v.getSize(), multiply );
    }
 
    __cuda_callable__
-   static void divisionStatic( Vector& v, const T& t )
+   static void
+   divisionStatic( Vector& v, const T& t )
    {
       TNL_ASSERT_EQ( v.getSize(), t.getSize(), "The sizes of the vectors must be equal." );
       for( decltype( v.getSize() ) i = 0; i < v.getSize(); i++ )
          v[ i ] /= t[ i ];
    }
 
-   static void division( Vector& v, const T& t )
+   static void
+   division( Vector& v, const T& t )
    {
       static_assert( std::is_same< typename Vector::DeviceType, typename T::DeviceType >::value,
                      "Cannot assign an expression to a vector allocated on a different device." );
@@ -235,22 +250,24 @@ struct VectorAssignmentWithOperation< Vector, T, true, false >
       using IndexType = typename Vector::IndexType;
 
       RealType* data = v.getData();
-      auto divide = [=] __cuda_callable__ ( IndexType i )
+      auto divide = [ = ] __cuda_callable__( IndexType i )
       {
          data[ i ] /= t[ i ];
       };
-      Algorithms::ParallelFor< DeviceType >::exec( ( IndexType ) 0, v.getSize(), divide );
+      Algorithms::ParallelFor< DeviceType >::exec( (IndexType) 0, v.getSize(), divide );
    }
 
    __cuda_callable__
-   static void moduloStatic( Vector& v, const T& t )
+   static void
+   moduloStatic( Vector& v, const T& t )
    {
       TNL_ASSERT_EQ( v.getSize(), t.getSize(), "The sizes of the vectors must be equal." );
       for( decltype( v.getSize() ) i = 0; i < v.getSize(); i++ )
          v[ i ] %= t[ i ];
    }
 
-   static void modulo( Vector& v, const T& t )
+   static void
+   modulo( Vector& v, const T& t )
    {
       static_assert( std::is_same< typename Vector::DeviceType, typename T::DeviceType >::value,
                      "Cannot assign an expression to a vector allocated on a different device." );
@@ -260,11 +277,11 @@ struct VectorAssignmentWithOperation< Vector, T, true, false >
       using IndexType = typename Vector::IndexType;
 
       RealType* data = v.getData();
-      auto divide = [=] __cuda_callable__ ( IndexType i )
+      auto divide = [ = ] __cuda_callable__( IndexType i )
       {
          data[ i ] %= t[ i ];
       };
-      Algorithms::ParallelFor< DeviceType >::exec( ( IndexType ) 0, v.getSize(), divide );
+      Algorithms::ParallelFor< DeviceType >::exec( (IndexType) 0, v.getSize(), divide );
    }
 };
 
@@ -272,116 +289,125 @@ struct VectorAssignmentWithOperation< Vector, T, true, false >
  * \brief Specialization for array-value assignment for other types. We assume
  * that T is convertible to Vector::ValueType.
  */
-template< typename Vector,
-          typename T >
+template< typename Vector, typename T >
 struct VectorAssignmentWithOperation< Vector, T, false, false >
 {
    __cuda_callable__
-   static void additionStatic( Vector& v, const T& t )
+   static void
+   additionStatic( Vector& v, const T& t )
    {
       for( decltype( v.getSize() ) i = 0; i < v.getSize(); i++ )
          v[ i ] += t;
    }
 
-   static void addition( Vector& v, const T& t )
+   static void
+   addition( Vector& v, const T& t )
    {
       using RealType = typename Vector::RealType;
       using DeviceType = typename Vector::DeviceType;
       using IndexType = typename Vector::IndexType;
 
       RealType* data = v.getData();
-      auto add = [=] __cuda_callable__ ( IndexType i )
+      auto add = [ = ] __cuda_callable__( IndexType i )
       {
          data[ i ] += t;
       };
-      Algorithms::ParallelFor< DeviceType >::exec( ( IndexType ) 0, v.getSize(), add );
+      Algorithms::ParallelFor< DeviceType >::exec( (IndexType) 0, v.getSize(), add );
    }
 
    __cuda_callable__
-   static void subtractionStatic( Vector& v, const T& t )
+   static void
+   subtractionStatic( Vector& v, const T& t )
    {
       for( decltype( v.getSize() ) i = 0; i < v.getSize(); i++ )
          v[ i ] -= t;
    }
 
-   static void subtraction( Vector& v, const T& t )
+   static void
+   subtraction( Vector& v, const T& t )
    {
       using RealType = typename Vector::RealType;
       using DeviceType = typename Vector::DeviceType;
       using IndexType = typename Vector::IndexType;
 
       RealType* data = v.getData();
-      auto subtract = [=] __cuda_callable__ ( IndexType i )
+      auto subtract = [ = ] __cuda_callable__( IndexType i )
       {
          data[ i ] -= t;
       };
-      Algorithms::ParallelFor< DeviceType >::exec( ( IndexType ) 0, v.getSize(), subtract );
+      Algorithms::ParallelFor< DeviceType >::exec( (IndexType) 0, v.getSize(), subtract );
    }
 
    __cuda_callable__
-   static void multiplicationStatic( Vector& v, const T& t )
+   static void
+   multiplicationStatic( Vector& v, const T& t )
    {
       for( decltype( v.getSize() ) i = 0; i < v.getSize(); i++ )
          v[ i ] *= t;
    }
 
-   static void multiplication( Vector& v, const T& t )
+   static void
+   multiplication( Vector& v, const T& t )
    {
       using RealType = typename Vector::RealType;
       using DeviceType = typename Vector::DeviceType;
       using IndexType = typename Vector::IndexType;
 
       RealType* data = v.getData();
-      auto multiply = [=] __cuda_callable__ ( IndexType i )
+      auto multiply = [ = ] __cuda_callable__( IndexType i )
       {
          data[ i ] *= t;
       };
-      Algorithms::ParallelFor< DeviceType >::exec( ( IndexType ) 0, v.getSize(), multiply );
+      Algorithms::ParallelFor< DeviceType >::exec( (IndexType) 0, v.getSize(), multiply );
    }
 
    __cuda_callable__
-   static void divisionStatic( Vector& v, const T& t )
+   static void
+   divisionStatic( Vector& v, const T& t )
    {
       for( decltype( v.getSize() ) i = 0; i < v.getSize(); i++ )
          v[ i ] /= t;
    }
 
-   static void division( Vector& v, const T& t )
+   static void
+   division( Vector& v, const T& t )
    {
       using RealType = typename Vector::RealType;
       using DeviceType = typename Vector::DeviceType;
       using IndexType = typename Vector::IndexType;
 
       RealType* data = v.getData();
-      auto divide = [=] __cuda_callable__ ( IndexType i )
+      auto divide = [ = ] __cuda_callable__( IndexType i )
       {
          data[ i ] /= t;
       };
-      Algorithms::ParallelFor< DeviceType >::exec( ( IndexType ) 0, v.getSize(), divide );
+      Algorithms::ParallelFor< DeviceType >::exec( (IndexType) 0, v.getSize(), divide );
    }
 
    __cuda_callable__
-   static void moduloStatic( Vector& v, const T& t )
+   static void
+   moduloStatic( Vector& v, const T& t )
    {
       for( decltype( v.getSize() ) i = 0; i < v.getSize(); i++ )
          v[ i ] %= t;
    }
 
-   static void modulo( Vector& v, const T& t )
+   static void
+   modulo( Vector& v, const T& t )
    {
       using RealType = typename Vector::RealType;
       using DeviceType = typename Vector::DeviceType;
       using IndexType = typename Vector::IndexType;
 
       RealType* data = v.getData();
-      auto divide = [=] __cuda_callable__ ( IndexType i )
+      auto divide = [ = ] __cuda_callable__( IndexType i )
       {
          data[ i ] %= t;
       };
-      Algorithms::ParallelFor< DeviceType >::exec( ( IndexType ) 0, v.getSize(), divide );
+      Algorithms::ParallelFor< DeviceType >::exec( (IndexType) 0, v.getSize(), divide );
    }
 };
 
-} // namespace detail
-} // namespace Containers
-} // namespace TNL
+}  // namespace detail
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/ndarray/BoundaryExecutors.h b/src/TNL/Containers/ndarray/BoundaryExecutors.h
index aaa44596624ca6dcea90aa235bbb4898d710815e..4bcdddfa98e7b9446422e9d93acf43028c24e064 100644
--- a/src/TNL/Containers/ndarray/BoundaryExecutors.h
+++ b/src/TNL/Containers/ndarray/BoundaryExecutors.h
@@ -17,27 +17,21 @@ namespace TNL {
 namespace Containers {
 namespace __ndarray_impl {
 
-template< typename Permutation,
-          typename LevelTag = IndexTag< 0 > >
+template< typename Permutation, typename LevelTag = IndexTag< 0 > >
 struct SequentialBoundaryExecutor_inner
 {
-   template< typename Begins,
-             typename SkipBegins,
-             typename SkipEnds,
-             typename Ends,
-             typename Func,
-             typename... Indices >
+   template< typename Begins, typename SkipBegins, typename SkipEnds, typename Ends, typename Func, typename... Indices >
    __cuda_callable__
-   void operator()( const Begins& begins,
-                    const SkipBegins& skipBegins,
-                    const SkipEnds& skipEnds,
-                    const Ends& ends,
-                    std::size_t level,
-                    Func f,
-                    Indices&&... indices )
+   void
+   operator()( const Begins& begins,
+               const SkipBegins& skipBegins,
+               const SkipEnds& skipEnds,
+               const Ends& ends,
+               std::size_t level,
+               Func f,
+               Indices&&... indices )
    {
-      static_assert( Begins::getDimension() == Ends::getDimension(),
-                     "wrong begins or ends" );
+      static_assert( Begins::getDimension() == Ends::getDimension(), "wrong begins or ends" );
 
       SequentialBoundaryExecutor_inner< Permutation, IndexTag< LevelTag::value + 1 > > exec;
       const auto begin = begins.template getSize< get< LevelTag::value >( Permutation{} ) >();
@@ -64,24 +58,19 @@ struct SequentialBoundaryExecutor_inner
 template< typename Permutation >
 struct SequentialBoundaryExecutor_inner< Permutation, IndexTag< Permutation::size() - 1 > >
 {
-   template< typename Begins,
-             typename SkipBegins,
-             typename SkipEnds,
-             typename Ends,
-             typename Func,
-             typename... Indices >
+   template< typename Begins, typename SkipBegins, typename SkipEnds, typename Ends, typename Func, typename... Indices >
    __cuda_callable__
-   void operator()( const Begins& begins,
-                    const SkipBegins& skipBegins,
-                    const SkipEnds& skipEnds,
-                    const Ends& ends,
-                    std::size_t level,
-                    Func f,
-                    Indices&&... indices )
+   void
+   operator()( const Begins& begins,
+               const SkipBegins& skipBegins,
+               const SkipEnds& skipEnds,
+               const Ends& ends,
+               std::size_t level,
+               Func f,
+               Indices&&... indices )
    {
-      static_assert( Begins::getDimension() == Ends::getDimension(),
-                     "wrong begins or ends" );
-      static_assert( sizeof...(indices) == Begins::getDimension() - 1,
+      static_assert( Begins::getDimension() == Ends::getDimension(), "wrong begins or ends" );
+      static_assert( sizeof...( indices ) == Begins::getDimension() - 1,
                      "invalid number of indices in the final step of the SequentialBoundaryExecutor" );
 
       using LevelTag = IndexTag< Permutation::size() - 1 >;
@@ -107,24 +96,15 @@ struct SequentialBoundaryExecutor_inner< Permutation, IndexTag< Permutation::siz
    }
 };
 
-template< typename Permutation,
-          std::size_t dim = Permutation::size() >
+template< typename Permutation, std::size_t dim = Permutation::size() >
 struct SequentialBoundaryExecutor
 {
-   template< typename Begins,
-             typename SkipBegins,
-             typename SkipEnds,
-             typename Ends,
-             typename Func >
+   template< typename Begins, typename SkipBegins, typename SkipEnds, typename Ends, typename Func >
    __cuda_callable__
-   void operator()( const Begins& begins,
-                    const SkipBegins& skipBegins,
-                    const SkipEnds& skipEnds,
-                    const Ends& ends,
-                    Func f )
+   void
+   operator()( const Begins& begins, const SkipBegins& skipBegins, const SkipEnds& skipEnds, const Ends& ends, Func f )
    {
-      static_assert( Begins::getDimension() == Ends::getDimension(),
-                     "wrong begins or ends" );
+      static_assert( Begins::getDimension() == Ends::getDimension(), "wrong begins or ends" );
 
       SequentialBoundaryExecutor_inner< Permutation > exec;
       for( std::size_t level = 0; level < Permutation::size(); level++ )
@@ -135,20 +115,12 @@ struct SequentialBoundaryExecutor
 template< typename Permutation >
 struct SequentialBoundaryExecutor< Permutation, 0 >
 {
-   template< typename Begins,
-             typename SkipBegins,
-             typename SkipEnds,
-             typename Ends,
-             typename Func >
+   template< typename Begins, typename SkipBegins, typename SkipEnds, typename Ends, typename Func >
    __cuda_callable__
-   void operator()( const Begins& begins,
-                    const SkipBegins& skipBegins,
-                    const SkipEnds& skipEnds,
-                    const Ends& ends,
-                    Func f )
+   void
+   operator()( const Begins& begins, const SkipBegins& skipBegins, const SkipEnds& skipEnds, const Ends& ends, Func f )
    {
-      static_assert( Begins::getDimension() == Ends::getDimension(),
-                     "wrong begins or ends" );
+      static_assert( Begins::getDimension() == Ends::getDimension(), "wrong begins or ends" );
 
       const auto begin = begins.template getSize< get< 0 >( Permutation{} ) >();
       const auto skipBegin = skipBegins.template getSize< get< 0 >( Permutation{} ) >();
@@ -161,51 +133,32 @@ struct SequentialBoundaryExecutor< Permutation, 0 >
    }
 };
 
-
-template< typename Permutation,
-          typename Device,
-          typename DimTag = IndexTag< Permutation::size() > >
+template< typename Permutation, typename Device, typename DimTag = IndexTag< Permutation::size() > >
 struct ParallelBoundaryExecutor
 {
-   template< typename Begins,
-             typename SkipBegins,
-             typename SkipEnds,
-             typename Ends,
-             typename Func >
-   void operator()( const Begins& begins,
-                    const SkipBegins& skipBegins,
-                    const SkipEnds& skipEnds,
-                    const Ends& ends,
-                    Func f )
+   template< typename Begins, typename SkipBegins, typename SkipEnds, typename Ends, typename Func >
+   void
+   operator()( const Begins& begins, const SkipBegins& skipBegins, const SkipEnds& skipEnds, const Ends& ends, Func f )
    {
       static_assert( Permutation::size() <= 3, "ParallelBoundaryExecutor is implemented only for 1D, 2D, and 3D." );
    }
 };
 
-template< typename Permutation,
-          typename Device >
+template< typename Permutation, typename Device >
 struct ParallelBoundaryExecutor< Permutation, Device, IndexTag< 3 > >
 {
-   template< typename Begins,
-             typename SkipBegins,
-             typename SkipEnds,
-             typename Ends,
-             typename Func >
-   void operator()( const Begins& begins,
-                    const SkipBegins& skipBegins,
-                    const SkipEnds& skipEnds,
-                    const Ends& ends,
-                    Func f )
+   template< typename Begins, typename SkipBegins, typename SkipEnds, typename Ends, typename Func >
+   void
+   operator()( const Begins& begins, const SkipBegins& skipBegins, const SkipEnds& skipEnds, const Ends& ends, Func f )
    {
-      static_assert( Begins::getDimension() == Ends::getDimension(),
-                     "wrong begins or ends" );
+      static_assert( Begins::getDimension() == Ends::getDimension(), "wrong begins or ends" );
 
       // nvcc does not like nested __cuda_callable__ and normal lambdas...
-//      using Index = typename Ends::IndexType;
-//      auto kernel = [=] __cuda_callable__ ( Index i2, Index i1, Index i0 )
-//      {
-//         call_with_unpermuted_arguments< Permutation >( f, i0, i1, i2 );
-//      };
+      //      using Index = typename Ends::IndexType;
+      //      auto kernel = [=] __cuda_callable__ ( Index i2, Index i1, Index i0 )
+      //      {
+      //         call_with_unpermuted_arguments< Permutation >( f, i0, i1, i2 );
+      //      };
       Kernel< Device > kernel;
 
       const auto begin0 = begins.template getSize< get< 0 >( Permutation{} ) >();
@@ -221,19 +174,20 @@ struct ParallelBoundaryExecutor< Permutation, Device, IndexTag< 3 > >
       const auto end1 = ends.template getSize< get< 1 >( Permutation{} ) >();
       const auto end2 = ends.template getSize< get< 2 >( Permutation{} ) >();
 
-      Algorithms::ParallelFor3D< Device >::exec( begin2,     begin1,     begin0,   skipBegin2, end1,       end0,       kernel, f );
-      Algorithms::ParallelFor3D< Device >::exec( skipEnd2,   begin1,     begin0,   end2,       end1,       end0,       kernel, f );
-      Algorithms::ParallelFor3D< Device >::exec( skipBegin2, begin1,     begin0,   skipEnd2,   skipBegin1, end0,       kernel, f );
-      Algorithms::ParallelFor3D< Device >::exec( skipBegin2, skipEnd1,   begin0,   skipEnd2,   end1,       end0,       kernel, f );
-      Algorithms::ParallelFor3D< Device >::exec( skipBegin2, skipBegin1, begin0,   skipEnd2,   skipEnd1,   skipBegin0, kernel, f );
-      Algorithms::ParallelFor3D< Device >::exec( skipBegin2, skipBegin1, skipEnd0, skipEnd2,   skipEnd1,   end0,       kernel, f );
+      Algorithms::ParallelFor3D< Device >::exec( begin2, begin1, begin0, skipBegin2, end1, end0, kernel, f );
+      Algorithms::ParallelFor3D< Device >::exec( skipEnd2, begin1, begin0, end2, end1, end0, kernel, f );
+      Algorithms::ParallelFor3D< Device >::exec( skipBegin2, begin1, begin0, skipEnd2, skipBegin1, end0, kernel, f );
+      Algorithms::ParallelFor3D< Device >::exec( skipBegin2, skipEnd1, begin0, skipEnd2, end1, end0, kernel, f );
+      Algorithms::ParallelFor3D< Device >::exec( skipBegin2, skipBegin1, begin0, skipEnd2, skipEnd1, skipBegin0, kernel, f );
+      Algorithms::ParallelFor3D< Device >::exec( skipBegin2, skipBegin1, skipEnd0, skipEnd2, skipEnd1, end0, kernel, f );
    }
 
    template< typename __Device, typename = void >
    struct Kernel
    {
       template< typename Index, typename Func >
-      void operator()( Index i2, Index i1, Index i0, Func f )
+      void
+      operator()( Index i2, Index i1, Index i0, Func f )
       {
          call_with_unpermuted_arguments< Permutation >( f, i0, i1, i2 );
       };
@@ -245,37 +199,29 @@ struct ParallelBoundaryExecutor< Permutation, Device, IndexTag< 3 > >
    {
       template< typename Index, typename Func >
       __cuda_callable__
-      void operator()( Index i2, Index i1, Index i0, Func f )
+      void
+      operator()( Index i2, Index i1, Index i0, Func f )
       {
          call_with_unpermuted_arguments< Permutation >( f, i0, i1, i2 );
       };
    };
 };
 
-template< typename Permutation,
-          typename Device >
+template< typename Permutation, typename Device >
 struct ParallelBoundaryExecutor< Permutation, Device, IndexTag< 2 > >
 {
-   template< typename Begins,
-             typename SkipBegins,
-             typename SkipEnds,
-             typename Ends,
-             typename Func >
-   void operator()( const Begins& begins,
-                    const SkipBegins& skipBegins,
-                    const SkipEnds& skipEnds,
-                    const Ends& ends,
-                    Func f )
+   template< typename Begins, typename SkipBegins, typename SkipEnds, typename Ends, typename Func >
+   void
+   operator()( const Begins& begins, const SkipBegins& skipBegins, const SkipEnds& skipEnds, const Ends& ends, Func f )
    {
-      static_assert( Begins::getDimension() == Ends::getDimension(),
-                     "wrong begins or ends" );
+      static_assert( Begins::getDimension() == Ends::getDimension(), "wrong begins or ends" );
 
       // nvcc does not like nested __cuda_callable__ and normal lambdas...
-//      using Index = typename Ends::IndexType;
-//      auto kernel = [=] __cuda_callable__ ( Index i1, Index i0 )
-//      {
-//         call_with_unpermuted_arguments< Permutation >( f, i0, i1 );
-//      };
+      //      using Index = typename Ends::IndexType;
+      //      auto kernel = [=] __cuda_callable__ ( Index i1, Index i0 )
+      //      {
+      //         call_with_unpermuted_arguments< Permutation >( f, i0, i1 );
+      //      };
       Kernel< Device > kernel;
 
       const auto begin0 = begins.template getSize< get< 0 >( Permutation{} ) >();
@@ -287,17 +233,18 @@ struct ParallelBoundaryExecutor< Permutation, Device, IndexTag< 2 > >
       const auto end0 = ends.template getSize< get< 0 >( Permutation{} ) >();
       const auto end1 = ends.template getSize< get< 1 >( Permutation{} ) >();
 
-      Algorithms::ParallelFor2D< Device >::exec( begin1,     begin0,   skipBegin1, end0,       kernel, f );
-      Algorithms::ParallelFor2D< Device >::exec( skipEnd1,   begin0,   end1,       end0,       kernel, f );
-      Algorithms::ParallelFor2D< Device >::exec( skipBegin1, begin0,   skipEnd1,   skipBegin0, kernel, f );
-      Algorithms::ParallelFor2D< Device >::exec( skipBegin1, skipEnd0, skipEnd1,   end0,       kernel, f );
+      Algorithms::ParallelFor2D< Device >::exec( begin1, begin0, skipBegin1, end0, kernel, f );
+      Algorithms::ParallelFor2D< Device >::exec( skipEnd1, begin0, end1, end0, kernel, f );
+      Algorithms::ParallelFor2D< Device >::exec( skipBegin1, begin0, skipEnd1, skipBegin0, kernel, f );
+      Algorithms::ParallelFor2D< Device >::exec( skipBegin1, skipEnd0, skipEnd1, end0, kernel, f );
    }
 
    template< typename __Device, typename = void >
    struct Kernel
    {
       template< typename Index, typename Func >
-      void operator()( Index i1, Index i0, Func f )
+      void
+      operator()( Index i1, Index i0, Func f )
       {
          call_with_unpermuted_arguments< Permutation >( f, i0, i1 );
       };
@@ -309,30 +256,22 @@ struct ParallelBoundaryExecutor< Permutation, Device, IndexTag< 2 > >
    {
       template< typename Index, typename Func >
       __cuda_callable__
-      void operator()( Index i1, Index i0, Func f )
+      void
+      operator()( Index i1, Index i0, Func f )
       {
          call_with_unpermuted_arguments< Permutation >( f, i0, i1 );
       };
    };
 };
 
-template< typename Permutation,
-          typename Device >
+template< typename Permutation, typename Device >
 struct ParallelBoundaryExecutor< Permutation, Device, IndexTag< 1 > >
 {
-   template< typename Begins,
-             typename SkipBegins,
-             typename SkipEnds,
-             typename Ends,
-             typename Func >
-   void operator()( const Begins& begins,
-                    const SkipBegins& skipBegins,
-                    const SkipEnds& skipEnds,
-                    const Ends& ends,
-                    Func f )
+   template< typename Begins, typename SkipBegins, typename SkipEnds, typename Ends, typename Func >
+   void
+   operator()( const Begins& begins, const SkipBegins& skipBegins, const SkipEnds& skipEnds, const Ends& ends, Func f )
    {
-      static_assert( Begins::getDimension() == Ends::getDimension(),
-                     "wrong begins or ends" );
+      static_assert( Begins::getDimension() == Ends::getDimension(), "wrong begins or ends" );
 
       const auto begin = begins.template getSize< get< 0 >( Permutation{} ) >();
       const auto skipBegin = skipBegins.template getSize< get< 0 >( Permutation{} ) >();
@@ -344,22 +283,13 @@ struct ParallelBoundaryExecutor< Permutation, Device, IndexTag< 1 > >
    }
 };
 
-
 // Device may be void which stands for StaticNDArray
-template< typename Permutation,
-          typename Device >
+template< typename Permutation, typename Device >
 struct BoundaryExecutorDispatcher
 {
-   template< typename Begins,
-             typename SkipBegins,
-             typename SkipEnds,
-             typename Ends,
-             typename Func >
-   void operator()( const Begins& begins,
-                    const SkipBegins& skipBegins,
-                    const SkipEnds& skipEnds,
-                    const Ends& ends,
-                    Func f )
+   template< typename Begins, typename SkipBegins, typename SkipEnds, typename Ends, typename Func >
+   void
+   operator()( const Begins& begins, const SkipBegins& skipBegins, const SkipEnds& skipEnds, const Ends& ends, Func f )
    {
       SequentialBoundaryExecutor< Permutation >()( begins, skipBegins, skipEnds, ends, f );
    }
@@ -368,16 +298,9 @@ struct BoundaryExecutorDispatcher
 template< typename Permutation >
 struct BoundaryExecutorDispatcher< Permutation, Devices::Host >
 {
-   template< typename Begins,
-             typename SkipBegins,
-             typename SkipEnds,
-             typename Ends,
-             typename Func >
-   void operator()( const Begins& begins,
-                    const SkipBegins& skipBegins,
-                    const SkipEnds& skipEnds,
-                    const Ends& ends,
-                    Func f )
+   template< typename Begins, typename SkipBegins, typename SkipEnds, typename Ends, typename Func >
+   void
+   operator()( const Begins& begins, const SkipBegins& skipBegins, const SkipEnds& skipEnds, const Ends& ends, Func f )
    {
       if( Devices::Host::isOMPEnabled() && Devices::Host::getMaxThreadsCount() > 1 )
          ParallelBoundaryExecutor< Permutation, Devices::Host >()( begins, skipBegins, skipEnds, ends, f );
@@ -389,21 +312,14 @@ struct BoundaryExecutorDispatcher< Permutation, Devices::Host >
 template< typename Permutation >
 struct BoundaryExecutorDispatcher< Permutation, Devices::Cuda >
 {
-   template< typename Begins,
-             typename SkipBegins,
-             typename SkipEnds,
-             typename Ends,
-             typename Func >
-   void operator()( const Begins& begins,
-                    const SkipBegins& skipBegins,
-                    const SkipEnds& skipEnds,
-                    const Ends& ends,
-                    Func f )
+   template< typename Begins, typename SkipBegins, typename SkipEnds, typename Ends, typename Func >
+   void
+   operator()( const Begins& begins, const SkipBegins& skipBegins, const SkipEnds& skipEnds, const Ends& ends, Func f )
    {
       ParallelBoundaryExecutor< Permutation, Devices::Cuda >()( begins, skipBegins, skipEnds, ends, f );
    }
 };
 
-} // namespace __ndarray_impl
-} // namespace Containers
-} // namespace TNL
+}  // namespace __ndarray_impl
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/ndarray/Executors.h b/src/TNL/Containers/ndarray/Executors.h
index 61b421fc50f012f17ddc1e2d7480f7c1903a6496..fb2883ceb13cad89e0b853166f74faac0dca0eb0 100644
--- a/src/TNL/Containers/ndarray/Executors.h
+++ b/src/TNL/Containers/ndarray/Executors.h
@@ -17,19 +17,15 @@ namespace TNL {
 namespace Containers {
 namespace __ndarray_impl {
 
-template< typename Permutation,
-          typename LevelTag = IndexTag< 0 > >
+template< typename Permutation, typename LevelTag = IndexTag< 0 > >
 struct SequentialExecutor
 {
-   template< typename Begins,
-             typename Ends,
-             typename Func,
-             typename... Indices >
+   template< typename Begins, typename Ends, typename Func, typename... Indices >
    __cuda_callable__
-   void operator()( const Begins& begins, const Ends& ends, Func f, Indices&&... indices )
+   void
+   operator()( const Begins& begins, const Ends& ends, Func f, Indices&&... indices )
    {
-      static_assert( Begins::getDimension() == Ends::getDimension(),
-                     "wrong begins or ends" );
+      static_assert( Begins::getDimension() == Ends::getDimension(), "wrong begins or ends" );
 
       SequentialExecutor< Permutation, IndexTag< LevelTag::value + 1 > > exec;
       const auto begin = begins.template getSize< get< LevelTag::value >( Permutation{} ) >();
@@ -42,16 +38,13 @@ struct SequentialExecutor
 template< typename Permutation >
 struct SequentialExecutor< Permutation, IndexTag< Permutation::size() - 1 > >
 {
-   template< typename Begins,
-             typename Ends,
-             typename Func,
-             typename... Indices >
+   template< typename Begins, typename Ends, typename Func, typename... Indices >
    __cuda_callable__
-   void operator()( const Begins& begins, const Ends& ends, Func f, Indices&&... indices )
+   void
+   operator()( const Begins& begins, const Ends& ends, Func f, Indices&&... indices )
    {
-      static_assert( Begins::getDimension() == Ends::getDimension(),
-                     "wrong begins or ends" );
-      static_assert( sizeof...(indices) == Begins::getDimension() - 1,
+      static_assert( Begins::getDimension() == Ends::getDimension(), "wrong begins or ends" );
+      static_assert( sizeof...( indices ) == Begins::getDimension() - 1,
                      "invalid number of indices in the final step of the SequentialExecutor" );
 
       using LevelTag = IndexTag< Permutation::size() - 1 >;
@@ -63,20 +56,15 @@ struct SequentialExecutor< Permutation, IndexTag< Permutation::size() - 1 > >
    }
 };
 
-
-template< typename Permutation,
-          typename LevelTag = IndexTag< Permutation::size() - 1 > >
+template< typename Permutation, typename LevelTag = IndexTag< Permutation::size() - 1 > >
 struct SequentialExecutorRTL
 {
-   template< typename Begins,
-             typename Ends,
-             typename Func,
-             typename... Indices >
+   template< typename Begins, typename Ends, typename Func, typename... Indices >
    __cuda_callable__
-   void operator()( const Begins& begins, const Ends& ends, Func f, Indices&&... indices )
+   void
+   operator()( const Begins& begins, const Ends& ends, Func f, Indices&&... indices )
    {
-      static_assert( Begins::getDimension() == Ends::getDimension(),
-                     "wrong begins or ends" );
+      static_assert( Begins::getDimension() == Ends::getDimension(), "wrong begins or ends" );
 
       SequentialExecutorRTL< Permutation, IndexTag< LevelTag::value - 1 > > exec;
       const auto begin = begins.template getSize< get< LevelTag::value >( Permutation{} ) >();
@@ -89,16 +77,13 @@ struct SequentialExecutorRTL
 template< typename Permutation >
 struct SequentialExecutorRTL< Permutation, IndexTag< 0 > >
 {
-   template< typename Begins,
-             typename Ends,
-             typename Func,
-             typename... Indices >
+   template< typename Begins, typename Ends, typename Func, typename... Indices >
    __cuda_callable__
-   void operator()( const Begins& begins, const Ends& ends, Func f, Indices&&... indices )
+   void
+   operator()( const Begins& begins, const Ends& ends, Func f, Indices&&... indices )
    {
-      static_assert( Begins::getDimension() == Ends::getDimension(),
-                     "wrong begins or ends" );
-      static_assert( sizeof...(indices) == Begins::getDimension() - 1,
+      static_assert( Begins::getDimension() == Ends::getDimension(), "wrong begins or ends" );
+      static_assert( sizeof...( indices ) == Begins::getDimension() - 1,
                      "invalid number of indices in the final step of the SequentialExecutorRTL" );
 
       const auto begin = begins.template getSize< get< 0 >( Permutation{} ) >();
@@ -108,22 +93,18 @@ struct SequentialExecutorRTL< Permutation, IndexTag< 0 > >
    }
 };
 
-
-template< typename Permutation,
-          typename Device >
+template< typename Permutation, typename Device >
 struct ParallelExecutorDeviceDispatch
 {
-   template< typename Begins,
-             typename Ends,
-             typename Func >
-   void operator()( const Begins& begins, const Ends& ends, Func f )
+   template< typename Begins, typename Ends, typename Func >
+   void
+   operator()( const Begins& begins, const Ends& ends, Func f )
    {
-      static_assert( Begins::getDimension() == Ends::getDimension(),
-                     "wrong begins or ends" );
+      static_assert( Begins::getDimension() == Ends::getDimension(), "wrong begins or ends" );
 
       using Index = typename Ends::IndexType;
 
-      auto kernel = [=] ( Index i2, Index i1, Index i0 )
+      auto kernel = [ = ]( Index i2, Index i1, Index i0 )
       {
          SequentialExecutor< Permutation, IndexTag< 3 > > exec;
          exec( begins, ends, f, i0, i1, i2 );
@@ -142,17 +123,15 @@ struct ParallelExecutorDeviceDispatch
 template< typename Permutation >
 struct ParallelExecutorDeviceDispatch< Permutation, Devices::Cuda >
 {
-   template< typename Begins,
-             typename Ends,
-             typename Func >
-   void operator()( const Begins& begins, const Ends& ends, Func f )
+   template< typename Begins, typename Ends, typename Func >
+   void
+   operator()( const Begins& begins, const Ends& ends, Func f )
    {
-      static_assert( Begins::getDimension() == Ends::getDimension(),
-                     "wrong begins or ends" );
+      static_assert( Begins::getDimension() == Ends::getDimension(), "wrong begins or ends" );
 
       using Index = typename Ends::IndexType;
 
-      auto kernel = [=] __cuda_callable__ ( Index i2, Index i1, Index i0 )
+      auto kernel = [ = ] __cuda_callable__( Index i2, Index i1, Index i0 )
       {
          SequentialExecutorRTL< Permutation, IndexTag< Begins::getDimension() - 4 > > exec;
          exec( begins, ends, f, i0, i1, i2 );
@@ -168,40 +147,34 @@ struct ParallelExecutorDeviceDispatch< Permutation, Devices::Cuda >
    }
 };
 
-template< typename Permutation,
-          typename Device,
-          typename DimTag = IndexTag< Permutation::size() > >
+template< typename Permutation, typename Device, typename DimTag = IndexTag< Permutation::size() > >
 struct ParallelExecutor
 {
-   template< typename Begins,
-             typename Ends,
-             typename Func >
-   void operator()( const Begins& begins, const Ends& ends, Func f )
+   template< typename Begins, typename Ends, typename Func >
+   void
+   operator()( const Begins& begins, const Ends& ends, Func f )
    {
       ParallelExecutorDeviceDispatch< Permutation, Device > dispatch;
       dispatch( begins, ends, f );
    }
 };
 
-template< typename Permutation,
-          typename Device >
+template< typename Permutation, typename Device >
 struct ParallelExecutor< Permutation, Device, IndexTag< 3 > >
 {
-   template< typename Begins,
-             typename Ends,
-             typename Func >
-   void operator()( const Begins& begins, const Ends& ends, Func f )
+   template< typename Begins, typename Ends, typename Func >
+   void
+   operator()( const Begins& begins, const Ends& ends, Func f )
    {
-      static_assert( Begins::getDimension() == Ends::getDimension(),
-                     "wrong begins or ends" );
+      static_assert( Begins::getDimension() == Ends::getDimension(), "wrong begins or ends" );
 
       using Index = typename Ends::IndexType;
 
       // nvcc does not like nested __cuda_callable__ and normal lambdas...
-//      auto kernel = [=] __cuda_callable__ ( Index i2, Index i1, Index i0 )
-//      {
-//         call_with_unpermuted_arguments< Permutation >( f, i0, i1, i2 );
-//      };
+      //      auto kernel = [=] __cuda_callable__ ( Index i2, Index i1, Index i0 )
+      //      {
+      //         call_with_unpermuted_arguments< Permutation >( f, i0, i1, i2 );
+      //      };
       Kernel< Device > kernel;
 
       const Index begin0 = begins.template getSize< get< 0 >( Permutation{} ) >();
@@ -217,7 +190,8 @@ struct ParallelExecutor< Permutation, Device, IndexTag< 3 > >
    struct Kernel
    {
       template< typename Index, typename Func >
-      void operator()( Index i2, Index i1, Index i0, Func f )
+      void
+      operator()( Index i2, Index i1, Index i0, Func f )
       {
          call_with_unpermuted_arguments< Permutation >( f, i0, i1, i2 );
       }
@@ -229,32 +203,30 @@ struct ParallelExecutor< Permutation, Device, IndexTag< 3 > >
    {
       template< typename Index, typename Func >
       __cuda_callable__
-      void operator()( Index i2, Index i1, Index i0, Func f )
+      void
+      operator()( Index i2, Index i1, Index i0, Func f )
       {
          call_with_unpermuted_arguments< Permutation >( f, i0, i1, i2 );
       }
    };
 };
 
-template< typename Permutation,
-          typename Device >
+template< typename Permutation, typename Device >
 struct ParallelExecutor< Permutation, Device, IndexTag< 2 > >
 {
-   template< typename Begins,
-             typename Ends,
-             typename Func >
-   void operator()( const Begins& begins, const Ends& ends, Func f )
+   template< typename Begins, typename Ends, typename Func >
+   void
+   operator()( const Begins& begins, const Ends& ends, Func f )
    {
-      static_assert( Begins::getDimension() == Ends::getDimension(),
-                     "wrong begins or ends" );
+      static_assert( Begins::getDimension() == Ends::getDimension(), "wrong begins or ends" );
 
       using Index = typename Ends::IndexType;
 
       // nvcc does not like nested __cuda_callable__ and normal lambdas...
-//      auto kernel = [=] __cuda_callable__ ( Index i1, Index i0 )
-//      {
-//         call_with_unpermuted_arguments< Permutation >( f, i0, i1 );
-//      };
+      //      auto kernel = [=] __cuda_callable__ ( Index i1, Index i0 )
+      //      {
+      //         call_with_unpermuted_arguments< Permutation >( f, i0, i1 );
+      //      };
       Kernel< Device > kernel;
 
       const Index begin0 = begins.template getSize< get< 0 >( Permutation{} ) >();
@@ -268,7 +240,8 @@ struct ParallelExecutor< Permutation, Device, IndexTag< 2 > >
    struct Kernel
    {
       template< typename Index, typename Func >
-      void operator()( Index i1, Index i0, Func f )
+      void
+      operator()( Index i1, Index i0, Func f )
       {
          call_with_unpermuted_arguments< Permutation >( f, i0, i1 );
       }
@@ -280,47 +253,44 @@ struct ParallelExecutor< Permutation, Device, IndexTag< 2 > >
    {
       template< typename Index, typename Func >
       __cuda_callable__
-      void operator()( Index i1, Index i0, Func f )
+      void
+      operator()( Index i1, Index i0, Func f )
       {
          call_with_unpermuted_arguments< Permutation >( f, i0, i1 );
       }
    };
 };
 
-template< typename Permutation,
-          typename Device >
+template< typename Permutation, typename Device >
 struct ParallelExecutor< Permutation, Device, IndexTag< 1 > >
 {
-   template< typename Begins,
-             typename Ends,
-             typename Func >
-   void operator()( const Begins& begins, const Ends& ends, Func f )
+   template< typename Begins, typename Ends, typename Func >
+   void
+   operator()( const Begins& begins, const Ends& ends, Func f )
    {
-      static_assert( Begins::getDimension() == Ends::getDimension(),
-                     "wrong begins or ends" );
+      static_assert( Begins::getDimension() == Ends::getDimension(), "wrong begins or ends" );
 
       using Index = typename Ends::IndexType;
 
-//      auto kernel = [=] __cuda_callable__ ( Index i )
-//      {
-//         call_with_unpermuted_arguments< Permutation >( f, i );
-//      };
+      //      auto kernel = [=] __cuda_callable__ ( Index i )
+      //      {
+      //         call_with_unpermuted_arguments< Permutation >( f, i );
+      //      };
 
       const Index begin = begins.template getSize< get< 0 >( Permutation{} ) >();
       const Index end = ends.template getSize< get< 0 >( Permutation{} ) >();
-//      Algorithms::ParallelFor< Device >::exec( begin, end, kernel );
+      //      Algorithms::ParallelFor< Device >::exec( begin, end, kernel );
       Algorithms::ParallelFor< Device >::exec( begin, end, f );
    }
 };
 
-
 // Device may be void which stands for StaticNDArray
-template< typename Permutation,
-          typename Device >
+template< typename Permutation, typename Device >
 struct ExecutorDispatcher
 {
    template< typename Begins, typename Ends, typename Func >
-   void operator()( const Begins& begins, const Ends& ends, Func f )
+   void
+   operator()( const Begins& begins, const Ends& ends, Func f )
    {
       SequentialExecutor< Permutation >()( begins, ends, f );
    }
@@ -330,7 +300,8 @@ template< typename Permutation >
 struct ExecutorDispatcher< Permutation, Devices::Host >
 {
    template< typename Begins, typename Ends, typename Func >
-   void operator()( const Begins& begins, const Ends& ends, Func f )
+   void
+   operator()( const Begins& begins, const Ends& ends, Func f )
    {
       if( Devices::Host::isOMPEnabled() && Devices::Host::getMaxThreadsCount() > 1 )
          ParallelExecutor< Permutation, Devices::Host >()( begins, ends, f );
@@ -343,12 +314,13 @@ template< typename Permutation >
 struct ExecutorDispatcher< Permutation, Devices::Cuda >
 {
    template< typename Begins, typename Ends, typename Func >
-   void operator()( const Begins& begins, const Ends& ends, Func f )
+   void
+   operator()( const Begins& begins, const Ends& ends, Func f )
    {
       ParallelExecutor< Permutation, Devices::Cuda >()( begins, ends, f );
    }
 };
 
-} // namespace __ndarray_impl
-} // namespace Containers
-} // namespace TNL
+}  // namespace __ndarray_impl
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/ndarray/Indexing.h b/src/TNL/Containers/ndarray/Indexing.h
index 0b510a4b1888f06db8fa6e26666e8ac9a24e6816..15653de76f0540949790e783d698e0f74648548b 100644
--- a/src/TNL/Containers/ndarray/Indexing.h
+++ b/src/TNL/Containers/ndarray/Indexing.h
@@ -14,116 +14,106 @@ namespace TNL {
 namespace Containers {
 namespace __ndarray_impl {
 
-template< typename OffsetsHolder,
-          typename Sequence >
+template< typename OffsetsHolder, typename Sequence >
 struct OffsetsHelper
 {};
 
-template< typename OffsetsHolder,
-          std::size_t... N >
+template< typename OffsetsHolder, std::size_t... N >
 struct OffsetsHelper< OffsetsHolder, std::index_sequence< N... > >
 {
    template< typename Func >
    __cuda_callable__
-   static auto apply( const OffsetsHolder& offsets, Func&& f ) -> decltype(auto)
+   static auto
+   apply( const OffsetsHolder& offsets, Func&& f ) -> decltype( auto )
    {
       return f( offsets.template getSize< N >()... );
    }
 
    template< typename Func >
-   static auto apply_host( const OffsetsHolder& offsets, Func&& f ) -> decltype(auto)
+   static auto
+   apply_host( const OffsetsHolder& offsets, Func&& f ) -> decltype( auto )
    {
       return f( offsets.template getSize< N >()... );
    }
 };
 
-template< typename OffsetsHolder,
-          typename Func >
+template< typename OffsetsHolder, typename Func >
 __cuda_callable__
-auto call_with_offsets( const OffsetsHolder& offsets, Func&& f ) -> decltype(auto)
+auto
+call_with_offsets( const OffsetsHolder& offsets, Func&& f ) -> decltype( auto )
 {
-   return OffsetsHelper< OffsetsHolder, std::make_index_sequence< OffsetsHolder::getDimension() > >
-          ::apply( offsets, std::forward< Func >( f ) );
+   return OffsetsHelper< OffsetsHolder, std::make_index_sequence< OffsetsHolder::getDimension() > >::apply(
+      offsets, std::forward< Func >( f ) );
 }
 
-template< typename OffsetsHolder,
-          typename Func >
-auto host_call_with_offsets( const OffsetsHolder& offsets, Func&& f ) -> decltype(auto)
+template< typename OffsetsHolder, typename Func >
+auto
+host_call_with_offsets( const OffsetsHolder& offsets, Func&& f ) -> decltype( auto )
 {
-   return OffsetsHelper< OffsetsHolder, std::make_index_sequence< OffsetsHolder::getDimension() > >
-          ::apply_host( offsets, std::forward< Func >( f ) );
+   return OffsetsHelper< OffsetsHolder, std::make_index_sequence< OffsetsHolder::getDimension() > >::apply_host(
+      offsets, std::forward< Func >( f ) );
 }
 
-
-template< typename OffsetsHolder,
-          typename Sequence >
+template< typename OffsetsHolder, typename Sequence >
 struct IndexShiftHelper
 {};
 
-template< typename OffsetsHolder,
-          std::size_t... N >
+template< typename OffsetsHolder, std::size_t... N >
 struct IndexShiftHelper< OffsetsHolder, std::index_sequence< N... > >
 {
-   template< typename Func,
-             typename... Indices >
+   template< typename Func, typename... Indices >
    __cuda_callable__
-   static auto apply( const OffsetsHolder& offsets, Func&& f, Indices&&... indices ) -> decltype(auto)
+   static auto
+   apply( const OffsetsHolder& offsets, Func&& f, Indices&&... indices ) -> decltype( auto )
    {
       return f( ( std::forward< Indices >( indices ) + offsets.template getSize< N >() )... );
    }
 
-   template< typename Func,
-             typename... Indices >
-   static auto apply_host( const OffsetsHolder& offsets, Func&& f, Indices&&... indices ) -> decltype(auto)
+   template< typename Func, typename... Indices >
+   static auto
+   apply_host( const OffsetsHolder& offsets, Func&& f, Indices&&... indices ) -> decltype( auto )
    {
       return f( ( std::forward< Indices >( indices ) + offsets.template getSize< N >() )... );
    }
 };
 
-template< typename OffsetsHolder,
-          typename Func,
-          typename... Indices >
+template< typename OffsetsHolder, typename Func, typename... Indices >
 __cuda_callable__
-auto call_with_shifted_indices( const OffsetsHolder& offsets, Func&& f, Indices&&... indices ) -> decltype(auto)
+auto
+call_with_shifted_indices( const OffsetsHolder& offsets, Func&& f, Indices&&... indices ) -> decltype( auto )
 {
-   return IndexShiftHelper< OffsetsHolder, std::make_index_sequence< sizeof...( Indices ) > >
-          ::apply( offsets, std::forward< Func >( f ), std::forward< Indices >( indices )... );
+   return IndexShiftHelper< OffsetsHolder, std::make_index_sequence< sizeof...( Indices ) > >::apply(
+      offsets, std::forward< Func >( f ), std::forward< Indices >( indices )... );
 }
 
-template< typename OffsetsHolder,
-          typename Func,
-          typename... Indices >
-auto host_call_with_shifted_indices( const OffsetsHolder& offsets, Func&& f, Indices&&... indices ) -> decltype(auto)
+template< typename OffsetsHolder, typename Func, typename... Indices >
+auto
+host_call_with_shifted_indices( const OffsetsHolder& offsets, Func&& f, Indices&&... indices ) -> decltype( auto )
 {
-   return IndexShiftHelper< OffsetsHolder, std::make_index_sequence< sizeof...( Indices ) > >
-          ::apply_host( offsets, std::forward< Func >( f ), std::forward< Indices >( indices )... );
+   return IndexShiftHelper< OffsetsHolder, std::make_index_sequence< sizeof...( Indices ) > >::apply_host(
+      offsets, std::forward< Func >( f ), std::forward< Indices >( indices )... );
 }
 
-
-template< typename SizesHolder,
-          typename Overlaps,
-          typename Sequence >
+template< typename SizesHolder, typename Overlaps, typename Sequence >
 struct IndexUnshiftHelper
 {};
 
-template< typename SizesHolder,
-          typename Overlaps,
-          std::size_t... N >
+template< typename SizesHolder, typename Overlaps, std::size_t... N >
 struct IndexUnshiftHelper< SizesHolder, Overlaps, std::index_sequence< N... > >
 {
-   template< typename Func,
-             typename... Indices >
+   template< typename Func, typename... Indices >
    __cuda_callable__
-   static auto apply( const SizesHolder& begins, Func&& f, Indices&&... indices ) -> decltype(auto)
+   static auto
+   apply( const SizesHolder& begins, Func&& f, Indices&&... indices ) -> decltype( auto )
    {
-      return f( ( get<N>( Overlaps{} ) + std::forward< Indices >( indices ) - begins.template getSize< N >() )... );
+      return f( ( get< N >( Overlaps{} ) + std::forward< Indices >( indices ) - begins.template getSize< N >() )... );
    }
 
-   template< typename Func,
-             typename... Indices >
-   static auto apply_host( const SizesHolder& begins, Func&& f, Indices&&... indices ) -> decltype(auto)
+   template< typename Func, typename... Indices >
+   static auto
+   apply_host( const SizesHolder& begins, Func&& f, Indices&&... indices ) -> decltype( auto )
    {
-      return f( ( get<N>( Overlaps{} ) + std::forward< Indices >( indices ) - begins.template getSize< N >() )... );
+      return f( ( get< N >( Overlaps{} ) + std::forward< Indices >( indices ) - begins.template getSize< N >() )... );
    }
 };
 
@@ -132,23 +122,24 @@ template< typename SizesHolder,
           typename Func,
           typename... Indices >
 __cuda_callable__
-auto call_with_unshifted_indices( const SizesHolder& begins, Func&& f, Indices&&... indices ) -> decltype(auto)
+auto
+call_with_unshifted_indices( const SizesHolder& begins, Func&& f, Indices&&... indices ) -> decltype( auto )
 {
-   return IndexUnshiftHelper< SizesHolder, Overlaps, std::make_index_sequence< sizeof...( Indices ) > >
-          ::apply( begins, std::forward< Func >( f ), std::forward< Indices >( indices )... );
+   return IndexUnshiftHelper< SizesHolder, Overlaps, std::make_index_sequence< sizeof...( Indices ) > >::apply(
+      begins, std::forward< Func >( f ), std::forward< Indices >( indices )... );
 }
 
 template< typename SizesHolder,
           typename Overlaps = make_constant_index_sequence< SizesHolder::getDimension(), 0 >,
           typename Func,
           typename... Indices >
-auto host_call_with_unshifted_indices( const SizesHolder& begins, Func&& f, Indices&&... indices ) -> decltype(auto)
+auto
+host_call_with_unshifted_indices( const SizesHolder& begins, Func&& f, Indices&&... indices ) -> decltype( auto )
 {
-   return IndexUnshiftHelper< SizesHolder, Overlaps, std::make_index_sequence< sizeof...( Indices ) > >
-          ::apply_host( begins, std::forward< Func >( f ), std::forward< Indices >( indices )... );
+   return IndexUnshiftHelper< SizesHolder, Overlaps, std::make_index_sequence< sizeof...( Indices ) > >::apply_host(
+      begins, std::forward< Func >( f ), std::forward< Indices >( indices )... );
 }
 
-
 template< typename Permutation,
           typename Overlaps,
           typename Alignment,
@@ -158,43 +149,32 @@ template< typename Permutation,
 struct SlicedIndexer
 {};
 
-template< typename Permutation,
-          typename Overlaps,
-          typename Alignment,
-          typename SliceInfo,
-          std::size_t level >
+template< typename Permutation, typename Overlaps, typename Alignment, typename SliceInfo, std::size_t level >
 struct SlicedIndexer< Permutation, Overlaps, Alignment, SliceInfo, level, false >
 {
    template< typename SizesHolder, typename StridesHolder, typename... Indices >
    __cuda_callable__
    static typename SizesHolder::IndexType
-   getIndex( const SizesHolder& sizes,
-             const StridesHolder& strides,
-             Indices&&... indices )
+   getIndex( const SizesHolder& sizes, const StridesHolder& strides, Indices&&... indices )
    {
       static constexpr std::size_t idx = get< level >( Permutation{} );
       static constexpr std::size_t overlap = __ndarray_impl::get< idx >( Overlaps{} );
       const auto alpha = get_from_pack< idx >( std::forward< Indices >( indices )... );
       const auto size = Alignment::template getAlignedSize< idx >( sizes ) + 2 * overlap;
-      const auto previous = SlicedIndexer< Permutation, Overlaps, Alignment, SliceInfo, level - 1 >::getIndex( sizes, strides, std::forward< Indices >( indices )... );
+      const auto previous = SlicedIndexer< Permutation, Overlaps, Alignment, SliceInfo, level - 1 >::getIndex(
+         sizes, strides, std::forward< Indices >( indices )... );
 
       return strides.template getStride< idx >( alpha ) * ( alpha + overlap + size * previous );
    }
 };
 
-template< typename Permutation,
-          typename Overlaps,
-          typename Alignment,
-          typename SliceInfo,
-          std::size_t level >
+template< typename Permutation, typename Overlaps, typename Alignment, typename SliceInfo, std::size_t level >
 struct SlicedIndexer< Permutation, Overlaps, Alignment, SliceInfo, level, true >
 {
    template< typename SizesHolder, typename StridesHolder, typename... Indices >
    __cuda_callable__
    static typename SizesHolder::IndexType
-   getIndex( const SizesHolder& sizes,
-             const StridesHolder& strides,
-             Indices&&... indices )
+   getIndex( const SizesHolder& sizes, const StridesHolder& strides, Indices&&... indices )
    {
       static_assert( SizesHolder::template getStaticSize< get< level >( Permutation{} ) >() == 0,
                      "Invalid SliceInfo: static dimension cannot be sliced." );
@@ -204,54 +184,47 @@ struct SlicedIndexer< Permutation, Overlaps, Alignment, SliceInfo, level, true >
       const auto alpha = get_from_pack< idx >( std::forward< Indices >( indices )... );
       static constexpr std::size_t S = SliceInfo::getSliceSize( idx );
       // TODO: check the calculation with strides and overlaps
-      return strides.template getStride< idx >( alpha ) *
-                  ( S * ((alpha + overlap) / S) * StorageSizeGetter< SizesHolder, Alignment, Overlaps, IndexTag< level - 1 > >::getPermuted( sizes, Permutation{} ) +
-                    (alpha + overlap) % S ) +
-             S * SlicedIndexer< Permutation, Overlaps, Alignment, SliceInfo, level - 1 >::getIndex( sizes, strides, std::forward< Indices >( indices )... );
+      return strides.template getStride< idx >( alpha )
+              * ( S * ( ( alpha + overlap ) / S )
+                     * StorageSizeGetter< SizesHolder, Alignment, Overlaps, IndexTag< level - 1 > >::getPermuted(
+                        sizes, Permutation{} )
+                  + ( alpha + overlap ) % S )
+           + S
+                * SlicedIndexer< Permutation, Overlaps, Alignment, SliceInfo, level - 1 >::getIndex(
+                   sizes, strides, std::forward< Indices >( indices )... );
    }
 };
 
-template< typename Permutation,
-          typename Overlaps,
-          typename Alignment,
-          typename SliceInfo >
+template< typename Permutation, typename Overlaps, typename Alignment, typename SliceInfo >
 struct SlicedIndexer< Permutation, Overlaps, Alignment, SliceInfo, 0, false >
 {
    template< typename SizesHolder, typename StridesHolder, typename... Indices >
    __cuda_callable__
    static typename SizesHolder::IndexType
-   getIndex( const SizesHolder& sizes,
-             const StridesHolder& strides,
-             Indices&&... indices )
+   getIndex( const SizesHolder& sizes, const StridesHolder& strides, Indices&&... indices )
    {
       static constexpr std::size_t idx = get< 0 >( Permutation{} );
       static constexpr std::size_t overlap = __ndarray_impl::get< idx >( Overlaps{} );
       const auto alpha = get_from_pack< idx >( std::forward< Indices >( indices )... );
-      return strides.template getStride< idx >( alpha ) * (alpha + overlap);
+      return strides.template getStride< idx >( alpha ) * ( alpha + overlap );
    }
 };
 
-template< typename Permutation,
-          typename Overlaps,
-          typename Alignment,
-          typename SliceInfo >
+template< typename Permutation, typename Overlaps, typename Alignment, typename SliceInfo >
 struct SlicedIndexer< Permutation, Overlaps, Alignment, SliceInfo, 0, true >
 {
    template< typename SizesHolder, typename StridesHolder, typename... Indices >
    __cuda_callable__
    static typename SizesHolder::IndexType
-   getIndex( const SizesHolder& sizes,
-             const StridesHolder& strides,
-             Indices&&... indices )
+   getIndex( const SizesHolder& sizes, const StridesHolder& strides, Indices&&... indices )
    {
       static constexpr std::size_t idx = get< 0 >( Permutation{} );
       static constexpr std::size_t overlap = __ndarray_impl::get< idx >( Overlaps{} );
       const auto alpha = get_from_pack< idx >( std::forward< Indices >( indices )... );
-      return strides.template getStride< idx >( alpha ) * (alpha + overlap);
+      return strides.template getStride< idx >( alpha ) * ( alpha + overlap );
    }
 };
 
-
 // SliceInfo should be always empty (i.e. sliceSize == 0)
 template< typename SliceInfo >
 struct NDArrayBase
@@ -267,26 +240,29 @@ struct NDArrayBase
          const auto size = sizes.template getSize< dimension >();
          // round up the last dynamic dimension to improve performance
          // TODO: aligning is good for GPU, but bad for CPU
-//         static constexpr decltype(size) mult = 32;
-//         if( dimension == get< Permutation::size() - 1 >( Permutation{} )
-//                 && SizesHolder::template getStaticSize< dimension >() == 0 )
-//             return mult * ( size / mult + ( size % mult != 0 ) );
+         //         static constexpr decltype(size) mult = 32;
+         //         if( dimension == get< Permutation::size() - 1 >( Permutation{} )
+         //                 && SizesHolder::template getStaticSize< dimension >() == 0 )
+         //             return mult * ( size / mult + ( size % mult != 0 ) );
          return size;
       }
    };
 
    template< typename Permutation, typename Overlaps, typename SizesHolder, typename StridesHolder, typename... Indices >
    __cuda_callable__
-   typename SizesHolder::IndexType
-   static getStorageIndex( const SizesHolder& sizes, const StridesHolder& strides, Indices&&... indices )
+   typename SizesHolder::IndexType static getStorageIndex( const SizesHolder& sizes,
+                                                           const StridesHolder& strides,
+                                                           Indices&&... indices )
    {
       static_assert( check_slice_size( SizesHolder::getDimension(), 0 ), "BUG - invalid SliceInfo type passed to NDArrayBase" );
       using Alignment = Alignment< Permutation >;
-      return SlicedIndexer< Permutation, Overlaps, Alignment, SliceInfo >::getIndex( sizes, strides, std::forward< Indices >( indices )... );
+      return SlicedIndexer< Permutation, Overlaps, Alignment, SliceInfo >::getIndex(
+         sizes, strides, std::forward< Indices >( indices )... );
    }
 
 private:
-   static constexpr bool check_slice_size( std::size_t dim, std::size_t sliceSize )
+   static constexpr bool
+   check_slice_size( std::size_t dim, std::size_t sliceSize )
    {
       for( std::size_t i = 0; i < dim; i++ )
          if( SliceInfo::getSliceSize( i ) != sliceSize )
@@ -295,7 +271,6 @@ private:
    }
 };
 
-
 template< typename SliceInfo >
 struct SlicedNDArrayBase
 {
@@ -308,18 +283,16 @@ struct SlicedNDArrayBase
       getAlignedSize( const SizesHolder& sizes )
       {
          const auto size = sizes.template getSize< dimension >();
-         if( SliceInfo::getSliceSize(dimension) > 0 )
+         if( SliceInfo::getSliceSize( dimension ) > 0 )
 // icpc does not consider the condition when printing warnings
 #ifdef __INTEL_COMPILER
    #pragma warning push
-   #pragma warning disable 39    // division by zero
-   #pragma warning disable 179   // right operand of "%" is zero
+   #pragma warning disable 39   // division by zero
+   #pragma warning disable 179  // right operand of "%" is zero
 #endif
             // round to multiple of SliceSize
-            return SliceInfo::getSliceSize(dimension) * (
-                        size / SliceInfo::getSliceSize(dimension) +
-                        ( size % SliceInfo::getSliceSize(dimension) != 0 )
-                     );
+            return SliceInfo::getSliceSize( dimension )
+                 * ( size / SliceInfo::getSliceSize( dimension ) + ( size % SliceInfo::getSliceSize( dimension ) != 0 ) );
 #ifdef __INTEL_COMPILER
    #pragma warning pop
 #endif
@@ -334,10 +307,11 @@ struct SlicedNDArrayBase
    getStorageIndex( const SizesHolder& sizes, const StridesHolder& strides, Indices&&... indices )
    {
       using Alignment = Alignment< Permutation >;
-      return SlicedIndexer< Permutation, Overlaps, Alignment, SliceInfo >::getIndex( sizes, strides, std::forward< Indices >( indices )... );
+      return SlicedIndexer< Permutation, Overlaps, Alignment, SliceInfo >::getIndex(
+         sizes, strides, std::forward< Indices >( indices )... );
    }
 };
 
-} // namespace __ndarray_impl
-} // namespace Containers
-} // namespace TNL
+}  // namespace __ndarray_impl
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/ndarray/Meta.h b/src/TNL/Containers/ndarray/Meta.h
index e6eb75e08aeba351ba7a557d5b211fe8c913ee3d..a24166e391f5bd98e45e078de4c76c06504afdf9 100644
--- a/src/TNL/Containers/ndarray/Meta.h
+++ b/src/TNL/Containers/ndarray/Meta.h
@@ -20,35 +20,36 @@ namespace __ndarray_impl {
  * Reference:
  * http://stackoverflow.com/questions/20162903/template-parameter-packs-access-nth-type-and-nth-element/37836252#37836252
  */
-template< std::size_t index, typename T, typename... Ts,
-          typename = typename std::enable_if< index == 0 >::type >
+template< std::size_t index, typename T, typename... Ts, typename = typename std::enable_if< index == 0 >::type >
 constexpr T
 get_from_pack( T&& arg, Ts&&... args )
 {
    return arg;
 }
 
-template< std::size_t index, typename T, typename... Ts,
-          typename = typename std::enable_if< (index > 0) && index <= sizeof...( Ts ) >::type >
+template< std::size_t index,
+          typename T,
+          typename... Ts,
+          typename = typename std::enable_if< ( index > 0 ) && index <= sizeof...( Ts ) >::type >
 constexpr auto
 get_from_pack( T&& arg, Ts&&... args )
 {
-   return get_from_pack< index-1 >( std::forward< Ts >( args )... );
+   return get_from_pack< index - 1 >( std::forward< Ts >( args )... );
 }
 
 // complementary specialization for getting a more readable compilation error
 // in case calling get with a bad index
-template< long long index, typename T, typename... Ts,
-          typename = typename std::enable_if< (index < 0) || (index > sizeof...( Ts )) >::type >
+template< long long index,
+          typename T,
+          typename... Ts,
+          typename = typename std::enable_if< ( index < 0 ) || ( index > sizeof...( Ts ) ) >::type >
 constexpr T
 get_from_pack( T&& arg, Ts&&... args )
 {
-   static_assert( index >= 0 && index <= sizeof...( Ts ),
-                  "invalid index passed to the get function" );
+   static_assert( index >= 0 && index <= sizeof...( Ts ), "invalid index passed to the get function" );
    return arg;
 }
 
-
 // Get N-th element from std::integer_sequence.
 template< std::size_t N, typename Index, Index... vals >
 constexpr Index
@@ -57,7 +58,6 @@ get( std::integer_sequence< Index, vals... > )
    return get_from_pack< N >( vals... );
 }
 
-
 // Test if a variadic pack contains a value.
 template< typename Index, typename T >
 constexpr bool
@@ -75,7 +75,6 @@ is_in_pack( Index value, T&& pack_value, Ts&&... vals )
    return is_in_pack( value, std::forward< Ts >( vals )... );
 }
 
-
 // Test if an std::integer_sequence contains an element.
 template< typename Index, Index... vals >
 constexpr bool
@@ -84,7 +83,6 @@ is_in_sequence( Index value, std::integer_sequence< Index, vals... > )
    return is_in_pack( value, vals... );
 }
 
-
 // Get index of the first occurrence of value in a variadic pack.
 template< typename V >
 constexpr std::size_t
@@ -102,7 +100,6 @@ index_in_pack( V&& value, T&& arg, Ts&&... args )
    return 1 + index_in_pack( value, std::forward< Ts >( args )... );
 }
 
-
 // Get index of the first occurrence of value in a std::integer_sequence
 template< typename V, typename Index, Index... vals >
 constexpr std::size_t
@@ -111,7 +108,6 @@ index_in_sequence( V&& value, std::integer_sequence< Index, vals... > )
    return index_in_pack( std::forward< V >( value ), vals... );
 }
 
-
 /*
  * Generic function to concatenate an arbitrary number of std::integer_sequence instances.
  * Useful mainly for getting the type of the resulting sequence with `decltype`.
@@ -125,22 +121,21 @@ concat_sequences( std::integer_sequence< Index, s... > )
 }
 
 // concatenate two sequences, each potentially empty
-template< typename Index, Index... s, Index... t>
+template< typename Index, Index... s, Index... t >
 constexpr auto
 concat_sequences( std::integer_sequence< Index, s... >, std::integer_sequence< Index, t... > )
 {
-   return std::integer_sequence< Index, s... , t... >{};
+   return std::integer_sequence< Index, s..., t... >{};
 }
 
 // concatenate more than 2 sequences
 template< typename Index, Index... s, Index... t, typename... R >
 constexpr auto
-concat_sequences( std::integer_sequence< Index, s... >, std::integer_sequence< Index, t...>, R... )
+concat_sequences( std::integer_sequence< Index, s... >, std::integer_sequence< Index, t... >, R... )
 {
    return concat_sequences( std::integer_sequence< Index, s..., t... >{}, R{}... );
 }
 
-
 // Integer wrapper necessary for C++ templates specializations.
 // As the C++ standard says:
 //    A partially specialized non-type argument expression shall not involve
@@ -152,71 +147,57 @@ struct IndexTag
    static constexpr std::size_t value = v;
 };
 
-
-template< typename Permutation,
-          typename Sequence >
+template< typename Permutation, typename Sequence >
 struct CallPermutationHelper
 {};
 
-template< typename Permutation,
-          std::size_t... N >
+template< typename Permutation, std::size_t... N >
 struct CallPermutationHelper< Permutation, std::index_sequence< N... > >
 {
-   template< typename Func,
-             typename... Args >
-   static constexpr auto apply( Func&& f, Args&&... args ) -> decltype(auto)
+   template< typename Func, typename... Args >
+   static constexpr auto
+   apply( Func&& f, Args&&... args ) -> decltype( auto )
    {
-      return std::forward< Func >( f )( get_from_pack<
-                  get< N >( Permutation{} )
-                >( std::forward< Args >( args )... )... );
+      return std::forward< Func >( f )( get_from_pack< get< N >( Permutation{} ) >( std::forward< Args >( args )... )... );
    }
 };
 
 // Call specified function with permuted arguments.
 // [used in ndarray_operations.h]
-template< typename Permutation,
-          typename Func,
-          typename... Args >
+template< typename Permutation, typename Func, typename... Args >
 constexpr auto
-call_with_permuted_arguments( Func&& f, Args&&... args ) -> decltype(auto)
+call_with_permuted_arguments( Func&& f, Args&&... args ) -> decltype( auto )
 {
-   return CallPermutationHelper< Permutation, std::make_index_sequence< sizeof...( Args ) > >
-          ::apply( std::forward< Func >( f ), std::forward< Args >( args )... );
+   return CallPermutationHelper< Permutation, std::make_index_sequence< sizeof...( Args ) > >::apply(
+      std::forward< Func >( f ), std::forward< Args >( args )... );
 }
 
-
-template< typename Permutation,
-          typename Sequence >
+template< typename Permutation, typename Sequence >
 struct CallInversePermutationHelper
 {};
 
-template< typename Permutation,
-          std::size_t... N >
+template< typename Permutation, std::size_t... N >
 struct CallInversePermutationHelper< Permutation, std::index_sequence< N... > >
 {
-   template< typename Func,
-             typename... Args >
-   static constexpr auto apply( Func&& f, Args&&... args ) -> decltype(auto)
+   template< typename Func, typename... Args >
+   static constexpr auto
+   apply( Func&& f, Args&&... args ) -> decltype( auto )
    {
-      return std::forward< Func >( f )( get_from_pack<
-                  index_in_sequence( N, Permutation{} )
-                >( std::forward< Args >( args )... )... );
+      return std::forward< Func >( f )(
+         get_from_pack< index_in_sequence( N, Permutation{} ) >( std::forward< Args >( args )... )... );
    }
 };
 
 // Call specified function with permuted arguments.
 // [used in ndarray_operations.h]
-template< typename Permutation,
-          typename Func,
-          typename... Args >
+template< typename Permutation, typename Func, typename... Args >
 constexpr auto
-call_with_unpermuted_arguments( Func&& f, Args&&... args ) -> decltype(auto)
+call_with_unpermuted_arguments( Func&& f, Args&&... args ) -> decltype( auto )
 {
-   return CallInversePermutationHelper< Permutation, std::make_index_sequence< sizeof...( Args ) > >
-          ::apply( std::forward< Func >( f ), std::forward< Args >( args )... );
+   return CallInversePermutationHelper< Permutation, std::make_index_sequence< sizeof...( Args ) > >::apply(
+      std::forward< Func >( f ), std::forward< Args >( args )... );
 }
 
-
 // Check that all elements of the initializer list are equal to the specified value.
 // [used in ndarray_operations.h]
 constexpr bool
@@ -228,7 +209,6 @@ all_elements_equal_to_value( std::size_t value, std::initializer_list< std::size
    return true;
 }
 
-
 // Check that all elements of the initializer list are in the specified range [begin, end).
 // [used in ndarray.h -- static assertions on permutations]
 constexpr bool
@@ -240,7 +220,6 @@ all_elements_in_range( std::size_t begin, std::size_t end, std::initializer_list
    return true;
 }
 
-
 // Check that the elements of the initializer list form an increasing sequence.
 // [used in ndarray.h -- static assertion in getSubarrayView()]
 constexpr bool
@@ -257,7 +236,6 @@ is_increasing_sequence( std::initializer_list< std::size_t > list )
    return true;
 }
 
-
 // Count elements of a variadic pack smaller than a specified value
 // [used in ndarray_subarray.h to generate a subpermutation]
 template< typename T, typename V >
@@ -276,12 +254,11 @@ count_smaller( T threshold, V&& value, Values&&... vals )
    return count_smaller( threshold, vals... );
 }
 
-
 // C++17 version using "if constexpr" and a general predicate (lambda function)
 // Reference: https://stackoverflow.com/a/41723705
-//template< typename Index, Index a, typename Predicate >
-//constexpr auto
-//FilterSingle( std::integer_sequence< Index, a >, Predicate pred )
+// template< typename Index, Index a, typename Predicate >
+// constexpr auto
+// FilterSingle( std::integer_sequence< Index, a >, Predicate pred )
 //{
 //   if constexpr (pred(a))
 //      return std::integer_sequence< Index, a >{};
@@ -290,27 +267,26 @@ count_smaller( T threshold, V&& value, Values&&... vals )
 //}
 //
 //// empty sequence case
-//template< typename Index, typename Predicate >
-//constexpr auto
-//filter_sequence( std::integer_sequence< Index >, [[maybe_unused]] Predicate pred )
+// template< typename Index, typename Predicate >
+// constexpr auto
+// filter_sequence( std::integer_sequence< Index >, [[maybe_unused]] Predicate pred )
 //{
-//   return std::integer_sequence< Index >{};
-//}
+//    return std::integer_sequence< Index >{};
+// }
 //
 //// non empty sequence case
-//template< typename Index, Index... vals, typename Predicate >
-//constexpr auto
-//filter_sequence( std::integer_sequence< Index, vals... >, [[maybe_unused]] Predicate pred )
+// template< typename Index, Index... vals, typename Predicate >
+// constexpr auto
+// filter_sequence( std::integer_sequence< Index, vals... >, [[maybe_unused]] Predicate pred )
 //{
-//   return concat_sequences( FilterSingle( std::integer_sequence< Index, vals >{}, pred )... );
-//}
+//    return concat_sequences( FilterSingle( std::integer_sequence< Index, vals >{}, pred )... );
+// }
 
 // C++14 version, with hard-coded predicate
 template< typename Mask, typename Index, Index val >
-constexpr typename std::conditional_t< is_in_sequence( val, Mask{} ),
-                                       std::integer_sequence< Index, val >,
-                                       std::integer_sequence< Index > >
-FilterSingle( std::integer_sequence< Index, val > )
+constexpr typename std::
+   conditional_t< is_in_sequence( val, Mask{} ), std::integer_sequence< Index, val >, std::integer_sequence< Index > >
+   FilterSingle( std::integer_sequence< Index, val > )
 {
    return {};
 }
@@ -335,42 +311,41 @@ filter_sequence( std::integer_sequence< Index, vals... > )
    return concat_sequences( FilterSingle< Mask >( std::integer_sequence< Index, vals >{} )... );
 }
 
-
 /*
  * make_constant_integer_sequence, make_constant_index_sequence - helper
  * templates for the generation of constant sequences like
  * std::make_integer_sequence, std::make_index_sequence
  */
-template< typename T, typename N, T v > struct gen_const_seq;
-template< typename T, typename N, T v > using gen_const_seq_t = typename gen_const_seq< T, N, v >::type;
+template< typename T, typename N, T v >
+struct gen_const_seq;
+template< typename T, typename N, T v >
+using gen_const_seq_t = typename gen_const_seq< T, N, v >::type;
 
 template< typename T, typename N, T v >
 struct gen_const_seq
 {
-   using type = decltype(concat_sequences(
-                     gen_const_seq_t<T, std::integral_constant<T, N::value/2>, v>{},
-                     gen_const_seq_t<T, std::integral_constant<T, N::value - N::value/2>, v>{}
-                  ));
+   using type = decltype( concat_sequences( gen_const_seq_t< T, std::integral_constant< T, N::value / 2 >, v >{},
+                                            gen_const_seq_t< T, std::integral_constant< T, N::value - N::value / 2 >, v >{} ) );
 };
 
 template< typename T, T v >
-struct gen_const_seq< T, std::integral_constant<T, 0>, v >
+struct gen_const_seq< T, std::integral_constant< T, 0 >, v >
 {
-   using type = std::integer_sequence<T>;
+   using type = std::integer_sequence< T >;
 };
 
 template< typename T, T v >
-struct gen_const_seq< T, std::integral_constant<T, 1>, v >
+struct gen_const_seq< T, std::integral_constant< T, 1 >, v >
 {
-   using type = std::integer_sequence<T, v>;
+   using type = std::integer_sequence< T, v >;
 };
 
 template< typename T, T N, T value >
-using make_constant_integer_sequence = gen_const_seq_t< T, std::integral_constant<T, N>, value >;
+using make_constant_integer_sequence = gen_const_seq_t< T, std::integral_constant< T, N >, value >;
 
 template< std::size_t N, std::size_t value >
-using make_constant_index_sequence = gen_const_seq_t< std::size_t, std::integral_constant<std::size_t, N>, value >;
+using make_constant_index_sequence = gen_const_seq_t< std::size_t, std::integral_constant< std::size_t, N >, value >;
 
-} // namespace __ndarray_impl
-} // namespace Containers
-} // namespace TNL
+}  // namespace __ndarray_impl
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/ndarray/Operations.h b/src/TNL/Containers/ndarray/Operations.h
index cf3aa00f31936ce4c4b0133a653d46fd3a6a969e..d3289afc9968f6a56d3611f06fe36e4b35f4a737 100644
--- a/src/TNL/Containers/ndarray/Operations.h
+++ b/src/TNL/Containers/ndarray/Operations.h
@@ -16,17 +16,17 @@ namespace Containers {
 namespace __ndarray_impl {
 
 #ifndef __NVCC__
-template< typename Output,
-          typename Func,
-          typename... Input >
-void nd_map_view( Output output, Func f, const Input... input )
+template< typename Output, typename Func, typename... Input >
+void
+nd_map_view( Output output, Func f, const Input... input )
 {
-   static_assert( all_elements_equal_to_value( Output::getDimension(), {Input::getDimension()...} ),
+   static_assert( all_elements_equal_to_value( Output::getDimension(), { Input::getDimension()... } ),
                   "all arrays must be of the same dimension" );
 
    // without mutable, the operator() would be const so output would be const as well
    // https://stackoverflow.com/a/2835645/4180822
-   auto wrapper = [=] __cuda_callable__ ( auto... indices ) mutable {
+   auto wrapper = [ = ] __cuda_callable__( auto... indices ) mutable
+   {
       static_assert( sizeof...( indices ) == Output::getDimension(),
                      "wrong number of indices passed to the wrapper lambda function" );
       output( indices... ) = f( input( indices... )... );
@@ -39,97 +39,93 @@ void nd_map_view( Output output, Func f, const Input... input )
 
 #else
 
-   template< typename Output,
-             typename Func >
-   struct nvcc_map_helper_0
-   {
-      Output output;
-      Func f;
-
-      nvcc_map_helper_0( Output o, Func f ) : output(o), f(f) {}
+template< typename Output, typename Func >
+struct nvcc_map_helper_0
+{
+   Output output;
+   Func f;
 
-      template< typename... Ts >
-      __cuda_callable__
-      void operator()( Ts... indices )
-      {
-         static_assert( sizeof...( indices ) == Output::getDimension(),
-                        "wrong number of indices passed to the wrapper operator() function" );
-         output( indices... ) = f();
-      }
-   };
+   nvcc_map_helper_0( Output o, Func f ) : output( o ), f( f ) {}
 
-   template< typename Output,
-             typename Func,
-             typename Input1 >
-   struct nvcc_map_helper_1
+   template< typename... Ts >
+   __cuda_callable__
+   void
+   operator()( Ts... indices )
    {
-      Output output;
-      Func f;
-      Input1 input1;
+      static_assert( sizeof...( indices ) == Output::getDimension(),
+                     "wrong number of indices passed to the wrapper operator() function" );
+      output( indices... ) = f();
+   }
+};
 
-      nvcc_map_helper_1( Output o, Func f, Input1 i1 ) : output(o), f(f), input1(i1) {}
+template< typename Output, typename Func, typename Input1 >
+struct nvcc_map_helper_1
+{
+   Output output;
+   Func f;
+   Input1 input1;
 
-      template< typename... Ts >
-      __cuda_callable__
-      void operator()( Ts... indices )
-      {
-         static_assert( sizeof...( indices ) == Output::getDimension(),
-                        "wrong number of indices passed to the wrapper operator() function" );
-         output( indices... ) = f( input1( indices... ) );
-      }
-   };
+   nvcc_map_helper_1( Output o, Func f, Input1 i1 ) : output( o ), f( f ), input1( i1 ) {}
 
-   template< typename Output,
-             typename Func,
-             typename Input1,
-             typename Input2 >
-   struct nvcc_map_helper_2
+   template< typename... Ts >
+   __cuda_callable__
+   void
+   operator()( Ts... indices )
    {
-      Output output;
-      Func f;
-      Input1 input1;
-      Input2 input2;
+      static_assert( sizeof...( indices ) == Output::getDimension(),
+                     "wrong number of indices passed to the wrapper operator() function" );
+      output( indices... ) = f( input1( indices... ) );
+   }
+};
 
-      nvcc_map_helper_2( Output o, Func f, Input1 i1, Input2 i2 ) : output(o), f(f), input1(i1), input2(i2) {}
+template< typename Output, typename Func, typename Input1, typename Input2 >
+struct nvcc_map_helper_2
+{
+   Output output;
+   Func f;
+   Input1 input1;
+   Input2 input2;
 
-      template< typename... Ts >
-      __cuda_callable__
-      void operator()( Ts... indices )
-      {
-         static_assert( sizeof...( indices ) == Output::getDimension(),
-                        "wrong number of indices passed to the wrapper operator() function" );
-         output( indices... ) = f( input1( indices... ), input2( indices... ) );
-      }
-   };
+   nvcc_map_helper_2( Output o, Func f, Input1 i1, Input2 i2 ) : output( o ), f( f ), input1( i1 ), input2( i2 ) {}
 
-   template< typename Output,
-             typename Func,
-             typename Input1,
-             typename Input2,
-             typename Input3 >
-   struct nvcc_map_helper_3
+   template< typename... Ts >
+   __cuda_callable__
+   void
+   operator()( Ts... indices )
    {
-      Output output;
-      Func f;
-      Input1 input1;
-      Input2 input2;
-      Input3 input3;
-
-      nvcc_map_helper_3( Output o, Func f, Input1 i1, Input2 i2, Input3 i3 ) : output(o), f(f), input1(i1), input2(i2), input3(i3) {}
-
-      template< typename... Ts >
-      __cuda_callable__
-      void operator()( Ts... indices )
-      {
-         static_assert( sizeof...( indices ) == Output::getDimension(),
-                        "wrong number of indices passed to the wrapper operator() function" );
-         output( indices... ) = f( input1( indices... ), input2( indices... ), input3( indices... ) );
-      }
-   };
+      static_assert( sizeof...( indices ) == Output::getDimension(),
+                     "wrong number of indices passed to the wrapper operator() function" );
+      output( indices... ) = f( input1( indices... ), input2( indices... ) );
+   }
+};
 
-template< typename Output,
-          typename Func >
-void nd_map_view( Output output, Func f )
+template< typename Output, typename Func, typename Input1, typename Input2, typename Input3 >
+struct nvcc_map_helper_3
+{
+   Output output;
+   Func f;
+   Input1 input1;
+   Input2 input2;
+   Input3 input3;
+
+   nvcc_map_helper_3( Output o, Func f, Input1 i1, Input2 i2, Input3 i3 )
+   : output( o ), f( f ), input1( i1 ), input2( i2 ), input3( i3 )
+   {}
+
+   template< typename... Ts >
+   __cuda_callable__
+   void
+   operator()( Ts... indices )
+   {
+      static_assert( sizeof...( indices ) == Output::getDimension(),
+                     "wrong number of indices passed to the wrapper operator() function" );
+      output( indices... ) = f( input1( indices... ), input2( indices... ), input3( indices... ) );
+   }
+};
+
+template< typename Output, typename Func >
+void
+nd_map_view( Output output, Func f )
 {
    nvcc_map_helper_0< Output, Func > wrapper( output, f );
    ExecutorDispatcher< typename Output::PermutationType, typename Output::DeviceType > dispatch;
@@ -137,12 +133,11 @@ void nd_map_view( Output output, Func f )
    dispatch( Begins{}, output.getSizes(), wrapper );
 }
 
-template< typename Output,
-          typename Func,
-          typename Input1 >
-void nd_map_view( Output output, Func f, const Input1 input1 )
+template< typename Output, typename Func, typename Input1 >
+void
+nd_map_view( Output output, Func f, const Input1 input1 )
 {
-   static_assert( all_elements_equal_to_value( Output::getDimension(), {Input1::getDimension()} ),
+   static_assert( all_elements_equal_to_value( Output::getDimension(), { Input1::getDimension() } ),
                   "all arrays must be of the same dimension" );
 
    nvcc_map_helper_1< Output, Func, Input1 > wrapper( output, f, input1 );
@@ -151,13 +146,11 @@ void nd_map_view( Output output, Func f, const Input1 input1 )
    dispatch( Begins{}, output.getSizes(), wrapper );
 }
 
-template< typename Output,
-          typename Func,
-          typename Input1,
-          typename Input2 >
-void nd_map_view( Output output, Func f, const Input1 input1, const Input2 input2 )
+template< typename Output, typename Func, typename Input1, typename Input2 >
+void
+nd_map_view( Output output, Func f, const Input1 input1, const Input2 input2 )
 {
-   static_assert( all_elements_equal_to_value( Output::getDimension(), {Input1::getDimension(), Input2::getDimension()} ),
+   static_assert( all_elements_equal_to_value( Output::getDimension(), { Input1::getDimension(), Input2::getDimension() } ),
                   "all arrays must be of the same dimension" );
 
    nvcc_map_helper_2< Output, Func, Input1, Input2 > wrapper( output, f, input1, input2 );
@@ -166,14 +159,12 @@ void nd_map_view( Output output, Func f, const Input1 input1, const Input2 input
    dispatch( Begins{}, output.getSizes(), wrapper );
 }
 
-template< typename Output,
-          typename Func,
-          typename Input1,
-          typename Input2,
-          typename Input3 >
-void nd_map_view( Output output, Func f, const Input1 input1, const Input2 input2, const Input3 input3 )
+template< typename Output, typename Func, typename Input1, typename Input2, typename Input3 >
+void
+nd_map_view( Output output, Func f, const Input1 input1, const Input2 input2, const Input3 input3 )
 {
-   static_assert( all_elements_equal_to_value( Output::getDimension(), {Input1::getDimension(), Input2::getDimension(), Input3::getDimension()} ),
+   static_assert( all_elements_equal_to_value( Output::getDimension(),
+                                               { Input1::getDimension(), Input2::getDimension(), Input3::getDimension() } ),
                   "all arrays must be of the same dimension" );
 
    nvcc_map_helper_3< Output, Func, Input1, Input2, Input3 > wrapper( output, f, input1, input2, input3 );
@@ -184,179 +175,328 @@ void nd_map_view( Output output, Func f, const Input1 input1, const Input2 input
 
 #endif
 
-} // namespace __ndarray_impl
-
+}  // namespace __ndarray_impl
 
 // f must be an N-ary function, where N is the dimension of the output and input arrays:
 //      output( i1, ..., iN ) = f( input1( i1, ..., iN ), ... inputM( i1, ..., iN ) )
-template< typename Output,
-          typename Func,
-          typename... Input >
-void nd_map( Output& output, Func f, const Input&... input )
+template< typename Output, typename Func, typename... Input >
+void
+nd_map( Output& output, Func f, const Input&... input )
 {
    __ndarray_impl::nd_map_view( output.getView(), f, input.getConstView()... );
 }
 
-template< typename Output,
-          typename Input >
-void nd_assign( Output& output, const Input& input )
+template< typename Output, typename Input >
+void
+nd_assign( Output& output, const Input& input )
 {
 #ifndef __NVCC__
-   nd_map( output, [] __cuda_callable__ ( auto v ){ return v; }, input );
+   nd_map(
+      output,
+      [] __cuda_callable__( auto v )
+      {
+         return v;
+      },
+      input );
 #else
    using value_type = typename Input::ValueType;
-   nd_map( output, [] __cuda_callable__ ( value_type v ){ return v; }, input );
+   nd_map(
+      output,
+      [] __cuda_callable__( value_type v )
+      {
+         return v;
+      },
+      input );
 #endif
 }
 
 // Some mathematical functions, inspired by NumPy:
 // https://docs.scipy.org/doc/numpy/reference/ufuncs.html#math-operations
 
-template< typename Output,
-          typename Input1,
-          typename Input2 >
-void nd_add( Output& output, const Input1& input1, const Input2& input2 )
+template< typename Output, typename Input1, typename Input2 >
+void
+nd_add( Output& output, const Input1& input1, const Input2& input2 )
 {
 #ifndef __NVCC__
-   nd_map( output, [] __cuda_callable__ ( auto v1, auto v2 ){ return v1 + v2; }, input1, input2 );
+   nd_map(
+      output,
+      [] __cuda_callable__( auto v1, auto v2 )
+      {
+         return v1 + v2;
+      },
+      input1,
+      input2 );
 #else
    using value_type_1 = typename Input1::ValueType;
    using value_type_2 = typename Input2::ValueType;
-   nd_map( output, [] __cuda_callable__ ( value_type_1 v1, value_type_2 v2 ){ return v1 + v2; }, input1, input2 );
+   nd_map(
+      output,
+      [] __cuda_callable__( value_type_1 v1, value_type_2 v2 )
+      {
+         return v1 + v2;
+      },
+      input1,
+      input2 );
 #endif
 }
 
-template< typename Output,
-          typename Input1,
-          typename Input2 >
-void nd_subtract( Output& output, const Input1& input1, const Input2& input2 )
+template< typename Output, typename Input1, typename Input2 >
+void
+nd_subtract( Output& output, const Input1& input1, const Input2& input2 )
 {
 #ifndef __NVCC__
-   nd_map( output, [] __cuda_callable__ ( auto v1, auto v2 ){ return v1 - v2; }, input1, input2 );
+   nd_map(
+      output,
+      [] __cuda_callable__( auto v1, auto v2 )
+      {
+         return v1 - v2;
+      },
+      input1,
+      input2 );
 #else
    using value_type_1 = typename Input1::ValueType;
    using value_type_2 = typename Input2::ValueType;
-   nd_map( output, [] __cuda_callable__ ( value_type_1 v1, value_type_2 v2 ){ return v1 - v2; }, input1, input2 );
+   nd_map(
+      output,
+      [] __cuda_callable__( value_type_1 v1, value_type_2 v2 )
+      {
+         return v1 - v2;
+      },
+      input1,
+      input2 );
 #endif
 }
 
-template< typename Output,
-          typename Input1,
-          typename Input2 >
-void nd_multiply( Output& output, const Input1& input1, const Input2& input2 )
+template< typename Output, typename Input1, typename Input2 >
+void
+nd_multiply( Output& output, const Input1& input1, const Input2& input2 )
 {
 #ifndef __NVCC__
-   nd_map( output, [] __cuda_callable__ ( auto v1, auto v2 ){ return v1 * v2; }, input1, input2 );
+   nd_map(
+      output,
+      [] __cuda_callable__( auto v1, auto v2 )
+      {
+         return v1 * v2;
+      },
+      input1,
+      input2 );
 #else
    using value_type_1 = typename Input1::ValueType;
    using value_type_2 = typename Input2::ValueType;
-   nd_map( output, [] __cuda_callable__ ( value_type_1 v1, value_type_2 v2 ){ return v1 * v2; }, input1, input2 );
+   nd_map(
+      output,
+      [] __cuda_callable__( value_type_1 v1, value_type_2 v2 )
+      {
+         return v1 * v2;
+      },
+      input1,
+      input2 );
 #endif
 }
 
-template< typename Output,
-          typename Input1,
-          typename Input2 >
-void nd_divide( Output& output, const Input1& input1, const Input2& input2 )
+template< typename Output, typename Input1, typename Input2 >
+void
+nd_divide( Output& output, const Input1& input1, const Input2& input2 )
 {
 #ifndef __NVCC__
-   nd_map( output, [] __cuda_callable__ ( auto v1, auto v2 ){ return v1 / v2; }, input1, input2 );
+   nd_map(
+      output,
+      [] __cuda_callable__( auto v1, auto v2 )
+      {
+         return v1 / v2;
+      },
+      input1,
+      input2 );
 #else
    using value_type_1 = typename Input1::ValueType;
    using value_type_2 = typename Input2::ValueType;
-   nd_map( output, [] __cuda_callable__ ( value_type_1 v1, value_type_2 v2 ){ return v1 / v2; }, input1, input2 );
+   nd_map(
+      output,
+      [] __cuda_callable__( value_type_1 v1, value_type_2 v2 )
+      {
+         return v1 / v2;
+      },
+      input1,
+      input2 );
 #endif
 }
 
-template< typename Output,
-          typename Input1,
-          typename Input2 >
-void nd_maximum( Output& output, const Input1& input1, const Input2& input2 )
+template< typename Output, typename Input1, typename Input2 >
+void
+nd_maximum( Output& output, const Input1& input1, const Input2& input2 )
 {
 #ifndef __NVCC__
-   nd_map( output, [] __cuda_callable__ ( auto v1, auto v2 ){ return TNL::max( v1, v2 ); }, input1, input2 );
+   nd_map(
+      output,
+      [] __cuda_callable__( auto v1, auto v2 )
+      {
+         return TNL::max( v1, v2 );
+      },
+      input1,
+      input2 );
 #else
    using value_type_1 = typename Input1::ValueType;
    using value_type_2 = typename Input2::ValueType;
-   nd_map( output, [] __cuda_callable__ ( value_type_1 v1, value_type_2 v2 ){ return TNL::max( v1, v2 ); }, input1, input2 );
+   nd_map(
+      output,
+      [] __cuda_callable__( value_type_1 v1, value_type_2 v2 )
+      {
+         return TNL::max( v1, v2 );
+      },
+      input1,
+      input2 );
 #endif
 }
 
-template< typename Output,
-          typename Input1,
-          typename Input2 >
-void nd_minimum( Output& output, const Input1& input1, const Input2& input2 )
+template< typename Output, typename Input1, typename Input2 >
+void
+nd_minimum( Output& output, const Input1& input1, const Input2& input2 )
 {
 #ifndef __NVCC__
-   nd_map( output, [] __cuda_callable__ ( auto v1, auto v2 ){ return TNL::min( v1, v2 ); }, input1, input2 );
+   nd_map(
+      output,
+      [] __cuda_callable__( auto v1, auto v2 )
+      {
+         return TNL::min( v1, v2 );
+      },
+      input1,
+      input2 );
 #else
    using value_type_1 = typename Input1::ValueType;
    using value_type_2 = typename Input2::ValueType;
-   nd_map( output, [] __cuda_callable__ ( value_type_1 v1, value_type_2 v2 ){ return TNL::min( v1, v2 ); }, input1, input2 );
+   nd_map(
+      output,
+      [] __cuda_callable__( value_type_1 v1, value_type_2 v2 )
+      {
+         return TNL::min( v1, v2 );
+      },
+      input1,
+      input2 );
 #endif
 }
 
-template< typename Output,
-          typename Input >
-void nd_absolute( Output& output, const Input& input )
+template< typename Output, typename Input >
+void
+nd_absolute( Output& output, const Input& input )
 {
 #ifndef __NVCC__
-   nd_map( output, [] __cuda_callable__ ( auto v ){ return TNL::abs( v ); }, input );
+   nd_map(
+      output,
+      [] __cuda_callable__( auto v )
+      {
+         return TNL::abs( v );
+      },
+      input );
 #else
    using value_type = typename Input::ValueType;
-   nd_map( output, [] __cuda_callable__ ( value_type v ){ return TNL::abs( v ); }, input );
+   nd_map(
+      output,
+      [] __cuda_callable__( value_type v )
+      {
+         return TNL::abs( v );
+      },
+      input );
 #endif
 }
 
-template< typename Output,
-          typename Input >
-void nd_sign( Output& output, const Input& input )
+template< typename Output, typename Input >
+void
+nd_sign( Output& output, const Input& input )
 {
 #ifndef __NVCC__
-   nd_map( output, [] __cuda_callable__ ( auto v ){ return TNL::sign( v ); }, input );
+   nd_map(
+      output,
+      [] __cuda_callable__( auto v )
+      {
+         return TNL::sign( v );
+      },
+      input );
 #else
    using value_type = typename Input::ValueType;
-   nd_map( output, [] __cuda_callable__ ( value_type v ){ return TNL::sign( v ); }, input );
+   nd_map(
+      output,
+      [] __cuda_callable__( value_type v )
+      {
+         return TNL::sign( v );
+      },
+      input );
 #endif
 }
 
-template< typename Output,
-          typename Input1,
-          typename Input2 >
-void nd_pow( Output& output, const Input1& input1, const Input2& input2 )
+template< typename Output, typename Input1, typename Input2 >
+void
+nd_pow( Output& output, const Input1& input1, const Input2& input2 )
 {
 #ifndef __NVCC__
-   nd_map( output, [] __cuda_callable__ ( auto v1, auto v2 ){ return TNL::pow( v1, v2 ); }, input1, input2 );
+   nd_map(
+      output,
+      [] __cuda_callable__( auto v1, auto v2 )
+      {
+         return TNL::pow( v1, v2 );
+      },
+      input1,
+      input2 );
 #else
    using value_type_1 = typename Input1::ValueType;
    using value_type_2 = typename Input2::ValueType;
-   nd_map( output, [] __cuda_callable__ ( value_type_1 v1, value_type_2 v2 ){ return TNL::pow( v1, v2 ); }, input1, input2 );
+   nd_map(
+      output,
+      [] __cuda_callable__( value_type_1 v1, value_type_2 v2 )
+      {
+         return TNL::pow( v1, v2 );
+      },
+      input1,
+      input2 );
 #endif
 }
 
-template< typename Output,
-          typename Input >
-void nd_sqrt( Output& output, const Input& input )
+template< typename Output, typename Input >
+void
+nd_sqrt( Output& output, const Input& input )
 {
 #ifndef __NVCC__
-   nd_map( output, [] __cuda_callable__ ( auto v ){ return TNL::sqrt( v ); }, input );
+   nd_map(
+      output,
+      [] __cuda_callable__( auto v )
+      {
+         return TNL::sqrt( v );
+      },
+      input );
 #else
    using value_type = typename Input::ValueType;
-   nd_map( output, [] __cuda_callable__ ( value_type v ){ return TNL::sqrt( v ); }, input );
+   nd_map(
+      output,
+      [] __cuda_callable__( value_type v )
+      {
+         return TNL::sqrt( v );
+      },
+      input );
 #endif
 }
 
-template< typename Output,
-          typename Input >
-void nd_square( Output& output, const Input& input )
+template< typename Output, typename Input >
+void
+nd_square( Output& output, const Input& input )
 {
 #ifndef __NVCC__
-   nd_map( output, [] __cuda_callable__ ( auto v ){ return v*v; }, input );
+   nd_map(
+      output,
+      [] __cuda_callable__( auto v )
+      {
+         return v * v;
+      },
+      input );
 #else
    using value_type = typename Input::ValueType;
-   nd_map( output, [] __cuda_callable__ ( value_type v ){ return v*v; }, input );
+   nd_map(
+      output,
+      [] __cuda_callable__( value_type v )
+      {
+         return v * v;
+      },
+      input );
 #endif
 }
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/ndarray/SizesHolder.h b/src/TNL/Containers/ndarray/SizesHolder.h
index 886564cacd65e1b2b9bd32b4468003513e15cb80..0525b78b0aaee082d0bc7fdf615e264cf62e0d92 100644
--- a/src/TNL/Containers/ndarray/SizesHolder.h
+++ b/src/TNL/Containers/ndarray/SizesHolder.h
@@ -19,50 +19,53 @@ namespace Containers {
 
 namespace __ndarray_impl {
 
-template< typename Index,
-          typename LevelTag,
-          std::size_t size >
+template< typename Index, typename LevelTag, std::size_t size >
 class SizeHolder
 {
 public:
    __cuda_callable__
-   constexpr Index getSize( LevelTag ) const
+   constexpr Index
+   getSize( LevelTag ) const
    {
       return size;
    }
 
    __cuda_callable__
-   void setSize( LevelTag, Index newSize )
+   void
+   setSize( LevelTag, Index newSize )
    {
       TNL_ASSERT_EQ( newSize, 0, "Dynamic size for a static dimension must be 0." );
    }
 
    __cuda_callable__
-   bool operator==( const SizeHolder& ) const
+   bool
+   operator==( const SizeHolder& ) const
    {
       return true;
    }
 };
 
-template< typename Index,
-          typename LevelTag >
+template< typename Index, typename LevelTag >
 class SizeHolder< Index, LevelTag, 0 >
 {
 public:
    __cuda_callable__
-   Index getSize( LevelTag ) const
+   Index
+   getSize( LevelTag ) const
    {
       return size;
    }
 
    __cuda_callable__
-   void setSize( LevelTag, Index size )
+   void
+   setSize( LevelTag, Index size )
    {
       this->size = size;
    }
 
    __cuda_callable__
-   bool operator==( const SizeHolder& other ) const
+   bool
+   operator==( const SizeHolder& other ) const
    {
       return size == other.size;
    }
@@ -71,19 +74,17 @@ private:
    Index size = 0;
 };
 
-template< typename Index,
-          std::size_t currentSize,
-          std::size_t... otherSizes >
-class SizesHolderLayer
-: public SizesHolderLayer< Index, otherSizes... >,
-  public SizeHolder< Index,
-                     IndexTag< sizeof...( otherSizes ) >,  // LevelTag
-                     currentSize >
+template< typename Index, std::size_t currentSize, std::size_t... otherSizes >
+class SizesHolderLayer : public SizesHolderLayer< Index, otherSizes... >,
+                         public SizeHolder< Index,
+                                            IndexTag< sizeof...( otherSizes ) >,  // LevelTag
+                                            currentSize >
 {
    using BaseType = SizesHolderLayer< Index, otherSizes... >;
    using Layer = SizeHolder< Index,
                              IndexTag< sizeof...( otherSizes ) >,  // LevelTag
                              currentSize >;
+
 protected:
    using BaseType::getSize;
    using BaseType::setSize;
@@ -91,141 +92,139 @@ protected:
    using Layer::setSize;
 
    __cuda_callable__
-   bool operator==( const SizesHolderLayer& other ) const
+   bool
+   operator==( const SizesHolderLayer& other ) const
    {
-      return BaseType::operator==( other ) &&
-             Layer::operator==( other );
+      return BaseType::operator==( other ) && Layer::operator==( other );
    }
 };
 
 // specializations to terminate the recursive inheritance
-template< typename Index,
-          std::size_t currentSize >
-class SizesHolderLayer< Index, currentSize >
-: public SizeHolder< Index,
-                     IndexTag< 0 >,  // LevelTag
-                     currentSize >
+template< typename Index, std::size_t currentSize >
+class SizesHolderLayer< Index, currentSize > : public SizeHolder< Index,
+                                                                  IndexTag< 0 >,  // LevelTag
+                                                                  currentSize >
 {
-    using Layer = SizeHolder< Index,
-                              IndexTag< 0 >,  // LevelTag
-                              currentSize >;
+   using Layer = SizeHolder< Index,
+                             IndexTag< 0 >,  // LevelTag
+                             currentSize >;
+
 protected:
-    using Layer::getSize;
-    using Layer::setSize;
-
-    __cuda_callable__
-    bool operator==( const SizesHolderLayer& other ) const
-    {
-        return Layer::operator==( other );
-    }
-};
+   using Layer::getSize;
+   using Layer::setSize;
 
-} // namespace __ndarray_impl
+   __cuda_callable__
+   bool
+   operator==( const SizesHolderLayer& other ) const
+   {
+      return Layer::operator==( other );
+   }
+};
 
+}  // namespace __ndarray_impl
 
 // dimensions and static sizes are specified as std::size_t,
 // the type of dynamic sizes is configurable with Index
 
-template< typename Index,
-          std::size_t... sizes >
-class SizesHolder
-: public __ndarray_impl::SizesHolderLayer< Index, sizes... >
+template< typename Index, std::size_t... sizes >
+class SizesHolder : public __ndarray_impl::SizesHolderLayer< Index, sizes... >
 {
    using BaseType = __ndarray_impl::SizesHolderLayer< Index, sizes... >;
 
 public:
    using IndexType = Index;
 
-   static constexpr std::size_t getDimension()
+   static constexpr std::size_t
+   getDimension()
    {
       return sizeof...( sizes );
    }
 
    template< std::size_t dimension >
-   static constexpr std::size_t getStaticSize()
+   static constexpr std::size_t
+   getStaticSize()
    {
-      static_assert( dimension < sizeof...(sizes), "Invalid dimension passed to getStaticSize()." );
+      static_assert( dimension < sizeof...( sizes ), "Invalid dimension passed to getStaticSize()." );
       return __ndarray_impl::get_from_pack< dimension >( sizes... );
    }
 
    template< std::size_t level >
    __cuda_callable__
-   Index getSize() const
+   Index
+   getSize() const
    {
-      static_assert( level < sizeof...(sizes), "Invalid level passed to getSize()." );
+      static_assert( level < sizeof...( sizes ), "Invalid level passed to getSize()." );
       return BaseType::getSize( __ndarray_impl::IndexTag< getDimension() - level - 1 >() );
    }
 
    template< std::size_t level >
    __cuda_callable__
-   void setSize( Index size )
+   void
+   setSize( Index size )
    {
-      static_assert( level < sizeof...(sizes), "Invalid level passed to setSize()." );
+      static_assert( level < sizeof...( sizes ), "Invalid level passed to setSize()." );
       BaseType::setSize( __ndarray_impl::IndexTag< getDimension() - level - 1 >(), size );
    }
 
    // methods for convenience
    __cuda_callable__
-   bool operator==( const SizesHolder& other ) const
+   bool
+   operator==( const SizesHolder& other ) const
    {
       return BaseType::operator==( other );
    }
 
    __cuda_callable__
-   bool operator!=( const SizesHolder& other ) const
+   bool
+   operator!=( const SizesHolder& other ) const
    {
       return ! operator==( other );
    }
 };
 
-template< typename Index,
-          std::size_t... sizes,
-          typename OtherHolder >
+template< typename Index, std::size_t... sizes, typename OtherHolder >
 SizesHolder< Index, sizes... >
 operator+( const SizesHolder< Index, sizes... >& lhs, const OtherHolder& rhs )
 {
    SizesHolder< Index, sizes... > result;
-   Algorithms::staticFor< std::size_t, 0, sizeof...(sizes) >(
-      [&result, &lhs, &rhs] ( auto level ) {
+   Algorithms::staticFor< std::size_t, 0, sizeof...( sizes ) >(
+      [ &result, &lhs, &rhs ]( auto level )
+      {
          if( result.template getStaticSize< level >() == 0 )
             result.template setSize< level >( lhs.template getSize< level >() + rhs.template getSize< level >() );
-      }
-   );
+      } );
    return result;
 }
 
-template< typename Index,
-          std::size_t... sizes,
-          typename OtherHolder >
+template< typename Index, std::size_t... sizes, typename OtherHolder >
 SizesHolder< Index, sizes... >
 operator-( const SizesHolder< Index, sizes... >& lhs, const OtherHolder& rhs )
 {
    SizesHolder< Index, sizes... > result;
-   Algorithms::staticFor< std::size_t, 0, sizeof...(sizes) >(
-      [&result, &lhs, &rhs] ( auto level ) {
+   Algorithms::staticFor< std::size_t, 0, sizeof...( sizes ) >(
+      [ &result, &lhs, &rhs ]( auto level )
+      {
          if( result.template getStaticSize< level >() == 0 )
             result.template setSize< level >( lhs.template getSize< level >() - rhs.template getSize< level >() );
-      }
-   );
+      } );
    return result;
 }
 
-
-template< typename Index,
-          std::size_t dimension,
-          Index constSize >
+template< typename Index, std::size_t dimension, Index constSize >
 class ConstStaticSizesHolder
 {
 public:
    using IndexType = Index;
 
-   static constexpr std::size_t getDimension()
+   static constexpr std::size_t
+   getDimension()
    {
       return dimension;
    }
 
    template< std::size_t level >
-   static constexpr std::size_t getStaticSize()
+   static constexpr std::size_t
+   getStaticSize()
    {
       static_assert( level < getDimension(), "Invalid level passed to getStaticSize()." );
       return constSize;
@@ -233,7 +232,8 @@ public:
 
    template< std::size_t level >
    __cuda_callable__
-   Index getSize() const
+   Index
+   getSize() const
    {
       static_assert( level < getDimension(), "Invalid dimension passed to getSize()." );
       return constSize;
@@ -241,58 +241,54 @@ public:
 
    // methods for convenience
    __cuda_callable__
-   bool operator==( const ConstStaticSizesHolder& other ) const
+   bool
+   operator==( const ConstStaticSizesHolder& other ) const
    {
       return true;
    }
 
    __cuda_callable__
-   bool operator!=( const ConstStaticSizesHolder& other ) const
+   bool
+   operator!=( const ConstStaticSizesHolder& other ) const
    {
       return false;
    }
 };
 
-
-template< typename Index,
-          std::size_t... sizes >
-std::ostream& operator<<( std::ostream& str, const SizesHolder< Index, sizes... >& holder )
+template< typename Index, std::size_t... sizes >
+std::ostream&
+operator<<( std::ostream& str, const SizesHolder< Index, sizes... >& holder )
 {
    str << "SizesHolder< ";
-   Algorithms::staticFor< std::size_t, 0, sizeof...(sizes) - 1 >(
-      [&str, &holder] ( auto dimension ) {
+   Algorithms::staticFor< std::size_t, 0, sizeof...( sizes ) - 1 >(
+      [ &str, &holder ]( auto dimension )
+      {
          str << holder.template getStaticSize< dimension >() << ", ";
-      }
-   );
-   str << holder.template getStaticSize< sizeof...(sizes) - 1 >() << " >( ";
-   Algorithms::staticFor< std::size_t, 0, sizeof...(sizes) - 1 >(
-      [&str, &holder] ( auto dimension ) {
+      } );
+   str << holder.template getStaticSize< sizeof...( sizes ) - 1 >() << " >( ";
+   Algorithms::staticFor< std::size_t, 0, sizeof...( sizes ) - 1 >(
+      [ &str, &holder ]( auto dimension )
+      {
          str << holder.template getSize< dimension >() << ", ";
-      }
-   );
-   str << holder.template getSize< sizeof...(sizes) - 1 >() << " )";
+      } );
+   str << holder.template getSize< sizeof...( sizes ) - 1 >() << " )";
    return str;
 }
 
-
 namespace __ndarray_impl {
 
 // helper for the forInternal method
-template< typename SizesHolder,
-          std::size_t ConstValue >
+template< typename SizesHolder, std::size_t ConstValue >
 struct SubtractedSizesHolder
 {};
 
-template< typename Index,
-          std::size_t ConstValue,
-          std::size_t... sizes >
+template< typename Index, std::size_t ConstValue, std::size_t... sizes >
 struct SubtractedSizesHolder< SizesHolder< Index, sizes... >, ConstValue >
 {
-//   using type = SizesHolder< Index, std::max( (std::size_t) 0, sizes - ConstValue )... >;
-   using type = SizesHolder< Index, ( (sizes >= ConstValue) ? sizes - ConstValue : 0 )... >;
+   //   using type = SizesHolder< Index, std::max( (std::size_t) 0, sizes - ConstValue )... >;
+   using type = SizesHolder< Index, ( ( sizes >= ConstValue ) ? sizes - ConstValue : 0 )... >;
 };
 
-
 // wrapper for localBegins in DistributedNDArray (static sizes cannot be distributed, begins are always 0)
 template< typename SizesHolder,
           // overridable value is useful in the forInternal method
@@ -300,7 +296,8 @@ template< typename SizesHolder,
 struct LocalBeginsHolder : public SizesHolder
 {
    template< std::size_t dimension >
-   static constexpr std::size_t getStaticSize()
+   static constexpr std::size_t
+   getStaticSize()
    {
       static_assert( dimension < SizesHolder::getDimension(), "Invalid dimension passed to getStaticSize()." );
       return ConstValue;
@@ -308,7 +305,8 @@ struct LocalBeginsHolder : public SizesHolder
 
    template< std::size_t level >
    __cuda_callable__
-   typename SizesHolder::IndexType getSize() const
+   typename SizesHolder::IndexType
+   getSize() const
    {
       if( SizesHolder::template getStaticSize< level >() != 0 )
          return ConstValue;
@@ -317,38 +315,40 @@ struct LocalBeginsHolder : public SizesHolder
 
    template< std::size_t level >
    __cuda_callable__
-   void setSize( typename SizesHolder::IndexType newSize )
+   void
+   setSize( typename SizesHolder::IndexType newSize )
    {
       if( SizesHolder::template getStaticSize< level >() == 0 )
          SizesHolder::template setSize< level >( newSize );
       else
-         TNL_ASSERT_EQ( newSize, (typename SizesHolder::IndexType) ConstValue, "Dynamic size for a static dimension must be equal to the specified ConstValue." );
+         TNL_ASSERT_EQ( newSize,
+                        (typename SizesHolder::IndexType) ConstValue,
+                        "Dynamic size for a static dimension must be equal to the specified ConstValue." );
    }
 };
 
-template< typename Index,
-          std::size_t... sizes,
-          std::size_t ConstValue >
-std::ostream& operator<<( std::ostream& str, const __ndarray_impl::LocalBeginsHolder< SizesHolder< Index, sizes... >, ConstValue >& holder )
+template< typename Index, std::size_t... sizes, std::size_t ConstValue >
+std::ostream&
+operator<<( std::ostream& str, const __ndarray_impl::LocalBeginsHolder< SizesHolder< Index, sizes... >, ConstValue >& holder )
 {
    str << "LocalBeginsHolder< SizesHolder< ";
-   Algorithms::staticFor< std::size_t, 0, sizeof...(sizes) - 1 >(
-      [&str, &holder] ( auto dimension ) {
+   Algorithms::staticFor< std::size_t, 0, sizeof...( sizes ) - 1 >(
+      [ &str, &holder ]( auto dimension )
+      {
          str << holder.template getStaticSize< dimension >() << ", ";
-      }
-   );
-   str << holder.template getStaticSize< sizeof...(sizes) - 1 >() << " >, ";
+      } );
+   str << holder.template getStaticSize< sizeof...( sizes ) - 1 >() << " >, ";
    str << ConstValue << " >( ";
-   Algorithms::staticFor< std::size_t, 0, sizeof...(sizes) - 1 >(
-      [&str, &holder] ( auto dimension ) {
+   Algorithms::staticFor< std::size_t, 0, sizeof...( sizes ) - 1 >(
+      [ &str, &holder ]( auto dimension )
+      {
          str << holder.template getSize< dimension >() << ", ";
-      }
-   );
-   str << holder.template getSize< sizeof...(sizes) - 1 >() << " )";
+      } );
+   str << holder.template getSize< sizeof...( sizes ) - 1 >() << " )";
    return str;
 }
 
-} // namespace __ndarray_impl
+}  // namespace __ndarray_impl
 
-} // namespace Containers
-} // namespace TNL
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/ndarray/SizesHolderHelpers.h b/src/TNL/Containers/ndarray/SizesHolderHelpers.h
index 7f648f354a86587ef13607dd8bd00ab3cced0303..f027b1dcd06c050aa83a19e9040b9771e61baa4d 100644
--- a/src/TNL/Containers/ndarray/SizesHolderHelpers.h
+++ b/src/TNL/Containers/ndarray/SizesHolderHelpers.h
@@ -25,14 +25,13 @@ template< typename SizesHolder,
           typename LevelTag = IndexTag< SizesHolder::getDimension() - 1 > >
 struct StorageSizeGetter
 {
-   static typename SizesHolder::IndexType
-   __cuda_callable__
+   static typename SizesHolder::IndexType __cuda_callable__
    get( const SizesHolder& sizes )
    {
       static constexpr std::size_t overlap = __ndarray_impl::get< LevelTag::value >( Overlaps{} );
       const auto size = Alignment::template getAlignedSize< LevelTag::value >( sizes );
       return ( size + 2 * overlap )
-             * StorageSizeGetter< SizesHolder, Alignment, Overlaps, IndexTag< LevelTag::value - 1 > >::get( sizes );
+           * StorageSizeGetter< SizesHolder, Alignment, Overlaps, IndexTag< LevelTag::value - 1 > >::get( sizes );
    }
 
    template< typename Permutation >
@@ -44,15 +43,14 @@ struct StorageSizeGetter
       static constexpr std::size_t overlap = __ndarray_impl::get< idx >( Overlaps{} );
       const auto size = Alignment::template getAlignedSize< idx >( sizes );
       return ( size + 2 * overlap )
-             * StorageSizeGetter< SizesHolder, Alignment, Overlaps, IndexTag< LevelTag::value - 1 > >::get( sizes );
+           * StorageSizeGetter< SizesHolder, Alignment, Overlaps, IndexTag< LevelTag::value - 1 > >::get( sizes );
    }
 };
 
 template< typename SizesHolder, typename Alignment, typename Overlaps >
 struct StorageSizeGetter< SizesHolder, Alignment, Overlaps, IndexTag< 0 > >
 {
-   static typename SizesHolder::IndexType
-   __cuda_callable__
+   static typename SizesHolder::IndexType __cuda_callable__
    get( const SizesHolder& sizes )
    {
       static constexpr std::size_t overlap = __ndarray_impl::get< 0 >( Overlaps{} );
@@ -70,159 +68,145 @@ struct StorageSizeGetter< SizesHolder, Alignment, Overlaps, IndexTag< 0 > >
    }
 };
 
-
 // Static storage size without alignment, used in StaticNDArray
-template< typename SizesHolder,
-          typename LevelTag = IndexTag< SizesHolder::getDimension() - 1 > >
+template< typename SizesHolder, typename LevelTag = IndexTag< SizesHolder::getDimension() - 1 > >
 struct StaticStorageSizeGetter
 {
-   constexpr static std::size_t get()
+   constexpr static std::size_t
+   get()
    {
-      return SizesHolder::template getStaticSize< LevelTag::value >() *
-             StaticStorageSizeGetter< SizesHolder, IndexTag< LevelTag::value - 1 > >::get();
+      return SizesHolder::template getStaticSize< LevelTag::value >()
+           * StaticStorageSizeGetter< SizesHolder, IndexTag< LevelTag::value - 1 > >::get();
    }
 };
 
 template< typename SizesHolder >
 struct StaticStorageSizeGetter< SizesHolder, IndexTag< 0 > >
 {
-   constexpr static std::size_t get()
+   constexpr static std::size_t
+   get()
    {
       return SizesHolder::template getStaticSize< 0 >();
    }
 };
 
-
-template< std::size_t level = 0,
-          typename SizesHolder,
-          typename Index,
-          typename... IndexTypes >
-void setSizesHelper( SizesHolder& holder,
-                     Index&& size,
-                     IndexTypes&&... otherSizes )
+template< std::size_t level = 0, typename SizesHolder, typename Index, typename... IndexTypes >
+void
+setSizesHelper( SizesHolder& holder, Index&& size, IndexTypes&&... otherSizes )
 {
    holder.template setSize< level >( std::forward< Index >( size ) );
    setSizesHelper< level + 1 >( holder, std::forward< IndexTypes >( otherSizes )... );
 }
 
-template< std::size_t level = 0,
-          typename SizesHolder,
-          typename Index >
-void setSizesHelper( SizesHolder& holder,
-                     Index&& size )
+template< std::size_t level = 0, typename SizesHolder, typename Index >
+void
+setSizesHelper( SizesHolder& holder, Index&& size )
 {
    holder.template setSize< level >( std::forward< Index >( size ) );
 }
 
-
 // A variadic bounds-checker for indices
 template< typename SizesHolder, typename Overlaps >
 __cuda_callable__
-void assertIndicesInBounds( const SizesHolder&, const Overlaps& overlaps )
+void
+assertIndicesInBounds( const SizesHolder&, const Overlaps& overlaps )
 {}
 
-template< typename SizesHolder,
-          typename Overlaps,
-          typename Index,
-          typename... IndexTypes >
+template< typename SizesHolder, typename Overlaps, typename Index, typename... IndexTypes >
 __cuda_callable__
-void assertIndicesInBounds( const SizesHolder& sizes, const Overlaps& overlaps, Index&& i, IndexTypes&&... indices )
+void
+assertIndicesInBounds( const SizesHolder& sizes, const Overlaps& overlaps, Index&& i, IndexTypes&&... indices )
 {
 #ifndef NDEBUG
    // sizes.template getSize<...>() cannot be inside the assert macro, but the variables
    // shouldn't be declared when compiling without assertions
-   constexpr std::size_t level = SizesHolder::getDimension() - sizeof...(indices) - 1;
+   constexpr std::size_t level = SizesHolder::getDimension() - sizeof...( indices ) - 1;
    const auto size = sizes.template getSize< level >();
-   const decltype(size) overlap = get<level>( overlaps );
-   TNL_ASSERT_LE( - overlap, (decltype(size)) i, "Input error - some index is below the lower bound." );
-   TNL_ASSERT_LT( (decltype(size)) i, size + overlap, "Input error - some index is above the upper bound." );
+   const decltype( size ) overlap = get< level >( overlaps );
+   TNL_ASSERT_LE( -overlap, (decltype( size )) i, "Input error - some index is below the lower bound." );
+   TNL_ASSERT_LT( (decltype( size )) i, size + overlap, "Input error - some index is above the upper bound." );
 #endif
    assertIndicesInBounds( sizes, overlaps, std::forward< IndexTypes >( indices )... );
 }
 
-
 // A variadic bounds-checker for distributed indices with overlaps
 template< typename SizesHolder1, typename SizesHolder2, typename Overlaps >
 __cuda_callable__
-void assertIndicesInRange( const SizesHolder1&, const SizesHolder2&, const Overlaps& )
+void
+assertIndicesInRange( const SizesHolder1&, const SizesHolder2&, const Overlaps& )
 {}
 
-template< typename SizesHolder1,
-          typename SizesHolder2,
-          typename Overlaps,
-          typename Index,
-          typename... IndexTypes >
+template< typename SizesHolder1, typename SizesHolder2, typename Overlaps, typename Index, typename... IndexTypes >
 __cuda_callable__
-void assertIndicesInRange( const SizesHolder1& begins, const SizesHolder2& ends, const Overlaps& overlaps, Index&& i, IndexTypes&&... indices )
+void
+assertIndicesInRange( const SizesHolder1& begins,
+                      const SizesHolder2& ends,
+                      const Overlaps& overlaps,
+                      Index&& i,
+                      IndexTypes&&... indices )
 {
-   static_assert( SizesHolder1::getDimension() == SizesHolder2::getDimension(),
-                  "Inconsistent begins and ends." );
+   static_assert( SizesHolder1::getDimension() == SizesHolder2::getDimension(), "Inconsistent begins and ends." );
 #ifndef NDEBUG
    // sizes.template getSize<...>() cannot be inside the assert macro, but the variables
    // shouldn't be declared when compiling without assertions
-   constexpr std::size_t level = SizesHolder1::getDimension() - sizeof...(indices) - 1;
+   constexpr std::size_t level = SizesHolder1::getDimension() - sizeof...( indices ) - 1;
    const auto begin = begins.template getSize< level >();
    const auto end = ends.template getSize< level >();
-   TNL_ASSERT_LE( begin - (decltype(begin)) get<level>( overlaps ), i, "Input error - some index is below the lower bound." );
-   TNL_ASSERT_LT( i, end + (decltype(end)) get<level>( overlaps ), "Input error - some index is above the upper bound." );
+   TNL_ASSERT_LE(
+      begin - (decltype( begin )) get< level >( overlaps ), i, "Input error - some index is below the lower bound." );
+   TNL_ASSERT_LT( i, end + (decltype( end )) get< level >( overlaps ), "Input error - some index is above the upper bound." );
 #endif
    assertIndicesInRange( begins, ends, overlaps, std::forward< IndexTypes >( indices )... );
 }
 
-
 // helper for the assignment operator in NDArray
-template< typename TargetHolder,
-          typename SourceHolder,
-          std::size_t level = TargetHolder::getDimension() - 1 >
+template< typename TargetHolder, typename SourceHolder, std::size_t level = TargetHolder::getDimension() - 1 >
 struct SetSizesCopyHelper
 {
-   static void copy( TargetHolder& target,
-                     const SourceHolder& source )
+   static void
+   copy( TargetHolder& target, const SourceHolder& source )
    {
       if( target.template getStaticSize< level >() == 0 ) {
          target.template setSize< level >( source.template getSize< level >() );
          SetSizesCopyHelper< TargetHolder, SourceHolder, level - 1 >::copy( target, source );
       }
-      else if( source.template getSize< level >() < 0 ||
-               target.template getStaticSize< level >() != (std::size_t) source.template getSize< level >() )
+      else if( source.template getSize< level >() < 0
+               || target.template getStaticSize< level >() != (std::size_t) source.template getSize< level >() )
          throw std::logic_error( "Cannot copy sizes due to inconsistent underlying types (static sizes don't match)." );
    }
 };
 
-template< typename TargetHolder,
-          typename SourceHolder >
+template< typename TargetHolder, typename SourceHolder >
 struct SetSizesCopyHelper< TargetHolder, SourceHolder, 0 >
 {
-   static void copy( TargetHolder& target,
-                     const SourceHolder& source )
+   static void
+   copy( TargetHolder& target, const SourceHolder& source )
    {
       if( target.template getStaticSize< 0 >() == 0 )
          target.template setSize< 0 >( source.template getSize< 0 >() );
-      else if( source.template getSize< 0 >() < 0 ||
-               target.template getStaticSize< 0 >() != (std::size_t) source.template getSize< 0 >() )
+      else if( source.template getSize< 0 >() < 0
+               || target.template getStaticSize< 0 >() != (std::size_t) source.template getSize< 0 >() )
          throw std::logic_error( "Cannot copy sizes due to inconsistent underlying types (static sizes don't match)." );
    }
 };
 
-
 // helper for the assignment operator in NDArrayView
-template< typename SizesHolder1,
-          typename SizesHolder2 >
+template< typename SizesHolder1, typename SizesHolder2 >
 __cuda_callable__
-bool sizesWeakCompare( const SizesHolder1& sizes1, const SizesHolder2& sizes2 )
+bool
+sizesWeakCompare( const SizesHolder1& sizes1, const SizesHolder2& sizes2 )
 {
    static_assert( SizesHolder1::getDimension() == SizesHolder2::getDimension(),
                   "Cannot compare sizes of different dimensions." );
    bool result = true;
    Algorithms::staticFor< std::size_t, 0, SizesHolder1::getDimension() >(
-      [&result, &sizes1, &sizes2] ( auto level ) {
+      [ &result, &sizes1, &sizes2 ]( auto level )
+      {
          result = result && sizes1.template getSize< level >() == sizes2.template getSize< level >();
-      }
-   );
+      } );
    return result;
 }
 
-
 // helper for the forInternal and forBoundary methods (NDArray and DistributedNDArray)
 template< std::size_t ConstValue,
           typename TargetHolder,
@@ -231,8 +215,8 @@ template< std::size_t ConstValue,
           std::size_t level = TargetHolder::getDimension() - 1 >
 struct SetSizesSubtractHelper
 {
-   static void subtract( TargetHolder& target,
-                         const SourceHolder& source )
+   static void
+   subtract( TargetHolder& target, const SourceHolder& source )
    {
       if( source.template getStaticSize< level >() == 0 )
          target.template setSize< level >( source.template getSize< level >() - ConstValue * ! get< level >( Overlaps{} ) );
@@ -240,21 +224,17 @@ struct SetSizesSubtractHelper
    }
 };
 
-template< std::size_t ConstValue,
-          typename TargetHolder,
-          typename SourceHolder,
-          typename Overlaps >
+template< std::size_t ConstValue, typename TargetHolder, typename SourceHolder, typename Overlaps >
 struct SetSizesSubtractHelper< ConstValue, TargetHolder, SourceHolder, Overlaps, 0 >
 {
-   static void subtract( TargetHolder& target,
-                         const SourceHolder& source )
+   static void
+   subtract( TargetHolder& target, const SourceHolder& source )
    {
       if( source.template getStaticSize< 0 >() == 0 )
          target.template setSize< 0 >( source.template getSize< 0 >() - ConstValue * ! get< 0 >( Overlaps{} ) );
    }
 };
 
-
 // helper for the forInternal and forBoundary methods (DistributedNDArray)
 template< std::size_t ConstValue,
           typename TargetHolder,
@@ -263,8 +243,8 @@ template< std::size_t ConstValue,
           std::size_t level = TargetHolder::getDimension() - 1 >
 struct SetSizesAddHelper
 {
-   static void add( TargetHolder& target,
-                    const SourceHolder& source )
+   static void
+   add( TargetHolder& target, const SourceHolder& source )
    {
       if( source.template getStaticSize< level >() == 0 )
          target.template setSize< level >( source.template getSize< level >() + ConstValue * ! get< level >( Overlaps{} ) );
@@ -272,21 +252,17 @@ struct SetSizesAddHelper
    }
 };
 
-template< std::size_t ConstValue,
-          typename TargetHolder,
-          typename SourceHolder,
-          typename Overlaps >
+template< std::size_t ConstValue, typename TargetHolder, typename SourceHolder, typename Overlaps >
 struct SetSizesAddHelper< ConstValue, TargetHolder, SourceHolder, Overlaps, 0 >
 {
-   static void add( TargetHolder& target,
-                    const SourceHolder& source )
+   static void
+   add( TargetHolder& target, const SourceHolder& source )
    {
       if( source.template getStaticSize< 0 >() == 0 )
          target.template setSize< 0 >( source.template getSize< 0 >() + ConstValue * ! get< 0 >( Overlaps{} ) );
    }
 };
 
-
 // helper for the forLocalInternal, forLocalBoundary and forOverlaps methods (DistributedNDArray)
 template< typename TargetHolder,
           typename SourceHolder,
@@ -294,8 +270,8 @@ template< typename TargetHolder,
           std::size_t level = TargetHolder::getDimension() - 1 >
 struct SetSizesSubtractOverlapsHelper
 {
-   static void subtract( TargetHolder& target,
-                         const SourceHolder& source )
+   static void
+   subtract( TargetHolder& target, const SourceHolder& source )
    {
       if( source.template getStaticSize< level >() == 0 )
          target.template setSize< level >( source.template getSize< level >() - get< level >( Overlaps{} ) );
@@ -303,20 +279,17 @@ struct SetSizesSubtractOverlapsHelper
    }
 };
 
-template< typename TargetHolder,
-          typename SourceHolder,
-          typename Overlaps >
+template< typename TargetHolder, typename SourceHolder, typename Overlaps >
 struct SetSizesSubtractOverlapsHelper< TargetHolder, SourceHolder, Overlaps, 0 >
 {
-   static void subtract( TargetHolder& target,
-                         const SourceHolder& source )
+   static void
+   subtract( TargetHolder& target, const SourceHolder& source )
    {
       if( source.template getStaticSize< 0 >() == 0 )
          target.template setSize< 0 >( source.template getSize< 0 >() - get< 0 >( Overlaps{} ) );
    }
 };
 
-
 // helper for the forLocalInternal, forLocalBoundary and forOverlaps methods (DistributedNDArray)
 template< typename TargetHolder,
           typename SourceHolder,
@@ -324,8 +297,8 @@ template< typename TargetHolder,
           std::size_t level = TargetHolder::getDimension() - 1 >
 struct SetSizesAddOverlapsHelper
 {
-   static void add( TargetHolder& target,
-                    const SourceHolder& source )
+   static void
+   add( TargetHolder& target, const SourceHolder& source )
    {
       if( source.template getStaticSize< level >() == 0 )
          target.template setSize< level >( source.template getSize< level >() + get< level >( Overlaps{} ) );
@@ -333,28 +306,23 @@ struct SetSizesAddOverlapsHelper
    }
 };
 
-template< typename TargetHolder,
-          typename SourceHolder,
-          typename Overlaps >
+template< typename TargetHolder, typename SourceHolder, typename Overlaps >
 struct SetSizesAddOverlapsHelper< TargetHolder, SourceHolder, Overlaps, 0 >
 {
-   static void add( TargetHolder& target,
-                    const SourceHolder& source )
+   static void
+   add( TargetHolder& target, const SourceHolder& source )
    {
       if( source.template getStaticSize< 0 >() == 0 )
          target.template setSize< 0 >( source.template getSize< 0 >() + get< 0 >( Overlaps{} ) );
    }
 };
 
-
 // helper for the forInternal method (DistributedNDArray)
-template< typename TargetHolder,
-          typename SourceHolder,
-          std::size_t level = TargetHolder::getDimension() - 1 >
+template< typename TargetHolder, typename SourceHolder, std::size_t level = TargetHolder::getDimension() - 1 >
 struct SetSizesMaxHelper
 {
-   static void max( TargetHolder& target,
-                    const SourceHolder& source )
+   static void
+   max( TargetHolder& target, const SourceHolder& source )
    {
       if( source.template getStaticSize< level >() == 0 )
          target.template setSize< level >( std::max( target.template getSize< level >(), source.template getSize< level >() ) );
@@ -362,27 +330,23 @@ struct SetSizesMaxHelper
    }
 };
 
-template< typename TargetHolder,
-          typename SourceHolder >
+template< typename TargetHolder, typename SourceHolder >
 struct SetSizesMaxHelper< TargetHolder, SourceHolder, 0 >
 {
-   static void max( TargetHolder& target,
-                    const SourceHolder& source )
+   static void
+   max( TargetHolder& target, const SourceHolder& source )
    {
       if( source.template getStaticSize< 0 >() == 0 )
          target.template setSize< 0 >( std::max( target.template getSize< 0 >(), source.template getSize< 0 >() ) );
    }
 };
 
-
 // helper for the forInternal method (DistributedNDArray)
-template< typename TargetHolder,
-          typename SourceHolder,
-          std::size_t level = TargetHolder::getDimension() - 1 >
+template< typename TargetHolder, typename SourceHolder, std::size_t level = TargetHolder::getDimension() - 1 >
 struct SetSizesMinHelper
 {
-   static void min( TargetHolder& target,
-                    const SourceHolder& source )
+   static void
+   min( TargetHolder& target, const SourceHolder& source )
    {
       if( source.template getStaticSize< level >() == 0 )
          target.template setSize< level >( std::min( target.template getSize< level >(), source.template getSize< level >() ) );
@@ -390,18 +354,17 @@ struct SetSizesMinHelper
    }
 };
 
-template< typename TargetHolder,
-          typename SourceHolder >
+template< typename TargetHolder, typename SourceHolder >
 struct SetSizesMinHelper< TargetHolder, SourceHolder, 0 >
 {
-   static void min( TargetHolder& target,
-                    const SourceHolder& source )
+   static void
+   min( TargetHolder& target, const SourceHolder& source )
    {
       if( source.template getStaticSize< 0 >() == 0 )
          target.template setSize< 0 >( std::min( target.template getSize< 0 >(), source.template getSize< 0 >() ) );
    }
 };
 
-} // namespace __ndarray_impl
-} // namespace Containers
-} // namespace TNL
+}  // namespace __ndarray_impl
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/ndarray/Subarrays.h b/src/TNL/Containers/ndarray/Subarrays.h
index 62924643c726d9de1eb22d898aeda9e506037c0b..ed22d7e970155505a71814d89528f722dd72c5ac 100644
--- a/src/TNL/Containers/ndarray/Subarrays.h
+++ b/src/TNL/Containers/ndarray/Subarrays.h
@@ -25,9 +25,7 @@ class SubpermutationGetter< std::index_sequence< dims... >, std::index_sequence<
 private:
    using Dimensions = std::index_sequence< dims... >;
    using Permutation = std::index_sequence< vals... >;
-   using Subsequence = decltype(
-            filter_sequence< Dimensions >( Permutation{} )
-         );
+   using Subsequence = decltype( filter_sequence< Dimensions >( Permutation{} ) );
 
    template< std::size_t... v >
    static constexpr auto
@@ -38,12 +36,9 @@ private:
    }
 
 public:
-   using Subpermutation = decltype(
-            get_subpermutation( Subsequence{} )
-         );
+   using Subpermutation = decltype( get_subpermutation( Subsequence{} ) );
 };
 
-
 template< typename Dimensions, typename SihesHolder >
 class SizesFilter;
 
@@ -53,9 +48,7 @@ class SizesFilter< std::index_sequence< dims... >, SizesHolder< Index, sizes...
 private:
    using Dimensions = std::index_sequence< dims... >;
    using SizesSequence = std::index_sequence< sizes... >;
-   using Subsequence = decltype(
-            concat_sequences( std::index_sequence< get_from_pack< dims >( sizes... ) >{} ... )
-         );
+   using Subsequence = decltype( concat_sequences( std::index_sequence< get_from_pack< dims >( sizes... ) >{}... ) );
 
    template< std::size_t... v >
    static constexpr auto
@@ -68,11 +61,10 @@ private:
    template< std::size_t level = 0, typename = void >
    struct SizeSetterHelper
    {
-      template< typename NewSizes,
-                typename OldSizes >
+      template< typename NewSizes, typename OldSizes >
       __cuda_callable__
-      static void setSizes( NewSizes& newSizes,
-                            const OldSizes& oldSizes )
+      static void
+      setSizes( NewSizes& newSizes, const OldSizes& oldSizes )
       {
          if( oldSizes.template getStaticSize< level >() == 0 )
             newSizes.template setSize< level >( oldSizes.template getSize< get< level >( Dimensions{} ) >() );
@@ -83,11 +75,10 @@ private:
    template< typename _unused >
    struct SizeSetterHelper< Dimensions::size() - 1, _unused >
    {
-      template< typename NewSizes,
-                typename OldSizes >
+      template< typename NewSizes, typename OldSizes >
       __cuda_callable__
-      static void setSizes( NewSizes& newSizes,
-                            const OldSizes& oldSizes )
+      static void
+      setSizes( NewSizes& newSizes, const OldSizes& oldSizes )
       {
          static constexpr std::size_t level = Dimensions::size() - 1;
          if( oldSizes.template getStaticSize< level >() == 0 )
@@ -99,7 +90,8 @@ private:
    struct IndexChecker
    {
       template< typename... IndexTypes >
-      static bool check( IndexTypes&&... indices )
+      static bool
+      check( IndexTypes&&... indices )
       {
          static constexpr std::size_t d = get< level >( Dimensions{} );
          if( get_from_pack< d >( std::forward< IndexTypes >( indices )... ) != 0 )
@@ -112,7 +104,8 @@ private:
    struct IndexChecker< Dimensions::size() - 1, _unused >
    {
       template< typename... IndexTypes >
-      static bool check( IndexTypes&&... indices )
+      static bool
+      check( IndexTypes&&... indices )
       {
          static constexpr std::size_t d = get< Dimensions::size() - 1 >( Dimensions{} );
          if( get_from_pack< d >( std::forward< IndexTypes >( indices )... ) != 0 )
@@ -122,13 +115,12 @@ private:
    };
 
 public:
-   using Sizes = decltype(
-            get_sizesholder( Subsequence{} )
-         );
+   using Sizes = decltype( get_sizesholder( Subsequence{} ) );
 
    template< typename... IndexTypes >
    __cuda_callable__
-   static Sizes filterSizes( const SizesHolder< Index, sizes... >& oldSizes, IndexTypes&&... indices )
+   static Sizes
+   filterSizes( const SizesHolder< Index, sizes... >& oldSizes, IndexTypes&&... indices )
    {
       Sizes newSizes;
 
@@ -148,60 +140,64 @@ public:
    }
 };
 
-
 template< typename Index, std::size_t Dimension >
 struct DummyStrideBase
 {
-   static constexpr std::size_t getDimension()
+   static constexpr std::size_t
+   getDimension()
    {
       return Dimension;
    }
 
-   static constexpr bool isContiguous()
+   static constexpr bool
+   isContiguous()
    {
       return true;
    }
 
    template< std::size_t level >
    __cuda_callable__
-   constexpr Index getStride( Index i = 0 ) const
+   constexpr Index
+   getStride( Index i = 0 ) const
    {
       return 1;
    }
 };
 
-template< typename Index,
-          std::size_t... sizes >
-class StridesHolder
-: private SizesHolder< Index, sizes... >
+template< typename Index, std::size_t... sizes >
+class StridesHolder : private SizesHolder< Index, sizes... >
 {
    using BaseType = SizesHolder< Index, sizes... >;
 
 public:
    using BaseType::getDimension;
 
-   static constexpr bool isContiguous()
+   static constexpr bool
+   isContiguous()
    {
       // a priori not contiguous (otherwise DummyStrideBase would be used)
       return false;
    }
 
    template< std::size_t level >
-   static constexpr std::size_t getStaticStride( Index i = 0 )
+   static constexpr std::size_t
+   getStaticStride( Index i = 0 )
    {
       return BaseType::template getStaticSize< level >();
    }
 
    template< std::size_t level >
    __cuda_callable__
-   Index getStride( Index i = 0 ) const
+   Index
+   getStride( Index i = 0 ) const
    {
       return BaseType::template getSize< level >();
    }
 
    template< std::size_t level >
    __cuda_callable__
-   void setStride( Index size )
+   void
+   setStride( Index size )
    {
       BaseType::template setSize< level >( size );
    }
@@ -215,7 +211,8 @@ class SubarrayGetter< NDArrayBase< SliceInfo >, Permutation, Dimensions... >
 {
    // returns the number of factors in the stride product
    template< std::size_t dim, std::size_t... vals >
-   static constexpr std::size_t get_end( std::index_sequence< vals... > _perm )
+   static constexpr std::size_t
+   get_end( std::index_sequence< vals... > _perm )
    {
       if( dim == get< Permutation::size() - 1 >( Permutation{} ) )
          return 0;
@@ -225,7 +222,7 @@ class SubarrayGetter< NDArrayBase< SliceInfo >, Permutation, Dimensions... >
 #ifndef __NVCC__
       for( auto v : std::initializer_list< std::size_t >{ vals... } )
 #else
-      for( auto v : (std::size_t [sizeof...(vals)]){ vals... } )
+      for( auto v : ( std::size_t[ sizeof...( vals ) ] ){ vals... } )
 #endif
       {
          if( i++ <= index_in_pack( dim, vals... ) )
@@ -245,18 +242,21 @@ class SubarrayGetter< NDArrayBase< SliceInfo >, Permutation, Dimensions... >
              typename = void >
    struct StaticStrideGetter
    {
-      static constexpr std::size_t get()
+      static constexpr std::size_t
+      get()
       {
          constexpr std::size_t start_offset = index_in_sequence( start_dim, Permutation{} );
          constexpr std::size_t dim = __ndarray_impl::get< start_offset + level + 1 >( Permutation{} );
-         return SizesHolder::template getStaticSize< dim >() * StaticStrideGetter< SizesHolder, start_dim, end, level + 1 >::get();
+         return SizesHolder::template getStaticSize< dim >()
+              * StaticStrideGetter< SizesHolder, start_dim, end, level + 1 >::get();
       }
    };
 
    template< typename SizesHolder, std::size_t start_dim, std::size_t end, typename _unused >
    struct StaticStrideGetter< SizesHolder, start_dim, end, end, _unused >
    {
-      static constexpr std::size_t get()
+      static constexpr std::size_t
+      get()
       {
          return 1;
       }
@@ -270,7 +270,8 @@ class SubarrayGetter< NDArrayBase< SliceInfo >, Permutation, Dimensions... >
    struct DynamicStrideGetter
    {
       template< typename SizesHolder >
-      static constexpr std::size_t get( const SizesHolder& sizes )
+      static constexpr std::size_t
+      get( const SizesHolder& sizes )
       {
          constexpr std::size_t start_offset = index_in_sequence( start_dim, Permutation{} );
          constexpr std::size_t dim = __ndarray_impl::get< start_offset + level + 1 >( Permutation{} );
@@ -282,7 +283,8 @@ class SubarrayGetter< NDArrayBase< SliceInfo >, Permutation, Dimensions... >
    struct DynamicStrideGetter< start_dim, end, end, _unused >
    {
       template< typename SizesHolder >
-      static constexpr std::size_t get( const SizesHolder& sizes )
+      static constexpr std::size_t
+      get( const SizesHolder& sizes )
       {
          return 1;
       }
@@ -294,7 +296,8 @@ class SubarrayGetter< NDArrayBase< SliceInfo >, Permutation, Dimensions... >
    {
       template< typename StridesHolder, typename SizesHolder >
       __cuda_callable__
-      static void setStrides( StridesHolder& strides, const SizesHolder& sizes )
+      static void
+      setStrides( StridesHolder& strides, const SizesHolder& sizes )
       {
          static constexpr std::size_t dim = get_from_pack< level >( Dimensions... );
          if( StridesHolder::template getStaticStride< level >() == 0 )
@@ -304,13 +307,14 @@ class SubarrayGetter< NDArrayBase< SliceInfo >, Permutation, Dimensions... >
    };
 
    template< typename _unused >
-   struct StrideSetterHelper< sizeof...(Dimensions) - 1, _unused >
+   struct StrideSetterHelper< sizeof...( Dimensions ) - 1, _unused >
    {
       template< typename StridesHolder, typename SizesHolder >
       __cuda_callable__
-      static void setStrides( StridesHolder& strides, const SizesHolder& sizes )
+      static void
+      setStrides( StridesHolder& strides, const SizesHolder& sizes )
       {
-         static constexpr std::size_t level = sizeof...(Dimensions) - 1;
+         static constexpr std::size_t level = sizeof...( Dimensions ) - 1;
          static constexpr std::size_t dim = get_from_pack< level >( Dimensions... );
          if( StridesHolder::template getStaticStride< level >() == 0 )
             strides.template setStride< level >( DynamicStrideGetter< dim >::get( sizes ) );
@@ -322,7 +326,8 @@ public:
 
    template< typename SizesHolder, typename... IndexTypes >
    __cuda_callable__
-   static auto filterSizes( const SizesHolder& sizes, IndexTypes&&... indices )
+   static auto
+   filterSizes( const SizesHolder& sizes, IndexTypes&&... indices )
    {
       using Filter = SizesFilter< std::index_sequence< Dimensions... >, SizesHolder >;
       return Filter::filterSizes( sizes, std::forward< IndexTypes >( indices )... );
@@ -330,10 +335,10 @@ public:
 
    template< typename SizesHolder, typename... IndexTypes >
    __cuda_callable__
-   static auto getStrides( const SizesHolder& sizes, IndexTypes&&... indices )
+   static auto
+   getStrides( const SizesHolder& sizes, IndexTypes&&... indices )
    {
-      using Strides = StridesHolder< typename SizesHolder::IndexType,
-                                     StaticStrideGetter< SizesHolder, Dimensions >::get()... >;
+      using Strides = StridesHolder< typename SizesHolder::IndexType, StaticStrideGetter< SizesHolder, Dimensions >::get()... >;
       Strides strides;
 
       // set dynamic strides
@@ -347,6 +352,6 @@ public:
    }
 };
 
-} // namespace __ndarray_impl
-} // namespace Containers
-} // namespace TNL
+}  // namespace __ndarray_impl
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Containers/ndarray/SynchronizerBuffers.h b/src/TNL/Containers/ndarray/SynchronizerBuffers.h
index 26c57691d409424d81166174d130090d10154098..094f9bb645f13c56b4a019f2069015046f2e8533 100644
--- a/src/TNL/Containers/ndarray/SynchronizerBuffers.h
+++ b/src/TNL/Containers/ndarray/SynchronizerBuffers.h
@@ -17,7 +17,8 @@ namespace __ndarray_impl {
 template< typename DistributedNDArray, std::size_t level >
 struct SynchronizerBuffersLayer
 {
-   SynchronizerBuffersLayer& getDimBuffers( std::integral_constant< std::size_t, level > )
+   SynchronizerBuffersLayer&
+   getDimBuffers( std::integral_constant< std::size_t, level > )
    {
       return *this;
    }
@@ -33,7 +34,8 @@ struct SynchronizerBuffersLayer
    int left_neighbor = -1;
    int right_neighbor = -1;
 
-   void reset()
+   void
+   reset()
    {
       left_send_buffer.reset();
       left_recv_buffer.reset();
@@ -45,7 +47,8 @@ struct SynchronizerBuffersLayer
       right_send_view.reset();
       right_recv_view.reset();
 
-      left_send_offsets = left_recv_offsets = right_send_offsets = right_recv_offsets = typename DistributedNDArray::LocalBeginsType{};
+      left_send_offsets = left_recv_offsets = right_send_offsets = right_recv_offsets =
+         typename DistributedNDArray::LocalBeginsType{};
 
       left_neighbor = right_neighbor = -1;
    }
@@ -73,18 +76,18 @@ struct SynchronizerBuffersLayerHelper< DistributedNDArray, std::integral_constan
 };
 
 template< typename DistributedNDArray >
-struct SynchronizerBuffers
-: public SynchronizerBuffersLayerHelper< DistributedNDArray >
+struct SynchronizerBuffers : public SynchronizerBuffersLayerHelper< DistributedNDArray >
 {
    using SynchronizerBuffersLayerHelper< DistributedNDArray >::getDimBuffers;
 
    template< std::size_t level >
-   auto& getDimBuffers()
+   auto&
+   getDimBuffers()
    {
       return this->getDimBuffers( std::integral_constant< std::size_t, level >{} );
    }
 };
 
-} // namespace __ndarray_impl
-} // namespace Containers
-} // namespace TNL
+}  // namespace __ndarray_impl
+}  // namespace Containers
+}  // namespace TNL
diff --git a/src/TNL/Cuda/CheckDevice.h b/src/TNL/Cuda/CheckDevice.h
index 4040552a8d5928cfec552c919c22b4930eb6e8ef..abdddb1b7cea569002bfd81888420d441d613680 100644
--- a/src/TNL/Cuda/CheckDevice.h
+++ b/src/TNL/Cuda/CheckDevice.h
@@ -12,25 +12,28 @@ namespace TNL {
 namespace Cuda {
 
 #ifdef HAVE_CUDA
-   /****
-    * I do not know why, but it is more reliable to pass the error code instead
-    * of calling cudaGetLastError() inside the function.
-    * We recommend to use macro 'TNL_CHECK_CUDA_DEVICE' defined bellow.
-    */
-   inline void checkDevice( const char* file_name, int line, cudaError error )
-   {
-      if( error != cudaSuccess )
-         throw Exceptions::CudaRuntimeError( error, file_name, line );
-   }
+/****
+ * I do not know why, but it is more reliable to pass the error code instead
+ * of calling cudaGetLastError() inside the function.
+ * We recommend to use macro 'TNL_CHECK_CUDA_DEVICE' defined bellow.
+ */
+inline void
+checkDevice( const char* file_name, int line, cudaError error )
+{
+   if( error != cudaSuccess )
+      throw Exceptions::CudaRuntimeError( error, file_name, line );
+}
 #else
-   inline void checkDevice() {}
+inline void
+checkDevice()
+{}
 #endif
 
-} // namespace Cuda
-} // namespace TNL
+}  // namespace Cuda
+}  // namespace TNL
 
 #ifdef HAVE_CUDA
-#define TNL_CHECK_CUDA_DEVICE ::TNL::Cuda::checkDevice( __FILE__, __LINE__, cudaGetLastError() )
+   #define TNL_CHECK_CUDA_DEVICE ::TNL::Cuda::checkDevice( __FILE__, __LINE__, cudaGetLastError() )
 #else
-#define TNL_CHECK_CUDA_DEVICE ::TNL::Cuda::checkDevice()
+   #define TNL_CHECK_CUDA_DEVICE ::TNL::Cuda::checkDevice()
 #endif
diff --git a/src/TNL/Cuda/CudaCallable.h b/src/TNL/Cuda/CudaCallable.h
index 8ab33a529f0487da4579afdd617c710c95dcc6a4..0bcd3cea9c8428b346fc8e6681a83b6d96bf875e 100644
--- a/src/TNL/Cuda/CudaCallable.h
+++ b/src/TNL/Cuda/CudaCallable.h
@@ -16,7 +16,9 @@
  * no effect.
  */
 #ifdef HAVE_CUDA
-   #define __cuda_callable__ __device__ __host__
+   #define __cuda_callable__ \
+      __device__             \
+      __host__
 #else
    #define __cuda_callable__
 #endif
diff --git a/src/TNL/Cuda/DeviceInfo.h b/src/TNL/Cuda/DeviceInfo.h
index 8a05f221a75775770cb42f940c0b6b8aaa342eb7..f8f1b6c5401f9f79a8ed589c08fb129eecc5c746 100644
--- a/src/TNL/Cuda/DeviceInfo.h
+++ b/src/TNL/Cuda/DeviceInfo.h
@@ -13,36 +13,50 @@ namespace Cuda {
 
 struct DeviceInfo
 {
-   static int getNumberOfDevices();
+   static int
+   getNumberOfDevices();
 
-   static int getActiveDevice();
+   static int
+   getActiveDevice();
 
-   static String getDeviceName( int deviceNum );
+   static String
+   getDeviceName( int deviceNum );
 
-   static int getArchitectureMajor( int deviceNum );
+   static int
+   getArchitectureMajor( int deviceNum );
 
-   static int getArchitectureMinor( int deviceNum );
+   static int
+   getArchitectureMinor( int deviceNum );
 
-   static int getClockRate( int deviceNum );
+   static int
+   getClockRate( int deviceNum );
 
-   static std::size_t getGlobalMemory( int deviceNum );
+   static std::size_t
+   getGlobalMemory( int deviceNum );
 
-   static std::size_t getFreeGlobalMemory();
+   static std::size_t
+   getFreeGlobalMemory();
 
-   static int getMemoryClockRate( int deviceNum );
+   static int
+   getMemoryClockRate( int deviceNum );
 
-   static bool getECCEnabled( int deviceNum );
+   static bool
+   getECCEnabled( int deviceNum );
 
-   static int getCudaMultiprocessors( int deviceNum );
+   static int
+   getCudaMultiprocessors( int deviceNum );
 
-   static int getCudaCoresPerMultiprocessors( int deviceNum );
+   static int
+   getCudaCoresPerMultiprocessors( int deviceNum );
 
-   static int getCudaCores( int deviceNum );
+   static int
+   getCudaCores( int deviceNum );
 
-   static int getRegistersPerMultiprocessor( int deviceNum );
+   static int
+   getRegistersPerMultiprocessor( int deviceNum );
 };
 
-} // namespace Cuda
-} // namespace TNL
+}  // namespace Cuda
+}  // namespace TNL
 
 #include <TNL/Cuda/DeviceInfo.hpp>
diff --git a/src/TNL/Cuda/DeviceInfo.hpp b/src/TNL/Cuda/DeviceInfo.hpp
index 56fa794592e3bdaaa8631fadf1a5785f574b2487..34d8b5217cb2c94afccc3664ed5ba67bc620d45d 100644
--- a/src/TNL/Cuda/DeviceInfo.hpp
+++ b/src/TNL/Cuda/DeviceInfo.hpp
@@ -15,8 +15,7 @@ namespace TNL {
 namespace Cuda {
 
 inline int
-DeviceInfo::
-getNumberOfDevices()
+DeviceInfo::getNumberOfDevices()
 {
 #ifdef HAVE_CUDA
    int devices;
@@ -28,8 +27,7 @@ getNumberOfDevices()
 }
 
 inline int
-DeviceInfo::
-getActiveDevice()
+DeviceInfo::getActiveDevice()
 {
 #ifdef HAVE_CUDA
    int device;
@@ -41,8 +39,7 @@ getActiveDevice()
 }
 
 inline String
-DeviceInfo::
-getDeviceName( int deviceNum )
+DeviceInfo::getDeviceName( int deviceNum )
 {
 #ifdef HAVE_CUDA
    cudaDeviceProp properties;
@@ -54,8 +51,7 @@ getDeviceName( int deviceNum )
 }
 
 inline int
-DeviceInfo::
-getArchitectureMajor( int deviceNum )
+DeviceInfo::getArchitectureMajor( int deviceNum )
 {
 #ifdef HAVE_CUDA
    cudaDeviceProp properties;
@@ -67,8 +63,7 @@ getArchitectureMajor( int deviceNum )
 }
 
 inline int
-DeviceInfo::
-getArchitectureMinor( int deviceNum )
+DeviceInfo::getArchitectureMinor( int deviceNum )
 {
 #ifdef HAVE_CUDA
    cudaDeviceProp properties;
@@ -80,8 +75,7 @@ getArchitectureMinor( int deviceNum )
 }
 
 inline int
-DeviceInfo::
-getClockRate( int deviceNum )
+DeviceInfo::getClockRate( int deviceNum )
 {
 #ifdef HAVE_CUDA
    cudaDeviceProp properties;
@@ -93,8 +87,7 @@ getClockRate( int deviceNum )
 }
 
 inline std::size_t
-DeviceInfo::
-getGlobalMemory( int deviceNum )
+DeviceInfo::getGlobalMemory( int deviceNum )
 {
 #ifdef HAVE_CUDA
    cudaDeviceProp properties;
@@ -106,8 +99,7 @@ getGlobalMemory( int deviceNum )
 }
 
 inline std::size_t
-DeviceInfo::
-getFreeGlobalMemory()
+DeviceInfo::getFreeGlobalMemory()
 {
 #ifdef HAVE_CUDA
    std::size_t free = 0;
@@ -120,8 +112,7 @@ getFreeGlobalMemory()
 }
 
 inline int
-DeviceInfo::
-getMemoryClockRate( int deviceNum )
+DeviceInfo::getMemoryClockRate( int deviceNum )
 {
 #ifdef HAVE_CUDA
    cudaDeviceProp properties;
@@ -133,8 +124,7 @@ getMemoryClockRate( int deviceNum )
 }
 
 inline bool
-DeviceInfo::
-getECCEnabled( int deviceNum )
+DeviceInfo::getECCEnabled( int deviceNum )
 {
 #ifdef HAVE_CUDA
    cudaDeviceProp properties;
@@ -146,8 +136,7 @@ getECCEnabled( int deviceNum )
 }
 
 inline int
-DeviceInfo::
-getCudaMultiprocessors( int deviceNum )
+DeviceInfo::getCudaMultiprocessors( int deviceNum )
 {
 #ifdef HAVE_CUDA
    // results are cached because they are used for configuration of some kernels
@@ -165,19 +154,16 @@ getCudaMultiprocessors( int deviceNum )
 }
 
 inline int
-DeviceInfo::
-getCudaCoresPerMultiprocessors( int deviceNum )
+DeviceInfo::getCudaCoresPerMultiprocessors( int deviceNum )
 {
 #ifdef HAVE_CUDA
    int major = DeviceInfo::getArchitectureMajor( deviceNum );
    int minor = DeviceInfo::getArchitectureMinor( deviceNum );
-   switch( major )
-   {
-      case 1:   // Tesla generation, G80, G8x, G9x classes
+   switch( major ) {
+      case 1:  // Tesla generation, G80, G8x, G9x classes
          return 8;
-      case 2:   // Fermi generation
-         switch( minor )
-         {
+      case 2:  // Fermi generation
+         switch( minor ) {
             case 0:  // GF100 class
                return 32;
             case 1:  // GF10x class
@@ -185,13 +171,12 @@ getCudaCoresPerMultiprocessors( int deviceNum )
             default:
                return -1;
          }
-      case 3: // Kepler generation -- GK10x, GK11x classes
+      case 3:  // Kepler generation -- GK10x, GK11x classes
          return 192;
-      case 5: // Maxwell generation -- GM10x, GM20x classes
+      case 5:  // Maxwell generation -- GM10x, GM20x classes
          return 128;
-      case 6: // Pascal generation
-         switch( minor )
-         {
+      case 6:  // Pascal generation
+         switch( minor ) {
             case 0:  // GP100 class
                return 64;
             case 1:  // GP10x classes
@@ -200,11 +185,10 @@ getCudaCoresPerMultiprocessors( int deviceNum )
             default:
                return -1;
          }
-      case 7: // Volta and Turing generations
+      case 7:  // Volta and Turing generations
          return 64;
-      case 8: // Ampere generation
-         switch( minor )
-         {
+      case 8:  // Ampere generation
+         switch( minor ) {
             case 0:  // GA100 class
                return 64;
             case 6:
@@ -221,20 +205,17 @@ getCudaCoresPerMultiprocessors( int deviceNum )
 }
 
 inline int
-DeviceInfo::
-getCudaCores( int deviceNum )
+DeviceInfo::getCudaCores( int deviceNum )
 {
 #ifdef HAVE_CUDA
-   return DeviceInfo::getCudaMultiprocessors( deviceNum ) *
-          DeviceInfo::getCudaCoresPerMultiprocessors( deviceNum );
+   return DeviceInfo::getCudaMultiprocessors( deviceNum ) * DeviceInfo::getCudaCoresPerMultiprocessors( deviceNum );
 #else
    throw Exceptions::CudaSupportMissing();
 #endif
 }
 
 inline int
-DeviceInfo::
-getRegistersPerMultiprocessor( int deviceNum )
+DeviceInfo::getRegistersPerMultiprocessor( int deviceNum )
 {
 #ifdef HAVE_CUDA
    // results are cached because they are used for configuration of some kernels
@@ -251,5 +232,5 @@ getRegistersPerMultiprocessor( int deviceNum )
 #endif
 }
 
-} // namespace Cuda
-} // namespace TNL
+}  // namespace Cuda
+}  // namespace TNL
diff --git a/src/TNL/Cuda/DummyDefs.h b/src/TNL/Cuda/DummyDefs.h
new file mode 100644
index 0000000000000000000000000000000000000000..5a18d190afd76d2464383275641169c0ba7ea239
--- /dev/null
+++ b/src/TNL/Cuda/DummyDefs.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2004-2022 Tomáš Oberhuber et al.
+//
+// This file is part of TNL - Template Numerical Library (https://tnl-project.org/)
+//
+// SPDX-License-Identifier: MIT
+
+#pragma once
+
+#ifndef HAVE_CUDA
+
+   #define __host__
+   #define __device__
+   #define __global__
+
+struct dim3
+{
+   unsigned int x = 1;
+   unsigned int y = 1;
+   unsigned int z = 1;
+
+   dim3() = default;
+   constexpr dim3( const dim3& ) = default;
+   constexpr dim3( dim3&& ) = default;
+
+   constexpr dim3( unsigned int x, unsigned int y = 1, unsigned int z = 1 ) : x( x ), y( y ), z( z ) {}
+};
+
+struct cudaStream_t
+{
+   cudaStream_t() = default;
+   cudaStream_t( int /*dummy*/ ) {}
+};
+
+#endif
diff --git a/src/TNL/Cuda/KernelLaunch.h b/src/TNL/Cuda/KernelLaunch.h
new file mode 100644
index 0000000000000000000000000000000000000000..5261a6edefb99bd1e6bab7c32815201038b54993
--- /dev/null
+++ b/src/TNL/Cuda/KernelLaunch.h
@@ -0,0 +1,125 @@
+// Copyright (c) 2004-2022 Tomáš Oberhuber et al.
+//
+// This file is part of TNL - Template Numerical Library (https://tnl-project.org/)
+//
+// SPDX-License-Identifier: MIT
+
+#pragma once
+
+#include <TNL/Cuda/CheckDevice.h>
+#include <TNL/Cuda/DummyDefs.h>
+#include <TNL/Exceptions/CudaSupportMissing.h>
+#include <TNL/TypeInfo.h>
+
+namespace TNL {
+namespace Cuda {
+
+/**
+ * Holds the parameters necessary to "launch" a CUDA kernel (i.e. schedule it for
+ * execution on some stream of some device).
+ */
+struct LaunchConfiguration
+{
+   // kernel grid dimensions (in blocks)
+   dim3 gridSize;
+
+   // kernel block dimensions (in threads)
+   dim3 blockSize;
+
+   // size of dynamic shared memory (in bytes per block)
+   std::size_t dynamicSharedMemorySize = 0U;
+
+   LaunchConfiguration() = default;
+   constexpr LaunchConfiguration( const LaunchConfiguration& ) = default;
+   constexpr LaunchConfiguration( LaunchConfiguration&& ) = default;
+
+   constexpr LaunchConfiguration( dim3 gridSize, dim3 blockSize, std::size_t dynamicSharedMemorySize = 0U )
+   : gridSize( gridSize ), blockSize( blockSize ), dynamicSharedMemorySize( dynamicSharedMemorySize )
+   {}
+};
+
+template< bool synchronous = true, typename RawKernel, typename... KernelParameters >
+inline void
+launchKernel( RawKernel kernel_function,
+              cudaStream_t stream_id,
+              LaunchConfiguration launch_configuration,
+              KernelParameters&&... parameters )
+{
+   static_assert(
+      ::std::is_function< RawKernel >::value
+         || ( ::std::is_pointer< RawKernel >::value && ::std::is_function< ::std::remove_pointer_t< RawKernel > >::value ),
+      "Only a plain function or function pointer can be launched as a CUDA kernel. "
+      "You are attempting to launch something else." );
+
+   if( kernel_function == nullptr )
+      throw std::logic_error( "cannot call a function via nullptr" );
+
+      // TODO: basic verification of the configuration
+
+#ifdef TNL_DEBUG_KERNEL_LAUNCHES
+   // clang-format off
+   std::cout << "Type of kernel function: " << TNL::getType( kernel_function ) << "\n";
+   std::cout << "Kernel launch configuration:\n"
+             << "\t- grid size: " << launch_configuration.gridSize.x << " x "
+                                  << launch_configuration.gridSize.y << " x "
+                                  << launch_configuration.gridSize.z << "\n"
+             << "\t- block size: " << launch_configuration.blockSize.x << " x "
+                                   << launch_configuration.blockSize.y << " x "
+                                   << launch_configuration.blockSize.z
+             << "\n"
+//             << "\t- stream: " << stream_id << "\n"
+             << "\t- dynamic shared memory size: " << launch_configuration.dynamicSharedMemorySize << "\n";
+   std::cout.flush();
+   // clang-format on
+#endif
+
+#ifdef __CUDACC__
+   // FIXME: clang-format 13.0.0 is still inserting spaces between "<<<" and ">>>":
+   // https://github.com/llvm/llvm-project/issues/52881
+   // clang-format off
+   kernel_function <<<
+         launch_configuration.gridSize,
+         launch_configuration.blockSize,
+         launch_configuration.dynamicSharedMemorySize,
+         stream_id
+      >>>( ::std::forward< KernelParameters >( parameters )... );
+   // clang-format on
+
+   if( synchronous )
+      cudaStreamSynchronize( stream_id );
+
+   // use custom error handling instead of TNL_CHECK_CUDA_DEVICE
+   // to add the kernel function type to the error message
+   const cudaError_t status = cudaGetLastError();
+   if( status != cudaSuccess ) {
+      std::string msg = "detected after launching kernel " + TNL::getType( kernel_function ) + "\nSource: line "
+                      + std::to_string( __LINE__ ) + " in " + __FILE__;
+      throw Exceptions::CudaRuntimeError( status, msg );
+   }
+#else
+   throw Exceptions::CudaSupportMissing();
+#endif
+}
+
+template< typename RawKernel, typename... KernelParameters >
+inline void
+launchKernelSync( RawKernel kernel_function,
+                  cudaStream_t stream_id,
+                  LaunchConfiguration launch_configuration,
+                  KernelParameters&&... parameters )
+{
+   launchKernel< true >( kernel_function, stream_id, launch_configuration, std::forward< KernelParameters >( parameters )... );
+}
+
+template< typename RawKernel, typename... KernelParameters >
+inline void
+launchKernelAsync( RawKernel kernel_function,
+                   cudaStream_t stream_id,
+                   LaunchConfiguration launch_configuration,
+                   KernelParameters&&... parameters )
+{
+   launchKernel< false >( kernel_function, stream_id, launch_configuration, std::forward< KernelParameters >( parameters )... );
+}
+
+}  // namespace Cuda
+}  // namespace TNL
diff --git a/src/TNL/Cuda/LaunchHelpers.h b/src/TNL/Cuda/LaunchHelpers.h
index 4e75e9d347e737425054f98e268309cc055a3c48..76134be609824b2e2367ed27e033a457d6a27e67 100644
--- a/src/TNL/Cuda/LaunchHelpers.h
+++ b/src/TNL/Cuda/LaunchHelpers.h
@@ -13,32 +13,38 @@ namespace Cuda {
 
 // TODO: the max grid size depends on the axis: (x,y,z): (2147483647, 65535, 65535)
 // see https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/4
-inline constexpr std::size_t getMaxGridSize()
+inline constexpr std::size_t
+getMaxGridSize()
 {
    return 65535;
 }
 
-inline constexpr size_t getMaxGridXSize()
+inline constexpr size_t
+getMaxGridXSize()
 {
-   return 2147483647;//65535;
+   return 2147483647;  // 65535;
 }
 
-inline constexpr size_t getMaxGridYSize()
+inline constexpr size_t
+getMaxGridYSize()
 {
    return 65535;
 }
 
-inline constexpr size_t getMaxGridZSize()
+inline constexpr size_t
+getMaxGridZSize()
 {
    return 65535;
 }
 
-inline constexpr int getMaxBlockSize()
+inline constexpr int
+getMaxBlockSize()
 {
    return 1024;
 }
 
-inline constexpr int getWarpSize()
+inline constexpr int
+getWarpSize()
 {
    return 32;
 }
@@ -46,53 +52,62 @@ inline constexpr int getWarpSize()
 // When we transfer data between the GPU and the CPU we use 1 MiB buffer. This
 // size should ensure good performance.
 // We use the same buffer size even for retyping data during IO operations.
-inline constexpr int getTransferBufferSize()
+inline constexpr int
+getTransferBufferSize()
 {
    return 1 << 20;
 }
 
 #ifdef HAVE_CUDA
-__device__ inline int getGlobalThreadIdx( const int gridIdx = 0,
-                                          const int gridSize = getMaxGridSize() )
+__device__
+inline int
+getGlobalThreadIdx( const int gridIdx = 0, const int gridSize = getMaxGridSize() )
 {
    return ( gridIdx * gridSize + blockIdx.x ) * blockDim.x + threadIdx.x;
 }
 
-__device__ inline int getGlobalThreadIdx_x( const dim3& gridIdx )
+__device__
+inline int
+getGlobalThreadIdx_x( const dim3& gridIdx )
 {
    return ( gridIdx.x * getMaxGridSize() + blockIdx.x ) * blockDim.x + threadIdx.x;
 }
 
-__device__ inline int getGlobalThreadIdx_y( const dim3& gridIdx )
+__device__
+inline int
+getGlobalThreadIdx_y( const dim3& gridIdx )
 {
    return ( gridIdx.y * getMaxGridSize() + blockIdx.y ) * blockDim.y + threadIdx.y;
 }
 
-__device__ inline int getGlobalThreadIdx_z( const dim3& gridIdx )
+__device__
+inline int
+getGlobalThreadIdx_z( const dim3& gridIdx )
 {
    return ( gridIdx.z * getMaxGridSize() + blockIdx.z ) * blockDim.z + threadIdx.z;
 }
 #endif
 
-inline int getNumberOfBlocks( const int threads,
-                              const int blockSize )
+inline int
+getNumberOfBlocks( const int threads, const int blockSize )
 {
    return roundUpDivision( threads, blockSize );
 }
 
-inline int getNumberOfGrids( const int blocks,
-                             const int gridSize = getMaxGridSize() )
+inline int
+getNumberOfGrids( const int blocks, const int gridSize = getMaxGridSize() )
 {
    return roundUpDivision( blocks, gridSize );
 }
 
 #ifdef HAVE_CUDA
-inline void setupThreads( const dim3& blockSize,
-                          dim3& blocksCount,
-                          dim3& gridsCount,
-                          long long int xThreads,
-                          long long int yThreads = 0,
-                          long long int zThreads = 0 )
+inline void
+setupThreads( const dim3& blockSize,
+              dim3& blocksCount,
+              dim3& gridsCount,
+              long long int xThreads,
+              long long int yThreads = 0,
+              long long int zThreads = 0 )
 {
    blocksCount.x = max( 1, xThreads / blockSize.x + ( xThreads % blockSize.x != 0 ) );
    blocksCount.y = max( 1, yThreads / blockSize.y + ( yThreads % blockSize.y != 0 ) );
@@ -116,10 +131,8 @@ inline void setupThreads( const dim3& blockSize,
    gridsCount.z = blocksCount.z / getMaxGridSize() + ( blocksCount.z % getMaxGridSize() != 0 );
 }
 
-inline void setupGrid( const dim3& blocksCount,
-                       const dim3& gridsCount,
-                       const dim3& gridIdx,
-                       dim3& gridSize )
+inline void
+setupGrid( const dim3& blocksCount, const dim3& gridsCount, const dim3& gridIdx, dim3& gridSize )
 {
    /* TODO: this is ext slow!!!!
    int currentDevice( 0 );
@@ -160,17 +173,19 @@ inline void setupGrid( const dim3& blocksCount,
       gridSize.z = blocksCount.z % getMaxGridSize();
 }
 
-inline std::ostream& operator<<( std::ostream& str, const dim3& d )
+inline std::ostream&
+operator<<( std::ostream& str, const dim3& d )
 {
    str << "( " << d.x << ", " << d.y << ", " << d.z << " )";
    return str;
 }
 
-inline void printThreadsSetup( const dim3& blockSize,
-                               const dim3& blocksCount,
-                               const dim3& gridSize,
-                               const dim3& gridsCount,
-                               std::ostream& str = std::cout )
+inline void
+printThreadsSetup( const dim3& blockSize,
+                   const dim3& blocksCount,
+                   const dim3& gridSize,
+                   const dim3& gridsCount,
+                   std::ostream& str = std::cout )
 {
    str << "Block size: " << blockSize << std::endl
        << " Blocks count: " << blocksCount << std::endl
@@ -179,5 +194,5 @@ inline void printThreadsSetup( const dim3& blockSize,
 }
 #endif
 
-} // namespace Cuda
-} // namespace TNL
+}  // namespace Cuda
+}  // namespace TNL
diff --git a/src/TNL/Cuda/MemoryHelpers.h b/src/TNL/Cuda/MemoryHelpers.h
index 27c94b047510b5e5860fc5f8b5ec048870795540..9f7008add600474ca9a53805012a021a8d07ca5d 100644
--- a/src/TNL/Cuda/MemoryHelpers.h
+++ b/src/TNL/Cuda/MemoryHelpers.h
@@ -16,21 +16,16 @@ namespace TNL {
 namespace Cuda {
 
 template< typename ObjectType >
-[[deprecated("Allocators::Cuda and MultiDeviceMemoryOperations should be used instead.")]]
-ObjectType* passToDevice( const ObjectType& object )
+[[deprecated( "Allocators::Cuda and MultiDeviceMemoryOperations should be used instead." )]] ObjectType*
+passToDevice( const ObjectType& object )
 {
 #ifdef HAVE_CUDA
    ObjectType* deviceObject;
-   if( cudaMalloc( ( void** ) &deviceObject,
-                   ( size_t ) sizeof( ObjectType ) ) != cudaSuccess )
+   if( cudaMalloc( (void**) &deviceObject, (size_t) sizeof( ObjectType ) ) != cudaSuccess )
       throw Exceptions::CudaBadAlloc();
-   if( cudaMemcpy( ( void* ) deviceObject,
-                   ( void* ) &object,
-                   sizeof( ObjectType ),
-                   cudaMemcpyHostToDevice ) != cudaSuccess )
-   {
+   if( cudaMemcpy( (void*) deviceObject, (void*) &object, sizeof( ObjectType ), cudaMemcpyHostToDevice ) != cudaSuccess ) {
       TNL_CHECK_CUDA_DEVICE;
-      cudaFree( ( void* ) deviceObject );
+      cudaFree( (void*) deviceObject );
       TNL_CHECK_CUDA_DEVICE;
       return 0;
    }
@@ -41,16 +36,16 @@ ObjectType* passToDevice( const ObjectType& object )
 }
 
 template< typename ObjectType >
-[[deprecated("Allocators::Cuda should be used instead.")]]
-void freeFromDevice( ObjectType* deviceObject )
+[[deprecated( "Allocators::Cuda should be used instead." )]] void
+freeFromDevice( ObjectType* deviceObject )
 {
 #ifdef HAVE_CUDA
-   cudaFree( ( void* ) deviceObject );
+   cudaFree( (void*) deviceObject );
    TNL_CHECK_CUDA_DEVICE;
 #else
    throw Exceptions::CudaSupportMissing();
 #endif
 }
 
-} // namespace Cuda
-} // namespace TNL
+}  // namespace Cuda
+}  // namespace TNL
diff --git a/src/TNL/Cuda/SharedMemory.h b/src/TNL/Cuda/SharedMemory.h
index af0fffc34fc2e5952428720a2db38f7db39488aa..6755a468ed232875c4f6960f4d1eb49662042038 100644
--- a/src/TNL/Cuda/SharedMemory.h
+++ b/src/TNL/Cuda/SharedMemory.h
@@ -37,24 +37,27 @@
 
 #ifdef HAVE_CUDA
 
-#include <stdint.h>
+   #include <stdint.h>
 
 namespace TNL {
 namespace Cuda {
 
-template< typename T, std::size_t _alignment = CHAR_BIT * sizeof(T) >
+template< typename T, std::size_t _alignment = CHAR_BIT * sizeof( T ) >
 struct SharedMemory;
 
 template< typename T >
 struct SharedMemory< T, 8 >
 {
-   __device__ inline operator T* ()
+   __device__
+   inline
+   operator T*()
    {
       extern __shared__ uint8_t __smem8[];
       return reinterpret_cast< T* >( __smem8 );
    }
 
-   __device__ inline operator const T* () const
+   __device__
+   inline operator const T*() const
    {
       extern __shared__ uint8_t __smem8[];
       return reinterpret_cast< T* >( __smem8 );
@@ -64,13 +67,16 @@ struct SharedMemory< T, 8 >
 template< typename T >
 struct SharedMemory< T, 16 >
 {
-   __device__ inline operator T* ()
+   __device__
+   inline
+   operator T*()
    {
       extern __shared__ uint16_t __smem16[];
       return reinterpret_cast< T* >( __smem16 );
    }
 
-   __device__ inline operator const T* () const
+   __device__
+   inline operator const T*() const
    {
       extern __shared__ uint16_t __smem16[];
       return reinterpret_cast< T* >( __smem16 );
@@ -80,13 +86,16 @@ struct SharedMemory< T, 16 >
 template< typename T >
 struct SharedMemory< T, 32 >
 {
-   __device__ inline operator T* ()
+   __device__
+   inline
+   operator T*()
    {
       extern __shared__ uint32_t __smem32[];
       return reinterpret_cast< T* >( __smem32 );
    }
 
-   __device__ inline operator const T* () const
+   __device__
+   inline operator const T*() const
    {
       extern __shared__ uint32_t __smem32[];
       return reinterpret_cast< T* >( __smem32 );
@@ -96,13 +105,16 @@ struct SharedMemory< T, 32 >
 template< typename T >
 struct SharedMemory< T, 64 >
 {
-   __device__ inline operator T* ()
+   __device__
+   inline
+   operator T*()
    {
       extern __shared__ uint64_t __smem64[];
       return reinterpret_cast< T* >( __smem64 );
    }
 
-   __device__ inline operator const T* () const
+   __device__
+   inline operator const T*() const
    {
       extern __shared__ uint64_t __smem64[];
       return reinterpret_cast< T* >( __smem64 );
@@ -110,26 +122,31 @@ struct SharedMemory< T, 64 >
 };
 
 template< typename T >
-__device__ inline T* getSharedMemory()
+__device__
+inline T*
+getSharedMemory()
 {
-   static_assert( sizeof(T) == 1 || sizeof(T) == 2 || sizeof(T) == 4 || sizeof(T) == 8,
+   static_assert( sizeof( T ) == 1 || sizeof( T ) == 2 || sizeof( T ) == 4 || sizeof( T ) == 8,
                   "Requested type has unsupported size." );
    return SharedMemory< T >{};
 }
 
 // helper functions for indexing shared memory
-inline constexpr int getNumberOfSharedMemoryBanks()
+inline constexpr int
+getNumberOfSharedMemoryBanks()
 {
    return 32;
 }
 
 template< typename Index >
-__device__ Index getInterleaving( const Index index )
+__device__
+Index
+getInterleaving( const Index index )
 {
    return index + index / Cuda::getNumberOfSharedMemoryBanks();
 }
 
-} // namespace Cuda
-} // namespace TNL
+}  // namespace Cuda
+}  // namespace TNL
 
 #endif
diff --git a/src/TNL/Cuda/StreamPool.h b/src/TNL/Cuda/StreamPool.h
index d637e6b76d2fa198ac8d18ffd0185bcf813ea67d..d50ee0b835072a30e243fbd4c0dbbd826147ce2f 100644
--- a/src/TNL/Cuda/StreamPool.h
+++ b/src/TNL/Cuda/StreamPool.h
@@ -8,7 +8,7 @@
 
 #pragma once
 
-#include <stdlib.h>
+#include <cstdlib>  // std::atexit
 #include <unordered_map>
 
 namespace TNL {
@@ -17,53 +17,57 @@ namespace Cuda {
 #ifdef HAVE_CUDA
 class StreamPool
 {
-   public:
-      // stop the compiler generating methods of copy the object
-      StreamPool( StreamPool const& copy ) = delete;
-      StreamPool& operator=( StreamPool const& copy ) = delete;
+public:
+   // stop the compiler generating methods of copy the object
+   StreamPool( StreamPool const& copy ) = delete;
+   StreamPool&
+   operator=( StreamPool const& copy ) = delete;
 
-      inline static StreamPool& getInstance()
-      {
-         static StreamPool instance;
-         return instance;
-      }
+   inline static StreamPool&
+   getInstance()
+   {
+      static StreamPool instance;
+      return instance;
+   }
 
-      const cudaStream_t& getStream( int s )
-      {
-         auto result = pool.insert( {s, cudaStream_t()} );
-         cudaStream_t& stream = (*result.first).second;
-         bool& inserted = result.second;
-         if( inserted ) {
-            cudaStreamCreate( &stream );
-         }
-         return stream;
+   const cudaStream_t&
+   getStream( int s )
+   {
+      auto result = pool.insert( { s, cudaStream_t() } );
+      cudaStream_t& stream = ( *result.first ).second;
+      bool& inserted = result.second;
+      if( inserted ) {
+         cudaStreamCreate( &stream );
       }
+      return stream;
+   }
 
-   private:
-      // private constructor of the singleton
-      inline StreamPool()
-      {
-         atexit( StreamPool::free_atexit );
-      }
+private:
+   // private constructor of the singleton
+   inline StreamPool()
+   {
+      std::atexit( StreamPool::free_atexit );
+   }
 
-      inline static void free_atexit( void )
-      {
-         StreamPool::getInstance().free();
-      }
+   inline static void
+   free_atexit( void )
+   {
+      StreamPool::getInstance().free();
+   }
 
-   protected:
-      using MapType = std::unordered_map< int, cudaStream_t >;
+protected:
+   using MapType = std::unordered_map< int, cudaStream_t >;
 
-      inline void free( void )
-      {
-         for( auto& p : pool )
-            cudaStreamDestroy( p.second );
-      }
+   inline void
+   free( void )
+   {
+      for( auto& p : pool )
+         cudaStreamDestroy( p.second );
+   }
 
-      MapType pool;
+   MapType pool;
 };
 #endif
 
-} // namespace Cuda
-} // namespace TNL
-
+}  // namespace Cuda
+}  // namespace TNL
diff --git a/src/TNL/Debugging/FPE.h b/src/TNL/Debugging/FPE.h
index 53f108fad94595b05270007c95fa60e75f25ffed..4bc029536f48c5e66960e4bda456b36d442f55dd 100644
--- a/src/TNL/Debugging/FPE.h
+++ b/src/TNL/Debugging/FPE.h
@@ -18,7 +18,7 @@ static void
 printStackBacktraceAndAbort( int sig = 0 )
 {
    if( sig == SIGSEGV )
-      fprintf(stderr, "Invalid memory reference, printing backtrace and aborting...\n");
+      fprintf( stderr, "Invalid memory reference, printing backtrace and aborting...\n" );
    else if( sig == SIGFPE ) {
       /*
        * Unfortunately it is not possible to get the floating-point exception type
@@ -32,7 +32,7 @@ printStackBacktraceAndAbort( int sig = 0 )
        *    if(fetestexcept(FE_UNDERFLOW))  fprintf(stderr, " FE_UNDERFLOW");
        *    fprintf(stderr, " occurred, printing backtrace and aborting...\n");
        */
-      fprintf(stderr, "Floating-point exception occurred, printing backtrace and aborting...\n");
+      fprintf( stderr, "Floating-point exception occurred, printing backtrace and aborting...\n" );
    }
    else
       fprintf( stderr, "Aborting due to signal %d...\n", sig );
@@ -58,9 +58,9 @@ static void
 trackFloatingPointExceptions()
 {
    signal( SIGSEGV, printStackBacktraceAndAbort );
-   signal( SIGFPE,  printStackBacktraceAndAbort );
+   signal( SIGFPE, printStackBacktraceAndAbort );
    feenableexcept( FE_ALL_EXCEPT & ~FE_INEXACT );
 }
 
-} // namespace Debugging
-} // namespace TNL
+}  // namespace Debugging
+}  // namespace TNL
diff --git a/src/TNL/Debugging/MemoryUsage.h b/src/TNL/Debugging/MemoryUsage.h
index d5e0e0897e39eeccebff9978f9faf2aed0a47c20..26ea61c6897e5e40616c1d56c140a9a18571cc9f 100644
--- a/src/TNL/Debugging/MemoryUsage.h
+++ b/src/TNL/Debugging/MemoryUsage.h
@@ -19,7 +19,7 @@ namespace Debugging {
  *
  * The information is obtained from /proc/self/status, which is assumed to be
  * present on the system. The meaning of the printed values is following:
- *  
+ *
  *  - VmSize: Virtual memory size.
  *  - VmRSS: Resident set size.
  *  - VmHWM: Peak resident set size ("high water mark").
@@ -29,7 +29,7 @@ namespace Debugging {
 static void
 printMemoryUsage( std::ostream& str = std::cerr )
 {
-   std::ifstream meminfo("/proc/self/status");
+   std::ifstream meminfo( "/proc/self/status" );
    if( meminfo.fail() ) {
       std::cerr << "error: unable to open /proc/self/status" << std::endl;
       return;
@@ -41,26 +41,25 @@ printMemoryUsage( std::ostream& str = std::cerr )
 
    std::string desc;
    while( meminfo.good() ) {
-       // extract description (first column)
-       meminfo >> desc;
+      // extract description (first column)
+      meminfo >> desc;
 
-       if( desc == "VmSize:" )
-           meminfo >> vm;
-       if( desc == "VmHWM:" )
-           meminfo >> hwm;
-       if( desc == "VmRSS:" )
-           meminfo >> rss;
+      if( desc == "VmSize:" )
+         meminfo >> vm;
+      if( desc == "VmHWM:" )
+         meminfo >> hwm;
+      if( desc == "VmRSS:" )
+         meminfo >> rss;
 
-       // ignore the rest of irrelevant lines
-       meminfo.ignore( std::numeric_limits< std::streamsize >::max(), '\n' );
+      // ignore the rest of irrelevant lines
+      meminfo.ignore( std::numeric_limits< std::streamsize >::max(), '\n' );
    }
 
    str << "Memory usage (MiB): "
        << "VmSize = " << vm / 1024 << "MiB, "
        << "VmRSS = " << rss / 1024 << "MiB, "
-       << "VmHWM = " << hwm / 1024 << "MiB, "
-       << std::endl;
+       << "VmHWM = " << hwm / 1024 << "MiB, " << std::endl;
 }
 
-} // namespace Debugging
-} // namespace TNL
+}  // namespace Debugging
+}  // namespace TNL
diff --git a/src/TNL/Debugging/OutputRedirection.h b/src/TNL/Debugging/OutputRedirection.h
index e2ce0ac257708f8cc49da769cb95ea94aaa8ce51..45a95bc2088b52e30f4c0a0bc9b82f4ebacb5a68 100644
--- a/src/TNL/Debugging/OutputRedirection.h
+++ b/src/TNL/Debugging/OutputRedirection.h
@@ -23,31 +23,32 @@ class OutputRedirection
 public:
    OutputRedirection() = delete;
 
-   OutputRedirection(int targetFd) : targetFd(targetFd) {}
+   OutputRedirection( int targetFd ) : targetFd( targetFd ) {}
 
-   bool redirect(std::string fname)
+   bool
+   redirect( const std::string& fname )
    {
       // restore the original stream if there is any backup
-      if( backupFd >= 0 || file )
+      if( backupFd >= 0 || file != nullptr )
          if( ! restore() )
-             return false;
+            return false;
 
       // first open the file
-      file = ::fopen(fname.c_str(), "w");
+      file = ::fopen( fname.c_str(), "w" );
       if( file == nullptr ) {
          std::cerr << "error: fopen() failed, output is not redirected." << std::endl;
          return false;
       }
 
       // then backup the original file descriptors
-      backupFd = ::dup(targetFd);
+      backupFd = ::dup( targetFd );
       if( backupFd < 0 ) {
          std::cerr << "error: dup() failed, output is not redirected." << std::endl;
          return false;
       }
 
       // finally redirect stdout and stderr
-      if( ::dup2(::fileno(file), targetFd) < 0 ) {
+      if( ::dup2( ::fileno( file ), targetFd ) < 0 ) {
          std::cerr << "error: dup2() failed, output is not redirected." << std::endl;
          return false;
       }
@@ -55,11 +56,12 @@ public:
       return true;
    }
 
-   bool restore()
+   bool
+   restore()
    {
       // first restore the original file descriptor
       if( backupFd >= 0 ) {
-         if( ::dup2(backupFd, targetFd) < 0 ) {
+         if( ::dup2( backupFd, targetFd ) < 0 ) {
             std::cerr << "error: dup2() failed, output is not restored." << std::endl;
             return false;
          }
@@ -68,7 +70,7 @@ public:
 
       // then close the file
       if( file != nullptr ) {
-         ::fclose(file);
+         ::fclose( file );
          file = nullptr;
       }
       return true;
@@ -76,20 +78,20 @@ public:
 
    ~OutputRedirection()
    {
-       restore();
+      restore();
    }
 };
 
 inline bool
-redirect_stdout_stderr(std::string stdout_fname, std::string stderr_fname, bool restore = false)
+redirect_stdout_stderr( const std::string& stdout_fname, const std::string& stderr_fname, bool restore = false )
 {
    static OutputRedirection stdoutRedir( STDOUT_FILENO );
    static OutputRedirection stderrRedir( STDERR_FILENO );
 
-   if( restore == false ) {
-      if( ! stdoutRedir.redirect(stdout_fname) )
+   if( ! restore ) {
+      if( ! stdoutRedir.redirect( stdout_fname ) )
          return false;
-      if( ! stderrRedir.redirect(stderr_fname) )
+      if( ! stderrRedir.redirect( stderr_fname ) )
          return false;
    }
    else {
@@ -100,5 +102,5 @@ redirect_stdout_stderr(std::string stdout_fname, std::string stderr_fname, bool
    return true;
 }
 
-} // namespace Debugging
-} // namespace TNL
+}  // namespace Debugging
+}  // namespace TNL
diff --git a/src/TNL/Debugging/StackBacktrace.h b/src/TNL/Debugging/StackBacktrace.h
index 322977109d3b5147b98c84e5d4c6ae4260c0dbd1..d3d58d1f69d38b017d7767297a44066c7651fa50 100644
--- a/src/TNL/Debugging/StackBacktrace.h
+++ b/src/TNL/Debugging/StackBacktrace.h
@@ -24,48 +24,48 @@ namespace Debugging {
  * demangling will not work.
  */
 static void
-printStackBacktrace( FILE *out = stderr, unsigned int max_frames = 63 )
+printStackBacktrace( FILE* out = stderr, unsigned int max_frames = 63 )
 {
-   fprintf(out, "stack trace:\n");
+   fprintf( out, "stack trace:\n" );
 
    // storage array for stack trace address data
-   void* addrlist[max_frames+1];
+   void* addrlist[ max_frames + 1 ];
 
    // retrieve current stack addresses
-   int addrlen = backtrace(addrlist, sizeof(addrlist) / sizeof(void*));
+   int addrlen = backtrace( addrlist, sizeof( addrlist ) / sizeof( void* ) );
 
-   if (addrlen == 0) {
-      fprintf(out, "  <empty, possibly corrupt>\n");
+   if( addrlen == 0 ) {
+      fprintf( out, "  <empty, possibly corrupt>\n" );
       return;
    }
 
    // resolve addresses into strings containing "filename(function+address)",
    // this array must be free()-ed
-   char** symbollist = backtrace_symbols(addrlist, addrlen);
+   char** symbollist = backtrace_symbols( addrlist, addrlen );
 
    // allocate string which will be filled with the demangled function name
    size_t funcnamesize = 256;
-   char* funcname = (char*)malloc(funcnamesize);
+   char* funcname = (char*) malloc( funcnamesize );
 
    // iterate over the returned symbol lines. skip the first, it is the
    // address of this function.
-   for (int i = 1; i < addrlen; i++) {
+   for( int i = 1; i < addrlen; i++ ) {
       char *begin_name = 0, *begin_offset = 0, *end_offset = 0;
 
       // find parentheses and +address offset surrounding the mangled name:
       // ./module(function+0x15c) [0x8048a6d]
-      for (char *p = symbollist[i]; *p; ++p) {
-         if (*p == '(')
+      for( char* p = symbollist[ i ]; *p; ++p ) {
+         if( *p == '(' )
             begin_name = p;
-         else if (*p == '+')
+         else if( *p == '+' )
             begin_offset = p;
-         else if (*p == ')' && begin_offset) {
+         else if( *p == ')' && begin_offset ) {
             end_offset = p;
             break;
          }
       }
 
-      if (begin_name && begin_offset && end_offset && begin_name < begin_offset) {
+      if( begin_name && begin_offset && end_offset && begin_name < begin_offset ) {
          *begin_name++ = '\0';
          *begin_offset++ = '\0';
          *end_offset = '\0';
@@ -75,34 +75,32 @@ printStackBacktrace( FILE *out = stderr, unsigned int max_frames = 63 )
          // __cxa_demangle():
 
          int status;
-         char* ret = abi::__cxa_demangle(begin_name, funcname, &funcnamesize, &status);
-         if (status == 0) {
-            funcname = ret; // use possibly realloc()-ed string
-            fprintf(out, "  %d %s : %s+%s\n",
-               i, symbollist[i], funcname, begin_offset);
+         char* ret = abi::__cxa_demangle( begin_name, funcname, &funcnamesize, &status );
+         if( status == 0 ) {
+            funcname = ret;  // use possibly realloc()-ed string
+            fprintf( out, "  %d %s : %s+%s\n", i, symbollist[ i ], funcname, begin_offset );
          }
          else {
             // demangling failed. Output function name as a C function with no arguments.
-            fprintf(out, "  %d %s : %s()+%s\n",
-               i, symbollist[i], begin_name, begin_offset);
+            fprintf( out, "  %d %s : %s()+%s\n", i, symbollist[ i ], begin_name, begin_offset );
          }
       }
       else {
          // couldn't parse the line? print the whole line.
-         fprintf(out, "  %d %s\n", i, symbollist[i]);
+         fprintf( out, "  %d %s\n", i, symbollist[ i ] );
       }
    }
 
-   free(funcname);
-   free(symbollist);
+   free( funcname );
+   free( symbollist );
 }
 #endif
 
-} // namespace Debugging
-} // namespace TNL
+}  // namespace Debugging
+}  // namespace TNL
 
 #ifdef NDEBUG
-#define PrintStackBacktrace
+   #define PrintStackBacktrace
 #else
-#define PrintStackBacktrace TNL::Debugging::printStackBacktrace();
+   #define PrintStackBacktrace TNL::Debugging::printStackBacktrace();
 #endif
diff --git a/src/TNL/Devices/AnyDevice.h b/src/TNL/Devices/AnyDevice.h
index 6d1bd66449367963c9a4cf7bc418d8d8313c2c4d..92147ce28d259969abdd52667441acb2eeefe3be 100644
--- a/src/TNL/Devices/AnyDevice.h
+++ b/src/TNL/Devices/AnyDevice.h
@@ -12,8 +12,7 @@ namespace TNL {
 namespace Devices {
 
 class AnyDevice
-{
-};
+{};
 
 template< typename Device >
 struct PickDevice
@@ -27,5 +26,5 @@ struct PickDevice< Devices::AnyDevice >
    using DeviceType = Devices::Host;
 };
 
-} // namespace Devices
-} // namespace TNL
+}  // namespace Devices
+}  // namespace TNL
diff --git a/src/TNL/Devices/Cuda.h b/src/TNL/Devices/Cuda.h
index c24ceae13bedd134c46c79d984698cbac4a4dce7..7d960ba858ffa23cc2e10da839000c8380bdaab0 100644
--- a/src/TNL/Devices/Cuda.h
+++ b/src/TNL/Devices/Cuda.h
@@ -16,22 +16,23 @@ namespace Devices {
 class Cuda
 {
 public:
-   static inline void configSetup( Config::ConfigDescription& config, const String& prefix = "" )
+   static inline void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" )
    {
 #ifdef HAVE_CUDA
       config.addEntry< int >( prefix + "cuda-device", "Choose CUDA device to run the computation.", 0 );
 #else
-      config.addEntry< int >( prefix + "cuda-device", "Choose CUDA device to run the computation (not supported on this system).", 0 );
+      config.addEntry< int >(
+         prefix + "cuda-device", "Choose CUDA device to run the computation (not supported on this system).", 0 );
 #endif
    }
 
-   static inline bool setup( const Config::ParameterContainer& parameters,
-                             const String& prefix = "" )
+   static inline bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" )
    {
 #ifdef HAVE_CUDA
       int cudaDevice = parameters.getParameter< int >( prefix + "cuda-device" );
-      if( cudaSetDevice( cudaDevice ) != cudaSuccess )
-      {
+      if( cudaSetDevice( cudaDevice ) != cudaSuccess ) {
          std::cerr << "I cannot activate CUDA device number " << cudaDevice << "." << std::endl;
          return false;
       }
@@ -40,5 +41,5 @@ public:
    }
 };
 
-} // namespace Devices
-} // namespace TNL
+}  // namespace Devices
+}  // namespace TNL
diff --git a/src/TNL/Devices/Host.h b/src/TNL/Devices/Host.h
index d02db507e9b4b5782cae4d171a32090550f10330..06a0c389c8d8cd9be94cffe92d96f84c7be49021 100644
--- a/src/TNL/Devices/Host.h
+++ b/src/TNL/Devices/Host.h
@@ -11,7 +11,7 @@
 #include <TNL/Config/ParameterContainer.h>
 
 #ifdef HAVE_OPENMP
-#include <omp.h>
+   #include <omp.h>
 #endif
 
 namespace TNL {
@@ -20,17 +20,20 @@ namespace Devices {
 class Host
 {
 public:
-   static void disableOMP()
+   static void
+   disableOMP()
    {
       ompEnabled() = false;
    }
 
-   static void enableOMP()
+   static void
+   enableOMP()
    {
       ompEnabled() = true;
    }
 
-   static inline bool isOMPEnabled()
+   static inline bool
+   isOMPEnabled()
    {
 #ifdef HAVE_OPENMP
       return ompEnabled();
@@ -39,7 +42,8 @@ public:
 #endif
    }
 
-   static void setMaxThreadsCount( int maxThreadsCount_ )
+   static void
+   setMaxThreadsCount( int maxThreadsCount_ )
    {
       maxThreadsCount() = maxThreadsCount_;
 #ifdef HAVE_OPENMP
@@ -47,7 +51,8 @@ public:
 #endif
    }
 
-   static int getMaxThreadsCount()
+   static int
+   getMaxThreadsCount()
    {
 #ifdef HAVE_OPENMP
       if( maxThreadsCount() == -1 )
@@ -58,7 +63,8 @@ public:
 #endif
    }
 
-   static int getThreadIdx()
+   static int
+   getThreadIdx()
    {
 #ifdef HAVE_OPENMP
       return omp_get_thread_num();
@@ -67,20 +73,21 @@ public:
 #endif
    }
 
-   static void configSetup( Config::ConfigDescription& config,
-                            const String& prefix = "" )
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" )
    {
 #ifdef HAVE_OPENMP
       config.addEntry< bool >( prefix + "openmp-enabled", "Enable support of OpenMP.", true );
-      config.addEntry<  int >( prefix + "openmp-max-threads", "Set maximum number of OpenMP threads.", omp_get_max_threads() );
+      config.addEntry< int >( prefix + "openmp-max-threads", "Set maximum number of OpenMP threads.", omp_get_max_threads() );
 #else
       config.addEntry< bool >( prefix + "openmp-enabled", "Enable support of OpenMP (not supported on this system).", false );
-      config.addEntry<  int >( prefix + "openmp-max-threads", "Set maximum number of OpenMP threads (not supported on this system).", 0 );
+      config.addEntry< int >(
+         prefix + "openmp-max-threads", "Set maximum number of OpenMP threads (not supported on this system).", 0 );
 #endif
    }
 
-   static bool setup( const Config::ParameterContainer& parameters,
-                      const String& prefix = "" )
+   static bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" )
    {
       if( parameters.getParameter< bool >( prefix + "openmp-enabled" ) ) {
 #ifdef HAVE_OPENMP
@@ -99,23 +106,25 @@ public:
       return true;
    }
 
-   protected:
-      static bool& ompEnabled()
-      {
+protected:
+   static bool&
+   ompEnabled()
+   {
 #ifdef HAVE_OPENMP
-         static bool ompEnabled = true;
+      static bool ompEnabled = true;
 #else
-         static bool ompEnabled = false;
+      static bool ompEnabled = false;
 #endif
-         return ompEnabled;
-      }
+      return ompEnabled;
+   }
 
-      static int& maxThreadsCount()
-      {
-         static int maxThreadsCount = -1;
-         return maxThreadsCount;
-      }
+   static int&
+   maxThreadsCount()
+   {
+      static int maxThreadsCount = -1;
+      return maxThreadsCount;
+   }
 };
 
-} // namespace Devices
-} // namespace TNL
+}  // namespace Devices
+}  // namespace TNL
diff --git a/src/TNL/Devices/Sequential.h b/src/TNL/Devices/Sequential.h
index 95b89968fafb0906545cc4efe6e5f97649ada7c2..94912e52a264bd3599aac57b4c56d05a3e5d2591 100644
--- a/src/TNL/Devices/Sequential.h
+++ b/src/TNL/Devices/Sequential.h
@@ -13,5 +13,5 @@ namespace Devices {
 struct Sequential
 {};
 
-} // namespace Devices
-} // namespace TNL
+}  // namespace Devices
+}  // namespace TNL
diff --git a/src/TNL/Endianness.h b/src/TNL/Endianness.h
index f0f719f8c9edecd0f0562577f5201b8b51814961..766cabc7cca5d097599dfbda18da304aa7923130 100644
--- a/src/TNL/Endianness.h
+++ b/src/TNL/Endianness.h
@@ -19,7 +19,8 @@ namespace TNL {
  * Reference: https://stackoverflow.com/a/4956493
  */
 template< typename T >
-T swapEndianness(T u)
+T
+swapEndianness( T u )
 {
    static_assert( CHAR_BIT == 8, "CHAR_BIT != 8" );
    static_assert( std::is_fundamental< T >::value, "swap_endian works only for fundamental types" );
@@ -27,13 +28,13 @@ T swapEndianness(T u)
    union
    {
       T u;
-      unsigned char u8[sizeof(T)];
+      unsigned char u8[ sizeof( T ) ];
    } source, dest;
 
    source.u = u;
 
-   for (std::size_t k = 0; k < sizeof(T); k++)
-      dest.u8[k] = source.u8[sizeof(T) - k - 1];
+   for( std::size_t k = 0; k < sizeof( T ); k++ )
+      dest.u8[ k ] = source.u8[ sizeof( T ) - k - 1 ];
 
    return dest.u;
 }
@@ -45,22 +46,21 @@ inline bool
 isLittleEndian()
 {
    const unsigned int tmp1 = 1;
-   const unsigned char *tmp2 = reinterpret_cast<const unsigned char*>(&tmp1);
-   if (*tmp2 != 0)
-      return true;
-   return false;
+   const auto* tmp2 = reinterpret_cast< const unsigned char* >( &tmp1 );
+   return *tmp2 != 0;
 }
 
 /**
  * \brief Function takes a value and returns its big endian representation.
  */
 template< typename T >
-T forceBigEndian(T value)
+T
+forceBigEndian( T value )
 {
    static bool swap = isLittleEndian();
    if( swap )
-      return swapEndianness(value);
+      return swapEndianness( value );
    return value;
 }
 
-}
+}  // namespace TNL
diff --git a/src/TNL/Exceptions/ConfigError.h b/src/TNL/Exceptions/ConfigError.h
index 825c7c15323ea0bef0ced53a062d08a3c54682e1..5aaf78f262022a7fda2d5c95da7927804459ec82 100644
--- a/src/TNL/Exceptions/ConfigError.h
+++ b/src/TNL/Exceptions/ConfigError.h
@@ -13,13 +13,10 @@
 namespace TNL {
 namespace Exceptions {
 
-struct ConfigError
-   : public std::runtime_error
+struct ConfigError : public std::runtime_error
 {
-   ConfigError( std::string msg )
-   : std::runtime_error( msg )
-   {}
+   ConfigError( const std::string& msg ) : std::runtime_error( msg ) {}
 };
 
-} // namespace Exceptions
-} // namespace TNL
+}  // namespace Exceptions
+}  // namespace TNL
diff --git a/src/TNL/Exceptions/CudaBadAlloc.h b/src/TNL/Exceptions/CudaBadAlloc.h
index 87e707388dad5611b7d5b4531bf1d1075934950a..a3e7dc57e8edd518d1b9109d208d0d8d198812a9 100644
--- a/src/TNL/Exceptions/CudaBadAlloc.h
+++ b/src/TNL/Exceptions/CudaBadAlloc.h
@@ -13,8 +13,7 @@
 namespace TNL {
 namespace Exceptions {
 
-struct CudaBadAlloc
-   : public std::bad_alloc
+struct CudaBadAlloc : public std::bad_alloc
 {
    CudaBadAlloc()
    {
@@ -25,12 +24,13 @@ struct CudaBadAlloc
 #endif
    }
 
-   const char* what() const throw()
+   const char*
+   what() const noexcept override
    {
       return "Failed to allocate memory on the CUDA device: "
              "most likely there is not enough space on the device memory.";
    }
 };
 
-} // namespace Exceptions
-} // namespace TNL
+}  // namespace Exceptions
+}  // namespace TNL
diff --git a/src/TNL/Exceptions/CudaRuntimeError.h b/src/TNL/Exceptions/CudaRuntimeError.h
index 797d1874f01ae96b1ecf93bab79163f9db194aa6..dab17af7582d675fc015470294af49b232cbe63d 100644
--- a/src/TNL/Exceptions/CudaRuntimeError.h
+++ b/src/TNL/Exceptions/CudaRuntimeError.h
@@ -14,41 +14,41 @@ namespace TNL {
 namespace Exceptions {
 
 #ifdef HAVE_CUDA
-   using CudaStatusType = cudaError;
+using CudaStatusType = cudaError;
 #else
-   using CudaStatusType = int;
+using CudaStatusType = int;
 #endif
 
-class CudaRuntimeError
-   : public std::runtime_error
+class CudaRuntimeError : public std::runtime_error
 {
 public:
    CudaRuntimeError( CudaStatusType error_code )
-   : std::runtime_error( "CUDA ERROR " + std::to_string( (int) error_code ) + " (" + name( error_code ) + "): "
-                         + description( error_code ) + "." ),
+   : std::runtime_error( "CUDA ERROR " + std::to_string( (int) error_code ) + " (" + name( error_code )
+                         + "): " + description( error_code ) + "." ),
      code_( error_code )
    {}
 
    CudaRuntimeError( CudaStatusType error_code, const std::string& what_arg )
-   : std::runtime_error( "CUDA ERROR " + std::to_string( (int) error_code ) + " (" + name( error_code ) + "): "
-                         + description( error_code ) + ".\nDetails: " + what_arg ),
-     code_(error_code)
+   : std::runtime_error( "CUDA ERROR " + std::to_string( (int) error_code ) + " (" + name( error_code )
+                         + "): " + description( error_code ) + ".\nDetails: " + what_arg ),
+     code_( error_code )
    {}
 
    CudaRuntimeError( CudaStatusType error_code, const char* file_name, int line )
    : std::runtime_error( "CUDA ERROR " + std::to_string( (int) error_code ) + " (" + name( error_code ) + "): "
-                         + description( error_code ) + ".\nSource: line " + std::to_string( line )
-                         + " in " + file_name ),
-     code_(error_code)
+                         + description( error_code ) + ".\nSource: line " + std::to_string( line ) + " in " + file_name ),
+     code_( error_code )
    {}
 
-   CudaStatusType code() const
+   CudaStatusType
+   code() const
    {
       return code_;
    }
 
 private:
-   static std::string name( CudaStatusType error_code )
+   static std::string
+   name( CudaStatusType error_code )
    {
 #ifdef HAVE_CUDA
       return cudaGetErrorName( error_code );
@@ -57,7 +57,8 @@ private:
 #endif
    }
 
-   static std::string description( CudaStatusType error_code )
+   static std::string
+   description( CudaStatusType error_code )
    {
 #ifdef HAVE_CUDA
       return cudaGetErrorString( error_code );
@@ -69,5 +70,5 @@ private:
    CudaStatusType code_;
 };
 
-} // namespace Exceptions
-} // namespace TNL
+}  // namespace Exceptions
+}  // namespace TNL
diff --git a/src/TNL/Exceptions/CudaSupportMissing.h b/src/TNL/Exceptions/CudaSupportMissing.h
index fb8f22635053e4a29b982c1cd1989ffb1eb43906..6f79548c08d90b3d9f8bf43a0b302f00cfb9600b 100644
--- a/src/TNL/Exceptions/CudaSupportMissing.h
+++ b/src/TNL/Exceptions/CudaSupportMissing.h
@@ -16,8 +16,7 @@ namespace TNL {
  */
 namespace Exceptions {
 
-struct CudaSupportMissing
-   : public std::runtime_error
+struct CudaSupportMissing : public std::runtime_error
 {
    CudaSupportMissing()
    : std::runtime_error( "CUDA support is missing, but the program called a function which needs it. "
@@ -25,5 +24,5 @@ struct CudaSupportMissing
    {}
 };
 
-} // namespace Exceptions
-} // namespace TNL
+}  // namespace Exceptions
+}  // namespace TNL
diff --git a/src/TNL/Exceptions/FileDeserializationError.h b/src/TNL/Exceptions/FileDeserializationError.h
index 1cbbe4626f51a4f6f75b952a7811fe4a4cac4a26..d7632dd40e7d723c2564fd0656c6c1e66e73714d 100644
--- a/src/TNL/Exceptions/FileDeserializationError.h
+++ b/src/TNL/Exceptions/FileDeserializationError.h
@@ -14,8 +14,7 @@
 namespace TNL {
 namespace Exceptions {
 
-class FileDeserializationError
-   : public std::runtime_error
+class FileDeserializationError : public std::runtime_error
 {
 public:
    FileDeserializationError( const std::string& fileName, const std::string& details )
@@ -23,5 +22,5 @@ public:
    {}
 };
 
-} // namespace Exceptions
-} // namespace TNL
+}  // namespace Exceptions
+}  // namespace TNL
diff --git a/src/TNL/Exceptions/FileSerializationError.h b/src/TNL/Exceptions/FileSerializationError.h
index dab7a8735725886ebdb03e69fde458a6cc87de36..4dd9e23d5738d550d17568f02fc747ce7f940cf1 100644
--- a/src/TNL/Exceptions/FileSerializationError.h
+++ b/src/TNL/Exceptions/FileSerializationError.h
@@ -14,8 +14,7 @@
 namespace TNL {
 namespace Exceptions {
 
-class FileSerializationError
-   : public std::runtime_error
+class FileSerializationError : public std::runtime_error
 {
 public:
    FileSerializationError( const std::string& fileName, const std::string& details )
@@ -23,5 +22,5 @@ public:
    {}
 };
 
-} // namespace Exceptions
-} // namespace TNL
+}  // namespace Exceptions
+}  // namespace TNL
diff --git a/src/TNL/Exceptions/MPISupportMissing.h b/src/TNL/Exceptions/MPISupportMissing.h
index aea03b7ed6aaf20a3cf84c4acd69f19018b602e3..e4a172c0e99dc1d770dadee8796da6a3a8d4c6da 100644
--- a/src/TNL/Exceptions/MPISupportMissing.h
+++ b/src/TNL/Exceptions/MPISupportMissing.h
@@ -11,8 +11,7 @@
 namespace TNL {
 namespace Exceptions {
 
-struct MPISupportMissing
-   : public std::runtime_error
+struct MPISupportMissing : public std::runtime_error
 {
    MPISupportMissing()
    : std::runtime_error( "MPI support is missing, but the program called a function which needs it. "
@@ -20,5 +19,5 @@ struct MPISupportMissing
    {}
 };
 
-} // namespace Exceptions
-} // namespace TNL
+}  // namespace Exceptions
+}  // namespace TNL
diff --git a/src/TNL/Exceptions/NotImplementedError.h b/src/TNL/Exceptions/NotImplementedError.h
index 8144fe08db82e0aa0628d73be3210061f3d2f810..d194d6060b703cb812cd3d8b258968761cea1927 100644
--- a/src/TNL/Exceptions/NotImplementedError.h
+++ b/src/TNL/Exceptions/NotImplementedError.h
@@ -13,13 +13,10 @@
 namespace TNL {
 namespace Exceptions {
 
-struct NotImplementedError
-   : public std::runtime_error
+struct NotImplementedError : public std::runtime_error
 {
-   NotImplementedError( std::string msg = "Something is not implemented." )
-   : std::runtime_error( msg )
-   {}
+   NotImplementedError( const std::string& msg = "Something is not implemented." ) : std::runtime_error( msg ) {}
 };
 
-} // namespace Exceptions
-} // namespace TNL
+}  // namespace Exceptions
+}  // namespace TNL
diff --git a/src/TNL/File.h b/src/TNL/File.h
index 7c1eb6283232029c084d6a4194cafcbf149fa638..92dfd58e4edaa89b63a368e4989b48f62997e37b 100644
--- a/src/TNL/File.h
+++ b/src/TNL/File.h
@@ -16,7 +16,8 @@
 namespace TNL {
 
 /**
- * \brief This class serves for binary IO. It allows to do IO even for data allocated on GPU together with on-the-fly data type conversion.
+ * \brief This class serves for binary IO. It allows to do IO even for data allocated on GPU together with on-the-fly data type
+ * conversion.
  *
  * \par Example
  * \include FileExample.cpp
@@ -25,149 +26,157 @@ namespace TNL {
  */
 class File
 {
-   public:
-
-      /**
-       * \brief Basic constructor.
-       */
-      File() = default;
-
-      File( const File& ) = delete;
-
-      File( File&& ) = default;
-
-      File& operator=( const File& ) = delete;
-
-      File& operator=( File&& ) = default;
-
-      /**
-       * \brief Constructor which opens given file.
-       *
-       * All parameters are passed to the \ref open method.
-       */
-      File( const String& fileName,
-            std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out );
-
-      /**
-       * \brief Open given file.
-       *
-       * Opens file with given \e fileName in some \e mode from \ref std::ios_base::openmode.
-       * Note that the file is always opened in binary mode, i.e. \ref std::ios_base::binary
-       * is always added to \e mode.
-       *
-       * Throws \ref std::ios_base::failure on failure.
-       *
-       * \param fileName String which indicates file name.
-       * \param mode Indicates in what mode the file will be opened - see \ref std::ios_base::openmode.
-       */
-      void open( const String& fileName,
-                 std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out );
-
-      /**
-       * \brief Closes the file.
-       *
-       * Throws \ref std::ios_base::failure on failure.
-       */
-      void close();
-
-      /**
-       * \brief Returns name of the file.
-       */
-      const String& getFileName() const
-      {
-         return this->fileName;
-      }
-
-      /**
-       * \brief Method for loading data from the file.
-       *
-       * The data will be stored in \e buffer which was allocated using the
-       * allocator of type \e Allocator. The data type of the buffer is given
-       * by the template parameter \e Type. The second template parameter
-       * \e SourceType defines the type of data in the source file. If both
-       * types are different, on-the-fly conversion takes place during the
-       * data loading.
-       *
-       * Throws \ref std::ios_base::failure on failure.
-       *
-       * \tparam Type type of data to be loaded to the \e buffer.
-       * \tparam SourceType type of data stored on the file,
-       * \tparam Allocator type of the allocator which was used to allocate \e buffer.
-       * \param buffer Pointer in memory where the elements are loaded and stored after reading.
-       * \param elements number of elements to be loaded from the file.
-       *
-       * The following example shows how to load data directly to GPU.
-       *
-       * \par Example
-       * \include FileExampleCuda.cpp
-       * \par Output
-       * \include FileExampleCuda.out
-       * The following example shows how to do on-the-fly data conversion.
-       *
-       * \par Example
-       * \include FileExampleSaveAndLoad.cpp
-       * \par Output
-       * \include FileExampleSaveAndLoad.out
-       */
-      template< typename Type, typename SourceType = Type, typename Allocator = Allocators::Host< Type > >
-      void load( Type* buffer, std::streamsize elements = 1 );
-
-      /**
-       * \brief Method for saving data to the file.
-       *
-       * The data from the \e buffer (with type \e Type) which was allocated
-       * using an allocator of type \e Allocator. \e TargetType defines as what
-       * data type the buffer shall be saved. If the type is different from the
-       * data type, on-the-fly data type conversion takes place during the data
-       * saving.
-       *
-       * Throws \ref std::ios_base::failure on failure.
-       *
-       * \tparam Type type of data in the \e buffer.
-       * \tparam TargetType tells as what type data the buffer shall be saved.
-       * \tparam Allocator type of the allocator which was used to allocate \e buffer.
-       * \tparam Index type of index by which the elements are indexed.
-       * \param buffer buffer that is going to be saved to the file.
-       * \param elements number of elements saved to the file.
-       *
-       * See \ref File::load for examples.
-       */
-      template< typename Type, typename TargetType = Type, typename Allocator = Allocators::Host< Type > >
-      void save( const Type* buffer, std::streamsize elements = 1 );
-
-   protected:
-      // implementation for all allocators which allocate data accessible from host
-      template< typename Type,
-                typename SourceType,
-                typename Allocator,
-                typename = std::enable_if_t< ! std::is_same< Allocator, Allocators::Cuda< Type > >::value > >
-      void load_impl( Type* buffer, std::streamsize elements );
-
-      // implementation for \ref Allocators::Cuda
-      template< typename Type,
-                typename SourceType,
-                typename Allocator,
-                typename = std::enable_if_t< std::is_same< Allocator, Allocators::Cuda< Type > >::value >,
-                typename = void >
-      void load_impl( Type* buffer, std::streamsize elements );
-
-      // implementation for all allocators which allocate data accessible from host
-      template< typename Type,
-                typename TargetType,
-                typename Allocator,
-                typename = std::enable_if_t< ! std::is_same< Allocator, Allocators::Cuda< Type > >::value > >
-      void save_impl( const Type* buffer, std::streamsize elements );
-
-      // implementation for \ref Allocators::Cuda
-      template< typename Type,
-                typename TargetType,
-                typename Allocator,
-                typename = std::enable_if_t< std::is_same< Allocator, Allocators::Cuda< Type > >::value >,
-                typename = void >
-      void save_impl( const Type* buffer, std::streamsize elements );
-
-      std::fstream file;
-      String fileName;
+public:
+   /**
+    * \brief Basic constructor.
+    */
+   File() = default;
+
+   File( const File& ) = delete;
+
+   File( File&& ) = default;
+
+   File&
+   operator=( const File& ) = delete;
+
+   File&
+   operator=( File&& ) = default;
+
+   /**
+    * \brief Constructor which opens given file.
+    *
+    * All parameters are passed to the \ref open method.
+    */
+   File( const String& fileName, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out );
+
+   /**
+    * \brief Open given file.
+    *
+    * Opens file with given \e fileName in some \e mode from \ref std::ios_base::openmode.
+    * Note that the file is always opened in binary mode, i.e. \ref std::ios_base::binary
+    * is always added to \e mode.
+    *
+    * Throws \ref std::ios_base::failure on failure.
+    *
+    * \param fileName String which indicates file name.
+    * \param mode Indicates in what mode the file will be opened - see \ref std::ios_base::openmode.
+    */
+   void
+   open( const String& fileName, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out );
+
+   /**
+    * \brief Closes the file.
+    *
+    * Throws \ref std::ios_base::failure on failure.
+    */
+   void
+   close();
+
+   /**
+    * \brief Returns name of the file.
+    */
+   const String&
+   getFileName() const
+   {
+      return this->fileName;
+   }
+
+   /**
+    * \brief Method for loading data from the file.
+    *
+    * The data will be stored in \e buffer which was allocated using the
+    * allocator of type \e Allocator. The data type of the buffer is given
+    * by the template parameter \e Type. The second template parameter
+    * \e SourceType defines the type of data in the source file. If both
+    * types are different, on-the-fly conversion takes place during the
+    * data loading.
+    *
+    * Throws \ref std::ios_base::failure on failure.
+    *
+    * \tparam Type type of data to be loaded to the \e buffer.
+    * \tparam SourceType type of data stored on the file,
+    * \tparam Allocator type of the allocator which was used to allocate \e buffer.
+    * \param buffer Pointer in memory where the elements are loaded and stored after reading.
+    * \param elements number of elements to be loaded from the file.
+    *
+    * The following example shows how to load data directly to GPU.
+    *
+    * \par Example
+    * \include FileExampleCuda.cpp
+    * \par Output
+    * \include FileExampleCuda.out
+    * The following example shows how to do on-the-fly data conversion.
+    *
+    * \par Example
+    * \include FileExampleSaveAndLoad.cpp
+    * \par Output
+    * \include FileExampleSaveAndLoad.out
+    */
+   template< typename Type, typename SourceType = Type, typename Allocator = Allocators::Host< Type > >
+   void
+   load( Type* buffer, std::streamsize elements = 1 );
+
+   /**
+    * \brief Method for saving data to the file.
+    *
+    * The data from the \e buffer (with type \e Type) which was allocated
+    * using an allocator of type \e Allocator. \e TargetType defines as what
+    * data type the buffer shall be saved. If the type is different from the
+    * data type, on-the-fly data type conversion takes place during the data
+    * saving.
+    *
+    * Throws \ref std::ios_base::failure on failure.
+    *
+    * \tparam Type type of data in the \e buffer.
+    * \tparam TargetType tells as what type data the buffer shall be saved.
+    * \tparam Allocator type of the allocator which was used to allocate \e buffer.
+    * \tparam Index type of index by which the elements are indexed.
+    * \param buffer buffer that is going to be saved to the file.
+    * \param elements number of elements saved to the file.
+    *
+    * See \ref File::load for examples.
+    */
+   template< typename Type, typename TargetType = Type, typename Allocator = Allocators::Host< Type > >
+   void
+   save( const Type* buffer, std::streamsize elements = 1 );
+
+protected:
+   // implementation for all allocators which allocate data accessible from host
+   template< typename Type,
+             typename SourceType,
+             typename Allocator,
+             typename = std::enable_if_t< ! std::is_same< Allocator, Allocators::Cuda< Type > >::value > >
+   void
+   load_impl( Type* buffer, std::streamsize elements );
+
+   // implementation for \ref Allocators::Cuda
+   template< typename Type,
+             typename SourceType,
+             typename Allocator,
+             typename = std::enable_if_t< std::is_same< Allocator, Allocators::Cuda< Type > >::value >,
+             typename = void >
+   void
+   load_impl( Type* buffer, std::streamsize elements );
+
+   // implementation for all allocators which allocate data accessible from host
+   template< typename Type,
+             typename TargetType,
+             typename Allocator,
+             typename = std::enable_if_t< ! std::is_same< Allocator, Allocators::Cuda< Type > >::value > >
+   void
+   save_impl( const Type* buffer, std::streamsize elements );
+
+   // implementation for \ref Allocators::Cuda
+   template< typename Type,
+             typename TargetType,
+             typename Allocator,
+             typename = std::enable_if_t< std::is_same< Allocator, Allocators::Cuda< Type > >::value >,
+             typename = void >
+   void
+   save_impl( const Type* buffer, std::streamsize elements );
+
+   std::fstream file;
+   String fileName;
 };
 
 /**
@@ -177,18 +186,21 @@ class File
  * \param fileName Name of the file to check.
  * \return returns true if the file exists and false othervise
  */
-bool fileExists( const String& fileName );
+bool
+fileExists( const String& fileName );
 
 /**
  * \brief Serialization of strings
  */
-File& operator<<( File& file, const std::string& str );
+File&
+operator<<( File& file, const std::string& str );
 
 /**
  * \brief Deserialization of strings.
  */
-File& operator>>( File& file, std::string& str );
+File&
+operator>>( File& file, std::string& str );
 
-} // namespace TNL
+}  // namespace TNL
 
 #include <TNL/File.hpp>
diff --git a/src/TNL/File.hpp b/src/TNL/File.hpp
index 4432d77cddbb846a09a9d89144ea9c702c21e811..e21e8b34082c8634d6ee18c81c11b167ab627977 100644
--- a/src/TNL/File.hpp
+++ b/src/TNL/File.hpp
@@ -27,7 +27,8 @@ inline File::File( const String& fileName, std::ios_base::openmode mode )
    open( fileName, mode );
 }
 
-inline void File::open( const String& fileName, std::ios_base::openmode mode )
+inline void
+File::open( const String& fileName, std::ios_base::openmode mode )
 {
    // enable exceptions
    file.exceptions( std::fstream::failbit | std::fstream::badbit | std::fstream::eofbit );
@@ -35,17 +36,15 @@ inline void File::open( const String& fileName, std::ios_base::openmode mode )
    close();
 
    mode |= std::ios::binary;
-   try
-   {
+   try {
       file.open( fileName.getString(), mode );
    }
-   catch( std::ios_base::failure& )
-   {
+   catch( std::ios_base::failure& ) {
       std::stringstream msg;
-      msg <<  "Unable to open file " << fileName << " ";
-      if( mode & std::ios_base::in )
+      msg << "Unable to open file " << fileName << " ";
+      if( ( mode & std::ios_base::in ) != 0 )
          msg << " for reading.";
-      if( mode & std::ios_base::out )
+      if( ( mode & std::ios_base::out ) != 0 )
          msg << " for writing.";
 
       throw std::ios_base::failure( msg.str() );
@@ -54,18 +53,16 @@ inline void File::open( const String& fileName, std::ios_base::openmode mode )
    this->fileName = fileName;
 }
 
-inline void File::close()
+inline void
+File::close()
 {
-   if( file.is_open() )
-   {
-      try
-      {
+   if( file.is_open() ) {
+      try {
          file.close();
       }
-      catch( std::ios_base::failure& )
-      {
+      catch( std::ios_base::failure& ) {
          std::stringstream msg;
-         msg <<  "Unable to close file " << fileName << ".";
+         msg << "Unable to close file " << fileName << ".";
 
          throw std::ios_base::failure( msg.str() );
       }
@@ -74,10 +71,9 @@ inline void File::close()
    fileName = "";
 }
 
-template< typename Type,
-          typename SourceType,
-          typename Allocator >
-void File::load( Type* buffer, std::streamsize elements )
+template< typename Type, typename SourceType, typename Allocator >
+void
+File::load( Type* buffer, std::streamsize elements )
 {
    static_assert( std::is_same< Type, typename Allocator::value_type >::value,
                   "Allocator::value_type must be the same as Type." );
@@ -90,74 +86,63 @@ void File::load( Type* buffer, std::streamsize elements )
 }
 
 // Host allocators
-template< typename Type,
-          typename SourceType,
-          typename Allocator,
-          typename >
-void File::load_impl( Type* buffer, std::streamsize elements )
+template< typename Type, typename SourceType, typename Allocator, typename >
+void
+File::load_impl( Type* buffer, std::streamsize elements )
 {
    if( std::is_same< Type, SourceType >::value )
-      file.read( reinterpret_cast<char*>(buffer), sizeof(Type) * elements );
-   else
-   {
-      const std::streamsize cast_buffer_size = std::min( Cuda::getTransferBufferSize() / (std::streamsize) sizeof(SourceType), elements );
+      file.read( reinterpret_cast< char* >( buffer ), sizeof( Type ) * elements );
+   else {
+      const std::streamsize cast_buffer_size =
+         std::min( Cuda::getTransferBufferSize() / (std::streamsize) sizeof( SourceType ), elements );
       using BaseType = typename std::remove_cv< SourceType >::type;
       std::unique_ptr< BaseType[] > cast_buffer{ new BaseType[ cast_buffer_size ] };
       std::streamsize readElements = 0;
-      while( readElements < elements )
-      {
+      while( readElements < elements ) {
          const std::streamsize transfer = std::min( elements - readElements, cast_buffer_size );
-         file.read( reinterpret_cast<char*>(cast_buffer.get()), sizeof(SourceType) * transfer );
+         file.read( reinterpret_cast< char* >( cast_buffer.get() ), sizeof( SourceType ) * transfer );
          for( std::streamsize i = 0; i < transfer; i++ )
-            buffer[ readElements ++ ] = static_cast< Type >( cast_buffer[ i ] );
+            buffer[ readElements++ ] = static_cast< Type >( cast_buffer[ i ] );
          readElements += transfer;
       }
    }
 }
 
 // Allocators::Cuda
-template< typename Type,
-          typename SourceType,
-          typename Allocator,
-          typename, typename >
-void File::load_impl( Type* buffer, std::streamsize elements )
+template< typename Type, typename SourceType, typename Allocator, typename, typename >
+void
+File::load_impl( Type* buffer, std::streamsize elements )
 {
 #ifdef HAVE_CUDA
-   const std::streamsize host_buffer_size = std::min( Cuda::getTransferBufferSize() / (std::streamsize) sizeof(Type), elements );
+   const std::streamsize host_buffer_size =
+      std::min( Cuda::getTransferBufferSize() / (std::streamsize) sizeof( Type ), elements );
    using BaseType = typename std::remove_cv< Type >::type;
    std::unique_ptr< BaseType[] > host_buffer{ new BaseType[ host_buffer_size ] };
 
    std::streamsize readElements = 0;
-   if( std::is_same< Type, SourceType >::value )
-   {
-      while( readElements < elements )
-      {
+   if( std::is_same< Type, SourceType >::value ) {
+      while( readElements < elements ) {
          const std::streamsize transfer = std::min( elements - readElements, host_buffer_size );
-         file.read( reinterpret_cast<char*>(host_buffer.get()), sizeof(Type) * transfer );
-         cudaMemcpy( (void*) &buffer[ readElements ],
-                     (void*) host_buffer.get(),
-                     transfer * sizeof( Type ),
-                     cudaMemcpyHostToDevice );
+         file.read( reinterpret_cast< char* >( host_buffer.get() ), sizeof( Type ) * transfer );
+         cudaMemcpy(
+            (void*) &buffer[ readElements ], (void*) host_buffer.get(), transfer * sizeof( Type ), cudaMemcpyHostToDevice );
          TNL_CHECK_CUDA_DEVICE;
          readElements += transfer;
       }
    }
-   else
-   {
-      const std::streamsize cast_buffer_size = std::min( Cuda::getTransferBufferSize() / (std::streamsize) sizeof(SourceType), elements );
+   else {
+      const std::streamsize cast_buffer_size =
+         std::min( Cuda::getTransferBufferSize() / (std::streamsize) sizeof( SourceType ), elements );
       using BaseType = typename std::remove_cv< SourceType >::type;
       std::unique_ptr< BaseType[] > cast_buffer{ new BaseType[ cast_buffer_size ] };
 
-      while( readElements < elements )
-      {
+      while( readElements < elements ) {
          const std::streamsize transfer = std::min( elements - readElements, cast_buffer_size );
-         file.read( reinterpret_cast<char*>(cast_buffer.get()), sizeof(SourceType) * transfer );
+         file.read( reinterpret_cast< char* >( cast_buffer.get() ), sizeof( SourceType ) * transfer );
          for( std::streamsize i = 0; i < transfer; i++ )
             host_buffer[ i ] = static_cast< Type >( cast_buffer[ i ] );
-         cudaMemcpy( (void*) &buffer[ readElements ],
-                     (void*) host_buffer.get(),
-                     transfer * sizeof( Type ),
-                     cudaMemcpyHostToDevice );
+         cudaMemcpy(
+            (void*) &buffer[ readElements ], (void*) host_buffer.get(), transfer * sizeof( Type ), cudaMemcpyHostToDevice );
          TNL_CHECK_CUDA_DEVICE;
          readElements += transfer;
       }
@@ -167,10 +152,9 @@ void File::load_impl( Type* buffer, std::streamsize elements )
 #endif
 }
 
-template< typename Type,
-          typename TargetType,
-          typename Allocator >
-void File::save( const Type* buffer, std::streamsize elements )
+template< typename Type, typename TargetType, typename Allocator >
+void
+File::save( const Type* buffer, std::streamsize elements )
 {
    static_assert( std::is_same< std::remove_cv_t< Type >, std::remove_cv_t< typename Allocator::value_type > >::value,
                   "Allocator::value_type must be the same as Type." );
@@ -183,77 +167,65 @@ void File::save( const Type* buffer, std::streamsize elements )
 }
 
 // Host allocators
-template< typename Type,
-          typename TargetType,
-          typename Allocator,
-          typename >
-void File::save_impl( const Type* buffer, std::streamsize elements )
+template< typename Type, typename TargetType, typename Allocator, typename >
+void
+File::save_impl( const Type* buffer, std::streamsize elements )
 {
    if( std::is_same< Type, TargetType >::value )
-      file.write( reinterpret_cast<const char*>(buffer), sizeof(Type) * elements );
-   else
-   {
-      const std::streamsize cast_buffer_size = std::min( Cuda::getTransferBufferSize() / (std::streamsize) sizeof(TargetType), elements );
+      file.write( reinterpret_cast< const char* >( buffer ), sizeof( Type ) * elements );
+   else {
+      const std::streamsize cast_buffer_size =
+         std::min( Cuda::getTransferBufferSize() / (std::streamsize) sizeof( TargetType ), elements );
       using BaseType = typename std::remove_cv< TargetType >::type;
       std::unique_ptr< BaseType[] > cast_buffer{ new BaseType[ cast_buffer_size ] };
       std::streamsize writtenElements = 0;
-      while( writtenElements < elements )
-      {
+      while( writtenElements < elements ) {
          const std::streamsize transfer = std::min( elements - writtenElements, cast_buffer_size );
          for( std::streamsize i = 0; i < transfer; i++ )
-            cast_buffer[ i ] = static_cast< TargetType >( buffer[ writtenElements ++ ] );
-         file.write( reinterpret_cast<char*>(cast_buffer.get()), sizeof(TargetType) * transfer );
+            cast_buffer[ i ] = static_cast< TargetType >( buffer[ writtenElements++ ] );
+         file.write( reinterpret_cast< char* >( cast_buffer.get() ), sizeof( TargetType ) * transfer );
          writtenElements += transfer;
       }
-
    }
 }
 
 // Allocators::Cuda
-template< typename Type,
-          typename TargetType,
-          typename Allocator,
-          typename, typename >
-void File::save_impl( const Type* buffer, std::streamsize elements )
+template< typename Type, typename TargetType, typename Allocator, typename, typename >
+void
+File::save_impl( const Type* buffer, std::streamsize elements )
 {
 #ifdef HAVE_CUDA
-   const std::streamsize host_buffer_size = std::min( Cuda::getTransferBufferSize() / (std::streamsize) sizeof(Type), elements );
+   const std::streamsize host_buffer_size =
+      std::min( Cuda::getTransferBufferSize() / (std::streamsize) sizeof( Type ), elements );
    using BaseType = typename std::remove_cv< Type >::type;
    std::unique_ptr< BaseType[] > host_buffer{ new BaseType[ host_buffer_size ] };
 
    std::streamsize writtenElements = 0;
-   if( std::is_same< Type, TargetType >::value )
-   {
-      while( writtenElements < elements )
-      {
+   if( std::is_same< Type, TargetType >::value ) {
+      while( writtenElements < elements ) {
          const std::streamsize transfer = std::min( elements - writtenElements, host_buffer_size );
-         cudaMemcpy( (void*) host_buffer.get(),
-                     (void*) &buffer[ writtenElements ],
-                     transfer * sizeof(Type),
-                     cudaMemcpyDeviceToHost );
+         cudaMemcpy(
+            (void*) host_buffer.get(), (void*) &buffer[ writtenElements ], transfer * sizeof( Type ), cudaMemcpyDeviceToHost );
          TNL_CHECK_CUDA_DEVICE;
-         file.write( reinterpret_cast<const char*>(host_buffer.get()), sizeof(Type) * transfer );
+         file.write( reinterpret_cast< const char* >( host_buffer.get() ), sizeof( Type ) * transfer );
          writtenElements += transfer;
       }
    }
-   else
-   {
-      const std::streamsize cast_buffer_size = std::min( Cuda::getTransferBufferSize() / (std::streamsize) sizeof(TargetType), elements );
+   else {
+      const std::streamsize cast_buffer_size =
+         std::min( Cuda::getTransferBufferSize() / (std::streamsize) sizeof( TargetType ), elements );
       using BaseType = typename std::remove_cv< TargetType >::type;
       std::unique_ptr< BaseType[] > cast_buffer{ new BaseType[ cast_buffer_size ] };
 
-      while( writtenElements < elements )
-      {
+      while( writtenElements < elements ) {
          const std::streamsize transfer = std::min( elements - writtenElements, host_buffer_size );
-         cudaMemcpy( (void*) host_buffer.get(),
-                     (void*) &buffer[ writtenElements ],
-                     transfer * sizeof(Type),
-                     cudaMemcpyDeviceToHost );
+         cudaMemcpy(
+            (void*) host_buffer.get(), (void*) &buffer[ writtenElements ], transfer * sizeof( Type ), cudaMemcpyDeviceToHost );
          TNL_CHECK_CUDA_DEVICE;
          for( std::streamsize i = 0; i < transfer; i++ )
             cast_buffer[ i ] = static_cast< TargetType >( host_buffer[ i ] );
 
-         file.write( reinterpret_cast<const char*>(cast_buffer.get()), sizeof(TargetType) * transfer );
+         file.write( reinterpret_cast< const char* >( cast_buffer.get() ), sizeof( TargetType ) * transfer );
          writtenElements += transfer;
       }
    }
@@ -262,63 +234,56 @@ void File::save_impl( const Type* buffer, std::streamsize elements )
 #endif
 }
 
-inline bool fileExists( const String& fileName )
+inline bool
+fileExists( const String& fileName )
 {
    std::fstream file;
    file.open( fileName.getString(), std::ios::in );
    return ! file.fail();
 }
 
-
 // serialization of strings
-inline File& operator<<( File& file, const std::string& str )
+inline File&
+operator<<( File& file, const std::string& str )
 {
    const int len = str.size();
-   try
-   {
-       file.save( &len );
+   try {
+      file.save( &len );
    }
-   catch(...)
-   {
+   catch( ... ) {
       throw Exceptions::FileSerializationError( file.getFileName(), "unable to write string length." );
    }
-   try
-   {
+   try {
       file.save( str.c_str(), len );
    }
-   catch(...)
-   {
+   catch( ... ) {
       throw Exceptions::FileSerializationError( file.getFileName(), "unable to write a C-string." );
    }
    return file;
 }
 
 // deserialization of strings
-inline File& operator>>( File& file, std::string& str )
+inline File&
+operator>>( File& file, std::string& str )
 {
    int length;
-   try
-   {
+   try {
       file.load( &length );
    }
-   catch(...)
-   {
+   catch( ... ) {
       throw Exceptions::FileDeserializationError( file.getFileName(), "unable to read string length." );
    }
-   char buffer[ length ];
-   if( length )
-   {
-      try
-      {
+   if( length > 0 ) {
+      char buffer[ length ];
+      try {
          file.load( buffer, length );
       }
-      catch(...)
-      {
+      catch( ... ) {
          throw Exceptions::FileDeserializationError( file.getFileName(), "unable to read a C-string." );
       }
+      str.assign( buffer, length );
    }
-   str.assign( buffer, length );
    return file;
 }
 
-} // namespace TNL
+}  // namespace TNL
diff --git a/src/TNL/FileName.h b/src/TNL/FileName.h
index 2027d7cd2875171ffeeb1d7944c5b393d87be7ac..3bcd829d00ae9d97c761fe0f9dd8e5dc93d97fd6 100644
--- a/src/TNL/FileName.h
+++ b/src/TNL/FileName.h
@@ -14,9 +14,9 @@ namespace TNL {
  * \brief Helper class for the construction of file names based on name, index and extension.
  *
  * Optionally, the file name can also handle node ID for distributed systems.
- * 
+ *
  * The following example demonstrates the use of FileName.
- * 
+ *
  * \par Example
  * \include FileNameExample.cpp
  * \par Output
@@ -24,130 +24,138 @@ namespace TNL {
  */
 class FileName
 {
-   public:
-
-      /**
-       * \brief Basic constructor.
-       *
-       * Sets no file name base, index to zero and index digits count to five;
-       */
-      FileName();
-
-      /**
-       * \brief Constructor with file name base parameter.
-       * 
-       * The index is set to zero and index digits count to five.
-       * 
-       * @param fileNameBase File name base.
-       */
-      FileName( const String& fileNameBase );
-
-      /**
-       * \brief Constructor with file name base and file name extension.
-       * 
-       * The index is set to zero and index digits count to five.
-       * 
-       * @param fileNameBase File name base.
-       * @param extension File name extension.
-       */
-      FileName( const String& fileNameBase,
-                const String& extension );
-
-      /**
-       * \brief Sets the file name base.
-       *
-       * @param fileNameBase String that specifies the new file name base.
-       */
-      void setFileNameBase( const String& fileNameBase );
-
-      /**
-       *  \brief Sets the file name extension.
-       *
-       * @param extension A String that specifies the new extension of file without dot.
-       */
-      void setExtension( const String& extension );
-
-      /**
-       * \brief Sets index of the file name.
-       *
-       * @param index Index of the file name.
-       */
-      void setIndex( const size_t index );
-
-      /**
-       * \brief Sets number of digits for index of the file name.
-       *
-       * @param digitsCount Number of digits. It is 5 by default.
-       */
-      void setDigitsCount( const size_t digitsCount );
-
-      /**
-       * \brief Sets the distributed system node ID as integer, for example MPI process ID.
-       * 
-       * @param nodeId Node ID.
-       * 
-       * See the following example:
-       * 
-       * \par Example
-       * \include FileNameExampleDistributedSystemNodeId.cpp
-       * \par Output
-       * \include FileNameExampleDistributedSystemNodeId.out
-       */
-      void setDistributedSystemNodeId( size_t nodeId );
-
-      /**
-       * \brief Sets the distributed system node ID in a form of Cartesian coordinates.
-       * 
-       * @tparam Coordinates Type of Cartesian coordinates. It is Containers::StaticVector usually.
-       * @param nodeId Node ID in a form of Cartesian coordinates.
-       * 
-       * See the following example:
-       * 
-       * \par Example
-       * \include FileNameExampleDistributedSystemNodeCoordinates.cpp
-       * \par Output
-       * \include FileNameExampleDistributedSystemNodeCoordinates.out
-       * 
-       */
-      template< typename Coordinates >
-      void setDistributedSystemNodeCoordinates( const Coordinates& nodeId );
-
-      /**
-       * \brief Resets the distributed system node ID.
-       */
-      void resetDistributedSystemNodeId();
-
-      /**
-       * \brief Returns complete file name.
-       *
-       * @return String with the complete file name.
-       */
-      String getFileName();
-
-   protected:
-
-      String fileNameBase, extension, distributedSystemNodeId;
-
-      size_t index, digitsCount;
+public:
+   /**
+    * \brief Basic constructor.
+    *
+    * Sets no file name base, index to zero and index digits count to five;
+    */
+   FileName() = default;
+
+   /**
+    * \brief Constructor with file name base parameter.
+    *
+    * The index is set to zero and index digits count to five.
+    *
+    * @param fileNameBase File name base.
+    */
+   FileName( String fileNameBase );
+
+   /**
+    * \brief Constructor with file name base and file name extension.
+    *
+    * The index is set to zero and index digits count to five.
+    *
+    * @param fileNameBase File name base.
+    * @param extension File name extension.
+    */
+   FileName( String fileNameBase, String extension );
+
+   /**
+    * \brief Sets the file name base.
+    *
+    * @param fileNameBase String that specifies the new file name base.
+    */
+   void
+   setFileNameBase( const String& fileNameBase );
+
+   /**
+    *  \brief Sets the file name extension.
+    *
+    * @param extension A String that specifies the new extension of file without dot.
+    */
+   void
+   setExtension( const String& extension );
+
+   /**
+    * \brief Sets index of the file name.
+    *
+    * @param index Index of the file name.
+    */
+   void
+   setIndex( size_t index );
+
+   /**
+    * \brief Sets number of digits for index of the file name.
+    *
+    * @param digitsCount Number of digits. It is 5 by default.
+    */
+   void
+   setDigitsCount( size_t digitsCount );
+
+   /**
+    * \brief Sets the distributed system node ID as integer, for example MPI process ID.
+    *
+    * @param nodeId Node ID.
+    *
+    * See the following example:
+    *
+    * \par Example
+    * \include FileNameExampleDistributedSystemNodeId.cpp
+    * \par Output
+    * \include FileNameExampleDistributedSystemNodeId.out
+    */
+   void
+   setDistributedSystemNodeId( size_t nodeId );
+
+   /**
+    * \brief Sets the distributed system node ID in a form of Cartesian coordinates.
+    *
+    * @tparam Coordinates Type of Cartesian coordinates. It is Containers::StaticVector usually.
+    * @param nodeId Node ID in a form of Cartesian coordinates.
+    *
+    * See the following example:
+    *
+    * \par Example
+    * \include FileNameExampleDistributedSystemNodeCoordinates.cpp
+    * \par Output
+    * \include FileNameExampleDistributedSystemNodeCoordinates.out
+    *
+    */
+   template< typename Coordinates >
+   void
+   setDistributedSystemNodeCoordinates( const Coordinates& nodeId );
+
+   /**
+    * \brief Resets the distributed system node ID.
+    */
+   void
+   resetDistributedSystemNodeId();
+
+   /**
+    * \brief Returns complete file name.
+    *
+    * @return String with the complete file name.
+    */
+   String
+   getFileName();
+
+protected:
+   String fileNameBase, extension, distributedSystemNodeId;
+
+   std::size_t index = 0;
+   std::size_t digitsCount = 5;
 };
 
 /**
  * \brief Returns extension of given file name, i.e. part after the last dot.
- * 
+ *
  * @param fileName Input file name.
- * 
+ *
  * @return Extension of the given file name.
  */
-String getFileExtension( const String fileName );
+String
+getFileExtension( const String& fileName );
 
 /**
  * \brief Cuts off the file extension.
- * 
+ *
  * @param file_name Input file name.
  * @return String with the file name without extension.
  */
-String removeFileNameExtension( String fileName );
+String
+removeFileNameExtension( String fileName );
 
-} // namespace TNL
+}  // namespace TNL
 
 #include <TNL/FileName.hpp>
diff --git a/src/TNL/FileName.hpp b/src/TNL/FileName.hpp
index 5768565358aa612eede031a30111006809efac4d..e283bc8be5da800bdd3e02462edaa7dfacd7b0bb 100644
--- a/src/TNL/FileName.hpp
+++ b/src/TNL/FileName.hpp
@@ -8,6 +8,7 @@
 
 #include <sstream>
 #include <iomanip>
+#include <utility>
 
 #include <TNL/FileName.h>
 #include <TNL/String.h>
@@ -17,97 +18,89 @@
 
 namespace TNL {
 
-inline FileName::FileName()
-: index( 0 ), digitsCount( 5 )
-{
-}
+inline FileName::FileName( String fileNameBase ) : fileNameBase( std::move( fileNameBase ) ) {}
 
-inline FileName::FileName( const String& fileNameBase )
-: fileNameBase( fileNameBase ),
-  index( 0 ),
-  digitsCount( 5 )
-{
-}
-
-inline FileName::FileName( const String& fileNameBase,
-                           const String& extension )
-: fileNameBase( fileNameBase ),
-  extension( extension ),
-  index( 0 ),
-  digitsCount( 5 )
-{
-}
+inline FileName::FileName( String fileNameBase, String extension )
+: fileNameBase( std::move( fileNameBase ) ), extension( std::move( extension ) )
+{}
 
-inline void FileName::setFileNameBase( const String& fileNameBase )
+inline void
+FileName::setFileNameBase( const String& fileNameBase )
 {
    this->fileNameBase = fileNameBase;
 }
 
-inline void FileName::setExtension( const String& extension )
+inline void
+FileName::setExtension( const String& extension )
 {
    this->extension = extension;
 }
 
-inline void FileName::setIndex( const size_t index )
+inline void
+FileName::setIndex( size_t index )
 {
    this->index = index;
 }
 
-inline void FileName::setDigitsCount( const size_t digitsCount )
+inline void
+FileName::setDigitsCount( size_t digitsCount )
 {
    this->digitsCount = digitsCount;
 }
 
-inline void FileName::setDistributedSystemNodeId( size_t nodeId )
+inline void
+FileName::setDistributedSystemNodeId( size_t nodeId )
 {
    this->distributedSystemNodeId = "-@";
    this->distributedSystemNodeId += convertToString( nodeId );
 }
 
 template< typename Coordinates >
-void FileName::setDistributedSystemNodeCoordinates( const Coordinates& nodeId )
+void
+FileName::setDistributedSystemNodeCoordinates( const Coordinates& nodeId )
 {
    this->distributedSystemNodeId = "-@";
    this->distributedSystemNodeId += convertToString( nodeId[ 0 ] );
-   for( int i = 1; i < nodeId.getSize(); i++ )
-   {
+   for( int i = 1; i < nodeId.getSize(); i++ ) {
       this->distributedSystemNodeId += "-";
       this->distributedSystemNodeId += convertToString( nodeId[ i ] );
    }
 }
 
-inline void FileName::resetDistributedSystemNodeId()
+inline void
+FileName::resetDistributedSystemNodeId()
 {
    this->distributedSystemNodeId = "";
 }
 
-inline String FileName::getFileName()
+inline String
+FileName::getFileName()
 {
    std::stringstream stream;
-   stream << this->fileNameBase
-          << std::setw( this->digitsCount )
-          << std::setfill( '0' )
-          << this->index
-          << this->distributedSystemNodeId
-          << "." << this->extension;
-   return String( stream.str().data() );
+   stream << this->fileNameBase << std::setw( this->digitsCount ) << std::setfill( '0' ) << this->index
+          << this->distributedSystemNodeId << "." << this->extension;
+   return stream.str();
 }
 
-inline String getFileExtension( const String fileName )
+inline String
+getFileExtension( const String& fileName )
 {
    const int size = fileName.getLength();
    int i = 1;
-   while( fileName[ size - i ] != '.' && i < size ) i++;
+   while( fileName[ size - i ] != '.' && i < size )
+      i++;
    return fileName.substr( size - i + 1 );
 }
 
-inline String removeFileNameExtension( String fileName )
+inline String
+removeFileNameExtension( String fileName )
 {
    const int size = fileName.getLength();
    int i = 1;
-   while( fileName[ size - i ] != '.' && size > i ) i++;
+   while( fileName[ size - i ] != '.' && size > i )
+      i++;
    fileName = fileName.substr( 0, size - i );
    return fileName;
 }
 
-} // namespace TNL
+}  // namespace TNL
diff --git a/src/TNL/Functional.h b/src/TNL/Functional.h
index 926ec7c7ee465c69df53f739cbe57662ffbe4522..1f22f36f5690396ccf53749e4583fea890fb6e75 100644
--- a/src/TNL/Functional.h
+++ b/src/TNL/Functional.h
@@ -24,7 +24,11 @@ struct Plus : public std::plus< void >
     * Suitable for \ref TNL::Algorithms::reduce.
     */
    template< typename T >
-   static constexpr T getIdentity() { return 0; }
+   static constexpr T
+   getIdentity()
+   {
+      return 0;
+   }
 };
 
 /**
@@ -43,7 +47,11 @@ struct Multiplies : public std::multiplies< void >
     * Suitable for \ref TNL::Algorithms::reduce.
     */
    template< typename T >
-   static constexpr T getIdentity() { return 1; }
+   static constexpr T
+   getIdentity()
+   {
+      return 1;
+   }
 };
 
 /**
@@ -62,7 +70,8 @@ using Modulus = std::modulus< void >;
 struct UnaryPlus
 {
    template< typename T >
-   constexpr auto operator()( const T& x ) const -> decltype( +x )
+   constexpr auto
+   operator()( const T& x ) const -> decltype( +x )
    {
       return +x;
    }
@@ -84,7 +93,8 @@ struct LogicalAnd : public std::logical_and< void >
     * Suitable for \ref TNL::Algorithms::reduce.
     */
    template< typename T >
-   static constexpr T getIdentity()
+   static constexpr T
+   getIdentity()
    {
       static_assert( std::numeric_limits< T >::is_specialized,
                      "std::numeric_limits is not specialized for the requested type" );
@@ -103,7 +113,11 @@ struct LogicalOr : public std::logical_or< void >
     * Suitable for \ref TNL::Algorithms::reduce.
     */
    template< typename T >
-   static constexpr T getIdentity() { return 0; }
+   static constexpr T
+   getIdentity()
+   {
+      return 0;
+   }
 };
 
 /**
@@ -122,7 +136,11 @@ struct BitAnd : public std::bit_and< void >
     * Suitable for \ref TNL::Algorithms::reduce.
     */
    template< typename T >
-   static constexpr T getIdentity() { return ~static_cast< T >( 0 ); }
+   static constexpr T
+   getIdentity()
+   {
+      return ~static_cast< T >( 0 );
+   }
 };
 
 /**
@@ -136,7 +154,11 @@ struct BitOr : public std::bit_or< void >
     * Suitable for \ref TNL::Algorithms::reduce.
     */
    template< typename T >
-   static constexpr T getIdentity() { return 0; }
+   static constexpr T
+   getIdentity()
+   {
+      return 0;
+   }
 };
 
 /**
@@ -150,7 +172,11 @@ struct BitXor : public std::bit_xor< void >
     * Suitable for \ref TNL::Algorithms::reduce.
     */
    template< typename T >
-   static constexpr T getIdentity() { return 0; }
+   static constexpr T
+   getIdentity()
+   {
+      return 0;
+   }
 };
 
 /**
@@ -169,7 +195,8 @@ struct Min
     * Suitable for \ref TNL::Algorithms::reduce.
     */
    template< typename T >
-   static constexpr T getIdentity()
+   static constexpr T
+   getIdentity()
    {
       static_assert( std::numeric_limits< T >::is_specialized,
                      "std::numeric_limits is not specialized for the requested type" );
@@ -177,7 +204,8 @@ struct Min
    }
 
    template< typename T1, typename T2 >
-   constexpr auto operator()( const T1& lhs, const T2& rhs ) const
+   constexpr auto
+   operator()( const T1& lhs, const T2& rhs ) const
    {
       // use argument-dependent lookup and make TNL::min available for unqualified calls
       using TNL::min;
@@ -196,7 +224,8 @@ struct Max
     * Suitable for \ref TNL::Algorithms::reduce.
     */
    template< typename T >
-   static constexpr T getIdentity()
+   static constexpr T
+   getIdentity()
    {
       static_assert( std::numeric_limits< T >::is_specialized,
                      "std::numeric_limits is not specialized for the requested type" );
@@ -204,7 +233,8 @@ struct Max
    }
 
    template< typename T1, typename T2 >
-   constexpr auto operator()( const T1& lhs, const T2& rhs ) const
+   constexpr auto
+   operator()( const T1& lhs, const T2& rhs ) const
    {
       // use argument-dependent lookup and make TNL::max available for unqualified calls
       using TNL::max;
@@ -223,7 +253,8 @@ struct MinWithArg
     * Suitable for \ref TNL::Algorithms::reduce.
     */
    template< typename T >
-   static constexpr T getIdentity()
+   static constexpr T
+   getIdentity()
    {
       static_assert( std::numeric_limits< T >::is_specialized,
                      "std::numeric_limits is not specialized for the requested type" );
@@ -231,15 +262,14 @@ struct MinWithArg
    }
 
    template< typename Value, typename Index >
-   constexpr void operator()( Value& lhs, const Value& rhs, Index& lhsIdx, const Index& rhsIdx ) const
+   constexpr void
+   operator()( Value& lhs, const Value& rhs, Index& lhsIdx, const Index& rhsIdx ) const
    {
-      if( lhs > rhs )
-      {
+      if( lhs > rhs ) {
          lhs = rhs;
          lhsIdx = rhsIdx;
       }
-      else if( lhs == rhs && rhsIdx < lhsIdx )
-      {
+      else if( lhs == rhs && rhsIdx < lhsIdx ) {
          lhsIdx = rhsIdx;
       }
    }
@@ -256,7 +286,8 @@ struct MaxWithArg
     * Suitable for \ref TNL::Algorithms::reduce.
     */
    template< typename T >
-   static constexpr T getIdentity()
+   static constexpr T
+   getIdentity()
    {
       static_assert( std::numeric_limits< T >::is_specialized,
                      "std::numeric_limits is not specialized for the requested type" );
@@ -264,41 +295,42 @@ struct MaxWithArg
    }
 
    template< typename Value, typename Index >
-   constexpr void operator()( Value& lhs, const Value& rhs, Index& lhsIdx, const Index& rhsIdx ) const
+   constexpr void
+   operator()( Value& lhs, const Value& rhs, Index& lhsIdx, const Index& rhsIdx ) const
    {
-      if( lhs < rhs )
-      {
+      if( lhs < rhs ) {
          lhs = rhs;
          lhsIdx = rhsIdx;
       }
-      else if( lhs == rhs && rhsIdx < lhsIdx )
-      {
+      else if( lhs == rhs && rhsIdx < lhsIdx ) {
          lhsIdx = rhsIdx;
       }
    }
 };
 
-#define TNL_MAKE_UNARY_FUNCTIONAL(name, function)                       \
-   struct name                                                          \
-   {                                                                    \
-      template< typename T >                                            \
-      __cuda_callable__                                                 \
-      auto operator()( const T& x ) const -> decltype( function( x ) )  \
-      {                                                                 \
-         return function( x );                                          \
-      }                                                                 \
-   };                                                                   \
-
-#define TNL_MAKE_BINARY_FUNCTIONAL(name, function)                                  \
-   struct name                                                                      \
-   {                                                                                \
-      template< typename T1, typename T2 >                                          \
-      __cuda_callable__                                                             \
-      auto operator()( const T1& x, const T2& y ) const -> decltype( pow( x, y ) )  \
-      {                                                                             \
-         return pow( x, y );                                                        \
-      }                                                                             \
-   };                                                                               \
+#define TNL_MAKE_UNARY_FUNCTIONAL( name, function )               \
+   struct name                                                    \
+   {                                                              \
+      template< typename T >                                      \
+      __cuda_callable__                                           \
+      auto                                                        \
+      operator()( const T& x ) const -> decltype( function( x ) ) \
+      {                                                           \
+         return function( x );                                    \
+      }                                                           \
+   };
+
+#define TNL_MAKE_BINARY_FUNCTIONAL( name, function )                          \
+   struct name                                                                \
+   {                                                                          \
+      template< typename T1, typename T2 >                                    \
+      __cuda_callable__                                                       \
+      auto                                                                    \
+      operator()( const T1& x, const T2& y ) const -> decltype( pow( x, y ) ) \
+      {                                                                       \
+         return pow( x, y );                                                  \
+      }                                                                       \
+   };
 
 TNL_MAKE_UNARY_FUNCTIONAL( Abs, abs )
 TNL_MAKE_UNARY_FUNCTIONAL( Exp, exp )
@@ -335,11 +367,12 @@ struct Cast
    {
       template< typename T >
       __cuda_callable__
-      auto operator()( const T& a ) const -> ResultType
+      auto
+      operator()( const T& a ) const -> ResultType
       {
-         return static_cast<ResultType>( a );
+         return static_cast< ResultType >( a );
       }
    };
 };
 
-} // namespace TNL
+}  // namespace TNL
diff --git a/src/TNL/Functions/Analytic/Blob.h b/src/TNL/Functions/Analytic/Blob.h
index f1e101e8b3e20ca3e257202b3d8195f99597e7c6..0978e8636cc924c075dd4b5041909dc96fbf5f6b 100644
--- a/src/TNL/Functions/Analytic/Blob.h
+++ b/src/TNL/Functions/Analytic/Blob.h
@@ -14,110 +14,103 @@
 namespace TNL {
 namespace Functions {
 namespace Analytic {
-   
-template< typename Real,
-          int Dimension >
+
+template< typename Real, int Dimension >
 class BlobBase : public Domain< Dimension, SpaceDomain >
 {
-   public:
-
-      typedef Real RealType;
-
-      bool setup( const Config::ParameterContainer& parameters,
-                 const String& prefix = "" );
+public:
+   using RealType = Real;
 
-     protected:
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-      RealType height;
+protected:
+   RealType height;
 };
 
-template< int Dimension,
-          typename Real >
+template< int Dimension, typename Real >
 class Blob
-{
-};
+{};
 
 template< typename Real >
 class Blob< 1, Real > : public BlobBase< Real, 1 >
 {
-   public:
-
-      enum { Dimension = 1 };
-      typedef Real RealType;
-      typedef Containers::StaticVector< Dimension, Real > PointType;
-
-      Blob();
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                                     const Real& time = 0.0 ) const;
- 
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
+public:
+   enum
+   {
+      Dimension = 1
+   };
+   using RealType = Real;
+   using PointType = Containers::StaticVector< Dimension, Real >;
+
+   Blob();
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
 class Blob< 2, Real > : public BlobBase< Real, 2 >
 {
-   public:
-
-      enum { Dimension = 2 };
-      typedef Real RealType;
-      typedef Containers::StaticVector< Dimension, Real > PointType;
-
-      Blob();
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                                     const Real& time = 0.0 ) const;
-
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
- 
+public:
+   enum
+   {
+      Dimension = 2
+   };
+   using RealType = Real;
+   using PointType = Containers::StaticVector< Dimension, Real >;
+
+   Blob();
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
 class Blob< 3, Real > : public BlobBase< Real, 3 >
 {
-   public:
-
-      enum { Dimension = 3 };
-      typedef Real RealType;
-      typedef Containers::StaticVector< Dimension, Real > PointType;
-
-      Blob();
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                                     const Real& time = 0.0 ) const;
- 
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
+public:
+   enum
+   {
+      Dimension = 3
+   };
+   using RealType = Real;
+   using PointType = Containers::StaticVector< Dimension, Real >;
+
+   Blob();
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
-template< int Dimension,
-          typename Real >
-std::ostream& operator << ( std::ostream& str, const Blob< Dimension, Real >& f )
+template< int Dimension, typename Real >
+std::ostream&
+operator<<( std::ostream& str, const Blob< Dimension, Real >& f )
 {
    str << "Level-set pseudo square function.";
    return str;
 }
 
-} // namespace Analytic
-} // namespace Functions
-} // namepsace TNL
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
 
 #include <TNL/Functions/Analytic/Blob_impl.h>
-
diff --git a/src/TNL/Functions/Analytic/Blob_impl.h b/src/TNL/Functions/Analytic/Blob_impl.h
index a1f84cbf7eb76843556ab72af9fb698ffb61fda4..b74249b7b5bd8c105ef53c14d63cde5d63a82af9 100644
--- a/src/TNL/Functions/Analytic/Blob_impl.h
+++ b/src/TNL/Functions/Analytic/Blob_impl.h
@@ -12,15 +12,12 @@ namespace TNL {
 namespace Functions {
 namespace Analytic {
 
-template< typename Real,
-          int Dimension >
+template< typename Real, int Dimension >
 bool
-BlobBase< Real, Dimension >::
-setup( const Config::ParameterContainer& parameters,
-       const String& prefix )
+BlobBase< Real, Dimension >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    this->height = parameters.getParameter< double >( prefix + "height" );
- 
+
    return true;
 }
 
@@ -29,21 +26,15 @@ setup( const Config::ParameterContainer& parameters,
  */
 
 template< typename Real >
-Blob< 1, Real >::Blob()
-{
-}
+Blob< 1, Real >::Blob() = default;
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-Blob< 1, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+Blob< 1, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
-   //const RealType& x = v.x();
+   // const RealType& x = v.x();
    if( YDiffOrder != 0 || ZDiffOrder != 0 )
       return 0.0;
    if( XDiffOrder == 0 )
@@ -54,9 +45,7 @@ getPartialDerivative( const PointType& v,
 template< typename Real >
 __cuda_callable__
 Real
-Blob< 1, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+Blob< 1, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
@@ -65,19 +54,13 @@ operator()( const PointType& v,
  * 2D
  */
 template< typename Real >
-Blob< 2, Real >::Blob()
-{
-}
+Blob< 2, Real >::Blob() = default;
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-Blob< 2, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+Blob< 2, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
    const RealType& x = v.x();
    const RealType& y = v.y();
@@ -91,9 +74,7 @@ getPartialDerivative( const PointType& v,
 template< typename Real >
 __cuda_callable__
 Real
-Blob< 2, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+Blob< 2, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
@@ -102,23 +83,17 @@ operator()( const PointType& v,
  * 3D
  */
 template< typename Real >
-Blob< 3, Real >::Blob()
-{
-}
+Blob< 3, Real >::Blob() = default;
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-Blob< 3, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+Blob< 3, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
-   //const RealType& x = v.x();
-   //const RealType& y = v.y();
-   //const RealType& z = v.z();
+   // const RealType& x = v.x();
+   // const RealType& y = v.y();
+   // const RealType& z = v.z();
    if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 )
       return 0.0;
    return 0.0;
@@ -127,13 +102,11 @@ getPartialDerivative( const PointType& v,
 template< typename Real >
 __cuda_callable__
 Real
-Blob< 3, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+Blob< 3, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-} // namespace Analytic
-} // namespace Functions
-} // namepsace TNL
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/Analytic/Constant.h b/src/TNL/Functions/Analytic/Constant.h
index b8657bf05778b1669df7fa6a46730802c3f351d0..c0df590e14c85e5493d63fdfb18457feb5551ae3 100644
--- a/src/TNL/Functions/Analytic/Constant.h
+++ b/src/TNL/Functions/Analytic/Constant.h
@@ -4,7 +4,7 @@
 //
 // SPDX-License-Identifier: MIT
 
-#pragma once 
+#pragma once
 
 #include <iostream>
 #include <TNL/Containers/StaticVector.h>
@@ -12,66 +12,63 @@
 
 namespace TNL {
 namespace Functions {
-namespace Analytic {   
+namespace Analytic {
 
-template< int dimensions,
-          typename Real = double >
+template< int dimensions, typename Real = double >
 class Constant : public Domain< dimensions, NonspaceDomain >
 {
-   public:
- 
-      typedef Real RealType;
-      typedef Containers::StaticVector< dimensions, RealType > PointType;
- 
-      __cuda_callable__
-      Constant();
-
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" );
-
-      bool setup( const Config::ParameterContainer& parameters,
-                 const String& prefix = "" );
-
-      void setConstant( const RealType& constant );
-
-      const RealType& getConstant() const;
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__ inline
-      RealType getPartialDerivative( const PointType& v,
-                                     const Real& time = 0.0 ) const;
-
-      __cuda_callable__ inline
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const
-      {
-         return constant;
-      }
- 
-       __cuda_callable__ inline
-      RealType getValue( const Real& time = 0.0 ) const
-      {
-          return constant;
-      }
-
-   protected:
-
-      RealType constant;
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< dimensions, RealType >;
+
+   __cuda_callable__
+   Constant();
+
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" );
+
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
+
+   void
+   setConstant( const RealType& constant );
+
+   const RealType&
+   getConstant() const;
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   inline RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   inline RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const
+   {
+      return constant;
+   }
+
+   __cuda_callable__
+   inline RealType
+   getValue( const Real& time = 0.0 ) const
+   {
+      return constant;
+   }
+
+protected:
+   RealType constant;
 };
 
-template< int dimensions,
-          typename Real >
-std::ostream& operator << ( std::ostream& str, const Constant< dimensions, Real >& f )
+template< int dimensions, typename Real >
+std::ostream&
+operator<<( std::ostream& str, const Constant< dimensions, Real >& f )
 {
    str << "Constant function: constant = " << f.getConstant();
    return str;
 }
 
-} // namespace Analytic
-} // namespace Functions
-} // namespace TNL
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
 
 #include <TNL/Functions/Analytic/Constant_impl.h>
-
diff --git a/src/TNL/Functions/Analytic/Constant_impl.h b/src/TNL/Functions/Analytic/Constant_impl.h
index 1ae19dc25f95b0df6f14b57529f07ef916ce45b7..4fbd2e176f363b374b64abebd782933c7ee36d89 100644
--- a/src/TNL/Functions/Analytic/Constant_impl.h
+++ b/src/TNL/Functions/Analytic/Constant_impl.h
@@ -8,72 +8,52 @@
 
 namespace TNL {
 namespace Functions {
-namespace Analytic {   
+namespace Analytic {
 
-template< int Dimension,
-          typename Real >
+template< int Dimension, typename Real >
 __cuda_callable__
-Constant< Dimension, Real >::
-Constant()
-: constant( 0.0 )
-{
-}
+Constant< Dimension, Real >::Constant() : constant( 0.0 ) {}
 
-template< int Dimension,
-          typename Real >
+template< int Dimension, typename Real >
 void
-Constant< Dimension, Real >::
-setConstant( const RealType& constant )
+Constant< Dimension, Real >::setConstant( const RealType& constant )
 {
    this->constant = constant;
 }
 
-template< int Dimension,
-          typename Real >
+template< int Dimension, typename Real >
 const Real&
-Constant< Dimension, Real >::
-getConstant() const
+Constant< Dimension, Real >::getConstant() const
 {
    return this->constant;
 }
 
-template< int FunctionDimension,
-          typename Real >
+template< int FunctionDimension, typename Real >
 void
-Constant< FunctionDimension, Real >::
-configSetup( Config::ConfigDescription& config,
-             const String& prefix )
+Constant< FunctionDimension, Real >::configSetup( Config::ConfigDescription& config, const String& prefix )
 {
-   config.addEntry     < double >( prefix + "constant", "Value of the constant function.", 0.0 );
+   config.addEntry< double >( prefix + "constant", "Value of the constant function.", 0.0 );
 }
 
-template< int Dimension,
-          typename Real >
+template< int Dimension, typename Real >
 bool
-Constant< Dimension, Real >::
-setup( const Config::ParameterContainer& parameters,
-       const String& prefix )
+Constant< Dimension, Real >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
-   this->setConstant( parameters.getParameter< double >( prefix + "constant") );
+   this->setConstant( parameters.getParameter< double >( prefix + "constant" ) );
    return true;
 }
 
-template< int Dimension,
-          typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder >
+template< int Dimension, typename Real >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-Constant< Dimension, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+Constant< Dimension, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
    if( XDiffOrder || YDiffOrder || ZDiffOrder )
       return 0.0;
    return constant;
 }
 
-} // namespace Analytic
-} // namespace Functions
-} // namespace TNL
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/Analytic/Cylinder.h b/src/TNL/Functions/Analytic/Cylinder.h
index 66d32830780bcdbdfb1dcb3d92aabb80fd78a159..0f74917127b006b968e43e291e83fdadd058cbc1 100644
--- a/src/TNL/Functions/Analytic/Cylinder.h
+++ b/src/TNL/Functions/Analytic/Cylinder.h
@@ -13,120 +13,110 @@
 
 namespace TNL {
 namespace Functions {
-namespace Analytic {   
+namespace Analytic {
 
-template< typename Real,
-          int Dimension >
+template< typename Real, int Dimension >
 class CylinderBase : public Domain< Dimension, SpaceDomain >
 {
-   public:
+public:
+   using RealType = Real;
 
-      typedef Real RealType;
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-      bool setup( const Config::ParameterContainer& parameters,
-                 const String& prefix = "" );
+   void
+   setDiameter( const RealType& sigma );
 
-      void setDiameter( const RealType& sigma );
+   const RealType&
+   getDiameter() const;
 
-      const RealType& getDiameter() const;
-
-   protected:
-
-      RealType diameter;
+protected:
+   RealType diameter;
 };
 
-template< int Dimension,
-          typename Real >
+template< int Dimension, typename Real >
 class Cylinder
-{
-};
+{};
 
 template< typename Real >
 class Cylinder< 1, Real > : public CylinderBase< Real, 1 >
 {
-   public:
-
-      enum { Dimension = 1 };
-      typedef Real RealType;
-      typedef Containers::StaticVector< Dimension, Real > PointType;
-
-      Cylinder();
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0,
-                typename Point = PointType >
-      __cuda_callable__
-      RealType getPartialDerivative( const Point& v,
-                                     const Real& time = 0.0 ) const;
-
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
- 
+public:
+   enum
+   {
+      Dimension = 1
+   };
+   using RealType = Real;
+   using PointType = Containers::StaticVector< Dimension, Real >;
+
+   Cylinder();
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Point = PointType >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const Point& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
 class Cylinder< 2, Real > : public CylinderBase< Real, 2 >
 {
-   public:
-
-      enum { Dimension = 2 };
-      typedef Real RealType;
-      typedef Containers::StaticVector< Dimension, Real > PointType;
-
-      Cylinder();
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0,
-                typename Point = PointType >
-      __cuda_callable__
-      RealType getPartialDerivative( const Point& v,
-                                     const Real& time = 0.0 ) const;
- 
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
- 
+public:
+   enum
+   {
+      Dimension = 2
+   };
+   using RealType = Real;
+   using PointType = Containers::StaticVector< Dimension, Real >;
+
+   Cylinder();
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Point = PointType >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const Point& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
 class Cylinder< 3, Real > : public CylinderBase< Real, 3 >
 {
-   public:
-
-      enum { Dimension = 3 };
-      typedef Real RealType;
-      typedef Containers::StaticVector< Dimension, Real > PointType;
-
-      Cylinder();
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0,
-                typename Point = PointType >
-      __cuda_callable__
-      RealType getPartialDerivative( const Point& v,
-                                     const Real& time = 0.0 ) const;
- 
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
- 
+public:
+   enum
+   {
+      Dimension = 3
+   };
+   using RealType = Real;
+   using PointType = Containers::StaticVector< Dimension, Real >;
+
+   Cylinder();
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Point = PointType >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const Point& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
-template< int Dimension,
-          typename Real >
-std::ostream& operator << ( std::ostream& str, const Cylinder< Dimension, Real >& f )
+template< int Dimension, typename Real >
+std::ostream&
+operator<<( std::ostream& str, const Cylinder< Dimension, Real >& f )
 {
    str << "Cylinder function.";
    return str;
 }
 
-} // namespace Analytic
-} // namespace Functions
-} // namespace TNL
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
 
 #include <TNL/Functions/Analytic/Cylinder_impl.h>
-
diff --git a/src/TNL/Functions/Analytic/Cylinder_impl.h b/src/TNL/Functions/Analytic/Cylinder_impl.h
index cfa7e66ae6f926665f211f39e1a94f079d0a98f4..6118b7d2de4e0d9a18dabeedd1edeaf16d783524 100644
--- a/src/TNL/Functions/Analytic/Cylinder_impl.h
+++ b/src/TNL/Functions/Analytic/Cylinder_impl.h
@@ -10,31 +10,26 @@
 
 namespace TNL {
 namespace Functions {
-namespace Analytic {   
+namespace Analytic {
 
-template< typename Real,
-          int Dimension >
+template< typename Real, int Dimension >
 bool
-CylinderBase< Real, Dimension >::
-setup( const Config::ParameterContainer& parameters,
-       const String& prefix )
+CylinderBase< Real, Dimension >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    this->diameter = parameters.getParameter< double >( prefix + "diameter" );
    return true;
 }
 
-template< typename Real,
-          int Dimension >
+template< typename Real, int Dimension >
 void
-CylinderBase< Real, Dimension >::
-setDiameter( const Real& sigma )
+CylinderBase< Real, Dimension >::setDiameter( const Real& sigma )
 {
    this->diameter = diameter;
 }
 
-template< typename Real,
-          int Dimension >
-const Real& CylinderBase< Real, Dimension >::getDiameter() const
+template< typename Real, int Dimension >
+const Real&
+CylinderBase< Real, Dimension >::getDiameter() const
 {
    return this->diameter;
 }
@@ -44,34 +39,26 @@ const Real& CylinderBase< Real, Dimension >::getDiameter() const
  */
 
 template< typename Real >
-Cylinder< 1, Real >::Cylinder()
-{
-}
+Cylinder< 1, Real >::Cylinder() = default;
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder,
-             typename Point >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, typename Point >
 __cuda_callable__
 Real
-Cylinder< 1, Real >::getPartialDerivative( const Point& v,
-                                                      const Real& time ) const
+Cylinder< 1, Real >::getPartialDerivative( const Point& v, const Real& time ) const
 {
    const RealType& x = v.x();
    if( YDiffOrder != 0 || ZDiffOrder != 0 )
       return 0.0;
    if( XDiffOrder == 0 )
-      return ( ( x*x - this->diameter ) < 0 ) - ( ( x*x - this->diameter ) > 0 ) + 1;
+      return ( ( x * x - this->diameter ) < 0 ) - ( ( x * x - this->diameter ) > 0 ) + 1;
    return 0.0;
 }
 
 template< typename Real >
 __cuda_callable__
 Real
-Cylinder< 1, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+Cylinder< 1, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
@@ -81,78 +68,59 @@ operator()( const PointType& v,
  */
 
 template< typename Real >
-Cylinder< 2, Real >::Cylinder()
-{
-}
+Cylinder< 2, Real >::Cylinder() = default;
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder,
-             typename Point >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, typename Point >
 __cuda_callable__
 Real
-Cylinder< 2, Real >::
-getPartialDerivative( const Point& v,
-                      const Real& time ) const
+Cylinder< 2, Real >::getPartialDerivative( const Point& v, const Real& time ) const
 {
    const RealType& x = v.x();
    const RealType& y = v.y();
    if( ZDiffOrder != 0 )
       return 0.0;
    if( XDiffOrder == 0 && YDiffOrder == 0 )
-      return ( ( x*x + y*y - this->diameter ) < 0 ) - ( ( x*x + y*y - this->diameter ) > 0 ) + 1;
+      return ( ( x * x + y * y - this->diameter ) < 0 ) - ( ( x * x + y * y - this->diameter ) > 0 ) + 1;
    return 0.0;
 }
 
 template< typename Real >
 __cuda_callable__
 Real
-Cylinder< 2, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+Cylinder< 2, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-
 /****
  * 3D
  */
 template< typename Real >
-Cylinder< 3, Real >::Cylinder()
-{
-}
+Cylinder< 3, Real >::Cylinder() = default;
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder,
-             typename Point >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, typename Point >
 __cuda_callable__
 Real
-Cylinder< 3, Real >::
-getPartialDerivative( const Point& v,
-                      const Real& time ) const
+Cylinder< 3, Real >::getPartialDerivative( const Point& v, const Real& time ) const
 {
    const RealType& x = v.x();
    const RealType& y = v.y();
    const RealType& z = v.z();
    if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 )
-      return ( ( x*x + y*y + z*z - this->diameter ) < 0 ) - ( ( x*x + y*y + z*z - this->diameter ) > 0 ) + 1;
+      return ( ( x * x + y * y + z * z - this->diameter ) < 0 ) - ( ( x * x + y * y + z * z - this->diameter ) > 0 ) + 1;
    return 0.0;
 }
 
 template< typename Real >
 __cuda_callable__
 Real
-Cylinder< 3, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+Cylinder< 3, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-} // namespace Analytic
-} // namespace Functions
-} // namespace TNL
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/Analytic/ExpBump.h b/src/TNL/Functions/Analytic/ExpBump.h
index 96c0004c1a98dac7fc050cb102f9c004fcb623f7..e7fcaa89f442fe04928a1fa71e961c1baab30a44 100644
--- a/src/TNL/Functions/Analytic/ExpBump.h
+++ b/src/TNL/Functions/Analytic/ExpBump.h
@@ -4,7 +4,7 @@
 //
 // SPDX-License-Identifier: MIT
 
-#pragma once 
+#pragma once
 
 #include <TNL/Config/ParameterContainer.h>
 #include <TNL/Containers/StaticVector.h>
@@ -12,119 +12,106 @@
 
 namespace TNL {
 namespace Functions {
-namespace Analytic {   
+namespace Analytic {
 
-template< int dimensions,
-          typename Real >
+template< int dimensions, typename Real >
 class ExpBumpBase : public Domain< dimensions, SpaceDomain >
 {
-   public:
- 
-      typedef Real RealType;
- 
-      ExpBumpBase();
- 
-      bool setup( const Config::ParameterContainer& parameters,
-                 const String& prefix = "" );
+public:
+   using RealType = Real;
 
-      void setAmplitude( const RealType& amplitude );
+   ExpBumpBase();
 
-      const RealType& getAmplitude() const;
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-      void setSigma( const RealType& sigma );
+   void
+   setAmplitude( const RealType& amplitude );
 
-      const RealType& getSigma() const;
+   const RealType&
+   getAmplitude() const;
 
-   protected:
+   void
+   setSigma( const RealType& sigma );
 
-      RealType amplitude, sigma;
+   const RealType&
+   getSigma() const;
+
+protected:
+   RealType amplitude, sigma;
 };
 
-template< int Dimension,
-          typename Real >
+template< int Dimension, typename Real >
 class ExpBump
-{
-};
+{};
 
 template< typename Real >
 class ExpBump< 1, Real > : public ExpBumpBase< 1, Real >
 {
-   public:
- 
-      typedef Real RealType;
-      typedef Containers::StaticVector< 1, RealType > PointType;
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< 1, RealType >;
 
-      ExpBump();
+   ExpBump();
 
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
    __cuda_callable__
-   RealType getPartialDerivative( const PointType& v,
-                                  const Real& time = 0.0 ) const;
- 
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
+
    __cuda_callable__
-   RealType operator()( const PointType& v,
-                        const RealType& time = 0.0 ) const;
+   RealType
+   operator()( const PointType& v, const RealType& time = 0.0 ) const;
 };
 
 template< typename Real >
 class ExpBump< 2, Real > : public ExpBumpBase< 2, Real >
 {
-   public:
- 
-      typedef Real RealType;
-      typedef Containers::StaticVector< 2, RealType > PointType;
-
-      ExpBump();
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-   __cuda_callable__ inline
-   RealType getPartialDerivative( const PointType& v,
-                                  const Real& time = 0.0 ) const;
- 
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< 2, RealType >;
+
+   ExpBump();
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
    __cuda_callable__
-   RealType operator()( const PointType& v,
-                        const Real& time = 0.0 ) const;
+   inline RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
 class ExpBump< 3, Real > : public ExpBumpBase< 3, Real >
 {
-   public:
- 
-      typedef Real RealType;
-      typedef Containers::StaticVector< 3, RealType > PointType;
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< 3, RealType >;
 
-      ExpBump();
+   ExpBump();
 
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
    __cuda_callable__
-   RealType getPartialDerivative( const PointType& v,
-                                  const Real& time = 0.0 ) const;
- 
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
+
    __cuda_callable__
-   RealType operator()( const PointType& v,
-                        const Real& time = 0.0 ) const;
- 
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
-template< int Dimension,
-          typename Real >
-std::ostream& operator << ( std::ostream& str, const ExpBump< Dimension, Real >& f )
+template< int Dimension, typename Real >
+std::ostream&
+operator<<( std::ostream& str, const ExpBump< Dimension, Real >& f )
 {
    str << "ExpBump. function: amplitude = " << f.getAmplitude() << " sigma = " << f.getSigma();
    return str;
 }
 
-} // namespace Analytic
-} // namespace Functions
-} // namespace TNL
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
 
 #include <TNL/Functions/Analytic/ExpBump_impl.h>
-
-
diff --git a/src/TNL/Functions/Analytic/ExpBump_impl.h b/src/TNL/Functions/Analytic/ExpBump_impl.h
index 6675944859475b53e47aa38526260da291af1180..42c76b036eeb52690ca47cdd6f7d9da29ec384c4 100644
--- a/src/TNL/Functions/Analytic/ExpBump_impl.h
+++ b/src/TNL/Functions/Analytic/ExpBump_impl.h
@@ -11,20 +11,15 @@
 
 namespace TNL {
 namespace Functions {
-namespace Analytic {   
+namespace Analytic {
 
 template< int dimensions, typename Real >
-ExpBumpBase< dimensions, Real >::
-ExpBumpBase()
-   : amplitude( 1.0 ), sigma( 1.0 )
-{
-}
+ExpBumpBase< dimensions, Real >::ExpBumpBase() : amplitude( 1.0 ), sigma( 1.0 )
+{}
 
 template< int dimensions, typename Real >
 bool
-ExpBumpBase< dimensions, Real >::
-setup( const Config::ParameterContainer& parameters,
-       const String& prefix )
+ExpBumpBase< dimensions, Real >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    this->amplitude = parameters.getParameter< double >( prefix + "amplitude" );
    this->sigma = parameters.getParameter< double >( prefix + "sigma" );
@@ -32,25 +27,29 @@ setup( const Config::ParameterContainer& parameters,
 }
 
 template< int dimensions, typename Real >
-void ExpBumpBase< dimensions, Real >::setAmplitude( const Real& amplitude )
+void
+ExpBumpBase< dimensions, Real >::setAmplitude( const Real& amplitude )
 {
    this->amplitude = amplitude;
 }
 
 template< int dimensions, typename Real >
-const Real& ExpBumpBase< dimensions, Real >::getAmplitude() const
+const Real&
+ExpBumpBase< dimensions, Real >::getAmplitude() const
 {
    return this->amplitude;
 }
 
 template< int dimensions, typename Real >
-void ExpBumpBase< dimensions, Real >::setSigma( const Real& sigma )
+void
+ExpBumpBase< dimensions, Real >::setSigma( const Real& sigma )
 {
    this->sigma = sigma;
 }
 
 template< int dimensions, typename Real >
-const Real& ExpBumpBase< dimensions, Real >::getSigma() const
+const Real&
+ExpBumpBase< dimensions, Real >::getSigma() const
 {
    return this->sigma;
 }
@@ -60,88 +59,82 @@ const Real& ExpBumpBase< dimensions, Real >::getSigma() const
  */
 
 template< typename Real >
-ExpBump< 1, Real >::ExpBump()
-{
-}
+ExpBump< 1, Real >::ExpBump() = default;
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-ExpBump< 1, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+ExpBump< 1, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
    using namespace std;
    const RealType& x = v.x();
    if( YDiffOrder != 0 || ZDiffOrder != 0 )
       return 0.0;
    if( XDiffOrder == 0 )
-      return this->amplitude * ::exp( -x*x / ( this->sigma*this->sigma ) );
+      return this->amplitude * ::exp( -x * x / ( this->sigma * this->sigma ) );
    if( XDiffOrder == 1 )
-      return -2.0 * x / ( this->sigma * this->sigma ) * this->amplitude * ::exp( -x*x / ( this->sigma * this->sigma ) );
+      return -2.0 * x / ( this->sigma * this->sigma ) * this->amplitude * ::exp( -x * x / ( this->sigma * this->sigma ) );
    if( XDiffOrder == 2 )
-      return -2.0 / ( this->sigma * this->sigma ) * this->amplitude * ::exp( -x*x / ( this->sigma * this->sigma ) ) + 4.0 * x * x / ( this->sigma * this->sigma * this->sigma * this->sigma ) * this->amplitude * ::exp( -x*x / ( this->sigma * this->sigma ) );
+      return -2.0 / ( this->sigma * this->sigma ) * this->amplitude * ::exp( -x * x / ( this->sigma * this->sigma ) )
+           + 4.0 * x * x / ( this->sigma * this->sigma * this->sigma * this->sigma ) * this->amplitude
+                * ::exp( -x * x / ( this->sigma * this->sigma ) );
    return 0.0;
 }
 
 template< typename Real >
 __cuda_callable__
 Real
-ExpBump< 1, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+ExpBump< 1, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-
 /****
  * 2D
  */
 
 template< typename Real >
-ExpBump< 2, Real >::ExpBump()
-{
-}
+ExpBump< 2, Real >::ExpBump() = default;
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder >
-__cuda_callable__ inline
-Real
-ExpBump< 2, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
+__cuda_callable__
+inline Real
+ExpBump< 2, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
    const RealType& x = v.x();
    const RealType& y = v.y();
    if( ZDiffOrder != 0 )
       return 0.0;
    if( XDiffOrder == 0 && YDiffOrder == 0 )
-      return this->amplitude * ::exp( ( -x*x - y*y ) / ( this->sigma * this->sigma ) );
+      return this->amplitude * ::exp( ( -x * x - y * y ) / ( this->sigma * this->sigma ) );
    if( XDiffOrder == 1 && YDiffOrder == 0 )
-      return -2.0 * x / ( this->sigma * this->sigma ) * this->amplitude * ::exp( (-x * x - y * y)/ ( this->sigma * this->sigma ) );
+      return -2.0 * x / ( this->sigma * this->sigma ) * this->amplitude
+           * ::exp( ( -x * x - y * y ) / ( this->sigma * this->sigma ) );
    if( XDiffOrder == 2 && YDiffOrder == 0 )
-      return -2.0 / ( this->sigma * this->sigma ) * this->amplitude * ::exp( (-x*x - y*y) / ( this->sigma * this->sigma ) ) + 4.0 * x * x / ( this->sigma * this->sigma * this->sigma * this->sigma ) * this->amplitude * ::exp( (-x*x - y*y) / ( this->sigma * this->sigma ) );
+      return -2.0 / ( this->sigma * this->sigma ) * this->amplitude
+              * ::exp( ( -x * x - y * y ) / ( this->sigma * this->sigma ) )
+           + 4.0 * x * x / ( this->sigma * this->sigma * this->sigma * this->sigma ) * this->amplitude
+                * ::exp( ( -x * x - y * y ) / ( this->sigma * this->sigma ) );
    if( XDiffOrder == 0 && YDiffOrder == 1 )
-      return -2.0 * y / ( this->sigma * this->sigma ) * this->amplitude * ::exp( (-x * x - y * y)/ ( this->sigma * this->sigma ) );
+      return -2.0 * y / ( this->sigma * this->sigma ) * this->amplitude
+           * ::exp( ( -x * x - y * y ) / ( this->sigma * this->sigma ) );
    if( XDiffOrder == 0 && YDiffOrder == 2 )
-      return -2.0 / ( this->sigma * this->sigma ) * this->amplitude * ::exp( (-x*x - y*y) / ( this->sigma * this->sigma ) ) + 4.0 * y * y / ( this->sigma * this->sigma * this->sigma * this->sigma ) * this->amplitude * ::exp( (-x*x - y*y) / ( this->sigma * this->sigma ) );
+      return -2.0 / ( this->sigma * this->sigma ) * this->amplitude
+              * ::exp( ( -x * x - y * y ) / ( this->sigma * this->sigma ) )
+           + 4.0 * y * y / ( this->sigma * this->sigma * this->sigma * this->sigma ) * this->amplitude
+                * ::exp( ( -x * x - y * y ) / ( this->sigma * this->sigma ) );
    if( XDiffOrder == 1 && YDiffOrder == 1 )
-      return 4.0 * x * y / ( ( this->sigma * this->sigma ) * ( this->sigma * this->sigma ) ) * this->amplitude * ::exp( (-x * x - y * y)/ ( this->sigma * this->sigma ) );
+      return 4.0 * x * y / ( ( this->sigma * this->sigma ) * ( this->sigma * this->sigma ) ) * this->amplitude
+           * ::exp( ( -x * x - y * y ) / ( this->sigma * this->sigma ) );
    return 0.0;
 }
 
 template< typename Real >
 __cuda_callable__
 Real
-ExpBump< 2, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+ExpBump< 2, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
@@ -151,56 +144,63 @@ operator()( const PointType& v,
  */
 
 template< typename Real >
-ExpBump< 3, Real >::ExpBump()
-{
-}
+ExpBump< 3, Real >::ExpBump() = default;
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-ExpBump< 3, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+ExpBump< 3, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
    const RealType& x = v.x();
    const RealType& y = v.y();
    const RealType& z = v.z();
    if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 )
-      return this->amplitude * ::exp( ( -x*x - y*y -z*z ) / ( this->sigma * this->sigma ) );
+      return this->amplitude * ::exp( ( -x * x - y * y - z * z ) / ( this->sigma * this->sigma ) );
    if( XDiffOrder == 1 && YDiffOrder == 0 && ZDiffOrder == 0 )
-      return -2.0 * x / ( this->sigma * this->sigma ) * this->amplitude * ::exp( ( -x*x - y*y -z*z ) / ( this->sigma * this->sigma ) );
+      return -2.0 * x / ( this->sigma * this->sigma ) * this->amplitude
+           * ::exp( ( -x * x - y * y - z * z ) / ( this->sigma * this->sigma ) );
    if( XDiffOrder == 2 && YDiffOrder == 0 && ZDiffOrder == 0 )
-      return -2.0 / ( this->sigma * this->sigma ) * this->amplitude * ::exp( ( -x*x - y*y -z*z ) / ( this->sigma * this->sigma ) ) + 4.0 * x * x / ( this->sigma * this->sigma * this->sigma * this->sigma ) * this->amplitude * ::exp( ( -x*x - y*y -z*z ) / ( this->sigma * this->sigma ) );
+      return -2.0 / ( this->sigma * this->sigma ) * this->amplitude
+              * ::exp( ( -x * x - y * y - z * z ) / ( this->sigma * this->sigma ) )
+           + 4.0 * x * x / ( this->sigma * this->sigma * this->sigma * this->sigma ) * this->amplitude
+                * ::exp( ( -x * x - y * y - z * z ) / ( this->sigma * this->sigma ) );
    if( XDiffOrder == 0 && YDiffOrder == 1 && ZDiffOrder == 0 )
-      return -2.0 * y / ( this->sigma * this->sigma ) * this->amplitude * ::exp( ( -x*x - y*y -z*z ) / ( this->sigma * this->sigma ) );
+      return -2.0 * y / ( this->sigma * this->sigma ) * this->amplitude
+           * ::exp( ( -x * x - y * y - z * z ) / ( this->sigma * this->sigma ) );
    if( XDiffOrder == 0 && YDiffOrder == 2 && ZDiffOrder == 0 )
-      return -2.0 / ( this->sigma * this->sigma ) * this->amplitude * ::exp( ( -x*x - y*y -z*z ) / ( this->sigma * this->sigma ) ) + 4.0 * y * y / ( this->sigma * this->sigma * this->sigma * this->sigma ) * this->amplitude * ::exp( ( -x*x - y*y -z*z ) / ( this->sigma * this->sigma ) );
+      return -2.0 / ( this->sigma * this->sigma ) * this->amplitude
+              * ::exp( ( -x * x - y * y - z * z ) / ( this->sigma * this->sigma ) )
+           + 4.0 * y * y / ( this->sigma * this->sigma * this->sigma * this->sigma ) * this->amplitude
+                * ::exp( ( -x * x - y * y - z * z ) / ( this->sigma * this->sigma ) );
    if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 1 )
-      return -2.0 * z / ( this->sigma * this->sigma ) * this->amplitude * ::exp( ( -x*x - y*y -z*z ) / ( this->sigma * this->sigma ) );
+      return -2.0 * z / ( this->sigma * this->sigma ) * this->amplitude
+           * ::exp( ( -x * x - y * y - z * z ) / ( this->sigma * this->sigma ) );
    if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 2 )
-      return -2.0 / ( this->sigma * this->sigma ) * this->amplitude * ::exp( ( -x*x - y*y -z*z ) / ( this->sigma * this->sigma ) ) + 4.0 * z * z / ( this->sigma * this->sigma * this->sigma * this->sigma ) * this->amplitude * ::exp( ( -x*x - y*y -z*z ) / ( this->sigma * this->sigma ) );
+      return -2.0 / ( this->sigma * this->sigma ) * this->amplitude
+              * ::exp( ( -x * x - y * y - z * z ) / ( this->sigma * this->sigma ) )
+           + 4.0 * z * z / ( this->sigma * this->sigma * this->sigma * this->sigma ) * this->amplitude
+                * ::exp( ( -x * x - y * y - z * z ) / ( this->sigma * this->sigma ) );
    if( XDiffOrder == 1 && YDiffOrder == 1 && ZDiffOrder == 0 )
-      return 4.0 * x * y / ( ( this->sigma * this->sigma ) * ( this->sigma * this->sigma ) ) * this->amplitude * ::exp( ( -x*x - y*y -z*z ) / ( this->sigma * this->sigma ) );
+      return 4.0 * x * y / ( ( this->sigma * this->sigma ) * ( this->sigma * this->sigma ) ) * this->amplitude
+           * ::exp( ( -x * x - y * y - z * z ) / ( this->sigma * this->sigma ) );
    if( XDiffOrder == 1 && YDiffOrder == 0 && ZDiffOrder == 1 )
-      return 4.0 * x * z / ( ( this->sigma * this->sigma ) * ( this->sigma * this->sigma ) ) * this->amplitude * ::exp( ( -x*x - y*y -z*z ) / ( this->sigma * this->sigma ) );
+      return 4.0 * x * z / ( ( this->sigma * this->sigma ) * ( this->sigma * this->sigma ) ) * this->amplitude
+           * ::exp( ( -x * x - y * y - z * z ) / ( this->sigma * this->sigma ) );
    if( XDiffOrder == 0 && YDiffOrder == 1 && ZDiffOrder == 1 )
-      return 4.0 * y * z / ( ( this->sigma * this->sigma ) * ( this->sigma * this->sigma ) ) * this->amplitude * ::exp( ( -x*x - y*y -z*z ) / ( this->sigma * this->sigma ) );
+      return 4.0 * y * z / ( ( this->sigma * this->sigma ) * ( this->sigma * this->sigma ) ) * this->amplitude
+           * ::exp( ( -x * x - y * y - z * z ) / ( this->sigma * this->sigma ) );
    return 0.0;
 }
 
 template< typename Real >
 __cuda_callable__
 Real
-ExpBump< 3, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+ExpBump< 3, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-} // namespace Analytic
-} // namespace Functions
-} // namespace TNL
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/Analytic/Flowerpot.h b/src/TNL/Functions/Analytic/Flowerpot.h
index 634d8425626b52cef0a79716d0f44b1d9898ae38..ee70c49054be463e7dd5a96a11843efaacf6611a 100644
--- a/src/TNL/Functions/Analytic/Flowerpot.h
+++ b/src/TNL/Functions/Analytic/Flowerpot.h
@@ -13,120 +13,110 @@
 
 namespace TNL {
 namespace Functions {
-namespace Analytic {   
+namespace Analytic {
 
-template< typename Real,
-          int Dimension >
+template< typename Real, int Dimension >
 class FlowerpotBase : public Domain< Dimension, SpaceDomain >
 {
-   public:
+public:
+   using RealType = Real;
 
-      typedef Real RealType;
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-      bool setup( const Config::ParameterContainer& parameters,
-                 const String& prefix = "" );
+   void
+   setDiameter( const RealType& sigma );
 
-      void setDiameter( const RealType& sigma );
+   const RealType&
+   getDiameter() const;
 
-      const RealType& getDiameter() const;
-
-   protected:
-
-      RealType diameter;
+protected:
+   RealType diameter;
 };
 
-template< int Dimension,
-          typename Real >
+template< int Dimension, typename Real >
 class Flowerpot
-{
-};
+{};
 
 template< typename Real >
 class Flowerpot< 1, Real > : public FlowerpotBase< Real, 1 >
 {
-   public:
-
-      enum { Dimension = 1 };
-      typedef Real RealType;
-      typedef Containers::StaticVector< Dimension, Real > PointType;
-
-      Flowerpot();
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0,
-                typename Point = PointType >
-      __cuda_callable__
-      RealType getPartialDerivative( const Point& v,
-                                     const Real& time = 0.0 ) const;
- 
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
- 
+public:
+   enum
+   {
+      Dimension = 1
+   };
+   using RealType = Real;
+   using PointType = Containers::StaticVector< Dimension, Real >;
+
+   Flowerpot();
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Point = PointType >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const Point& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
 class Flowerpot< 2, Real > : public FlowerpotBase< Real, 2 >
 {
-   public:
-
-      enum { Dimension = 2 };
-      typedef Real RealType;
-      typedef Containers::StaticVector< Dimension, Real > PointType;
-
-      Flowerpot();
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0,
-                typename Point = PointType >
-      __cuda_callable__
-      RealType getPartialDerivative( const Point& v,
-                                     const Real& time = 0.0 ) const;
- 
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
- 
+public:
+   enum
+   {
+      Dimension = 2
+   };
+   using RealType = Real;
+   using PointType = Containers::StaticVector< Dimension, Real >;
+
+   Flowerpot();
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Point = PointType >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const Point& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
 class Flowerpot< 3, Real > : public FlowerpotBase< Real, 3 >
 {
-   public:
-
-      enum { Dimension = 3 };
-      typedef Real RealType;
-      typedef Containers::StaticVector< Dimension, Real > PointType;
-
-      Flowerpot();
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0,
-                typename Point = PointType >
-      __cuda_callable__
-      RealType getPartialDerivative( const Point& v,
-                                     const Real& time = 0.0 ) const;
- 
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
- 
+public:
+   enum
+   {
+      Dimension = 3
+   };
+   using RealType = Real;
+   using PointType = Containers::StaticVector< Dimension, Real >;
+
+   Flowerpot();
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Point = PointType >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const Point& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
-template< int Dimension,
-          typename Real >
-std::ostream& operator << ( std::ostream& str, const Flowerpot< Dimension, Real >& f )
+template< int Dimension, typename Real >
+std::ostream&
+operator<<( std::ostream& str, const Flowerpot< Dimension, Real >& f )
 {
    str << "Flowerpot function.";
    return str;
 }
 
-} // namespace Analytic
-} // namespace Functions
-} // namespace TNL
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
 
 #include <TNL/Functions/Analytic/Flowerpot_impl.h>
-
diff --git a/src/TNL/Functions/Analytic/Flowerpot_impl.h b/src/TNL/Functions/Analytic/Flowerpot_impl.h
index 5cfcaeed85bfb67cbf0e0f933f6a1709967436ac..45dca5b549e71ff0f514deba00aa779e44c6f103 100644
--- a/src/TNL/Functions/Analytic/Flowerpot_impl.h
+++ b/src/TNL/Functions/Analytic/Flowerpot_impl.h
@@ -10,29 +10,26 @@
 
 namespace TNL {
 namespace Functions {
-namespace Analytic {   
+namespace Analytic {
 
-template< typename Real,
-          int Dimension >
+template< typename Real, int Dimension >
 bool
-FlowerpotBase< Real, Dimension >::
-setup( const Config::ParameterContainer& parameters,
-       const String& prefix )
+FlowerpotBase< Real, Dimension >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    this->diameter = parameters.getParameter< double >( prefix + "diameter" );
    return true;
 }
 
-template< typename Real,
-          int Dimension >
-void FlowerpotBase< Real, Dimension >::setDiameter( const Real& sigma )
+template< typename Real, int Dimension >
+void
+FlowerpotBase< Real, Dimension >::setDiameter( const Real& sigma )
 {
    this->diameter = diameter;
 }
 
-template< typename Real,
-          int Dimension >
-const Real& FlowerpotBase< Real, Dimension >::getDiameter() const
+template< typename Real, int Dimension >
+const Real&
+FlowerpotBase< Real, Dimension >::getDiameter() const
 {
    return this->diameter;
 }
@@ -42,19 +39,13 @@ const Real& FlowerpotBase< Real, Dimension >::getDiameter() const
  */
 
 template< typename Real >
-Flowerpot< 1, Real >::Flowerpot()
-{
-}
+Flowerpot< 1, Real >::Flowerpot() = default;
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder,
-             typename Point >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, typename Point >
 __cuda_callable__
 Real
-Flowerpot< 1, Real >::getPartialDerivative( const Point& v,
-                                                       const Real& time ) const
+Flowerpot< 1, Real >::getPartialDerivative( const Point& v, const Real& time ) const
 {
    const RealType& x = v.x();
    if( YDiffOrder != 0 || ZDiffOrder != 0 )
@@ -67,32 +58,22 @@ Flowerpot< 1, Real >::getPartialDerivative( const Point& v,
 template< typename Real >
 __cuda_callable__
 Real
-Flowerpot< 1, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+Flowerpot< 1, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-
 /****
  * 2D
  */
 template< typename Real >
-Flowerpot< 2, Real >::Flowerpot()
-{
-}
+Flowerpot< 2, Real >::Flowerpot() = default;
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder,
-             typename Point >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, typename Point >
 __cuda_callable__
 Real
-Flowerpot< 2, Real >::
-getPartialDerivative( const Point& v,
-                      const Real& time ) const
+Flowerpot< 2, Real >::getPartialDerivative( const Point& v, const Real& time ) const
 {
    const RealType& x = v.x();
    const RealType& y = v.y();
@@ -106,33 +87,23 @@ getPartialDerivative( const Point& v,
 template< typename Real >
 __cuda_callable__
 Real
-Flowerpot< 2, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+Flowerpot< 2, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-
 /****
  * 3D
  */
 
 template< typename Real >
-Flowerpot< 3, Real >::Flowerpot()
-{
-}
+Flowerpot< 3, Real >::Flowerpot() = default;
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder,
-             typename Point >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, typename Point >
 __cuda_callable__
 Real
-Flowerpot< 3, Real >::
-getPartialDerivative( const Point& v,
-                      const Real& time ) const
+Flowerpot< 3, Real >::getPartialDerivative( const Point& v, const Real& time ) const
 {
    const RealType& x = v.x();
    const RealType& y = v.y();
@@ -145,14 +116,11 @@ getPartialDerivative( const Point& v,
 template< typename Real >
 __cuda_callable__
 Real
-Flowerpot< 3, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+Flowerpot< 3, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-} // namespace Analytic
-} // namespace Functions
-} // namespace TNL
-
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/Analytic/Paraboloid.h b/src/TNL/Functions/Analytic/Paraboloid.h
index 90cffb1a48946210bc5a909ffd4ed2230441e68c..f994aa6190e8fe76490d53794f16eafd6a61ec2b 100644
--- a/src/TNL/Functions/Analytic/Paraboloid.h
+++ b/src/TNL/Functions/Analytic/Paraboloid.h
@@ -11,136 +11,126 @@
 #include <TNL/Functions/Domain.h>
 
 namespace TNL {
-   namespace Functions {
-      namespace Analytic {
+namespace Functions {
+namespace Analytic {
 
-template< int dimensions,
-          typename Real = double >
+template< int dimensions, typename Real = double >
 class ParaboloidBase : public Functions::Domain< dimensions, SpaceDomain >
 {
-   public:
-
+public:
    ParaboloidBase();
 
-   bool setup( const Config::ParameterContainer& parameters,
-              const String& prefix = "" );
-
-   void setXCenter( const Real& waveLength );
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-   Real getXCenter() const;
+   void
+   setXCenter( const Real& waveLength );
 
-   void setYCenter( const Real& waveLength );
+   Real
+   getXCenter() const;
 
-   Real getYCenter() const;
+   void
+   setYCenter( const Real& waveLength );
 
-   void setZCenter( const Real& waveLength );
+   Real
+   getYCenter() const;
 
-   Real getZCenter() const;
+   void
+   setZCenter( const Real& waveLength );
 
-   void setCoefficient( const Real& coefficient );
+   Real
+   getZCenter() const;
 
-   Real getCoefficient() const;
+   void
+   setCoefficient( const Real& coefficient );
 
-   void setOffset( const Real& offset );
+   Real
+   getCoefficient() const;
 
-   Real getOffset() const;
+   void
+   setOffset( const Real& offset );
 
-   protected:
+   Real
+   getOffset() const;
 
+protected:
    Real xCenter, yCenter, zCenter, coefficient, radius;
 };
 
 template< int Dimensions, typename Real >
 class Paraboloid
-{
-};
+{};
 
 template< typename Real >
 class Paraboloid< 1, Real > : public ParaboloidBase< 1, Real >
 {
-   public:
-
-      typedef Real RealType;
-      typedef Containers::StaticVector< 1, RealType > PointType;
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                                     const Real& time = 0.0 ) const;
-
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const
-      {
-         return this->getPartialDerivative< 0, 0, 0 >( v, time );
-      }
-
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< 1, RealType >;
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const
+   {
+      return this->getPartialDerivative< 0, 0, 0 >( v, time );
+   }
 };
 
 template< typename Real >
 class Paraboloid< 2, Real > : public ParaboloidBase< 2, Real >
 {
-   public:
-
-      typedef Real RealType;
-      typedef Containers::StaticVector< 2, RealType > PointType;
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                                     const Real& time = 0.0 ) const;
-
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const
-      {
-         return this->getPartialDerivative< 0, 0, 0 >( v, time );
-      }
-
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< 2, RealType >;
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const
+   {
+      return this->getPartialDerivative< 0, 0, 0 >( v, time );
+   }
 };
 
 template< typename Real >
 class Paraboloid< 3, Real > : public ParaboloidBase< 3, Real >
 {
-   public:
-
-      typedef Real RealType;
-      typedef Containers::StaticVector< 3, RealType > PointType;
-
-
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                         const Real& time = 0.0 ) const;
-
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const
-      {
-         return this->getPartialDerivative< 0, 0, 0 >( v, time );
-      }
-
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< 3, RealType >;
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const
+   {
+      return this->getPartialDerivative< 0, 0, 0 >( v, time );
+   }
 };
 
-template< int Dimensions,
-          typename Real >
-std::ostream& operator << ( std::ostream& str, const Paraboloid< Dimensions, Real >& f )
+template< int Dimensions, typename Real >
+std::ostream&
+operator<<( std::ostream& str, const Paraboloid< Dimensions, Real >& f )
 {
-   str << "SDF Paraboloid function: amplitude = " << f.getCoefficient()
-       << " offset = " << f.getOffset();
+   str << "SDF Paraboloid function: amplitude = " << f.getCoefficient() << " offset = " << f.getOffset();
    return str;
 }
-        
-      } // namespace Analytic
-   } // namespace Functions
-} // namespace TNL
 
-#include <TNL/Functions/Analytic/Paraboloid_impl.h>
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
 
+#include <TNL/Functions/Analytic/Paraboloid_impl.h>
diff --git a/src/TNL/Functions/Analytic/ParaboloidSDF.h b/src/TNL/Functions/Analytic/ParaboloidSDF.h
index 74cb7f82a7fd98670a66e0e22f71eb09ff993e1c..57a44a54cf0e6fa55101cccd46ea4d3935831932 100644
--- a/src/TNL/Functions/Analytic/ParaboloidSDF.h
+++ b/src/TNL/Functions/Analytic/ParaboloidSDF.h
@@ -4,135 +4,124 @@
 //
 // SPDX-License-Identifier: MIT
 
-#pragma once 
+#pragma once
 
 #include <TNL/Config/ParameterContainer.h>
 #include <TNL/Containers/StaticVector.h>
 #include <TNL/Functions/Domain.h>
 
 namespace TNL {
-   namespace Functions {
-      namespace Analytic {
+namespace Functions {
+namespace Analytic {
 
-template< int dimensions,
-          typename Real = double >
+template< int dimensions, typename Real = double >
 class ParaboloidSDFBase : public Functions::Domain< dimensions, SpaceDomain >
 {
-   public:
-
+public:
    ParaboloidSDFBase();
 
-   bool setup( const Config::ParameterContainer& parameters,
-              const String& prefix = "" );
-
-   void setXCenter( const Real& waveLength );
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-   Real getXCenter() const;
+   void
+   setXCenter( const Real& waveLength );
 
-   void setYCenter( const Real& waveLength );
+   Real
+   getXCenter() const;
 
-   Real getYCenter() const;
+   void
+   setYCenter( const Real& waveLength );
 
-   void setZCenter( const Real& waveLength );
+   Real
+   getYCenter() const;
 
-   Real getZCenter() const;
+   void
+   setZCenter( const Real& waveLength );
 
-   void setCoefficient( const Real& coefficient );
+   Real
+   getZCenter() const;
 
-   Real getCoefficient() const;
+   void
+   setCoefficient( const Real& coefficient );
 
-   void setOffset( const Real& offset );
+   Real
+   getCoefficient() const;
 
-   Real getOffset() const;
+   void
+   setOffset( const Real& offset );
 
-   protected:
+   Real
+   getOffset() const;
 
+protected:
    Real xCenter, yCenter, zCenter, coefficient, radius;
 };
 
 template< int Dimensions, typename Real >
 class ParaboloidSDF
-{
-};
+{};
 
 template< typename Real >
 class ParaboloidSDF< 1, Real > : public ParaboloidSDFBase< 1, Real >
 {
-   public:
-
-      typedef Real RealType;
-      typedef Containers::StaticVector< 1, RealType > PointType;
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                                     const Real& time = 0.0 ) const;
-
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
-
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< 1, RealType >;
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
 class ParaboloidSDF< 2, Real > : public ParaboloidSDFBase< 2, Real >
 {
-   public:
-
-      typedef Real RealType;
-      typedef Containers::StaticVector< 2, RealType > PointType;
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                                     const Real& time = 0.0 ) const;
-
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
-
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< 2, RealType >;
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
 class ParaboloidSDF< 3, Real > : public ParaboloidSDFBase< 3, Real >
 {
-   public:
-
-      typedef Real RealType;
-      typedef Containers::StaticVector< 3, RealType > PointType;
-
-
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                         const Real& time = 0.0 ) const;
-
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
-
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< 3, RealType >;
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
-template< int Dimensions,
-          typename Real >
-std::ostream& operator << ( std::ostream& str, const ParaboloidSDF< Dimensions, Real >& f )
+template< int Dimensions, typename Real >
+std::ostream&
+operator<<( std::ostream& str, const ParaboloidSDF< Dimensions, Real >& f )
 {
-   str << "SDF Paraboloid SDF function: amplitude = " << f.getCoefficient()
-       << " offset = " << f.getOffset();
+   str << "SDF Paraboloid SDF function: amplitude = " << f.getCoefficient() << " offset = " << f.getOffset();
    return str;
 }
-         
-      } // namespace Analytic
-   } // namespace Functions
-} // namespace TNL
 
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
 
 #include <TNL/Functions/Analytic/ParaboloidSDF_impl.h>
-
diff --git a/src/TNL/Functions/Analytic/ParaboloidSDF_impl.h b/src/TNL/Functions/Analytic/ParaboloidSDF_impl.h
index 2cedd9b95733c1f6ab6ff2073e4bec7b8cb8884c..cabfd2a31a6b5b87794877c930e1fd65c2cc0280 100644
--- a/src/TNL/Functions/Analytic/ParaboloidSDF_impl.h
+++ b/src/TNL/Functions/Analytic/ParaboloidSDF_impl.h
@@ -4,24 +4,22 @@
 //
 // SPDX-License-Identifier: MIT
 
-#pragma once 
+#pragma once
 
 #include <TNL/Functions/Analytic/ParaboloidSDF.h>
 
 namespace TNL {
-   namespace Functions {
-      namespace Analytic {
+namespace Functions {
+namespace Analytic {
 
 template< int dimensions, typename Real >
 ParaboloidSDFBase< dimensions, Real >::ParaboloidSDFBase()
-: xCenter( 0 ), yCenter( 0 ), zCenter( 0 ),
-  coefficient( 1 ), radius ( 0 )
-{
-}
+: xCenter( 0 ), yCenter( 0 ), zCenter( 0 ), coefficient( 1 ), radius( 0 )
+{}
 
 template< int dimensions, typename Real >
-bool ParaboloidSDFBase< dimensions, Real >::setup( const Config::ParameterContainer& parameters,
-        								 const String& prefix)
+bool
+ParaboloidSDFBase< dimensions, Real >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    this->xCenter = parameters.getParameter< double >( "x-center" );
    this->yCenter = parameters.getParameter< double >( "y-center" );
@@ -33,127 +31,122 @@ bool ParaboloidSDFBase< dimensions, Real >::setup( const Config::ParameterContai
 }
 
 template< int dimensions, typename Real >
-void ParaboloidSDFBase< dimensions, Real >::setXCenter( const Real& xCenter )
+void
+ParaboloidSDFBase< dimensions, Real >::setXCenter( const Real& xCenter )
 {
    this->xCenter = xCenter;
 }
 
 template< int dimensions, typename Real >
-Real ParaboloidSDFBase< dimensions, Real >::getXCenter() const
+Real
+ParaboloidSDFBase< dimensions, Real >::getXCenter() const
 {
    return this->xCenter;
 }
 
 template< int dimensions, typename Real >
-void ParaboloidSDFBase< dimensions, Real >::setYCenter( const Real& yCenter )
+void
+ParaboloidSDFBase< dimensions, Real >::setYCenter( const Real& yCenter )
 {
    this->yCenter = yCenter;
 }
 
 template< int dimensions, typename Real >
-Real ParaboloidSDFBase< dimensions, Real >::getYCenter() const
+Real
+ParaboloidSDFBase< dimensions, Real >::getYCenter() const
 {
    return this->yCenter;
 }
 template< int dimensions, typename Real >
-void ParaboloidSDFBase< dimensions, Real >::setZCenter( const Real& zCenter )
+void
+ParaboloidSDFBase< dimensions, Real >::setZCenter( const Real& zCenter )
 {
    this->zCenter = zCenter;
 }
 
 template< int dimensions, typename Real >
-Real ParaboloidSDFBase< dimensions, Real >::getZCenter() const
+Real
+ParaboloidSDFBase< dimensions, Real >::getZCenter() const
 {
    return this->zCenter;
 }
 
 template< int dimensions, typename Real >
-void ParaboloidSDFBase< dimensions, Real >::setCoefficient( const Real& amplitude )
+void
+ParaboloidSDFBase< dimensions, Real >::setCoefficient( const Real& amplitude )
 {
    this->coefficient = coefficient;
 }
 
 template< int dimensions, typename Real >
-Real ParaboloidSDFBase< dimensions, Real >::getCoefficient() const
+Real
+ParaboloidSDFBase< dimensions, Real >::getCoefficient() const
 {
    return this->coefficient;
 }
 
 template< int dimensions, typename Real >
-void ParaboloidSDFBase< dimensions, Real >::setOffset( const Real& offset )
+void
+ParaboloidSDFBase< dimensions, Real >::setOffset( const Real& offset )
 {
    this->radius = offset;
 }
 
 template< int dimensions, typename Real >
-Real ParaboloidSDFBase< dimensions, Real >::getOffset() const
+Real
+ParaboloidSDFBase< dimensions, Real >::getOffset() const
 {
    return this->radius;
 }
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder>
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-ParaboloidSDF< 1, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+ParaboloidSDF< 1, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
    const Real& x = v.x();
    if( YDiffOrder != 0 || ZDiffOrder != 0 )
       return 0.0;
    if( XDiffOrder == 0 )
-      return ::sqrt( ( x - this -> xCenter ) * ( x - this -> xCenter ) ) - this->radius;
+      return ::sqrt( ( x - this->xCenter ) * ( x - this->xCenter ) ) - this->radius;
    if( XDiffOrder == 1 )
       return 1.0;
    return 0.0;
 }
 
-
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder>
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-ParaboloidSDF< 2, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+ParaboloidSDF< 2, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
    const Real& x = v.x();
    const Real& y = v.y();
-   if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 )
-   {
-      return ::sqrt ( ( x - this -> xCenter ) * ( x - this -> xCenter )
-    		  	  + ( y - this -> yCenter ) * ( y - this -> yCenter ) ) - this->radius;
+   if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 ) {
+      return ::sqrt( ( x - this->xCenter ) * ( x - this->xCenter ) + ( y - this->yCenter ) * ( y - this->yCenter ) )
+           - this->radius;
    }
    return 0.0;
 }
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder>
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-ParaboloidSDF< 3, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+ParaboloidSDF< 3, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
    const Real& x = v.x();
    const Real& y = v.y();
    const Real& z = v.z();
-   if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 )
-   {
-      return ::sqrt( ( x - this -> xCenter ) * ( x - this -> xCenter )
-    		  	 + ( y - this -> yCenter ) * ( y - this -> yCenter )
-    		  	 + ( z - this -> zCenter ) * ( z - this -> zCenter ) ) - this->radius;
+   if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 ) {
+      return ::sqrt( ( x - this->xCenter ) * ( x - this->xCenter ) + ( y - this->yCenter ) * ( y - this->yCenter )
+                     + ( z - this->zCenter ) * ( z - this->zCenter ) )
+           - this->radius;
    }
    return 0.0;
 }
-         
-      } //namespace Analytic
-   } // namepsace Functions
-} // namespace TNL
+
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/Analytic/Paraboloid_impl.h b/src/TNL/Functions/Analytic/Paraboloid_impl.h
index 128a7c6a85cd9c95d6dbad882772822ba2cda4cc..293ce63c6c8243a413313bea27939570557910cf 100644
--- a/src/TNL/Functions/Analytic/Paraboloid_impl.h
+++ b/src/TNL/Functions/Analytic/Paraboloid_impl.h
@@ -4,24 +4,21 @@
 //
 // SPDX-License-Identifier: MIT
 
-#pragma once 
+#pragma once
 
 #include <TNL/Functions/Analytic/Paraboloid.h>
 
 namespace TNL {
-   namespace Functions {
-      namespace Analytic {
+namespace Functions {
+namespace Analytic {
 
 template< int dimensions, typename Real >
-ParaboloidBase< dimensions, Real >::ParaboloidBase()
-: xCenter( 0 ), yCenter( 0 ), zCenter( 0 ),
-  coefficient( 1 ), radius ( 0 )
-{
-}
+ParaboloidBase< dimensions, Real >::ParaboloidBase() : xCenter( 0 ), yCenter( 0 ), zCenter( 0 ), coefficient( 1 ), radius( 0 )
+{}
 
 template< int dimensions, typename Real >
-bool ParaboloidBase< dimensions, Real >::setup( const Config::ParameterContainer& parameters,
-        								 const String& prefix)
+bool
+ParaboloidBase< dimensions, Real >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    this->xCenter = parameters.getParameter< double >( "x-center" );
    this->yCenter = parameters.getParameter< double >( "y-center" );
@@ -33,149 +30,145 @@ bool ParaboloidBase< dimensions, Real >::setup( const Config::ParameterContainer
 }
 
 template< int dimensions, typename Real >
-void ParaboloidBase< dimensions, Real >::setXCenter( const Real& xCenter )
+void
+ParaboloidBase< dimensions, Real >::setXCenter( const Real& xCenter )
 {
    this->xCenter = xCenter;
 }
 
 template< int dimensions, typename Real >
-Real ParaboloidBase< dimensions, Real >::getXCenter() const
+Real
+ParaboloidBase< dimensions, Real >::getXCenter() const
 {
    return this->xCenter;
 }
 
 template< int dimensions, typename Real >
-void ParaboloidBase< dimensions, Real >::setYCenter( const Real& yCenter )
+void
+ParaboloidBase< dimensions, Real >::setYCenter( const Real& yCenter )
 {
    this->yCenter = yCenter;
 }
 
 template< int dimensions, typename Real >
-Real ParaboloidBase< dimensions, Real >::getYCenter() const
+Real
+ParaboloidBase< dimensions, Real >::getYCenter() const
 {
    return this->yCenter;
 }
 template< int dimensions, typename Real >
-void ParaboloidBase< dimensions, Real >::setZCenter( const Real& zCenter )
+void
+ParaboloidBase< dimensions, Real >::setZCenter( const Real& zCenter )
 {
    this->zCenter = zCenter;
 }
 
 template< int dimensions, typename Real >
-Real ParaboloidBase< dimensions, Real >::getZCenter() const
+Real
+ParaboloidBase< dimensions, Real >::getZCenter() const
 {
    return this->zCenter;
 }
 
 template< int dimensions, typename Real >
-void ParaboloidBase< dimensions, Real >::setCoefficient( const Real& amplitude )
+void
+ParaboloidBase< dimensions, Real >::setCoefficient( const Real& amplitude )
 {
    this->coefficient = coefficient;
 }
 
 template< int dimensions, typename Real >
-Real ParaboloidBase< dimensions, Real >::getCoefficient() const
+Real
+ParaboloidBase< dimensions, Real >::getCoefficient() const
 {
    return this->coefficient;
 }
 
 template< int dimensions, typename Real >
-void ParaboloidBase< dimensions, Real >::setOffset( const Real& offset )
+void
+ParaboloidBase< dimensions, Real >::setOffset( const Real& offset )
 {
    this->radius = offset;
 }
 
 template< int dimensions, typename Real >
-Real ParaboloidBase< dimensions, Real >::getOffset() const
+Real
+ParaboloidBase< dimensions, Real >::getOffset() const
 {
    return this->radius;
 }
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder>
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-Paraboloid< 1, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+Paraboloid< 1, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
    const Real& x = v.x();
    if( YDiffOrder != 0 || ZDiffOrder != 0 )
       return 0.0;
    if( XDiffOrder == 0 )
-      return this->coefficient * ( ( x - this -> xCenter ) * ( x - this -> xCenter ) - this->radius*this->radius );
+      return this->coefficient * ( ( x - this->xCenter ) * ( x - this->xCenter ) - this->radius * this->radius );
    if( XDiffOrder == 1 )
-      return 2.0 * this->coefficient * ( x - this -> xCenter );
+      return 2.0 * this->coefficient * ( x - this->xCenter );
    return 0.0;
 }
 
-
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder>
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-Paraboloid< 2, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+Paraboloid< 2, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
    const Real& x = v.x();
    const Real& y = v.y();
    if( ZDiffOrder != 0 )
       return 0.0;
-   if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 )
-   {
-      return this->coefficient * ( ( x - this -> xCenter ) * ( x - this -> xCenter )
-    		  	  	  	         + ( y - this -> yCenter ) * ( y - this -> yCenter ) - this->radius*this->radius );
+   if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 ) {
+      return this->coefficient
+           * ( ( x - this->xCenter ) * ( x - this->xCenter ) + ( y - this->yCenter ) * ( y - this->yCenter )
+               - this->radius * this->radius );
    }
-   if( XDiffOrder == 1 && YDiffOrder == 0)
-	   return 2.0 * this->coefficient * ( x - this -> xCenter );
-   if( YDiffOrder == 1 && XDiffOrder == 0)
-	   return 2.0 * this->coefficient * ( y - this -> yCenter );
-   if( XDiffOrder == 2 && YDiffOrder == 0)
-	   return 2.0 * this->coefficient;
-   if( YDiffOrder == 2 && XDiffOrder == 0)
-	   return 2.0 * this->coefficient;
+   if( XDiffOrder == 1 && YDiffOrder == 0 )
+      return 2.0 * this->coefficient * ( x - this->xCenter );
+   if( YDiffOrder == 1 && XDiffOrder == 0 )
+      return 2.0 * this->coefficient * ( y - this->yCenter );
+   if( XDiffOrder == 2 && YDiffOrder == 0 )
+      return 2.0 * this->coefficient;
+   if( YDiffOrder == 2 && XDiffOrder == 0 )
+      return 2.0 * this->coefficient;
    return 0.0;
 }
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder>
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-Paraboloid< 3, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+Paraboloid< 3, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
    const Real& x = v.x();
    const Real& y = v.y();
    const Real& z = v.z();
-   if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 )
-   {
-      return this->coefficient * ( ( x - this -> xCenter ) * ( x - this -> xCenter )
-    		  	  	  	         + ( y - this -> yCenter ) * ( y - this -> yCenter )
-    		  	  	  	         + ( z - this -> zCenter ) * ( z - this -> zCenter ) - this->radius*this->radius );
+   if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 ) {
+      return this->coefficient
+           * ( ( x - this->xCenter ) * ( x - this->xCenter ) + ( y - this->yCenter ) * ( y - this->yCenter )
+               + ( z - this->zCenter ) * ( z - this->zCenter ) - this->radius * this->radius );
    }
-   if( XDiffOrder == 1 && YDiffOrder == 0 && ZDiffOrder == 0)
-	   return 2.0 * this->coefficient * ( x - this -> xCenter );
-   if( YDiffOrder == 1 && XDiffOrder == 0 && ZDiffOrder == 0)
-	   return 2.0 * this->coefficient * ( y - this -> yCenter );
-   if( ZDiffOrder == 1 && XDiffOrder == 0 && YDiffOrder == 0)
-	   return 2.0 * this->coefficient * ( z - this -> zCenter );
-   if( XDiffOrder == 2 && YDiffOrder == 0 && ZDiffOrder == 0)
-	   return 2.0 * this->coefficient;
-   if( YDiffOrder == 2 && XDiffOrder == 0 && ZDiffOrder == 0)
-	   return 2.0 * this->coefficient;
-   if( ZDiffOrder == 2 && XDiffOrder == 0 && YDiffOrder == 0)
-	   return 2.0 * this->coefficient;
+   if( XDiffOrder == 1 && YDiffOrder == 0 && ZDiffOrder == 0 )
+      return 2.0 * this->coefficient * ( x - this->xCenter );
+   if( YDiffOrder == 1 && XDiffOrder == 0 && ZDiffOrder == 0 )
+      return 2.0 * this->coefficient * ( y - this->yCenter );
+   if( ZDiffOrder == 1 && XDiffOrder == 0 && YDiffOrder == 0 )
+      return 2.0 * this->coefficient * ( z - this->zCenter );
+   if( XDiffOrder == 2 && YDiffOrder == 0 && ZDiffOrder == 0 )
+      return 2.0 * this->coefficient;
+   if( YDiffOrder == 2 && XDiffOrder == 0 && ZDiffOrder == 0 )
+      return 2.0 * this->coefficient;
+   if( ZDiffOrder == 2 && XDiffOrder == 0 && YDiffOrder == 0 )
+      return 2.0 * this->coefficient;
    return 0.0;
 }
-         
-      } // namespace Analytic
-   } // namedspace Functions
-} // namespace TNL
+
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/Analytic/PseudoSquare.h b/src/TNL/Functions/Analytic/PseudoSquare.h
index 15355e23242707f6bb7b95a4ce3254fd433907eb..2525d680e099a072828566d89a37927fe0cb9199 100644
--- a/src/TNL/Functions/Analytic/PseudoSquare.h
+++ b/src/TNL/Functions/Analytic/PseudoSquare.h
@@ -13,110 +13,104 @@
 
 namespace TNL {
 namespace Functions {
-namespace Analytic {   
+namespace Analytic {
 
-template< typename Real,
-          int Dimension >
+template< typename Real, int Dimension >
 class PseudoSquareBase : public Domain< Dimension, SpaceDomain >
 {
-   public:
+public:
+   using RealType = Real;
 
-      typedef Real RealType;
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-      bool setup( const Config::ParameterContainer& parameters,
-                 const String& prefix = "" );
-
-   protected:
-
-      RealType height;
+protected:
+   RealType height;
 };
 
-template< int Dimension,
-          typename Real >
+template< int Dimension, typename Real >
 class PseudoSquare
-{
-};
+{};
 
 template< typename Real >
 class PseudoSquare< 1, Real > : public PseudoSquareBase< Real, 1 >
 {
-   public:
-
-      enum { Dimension = 1 };
-      typedef Real RealType;
-      typedef Containers::StaticVector< Dimension, Real > PointType;
-
-      PseudoSquare();
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                                     const Real& time = 0.0 ) const;
- 
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
+public:
+   enum
+   {
+      Dimension = 1
+   };
+   using RealType = Real;
+   using PointType = Containers::StaticVector< Dimension, Real >;
+
+   PseudoSquare();
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
 class PseudoSquare< 2, Real > : public PseudoSquareBase< Real, 2 >
 {
-   public:
-
-      enum { Dimension = 2 };
-      typedef Real RealType;
-      typedef Containers::StaticVector< Dimension, Real > PointType;
-
-      PseudoSquare();
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                                     const Real& time = 0.0 ) const;
- 
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
+public:
+   enum
+   {
+      Dimension = 2
+   };
+   using RealType = Real;
+   using PointType = Containers::StaticVector< Dimension, Real >;
+
+   PseudoSquare();
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
 class PseudoSquare< 3, Real > : public PseudoSquareBase< Real, 3 >
 {
-   public:
-
-      enum { Dimension = 3 };
-      typedef Real RealType;
-      typedef Containers::StaticVector< Dimension, Real > PointType;
-
-      PseudoSquare();
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                                     const Real& time = 0.0 ) const;
- 
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
- 
+public:
+   enum
+   {
+      Dimension = 3
+   };
+   using RealType = Real;
+   using PointType = Containers::StaticVector< Dimension, Real >;
+
+   PseudoSquare();
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
-template< int Dimension,
-          typename Real >
-std::ostream& operator << ( std::ostream& str, const PseudoSquare< Dimension, Real >& f )
+template< int Dimension, typename Real >
+std::ostream&
+operator<<( std::ostream& str, const PseudoSquare< Dimension, Real >& f )
 {
    str << "Level-set pseudo square function.";
    return str;
 }
 
-} // namespace Analytic
-} // namespace Functions
-} // namepsace TNL
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
 
 #include <TNL/Functions/Analytic/PseudoSquare_impl.h>
diff --git a/src/TNL/Functions/Analytic/PseudoSquare_impl.h b/src/TNL/Functions/Analytic/PseudoSquare_impl.h
index 8eab1ae8774309be822ff3c180c6c4052cc7fe6d..a2307e99241367afc9ef9695eca1e979880e50cd 100644
--- a/src/TNL/Functions/Analytic/PseudoSquare_impl.h
+++ b/src/TNL/Functions/Analytic/PseudoSquare_impl.h
@@ -10,41 +10,31 @@
 
 namespace TNL {
 namespace Functions {
-namespace Analytic {   
+namespace Analytic {
 
-template< typename Real,
-          int Dimension >
+template< typename Real, int Dimension >
 bool
-PseudoSquareBase< Real, Dimension >::
-setup( const Config::ParameterContainer& parameters,
-       const String& prefix )
+PseudoSquareBase< Real, Dimension >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    this->height = parameters.getParameter< double >( prefix + "height" );
- 
+
    return true;
 }
 
-
 /***
  * 1D
  */
 
 template< typename Real >
-PseudoSquare< 1, Real >::PseudoSquare()
-{
-}
+PseudoSquare< 1, Real >::PseudoSquare() = default;
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-PseudoSquare< 1, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+PseudoSquare< 1, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
-   //const RealType& x = v.x();
+   // const RealType& x = v.x();
    if( YDiffOrder != 0 || ZDiffOrder != 0 )
       return 0.0;
    if( XDiffOrder == 0 )
@@ -55,9 +45,7 @@ getPartialDerivative( const PointType& v,
 template< typename Real >
 __cuda_callable__
 Real
-PseudoSquare< 1, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+PseudoSquare< 1, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
@@ -66,19 +54,13 @@ operator()( const PointType& v,
  * 2D
  */
 template< typename Real >
-PseudoSquare< 2, Real >::PseudoSquare()
-{
-}
+PseudoSquare< 2, Real >::PseudoSquare() = default;
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-PseudoSquare< 2, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+PseudoSquare< 2, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
    const RealType& x = v.x();
    const RealType& y = v.y();
@@ -92,9 +74,7 @@ getPartialDerivative( const PointType& v,
 template< typename Real >
 __cuda_callable__
 Real
-PseudoSquare< 2, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+PseudoSquare< 2, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
@@ -103,23 +83,17 @@ operator()( const PointType& v,
  * 3D
  */
 template< typename Real >
-PseudoSquare< 3, Real >::PseudoSquare()
-{
-}
+PseudoSquare< 3, Real >::PseudoSquare() = default;
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-PseudoSquare< 3, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+PseudoSquare< 3, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
-   //const RealType& x = v.x();
-   //const RealType& y = v.y();
-   //const RealType& z = v.z();
+   // const RealType& x = v.x();
+   // const RealType& y = v.y();
+   // const RealType& z = v.z();
    if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 )
       return 0.0;
    return 0.0;
@@ -128,13 +102,11 @@ getPartialDerivative( const PointType& v,
 template< typename Real >
 __cuda_callable__
 Real
-PseudoSquare< 3, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+PseudoSquare< 3, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-} // namespace Analytic
-} // namespace Functions
-} // namepsace TNL
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/Analytic/SDFSchemeTest.h b/src/TNL/Functions/Analytic/SDFSchemeTest.h
index c5b0cef7809ca7e9fd0f2773e229729470cf64e0..6df563b9ee9ba1dedb438bdb93381a5dae2417ff 100644
--- a/src/TNL/Functions/Analytic/SDFSchemeTest.h
+++ b/src/TNL/Functions/Analytic/SDFSchemeTest.h
@@ -17,88 +17,75 @@
 #include <functions/tnlSDFParaboloidSDF.h>
 
 namespace TNL {
-   namespace Functions {
-      namespace Analytic {
+namespace Functions {
+namespace Analytic {
 
 template< typename function, typename Real = double >
 class SDFSchemeTestBase
 {
-   public:
-
+public:
    SDFSchemeTestBase();
 
-   bool setup( const Config::ParameterContainer& parameters,
-           const String& prefix = "" );
-
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-   	function f;
+   function f;
 };
 
 template< typename function, int Dimensions, typename Real >
 class SDFSchemeTest
-{
-
-};
+{};
 
 template< typename function, int Dimensions, typename Real >
 class SDFSchemeTest< function, 1, Real > : public SDFSchemeTestBase< function, Real >
 {
-   public:
-
-
-   enum { Dimensions = 1 };
+public:
+   enum
+   {
+      Dimensions = 1
+   };
    typedef Point PointType;
    typedef typename PointType::RealType RealType;
 
-   template< int XDiffOrder = 0,
-             int YDiffOrder = 0,
-             int ZDiffOrder = 0 >
-   RealType getValue( const PointType& v,
-           const Real& time = 0.0 ) const;
-
-
-
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   RealType
+   getValue( const PointType& v, const Real& time = 0.0 ) const;
 };
 
 template< typename function, int Dimensions, typename Real >
 class SDFSchemeTest< function, 2, Real > : public SDFSchemeTestBase< function, Real >
 {
-   public:
-
-
-   enum { Dimensions = 2 };
+public:
+   enum
+   {
+      Dimensions = 2
+   };
    typedef Point PointType;
    typedef typename PointType::RealType RealType;
 
-   template< int XDiffOrder = 0,
-             int YDiffOrder = 0,
-             int ZDiffOrder = 0 >
-   RealType getValue( const PointType& v,
-           const Real& time = 0.0 ) const;
-
-
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   RealType
+   getValue( const PointType& v, const Real& time = 0.0 ) const;
 };
 
 template< typename function, int Dimensions, typename Real >
-class SDFSchemeTest< function, 3, Real > : public SDFSchemeTestBase< function,  Real >
+class SDFSchemeTest< function, 3, Real > : public SDFSchemeTestBase< function, Real >
 {
-   public:
-
-
-   enum { Dimensions = 3 };
+public:
+   enum
+   {
+      Dimensions = 3
+   };
    typedef Point PointType;
    typedef typename PointType::RealType RealType;
 
-   template< int XDiffOrder = 0,
-             int YDiffOrder = 0,
-             int ZDiffOrder = 0 >
-   RealType getValue( const PointType& v,
-           const Real& time = 0.0 ) const;
-
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   RealType
+   getValue( const PointType& v, const Real& time = 0.0 ) const;
 };
 
-      } // namespace Analytic
-   } // namespace Functions
-} // namespace TNL
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
 
 #include <functions/SDFSchemeTest_impl.h>
diff --git a/src/TNL/Functions/Analytic/SDFSchemeTest_impl.h b/src/TNL/Functions/Analytic/SDFSchemeTest_impl.h
index aef4472b0d6eaaf5c1498db6d5124681ec213fed..6626f98775052eafd6fc5417ecf2dac0a73d5d6f 100644
--- a/src/TNL/Functions/Analytic/SDFSchemeTest_impl.h
+++ b/src/TNL/Functions/Analytic/SDFSchemeTest_impl.h
@@ -9,66 +9,63 @@
 #include <functions/SDFSchemeTest.h>
 
 namespace TNL {
-   namespace Functions {
-      namespace Analytic {
+namespace Functions {
+namespace Analytic {
 
 template< typename function, typename Real >
 SDFSchemeTestBase< function, Real >::SDFSchemeTestBase()
-{
-}
+{}
 
 template< typename function, typename Real >
-bool SDFSchemeTestBase< function, Real >::v( const Config::ParameterContainer& parameters,
-        const String& prefix = "" )
+bool
+SDFSchemeTestBase< function, Real >::v( const Config::ParameterContainer& parameters, const String& prefix = "" )
 {
-	f.init(parameters);
+   f.init( parameters );
 
    return true;
 }
 
-
-
 template< typename function, int Dimensions, typename Real >
-   template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
-Real SDFSchemeTest< function, 1, Real >::getValue( const Point& v,
-              const Real& time = 0.0 ) const
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
+Real
+SDFSchemeTest< function, 1, Real >::getValue( const Point& v, const Real& time = 0.0 ) const
 {
    if( YDiffOrder != 0 || ZDiffOrder != 0 || XDiffOrder != 0 )
       return 0.0;
 
-   return sign( this->f.getValue<0,0,0>(v))*
-		   	   ( 1-sqrt(this->f.getValue<1,0,0>(v)*this->f.getValue<1,0,0>(v)) );
+   return sign( this->f.getValue< 0, 0, 0 >( v ) )
+        * ( 1 - sqrt( this->f.getValue< 1, 0, 0 >( v ) * this->f.getValue< 1, 0, 0 >( v ) ) );
 }
 
-
 template< typename function, int Dimensions, typename Real >
-   template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
-Real SDFSchemeTest< function, 2, Real >::getValue( const Point& v,
-              const Real& time = 0.0 ) const
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
+Real
+SDFSchemeTest< function, 2, Real >::getValue( const Point& v, const Real& time = 0.0 ) const
 {
-	   if( YDiffOrder != 0 || ZDiffOrder != 0 || XDiffOrder != 0 )
-	      return 0.0;
+   if( YDiffOrder != 0 || ZDiffOrder != 0 || XDiffOrder != 0 )
+      return 0.0;
 
-	   return sign( this->f.getValue<0,0,0>(v))*
-			   ( 1-sqrt(this->f.getValue<1,0,0>(v)*this->f.getValue<1,0,0>(v) +
-					    this->f.getValue<0,1,0>(v)*this->f.getValue<0,1,0>(v)) );
+   return sign( this->f.getValue< 0, 0, 0 >( v ) )
+        * ( 1
+            - sqrt( this->f.getValue< 1, 0, 0 >( v ) * this->f.getValue< 1, 0, 0 >( v )
+                    + this->f.getValue< 0, 1, 0 >( v ) * this->f.getValue< 0, 1, 0 >( v ) ) );
 }
 
 template< typename function, int Dimensions, typename Real >
-   template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
-Real SDFSchemeTest< function, 3, Real >::getValue( const Point& v,
-              const Real& time = 0.0 ) const
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
+Real
+SDFSchemeTest< function, 3, Real >::getValue( const Point& v, const Real& time = 0.0 ) const
 {
-	   if( YDiffOrder != 0 || ZDiffOrder != 0 || XDiffOrder != 0 )
-	      return 0.0;
+   if( YDiffOrder != 0 || ZDiffOrder != 0 || XDiffOrder != 0 )
+      return 0.0;
 
-	   return sign( this->f.getValue<0,0,0>(v))*
-			   ( 1.0-sqrt(this->f.getValue<1,0,0>(v)*this->f.getValue<1,0,0>(v) +
-					      this->f.getValue<0,1,0>(v)*this->f.getValue<0,1,0>(v) +
-					      this->f.getValue<0,0,1>(v)*this->f.getValue<0,0,1>(v)) );
+   return sign( this->f.getValue< 0, 0, 0 >( v ) )
+        * ( 1.0
+            - sqrt( this->f.getValue< 1, 0, 0 >( v ) * this->f.getValue< 1, 0, 0 >( v )
+                    + this->f.getValue< 0, 1, 0 >( v ) * this->f.getValue< 0, 1, 0 >( v )
+                    + this->f.getValue< 0, 0, 1 >( v ) * this->f.getValue< 0, 0, 1 >( v ) ) );
 }
 
-      } // namespace Analytic
-   } // namespace Functions
-} // namespace TNL
-
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/Analytic/SinBumps.h b/src/TNL/Functions/Analytic/SinBumps.h
index ebf84ad72f696c3ed6b344a19a129919aba4aa0b..32930993d8c380a67594b251c12a85f2ae4d2e97 100644
--- a/src/TNL/Functions/Analytic/SinBumps.h
+++ b/src/TNL/Functions/Analytic/SinBumps.h
@@ -8,7 +8,7 @@
  * Tomas Sobotik
  */
 
-#pragma once 
+#pragma once
 
 #include <TNL/Config/ParameterContainer.h>
 #include <TNL/Containers/StaticVector.h>
@@ -16,136 +16,130 @@
 
 namespace TNL {
 namespace Functions {
-namespace Analytic {   
+namespace Analytic {
 
 template< typename Point >
 class SinBumpsBase : public Domain< Point::getSize(), SpaceDomain >
 {
-   public:
- 
-      typedef Point PointType;
-      typedef typename Point::RealType RealType;
-      enum { Dimension = PointType::getSize() };
+public:
+   using PointType = Point;
+   using RealType = typename Point::RealType;
+   enum
+   {
+      Dimension = PointType::getSize()
+   };
 
-      void setWaveLength( const PointType& waveLength );
+   void
+   setWaveLength( const PointType& waveLength );
 
-      const PointType& getWaveLength() const;
+   const PointType&
+   getWaveLength() const;
 
-      void setAmplitude( const RealType& amplitude );
+   void
+   setAmplitude( const RealType& amplitude );
 
-      const RealType& getAmplitude() const;
+   const RealType&
+   getAmplitude() const;
 
-      void setPhase( const PointType& phase );
+   void
+   setPhase( const PointType& phase );
 
-      const PointType& getPhase() const;
+   const PointType&
+   getPhase() const;
 
-      void setWavesNumber( const PointType& wavesNumber );
+   void
+   setWavesNumber( const PointType& wavesNumber );
 
-      const PointType& getWavesNumber() const;
+   const PointType&
+   getWavesNumber() const;
 
-   protected:
+protected:
+   RealType amplitude;
 
-      RealType amplitude;
-
-      PointType waveLength, wavesNumber, phase;
+   PointType waveLength, wavesNumber, phase;
 };
 
 template< int Dimension, typename Real >
 class SinBumps
-{
-};
+{};
 
 template< typename Real >
-class SinBumps< 1, Real  > : public SinBumpsBase< Containers::StaticVector< 1, Real > >
+class SinBumps< 1, Real > : public SinBumpsBase< Containers::StaticVector< 1, Real > >
 {
-   public:
- 
-      typedef Real RealType;
-      typedef Containers::StaticVector< 1, RealType > PointType;
-
-      SinBumps();
-
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" );
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                                     const Real& time = 0.0 ) const;
- 
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< 1, RealType >;
+
+   SinBumps();
+
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
    __cuda_callable__
-   RealType operator()( const PointType& v,
-                        const Real& time = 0.0 ) const;
- 
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
 class SinBumps< 2, Real > : public SinBumpsBase< Containers::StaticVector< 2, Real > >
 {
-   public:
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< 2, RealType >;
 
-      typedef Real RealType;
-      typedef Containers::StaticVector< 2, RealType > PointType;
- 
+   SinBumps();
 
-      SinBumps();
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-      bool setup( const Config::ParameterContainer& parameters,
-                 const String& prefix = "" );
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
 
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                                     const Real& time = 0.0 ) const;
- 
    __cuda_callable__
-   RealType operator()( const PointType& v,
-                        const Real& time = 0.0 ) const;
- 
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
 class SinBumps< 3, Real > : public SinBumpsBase< Containers::StaticVector< 3, Real > >
 {
-   public:
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< 3, RealType >;
 
-      typedef Real RealType;
-      typedef Containers::StaticVector< 3, RealType > PointType;
+   SinBumps();
 
-      SinBumps();
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" );
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
 
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                         const Real& time = 0.0 ) const;
- 
    __cuda_callable__
-   RealType operator()( const PointType& v,
-                        const Real& time = 0.0 ) const;
- 
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
-template< int Dimension,
-          typename Real >
-std::ostream& operator << ( std::ostream& str, const SinBumps< Dimension, Real >& f )
+template< int Dimension, typename Real >
+std::ostream&
+operator<<( std::ostream& str, const SinBumps< Dimension, Real >& f )
 {
-   str << "Sin Bumps. function: amplitude = " << f.getAmplitude()
-       << " wavelength = " << f.getWaveLength()
+   str << "Sin Bumps. function: amplitude = " << f.getAmplitude() << " wavelength = " << f.getWaveLength()
        << " phase = " << f.getPhase();
    return str;
 }
 
-} // namespace Analytic
-} // namespace Functions
-} // namespace TNL
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
 
 #include <TNL/Functions/Analytic/SinBumps_impl.h>
diff --git a/src/TNL/Functions/Analytic/SinBumpsSDF.h b/src/TNL/Functions/Analytic/SinBumpsSDF.h
index f974c78924be3415411d4e7d5e21632a77e05e3f..7d641c8ecb82410a36ea04ef5f88367bdedff8d0 100644
--- a/src/TNL/Functions/Analytic/SinBumpsSDF.h
+++ b/src/TNL/Functions/Analytic/SinBumpsSDF.h
@@ -4,147 +4,138 @@
 //
 // SPDX-License-Identifier: MIT
 
-#pragma once 
+#pragma once
 
 #include <TNL/Config/ParameterContainer.h>
 #include <TNL/Containers/StaticVector.h>
 #include <TNL/Functions/Domain.h>
 
 namespace TNL {
-   namespace Functions {
-      namespace Analytic {
-
+namespace Functions {
+namespace Analytic {
 
 template< typename Point >
 class SinBumpsSDFBase : public Domain< Point::getSize(), SpaceDomain >
 {
-   public:
-
-      typedef Point PointType;
-      typedef typename Point::RealType RealType;
-      enum { Dimensions = PointType::getSize() };
-
-      void setWaveLength( const PointType& waveLength );
+public:
+   using PointType = Point;
+   using RealType = typename Point::RealType;
+   enum
+   {
+      Dimensions = PointType::getSize()
+   };
 
-      const PointType& getWaveLength() const;
+   void
+   setWaveLength( const PointType& waveLength );
 
-      void setAmplitude( const RealType& amplitude );
+   const PointType&
+   getWaveLength() const;
 
-      const RealType& getAmplitude() const;
+   void
+   setAmplitude( const RealType& amplitude );
 
-      void setPhase( const PointType& phase );
+   const RealType&
+   getAmplitude() const;
 
-      const PointType& getPhase() const;
+   void
+   setPhase( const PointType& phase );
 
-      void setWavesNumber( const PointType& wavesNumber );
+   const PointType&
+   getPhase() const;
 
-      const PointType& getWavesNumber() const;
+   void
+   setWavesNumber( const PointType& wavesNumber );
 
-   protected:
+   const PointType&
+   getWavesNumber() const;
 
-      RealType amplitude;
+protected:
+   RealType amplitude;
 
-      PointType waveLength, phase, wavesNumber;
+   PointType waveLength, phase, wavesNumber;
 };
 
 template< int Dimensions, typename Real >
 class SinBumpsSDF
-{
-};
+{};
 
 template< typename Real >
-class SinBumpsSDF< 1, Real  > : public SinBumpsSDFBase< Containers::StaticVector< 1, Real > >
+class SinBumpsSDF< 1, Real > : public SinBumpsSDFBase< Containers::StaticVector< 1, Real > >
 {
-   public:
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< 1, RealType >;
 
-      typedef Real RealType;
-      typedef Containers::StaticVector< 1, RealType > PointType;
+   SinBumpsSDF();
 
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-      SinBumpsSDF();
-
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" );
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                                     const Real& time = 0.0 ) const;
-
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
    __cuda_callable__
-   RealType operator()( const PointType& v,
-                        const Real& time = 0.0 ) const;
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
 
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
 class SinBumpsSDF< 2, Real > : public SinBumpsSDFBase< Containers::StaticVector< 2, Real > >
 {
-   public:
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< 2, RealType >;
 
-      typedef Real RealType;
-      typedef Containers::StaticVector< 2, RealType > PointType;
+   SinBumpsSDF();
 
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-      SinBumpsSDF();
-
-      bool setup( const Config::ParameterContainer& parameters,
-                 const String& prefix = "" );
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                                     const Real& time = 0.0 ) const;
-
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
    __cuda_callable__
-   RealType operator()( const PointType& v,
-                        const Real& time = 0.0 ) const;
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
 
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
 class SinBumpsSDF< 3, Real > : public SinBumpsSDFBase< Containers::StaticVector< 3, Real > >
 {
-   public:
-
-      typedef Real RealType;
-      typedef Containers::StaticVector< 3, RealType > PointType;
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< 3, RealType >;
 
-      SinBumpsSDF();
+   SinBumpsSDF();
 
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" );
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                         const Real& time = 0.0 ) const;
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
    __cuda_callable__
-   RealType operator()( const PointType& v,
-                        const Real& time = 0.0 ) const;
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
 
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
-template< int Dimensions,
-          typename Real >
-std::ostream& operator << ( std::ostream& str, const SinBumpsSDF< Dimensions, Real >& f )
+template< int Dimensions, typename Real >
+std::ostream&
+operator<<( std::ostream& str, const SinBumpsSDF< Dimensions, Real >& f )
 {
-   str << "SDF Sin Bumps SDF. function: amplitude = " << f.getAmplitude()
-       << " wavelength = " << f.getWaveLength()
+   str << "SDF Sin Bumps SDF. function: amplitude = " << f.getAmplitude() << " wavelength = " << f.getWaveLength()
        << " phase = " << f.getPhase();
    return str;
 }
 
-
-      } // namespace Analytic
-   } // namespace Functions
-} // namespace TNL
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
 
 #include <TNL/Functions/Analytic/SinBumpsSDF_impl.h>
diff --git a/src/TNL/Functions/Analytic/SinBumpsSDF_impl.h b/src/TNL/Functions/Analytic/SinBumpsSDF_impl.h
index 4014de452c77cece47818de89d41af754f188308..a9cd800e3e7542e74dc9ff66fe5d10fe673e3b1b 100644
--- a/src/TNL/Functions/Analytic/SinBumpsSDF_impl.h
+++ b/src/TNL/Functions/Analytic/SinBumpsSDF_impl.h
@@ -4,46 +4,52 @@
 //
 // SPDX-License-Identifier: MIT
 
-#pragma once 
+#pragma once
 
 #include <TNL/Functions/Analytic/SinBumpsSDF.h>
 
 namespace TNL {
-   namespace Functions {
-      namespace Analytic {
+namespace Functions {
+namespace Analytic {
 
 template< typename Point >
-void SinBumpsSDFBase< Point >::setWaveLength( const Point& waveLength )
+void
+SinBumpsSDFBase< Point >::setWaveLength( const Point& waveLength )
 {
    this->waveLength = waveLength;
 }
 
 template< typename Point >
-const Point& SinBumpsSDFBase< Point >::getWaveLength() const
+const Point&
+SinBumpsSDFBase< Point >::getWaveLength() const
 {
    return this->waveLength;
 }
 
 template< typename Point >
-void SinBumpsSDFBase< Point >::setAmplitude( const typename Point::RealType& amplitude )
+void
+SinBumpsSDFBase< Point >::setAmplitude( const typename Point::RealType& amplitude )
 {
    this->amplitude = amplitude;
 }
 
 template< typename Point >
-const typename Point::RealType& SinBumpsSDFBase< Point >::getAmplitude() const
+const typename Point::RealType&
+SinBumpsSDFBase< Point >::getAmplitude() const
 {
    return this->amplitude;
 }
 
 template< typename Point >
-void SinBumpsSDFBase< Point >::setPhase( const Point& phase )
+void
+SinBumpsSDFBase< Point >::setPhase( const Point& phase )
 {
    this->phase = phase;
 }
 
 template< typename Point >
-const Point& SinBumpsSDFBase< Point >::getPhase() const
+const Point&
+SinBumpsSDFBase< Point >::getPhase() const
 {
    return this->phase;
 }
@@ -53,44 +59,37 @@ const Point& SinBumpsSDFBase< Point >::getPhase() const
  */
 
 template< typename Real >
-SinBumpsSDF< 1, Real >::SinBumpsSDF()
-{
-}
+SinBumpsSDF< 1, Real >::SinBumpsSDF() = default;
 
 template< typename Real >
-bool SinBumpsSDF< 1, Real >::setup( const Config::ParameterContainer& parameters,
-        const String& prefix)
+bool
+SinBumpsSDF< 1, Real >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
-   this->amplitude = parameters.getParameter< double >( prefix+"amplitude" );
-   this->waveLength.x() = parameters.getParameter< double >( prefix+"wave-length-x" );
-   while(this->waveLength.x() > 2.0*M_PI)
-	   this->waveLength.x() -= 2.0*M_PI;
-   this->wavesNumber.x() = ceil( parameters.getParameter< double >( prefix+"waves-number-x" ) );
-   this->phase.x() = parameters.getParameter< double >( prefix+"phase-x" );
+   this->amplitude = parameters.getParameter< double >( prefix + "amplitude" );
+   this->waveLength.x() = parameters.getParameter< double >( prefix + "wave-length-x" );
+   while( this->waveLength.x() > 2.0 * M_PI )
+      this->waveLength.x() -= 2.0 * M_PI;
+   this->wavesNumber.x() = ceil( parameters.getParameter< double >( prefix + "waves-number-x" ) );
+   this->phase.x() = parameters.getParameter< double >( prefix + "phase-x" );
    return true;
 }
 
-
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-SinBumpsSDF< 1, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+SinBumpsSDF< 1, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
    const RealType& x = v.x();
-   RealType xp = abs( x ) + sign( x ) * this->phase.x() * this->waveLength.x() / ( 2.0*M_PI );
+   RealType xp = abs( x ) + sign( x ) * this->phase.x() * this->waveLength.x() / ( 2.0 * M_PI );
    if( this->wavesNumber.x() != 0.0 && xp > this->wavesNumber.x() * this->waveLength.x() )
       return 0.0;
    if( YDiffOrder != 0 || ZDiffOrder != 0 )
       return 0.0;
    if( XDiffOrder == 0 )
-      return sign( xp - round( (2.0 * xp ) / this->waveLength.x() ) * this->waveLength.x() / 2.0 )
-          * ( xp- round((2.0 * xp)/this->waveLength.x())* this->waveLength.x()/2.0)
-          * sign( ::sin(this-> phase.x() + 2.0 * M_PI * x / this->waveLength.x()));
+      return sign( xp - round( ( 2.0 * xp ) / this->waveLength.x() ) * this->waveLength.x() / 2.0 )
+           * ( xp - round( ( 2.0 * xp ) / this->waveLength.x() ) * this->waveLength.x() / 2.0 )
+           * sign( ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() ) );
    if( XDiffOrder == 1 )
       return 1.0;
    return 0.0;
@@ -101,61 +100,54 @@ getPartialDerivative( const PointType& v,
  */
 
 template< typename Real >
-SinBumpsSDF< 2, Real >::SinBumpsSDF()
-{
-}
+SinBumpsSDF< 2, Real >::SinBumpsSDF() = default;
 
 template< typename Real >
-bool SinBumpsSDF< 2, Real >::setup( const Config::ParameterContainer& parameters,
-        const String& prefix )
+bool
+SinBumpsSDF< 2, Real >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
-   this->amplitude = parameters.getParameter< double >( prefix+"amplitude" );
-   this->waveLength.x() = parameters.getParameter< double >( prefix+"wave-length-x" );
-   this->waveLength.y() = parameters.getParameter< double >( prefix+"wave-length-y" );
-   while(this->waveLength.x() > 2.0*M_PI)
-	   this->waveLength.x() -= 2.0*M_PI;
-   while(this->waveLength.y() > 2.0*M_PI)
-	   this->waveLength.y() -= 2.0*M_PI;
-   this->wavesNumber.x() = ceil( parameters.getParameter< double >( prefix+"waves-number-x" ) );
-   this->wavesNumber.y() = ceil( parameters.getParameter< double >( prefix+"waves-number-y" ) );
-   this->phase.x() = parameters.getParameter< double >( prefix+"phase-x" );
-   this->phase.y() = parameters.getParameter< double >( prefix+"phase-y" );
+   this->amplitude = parameters.getParameter< double >( prefix + "amplitude" );
+   this->waveLength.x() = parameters.getParameter< double >( prefix + "wave-length-x" );
+   this->waveLength.y() = parameters.getParameter< double >( prefix + "wave-length-y" );
+   while( this->waveLength.x() > 2.0 * M_PI )
+      this->waveLength.x() -= 2.0 * M_PI;
+   while( this->waveLength.y() > 2.0 * M_PI )
+      this->waveLength.y() -= 2.0 * M_PI;
+   this->wavesNumber.x() = ceil( parameters.getParameter< double >( prefix + "waves-number-x" ) );
+   this->wavesNumber.y() = ceil( parameters.getParameter< double >( prefix + "waves-number-y" ) );
+   this->phase.x() = parameters.getParameter< double >( prefix + "phase-x" );
+   this->phase.y() = parameters.getParameter< double >( prefix + "phase-y" );
    return true;
 }
 
-
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-SinBumpsSDF< 2, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+SinBumpsSDF< 2, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
-	   const RealType& x = v.x();
-	   const RealType& y = v.y();
-	   RealType xp = ::sqrt(x*x) + sign( x ) * this->phase.x() * this->waveLength.x() / (2.0*M_PI);
-	   RealType yp = ::sqrt(y*y) + sign( y ) * this->phase.y() * this->waveLength.y() / (2.0*M_PI);
-	   if( ( xp > this->wavesNumber.x()*this->waveLength.x() && this->wavesNumber.x() != 0.0 )  ||
-			 ( yp > this->wavesNumber.y()*this->waveLength.y() && this->wavesNumber.y() != 0.0 ) )
-		   return 0.0;
-	   const RealType sx = sign(xp - round((2.0 * xp)/this->waveLength.x())* this->waveLength.x()/2.0)
-	  		  		    *(xp - round((2.0 * xp)/this->waveLength.x())* this->waveLength.x()/2.0);
-	   const RealType sy = sign(yp - round((2.0 * yp)/this->waveLength.y())* this->waveLength.y()/2.0)
-	  		  		    *(yp - round((2.0 * yp)/this->waveLength.y())* this->waveLength.y()/2.0);
-	   RealType sxy;
-	   if(sx < sy)
-		   sxy = sx;
-	   else
-		   sxy = sy;
-	   if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 )
-	   {
-		      return sxy * sign( ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() )
-		      	  	  	       * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() ) );
-	   }
-	   return 0.0;
+   const RealType& x = v.x();
+   const RealType& y = v.y();
+   RealType xp = ::sqrt( x * x ) + sign( x ) * this->phase.x() * this->waveLength.x() / ( 2.0 * M_PI );
+   RealType yp = ::sqrt( y * y ) + sign( y ) * this->phase.y() * this->waveLength.y() / ( 2.0 * M_PI );
+   if( ( xp > this->wavesNumber.x() * this->waveLength.x() && this->wavesNumber.x() != 0.0 )
+       || ( yp > this->wavesNumber.y() * this->waveLength.y() && this->wavesNumber.y() != 0.0 ) )
+      return 0.0;
+   const RealType sx = sign( xp - round( ( 2.0 * xp ) / this->waveLength.x() ) * this->waveLength.x() / 2.0 )
+                     * ( xp - round( ( 2.0 * xp ) / this->waveLength.x() ) * this->waveLength.x() / 2.0 );
+   const RealType sy = sign( yp - round( ( 2.0 * yp ) / this->waveLength.y() ) * this->waveLength.y() / 2.0 )
+                     * ( yp - round( ( 2.0 * yp ) / this->waveLength.y() ) * this->waveLength.y() / 2.0 );
+   RealType sxy;
+   if( sx < sy )
+      sxy = sx;
+   else
+      sxy = sy;
+   if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 ) {
+      return sxy
+           * sign( ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() )
+                   * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() ) );
+   }
+   return 0.0;
 }
 
 /****
@@ -163,76 +155,69 @@ getPartialDerivative( const PointType& v,
  */
 
 template< typename Real >
-SinBumpsSDF< 3, Real >::SinBumpsSDF()
-{
-}
+SinBumpsSDF< 3, Real >::SinBumpsSDF() = default;
 
 template< typename Real >
-bool SinBumpsSDF< 3, Real >::setup( const Config::ParameterContainer& parameters,
-        const String& prefix )
+bool
+SinBumpsSDF< 3, Real >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
-   this->amplitude = parameters.getParameter< double >( prefix+"amplitude" );
-   this->waveLength.x() = parameters.getParameter< double >( prefix+"wave-length-x" );
-   this->waveLength.y() = parameters.getParameter< double >( prefix+"wave-length-y" );
-   this->waveLength.z() = parameters.getParameter< double >( prefix+"wave-length-z" );
-   while(this->waveLength.x() > 2.0*M_PI)
-	   this->waveLength.x() -= 2.0*M_PI;
-   while(this->waveLength.y() > 2.0*M_PI)
-	   this->waveLength.y() -= 2.0*M_PI;
-   while(this->waveLength.z() > 2.0*M_PI)
-	   this->waveLength.z() -= 2.0*M_PI;
-   this->wavesNumber.x() = ceil( parameters.getParameter< double >( prefix+"waves-number-x" ) );
-   this->wavesNumber.y() = ceil( parameters.getParameter< double >( prefix+"waves-number-y" ) );
-   this->wavesNumber.z() = ceil( parameters.getParameter< double >( prefix+"waves-number-z" ) );
-   this->phase.x() = parameters.getParameter< double >( prefix+"phase-x" );
-   this->phase.y() = parameters.getParameter< double >( prefix+"phase-y" );
-   this->phase.z() = parameters.getParameter< double >(prefix+"phase-z" );
+   this->amplitude = parameters.getParameter< double >( prefix + "amplitude" );
+   this->waveLength.x() = parameters.getParameter< double >( prefix + "wave-length-x" );
+   this->waveLength.y() = parameters.getParameter< double >( prefix + "wave-length-y" );
+   this->waveLength.z() = parameters.getParameter< double >( prefix + "wave-length-z" );
+   while( this->waveLength.x() > 2.0 * M_PI )
+      this->waveLength.x() -= 2.0 * M_PI;
+   while( this->waveLength.y() > 2.0 * M_PI )
+      this->waveLength.y() -= 2.0 * M_PI;
+   while( this->waveLength.z() > 2.0 * M_PI )
+      this->waveLength.z() -= 2.0 * M_PI;
+   this->wavesNumber.x() = ceil( parameters.getParameter< double >( prefix + "waves-number-x" ) );
+   this->wavesNumber.y() = ceil( parameters.getParameter< double >( prefix + "waves-number-y" ) );
+   this->wavesNumber.z() = ceil( parameters.getParameter< double >( prefix + "waves-number-z" ) );
+   this->phase.x() = parameters.getParameter< double >( prefix + "phase-x" );
+   this->phase.y() = parameters.getParameter< double >( prefix + "phase-y" );
+   this->phase.z() = parameters.getParameter< double >( prefix + "phase-z" );
    return true;
 }
 
-
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-SinBumpsSDF< 3, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+SinBumpsSDF< 3, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
-	   const RealType& x = v.x();
-	   const RealType& y = v.y();
-	   const RealType& z = v.z();
-	   RealType xp = ::sqrt(x*x) + sign(x)*(this->phase.x())*(this->waveLength.x())/(2.0*M_PI);
-	   RealType yp = ::sqrt(y*y) + sign(y)*(this->phase.y())*(this->waveLength.y())/(2.0*M_PI);
-	   RealType zp = ::sqrt(z*z) + sign(z)*(this->phase.z())*(this->waveLength.z())/(2.0*M_PI);
-	   if ( ( xp > this->wavesNumber.x()*this->waveLength.x() && this->wavesNumber.x() != 0.0 ) ||
-			(yp > this->wavesNumber.y()*this->waveLength.y() && this->wavesNumber.y() != 0.0 ) ||
-			(::sqrt(z*z) > this->wavesNumber.z()*this->waveLength.z() && this->wavesNumber.z() != 0.0 ) )
-		   return 0.0;
-	   const RealType sx = sign(xp - round((2.0 * xp)/this->waveLength.x())* this->waveLength.x()/2.0)
-	  		  		    *(xp - round((2.0 * xp)/this->waveLength.x())* this->waveLength.x()/2.0);
-	   const RealType sy = sign(yp - round((2.0 * yp)/this->waveLength.y())* this->waveLength.y()/2.0)
-	  		  		    *(yp - round((2.0 * yp)/this->waveLength.y())* this->waveLength.y()/2.0);
-	   const RealType sz = sign(zp - round((2.0 * zp)/this->waveLength.z())* this->waveLength.z()/2.0)
-	  		  		    *(zp - round((2.0 * zp)/this->waveLength.z())* this->waveLength.z()/2.0);
-	   RealType sxyz;
-	   if(sx <= sy && sx <= sz)
-		   sxyz = sx;
-	   else if ( sy <= sx && sy <= sz)
-		   sxyz = sy;
-	   else
-		   sxyz = sz;
-	   if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 )
-	   {
-	      return sxyz * sign( ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() )
-	      	  	     	  	* ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() )
-	      	  	  	  	  	* ::sin( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() ) );
-	   }
-	   return 0.0;
+   const RealType& x = v.x();
+   const RealType& y = v.y();
+   const RealType& z = v.z();
+   RealType xp = ::sqrt( x * x ) + sign( x ) * ( this->phase.x() ) * ( this->waveLength.x() ) / ( 2.0 * M_PI );
+   RealType yp = ::sqrt( y * y ) + sign( y ) * ( this->phase.y() ) * ( this->waveLength.y() ) / ( 2.0 * M_PI );
+   RealType zp = ::sqrt( z * z ) + sign( z ) * ( this->phase.z() ) * ( this->waveLength.z() ) / ( 2.0 * M_PI );
+   if( ( xp > this->wavesNumber.x() * this->waveLength.x() && this->wavesNumber.x() != 0.0 )
+       || ( yp > this->wavesNumber.y() * this->waveLength.y() && this->wavesNumber.y() != 0.0 )
+       || ( ::sqrt( z * z ) > this->wavesNumber.z() * this->waveLength.z() && this->wavesNumber.z() != 0.0 ) )
+      return 0.0;
+   const RealType sx = sign( xp - round( ( 2.0 * xp ) / this->waveLength.x() ) * this->waveLength.x() / 2.0 )
+                     * ( xp - round( ( 2.0 * xp ) / this->waveLength.x() ) * this->waveLength.x() / 2.0 );
+   const RealType sy = sign( yp - round( ( 2.0 * yp ) / this->waveLength.y() ) * this->waveLength.y() / 2.0 )
+                     * ( yp - round( ( 2.0 * yp ) / this->waveLength.y() ) * this->waveLength.y() / 2.0 );
+   const RealType sz = sign( zp - round( ( 2.0 * zp ) / this->waveLength.z() ) * this->waveLength.z() / 2.0 )
+                     * ( zp - round( ( 2.0 * zp ) / this->waveLength.z() ) * this->waveLength.z() / 2.0 );
+   RealType sxyz;
+   if( sx <= sy && sx <= sz )
+      sxyz = sx;
+   else if( sy <= sx && sy <= sz )
+      sxyz = sy;
+   else
+      sxyz = sz;
+   if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 ) {
+      return sxyz
+           * sign( ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() )
+                   * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() )
+                   * ::sin( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() ) );
+   }
+   return 0.0;
 }
 
-      } // namespace Analytic
-   } // namespace Fucntions
-} // namespace TNL
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/Analytic/SinBumps_impl.h b/src/TNL/Functions/Analytic/SinBumps_impl.h
index 9dcaa961cb82da055e510798c8e97227f88f0a22..718d2c743e08eeb4bddf316a4fd1790280dea8fa 100644
--- a/src/TNL/Functions/Analytic/SinBumps_impl.h
+++ b/src/TNL/Functions/Analytic/SinBumps_impl.h
@@ -13,52 +13,60 @@
 
 namespace TNL {
 namespace Functions {
-namespace Analytic {   
+namespace Analytic {
 
 template< typename Point >
-void SinBumpsBase< Point >::setWaveLength( const Point& waveLength )
+void
+SinBumpsBase< Point >::setWaveLength( const Point& waveLength )
 {
    this->waveLength = waveLength;
 }
 
 template< typename Point >
-const Point& SinBumpsBase< Point >::getWaveLength() const
+const Point&
+SinBumpsBase< Point >::getWaveLength() const
 {
    return this->waveLength;
 }
 
 template< typename Point >
-void SinBumpsBase< Point >::setAmplitude( const typename Point::RealType& amplitude )
+void
+SinBumpsBase< Point >::setAmplitude( const typename Point::RealType& amplitude )
 {
    this->amplitude = amplitude;
 }
 
 template< typename Point >
-const typename Point::RealType& SinBumpsBase< Point >::getAmplitude() const
+const typename Point::RealType&
+SinBumpsBase< Point >::getAmplitude() const
 {
    return this->amplitude;
 }
 
 template< typename Point >
-void SinBumpsBase< Point >::setPhase( const Point& phase )
+void
+SinBumpsBase< Point >::setPhase( const Point& phase )
 {
    this->phase = phase;
 }
 
 template< typename Point >
-const Point& SinBumpsBase< Point >::getPhase() const
+const Point&
+SinBumpsBase< Point >::getPhase() const
 {
    return this->phase;
 }
 
 template< typename Point >
-void SinBumpsBase< Point >::setWavesNumber( const Point& wavesNumber )
+void
+SinBumpsBase< Point >::setWavesNumber( const Point& wavesNumber )
 {
    this->wavesNumber = wavesNumber;
 }
 
 template< typename Point >
-const Point& SinBumpsBase< Point >::getWavesNumber() const
+const Point&
+SinBumpsBase< Point >::getWavesNumber() const
 {
    return this->wavesNumber;
 }
@@ -67,127 +75,121 @@ const Point& SinBumpsBase< Point >::getWavesNumber() const
  * 1D
  */
 template< typename Real >
-SinBumps< 1, Real >::SinBumps()
-{
-}
+SinBumps< 1, Real >::SinBumps() = default;
 
 template< typename Real >
-bool SinBumps< 1, Real >::setup( const Config::ParameterContainer& parameters,
-                                           const String& prefix )
+bool
+SinBumps< 1, Real >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    this->amplitude = parameters.getParameter< double >( prefix + "amplitude" );
    this->waveLength.x() = parameters.getParameter< double >( prefix + "wave-length-x" );
    this->phase.x() = parameters.getParameter< double >( prefix + "phase-x" );
-   this->wavesNumber.x() = ceil( parameters.getParameter< double >( prefix+"waves-number-x" ) );
+   this->wavesNumber.x() = ceil( parameters.getParameter< double >( prefix + "waves-number-x" ) );
    return true;
 }
 
-
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-SinBumps< 1, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+SinBumps< 1, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
    if( YDiffOrder != 0 || ZDiffOrder != 0 )
       return 0.0;
-   
+
    const RealType& x = v.x();
-   const RealType xp = abs( x ) + sign( x ) * this->phase.x() * this->waveLength.x() / (2.0*M_PI);
+   const RealType xp = abs( x ) + sign( x ) * this->phase.x() * this->waveLength.x() / ( 2.0 * M_PI );
    if( this->wavesNumber.x() != 0.0 && xp > this->waveLength.x() * this->wavesNumber.x() )
       return 0.0;
-  
+
    if( XDiffOrder == 0 )
       return this->amplitude * ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() );
    if( XDiffOrder == 1 )
-      return 2.0 * M_PI / this->waveLength.x() * this->amplitude * ::cos( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() );
+      return 2.0 * M_PI / this->waveLength.x() * this->amplitude
+           * ::cos( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() );
    if( XDiffOrder == 2 )
-      return -4.0 * M_PI * M_PI / ( this->waveLength.x() * this->waveLength.x() ) * this->amplitude * ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() );
+      return -4.0 * M_PI * M_PI / ( this->waveLength.x() * this->waveLength.x() ) * this->amplitude
+           * ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() );
    return 0.0;
 }
 
 template< typename Real >
 __cuda_callable__
 Real
-SinBumps< 1, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+SinBumps< 1, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-
 /****
  * 2D
  */
 template< typename Real >
-SinBumps< 2, Real >::SinBumps()
-{
-}
+SinBumps< 2, Real >::SinBumps() = default;
 
 template< typename Real >
-bool SinBumps< 2, Real >::setup( const Config::ParameterContainer& parameters,
-                                            const String& prefix )
+bool
+SinBumps< 2, Real >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    this->amplitude = parameters.getParameter< double >( prefix + "amplitude" );
    this->waveLength.x() = parameters.getParameter< double >( prefix + "wave-length-x" );
    this->waveLength.y() = parameters.getParameter< double >( prefix + "wave-length-y" );
    this->phase.x() = parameters.getParameter< double >( prefix + "phase-x" );
    this->phase.y() = parameters.getParameter< double >( prefix + "phase-y" );
-   this->wavesNumber.x() = ceil( parameters.getParameter< double >( prefix+"waves-number-x" ) );
-   this->wavesNumber.y() = ceil( parameters.getParameter< double >( prefix+"waves-number-y" ) );
+   this->wavesNumber.x() = ceil( parameters.getParameter< double >( prefix + "waves-number-x" ) );
+   this->wavesNumber.y() = ceil( parameters.getParameter< double >( prefix + "waves-number-y" ) );
    return true;
 }
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-SinBumps< 2, Real>::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+SinBumps< 2, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
    if( ZDiffOrder != 0 )
       return 0.0;
 
    const RealType& x = v.x();
    const RealType& y = v.y();
-   const RealType xp = abs( x ) + sign( x ) * this->phase.x() * this->waveLength.x() / (2.0*M_PI);
-   const RealType yp = abs( y ) + sign( y ) * this->phase.y() * this->waveLength.y() / (2.0*M_PI);
-   //std::cerr << "this->wavesNumber.x() = " << this->wavesNumber.x() << "fabs( x ) = " << fabs( x ) << " 2.0*M_PI * this->waveLength.x() * this->wavesNumber.x() = " << 2.0*M_PI * this->waveLength.x() * this->wavesNumber.x() << std::endl;
-   if( ( this->wavesNumber.x() != 0.0 && xp > this->waveLength.x() * this->wavesNumber.x() ) ||
-       ( this->wavesNumber.y() != 0.0 && yp > this->waveLength.y() * this->wavesNumber.y() ) )
+   const RealType xp = abs( x ) + sign( x ) * this->phase.x() * this->waveLength.x() / ( 2.0 * M_PI );
+   const RealType yp = abs( y ) + sign( y ) * this->phase.y() * this->waveLength.y() / ( 2.0 * M_PI );
+   // std::cerr << "this->wavesNumber.x() = " << this->wavesNumber.x() << "fabs( x ) = " << fabs( x ) << " 2.0*M_PI *
+   // this->waveLength.x() * this->wavesNumber.x() = " << 2.0*M_PI * this->waveLength.x() * this->wavesNumber.x() << std::endl;
+   if( ( this->wavesNumber.x() != 0.0 && xp > this->waveLength.x() * this->wavesNumber.x() )
+       || ( this->wavesNumber.y() != 0.0 && yp > this->waveLength.y() * this->wavesNumber.y() ) )
       return 0.0;
-   
+
    if( XDiffOrder == 0 && YDiffOrder == 0 )
-      return this->amplitude *
-             ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() ) *
-             ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() );
+      return this->amplitude * ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() )
+           * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() );
    if( XDiffOrder == 1 && YDiffOrder == 0 )
-      return 2.0 * M_PI / this->waveLength.x() * this->amplitude * ::cos( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() ) * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() );
+      return 2.0 * M_PI / this->waveLength.x() * this->amplitude
+           * ::cos( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() )
+           * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() );
    if( XDiffOrder == 2 && YDiffOrder == 0 )
-      return -4.0 * M_PI * M_PI / ( this->waveLength.x() * this->waveLength.x() ) * this->amplitude * ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() ) * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() );
+      return -4.0 * M_PI * M_PI / ( this->waveLength.x() * this->waveLength.x() ) * this->amplitude
+           * ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() )
+           * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() );
    if( XDiffOrder == 0 && YDiffOrder == 1 )
-      return 2.0 * M_PI / this->waveLength.y() * this->amplitude * ::cos( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() ) * ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() );
+      return 2.0 * M_PI / this->waveLength.y() * this->amplitude
+           * ::cos( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() )
+           * ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() );
    if( XDiffOrder == 0 && YDiffOrder == 2 )
-      return -4.0 * M_PI * M_PI / ( this->waveLength.y() * this->waveLength.y() ) * this->amplitude * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() ) * ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() );
+      return -4.0 * M_PI * M_PI / ( this->waveLength.y() * this->waveLength.y() ) * this->amplitude
+           * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() )
+           * ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() );
    if( XDiffOrder == 1 && YDiffOrder == 1 )
-      return 4.0 * M_PI * M_PI / ( this->waveLength.x() * this->waveLength.y() ) * this->amplitude * ::cos( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() ) * ::cos( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() );
+      return 4.0 * M_PI * M_PI / ( this->waveLength.x() * this->waveLength.y() ) * this->amplitude
+           * ::cos( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() )
+           * ::cos( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() );
    return 0.0;
 }
 
 template< typename Real >
 __cuda_callable__
 Real
-SinBumps< 2, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+SinBumps< 2, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
@@ -196,13 +198,11 @@ operator()( const PointType& v,
  * 3D
  */
 template< typename Real >
-SinBumps< 3, Real >::SinBumps()
-{
-}
+SinBumps< 3, Real >::SinBumps() = default;
 
 template< typename Real >
-bool SinBumps< 3, Real >::setup( const Config::ParameterContainer& parameters,
-                                           const String& prefix )
+bool
+SinBumps< 3, Real >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    this->amplitude = parameters.getParameter< double >( prefix + "amplitude" );
    this->waveLength.x() = parameters.getParameter< double >( prefix + "wave-length-x" );
@@ -211,72 +211,91 @@ bool SinBumps< 3, Real >::setup( const Config::ParameterContainer& parameters,
    this->phase.x() = parameters.getParameter< double >( prefix + "phase-x" );
    this->phase.y() = parameters.getParameter< double >( prefix + "phase-y" );
    this->phase.z() = parameters.getParameter< double >( prefix + "phase-z" );
-   this->wavesNumber.x() = ceil( parameters.getParameter< double >( prefix+"waves-number-x" ) );
-   this->wavesNumber.y() = ceil( parameters.getParameter< double >( prefix+"waves-number-y" ) );
-   this->wavesNumber.z() = ceil( parameters.getParameter< double >( prefix+"waves-number-z" ) );
+   this->wavesNumber.x() = ceil( parameters.getParameter< double >( prefix + "waves-number-x" ) );
+   this->wavesNumber.y() = ceil( parameters.getParameter< double >( prefix + "waves-number-y" ) );
+   this->wavesNumber.z() = ceil( parameters.getParameter< double >( prefix + "waves-number-z" ) );
    return true;
 }
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-SinBumps< 3, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+SinBumps< 3, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
    const RealType& x = v.x();
    const RealType& y = v.y();
    const RealType& z = v.z();
-   
-   const RealType xp = abs( x ) + sign( x ) * this->phase.x() * this->waveLength.x() / (2.0*M_PI);
-   const RealType yp = abs( y ) + sign( y ) * this->phase.y() * this->waveLength.y() / (2.0*M_PI);
-   const RealType zp = abs( z ) + sign( z ) * this->phase.z() * this->waveLength.z() / (2.0*M_PI);
 
-   if( ( this->wavesNumber.x() != 0.0 && xp > this->waveLength.x() * this->wavesNumber.x() ) ||
-       ( this->wavesNumber.y() != 0.0 && yp > this->waveLength.y() * this->wavesNumber.y() ) ||
-       ( this->wavesNumber.z() != 0.0 && zp > this->waveLength.z() * this->wavesNumber.z() ) )
+   const RealType xp = abs( x ) + sign( x ) * this->phase.x() * this->waveLength.x() / ( 2.0 * M_PI );
+   const RealType yp = abs( y ) + sign( y ) * this->phase.y() * this->waveLength.y() / ( 2.0 * M_PI );
+   const RealType zp = abs( z ) + sign( z ) * this->phase.z() * this->waveLength.z() / ( 2.0 * M_PI );
+
+   if( ( this->wavesNumber.x() != 0.0 && xp > this->waveLength.x() * this->wavesNumber.x() )
+       || ( this->wavesNumber.y() != 0.0 && yp > this->waveLength.y() * this->wavesNumber.y() )
+       || ( this->wavesNumber.z() != 0.0 && zp > this->waveLength.z() * this->wavesNumber.z() ) )
       return 0.0;
-   
-   if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0)
-      return this->amplitude *
-             ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() ) *
-             ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() ) *
-             ::sin( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() );
-   if( XDiffOrder == 1 && YDiffOrder == 0 && ZDiffOrder == 0)
-      return 2.0 * M_PI / this->waveLength.x() * this->amplitude * ::cos( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() ) * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() ) * ::sin( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() );
-   if( XDiffOrder == 2 && YDiffOrder == 0 && ZDiffOrder == 0)
-      return -4.0 * M_PI * M_PI / ( this->waveLength.x() * this->waveLength.x() ) * this->amplitude * ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() ) * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() ) * ::sin( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() );
-   if( XDiffOrder == 0 && YDiffOrder == 1 && ZDiffOrder == 0)
-      return 2.0 * M_PI / this->waveLength.y() * this->amplitude * ::cos( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() ) * ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() ) * ::sin( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() );
-   if( XDiffOrder == 0 && YDiffOrder == 2 && ZDiffOrder == 0)
-      return -4.0 * M_PI * M_PI / ( this->waveLength.y() * this->waveLength.y() ) * this->amplitude * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() ) * ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() ) * ::sin( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() );
-   if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 1)
-      return 2.0 * M_PI / this->waveLength.z() * this->amplitude * ::cos( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() ) * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() ) * ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() );
-   if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 2)
-      return -4.0 * M_PI * M_PI / ( this->waveLength.z() * this->waveLength.z() ) * this->amplitude * ::sin( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() ) * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() ) * ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() );
-   if( XDiffOrder == 1 && YDiffOrder == 1 && ZDiffOrder == 0)
-      return 4.0 * M_PI * M_PI / ( this->waveLength.x() * this->waveLength.y() ) * this->amplitude * ::cos( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() ) * ::cos( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() ) * ::sin( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() );
-   if( XDiffOrder == 1 && YDiffOrder == 0 && ZDiffOrder == 1)
-      return 4.0 * M_PI * M_PI / ( this->waveLength.x() * this->waveLength.z() ) * this->amplitude * ::cos( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() ) * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() ) * ::cos( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() );
-   if( XDiffOrder == 0 && YDiffOrder == 1 && ZDiffOrder == 1)
-      return 4.0 * M_PI * M_PI / ( this->waveLength.y() * this->waveLength.z() ) * this->amplitude * ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() ) * ::cos( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() ) * ::cos( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() );
+
+   if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 )
+      return this->amplitude * ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() )
+           * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() )
+           * ::sin( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() );
+   if( XDiffOrder == 1 && YDiffOrder == 0 && ZDiffOrder == 0 )
+      return 2.0 * M_PI / this->waveLength.x() * this->amplitude
+           * ::cos( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() )
+           * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() )
+           * ::sin( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() );
+   if( XDiffOrder == 2 && YDiffOrder == 0 && ZDiffOrder == 0 )
+      return -4.0 * M_PI * M_PI / ( this->waveLength.x() * this->waveLength.x() ) * this->amplitude
+           * ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() )
+           * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() )
+           * ::sin( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() );
+   if( XDiffOrder == 0 && YDiffOrder == 1 && ZDiffOrder == 0 )
+      return 2.0 * M_PI / this->waveLength.y() * this->amplitude
+           * ::cos( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() )
+           * ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() )
+           * ::sin( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() );
+   if( XDiffOrder == 0 && YDiffOrder == 2 && ZDiffOrder == 0 )
+      return -4.0 * M_PI * M_PI / ( this->waveLength.y() * this->waveLength.y() ) * this->amplitude
+           * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() )
+           * ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() )
+           * ::sin( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() );
+   if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 1 )
+      return 2.0 * M_PI / this->waveLength.z() * this->amplitude
+           * ::cos( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() )
+           * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() )
+           * ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() );
+   if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 2 )
+      return -4.0 * M_PI * M_PI / ( this->waveLength.z() * this->waveLength.z() ) * this->amplitude
+           * ::sin( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() )
+           * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() )
+           * ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() );
+   if( XDiffOrder == 1 && YDiffOrder == 1 && ZDiffOrder == 0 )
+      return 4.0 * M_PI * M_PI / ( this->waveLength.x() * this->waveLength.y() ) * this->amplitude
+           * ::cos( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() )
+           * ::cos( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() )
+           * ::sin( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() );
+   if( XDiffOrder == 1 && YDiffOrder == 0 && ZDiffOrder == 1 )
+      return 4.0 * M_PI * M_PI / ( this->waveLength.x() * this->waveLength.z() ) * this->amplitude
+           * ::cos( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() )
+           * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() )
+           * ::cos( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() );
+   if( XDiffOrder == 0 && YDiffOrder == 1 && ZDiffOrder == 1 )
+      return 4.0 * M_PI * M_PI / ( this->waveLength.y() * this->waveLength.z() ) * this->amplitude
+           * ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() )
+           * ::cos( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() )
+           * ::cos( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() );
    return 0.0;
 }
 
 template< typename Real >
 __cuda_callable__
 Real
-SinBumps< 3, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+SinBumps< 3, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-} // namespace Analytic
-} // namespace Functions
-} // namespace TNL
-
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/Analytic/SinWave.h b/src/TNL/Functions/Analytic/SinWave.h
index cd82a60a4134bd07f9d04af2bb78a473111a76ea..a564e7dde828ef8f4cd19897fb5ddb425ac4ed05 100644
--- a/src/TNL/Functions/Analytic/SinWave.h
+++ b/src/TNL/Functions/Analytic/SinWave.h
@@ -15,126 +15,114 @@
 
 namespace TNL {
 namespace Functions {
-namespace Analytic {   
+namespace Analytic {
 
-template< int dimensions,
-          typename Real = double >
+template< int dimensions, typename Real = double >
 class SinWaveBase : public Domain< dimensions, SpaceDomain >
 {
-   public:
- 
-      SinWaveBase();
+public:
+   SinWaveBase();
 
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" );
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-      void setWaveLength( const Real& waveLength );
-      
-      Real getWaveLength() const;
+   void
+   setWaveLength( const Real& waveLength );
 
-      void setAmplitude( const Real& amplitude );
+   Real
+   getWaveLength() const;
 
-      Real getAmplitude() const;
+   void
+   setAmplitude( const Real& amplitude );
 
-      void setPhase( const Real& phase );
+   Real
+   getAmplitude() const;
 
-      Real getPhase() const;
+   void
+   setPhase( const Real& phase );
 
-      void setWavesNumber( const Real& wavesNumber );
+   Real
+   getPhase() const;
 
-      Real getWavesNumber() const;
+   void
+   setWavesNumber( const Real& wavesNumber );
 
-   protected:
-      
-      bool isInsideWaves( const Real& distance ) const;
+   Real
+   getWavesNumber() const;
 
-      Real waveLength, amplitude, phase, wavesNumber;
+protected:
+   bool
+   isInsideWaves( const Real& distance ) const;
+
+   Real waveLength, amplitude, phase, wavesNumber;
 };
 
 template< int Dimension, typename Real >
 class SinWave
-{
-};
+{};
 
 template< typename Real >
 class SinWave< 1, Real > : public SinWaveBase< 1, Real >
 {
-   public:
- 
-      typedef Real RealType;
-      typedef Containers::StaticVector< 1, RealType > PointType;
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                                     const Real& time = 0.0 ) const;
- 
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
-
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< 1, RealType >;
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
 class SinWave< 2, Real > : public SinWaveBase< 2, Real >
 {
-   public:
- 
-      typedef Real RealType;
-      typedef Containers::StaticVector< 2, RealType > PointType;
- 
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                                     const Real& time = 0.0 ) const;
- 
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
- 
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< 2, RealType >;
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
 class SinWave< 3, Real > : public SinWaveBase< 3, Real >
 {
-   public:
- 
-      typedef Real RealType;
-      typedef Containers::StaticVector< 3, RealType > PointType;
-
-
- 
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                         const Real& time = 0.0 ) const;
- 
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
- 
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< 3, RealType >;
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
-template< int Dimension,
-          typename Real >
-std::ostream& operator << ( std::ostream& str, const SinWave< Dimension, Real >& f )
+template< int Dimension, typename Real >
+std::ostream&
+operator<<( std::ostream& str, const SinWave< Dimension, Real >& f )
 {
-   str << "Sin Wave. function: amplitude = " << f.getAmplitude()
-       << " wavelength = " << f.getWaveLength()
-       << " phase = " << f.getPhase()
-       << " waves number = " << f.getWavesNumber();
+   str << "Sin Wave. function: amplitude = " << f.getAmplitude() << " wavelength = " << f.getWaveLength()
+       << " phase = " << f.getPhase() << " waves number = " << f.getWavesNumber();
    return str;
 }
 
-} // namespace Analytic
-} // namespace Functions
-} // namespace TNL
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
 
 #include <TNL/Functions/Analytic/SinWave_impl.h>
-
diff --git a/src/TNL/Functions/Analytic/SinWaveSDF.h b/src/TNL/Functions/Analytic/SinWaveSDF.h
index 4fefd14a9f76c5f5d2e0111479caf78e886bf420..bb14afd21d09e43136e1c4d048169eaf09687ac7 100644
--- a/src/TNL/Functions/Analytic/SinWaveSDF.h
+++ b/src/TNL/Functions/Analytic/SinWaveSDF.h
@@ -11,127 +11,116 @@
 #include <TNL/Functions/Domain.h>
 
 namespace TNL {
-   namespace Functions {
-      namespace Analytic {
+namespace Functions {
+namespace Analytic {
 
-template< int dimensions,
-          typename Real = double >
+template< int dimensions, typename Real = double >
 class SinWaveSDFBase : public Functions::Domain< dimensions, SpaceDomain >
 {
-   public:
+public:
+   SinWaveSDFBase();
 
-      SinWaveSDFBase();
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-      bool setup( const Config::ParameterContainer& parameters,
-                 const String& prefix = "" );
+   void
+   setWaveLength( const Real& waveLength );
 
-      void setWaveLength( const Real& waveLength );
+   Real
+   getWaveLength() const;
 
-      Real getWaveLength() const;
+   void
+   setAmplitude( const Real& amplitude );
 
-      void setAmplitude( const Real& amplitude );
+   Real
+   getAmplitude() const;
 
-      Real getAmplitude() const;
+   void
+   setPhase( const Real& phase );
 
-      void setPhase( const Real& phase );
+   Real
+   getPhase() const;
 
-      Real getPhase() const;
+   void
+   setWavesNumber( const Real& wavesNumber );
 
-      void setWavesNumber( const Real& wavesNumber );
+   Real
+   getWavesNumber() const;
 
-      Real getWavesNumber() const;
+protected:
+   __cuda_callable__
+   Real
+   sinWaveFunctionSDF( const Real& r ) const;
 
-   protected:
-
-      __cuda_callable__
-      Real sinWaveFunctionSDF( const Real& r ) const;
-      
-      Real waveLength, amplitude, phase, wavesNumber;
+   Real waveLength, amplitude, phase, wavesNumber;
 };
 
 template< int Dimensions, typename Real >
 class SinWaveSDF
-{
-};
+{};
 
 template< typename Real >
 class SinWaveSDF< 1, Real > : public SinWaveSDFBase< 1, Real >
 {
-   public:
-
-      typedef Real RealType;
-      typedef Containers::StaticVector< 1, RealType > PointType;
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                                     const Real& time = 0.0 ) const;
-
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
-
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< 1, RealType >;
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
 class SinWaveSDF< 2, Real > : public SinWaveSDFBase< 2, Real >
 {
-   public:
-
-      typedef Real RealType;
-      typedef Containers::StaticVector< 2, RealType > PointType;
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                                     const Real& time = 0.0 ) const;
-
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
-
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< 2, RealType >;
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
 class SinWaveSDF< 3, Real > : public SinWaveSDFBase< 3, Real >
 {
-   public:
-
-      typedef Real RealType;
-      typedef Containers::StaticVector< 3, RealType > PointType;
-
-
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                         const Real& time = 0.0 ) const;
-
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
-
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< 3, RealType >;
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
-template< int Dimensions,
-          typename Real >
-std::ostream& operator << ( std::ostream& str, const SinWaveSDF< Dimensions, Real >& f )
+template< int Dimensions, typename Real >
+std::ostream&
+operator<<( std::ostream& str, const SinWaveSDF< Dimensions, Real >& f )
 {
-   str << "SDF Sin Wave SDF. function: amplitude = " << f.getAmplitude()
-       << " wavelength = " << f.getWaveLength()
-       << " phase = " << f.getPhase()
-       << " # of waves = " << f.getWavesNumber();
+   str << "SDF Sin Wave SDF. function: amplitude = " << f.getAmplitude() << " wavelength = " << f.getWaveLength()
+       << " phase = " << f.getPhase() << " # of waves = " << f.getWavesNumber();
    return str;
 }
-        
-      } // namespace Analytic
-   } // namespace Functions 
-} // namespace TNL
+
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
 
 #include <TNL/Functions/Analytic/SinWaveSDF_impl.h>
diff --git a/src/TNL/Functions/Analytic/SinWaveSDF_impl.h b/src/TNL/Functions/Analytic/SinWaveSDF_impl.h
index e0c84a87ab043a31b43ed1419954d41bd5df65c5..0720108d1d3b84b3ffee7867df2e959c519d8a27 100644
--- a/src/TNL/Functions/Analytic/SinWaveSDF_impl.h
+++ b/src/TNL/Functions/Analytic/SinWaveSDF_impl.h
@@ -13,151 +13,141 @@ namespace Functions {
 namespace Analytic {
 
 template< int dimensions, typename Real >
-SinWaveSDFBase< dimensions, Real >::SinWaveSDFBase()
-: waveLength( 1.0 ),
-  amplitude( 1.0 ),
-  phase( 0 ),
-  wavesNumber( 0 )
-{
-}
+SinWaveSDFBase< dimensions, Real >::SinWaveSDFBase() : waveLength( 1.0 ), amplitude( 1.0 ), phase( 0 ), wavesNumber( 0 )
+{}
 
 template< int dimensions, typename Real >
-bool SinWaveSDFBase< dimensions, Real >::setup( const Config::ParameterContainer& parameters,
-                                           const String& prefix )
+bool
+SinWaveSDFBase< dimensions, Real >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    this->waveLength = parameters.getParameter< double >( prefix + "wave-length" );
    this->amplitude = parameters.getParameter< double >( prefix + "amplitude" );
    this->phase = parameters.getParameter< double >( prefix + "phase" );
-   while(this->phase >2.0*M_PI)
-      this->phase -= 2.0*M_PI;
+   while( this->phase > 2.0 * M_PI )
+      this->phase -= 2.0 * M_PI;
    this->wavesNumber = ceil( parameters.getParameter< double >( prefix + "waves-number" ) );
    return true;
 }
 
 template< int dimensions, typename Real >
-void SinWaveSDFBase< dimensions, Real >::setWaveLength( const Real& waveLength )
+void
+SinWaveSDFBase< dimensions, Real >::setWaveLength( const Real& waveLength )
 {
    this->waveLength = waveLength;
 }
 
 template< int dimensions, typename Real >
-Real SinWaveSDFBase< dimensions, Real >::getWaveLength() const
+Real
+SinWaveSDFBase< dimensions, Real >::getWaveLength() const
 {
    return this->waveLength;
 }
 
 template< int dimensions, typename Real >
-void SinWaveSDFBase< dimensions, Real >::setAmplitude( const Real& amplitude )
+void
+SinWaveSDFBase< dimensions, Real >::setAmplitude( const Real& amplitude )
 {
    this->amplitude = amplitude;
 }
 
 template< int dimensions, typename Real >
-Real SinWaveSDFBase< dimensions, Real >::getAmplitude() const
+Real
+SinWaveSDFBase< dimensions, Real >::getAmplitude() const
 {
    return this->amplitude;
 }
 
 template< int dimensions, typename Real >
-void SinWaveSDFBase< dimensions, Real >::setPhase( const Real& phase )
+void
+SinWaveSDFBase< dimensions, Real >::setPhase( const Real& phase )
 {
    this->phase = phase;
 }
 
 template< int dimensions, typename Real >
-Real SinWaveSDFBase< dimensions, Real >::getPhase() const
+Real
+SinWaveSDFBase< dimensions, Real >::getPhase() const
 {
    return this->phase;
 }
 
 template< int dimensions, typename Real >
-void SinWaveSDFBase< dimensions, Real >::setWavesNumber( const Real& wavesNumber )
+void
+SinWaveSDFBase< dimensions, Real >::setWavesNumber( const Real& wavesNumber )
 {
    this->wavesNumber = wavesNumber;
 }
 
 template< int dimensions, typename Real >
-Real SinWaveSDFBase< dimensions, Real >::getWavesNumber() const
+Real
+SinWaveSDFBase< dimensions, Real >::getWavesNumber() const
 {
    return this->wavesNumber;
 }
 
 template< int dimensions, typename Real >
 __cuda_callable__
-Real SinWaveSDFBase< dimensions, Real >::sinWaveFunctionSDF( const Real& r ) const
+Real
+SinWaveSDFBase< dimensions, Real >::sinWaveFunctionSDF( const Real& r ) const
 {
    if( this->wavesNumber == 0.0 || r < this->wavesNumber * this->waveLength )
       return sign( r - round( 2.0 * r / this->waveLength ) * this->waveLength / 2.0 )
-             * ( r - round( 2.0 * r / this->waveLength ) * this->waveLength / 2.0 )
-             * sign( ::sin( 2.0 * M_PI * r / this->waveLength ) );
+           * ( r - round( 2.0 * r / this->waveLength ) * this->waveLength / 2.0 )
+           * sign( ::sin( 2.0 * M_PI * r / this->waveLength ) );
    else
-      return r - this->wavesNumber * this->waveLength;   
+      return r - this->wavesNumber * this->waveLength;
 }
 
-
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder>
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-SinWaveSDF< 1, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+SinWaveSDF< 1, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
    if( YDiffOrder != 0 || ZDiffOrder != 0 )
       return 0.0;
    const RealType& x = v.x();
-   const RealType distance = ::sqrt( x * x ) + this->phase * this->waveLength / (2.0*M_PI);
+   const RealType distance = ::sqrt( x * x ) + this->phase * this->waveLength / ( 2.0 * M_PI );
    if( XDiffOrder == 0 )
       return this->sinWaveFunctionSDF( distance );
    TNL_ASSERT_TRUE( false, "TODO: implement this" );
    return 0.0;
 }
 
-
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder>
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-SinWaveSDF< 2, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+SinWaveSDF< 2, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
    if( ZDiffOrder != 0 )
       return 0.0;
 
    const RealType& x = v.x();
    const RealType& y = v.y();
-   const RealType distance  = ::sqrt( x * x + y * y ) + this->phase * this->waveLength / (2.0*M_PI);
-   if( XDiffOrder == 0 && YDiffOrder == 0)
+   const RealType distance = ::sqrt( x * x + y * y ) + this->phase * this->waveLength / ( 2.0 * M_PI );
+   if( XDiffOrder == 0 && YDiffOrder == 0 )
       return this->sinWaveFunctionSDF( distance );
    TNL_ASSERT_TRUE( false, "TODO: implement this" );
    return 0.0;
 }
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder>
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-SinWaveSDF< 3, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+SinWaveSDF< 3, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
    const RealType& x = v.x();
    const RealType& y = v.y();
    const RealType& z = v.z();
-   const RealType distance  = ::sqrt( x * x +  y * y + z * z ) +  this->phase * this->waveLength / (2.0*M_PI);
+   const RealType distance = ::sqrt( x * x + y * y + z * z ) + this->phase * this->waveLength / ( 2.0 * M_PI );
    if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 )
       return this->sinWaveFunctionSDF( distance );
    TNL_ASSERT_TRUE( false, "TODO: implement this" );
    return 0.0;
 }
 
-} // namespace Analytic
-} // namespace Functions
-} // namespace TNL
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/Analytic/SinWave_impl.h b/src/TNL/Functions/Analytic/SinWave_impl.h
index 693aeaf9f28425d4d9341c6c5f624d98b7758886..196b40de31aed3a3e9ca0a7a2cd1b86ebc9d4dd3 100644
--- a/src/TNL/Functions/Analytic/SinWave_impl.h
+++ b/src/TNL/Functions/Analytic/SinWave_impl.h
@@ -10,20 +10,15 @@
 
 namespace TNL {
 namespace Functions {
-namespace Analytic {   
+namespace Analytic {
 
 template< int dimensions, typename Real >
-SinWaveBase< dimensions, Real >::SinWaveBase()
-: waveLength( 1.0 ),
-  amplitude( 1.0 ),
-  phase( 0 ),
-  wavesNumber( 0 )
-{
-}
+SinWaveBase< dimensions, Real >::SinWaveBase() : waveLength( 1.0 ), amplitude( 1.0 ), phase( 0 ), wavesNumber( 0 )
+{}
 
 template< int dimensions, typename Real >
-bool SinWaveBase< dimensions, Real >::setup( const Config::ParameterContainer& parameters,
-                                           const String& prefix )
+bool
+SinWaveBase< dimensions, Real >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    this->waveLength = parameters.getParameter< double >( prefix + "wave-length" );
    this->amplitude = parameters.getParameter< double >( prefix + "amplitude" );
@@ -33,180 +28,204 @@ bool SinWaveBase< dimensions, Real >::setup( const Config::ParameterContainer& p
 }
 
 template< int dimensions, typename Real >
-void SinWaveBase< dimensions, Real >::setWaveLength( const Real& waveLength )
+void
+SinWaveBase< dimensions, Real >::setWaveLength( const Real& waveLength )
 {
    this->waveLength = waveLength;
 }
 
 template< int dimensions, typename Real >
-Real SinWaveBase< dimensions, Real >::getWaveLength() const
+Real
+SinWaveBase< dimensions, Real >::getWaveLength() const
 {
    return this->waveLength;
 }
 
 template< int dimensions, typename Real >
-void SinWaveBase< dimensions, Real >::setAmplitude( const Real& amplitude )
+void
+SinWaveBase< dimensions, Real >::setAmplitude( const Real& amplitude )
 {
    this->amplitude = amplitude;
 }
 
 template< int dimensions, typename Real >
-Real SinWaveBase< dimensions, Real >::getAmplitude() const
+Real
+SinWaveBase< dimensions, Real >::getAmplitude() const
 {
    return this->amplitude;
 }
 
 template< int dimensions, typename Real >
-void SinWaveBase< dimensions, Real >::setPhase( const Real& phase )
+void
+SinWaveBase< dimensions, Real >::setPhase( const Real& phase )
 {
    this->phase = phase;
 }
 
 template< int dimensions, typename Real >
-Real SinWaveBase< dimensions, Real >::getPhase() const
+Real
+SinWaveBase< dimensions, Real >::getPhase() const
 {
    return this->phase;
 }
 
-
-
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-SinWave< 1, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+SinWave< 1, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
    const RealType& x = v.x();
    if( YDiffOrder != 0 || ZDiffOrder != 0 )
       return 0.0;
-   if( XDiffOrder == 0 )
-   {
-      RealType arg = 2.0 * M_PI * x  / this->waveLength;
-      if( this->wavesNumber )
-      {
+   if( XDiffOrder == 0 ) {
+      RealType arg = 2.0 * M_PI * x / this->waveLength;
+      if( this->wavesNumber ) {
          if( abs( arg ) > this->wavesNumber )
             arg = sign( x ) * this->wavesNumber;
       }
-      //cout << "arg = " << arg << " amplitude = " << this->amplitude << " -> " << this->amplitude * ::sin( this->phase + arg ) << std::endl;
+      // cout << "arg = " << arg << " amplitude = " << this->amplitude << " -> " << this->amplitude * ::sin( this->phase + arg )
+      // << std::endl;
       return this->amplitude * ::sin( this->phase + arg );
    }
    if( XDiffOrder == 1 )
       return 2.0 * M_PI / this->waveLength * this->amplitude * ::cos( this->phase + 2.0 * M_PI * x / this->waveLength );
    if( XDiffOrder == 2 )
-      return -4.0 * M_PI * M_PI / ( this->waveLength * this->waveLength ) * this->amplitude * ::sin( this->phase + 2.0 * M_PI * x / this->waveLength );
+      return -4.0 * M_PI * M_PI / ( this->waveLength * this->waveLength ) * this->amplitude
+           * ::sin( this->phase + 2.0 * M_PI * x / this->waveLength );
    return 0.0;
 }
 
 template< typename Real >
 __cuda_callable__
 Real
-SinWave< 1, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+SinWave< 1, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-
-
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-SinWave< 2, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+SinWave< 2, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
    const RealType& x = v.x();
    const RealType& y = v.y();
-   if ( ZDiffOrder != 0 )
+   if( ZDiffOrder != 0 )
       return 0.0;
-   if( XDiffOrder == 0 && YDiffOrder == 0)
-   {
+   if( XDiffOrder == 0 && YDiffOrder == 0 ) {
       return this->amplitude * ::sin( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y ) / this->waveLength );
    }
    if( XDiffOrder == 1 && YDiffOrder == 0 )
-      return 2.0 * M_PI * x / ( this->waveLength * ::sqrt( x * x + y * y ) ) * this->amplitude * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y ) / this->waveLength );
+      return 2.0 * M_PI * x / ( this->waveLength * ::sqrt( x * x + y * y ) ) * this->amplitude
+           * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y ) / this->waveLength );
    if( XDiffOrder == 2 && YDiffOrder == 0 )
-      return 2.0 * M_PI * x * x / ( this->waveLength * ::sqrt( x * x + y * y ) * ::sqrt( x * x + y * y ) * ::sqrt( x * x + y * y ) ) * this->amplitude * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y ) / this->waveLength ) - 4.0 * M_PI * M_PI * x * x / ( this->waveLength * this->waveLength * ( x * x + y * y ) ) * this->amplitude * ::sin( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y ) / this->waveLength );
+      return 2.0 * M_PI * x * x
+              / ( this->waveLength * ::sqrt( x * x + y * y ) * ::sqrt( x * x + y * y ) * ::sqrt( x * x + y * y ) )
+              * this->amplitude * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y ) / this->waveLength )
+           - 4.0 * M_PI * M_PI * x * x / ( this->waveLength * this->waveLength * ( x * x + y * y ) ) * this->amplitude
+                * ::sin( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y ) / this->waveLength );
    if( XDiffOrder == 0 && YDiffOrder == 1 )
-      return 2.0 * M_PI * y / ( this->waveLength * ::sqrt( x * x + y * y ) ) * this->amplitude * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y ) / this->waveLength );
+      return 2.0 * M_PI * y / ( this->waveLength * ::sqrt( x * x + y * y ) ) * this->amplitude
+           * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y ) / this->waveLength );
    if( XDiffOrder == 0 && YDiffOrder == 2 )
-      return 2.0 * M_PI * y * y / ( this->waveLength * ::sqrt( x * x + y * y ) * ::sqrt( x * x + y * y ) * ::sqrt( x * x + y * y ) ) * this->amplitude * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y ) / this->waveLength ) - 4.0 * M_PI * M_PI * y * y / ( this->waveLength * this->waveLength * ( x * x + y * y ) ) * this->amplitude * ::sin( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y ) / this->waveLength );
+      return 2.0 * M_PI * y * y
+              / ( this->waveLength * ::sqrt( x * x + y * y ) * ::sqrt( x * x + y * y ) * ::sqrt( x * x + y * y ) )
+              * this->amplitude * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y ) / this->waveLength )
+           - 4.0 * M_PI * M_PI * y * y / ( this->waveLength * this->waveLength * ( x * x + y * y ) ) * this->amplitude
+                * ::sin( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y ) / this->waveLength );
    if( XDiffOrder == 1 && YDiffOrder == 1 )
-      return -4.0 * M_PI * M_PI * x * y / ( this->waveLength * this->waveLength * (x * x + y * y ) )* this->amplitude * ::sin( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y ) / this->waveLength )
-             - 2.0 * M_PI * this->amplitude * x * y * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y ) / this->waveLength ) / ( this->waveLength  * ::sqrt( (x * x + y * y )  * (x * x + y * y ) * (x * x + y * y ) ) );
+      return -4.0 * M_PI * M_PI * x * y / ( this->waveLength * this->waveLength * ( x * x + y * y ) ) * this->amplitude
+              * ::sin( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y ) / this->waveLength )
+           - 2.0 * M_PI * this->amplitude * x * y
+                * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y ) / this->waveLength )
+                / ( this->waveLength * ::sqrt( ( x * x + y * y ) * ( x * x + y * y ) * ( x * x + y * y ) ) );
    return 0.0;
 }
 
 template< typename Real >
 __cuda_callable__
 Real
-SinWave< 2, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+SinWave< 2, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-SinWave< 3, Real >::
-getPartialDerivative( const PointType& v,
-                      const Real& time ) const
+SinWave< 3, Real >::getPartialDerivative( const PointType& v, const Real& time ) const
 {
    const RealType& x = v.x();
    const RealType& y = v.y();
    const RealType& z = v.z();
-   if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 )
-   {
+   if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 ) {
       return this->amplitude * ::sin( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength );
    }
    if( XDiffOrder == 1 && YDiffOrder == 0 && ZDiffOrder == 0 )
-      return 2.0 * M_PI * x / ( this->waveLength * ::sqrt( x * x + y * y + z * z ) ) * this->amplitude * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength );
+      return 2.0 * M_PI * x / ( this->waveLength * ::sqrt( x * x + y * y + z * z ) ) * this->amplitude
+           * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength );
    if( XDiffOrder == 2 && YDiffOrder == 0 && ZDiffOrder == 0 )
-      return 2.0 * M_PI * ( y * y + z * z ) / ( this->waveLength * ::sqrt( x * x + y * y + z * z ) * ::sqrt( x * x + y * y + z * z ) * ::sqrt( x * x + y * y + z * z ) ) * this->amplitude * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength ) - 4.0 * M_PI * M_PI * x * x / ( this->waveLength * this->waveLength * ( x * x + y * y + z * z ) ) * this->amplitude * ::sin( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength );
+      return 2.0 * M_PI * ( y * y + z * z )
+              / ( this->waveLength * ::sqrt( x * x + y * y + z * z ) * ::sqrt( x * x + y * y + z * z )
+                  * ::sqrt( x * x + y * y + z * z ) )
+              * this->amplitude * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength )
+           - 4.0 * M_PI * M_PI * x * x / ( this->waveLength * this->waveLength * ( x * x + y * y + z * z ) ) * this->amplitude
+                * ::sin( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength );
    if( XDiffOrder == 0 && YDiffOrder == 1 && ZDiffOrder == 0 )
-      return 2.0 * M_PI * y / ( this->waveLength * ::sqrt( x * x + y * y + z * z ) ) * this->amplitude * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength );
+      return 2.0 * M_PI * y / ( this->waveLength * ::sqrt( x * x + y * y + z * z ) ) * this->amplitude
+           * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength );
    if( XDiffOrder == 0 && YDiffOrder == 2 && ZDiffOrder == 0 )
-      return 2.0 * M_PI * ( x * x + z * z ) / ( this->waveLength * ::sqrt( x * x + y * y + z * z ) * ::sqrt( x * x + y * y + z * z ) * ::sqrt( x * x + y * y + z * z ) ) * this->amplitude * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength ) - 4.0 * M_PI * M_PI * y * y / ( this->waveLength * this->waveLength * ( x * x + y * y + z * z ) ) * this->amplitude * ::sin( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength );
+      return 2.0 * M_PI * ( x * x + z * z )
+              / ( this->waveLength * ::sqrt( x * x + y * y + z * z ) * ::sqrt( x * x + y * y + z * z )
+                  * ::sqrt( x * x + y * y + z * z ) )
+              * this->amplitude * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength )
+           - 4.0 * M_PI * M_PI * y * y / ( this->waveLength * this->waveLength * ( x * x + y * y + z * z ) ) * this->amplitude
+                * ::sin( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength );
    if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 1 )
-      return 2.0 * M_PI * z / ( this->waveLength * ::sqrt( x * x + y * y + z * z ) ) * this->amplitude * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength );
+      return 2.0 * M_PI * z / ( this->waveLength * ::sqrt( x * x + y * y + z * z ) ) * this->amplitude
+           * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength );
    if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 2 )
-      return 2.0 * M_PI * ( x * x + y * y ) / ( this->waveLength * ::sqrt( x * x + y * y + z * z ) * ::sqrt( x * x + y * y + z * z ) * ::sqrt( x * x + y * y + z * z ) ) * this->amplitude * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength ) - 4.0 * M_PI * M_PI * z * z / ( this->waveLength * this->waveLength * ( x * x + y * y + z * z ) ) * this->amplitude * ::sin( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength );
+      return 2.0 * M_PI * ( x * x + y * y )
+              / ( this->waveLength * ::sqrt( x * x + y * y + z * z ) * ::sqrt( x * x + y * y + z * z )
+                  * ::sqrt( x * x + y * y + z * z ) )
+              * this->amplitude * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength )
+           - 4.0 * M_PI * M_PI * z * z / ( this->waveLength * this->waveLength * ( x * x + y * y + z * z ) ) * this->amplitude
+                * ::sin( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength );
    if( XDiffOrder == 1 && YDiffOrder == 1 && ZDiffOrder == 0 )
-      return -4.0 * M_PI * M_PI * x * y / ( this->waveLength * this->waveLength * (x * x + y * y + z * z ) )* this->amplitude * ::sin( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength )
-             - 2.0 * M_PI * this->amplitude * x * y * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength ) / ( this->waveLength  * ::sqrt( (x * x + y * y + z * z )  * (x * x + y * y + z * z ) * (x * x + y * y + z * z ) ) );
+      return -4.0 * M_PI * M_PI * x * y / ( this->waveLength * this->waveLength * ( x * x + y * y + z * z ) ) * this->amplitude
+              * ::sin( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength )
+           - 2.0 * M_PI * this->amplitude * x * y
+                * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength )
+                / ( this->waveLength
+                    * ::sqrt( ( x * x + y * y + z * z ) * ( x * x + y * y + z * z ) * ( x * x + y * y + z * z ) ) );
    if( XDiffOrder == 1 && YDiffOrder == 0 && ZDiffOrder == 1 )
-      return -4.0 * M_PI * M_PI * x * z / ( this->waveLength * this->waveLength * (x * x + y * y + z * z ) )* this->amplitude * ::sin( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength )
-             - 2.0 * M_PI * this->amplitude * x * z * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength ) / ( this->waveLength  * ::sqrt( (x * x + y * y + z * z )  * (x * x + y * y + z * z ) * (x * x + y * y + z * z ) ) );
+      return -4.0 * M_PI * M_PI * x * z / ( this->waveLength * this->waveLength * ( x * x + y * y + z * z ) ) * this->amplitude
+              * ::sin( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength )
+           - 2.0 * M_PI * this->amplitude * x * z
+                * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength )
+                / ( this->waveLength
+                    * ::sqrt( ( x * x + y * y + z * z ) * ( x * x + y * y + z * z ) * ( x * x + y * y + z * z ) ) );
    if( XDiffOrder == 0 && YDiffOrder == 1 && ZDiffOrder == 1 )
-      return -4.0 * M_PI * M_PI * z * y / ( this->waveLength * this->waveLength * (x * x + y * y + z * z ) )* this->amplitude * ::sin( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength )
-             - 2.0 * M_PI * this->amplitude * z * y * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength ) / ( this->waveLength  * ::sqrt( (x * x + y * y + z * z )  * (x * x + y * y + z * z ) * (x * x + y * y + z * z ) ) );
+      return -4.0 * M_PI * M_PI * z * y / ( this->waveLength * this->waveLength * ( x * x + y * y + z * z ) ) * this->amplitude
+              * ::sin( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength )
+           - 2.0 * M_PI * this->amplitude * z * y
+                * ::cos( this->phase + 2.0 * M_PI * ::sqrt( x * x + y * y + z * z ) / this->waveLength )
+                / ( this->waveLength
+                    * ::sqrt( ( x * x + y * y + z * z ) * ( x * x + y * y + z * z ) * ( x * x + y * y + z * z ) ) );
    return 0.0;
 }
 
 template< typename Real >
 __cuda_callable__
 Real
-SinWave< 3, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+SinWave< 3, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-} // namespace Analytic
-} // namespace Functions
-} // namespace TNL
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/Analytic/Twins.h b/src/TNL/Functions/Analytic/Twins.h
index 4bb877a6360183c234b8ab493a2f117fb02ba4ab..4a0dc720e97e703f67ebb90bdb2109107ab2b91e 100644
--- a/src/TNL/Functions/Analytic/Twins.h
+++ b/src/TNL/Functions/Analytic/Twins.h
@@ -13,112 +13,101 @@
 
 namespace TNL {
 namespace Functions {
-namespace Analytic {   
+namespace Analytic {
 
-template< typename Real,
-          int Dimension >
+template< typename Real, int Dimension >
 class TwinsBase : public Domain< Dimension, SpaceDomain >
 {
-   public:
+public:
+   using RealType = Real;
 
-      typedef Real RealType;
-
-      bool setup( const Config::ParameterContainer& parameters,
-                 const String& prefix = "" );
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 };
 
-template< int Dimension,
-          typename Real >
+template< int Dimension, typename Real >
 class Twins
-{
-};
+{};
 
 template< typename Real >
 class Twins< 1, Real > : public TwinsBase< Real, 1 >
 {
-   public:
-
-      enum { Dimension = 1 };
-      typedef Real RealType;
-      typedef Containers::StaticVector< Dimension, Real > PointType;
-
-      Twins();
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0,
-                typename Point = PointType >
-      __cuda_callable__
-      RealType getPartialDerivative( const Point& v,
-                                     const Real& time = 0.0 ) const;
- 
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
- 
+public:
+   enum
+   {
+      Dimension = 1
+   };
+   using RealType = Real;
+   using PointType = Containers::StaticVector< Dimension, Real >;
+
+   Twins();
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Point = PointType >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const Point& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
 class Twins< 2, Real > : public TwinsBase< Real, 2 >
 {
-   public:
-
-      enum { Dimension = 2 };
-      typedef Real RealType;
-      typedef Containers::StaticVector< Dimension, Real > PointType;
-
-      Twins();
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0,
-                typename Point = PointType >
-      __cuda_callable__
-      RealType getPartialDerivative( const Point& v,
-                                     const Real& time = 0.0 ) const;
- 
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
- 
+public:
+   enum
+   {
+      Dimension = 2
+   };
+   using RealType = Real;
+   using PointType = Containers::StaticVector< Dimension, Real >;
+
+   Twins();
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Point = PointType >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const Point& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
 template< typename Real >
 class Twins< 3, Real > : public TwinsBase< Real, 3 >
 {
-   public:
-
-      enum { Dimension = 3 };
-      typedef Real RealType;
-      typedef Containers::StaticVector< Dimension, Real > PointType;
-
-      Twins();
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0,
-                typename Point = PointType >
-      __cuda_callable__
-      RealType getPartialDerivative( const Point& v,
-                                     const Real& time = 0.0 ) const;
- 
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const;
- 
+public:
+   enum
+   {
+      Dimension = 3
+   };
+   using RealType = Real;
+   using PointType = Containers::StaticVector< Dimension, Real >;
+
+   Twins();
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Point = PointType >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const Point& v, const Real& time = 0.0 ) const;
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const;
 };
 
-template< int Dimension,
-          typename Real >
-std::ostream& operator << ( std::ostream& str, const Twins< Dimension, Real >& f )
+template< int Dimension, typename Real >
+std::ostream&
+operator<<( std::ostream& str, const Twins< Dimension, Real >& f )
 {
    str << "Twins function.";
    return str;
 }
 
-} // namespace Analytic
-} // namespace Functions
-} // namespace TNL
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
 
 #include <TNL/Functions/Analytic/Twins_impl.h>
-
diff --git a/src/TNL/Functions/Analytic/Twins_impl.h b/src/TNL/Functions/Analytic/Twins_impl.h
index 04753d0f3196d93f35c63e590c717623ed65daa0..c9624252ff8a82fb037ce8c35eabac79cf6a82e4 100644
--- a/src/TNL/Functions/Analytic/Twins_impl.h
+++ b/src/TNL/Functions/Analytic/Twins_impl.h
@@ -10,39 +10,29 @@
 
 namespace TNL {
 namespace Functions {
-namespace Analytic {   
+namespace Analytic {
 
-template< typename Real,
-          int Dimension >
+template< typename Real, int Dimension >
 bool
-TwinsBase< Real, Dimension >::
-setup( const Config::ParameterContainer& parameters,
-       const String& prefix )
+TwinsBase< Real, Dimension >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    return true;
 }
 
-
 /***
  * 1D
  */
 
 template< typename Real >
-Twins< 1, Real >::Twins()
-{
-}
+Twins< 1, Real >::Twins() = default;
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder,
-             typename Point >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, typename Point >
 __cuda_callable__
 Real
-Twins< 1, Real >::getPartialDerivative( const Point& v,
-                                                   const Real& time ) const
+Twins< 1, Real >::getPartialDerivative( const Point& v, const Real& time ) const
 {
-   //const RealType& x = v.x();
+   // const RealType& x = v.x();
    if( YDiffOrder != 0 || ZDiffOrder != 0 )
       return 0.0;
    if( XDiffOrder == 0 )
@@ -53,75 +43,56 @@ Twins< 1, Real >::getPartialDerivative( const Point& v,
 template< typename Real >
 __cuda_callable__
 Real
-Twins< 1, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+Twins< 1, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-
 /****
  * 2D
  */
 template< typename Real >
-Twins< 2, Real >::Twins()
-{
-}
+Twins< 2, Real >::Twins() = default;
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder,
-             typename Point >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, typename Point >
 __cuda_callable__
 Real
-Twins< 2, Real >::
-getPartialDerivative( const Point& v,
-                      const Real& time ) const
+Twins< 2, Real >::getPartialDerivative( const Point& v, const Real& time ) const
 {
    const RealType& x = v.x();
    const RealType& y = v.y();
    if( ZDiffOrder != 0 )
       return 0.0;
    if( XDiffOrder == 0 && YDiffOrder == 0 )
-      return -0.5 * ::sin( M_PI * x) * ::sin( M_PI * x) * ( 1 - ( y - 2 ) * ( y - 2 ) ) * ( 1 - ::tanh( 10 * ( ::sqrt( x * x + y * y ) - 0.6 ) ) );
+      return -0.5 * ::sin( M_PI * x ) * ::sin( M_PI * x ) * ( 1 - ( y - 2 ) * ( y - 2 ) )
+           * ( 1 - ::tanh( 10 * ( ::sqrt( x * x + y * y ) - 0.6 ) ) );
    return 0.0;
 }
 
 template< typename Real >
 __cuda_callable__
 Real
-Twins< 2, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+Twins< 2, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-
 /****
  * 3D
  */
 template< typename Real >
-Twins< 3, Real >::Twins()
-{
-}
+Twins< 3, Real >::Twins() = default;
 
 template< typename Real >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder,
-             typename Point >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, typename Point >
 __cuda_callable__
 Real
-Twins< 3, Real >::
-getPartialDerivative( const Point& v,
-                      const Real& time ) const
+Twins< 3, Real >::getPartialDerivative( const Point& v, const Real& time ) const
 {
-   //const RealType& x = v.x();
-   //const RealType& y = v.y();
-   //const RealType& z = v.z();
+   // const RealType& x = v.x();
+   // const RealType& y = v.y();
+   // const RealType& z = v.z();
    if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 )
       return 0.0;
    return 0.0;
@@ -130,14 +101,11 @@ getPartialDerivative( const Point& v,
 template< typename Real >
 __cuda_callable__
 Real
-Twins< 3, Real >::
-operator()( const PointType& v,
-            const Real& time ) const
+Twins< 3, Real >::operator()( const PointType& v, const Real& time ) const
 {
    return this->template getPartialDerivative< 0, 0, 0 >( v, time );
 }
 
-} // namespace Analytic
-} // namespace Functions
-} // namespace TNL
-
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/Analytic/VectorNorm.h b/src/TNL/Functions/Analytic/VectorNorm.h
index 3c171e5920c233943138f566d7864d7bfd56c1f1..d271da27c0a76f2e15c0c332fde5bc3c8dba508f 100644
--- a/src/TNL/Functions/Analytic/VectorNorm.h
+++ b/src/TNL/Functions/Analytic/VectorNorm.h
@@ -13,266 +13,263 @@ namespace TNL {
 namespace Functions {
 namespace Analytic {
 
-template< int Dimensions_,
-          typename Real >
+template< int Dimensions_, typename Real >
 class VectorNormBase : public Domain< Dimensions_, SpaceDomain >
 {
-   public:
-
-      typedef Real RealType;
-      typedef Containers::StaticVector< Dimensions_, RealType > PointType;
-
-      VectorNormBase()
-         : center( 0.0 ),
-           anisotropy( 1.0 ),
-           power( 2.0 ),
-           radius( 0.0 ),
-           multiplicator( 1.0 ),
-           maxNorm( false ){};
-
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" )
-      {
-         config.addEntry< double >( prefix + "center-x", "x-coordinate of the coordinates origin for the vector norm.", 0.0 );
-         config.addEntry< double >( prefix + "center-y", "y-coordinate of the coordinates origin for the vector norm.", 0.0 );
-         config.addEntry< double >( prefix + "center-z", "z-coordinate of the coordinates origin for the vector norm.", 0.0 );
-         config.addEntry< double >( prefix + "anisotropy-x", "x-coordinate of the linear anisotropy of the vector norm.", 1.0 );
-         config.addEntry< double >( prefix + "anisotropy-y", "y-coordinate of the linear anisotropy of the vector norm.", 1.0 );
-         config.addEntry< double >( prefix + "anisotropy-z", "z-coordinate of the linear anisotropy of the vector norm.", 1.0 );
-         config.addEntry< double >( prefix + "power", "The p coefficient of the L-p vector norm", 2.0 );
-         config.addEntry< double >( prefix + "radius", "Radius of the zero-th level-set.", 0.0 );
-         config.addEntry< double >( prefix + "multiplicator", "Outer multiplicator of the norm - -1.0 turns the function graph upside/down.", 1.0 );
-         config.addEntry< bool >( prefix + "max-norm", "Turn to 'true' to get maximum norm.", false );
-      }
-
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" )
-      {
-         this->power = parameters.template getParameter< double >( prefix + "power" );
-         this->maxNorm = parameters.template getParameter< bool >( prefix + "max-norm" );
-         this->radius = parameters.template getParameter< double >( prefix + "radius" );
-         this->multiplicator = parameters.template getParameter< double >( prefix + "multiplicator" );
-         this->center = parameters.template getXyz< PointType >( prefix + "center" );
-         this->anisotropy = parameters.template getXyz< PointType >( prefix + "anisotropy" );
-         return true;
-      }
-
-      void setCenter( const PointType& center )
-      {
-         this->center = center;
-      };
-
-      const RealType& getCenter() const
-      {
-         return this->center;
-      }
-
-      void setAnisotropy( const PointType& anisotropy )
-      {
-         this->anisotropy = anisotropy;
-      };
-
-      const RealType& getAnisotropy() const
-      {
-         return this->anisotropy;
-      }
-
-      void setPower( const RealType& power )
-      {
-         this->power = power;
-      }
-
-      const RealType& getPower() const
-      {
-         return this->power;
-      }
-
-      void setRadius( const RealType& radius )
-      {
-         this->radius = radius;
-      }
-
-      const RealType& getRadius() const
-      {
-         return this->radius;
-      }
-
-      void setMultiplicator( const RealType& multiplicator )
-      {
-         this->multiplicator = multiplicator;
-      }
-
-      const RealType& getMultiplicator() const
-      {
-         return this->multiplicator;
-      }
-
-      void setMaxNorm( bool maxNorm )
-      {
-         this->maxNorm = maxNorm;
-      }
-
-      const RealType& getMaxNorm() const
-      {
-         return this->maxNorm;
-      }
-
-   protected:
-
-      PointType center, anisotropy;
-
-      RealType power, radius, multiplicator;
-
-      bool maxNorm;
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< Dimensions_, RealType >;
+
+   VectorNormBase() : center( 0.0 ), anisotropy( 1.0 ), power( 2.0 ), radius( 0.0 ), multiplicator( 1.0 ), maxNorm( false ){};
+
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" )
+   {
+      config.addEntry< double >( prefix + "center-x", "x-coordinate of the coordinates origin for the vector norm.", 0.0 );
+      config.addEntry< double >( prefix + "center-y", "y-coordinate of the coordinates origin for the vector norm.", 0.0 );
+      config.addEntry< double >( prefix + "center-z", "z-coordinate of the coordinates origin for the vector norm.", 0.0 );
+      config.addEntry< double >( prefix + "anisotropy-x", "x-coordinate of the linear anisotropy of the vector norm.", 1.0 );
+      config.addEntry< double >( prefix + "anisotropy-y", "y-coordinate of the linear anisotropy of the vector norm.", 1.0 );
+      config.addEntry< double >( prefix + "anisotropy-z", "z-coordinate of the linear anisotropy of the vector norm.", 1.0 );
+      config.addEntry< double >( prefix + "power", "The p coefficient of the L-p vector norm", 2.0 );
+      config.addEntry< double >( prefix + "radius", "Radius of the zero-th level-set.", 0.0 );
+      config.addEntry< double >(
+         prefix + "multiplicator", "Outer multiplicator of the norm - -1.0 turns the function graph upside/down.", 1.0 );
+      config.addEntry< bool >( prefix + "max-norm", "Turn to 'true' to get maximum norm.", false );
+   }
+
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" )
+   {
+      this->power = parameters.template getParameter< double >( prefix + "power" );
+      this->maxNorm = parameters.template getParameter< bool >( prefix + "max-norm" );
+      this->radius = parameters.template getParameter< double >( prefix + "radius" );
+      this->multiplicator = parameters.template getParameter< double >( prefix + "multiplicator" );
+      this->center = parameters.template getXyz< PointType >( prefix + "center" );
+      this->anisotropy = parameters.template getXyz< PointType >( prefix + "anisotropy" );
+      return true;
+   }
+
+   void
+   setCenter( const PointType& center )
+   {
+      this->center = center;
+   };
+
+   const RealType&
+   getCenter() const
+   {
+      return this->center;
+   }
+
+   void
+   setAnisotropy( const PointType& anisotropy )
+   {
+      this->anisotropy = anisotropy;
+   };
+
+   const RealType&
+   getAnisotropy() const
+   {
+      return this->anisotropy;
+   }
+
+   void
+   setPower( const RealType& power )
+   {
+      this->power = power;
+   }
+
+   const RealType&
+   getPower() const
+   {
+      return this->power;
+   }
+
+   void
+   setRadius( const RealType& radius )
+   {
+      this->radius = radius;
+   }
+
+   const RealType&
+   getRadius() const
+   {
+      return this->radius;
+   }
+
+   void
+   setMultiplicator( const RealType& multiplicator )
+   {
+      this->multiplicator = multiplicator;
+   }
+
+   const RealType&
+   getMultiplicator() const
+   {
+      return this->multiplicator;
+   }
+
+   void
+   setMaxNorm( bool maxNorm )
+   {
+      this->maxNorm = maxNorm;
+   }
+
+   const RealType&
+   getMaxNorm() const
+   {
+      return this->maxNorm;
+   }
+
+protected:
+   PointType center, anisotropy;
+
+   RealType power, radius, multiplicator;
+
+   bool maxNorm;
 };
 
-template< int Dimensions,
-          typename Real >
+template< int Dimensions, typename Real >
 class VectorNorm
-{
-};
+{};
 
 template< typename Real >
 class VectorNorm< 1, Real > : public VectorNormBase< 1, Real >
 {
-   public:
-
-      typedef VectorNormBase< 1, Real > BaseType;
-      using typename BaseType::RealType;
-      using typename BaseType::PointType;
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                                     const Real& time = 0.0 ) const
-      {
-         const RealType& x = v.x() - this->center.x();
-         if( YDiffOrder != 0 || ZDiffOrder != 0 )
-            return 0.0;
-         if( XDiffOrder == 0 )
-         {
-            return this->multiplicator * ( TNL::abs( x ) * this->anisotropy.x() - this->radius );
-         }
-         if( XDiffOrder == 1 )
-         {
-            return this->multiplicator * TNL::sign( x ) * this->anisotropy.x();
-         }
+public:
+   using BaseType = VectorNormBase< 1, Real >;
+   using typename BaseType::PointType;
+   using typename BaseType::RealType;
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const
+   {
+      const RealType& x = v.x() - this->center.x();
+      if( YDiffOrder != 0 || ZDiffOrder != 0 )
          return 0.0;
+      if( XDiffOrder == 0 ) {
+         return this->multiplicator * ( TNL::abs( x ) * this->anisotropy.x() - this->radius );
       }
-
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const RealType& time = 0.0 ) const
-      {
-         return this->template getPartialDerivative< 0, 0, 0 >( v, time );
+      if( XDiffOrder == 1 ) {
+         return this->multiplicator * TNL::sign( x ) * this->anisotropy.x();
       }
+      return 0.0;
+   }
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const RealType& time = 0.0 ) const
+   {
+      return this->template getPartialDerivative< 0, 0, 0 >( v, time );
+   }
 };
 
 template< typename Real >
 class VectorNorm< 2, Real > : public VectorNormBase< 2, Real >
 {
-   public:
-
-      typedef VectorNormBase< 2, Real > BaseType;
-      using typename BaseType::RealType;
-      using typename BaseType::PointType;
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__ inline
-      RealType getPartialDerivative( const PointType& v,
-                                     const Real& time = 0.0 ) const
-      {
-         const RealType& x = v.x() - this->center.x();
-         const RealType& y = v.y() - this->center.y();
-         if( ZDiffOrder != 0 )
-            return 0.0;
-         if( XDiffOrder == 0 && YDiffOrder == 0 )
-         {
-            if( this->maxNorm )
-               return ( TNL::max( TNL::abs( x ) * this->anisotropy.x(),
-                                  TNL::abs( y ) * this->anisotropy.y() ) - this->radius ) * this->multiplicator;
-            if( this->power == 1.0 )
-               return ( ( TNL::abs( x ) * this->anisotropy.x() +
-                          TNL::abs( y ) * this->anisotropy.y() ) - this->radius ) * this->multiplicator;
-            if( this->power == 2.0 )
-               return ( std::sqrt( x * x  * this->anisotropy.x() +
-                                   y * y  * this->anisotropy.y() ) - this->radius ) * this->multiplicator;
-            return ( std::pow( std::pow( TNL::abs( x ), this->power ) * this->anisotropy.x() +
-                               std::pow( TNL::abs( y ), this->power ) * this->anisotropy.y(), 1.0 / this-> power ) - this->radius ) * this->multiplicator;
-         }
-         TNL_ASSERT_TRUE( false, "Not implemented yet." );
+public:
+   using BaseType = VectorNormBase< 2, Real >;
+   using typename BaseType::PointType;
+   using typename BaseType::RealType;
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   inline RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const
+   {
+      const RealType& x = v.x() - this->center.x();
+      const RealType& y = v.y() - this->center.y();
+      if( ZDiffOrder != 0 )
          return 0.0;
+      if( XDiffOrder == 0 && YDiffOrder == 0 ) {
+         if( this->maxNorm )
+            return ( TNL::max( TNL::abs( x ) * this->anisotropy.x(), TNL::abs( y ) * this->anisotropy.y() ) - this->radius )
+                 * this->multiplicator;
+         if( this->power == 1.0 )
+            return ( ( TNL::abs( x ) * this->anisotropy.x() + TNL::abs( y ) * this->anisotropy.y() ) - this->radius )
+                 * this->multiplicator;
+         if( this->power == 2.0 )
+            return ( std::sqrt( x * x * this->anisotropy.x() + y * y * this->anisotropy.y() ) - this->radius )
+                 * this->multiplicator;
+         return ( std::pow( std::pow( TNL::abs( x ), this->power ) * this->anisotropy.x()
+                               + std::pow( TNL::abs( y ), this->power ) * this->anisotropy.y(),
+                            1.0 / this->power )
+                  - this->radius )
+              * this->multiplicator;
       }
-
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const
-      {
-         return this->template getPartialDerivative< 0, 0, 0 >( v, time );
-      }
+      TNL_ASSERT_TRUE( false, "Not implemented yet." );
+      return 0.0;
+   }
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const
+   {
+      return this->template getPartialDerivative< 0, 0, 0 >( v, time );
+   }
 };
 
 template< typename Real >
 class VectorNorm< 3, Real > : public VectorNormBase< 3, Real >
 {
-   public:
-
-      typedef VectorNormBase< 3, Real > BaseType;
-      using typename BaseType::RealType;
-      using typename BaseType::PointType;
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const PointType& v,
-                                     const Real& time = 0.0 ) const
-      {
-         const RealType& x = v.x() - this->center.x();
-         const RealType& y = v.y() - this->center.y();
-         const RealType& z = v.z() - this->center.z();
-         if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 )
-         {
-            if( this->maxNorm )
-               return ( TNL::max( TNL::max( TNL::abs( x ) * this->anisotropy.x(),
-                                            TNL::abs( y ) * this->anisotropy.y() ),
-                                  TNL::abs( z ) * this->anisotropy.z() ) - this->radius ) * this->multiplicator;
-            if( this->power == 1.0 )
-               return ( ( TNL::abs( x ) * this->anisotropy.x() +
-                          TNL::abs( y ) * this->anisotropy.y() +
-                          TNL::abs( z ) * this->anisotropy.z() ) - this->radius ) * this->multiplicator;
-            if( this->power == 2.0 )
-               return ( std::sqrt( x * x  * this->anisotropy.x() +
-                                   y * y  * this->anisotropy.y() +
-                                   z * z  * this->anisotropy.z() ) - this->radius ) * this->multiplicator ;
-            return ( std::pow( std::pow( TNL::abs( x ), this->power ) * this->anisotropy.x() +
-                               std::pow( TNL::abs( y ), this->power ) * this->anisotropy.y() +
-                               std::pow( TNL::abs( z ), this->power ) * this->anisotropy.z(), 1.0 / this-> power ) - this->radius ) * this->multiplicator;
-         }
-         TNL_ASSERT_TRUE( false, "Not implemented yet." );
-         return 0.0;
-      }
-
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const Real& time = 0.0 ) const
-      {
-         return this->template getPartialDerivative< 0, 0, 0 >( v, time );
+public:
+   using BaseType = VectorNormBase< 3, Real >;
+   using typename BaseType::PointType;
+   using typename BaseType::RealType;
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const PointType& v, const Real& time = 0.0 ) const
+   {
+      const RealType& x = v.x() - this->center.x();
+      const RealType& y = v.y() - this->center.y();
+      const RealType& z = v.z() - this->center.z();
+      if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 ) {
+         if( this->maxNorm )
+            return ( TNL::max( TNL::max( TNL::abs( x ) * this->anisotropy.x(), TNL::abs( y ) * this->anisotropy.y() ),
+                               TNL::abs( z ) * this->anisotropy.z() )
+                     - this->radius )
+                 * this->multiplicator;
+         if( this->power == 1.0 )
+            return ( ( TNL::abs( x ) * this->anisotropy.x() + TNL::abs( y ) * this->anisotropy.y()
+                       + TNL::abs( z ) * this->anisotropy.z() )
+                     - this->radius )
+                 * this->multiplicator;
+         if( this->power == 2.0 )
+            return ( std::sqrt( x * x * this->anisotropy.x() + y * y * this->anisotropy.y() + z * z * this->anisotropy.z() )
+                     - this->radius )
+                 * this->multiplicator;
+         return ( std::pow( std::pow( TNL::abs( x ), this->power ) * this->anisotropy.x()
+                               + std::pow( TNL::abs( y ), this->power ) * this->anisotropy.y()
+                               + std::pow( TNL::abs( z ), this->power ) * this->anisotropy.z(),
+                            1.0 / this->power )
+                  - this->radius )
+              * this->multiplicator;
       }
+      TNL_ASSERT_TRUE( false, "Not implemented yet." );
+      return 0.0;
+   }
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const Real& time = 0.0 ) const
+   {
+      return this->template getPartialDerivative< 0, 0, 0 >( v, time );
+   }
 };
 
-template< int Dimensions,
-          typename Real >
-std::ostream& operator << ( std::ostream& str, const VectorNorm< Dimensions, Real >& f )
+template< int Dimensions, typename Real >
+std::ostream&
+operator<<( std::ostream& str, const VectorNorm< Dimensions, Real >& f )
 {
    str << "VectorNorm. function: multiplicator = " << f.getMultiplicator() << " sigma = " << f.getSigma();
    return str;
 }
 
-} // namespace Analytic
-} // namespace Functions
-} // namespace TNL
+}  // namespace Analytic
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/BoundaryMeshFunction.h b/src/TNL/Functions/BoundaryMeshFunction.h
index 7529294423d70fd7fea80f652e700297b8c9110e..f045b683ee6dce36ac45710730d0e8fcebf9e421 100644
--- a/src/TNL/Functions/BoundaryMeshFunction.h
+++ b/src/TNL/Functions/BoundaryMeshFunction.h
@@ -9,30 +9,25 @@
 #include <TNL/Functions/MeshFunction.h>
 
 namespace TNL {
-namespace Functions {   
+namespace Functions {
 
-   
 // BoundaryMeshFunction is supposed to store values of a mesh functions only
 // at boundary mesh entities. It is just a small memory optimization.
 // Currently, it is only a wrap around common MeshFunction so that we can introduce
-// boundary mesh functions in the rest of the code. 
+// boundary mesh functions in the rest of the code.
 // TODO: Implement it.
-template< typename Mesh,
-          int MeshEntityDimension = Mesh::getMeshDimension(),
-          typename Real = typename Mesh::RealType >
-class BoundaryMeshFunction :
-   public MeshFunction< Mesh, MeshEntityDimension, Real >
+template< typename Mesh, int MeshEntityDimension = Mesh::getMeshDimension(), typename Real = typename Mesh::RealType >
+class BoundaryMeshFunction : public MeshFunction< Mesh, MeshEntityDimension, Real >
 {
-   public:
-      
-      using BaseType = MeshFunction< Mesh, MeshEntityDimension, Real >;
-      using typename BaseType::MeshType;
-      using typename BaseType::DeviceType;
-      using typename BaseType::IndexType;
-      using typename BaseType::MeshPointer;
-      using typename BaseType::RealType;
-      using typename BaseType::VectorType;
+public:
+   using BaseType = MeshFunction< Mesh, MeshEntityDimension, Real >;
+   using typename BaseType::DeviceType;
+   using typename BaseType::IndexType;
+   using typename BaseType::MeshPointer;
+   using typename BaseType::MeshType;
+   using typename BaseType::RealType;
+   using typename BaseType::VectorType;
 };
 
-} // namespace Functions
-} // namespace TNL
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/CutMeshFunction.h b/src/TNL/Functions/CutMeshFunction.h
index 8fed6b89cdf6b85d250dc5181e3796aa5e78764c..b68e4609f59bb3f9e2d1feb1fd68a8af63e7dc83 100644
--- a/src/TNL/Functions/CutMeshFunction.h
+++ b/src/TNL/Functions/CutMeshFunction.h
@@ -10,17 +10,14 @@
 
 namespace TNL {
 namespace Functions {
-template <  typename MeshFunctionType,
-            typename OutMesh,
-            typename OutDof,
-            int outDimension=OutMesh::getMeshDimension(),
-            int codimension=MeshFunctionType::getMeshDimension()-OutMesh::getMeshDimension()>
+template< typename MeshFunctionType,
+          typename OutMesh,
+          typename OutDof,
+          int outDimension = OutMesh::getMeshDimension(),
+          int codimension = MeshFunctionType::getMeshDimension() - OutMesh::getMeshDimension() >
 class CutMeshFunction
 {
-   template< typename Index,
-             typename Function,
-             typename... FunctionArgs,
-             int dim >
+   template< typename Index, typename Function, typename... FunctionArgs, int dim >
    static void
    staticVectorFor( const Containers::StaticVector< dim, Index >& begin,
                     const Containers::StaticVector< dim, Index >& end,
@@ -31,107 +28,101 @@ class CutMeshFunction
       Containers::StaticVector< dim, Index > index;
 
       if( dim == 1 ) {
-         for( index[0] = begin[0]; index[0] < end[0]; index[0]++ )
+         for( index[ 0 ] = begin[ 0 ]; index[ 0 ] < end[ 0 ]; index[ 0 ]++ )
             f( index, args... );
       }
 
       if( dim == 2 ) {
-         for( index[1] = begin[1]; index[1] < end[1]; index[1]++ )
-         for( index[0] = begin[0]; index[0] < end[0]; index[0]++ )
+         for( index[ 1 ] = begin[ 1 ]; index[ 1 ] < end[ 1 ]; index[ 1 ]++ )
+            for( index[ 0 ] = begin[ 0 ]; index[ 0 ] < end[ 0 ]; index[ 0 ]++ )
                f( index, args... );
       }
 
       if( dim == 3 ) {
-         for( index[2] = begin[2]; index[2] < end[2]; index[2]++ )
-         for( index[1] = begin[1]; index[1] < end[1]; index[1]++ )
-         for( index[0] = begin[0]; index[0] < end[0]; index[0]++ )
-            f( index, args... );
+         for( index[ 2 ] = begin[ 2 ]; index[ 2 ] < end[ 2 ]; index[ 2 ]++ )
+            for( index[ 1 ] = begin[ 1 ]; index[ 1 ] < end[ 1 ]; index[ 1 ]++ )
+               for( index[ 0 ] = begin[ 0 ]; index[ 0 ] < end[ 0 ]; index[ 0 ]++ )
+                  f( index, args... );
       }
    }
 
-  public:
-    static bool Cut(MeshFunctionType &inputMeshFunction,
-                    OutMesh &outMesh,
-                    OutDof &outData,
-                    Containers::StaticVector<outDimension, int> savedDimensions,
-                    Containers::StaticVector<codimension,int> reducedDimensions,
-                    Containers::StaticVector<codimension,typename MeshFunctionType::IndexType> fixedIndexs )
-    {
-        bool inCut;
-        Containers::StaticVector<codimension,typename MeshFunctionType::IndexType> localFixedIndexs;
-
-        auto fromData=inputMeshFunction.getData().getData();
-        auto fromMesh=inputMeshFunction.getMesh();
-
-        //Set-up Grid
-        auto fromDistributedGrid=fromMesh.getDistributedMesh();
-        if(fromDistributedGrid!=nullptr)
-        {
-            auto toDistributedGrid=outMesh.getDistributedMesh();
-            TNL_ASSERT_TRUE(toDistributedGrid!=nullptr,"You are trying cut distributed meshfunction, but output grid is not set up for distribution");
-
-            inCut=toDistributedGrid->SetupByCut(*fromDistributedGrid,savedDimensions,reducedDimensions,fixedIndexs);
-            if(inCut)
-            {
-               toDistributedGrid->setupGrid(outMesh);
-               for(int i=0;i<codimension;i++)
-                   localFixedIndexs[i]=fixedIndexs[i]-fromDistributedGrid->getGlobalBegin()[reducedDimensions[i]];
-            }
-        }
-        else
-        {
-            typename OutMesh::PointType outOrigin;
-            typename OutMesh::PointType outProportions;
-            typename OutMesh::CoordinatesType outDimensions;
-
-            for(int i=0; i<outDimension;i++)
-            {
-                outOrigin[i]=fromMesh.getOrigin()[savedDimensions[i]];
-                outProportions[i]=fromMesh.getProportions()[savedDimensions[i]];
-                outDimensions[i]=fromMesh.getDimensions()[savedDimensions[i]];
-            }
-
-            outMesh.setDimensions(outDimensions);
-            outMesh.setDomain(outOrigin,outProportions);
-
-            inCut=true;
-            localFixedIndexs=fixedIndexs;
-
-        }
-
-        //copy data
-        if(inCut)
-        {
-            outData.setSize(outMesh.template getEntitiesCount< typename OutMesh::Cell >());
-            auto kernel = [&fromData, &fromMesh, &outData, &outMesh, &savedDimensions,&localFixedIndexs,&reducedDimensions ] ( typename OutMesh::CoordinatesType index )
-            {
-
-                typename MeshFunctionType::MeshType::Cell fromEntity(fromMesh);
-                typename OutMesh::Cell outEntity(outMesh);
-
-                for(int j=0;j<outDimension;j++)
-                {
-                    fromEntity.getCoordinates()[savedDimensions[j]]=index[j];
-                    outEntity.getCoordinates()[j]=index[j];
-                }
+public:
+   static bool
+   Cut( MeshFunctionType& inputMeshFunction,
+        OutMesh& outMesh,
+        OutDof& outData,
+        Containers::StaticVector< outDimension, int > savedDimensions,
+        Containers::StaticVector< codimension, int > reducedDimensions,
+        Containers::StaticVector< codimension, typename MeshFunctionType::IndexType > fixedIndexs )
+   {
+      bool inCut;
+      Containers::StaticVector< codimension, typename MeshFunctionType::IndexType > localFixedIndexs;
+
+      auto fromData = inputMeshFunction.getData().getData();
+      auto fromMesh = inputMeshFunction.getMesh();
+
+      // Set-up Grid
+      auto fromDistributedGrid = fromMesh.getDistributedMesh();
+      if( fromDistributedGrid != nullptr ) {
+         auto toDistributedGrid = outMesh.getDistributedMesh();
+         TNL_ASSERT_TRUE( toDistributedGrid != nullptr,
+                          "You are trying cut distributed meshfunction, but output grid is not set up for distribution" );
+
+         inCut = toDistributedGrid->SetupByCut( *fromDistributedGrid, savedDimensions, reducedDimensions, fixedIndexs );
+         if( inCut ) {
+            toDistributedGrid->setupGrid( outMesh );
+            for( int i = 0; i < codimension; i++ )
+               localFixedIndexs[ i ] = fixedIndexs[ i ] - fromDistributedGrid->getGlobalBegin()[ reducedDimensions[ i ] ];
+         }
+      }
+      else {
+         typename OutMesh::PointType outOrigin;
+         typename OutMesh::PointType outProportions;
+         typename OutMesh::CoordinatesType outDimensions;
+
+         for( int i = 0; i < outDimension; i++ ) {
+            outOrigin[ i ] = fromMesh.getOrigin()[ savedDimensions[ i ] ];
+            outProportions[ i ] = fromMesh.getProportions()[ savedDimensions[ i ] ];
+            outDimensions[ i ] = fromMesh.getDimensions()[ savedDimensions[ i ] ];
+         }
+
+         outMesh.setDimensions( outDimensions );
+         outMesh.setDomain( outOrigin, outProportions );
+
+         inCut = true;
+         localFixedIndexs = fixedIndexs;
+      }
 
-                for(int j=0; j<codimension;j++)
-                    fromEntity.getCoordinates()[reducedDimensions[j]]=localFixedIndexs[j];
+      // copy data
+      if( inCut ) {
+         outData.setSize( outMesh.template getEntitiesCount< typename OutMesh::Cell >() );
+         auto kernel = [ &fromData, &fromMesh, &outData, &outMesh, &savedDimensions, &localFixedIndexs, &reducedDimensions ](
+                          typename OutMesh::CoordinatesType index )
+         {
+            typename MeshFunctionType::MeshType::Cell fromEntity( fromMesh );
+            typename OutMesh::Cell outEntity( outMesh );
+
+            for( int j = 0; j < outDimension; j++ ) {
+               fromEntity.getCoordinates()[ savedDimensions[ j ] ] = index[ j ];
+               outEntity.getCoordinates()[ j ] = index[ j ];
+            }
 
-                fromEntity.refresh();
-                outEntity.refresh();
-                outData[outEntity.getIndex()]=fromData[fromEntity.getIndex()];
-            };
+            for( int j = 0; j < codimension; j++ )
+               fromEntity.getCoordinates()[ reducedDimensions[ j ] ] = localFixedIndexs[ j ];
 
+            fromEntity.refresh();
+            outEntity.refresh();
+            outData[ outEntity.getIndex() ] = fromData[ fromEntity.getIndex() ];
+         };
 
-            typename OutMesh::CoordinatesType starts;
-            starts.setValue(0);
-            staticVectorFor(starts,outMesh.getDimensions(),kernel);
-        }
+         typename OutMesh::CoordinatesType starts;
+         starts.setValue( 0 );
+         staticVectorFor( starts, outMesh.getDimensions(), kernel );
+      }
 
-        return inCut;
-    }
+      return inCut;
+   }
 };
 
-} // namespace Functions
-} // namespace TNL
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/Domain.h b/src/TNL/Functions/Domain.h
index f46d80dc0b04dc5ec60d140815e00de1ae3eb203..2423882d8c9de6487c1bf904be699ee15940e295 100644
--- a/src/TNL/Functions/Domain.h
+++ b/src/TNL/Functions/Domain.h
@@ -4,27 +4,38 @@
 //
 // SPDX-License-Identifier: MIT
 
-
 #pragma once
 
 namespace TNL {
-namespace Functions {   
+namespace Functions {
 
-enum DomainType { NonspaceDomain, SpaceDomain, MeshDomain, MeshInteriorDomain, MeshBoundaryDomain };
+enum DomainType
+{
+   NonspaceDomain,
+   SpaceDomain,
+   MeshDomain,
+   MeshInteriorDomain,
+   MeshBoundaryDomain
+};
 
-template< int Dimension,
-          DomainType DomainType_ = SpaceDomain >
+template< int Dimension, DomainType DomainType_ = SpaceDomain >
 class Domain
 {
-   public:
- 
-      typedef void DeviceType;
- 
-      static constexpr int getDomainDimension() { return Dimension; }
- 
-      static constexpr DomainType getDomainType() { return DomainType_; }
-};
+public:
+   using DeviceType = void;
+
+   static constexpr int
+   getDomainDimension()
+   {
+      return Dimension;
+   }
 
-} // namespace Functions
-} // namespace TNL
+   static constexpr DomainType
+   getDomainType()
+   {
+      return DomainType_;
+   }
+};
 
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/ExactOperatorFunction.h b/src/TNL/Functions/ExactOperatorFunction.h
index 598a37d27b7fe59ac1e90a240ef0143364d55e97..e4452f02453c4d396928b23be3ad41f7b89c8f5a 100644
--- a/src/TNL/Functions/ExactOperatorFunction.h
+++ b/src/TNL/Functions/ExactOperatorFunction.h
@@ -9,44 +9,42 @@
 #include <TNL/Functions/Domain.h>
 
 namespace TNL {
-namespace Functions {   
+namespace Functions {
 
-template< typename Operator,
-          typename Function >
+template< typename Operator, typename Function >
 class ExactOperatorFunction : public Domain< Operator::getDomainDimension(), SpaceDomain >
 {
    static_assert( Operator::getDomainDimension() == Function::getDomainDimension(),
-      "Operator and function have different number of domain dimensions." );
- 
-   public:
- 
-      typedef Operator OperatorType;
-      typedef Function FunctionType;
-      typedef typename FunctionType::RealType RealType;
-      typedef typename FunctionType::PointType PointType;
- 
-      static constexpr int getDomainDimension() { return Operator::getDomainDimension(); }
- 
-      ExactOperatorFunction(
-         const OperatorType& operator_,
-         const FunctionType& function )
-      : operator_( operator_ ), function( function ) {}
- 
-      __cuda_callable__
-      RealType operator()(
-         const PointType& vertex,
-         const RealType& time ) const
-      {
-         return this->operator_( function, vertex, time );
-      }
- 
-   protected:
- 
-      const OperatorType& operator_;
- 
-      const FunctionType& function;
-};
+                  "Operator and function have different number of domain dimensions." );
+
+public:
+   typedef Operator OperatorType;
+   typedef Function FunctionType;
+   typedef typename FunctionType::RealType RealType;
+   typedef typename FunctionType::PointType PointType;
+
+   static constexpr int
+   getDomainDimension()
+   {
+      return Operator::getDomainDimension();
+   }
+
+   ExactOperatorFunction( const OperatorType& operator_, const FunctionType& function )
+   : operator_( operator_ ), function( function )
+   {}
 
-} // namespace Functions
-} // namespace TNL
+   __cuda_callable__
+   RealType
+   operator()( const PointType& vertex, const RealType& time ) const
+   {
+      return this->operator_( function, vertex, time );
+   }
+
+protected:
+   const OperatorType& operator_;
+
+   const FunctionType& function;
+};
 
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/FunctionAdapter.h b/src/TNL/Functions/FunctionAdapter.h
index b687ebd0ef80d1a48c8f51e031375936a836b142..c791f60dc6ec9a5d9b32bcc576d65fcd9c6ec36e 100644
--- a/src/TNL/Functions/FunctionAdapter.h
+++ b/src/TNL/Functions/FunctionAdapter.h
@@ -11,7 +11,7 @@
 #include <TNL/Functions/Domain.h>
 
 namespace TNL {
-namespace Functions {   
+namespace Functions {
 
 /***
  * MeshType is a type of mesh on which we evaluate the function.
@@ -19,72 +19,66 @@ namespace Functions {
  * the function. In TNL, we mostly work with mesh functions. In this case
  * mesh entity and time is passed to the function...
  */
-template< typename Mesh,
-          typename Function,
-          int domainType = Function::getDomainType() >
+template< typename Mesh, typename Function, int domainType = Function::getDomainType() >
 class FunctionAdapter
 {
-      public:
- 
-      typedef Function FunctionType;
-      typedef Mesh MeshType;
-      typedef typename FunctionType::RealType  RealType;
-      typedef typename MeshType::GlobalIndexType     IndexType;
-      //typedef typename FunctionType::PointType PointType;
- 
-      template< typename MeshPointer >
-      static bool setup( FunctionType& function,
-                         const MeshPointer& meshPointer,
-                         const Config::ParameterContainer& parameters,
-                         const String& prefix = "" )
-      {
-         return function.setup( meshPointer, parameters, prefix );
-      }
-      
-      template< typename EntityType >
-      __cuda_callable__ inline
-      static RealType getValue( const FunctionType& function,
-                                const EntityType& meshEntity,
-                                const RealType& time )
-      {
-         return function( meshEntity, time );
-      }
+public:
+   using FunctionType = Function;
+   using MeshType = Mesh;
+   using RealType = typename FunctionType::RealType;
+   using IndexType = typename MeshType::GlobalIndexType;
+   // typedef typename FunctionType::PointType PointType;
+
+   template< typename MeshPointer >
+   static bool
+   setup( FunctionType& function,
+          const MeshPointer& meshPointer,
+          const Config::ParameterContainer& parameters,
+          const String& prefix = "" )
+   {
+      return function.setup( meshPointer, parameters, prefix );
+   }
+
+   template< typename EntityType >
+   __cuda_callable__
+   inline static RealType
+   getValue( const FunctionType& function, const EntityType& meshEntity, const RealType& time )
+   {
+      return function( meshEntity, time );
+   }
 };
 
 /***
  * Specialization for analytic functions. In this case
  * we pass vertex and time to the function ...
  */
-template< typename Mesh,
-          typename Function >
+template< typename Mesh, typename Function >
 class FunctionAdapter< Mesh, Function, SpaceDomain >
 {
-   public:
- 
-      typedef Function FunctionType;
-      typedef Mesh MeshType;
-      typedef typename FunctionType::RealType  RealType;
-      typedef typename MeshType::GlobalIndexType     IndexType;
-      typedef typename FunctionType::PointType PointType;
-      
-      template< typename MeshPointer >
-      static bool setup( FunctionType& function,
-                         const MeshPointer& meshPointer,
-                         const Config::ParameterContainer& parameters,
-                         const String& prefix = "" )
-      {
-         return function.setup( parameters, prefix );
-      }
-      
- 
-      template< typename EntityType >
-      __cuda_callable__ inline
-      static RealType getValue( const FunctionType& function,
-                                const EntityType& meshEntity,
-                                const RealType& time )
-      {
-         return function( meshEntity.getCenter(), time );
-      }
+public:
+   using FunctionType = Function;
+   using MeshType = Mesh;
+   using RealType = typename FunctionType::RealType;
+   using IndexType = typename MeshType::GlobalIndexType;
+   using PointType = typename FunctionType::PointType;
+
+   template< typename MeshPointer >
+   static bool
+   setup( FunctionType& function,
+          const MeshPointer& meshPointer,
+          const Config::ParameterContainer& parameters,
+          const String& prefix = "" )
+   {
+      return function.setup( parameters, prefix );
+   }
+
+   template< typename EntityType >
+   __cuda_callable__
+   inline static RealType
+   getValue( const FunctionType& function, const EntityType& meshEntity, const RealType& time )
+   {
+      return function( meshEntity.getCenter(), time );
+   }
 };
 
 /***
@@ -92,35 +86,33 @@ class FunctionAdapter< Mesh, Function, SpaceDomain >
  * Such function does not depend on any space variable and so
  * we pass only time.
  */
-template< typename Mesh,
-          typename Function >
+template< typename Mesh, typename Function >
 class FunctionAdapter< Mesh, Function, NonspaceDomain >
 {
-   public:
- 
-      typedef Function FunctionType;
-      typedef Mesh MeshType;
-      typedef typename FunctionType::RealType  RealType;
-      typedef typename MeshType::GlobalIndexType     IndexType;
-      typedef typename FunctionType::PointType PointType;
-      
-      template< typename MeshPointer >
-      static bool setup( FunctionType& function,
-                         const MeshPointer& meshPointer,
-                         const Config::ParameterContainer& parameters,
-                         const String& prefix = "" )
-      {
-         return function.setup( parameters, prefix );
-      }
-      
-      template< typename EntityType >
-      __cuda_callable__ inline
-      static RealType getValue( const FunctionType& function,
-                                const EntityType& meshEntity,
-                                const RealType& time )
-      {
-         return function.getValue( time );
-      }
+public:
+   using FunctionType = Function;
+   using MeshType = Mesh;
+   using RealType = typename FunctionType::RealType;
+   using IndexType = typename MeshType::GlobalIndexType;
+   using PointType = typename FunctionType::PointType;
+
+   template< typename MeshPointer >
+   static bool
+   setup( FunctionType& function,
+          const MeshPointer& meshPointer,
+          const Config::ParameterContainer& parameters,
+          const String& prefix = "" )
+   {
+      return function.setup( parameters, prefix );
+   }
+
+   template< typename EntityType >
+   __cuda_callable__
+   inline static RealType
+   getValue( const FunctionType& function, const EntityType& meshEntity, const RealType& time )
+   {
+      return function.getValue( time );
+   }
 };
 
 #ifdef UNDEF
@@ -128,78 +120,68 @@ class FunctionAdapter< Mesh, Function, NonspaceDomain >
 /***
  * Specialization for mesh functions
  */
-template< typename Mesh,
-          typename Function >
+template< typename Mesh, typename Function >
 class FunctionAdapter< Mesh, Function, MeshFunction >
 {
-   public:
- 
-      typedef Function FunctionType;
-      typedef Mesh MeshType;
-      typedef typename FunctionType::RealType  RealType;
-      typedef typename MeshType::GlobalIndexType     IndexType;
- 
-      template< typename EntityType >
-      __cuda_callable__ inline
-      static RealType getValue( const FunctionType& function,
-                                const EntityType& meshEntity,
-                                const RealType& time )
-      {
-         return function( meshEntity, time );
-      }
+public:
+   typedef Function FunctionType;
+   typedef Mesh MeshType;
+   typedef typename FunctionType::RealType RealType;
+   typedef typename MeshType::GlobalIndexType IndexType;
+
+   template< typename EntityType >
+   __cuda_callable__
+   inline static RealType
+   getValue( const FunctionType& function, const EntityType& meshEntity, const RealType& time )
+   {
+      return function( meshEntity, time );
+   }
 };
 
 /***
  * Specialization for analytic functions
  */
-template< typename Mesh,
-          typename Function >
+template< typename Mesh, typename Function >
 class FunctionAdapter< Mesh, Function, SpaceDomain >
 {
-   public:
- 
-      typedef Function FunctionType;
-      typedef Mesh MeshType;
-      typedef typename FunctionType::RealType  RealType;
-      typedef typename MeshType::GlobalIndexType     IndexType;
-      typedef typename FunctionType::PointType PointType;
- 
-      template< typename EntityType >
-      __cuda_callable__ inline
-      static RealType getValue( const FunctionType& function,
-                                const EntityType& meshEntity,
-                                const RealType& time )
-      {
-         return function.getValue( meshEntity.getCenter(), time );
-      }
+public:
+   typedef Function FunctionType;
+   typedef Mesh MeshType;
+   typedef typename FunctionType::RealType RealType;
+   typedef typename MeshType::GlobalIndexType IndexType;
+   typedef typename FunctionType::PointType PointType;
+
+   template< typename EntityType >
+   __cuda_callable__
+   inline static RealType
+   getValue( const FunctionType& function, const EntityType& meshEntity, const RealType& time )
+   {
+      return function.getValue( meshEntity.getCenter(), time );
+   }
 };
 
 /***
  * Specialization for constant analytic functions
  */
-template< typename Mesh,
-          typename Function >
+template< typename Mesh, typename Function >
 class FunctionAdapter< Mesh, Function, SpaceDomain >
 {
-   public:
- 
-      typedef Function FunctionType;
-      typedef Mesh MeshType;
-      typedef typename FunctionType::RealType  RealType;
-      typedef typename MeshType::GlobalIndexType     IndexType;
-      typedef typename FunctionType::PointType PointType;
- 
-      template< typename EntityType >
-      __cuda_callable__ inline
-      static RealType getValue( const FunctionType& function,
-                                const EntityType& meshEntity,
-                                const RealType& time )
-      {
-         return function.getValue( time );
-      }
+public:
+   typedef Function FunctionType;
+   typedef Mesh MeshType;
+   typedef typename FunctionType::RealType RealType;
+   typedef typename MeshType::GlobalIndexType IndexType;
+   typedef typename FunctionType::PointType PointType;
+
+   template< typename EntityType >
+   __cuda_callable__
+   inline static RealType
+   getValue( const FunctionType& function, const EntityType& meshEntity, const RealType& time )
+   {
+      return function.getValue( time );
+   }
 };
 #endif
 
-} // namespace Functions
-} // namespace TNL
-
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/MeshFunction.h b/src/TNL/Functions/MeshFunction.h
index 1d68eccce07813866cb22485c267bba9637253ce..d53799c795828e0c231a07676644afd224e66917 100644
--- a/src/TNL/Functions/MeshFunction.h
+++ b/src/TNL/Functions/MeshFunction.h
@@ -14,117 +14,138 @@
 namespace TNL {
 namespace Functions {
 
-template< typename Mesh,
-          int MeshEntityDimension = Mesh::getMeshDimension(),
-          typename Real = typename Mesh::RealType >
-class MeshFunction :
-   public Domain< Mesh::getMeshDimension(), MeshDomain >
+template< typename Mesh, int MeshEntityDimension = Mesh::getMeshDimension(), typename Real = typename Mesh::RealType >
+class MeshFunction : public Domain< Mesh::getMeshDimension(), MeshDomain >
 {
-   //static_assert( Mesh::DeviceType::DeviceType == Vector::DeviceType::DeviceType,
-   //               "Both mesh and vector of a mesh function must reside on the same device.");
-   public:
+   // static_assert( Mesh::DeviceType::DeviceType == Vector::DeviceType::DeviceType,
+   //                "Both mesh and vector of a mesh function must reside on the same device.");
+public:
+   using MeshType = Mesh;
+   using DeviceType = typename MeshType::DeviceType;
+   using IndexType = typename MeshType::GlobalIndexType;
+   using MeshPointer = Pointers::SharedPointer< MeshType >;
+   using RealType = Real;
+   using VectorType = Containers::Vector< RealType, DeviceType, IndexType >;
 
-      using MeshType = Mesh;
-      using DeviceType = typename MeshType::DeviceType;
-      using IndexType = typename MeshType::GlobalIndexType;
-      using MeshPointer = Pointers::SharedPointer< MeshType >;
-      using RealType = Real;
-      using VectorType = Containers::Vector< RealType, DeviceType, IndexType >;
+   static constexpr int
+   getEntitiesDimension()
+   {
+      return MeshEntityDimension;
+   }
 
-      static constexpr int getEntitiesDimension() { return MeshEntityDimension; }
+   static constexpr int
+   getMeshDimension()
+   {
+      return MeshType::getMeshDimension();
+   }
 
-      static constexpr int getMeshDimension() { return MeshType::getMeshDimension(); }
+   MeshFunction();
 
-      MeshFunction();
+   MeshFunction( const MeshPointer& meshPointer );
 
-      MeshFunction( const MeshPointer& meshPointer );
+   MeshFunction( const MeshFunction& meshFunction );
 
-      MeshFunction( const MeshFunction& meshFunction );
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" );
 
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" );
+   bool
+   setup( const MeshPointer& meshPointer, const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-      bool setup( const MeshPointer& meshPointer,
-                  const Config::ParameterContainer& parameters,
-                  const String& prefix = "" );
+   void
+   setMesh( const MeshPointer& meshPointer );
 
-      void setMesh( const MeshPointer& meshPointer );
+   template< typename Device = Devices::Host >
+   __cuda_callable__
+   const MeshType&
+   getMesh() const;
 
-      template< typename Device = Devices::Host >
-      __cuda_callable__
-      const MeshType& getMesh() const;
+   const MeshPointer&
+   getMeshPointer() const;
 
-      const MeshPointer& getMeshPointer() const;
+   MeshPointer&
+   getMeshPointer();
 
-      MeshPointer& getMeshPointer();
+   static IndexType
+   getDofs( const MeshPointer& meshPointer );
 
-      static IndexType getDofs( const MeshPointer& meshPointer );
+   __cuda_callable__
+   const VectorType&
+   getData() const;
 
-      __cuda_callable__ const VectorType& getData() const;
+   __cuda_callable__
+   VectorType&
+   getData();
 
-      __cuda_callable__ VectorType& getData();
+   bool
+   refresh( const RealType& time = 0.0 ) const;
 
-      bool refresh( const RealType& time = 0.0 ) const;
+   bool
+   deepRefresh( const RealType& time = 0.0 ) const;
 
-      bool deepRefresh( const RealType& time = 0.0 ) const;
+   template< typename EntityType >
+   RealType
+   getValue( const EntityType& meshEntity ) const;
 
-      template< typename EntityType >
-      RealType getValue( const EntityType& meshEntity ) const;
+   template< typename EntityType >
+   void
+   setValue( const EntityType& meshEntity, const RealType& value );
 
-      template< typename EntityType >
-      void setValue( const EntityType& meshEntity,
-                     const RealType& value );
+   template< typename EntityType >
+   __cuda_callable__
+   RealType&
+   operator()( const EntityType& meshEntity, const RealType& time = 0 );
 
-      template< typename EntityType >
-      __cuda_callable__
-      RealType& operator()( const EntityType& meshEntity,
-                            const RealType& time = 0 );
+   template< typename EntityType >
+   __cuda_callable__
+   const RealType&
+   operator()( const EntityType& meshEntity, const RealType& time = 0 ) const;
 
-      template< typename EntityType >
-      __cuda_callable__
-      const RealType& operator()( const EntityType& meshEntity,
-                                  const RealType& time = 0 ) const;
+   __cuda_callable__
+   RealType&
+   operator[]( const IndexType& meshEntityIndex );
 
-      __cuda_callable__
-      RealType& operator[]( const IndexType& meshEntityIndex );
+   __cuda_callable__
+   const RealType&
+   operator[]( const IndexType& meshEntityIndex ) const;
 
-      __cuda_callable__
-      const RealType& operator[]( const IndexType& meshEntityIndex ) const;
+   MeshFunction&
+   operator=( const MeshFunction& f );
 
-      MeshFunction& operator = ( const MeshFunction& f );
+   template< typename Function >
+   MeshFunction&
+   operator=( const Function& f );
 
-      template< typename Function >
-      MeshFunction& operator = ( const Function& f );
+   template< typename Function >
+   MeshFunction&
+   operator-=( const Function& f );
 
-      template< typename Function >
-      MeshFunction& operator -= ( const Function& f );
+   template< typename Function >
+   MeshFunction&
+   operator+=( const Function& f );
 
-      template< typename Function >
-      MeshFunction& operator += ( const Function& f );
+   RealType
+   getLpNorm( const RealType& p ) const;
 
-      RealType getLpNorm( const RealType& p ) const;
+   RealType
+   getMaxNorm() const;
 
-      RealType getMaxNorm() const;
+   bool
+   write( const std::string& functionName, const std::string& fileName, const std::string& fileFormat = "auto" ) const;
 
-      bool write( const std::string& functionName,
-                  const std::string& fileName,
-                  const std::string& fileFormat = "auto" ) const;
+protected:
+   MeshPointer meshPointer;
 
-   protected:
+   VectorType data;
 
-      MeshPointer meshPointer;
-
-      VectorType data;
-
-      template< typename, typename > friend class MeshFunctionEvaluator;
+   template< typename, typename >
+   friend class MeshFunctionEvaluator;
 };
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-std::ostream& operator << ( std::ostream& str, const MeshFunction< Mesh, MeshEntityDimension, Real >& f );
+template< typename Mesh, int MeshEntityDimension, typename Real >
+std::ostream&
+operator<<( std::ostream& str, const MeshFunction< Mesh, MeshEntityDimension, Real >& f );
 
-} // namespace Functions
-} // namespace TNL
+}  // namespace Functions
+}  // namespace TNL
 
 #include <TNL/Functions/MeshFunction.hpp>
diff --git a/src/TNL/Functions/MeshFunction.hpp b/src/TNL/Functions/MeshFunction.hpp
index 5ae20c8e35e15e4063ccd2f19ad847b1b86d1059..2f8309dcd535a1103f1e48a077fac517d9dd04d0 100644
--- a/src/TNL/Functions/MeshFunction.hpp
+++ b/src/TNL/Functions/MeshFunction.hpp
@@ -16,54 +16,36 @@
 namespace TNL {
 namespace Functions {
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-MeshFunction()
-{
-}
+template< typename Mesh, int MeshEntityDimension, typename Real >
+MeshFunction< Mesh, MeshEntityDimension, Real >::MeshFunction() = default;
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-MeshFunction( const MeshPointer& meshPointer )
+template< typename Mesh, int MeshEntityDimension, typename Real >
+MeshFunction< Mesh, MeshEntityDimension, Real >::MeshFunction( const MeshPointer& meshPointer )
 {
    this->meshPointer = meshPointer;
    this->data.setSize( getMesh().template getEntitiesCount< typename Mesh::template EntityType< MeshEntityDimension > >() );
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-MeshFunction( const MeshFunction& meshFunction )
+template< typename Mesh, int MeshEntityDimension, typename Real >
+MeshFunction< Mesh, MeshEntityDimension, Real >::MeshFunction( const MeshFunction& meshFunction )
 {
    this->meshPointer = meshFunction.meshPointer;
    this->data = meshFunction.getData();
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 void
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-configSetup( Config::ConfigDescription& config,
-             const String& prefix )
+MeshFunction< Mesh, MeshEntityDimension, Real >::configSetup( Config::ConfigDescription& config, const String& prefix )
 {
    config.addEntry< String >( prefix + "file", "Dataset for the mesh function." );
    config.addEntry< String >( prefix + "function-name", "Name of the mesh function in the input file.", "f" );
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 bool
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-setup( const MeshPointer& meshPointer,
-       const Config::ParameterContainer& parameters,
-       const String& prefix )
+MeshFunction< Mesh, MeshEntityDimension, Real >::setup( const MeshPointer& meshPointer,
+                                                        const Config::ParameterContainer& parameters,
+                                                        const String& prefix )
 {
    this->setMesh( meshPointer );
    const String fileName = parameters.getParameter< String >( prefix + "file" );
@@ -71,195 +53,145 @@ setup( const MeshPointer& meshPointer,
    return readMeshFunction( *this, functionName, fileName );
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 void
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-setMesh( const MeshPointer& meshPointer )
+MeshFunction< Mesh, MeshEntityDimension, Real >::setMesh( const MeshPointer& meshPointer )
 {
    this->meshPointer = meshPointer;
    this->data.setSize( getMesh().template getEntitiesCount< typename Mesh::template EntityType< MeshEntityDimension > >() );
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
- template< typename Device >
+template< typename Mesh, int MeshEntityDimension, typename Real >
+template< typename Device >
 __cuda_callable__
 const typename MeshFunction< Mesh, MeshEntityDimension, Real >::MeshType&
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-getMesh() const
+MeshFunction< Mesh, MeshEntityDimension, Real >::getMesh() const
 {
    return this->meshPointer.template getData< Device >();
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 const typename MeshFunction< Mesh, MeshEntityDimension, Real >::MeshPointer&
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-getMeshPointer() const
+MeshFunction< Mesh, MeshEntityDimension, Real >::getMeshPointer() const
 {
    return this->meshPointer;
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 typename MeshFunction< Mesh, MeshEntityDimension, Real >::MeshPointer&
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-getMeshPointer()
+MeshFunction< Mesh, MeshEntityDimension, Real >::getMeshPointer()
 {
    return this->meshPointer;
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 typename MeshFunction< Mesh, MeshEntityDimension, Real >::IndexType
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-getDofs( const MeshPointer& meshPointer )
+MeshFunction< Mesh, MeshEntityDimension, Real >::getDofs( const MeshPointer& meshPointer )
 {
    return meshPointer->template getEntitiesCount< getEntitiesDimension() >();
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 __cuda_callable__
 const typename MeshFunction< Mesh, MeshEntityDimension, Real >::VectorType&
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-getData() const
+MeshFunction< Mesh, MeshEntityDimension, Real >::getData() const
 {
    return this->data;
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 __cuda_callable__
 typename MeshFunction< Mesh, MeshEntityDimension, Real >::VectorType&
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-getData()
+MeshFunction< Mesh, MeshEntityDimension, Real >::getData()
 {
    return this->data;
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 bool
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-refresh( const RealType& time ) const
+MeshFunction< Mesh, MeshEntityDimension, Real >::refresh( const RealType& time ) const
 {
    return true;
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 bool
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-deepRefresh( const RealType& time ) const
+MeshFunction< Mesh, MeshEntityDimension, Real >::deepRefresh( const RealType& time ) const
 {
    return true;
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-   template< typename EntityType >
+template< typename Mesh, int MeshEntityDimension, typename Real >
+template< typename EntityType >
 typename Functions::MeshFunction< Mesh, MeshEntityDimension, Real >::RealType
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-getValue( const EntityType& meshEntity ) const
+MeshFunction< Mesh, MeshEntityDimension, Real >::getValue( const EntityType& meshEntity ) const
 {
-   static_assert( EntityType::getEntityDimension() == MeshEntityDimension, "Calling with wrong EntityType -- entity dimensions do not match." );
+   static_assert( EntityType::getEntityDimension() == MeshEntityDimension,
+                  "Calling with wrong EntityType -- entity dimensions do not match." );
    return this->data.getElement( meshEntity.getIndex() );
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-   template< typename EntityType >
+template< typename Mesh, int MeshEntityDimension, typename Real >
+template< typename EntityType >
 void
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-setValue( const EntityType& meshEntity,
-          const RealType& value )
+MeshFunction< Mesh, MeshEntityDimension, Real >::setValue( const EntityType& meshEntity, const RealType& value )
 {
-   static_assert( EntityType::getEntityDimension() == MeshEntityDimension, "Calling with wrong EntityType -- entity dimensions do not match." );
+   static_assert( EntityType::getEntityDimension() == MeshEntityDimension,
+                  "Calling with wrong EntityType -- entity dimensions do not match." );
    this->data.setElement( meshEntity.getIndex(), value );
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-   template< typename EntityType >
+template< typename Mesh, int MeshEntityDimension, typename Real >
+template< typename EntityType >
 __cuda_callable__
 typename Functions::MeshFunction< Mesh, MeshEntityDimension, Real >::RealType&
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-operator()( const EntityType& meshEntity,
-            const RealType& time )
+MeshFunction< Mesh, MeshEntityDimension, Real >::operator()( const EntityType& meshEntity, const RealType& time )
 {
-   static_assert( EntityType::getEntityDimension() == MeshEntityDimension, "Calling with wrong EntityType -- entity dimensions do not match." );
+   static_assert( EntityType::getEntityDimension() == MeshEntityDimension,
+                  "Calling with wrong EntityType -- entity dimensions do not match." );
    return this->data[ meshEntity.getIndex() ];
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-   template< typename EntityType >
+template< typename Mesh, int MeshEntityDimension, typename Real >
+template< typename EntityType >
 __cuda_callable__
 const typename Functions::MeshFunction< Mesh, MeshEntityDimension, Real >::RealType&
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-operator()( const EntityType& meshEntity,
-            const RealType& time ) const
+MeshFunction< Mesh, MeshEntityDimension, Real >::operator()( const EntityType& meshEntity, const RealType& time ) const
 {
-   static_assert( EntityType::getEntityDimension() == MeshEntityDimension, "Calling with wrong EntityType -- entity dimensions do not match." );
+   static_assert( EntityType::getEntityDimension() == MeshEntityDimension,
+                  "Calling with wrong EntityType -- entity dimensions do not match." );
    return this->data[ meshEntity.getIndex() ];
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 __cuda_callable__
 typename Functions::MeshFunction< Mesh, MeshEntityDimension, Real >::RealType&
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-operator[]( const IndexType& meshEntityIndex )
+MeshFunction< Mesh, MeshEntityDimension, Real >::operator[]( const IndexType& meshEntityIndex )
 {
    return this->data[ meshEntityIndex ];
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 __cuda_callable__
 const typename Functions::MeshFunction< Mesh, MeshEntityDimension, Real >::RealType&
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-operator[]( const IndexType& meshEntityIndex ) const
+MeshFunction< Mesh, MeshEntityDimension, Real >::operator[]( const IndexType& meshEntityIndex ) const
 {
    return this->data[ meshEntityIndex ];
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 MeshFunction< Mesh, MeshEntityDimension, Real >&
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-operator = ( const MeshFunction& f )
+MeshFunction< Mesh, MeshEntityDimension, Real >::operator=( const MeshFunction& f )
 {
    this->setMesh( f.getMeshPointer() );
    this->getData() = f.getData();
    return *this;
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-   template< typename Function >
+template< typename Mesh, int MeshEntityDimension, typename Real >
+template< typename Function >
 MeshFunction< Mesh, MeshEntityDimension, Real >&
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-operator = ( const Function& f )
+MeshFunction< Mesh, MeshEntityDimension, Real >::operator=( const Function& f )
 {
    Pointers::DevicePointer< MeshFunction > thisDevicePtr( *this );
    Pointers::DevicePointer< std::add_const_t< Function > > fDevicePtr( f );
@@ -267,75 +199,58 @@ operator = ( const Function& f )
    return *this;
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-   template< typename Function >
+template< typename Mesh, int MeshEntityDimension, typename Real >
+template< typename Function >
 MeshFunction< Mesh, MeshEntityDimension, Real >&
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-operator += ( const Function& f )
+MeshFunction< Mesh, MeshEntityDimension, Real >::operator+=( const Function& f )
 {
    Pointers::DevicePointer< MeshFunction > thisDevicePtr( *this );
    Pointers::DevicePointer< std::add_const_t< Function > > fDevicePtr( f );
-   MeshFunctionEvaluator< MeshFunction, Function >::evaluate( thisDevicePtr, fDevicePtr, ( RealType ) 1.0, ( RealType ) 1.0 );
+   MeshFunctionEvaluator< MeshFunction, Function >::evaluate( thisDevicePtr, fDevicePtr, (RealType) 1.0, (RealType) 1.0 );
    return *this;
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-   template< typename Function >
+template< typename Mesh, int MeshEntityDimension, typename Real >
+template< typename Function >
 MeshFunction< Mesh, MeshEntityDimension, Real >&
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-operator -= ( const Function& f )
+MeshFunction< Mesh, MeshEntityDimension, Real >::operator-=( const Function& f )
 {
    Pointers::DevicePointer< MeshFunction > thisDevicePtr( *this );
    Pointers::DevicePointer< std::add_const_t< Function > > fDevicePtr( f );
-   MeshFunctionEvaluator< MeshFunction, Function >::evaluate( thisDevicePtr, fDevicePtr, ( RealType ) 1.0, ( RealType ) -1.0 );
+   MeshFunctionEvaluator< MeshFunction, Function >::evaluate( thisDevicePtr, fDevicePtr, (RealType) 1.0, (RealType) -1.0 );
    return *this;
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 Real
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-getLpNorm( const RealType& p ) const
+MeshFunction< Mesh, MeshEntityDimension, Real >::getLpNorm( const RealType& p ) const
 {
    return MeshFunctionNormGetter< Mesh >::getNorm( *this, p );
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 Real
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-getMaxNorm() const
+MeshFunction< Mesh, MeshEntityDimension, Real >::getMaxNorm() const
 {
    return max( abs( this->data ) );
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 bool
-MeshFunction< Mesh, MeshEntityDimension, Real >::
-write( const std::string& functionName,
-       const std::string& fileName,
-       const std::string& fileFormat ) const
+MeshFunction< Mesh, MeshEntityDimension, Real >::write( const std::string& functionName,
+                                                        const std::string& fileName,
+                                                        const std::string& fileFormat ) const
 {
    return writeMeshFunction( *this, functionName, fileName, fileFormat );
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 std::ostream&
-operator << ( std::ostream& str, const MeshFunction< Mesh, MeshEntityDimension, Real >& f )
+operator<<( std::ostream& str, const MeshFunction< Mesh, MeshEntityDimension, Real >& f )
 {
    str << f.getData();
    return str;
 }
 
-} // namespace Functions
-} // namespace TNL
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/MeshFunctionEvaluator.h b/src/TNL/Functions/MeshFunctionEvaluator.h
index 19c7b2d661a284f17ccdda143ff9ae7ebcd2799d..f50b0aab66fcfa75c0579c9b36842eba1efc0d2c 100644
--- a/src/TNL/Functions/MeshFunctionEvaluator.h
+++ b/src/TNL/Functions/MeshFunctionEvaluator.h
@@ -9,35 +9,28 @@
 #include <TNL/Functions/FunctionAdapter.h>
 
 namespace TNL {
-namespace Functions {   
+namespace Functions {
 
-template< typename OutMeshFunction,
-          typename InFunction,
-          typename Real >
+template< typename OutMeshFunction, typename InFunction, typename Real >
 class MeshFunctionEvaluatorTraverserUserData
 {
-   public:
-      typedef InFunction InFunctionType;
-
-      MeshFunctionEvaluatorTraverserUserData( const InFunction* function,
-                                              const Real& time,
-                                              OutMeshFunction* meshFunction,
-                                              const Real& outFunctionMultiplicator,
-                                              const Real& inFunctionMultiplicator )
-      : meshFunction( meshFunction ),
-        function( function ),
-        time( time ),
-        outFunctionMultiplicator( outFunctionMultiplicator ),
-        inFunctionMultiplicator( inFunctionMultiplicator )
-      {}
-
-      OutMeshFunction* meshFunction;
-      const InFunction* function;
-      const Real time, outFunctionMultiplicator, inFunctionMultiplicator;
-
+public:
+   using InFunctionType = InFunction;
+
+   MeshFunctionEvaluatorTraverserUserData( const InFunction* function,
+                                           const Real& time,
+                                           OutMeshFunction* meshFunction,
+                                           const Real& outFunctionMultiplicator,
+                                           const Real& inFunctionMultiplicator )
+   : meshFunction( meshFunction ), function( function ), time( time ), outFunctionMultiplicator( outFunctionMultiplicator ),
+     inFunctionMultiplicator( inFunctionMultiplicator )
+   {}
+
+   OutMeshFunction* meshFunction;
+   const InFunction* function;
+   const Real time, outFunctionMultiplicator, inFunctionMultiplicator;
 };
 
-
 /***
  * General mesh function evaluator. As an input function any type implementing
  * getValue( meshEntity, time ) may be substituted.
@@ -47,111 +40,108 @@ class MeshFunctionEvaluatorTraverserUserData
  *  evaluateInteriorEntities() - evaluate the input function only on the INTERIOR mesh entities
  *  evaluateBoundaryEntities() - evaluate the input function only on the BOUNDARY mesh entities
  */
-template< typename OutMeshFunction,
-          typename InFunction >
+template< typename OutMeshFunction, typename InFunction >
 class MeshFunctionEvaluator
 {
    static_assert( OutMeshFunction::getDomainDimension() == InFunction::getDomainDimension(),
                   "Input and output functions must have the same domain dimensions." );
 
-   public:
-      typedef typename InFunction::RealType RealType;
-      typedef typename OutMeshFunction::MeshType MeshType;
-      typedef typename MeshType::DeviceType DeviceType;
-      typedef Functions::MeshFunctionEvaluatorTraverserUserData< OutMeshFunction, InFunction, RealType > TraverserUserData;
-
-      template< typename OutMeshFunctionPointer, typename InFunctionPointer >
-      static void evaluate( OutMeshFunctionPointer& meshFunction,
-                            const InFunctionPointer& function,
-                            const RealType& time = ( RealType ) 0.0,
-                            const RealType& outFunctionMultiplicator = ( RealType ) 0.0,
-                            const RealType& inFunctionMultiplicator = ( RealType ) 1.0 );
-
-      template< typename OutMeshFunctionPointer, typename InFunctionPointer >
-      static void evaluateAllEntities( OutMeshFunctionPointer& meshFunction,
-                                       const InFunctionPointer& function,
-                                       const RealType& time = ( RealType ) 0.0,
-                                       const RealType& outFunctionMultiplicator = ( RealType ) 0.0,
-                                       const RealType& inFunctionMultiplicator = ( RealType ) 1.0 );
- 
-      template< typename OutMeshFunctionPointer, typename InFunctionPointer >
-      static void evaluateInteriorEntities( OutMeshFunctionPointer& meshFunction,
-                                            const InFunctionPointer& function,
-                                            const RealType& time = ( RealType ) 0.0,
-                                            const RealType& outFunctionMultiplicator = ( RealType ) 0.0,
-                                            const RealType& inFunctionMultiplicator = ( RealType ) 1.0 );
-
-      template< typename OutMeshFunctionPointer, typename InFunctionPointer >
-      static void evaluateBoundaryEntities( OutMeshFunctionPointer& meshFunction,
-                                            const InFunctionPointer& function,
-                                            const RealType& time = ( RealType ) 0.0,
-                                            const RealType& outFunctionMultiplicator = ( RealType ) 0.0,
-                                            const RealType& inFunctionMultiplicator = ( RealType ) 1.0 );
-
-   protected:
-
-      enum EntitiesType { all, boundary, interior };
- 
-      template< typename OutMeshFunctionPointer, typename InFunctionPointer >
-      static void evaluateEntities( OutMeshFunctionPointer& meshFunction,
-                                    const InFunctionPointer& function,
-                                    const RealType& time,
-                                    const RealType& outFunctionMultiplicator,
-                                    const RealType& inFunctionMultiplicator,
-                                    EntitiesType entitiesType );
-
- 
+public:
+   using RealType = typename InFunction::RealType;
+   using MeshType = typename OutMeshFunction::MeshType;
+   using DeviceType = typename MeshType::DeviceType;
+   using TraverserUserData = Functions::MeshFunctionEvaluatorTraverserUserData< OutMeshFunction, InFunction, RealType >;
+
+   template< typename OutMeshFunctionPointer, typename InFunctionPointer >
+   static void
+   evaluate( OutMeshFunctionPointer& meshFunction,
+             const InFunctionPointer& function,
+             const RealType& time = (RealType) 0.0,
+             const RealType& outFunctionMultiplicator = (RealType) 0.0,
+             const RealType& inFunctionMultiplicator = (RealType) 1.0 );
+
+   template< typename OutMeshFunctionPointer, typename InFunctionPointer >
+   static void
+   evaluateAllEntities( OutMeshFunctionPointer& meshFunction,
+                        const InFunctionPointer& function,
+                        const RealType& time = (RealType) 0.0,
+                        const RealType& outFunctionMultiplicator = (RealType) 0.0,
+                        const RealType& inFunctionMultiplicator = (RealType) 1.0 );
+
+   template< typename OutMeshFunctionPointer, typename InFunctionPointer >
+   static void
+   evaluateInteriorEntities( OutMeshFunctionPointer& meshFunction,
+                             const InFunctionPointer& function,
+                             const RealType& time = (RealType) 0.0,
+                             const RealType& outFunctionMultiplicator = (RealType) 0.0,
+                             const RealType& inFunctionMultiplicator = (RealType) 1.0 );
+
+   template< typename OutMeshFunctionPointer, typename InFunctionPointer >
+   static void
+   evaluateBoundaryEntities( OutMeshFunctionPointer& meshFunction,
+                             const InFunctionPointer& function,
+                             const RealType& time = (RealType) 0.0,
+                             const RealType& outFunctionMultiplicator = (RealType) 0.0,
+                             const RealType& inFunctionMultiplicator = (RealType) 1.0 );
+
+protected:
+   enum EntitiesType
+   {
+      all,
+      boundary,
+      interior
+   };
+
+   template< typename OutMeshFunctionPointer, typename InFunctionPointer >
+   static void
+   evaluateEntities( OutMeshFunctionPointer& meshFunction,
+                     const InFunctionPointer& function,
+                     const RealType& time,
+                     const RealType& outFunctionMultiplicator,
+                     const RealType& inFunctionMultiplicator,
+                     EntitiesType entitiesType );
 };
 
-
-template< typename MeshType,
-          typename UserData >
+template< typename MeshType, typename UserData >
 class MeshFunctionEvaluatorAssignmentEntitiesProcessor
 {
-   public:
-
-      template< typename EntityType >
-      __cuda_callable__
-      static inline void processEntity( const MeshType& mesh,
-                                        UserData& userData,
-                                        const EntityType& entity )
-      {
-         typedef FunctionAdapter< MeshType, typename UserData::InFunctionType > FunctionAdapter;
-         ( *userData.meshFunction )( entity ) =
-            userData.inFunctionMultiplicator *
-            FunctionAdapter::getValue( *userData.function, entity, userData.time );
-         /*cerr << "Idx = " << entity.getIndex()
-            << " Value = " << FunctionAdapter::getValue( *userData.function, entity, userData.time )
-            << " stored value = " << ( *userData.meshFunction )( entity )
-            << " multiplicators = " << std::endl;*/
-      }
+public:
+   template< typename EntityType >
+   __cuda_callable__
+   static inline void
+   processEntity( const MeshType& mesh, UserData& userData, const EntityType& entity )
+   {
+      using FunctionAdapter = FunctionAdapter< MeshType, typename UserData::InFunctionType >;
+      ( *userData.meshFunction )( entity ) =
+         userData.inFunctionMultiplicator * FunctionAdapter::getValue( *userData.function, entity, userData.time );
+      /*cerr << "Idx = " << entity.getIndex()
+         << " Value = " << FunctionAdapter::getValue( *userData.function, entity, userData.time )
+         << " stored value = " << ( *userData.meshFunction )( entity )
+         << " multiplicators = " << std::endl;*/
+   }
 };
 
-template< typename MeshType,
-          typename UserData >
+template< typename MeshType, typename UserData >
 class MeshFunctionEvaluatorAdditionEntitiesProcessor
 {
-   public:
-
-      template< typename EntityType >
-      __cuda_callable__
-      static inline void processEntity( const MeshType& mesh,
-                                        UserData& userData,
-                                        const EntityType& entity )
-      {
-         typedef FunctionAdapter< MeshType, typename UserData::InFunctionType > FunctionAdapter;
-         ( *userData.meshFunction )( entity ) =
-            userData.outFunctionMultiplicator * ( *userData.meshFunction )( entity ) +
-            userData.inFunctionMultiplicator *
-            FunctionAdapter::getValue( *userData.function, entity, userData.time );
-         /*cerr << "Idx = " << entity.getIndex()
-            << " Value = " << FunctionAdapter::getValue( *userData.function, entity, userData.time )
-            << " stored value = " << ( *userData.meshFunction )( entity )
-            << " multiplicators = " << std::endl;*/
-      }
+public:
+   template< typename EntityType >
+   __cuda_callable__
+   static inline void
+   processEntity( const MeshType& mesh, UserData& userData, const EntityType& entity )
+   {
+      using FunctionAdapter = FunctionAdapter< MeshType, typename UserData::InFunctionType >;
+      ( *userData.meshFunction )( entity ) =
+         userData.outFunctionMultiplicator * ( *userData.meshFunction )( entity )
+         + userData.inFunctionMultiplicator * FunctionAdapter::getValue( *userData.function, entity, userData.time );
+      /*cerr << "Idx = " << entity.getIndex()
+         << " Value = " << FunctionAdapter::getValue( *userData.function, entity, userData.time )
+         << " stored value = " << ( *userData.meshFunction )( entity )
+         << " multiplicators = " << std::endl;*/
+   }
 };
 
-} // namespace Functions
-} // namespace TNL
+}  // namespace Functions
+}  // namespace TNL
 
 #include <TNL/Functions/MeshFunctionEvaluator_impl.h>
diff --git a/src/TNL/Functions/MeshFunctionEvaluator_impl.h b/src/TNL/Functions/MeshFunctionEvaluator_impl.h
index 1c25b9b451d914b2224e9b53816e87a9129dc62d..3bac5923d919b6e11ad0d8e840646f90d0923618 100644
--- a/src/TNL/Functions/MeshFunctionEvaluator_impl.h
+++ b/src/TNL/Functions/MeshFunctionEvaluator_impl.h
@@ -10,24 +10,24 @@
 #include <TNL/Meshes/Traverser.h>
 
 namespace TNL {
-namespace Functions {   
+namespace Functions {
 
-template< typename OutMeshFunction,
-          typename InFunction >
-   template< typename OutMeshFunctionPointer, typename InFunctionPointer >
+template< typename OutMeshFunction, typename InFunction >
+template< typename OutMeshFunctionPointer, typename InFunctionPointer >
 void
-MeshFunctionEvaluator< OutMeshFunction, InFunction >::
-evaluate( OutMeshFunctionPointer& meshFunction,
-          const InFunctionPointer& function,
-          const RealType& time,
-          const RealType& outFunctionMultiplicator,
-          const RealType& inFunctionMultiplicator )
+MeshFunctionEvaluator< OutMeshFunction, InFunction >::evaluate( OutMeshFunctionPointer& meshFunction,
+                                                                const InFunctionPointer& function,
+                                                                const RealType& time,
+                                                                const RealType& outFunctionMultiplicator,
+                                                                const RealType& inFunctionMultiplicator )
 {
-   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" );
+   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" );
 
-   switch( InFunction::getDomainType() )
-   {
+   switch( InFunction::getDomainType() ) {
       case NonspaceDomain:
       case SpaceDomain:
       case MeshDomain:
@@ -42,120 +42,114 @@ evaluate( OutMeshFunctionPointer& meshFunction,
    }
 }
 
-
-template< typename OutMeshFunction,
-          typename InFunction >
-   template< typename OutMeshFunctionPointer, typename InFunctionPointer >
+template< typename OutMeshFunction, typename InFunction >
+template< typename OutMeshFunctionPointer, typename InFunctionPointer >
 void
-MeshFunctionEvaluator< OutMeshFunction, InFunction >::
-evaluateAllEntities( OutMeshFunctionPointer& meshFunction,
-                     const InFunctionPointer& function,
-                     const RealType& time,
-                     const RealType& outFunctionMultiplicator,
-                     const RealType& inFunctionMultiplicator )
+MeshFunctionEvaluator< OutMeshFunction, InFunction >::evaluateAllEntities( OutMeshFunctionPointer& meshFunction,
+                                                                           const InFunctionPointer& function,
+                                                                           const RealType& time,
+                                                                           const RealType& outFunctionMultiplicator,
+                                                                           const RealType& inFunctionMultiplicator )
 {
-   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" );
+   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" );
 
    return evaluateEntities( meshFunction, function, time, outFunctionMultiplicator, inFunctionMultiplicator, all );
 }
 
-template< typename OutMeshFunction,
-          typename InFunction >
-   template< typename OutMeshFunctionPointer, typename InFunctionPointer >
+template< typename OutMeshFunction, typename InFunction >
+template< typename OutMeshFunctionPointer, typename InFunctionPointer >
 void
-MeshFunctionEvaluator< OutMeshFunction, InFunction >::
-evaluateInteriorEntities( OutMeshFunctionPointer& meshFunction,
-                          const InFunctionPointer& function,
-                          const RealType& time,
-                          const RealType& outFunctionMultiplicator,
-                          const RealType& inFunctionMultiplicator )
+MeshFunctionEvaluator< OutMeshFunction, InFunction >::evaluateInteriorEntities( OutMeshFunctionPointer& meshFunction,
+                                                                                const InFunctionPointer& function,
+                                                                                const RealType& time,
+                                                                                const RealType& outFunctionMultiplicator,
+                                                                                const RealType& inFunctionMultiplicator )
 {
-   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" );
+   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" );
 
    return evaluateEntities( meshFunction, function, time, outFunctionMultiplicator, inFunctionMultiplicator, interior );
 }
 
-template< typename OutMeshFunction,
-          typename InFunction >
-   template< typename OutMeshFunctionPointer, typename InFunctionPointer >
+template< typename OutMeshFunction, typename InFunction >
+template< typename OutMeshFunctionPointer, typename InFunctionPointer >
 void
-MeshFunctionEvaluator< OutMeshFunction, InFunction >::
-evaluateBoundaryEntities( OutMeshFunctionPointer& meshFunction,
-                          const InFunctionPointer& function,
-                          const RealType& time,
-                          const RealType& outFunctionMultiplicator,
-                          const RealType& inFunctionMultiplicator )
+MeshFunctionEvaluator< OutMeshFunction, InFunction >::evaluateBoundaryEntities( OutMeshFunctionPointer& meshFunction,
+                                                                                const InFunctionPointer& function,
+                                                                                const RealType& time,
+                                                                                const RealType& outFunctionMultiplicator,
+                                                                                const RealType& inFunctionMultiplicator )
 {
-   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" );
+   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" );
 
    return evaluateEntities( meshFunction, function, time, outFunctionMultiplicator, inFunctionMultiplicator, boundary );
 }
 
-
-
-template< typename OutMeshFunction,
-          typename InFunction >
-   template< typename OutMeshFunctionPointer, typename InFunctionPointer >
+template< typename OutMeshFunction, typename InFunction >
+template< typename OutMeshFunctionPointer, typename InFunctionPointer >
 void
-MeshFunctionEvaluator< OutMeshFunction, InFunction >::
-evaluateEntities( OutMeshFunctionPointer& meshFunction,
-                  const InFunctionPointer& function,
-                  const RealType& time,
-                  const RealType& outFunctionMultiplicator,
-                  const RealType& inFunctionMultiplicator,
-                  EntitiesType entitiesType )
+MeshFunctionEvaluator< OutMeshFunction, InFunction >::evaluateEntities( OutMeshFunctionPointer& meshFunction,
+                                                                        const InFunctionPointer& function,
+                                                                        const RealType& time,
+                                                                        const RealType& outFunctionMultiplicator,
+                                                                        const RealType& inFunctionMultiplicator,
+                                                                        EntitiesType entitiesType )
 {
-   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" );
+   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" );
+
+   using MeshEntityType = typename MeshType::template EntityType< OutMeshFunction::getEntitiesDimension() >;
+   using AssignmentEntitiesProcessor =
+      Functions::MeshFunctionEvaluatorAssignmentEntitiesProcessor< MeshType, TraverserUserData >;
+   using AdditionEntitiesProcessor = Functions::MeshFunctionEvaluatorAdditionEntitiesProcessor< MeshType, TraverserUserData >;
+   // typedef typename OutMeshFunction::MeshPointer OutMeshPointer;
 
-   typedef typename MeshType::template EntityType< OutMeshFunction::getEntitiesDimension() > MeshEntityType;
-   typedef Functions::MeshFunctionEvaluatorAssignmentEntitiesProcessor< MeshType, TraverserUserData > AssignmentEntitiesProcessor;
-   typedef Functions::MeshFunctionEvaluatorAdditionEntitiesProcessor< MeshType, TraverserUserData > AdditionEntitiesProcessor;
-   //typedef typename OutMeshFunction::MeshPointer OutMeshPointer;
-   
    TraverserUserData userData( &function.template getData< DeviceType >(),
-                time,
-                &meshFunction.template modifyData< DeviceType >(),
-                outFunctionMultiplicator,
-                inFunctionMultiplicator );
+                               time,
+                               &meshFunction.template modifyData< DeviceType >(),
+                               outFunctionMultiplicator,
+                               inFunctionMultiplicator );
    Meshes::Traverser< MeshType, MeshEntityType > meshTraverser;
-   switch( entitiesType )
-   {
+   switch( entitiesType ) {
       case all:
          if( outFunctionMultiplicator )
-            meshTraverser.template processAllEntities< AdditionEntitiesProcessor >
-                                                     ( meshFunction->getMeshPointer(),
-                                                       userData );
+            meshTraverser.template processAllEntities< AdditionEntitiesProcessor >( meshFunction->getMeshPointer(), userData );
          else
-            meshTraverser.template processAllEntities< AssignmentEntitiesProcessor >
-                                                    ( meshFunction->getMeshPointer(),
-                                                      userData );
+            meshTraverser.template processAllEntities< AssignmentEntitiesProcessor >( meshFunction->getMeshPointer(),
+                                                                                      userData );
          break;
       case interior:
          if( outFunctionMultiplicator )
-            meshTraverser.template processInteriorEntities< AdditionEntitiesProcessor >
-                                                          ( meshFunction->getMeshPointer(),
-                                                            userData );
+            meshTraverser.template processInteriorEntities< AdditionEntitiesProcessor >( meshFunction->getMeshPointer(),
+                                                                                         userData );
          else
-            meshTraverser.template processInteriorEntities< AssignmentEntitiesProcessor >
-                                                          ( meshFunction->getMeshPointer(),
-                                                            userData );
+            meshTraverser.template processInteriorEntities< AssignmentEntitiesProcessor >( meshFunction->getMeshPointer(),
+                                                                                           userData );
          break;
       case boundary:
          if( outFunctionMultiplicator )
-            meshTraverser.template processBoundaryEntities< AdditionEntitiesProcessor >
-                                                          ( meshFunction->getMeshPointer(),
-                                                            userData );
+            meshTraverser.template processBoundaryEntities< AdditionEntitiesProcessor >( meshFunction->getMeshPointer(),
+                                                                                         userData );
          else
-            meshTraverser.template processBoundaryEntities< AssignmentEntitiesProcessor >
-                                                          ( meshFunction->getMeshPointer(),
-                                                            userData );
+            meshTraverser.template processBoundaryEntities< AssignmentEntitiesProcessor >( meshFunction->getMeshPointer(),
+                                                                                           userData );
          break;
    }
 }
 
-} // namespace Functions
-} // namespace TNL
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/MeshFunctionGnuplotWriter.h b/src/TNL/Functions/MeshFunctionGnuplotWriter.h
index f54ff04cdb3c680aba70602f968a144267eac3db..8a6aa84f8d2c6ab0f604ad708540cf023755f1a1 100644
--- a/src/TNL/Functions/MeshFunctionGnuplotWriter.h
+++ b/src/TNL/Functions/MeshFunctionGnuplotWriter.h
@@ -12,65 +12,68 @@
 namespace TNL {
 
 namespace Meshes {
-   template< typename, typename, typename > class MeshEntity;
+template< typename, typename, typename >
+class MeshEntity;
 }
 
 namespace Functions {
 
 class MeshFunctionGnuplotWriterBase
 {
-   protected:
-
-      template< typename Entity, int dim = Entity::getEntityDimension() >
-      struct center
+protected:
+   template< typename Entity, int dim = Entity::getEntityDimension() >
+   struct center
+   {
+      static auto
+      get( const Entity& entity ) -> decltype( entity.getCenter() )
       {
-         static auto get( const Entity& entity ) -> decltype(entity.getCenter())
-         {
-            return entity.getCenter();
-         }
-      };
+         return entity.getCenter();
+      }
+   };
 
-      template< typename Entity >
-      struct center< Entity, 0 >
+   template< typename Entity >
+   struct center< Entity, 0 >
+   {
+      static auto
+      get( const Entity& entity ) -> decltype( entity.getPoint() )
       {
-         static auto get( const Entity& entity ) -> decltype(entity.getPoint())
-         {
-            return entity.getPoint();
-         }
-      };
+         return entity.getPoint();
+      }
+   };
 
-      template< typename MeshConfig, typename Device, typename Topology, int dim >
-      struct center< TNL::Meshes::MeshEntity< MeshConfig, Device, Topology >, dim >
+   template< typename MeshConfig, typename Device, typename Topology, int dim >
+   struct center< TNL::Meshes::MeshEntity< MeshConfig, Device, Topology >, dim >
+   {
+      static int
+      get( const TNL::Meshes::MeshEntity< MeshConfig, Device, Topology >& entity )
       {
-         static int get( const TNL::Meshes::MeshEntity< MeshConfig, Device, Topology >& entity )
-         {
-            throw Exceptions::NotImplementedError();
-         }
-      };
+         throw Exceptions::NotImplementedError();
+      }
+   };
 
-      template< typename MeshConfig, typename Device, typename Topology >
-      struct center< TNL::Meshes::MeshEntity< MeshConfig, Device, Topology >, 0 >
+   template< typename MeshConfig, typename Device, typename Topology >
+   struct center< TNL::Meshes::MeshEntity< MeshConfig, Device, Topology >, 0 >
+   {
+      static int
+      get( const TNL::Meshes::MeshEntity< MeshConfig, Device, Topology >& entity )
       {
-         static int get( const TNL::Meshes::MeshEntity< MeshConfig, Device, Topology >& entity )
-         {
-            throw Exceptions::NotImplementedError();
-         }
-      };
+         throw Exceptions::NotImplementedError();
+      }
+   };
 };
 
 template< typename MeshFunction,
           typename Mesh = typename MeshFunction::MeshType,
           int EntitiesDimension = MeshFunction::getEntitiesDimension() >
-class MeshFunctionGnuplotWriter
-: public MeshFunctionGnuplotWriterBase
+class MeshFunctionGnuplotWriter : public MeshFunctionGnuplotWriterBase
 {
 public:
    using MeshType = typename MeshFunction::MeshType;
    using EntityType = typename MeshType::template EntityType< MeshFunction::getEntitiesDimension() >;
    using GlobalIndex = typename MeshType::GlobalIndexType;
 
-   static bool write( const MeshFunction& function,
-                      std::ostream& str )
+   static bool
+   write( const MeshFunction& function, std::ostream& str )
    {
       const MeshType& mesh = function.getMesh();
       const GlobalIndex entitiesCount = mesh.template getEntitiesCount< EntityType >();
@@ -85,11 +88,7 @@ public:
    }
 };
 
-template< typename MeshFunction,
-   typename Real,
-   typename Device,
-   typename Index,
-   int EntityDimension >
+template< typename MeshFunction, typename Real, typename Device, typename Index, int EntityDimension >
 class MeshFunctionGnuplotWriter< MeshFunction, Meshes::Grid< 2, Real, Device, Index >, EntityDimension >
 : public MeshFunctionGnuplotWriterBase
 {
@@ -98,19 +97,17 @@ public:
    using EntityType = typename MeshType::template EntityType< MeshFunction::getEntitiesDimension() >;
    using GlobalIndex = typename MeshType::GlobalIndexType;
 
-   static bool write( const MeshFunction& function,
-                      std::ostream& str )
+   static bool
+   write( const MeshFunction& function, std::ostream& str )
    {
       const MeshType& grid = function.getMesh();
       EntityType entity( grid );
       auto& c = entity.getCoordinates();
-      for( c.y() = 0; c.y() < grid.getDimensions().y(); c.y()++ )
-      {
-         for( c.x() = 0; c.x() < grid.getDimensions().x(); c.x()++ )
-         {
+      for( c.y() = 0; c.y() < grid.getDimensions().y(); c.y()++ ) {
+         for( c.x() = 0; c.x() < grid.getDimensions().x(); c.x()++ ) {
             entity.refresh();
             typename MeshType::PointType v = center< EntityType >::get( entity );
-            //std::cerr << entity.getCoordinates() << " -> " << v << std::endl;
+            // std::cerr << entity.getCoordinates() << " -> " << v << std::endl;
             for( int j = 0; j < v.getSize(); j++ )
                str << v[ j ] << " ";
             str << function.getData().getElement( entity.getIndex() ) << "\n";
@@ -121,11 +118,7 @@ public:
    }
 };
 
-template< typename MeshFunction,
-   typename Real,
-   typename Device,
-   typename Index,
-   int EntityDimension >
+template< typename MeshFunction, typename Real, typename Device, typename Index, int EntityDimension >
 class MeshFunctionGnuplotWriter< MeshFunction, Meshes::Grid< 3, Real, Device, Index >, EntityDimension >
 : public MeshFunctionGnuplotWriterBase
 {
@@ -134,17 +127,15 @@ public:
    using EntityType = typename MeshType::template EntityType< MeshFunction::getEntitiesDimension() >;
    using GlobalIndex = typename MeshType::GlobalIndexType;
 
-   static bool write( const MeshFunction& function,
-                      std::ostream& str )
+   static bool
+   write( const MeshFunction& function, std::ostream& str )
    {
       const MeshType& grid = function.getMesh();
       EntityType entity( grid );
       auto& c = entity.getCoordinates();
       for( c.z() = 0; c.z() < grid.getDimensions().z(); c.z()++ )
-         for( c.y() = 0; c.y() < grid.getDimensions().y(); c.y()++ )
-         {
-            for( c.x() = 0; c.x() < grid.getDimensions().x(); c.x()++ )
-            {
+         for( c.y() = 0; c.y() < grid.getDimensions().y(); c.y()++ ) {
+            for( c.x() = 0; c.x() < grid.getDimensions().x(); c.x()++ ) {
                entity.refresh();
                typename MeshType::PointType v = center< EntityType >::get( entity );
                for( int j = 0; j < v.getSize(); j++ )
@@ -157,5 +148,5 @@ public:
    }
 };
 
-} // namespace Functions
-} // namespace TNL
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/MeshFunctionIO.h b/src/TNL/Functions/MeshFunctionIO.h
index e06f3e6f2b72bb444172fbaa64911dc1f5377a70..a93fc2d32660ca20e41e12dc5086e30dd1743f76 100644
--- a/src/TNL/Functions/MeshFunctionIO.h
+++ b/src/TNL/Functions/MeshFunctionIO.h
@@ -34,7 +34,7 @@ readMeshFunction( MeshFunction& function,
    reader->detectMesh();
 
    // load the mesh if the function does not have it yet
-   if( function.getMesh() == typename MeshFunction::MeshType {} )
+   if( function.getMesh() == typename MeshFunction::MeshType{} )
       reader->loadMesh( *function.getMeshPointer() );
 
    Meshes::Readers::MeshReader::VariantVector data;
@@ -43,20 +43,25 @@ readMeshFunction( MeshFunction& function,
    else if( function.getEntitiesDimension() == function.getMeshDimension() )
       data = reader->readCellData( functionName );
    else {
-      std::cerr << "The mesh function with entities dimension " << function.getEntitiesDimension() << " cannot be read from the file " << fileName << std::endl;
+      std::cerr << "The mesh function with entities dimension " << function.getEntitiesDimension()
+                << " cannot be read from the file " << fileName << std::endl;
       return false;
    }
 
-   visit( [&](auto&& array) {
-            const auto entitiesCount = function.getMesh().template getEntitiesCount< MeshFunction::getEntitiesDimension() >();
-            if( array.size() == (std::size_t) entitiesCount )
-               Algorithms::MultiDeviceMemoryOperations< typename MeshFunction::VectorType::DeviceType, Devices::Host >
-                  ::copy( function.getData().getData(), array.data(), array.size() );
-            else
-               throw Exceptions::FileDeserializationError( fileName, "mesh function data size does not match the mesh size (expected " + std::to_string(entitiesCount) + ", got " + std::to_string(array.size()) + ")." );
-         },
-         data
-      );
+   visit(
+      [ & ]( auto&& array )
+      {
+         const auto entitiesCount = function.getMesh().template getEntitiesCount< MeshFunction::getEntitiesDimension() >();
+         if( array.size() == (std::size_t) entitiesCount )
+            Algorithms::MultiDeviceMemoryOperations< typename MeshFunction::VectorType::DeviceType, Devices::Host >::copy(
+               function.getData().getData(), array.data(), array.size() );
+         else
+            throw Exceptions::FileDeserializationError( fileName,
+                                                        "mesh function data size does not match the mesh size (expected "
+                                                           + std::to_string( entitiesCount ) + ", got "
+                                                           + std::to_string( array.size() ) + ")." );
+      },
+      data );
 
    return true;
 }
@@ -78,11 +83,11 @@ readDistributedMeshFunction( Meshes::DistributedMeshes::DistributedMesh< typenam
    // load the mesh if it was not loaded yet
    using MeshType = typename MeshFunction::MeshType;
    using DistributedMeshType = Meshes::DistributedMeshes::DistributedMesh< MeshType >;
-   if( distributedMesh == DistributedMeshType {} ) {
+   if( distributedMesh == DistributedMeshType{} ) {
       if( reader->getMeshType() == "Meshes::DistributedMesh" )
-         dynamic_cast<Meshes::Readers::PVTUReader&>(*reader).loadMesh( distributedMesh );
+         dynamic_cast< Meshes::Readers::PVTUReader& >( *reader ).loadMesh( distributedMesh );
       else if( reader->getMeshType() == "Meshes::DistributedGrid" )
-         dynamic_cast<Meshes::Readers::PVTIReader&>(*reader).loadMesh( distributedMesh );
+         dynamic_cast< Meshes::Readers::PVTIReader& >( *reader ).loadMesh( distributedMesh );
       else
          throw std::runtime_error( "Unknown type of a distributed mesh: " + reader->getMeshType() );
    }
@@ -97,20 +102,25 @@ readDistributedMeshFunction( Meshes::DistributedMeshes::DistributedMesh< typenam
    else if( function.getEntitiesDimension() == function.getMeshDimension() )
       data = reader->readCellData( functionName );
    else {
-      std::cerr << "The mesh function with entities dimension " << function.getEntitiesDimension() << " cannot be read from the file " << fileName << std::endl;
+      std::cerr << "The mesh function with entities dimension " << function.getEntitiesDimension()
+                << " cannot be read from the file " << fileName << std::endl;
       return false;
    }
 
-   visit( [&](auto&& array) {
-            const auto entitiesCount = function.getMesh().template getEntitiesCount< MeshFunction::getEntitiesDimension() >();
-            if( array.size() == (std::size_t) entitiesCount )
-               Algorithms::MultiDeviceMemoryOperations< typename MeshFunction::VectorType::DeviceType, Devices::Host >
-                  ::copy( function.getData().getData(), array.data(), array.size() );
-            else
-               throw Exceptions::FileDeserializationError( fileName, "mesh function data size does not match the mesh size (expected " + std::to_string(entitiesCount) + ", got " + std::to_string(array.size()) + ")." );
-         },
-         data
-      );
+   visit(
+      [ & ]( auto&& array )
+      {
+         const auto entitiesCount = function.getMesh().template getEntitiesCount< MeshFunction::getEntitiesDimension() >();
+         if( array.size() == (std::size_t) entitiesCount )
+            Algorithms::MultiDeviceMemoryOperations< typename MeshFunction::VectorType::DeviceType, Devices::Host >::copy(
+               function.getData().getData(), array.data(), array.size() );
+         else
+            throw Exceptions::FileDeserializationError( fileName,
+                                                        "mesh function data size does not match the mesh size (expected "
+                                                           + std::to_string( entitiesCount ) + ", got "
+                                                           + std::to_string( array.size() ) + ")." );
+      },
+      data );
 
    return true;
 }
@@ -125,8 +135,7 @@ writeMeshFunction( const MeshFunction& function,
 {
    std::ofstream file;
    file.open( fileName );
-   if( ! file )
-   {
+   if( ! file ) {
       std::cerr << "Unable to open a file " << fileName << "." << std::endl;
       return false;
    }
@@ -134,10 +143,10 @@ writeMeshFunction( const MeshFunction& function,
    namespace fs = std::experimental::filesystem;
    std::string format = fileFormat;
    if( format == "auto" ) {
-      format = fs::path(fileName).extension();
+      format = fs::path( fileName ).extension();
       if( format.length() > 0 )
          // remove dot from the extension
-         format = format.substr(1);
+         format = format.substr( 1 );
    }
 
    if( format == "vti" ) {
@@ -167,8 +176,7 @@ writeMeshFunction( const MeshFunction& function,
 {
    std::ofstream file;
    file.open( fileName );
-   if( ! file )
-   {
+   if( ! file ) {
       std::cerr << "Unable to open a file " << fileName << "." << std::endl;
       return false;
    }
@@ -176,10 +184,10 @@ writeMeshFunction( const MeshFunction& function,
    namespace fs = std::experimental::filesystem;
    std::string format = fileFormat;
    if( format == "auto" ) {
-      format = fs::path(fileName).extension();
+      format = fs::path( fileName ).extension();
       if( format.length() > 0 )
          // remove dot from the extension
-         format = format.substr(1);
+         format = format.substr( 1 );
    }
 
    if( format == "vtk" ) {
@@ -210,19 +218,20 @@ writeMeshFunction( const MeshFunction& function,
 // specialization for grids
 template< typename MeshFunction >
 std::enable_if_t< Meshes::isGrid< typename MeshFunction::MeshType >::value, bool >
-writeDistributedMeshFunction( const Meshes::DistributedMeshes::DistributedMesh< typename MeshFunction::MeshType >& distributedMesh,
-                              const MeshFunction& function,
-                              const std::string& functionName,
-                              const std::string& fileName,
-                              const std::string& fileFormat = "auto" )
+writeDistributedMeshFunction(
+   const Meshes::DistributedMeshes::DistributedMesh< typename MeshFunction::MeshType >& distributedMesh,
+   const MeshFunction& function,
+   const std::string& functionName,
+   const std::string& fileName,
+   const std::string& fileFormat = "auto" )
 {
    namespace fs = std::experimental::filesystem;
    std::string format = fileFormat;
    if( format == "auto" ) {
-      format = fs::path(fileName).extension();
+      format = fs::path( fileName ).extension();
       if( format.length() > 0 )
          // remove dot from the extension
-         format = format.substr(1);
+         format = format.substr( 1 );
    }
 
    if( format == "pvti" ) {
@@ -236,7 +245,7 @@ writeDistributedMeshFunction( const Meshes::DistributedMeshes::DistributedMesh<
       // TODO: write metadata: step and time
       pvti.writeImageData( distributedMesh );
       // TODO
-      //if( distributedMesh.getGhostLevels() > 0 ) {
+      // if( distributedMesh.getGhostLevels() > 0 ) {
       //   pvti.template writePPointData< std::uint8_t >( Meshes::VTK::ghostArrayName() );
       //   pvti.template writePCellData< std::uint8_t >( Meshes::VTK::ghostArrayName() );
       //}
@@ -256,14 +265,15 @@ writeDistributedMeshFunction( const Meshes::DistributedMeshes::DistributedMesh<
       // NOTE: globalBegin and globalEnd here are without overlaps
       writer.writeImageData( distributedMesh.getGlobalGrid().getOrigin(),
                              distributedMesh.getGlobalBegin() - distributedMesh.getLowerOverlap(),
-                             distributedMesh.getGlobalBegin() + distributedMesh.getLocalSize() + distributedMesh.getUpperOverlap(),
+                             distributedMesh.getGlobalBegin() + distributedMesh.getLocalSize()
+                                + distributedMesh.getUpperOverlap(),
                              distributedMesh.getGlobalGrid().getSpaceSteps() );
       if( function.getEntitiesDimension() == 0 )
          writer.writePointData( function.getData(), functionName );
       else
          writer.writeCellData( function.getData(), functionName );
       // TODO
-      //if( mesh.getGhostLevels() > 0 ) {
+      // if( mesh.getGhostLevels() > 0 ) {
       //   writer.writePointData( mesh.vtkPointGhostTypes(), Meshes::VTK::ghostArrayName() );
       //   writer.writeCellData( mesh.vtkCellGhostTypes(), Meshes::VTK::ghostArrayName() );
       //}
@@ -277,5 +287,5 @@ writeDistributedMeshFunction( const Meshes::DistributedMeshes::DistributedMesh<
 
 // TODO: specialization of writeDistributedMeshFunction for unstructured mesh
 
-} // namespace Functions
-} // namespace TNL
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/MeshFunctionNormGetter.h b/src/TNL/Functions/MeshFunctionNormGetter.h
index bdac37d71f15388217c69a5883a8e40f8d40aff4..362e85044e132cdb4ca30a933c8a797d9995db89 100644
--- a/src/TNL/Functions/MeshFunctionNormGetter.h
+++ b/src/TNL/Functions/MeshFunctionNormGetter.h
@@ -10,136 +10,112 @@
 #include <TNL/Exceptions/NotImplementedError.h>
 
 namespace TNL {
-namespace Functions {   
+namespace Functions {
 
 template< typename Mesh >
 class MeshFunctionNormGetter
-{
-};
+{};
 
 /***
  * Specialization for grids
  * TODO: implement this even for other devices
  */
-template< int Dimension,
-          typename MeshReal,
-          typename MeshIndex >
+template< int Dimension, typename MeshReal, typename MeshIndex >
 class MeshFunctionNormGetter< Meshes::Grid< Dimension, MeshReal, Devices::Host, MeshIndex > >
 {
-   public:
- 
-      typedef Meshes::Grid< Dimension, MeshReal, Devices::Host, MeshIndex > GridType;
-      typedef MeshReal MeshRealType;
-      typedef Devices::Host DeviceType;
-      typedef MeshIndex MeshIndexType;
- 
-      template< typename MeshFunctionType >
-      static typename MeshFunctionType::RealType
-      getNorm( const MeshFunctionType& function,
-               const typename MeshFunctionType::RealType& p )
-      {
-         typedef typename MeshFunctionType::RealType RealType;
-         static constexpr int EntityDimension = MeshFunctionType::getEntitiesDimension();
-         if( EntityDimension == Dimension )
-         {
-            if( p == 1.0 )
-               return function.getMesh().getCellMeasure() * lpNorm( function.getData(), 1.0 );
-            if( p == 2.0 )
-               return std::sqrt( function.getMesh().getCellMeasure() ) * lpNorm( function.getData(), 2.0 );
-            return std::pow( function.getMesh().getCellMeasure(), 1.0 / p ) * lpNorm( function.getData(), p );
-         }
-         if( EntityDimension > 0 )
-         {
-            typedef typename MeshFunctionType::MeshType MeshType;
-            typedef typename MeshType::Face EntityType;
-            if( p == 1.0 )
-            {
-               RealType result( 0.0 );
-               for( MeshIndexType i = 0;
-                    i < function.getMesh().template getEntitiesCount< EntityType >();
-                    i++ )
-               {
-                  EntityType entity = function.getMesh().template getEntity< EntityType >( i );
-                  result += std::fabs( function[ i ] ) * entity.getMeasure();
-               }
-               return result;
-            }
-            if( p == 2.0 )
-            {
-               RealType result( 0.0 );
-               for( MeshIndexType i = 0;
-                    i < function.getMesh().template getEntitiesCount< EntityType >();
-                    i++ )
-               {
-                  EntityType entity = function.getMesh().template getEntity< EntityType >( i );
-                  result += function[ i ] * function[ i ] * entity.getMeasure();
-               }
-               return std::sqrt( result );
-            }
+public:
+   using GridType = Meshes::Grid< Dimension, MeshReal, Devices::Host, MeshIndex >;
+   using MeshRealType = MeshReal;
+   using DeviceType = Devices::Host;
+   using MeshIndexType = MeshIndex;
 
+   template< typename MeshFunctionType >
+   static typename MeshFunctionType::RealType
+   getNorm( const MeshFunctionType& function, const typename MeshFunctionType::RealType& p )
+   {
+      using RealType = typename MeshFunctionType::RealType;
+      static constexpr int EntityDimension = MeshFunctionType::getEntitiesDimension();
+      if( EntityDimension == Dimension ) {
+         if( p == 1.0 )
+            return function.getMesh().getCellMeasure() * lpNorm( function.getData(), 1.0 );
+         if( p == 2.0 )
+            return std::sqrt( function.getMesh().getCellMeasure() ) * lpNorm( function.getData(), 2.0 );
+         return std::pow( function.getMesh().getCellMeasure(), 1.0 / p ) * lpNorm( function.getData(), p );
+      }
+      if( EntityDimension > 0 ) {
+         using MeshType = typename MeshFunctionType::MeshType;
+         using EntityType = typename MeshType::Face;
+         if( p == 1.0 ) {
             RealType result( 0.0 );
-            for( MeshIndexType i = 0;
-                 i < function.getMesh().template getEntitiesCount< EntityType >();
-                 i++ )
-            {
+            for( MeshIndexType i = 0; i < function.getMesh().template getEntitiesCount< EntityType >(); i++ ) {
                EntityType entity = function.getMesh().template getEntity< EntityType >( i );
-               result += std::pow( std::fabs( function[ i ] ), p ) * entity.getMeasure();
+               result += std::fabs( function[ i ] ) * entity.getMeasure();
             }
-            return std::pow( result, 1.0 / p );
+            return result;
          }
- 
-         if( p == 1.0 )
-            return lpNorm( function.getData(), 1.0 );
-         if( p == 2.0 )
-            return lpNorm( function.getData(), 2.0 );
-         return lpNorm( function.getData(), p );
+         if( p == 2.0 ) {
+            RealType result( 0.0 );
+            for( MeshIndexType i = 0; i < function.getMesh().template getEntitiesCount< EntityType >(); i++ ) {
+               EntityType entity = function.getMesh().template getEntity< EntityType >( i );
+               result += function[ i ] * function[ i ] * entity.getMeasure();
+            }
+            return std::sqrt( result );
+         }
+
+         RealType result( 0.0 );
+         for( MeshIndexType i = 0; i < function.getMesh().template getEntitiesCount< EntityType >(); i++ ) {
+            EntityType entity = function.getMesh().template getEntity< EntityType >( i );
+            result += std::pow( std::fabs( function[ i ] ), p ) * entity.getMeasure();
+         }
+         return std::pow( result, 1.0 / p );
       }
+
+      if( p == 1.0 )
+         return lpNorm( function.getData(), 1.0 );
+      if( p == 2.0 )
+         return lpNorm( function.getData(), 2.0 );
+      return lpNorm( function.getData(), p );
+   }
 };
 
 /****
  * Specialization for CUDA devices
  */
-template< int Dimension,
-          typename MeshReal,
-          typename MeshIndex >
+template< int Dimension, typename MeshReal, typename MeshIndex >
 class MeshFunctionNormGetter< Meshes::Grid< Dimension, MeshReal, Devices::Cuda, MeshIndex > >
 {
-   public:
- 
-      typedef Meshes::Grid< Dimension, MeshReal, Devices::Cuda, MeshIndex > GridType;
-      typedef MeshReal MeshRealType;
-      typedef Devices::Cuda DeviceType;
-      typedef MeshIndex MeshIndexType;
- 
-      template< typename MeshFunctionType >
-      static typename MeshFunctionType::RealType
-      getNorm( const MeshFunctionType& function,
-               const typename MeshFunctionType::RealType& p )
-      {
-         typedef typename MeshFunctionType::RealType RealType;
-         static constexpr int EntityDimension = MeshFunctionType::getEntitiesDimension();
-         if( EntityDimension == Dimension )
-         {
-            if( p == 1.0 )
-               return function.getMesh().getCellMeasure() * function.getData().lpNorm( 1.0 );
-            if( p == 2.0 )
-               return ::sqrt( function.getMesh().getCellMeasure() ) * function.getData().lpNorm( 2.0 );
-            return ::pow( function.getMesh().getCellMeasure(), 1.0 / p ) * function.getData().lpNorm( p );
-         }
-         if( EntityDimension > 0 )
-         {
-            typedef typename MeshFunctionType::MeshType MeshType;
-            typedef typename MeshType::Face EntityType;
-            throw Exceptions::NotImplementedError("Not implemented yet.");
-         }
- 
+public:
+   using GridType = Meshes::Grid< Dimension, MeshReal, Devices::Cuda, MeshIndex >;
+   using MeshRealType = MeshReal;
+   using DeviceType = Devices::Cuda;
+   using MeshIndexType = MeshIndex;
+
+   template< typename MeshFunctionType >
+   static typename MeshFunctionType::RealType
+   getNorm( const MeshFunctionType& function, const typename MeshFunctionType::RealType& p )
+   {
+      using RealType = typename MeshFunctionType::RealType;
+      static constexpr int EntityDimension = MeshFunctionType::getEntitiesDimension();
+      if( EntityDimension == Dimension ) {
          if( p == 1.0 )
-            return function.getData().lpNorm( 1.0 );
+            return function.getMesh().getCellMeasure() * function.getData().lpNorm( 1.0 );
          if( p == 2.0 )
-            return function.getData().lpNorm( 2.0 );
-         return function.getData().lpNorm( p );
+            return ::sqrt( function.getMesh().getCellMeasure() ) * function.getData().lpNorm( 2.0 );
+         return ::pow( function.getMesh().getCellMeasure(), 1.0 / p ) * function.getData().lpNorm( p );
       }
+      if( EntityDimension > 0 ) {
+         using MeshType = typename MeshFunctionType::MeshType;
+         using EntityType = typename MeshType::Face;
+         throw Exceptions::NotImplementedError( "Not implemented yet." );
+      }
+
+      if( p == 1.0 )
+         return function.getData().lpNorm( 1.0 );
+      if( p == 2.0 )
+         return function.getData().lpNorm( 2.0 );
+      return function.getData().lpNorm( p );
+   }
 };
 
-} // namespace Functions
-} // namespace TNL
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/MeshFunctionView.h b/src/TNL/Functions/MeshFunctionView.h
index e82c85dfb44158b578c7706e4c3a59ba4d01964c..c47f1055523c4fa4bd3a330b45e8fd52b6a283a7 100644
--- a/src/TNL/Functions/MeshFunctionView.h
+++ b/src/TNL/Functions/MeshFunctionView.h
@@ -14,141 +14,157 @@
 namespace TNL {
 namespace Functions {
 
-template< typename Mesh,
-          int MeshEntityDimension = Mesh::getMeshDimension(),
-          typename Real = typename Mesh::RealType >
-class MeshFunctionView :
-   public Domain< Mesh::getMeshDimension(), MeshDomain >
+template< typename Mesh, int MeshEntityDimension = Mesh::getMeshDimension(), typename Real = typename Mesh::RealType >
+class MeshFunctionView : public Domain< Mesh::getMeshDimension(), MeshDomain >
 {
-   //static_assert( Mesh::DeviceType::DeviceType == Vector::DeviceType::DeviceType,
-   //               "Both mesh and vector of a mesh function must reside on the same device.");
-   public:
+   // static_assert( Mesh::DeviceType::DeviceType == Vector::DeviceType::DeviceType,
+   //                "Both mesh and vector of a mesh function must reside on the same device.");
+public:
+   using MeshType = Mesh;
+   using DeviceType = typename MeshType::DeviceType;
+   using IndexType = typename MeshType::GlobalIndexType;
+   using MeshPointer = Pointers::SharedPointer< MeshType >;
+   using RealType = Real;
+   using VectorType = Containers::VectorView< RealType, DeviceType, IndexType >;
 
-      using MeshType = Mesh;
-      using DeviceType = typename MeshType::DeviceType;
-      using IndexType = typename MeshType::GlobalIndexType;
-      using MeshPointer = Pointers::SharedPointer< MeshType >;
-      using RealType = Real;
-      using VectorType = Containers::VectorView< RealType, DeviceType, IndexType >;
+   static constexpr int
+   getEntitiesDimension()
+   {
+      return MeshEntityDimension;
+   }
 
-      static constexpr int getEntitiesDimension() { return MeshEntityDimension; }
+   static constexpr int
+   getMeshDimension()
+   {
+      return MeshType::getMeshDimension();
+   }
 
-      static constexpr int getMeshDimension() { return MeshType::getMeshDimension(); }
+   MeshFunctionView();
 
-      MeshFunctionView();
+   MeshFunctionView( const MeshFunctionView& meshFunction );
 
-      MeshFunctionView( const MeshFunctionView& meshFunction );
+   template< typename Vector >
+   MeshFunctionView( const MeshPointer& meshPointer, Vector& data, const IndexType& offset = 0 );
 
-      template< typename Vector >
-      MeshFunctionView( const MeshPointer& meshPointer,
-                        Vector& data,
-                        const IndexType& offset = 0 );
+   template< typename Vector >
+   MeshFunctionView( const MeshPointer& meshPointer, Pointers::SharedPointer< Vector >& data, const IndexType& offset = 0 );
 
-      template< typename Vector >
-      MeshFunctionView( const MeshPointer& meshPointer,
-                        Pointers::SharedPointer<  Vector >& data,
-                        const IndexType& offset = 0 );
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" );
 
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" );
+   bool
+   setup( const MeshPointer& meshPointer, const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-      bool setup( const MeshPointer& meshPointer,
-                  const Config::ParameterContainer& parameters,
-                  const String& prefix = "" );
+   void
+   bind( MeshFunctionView& meshFunction );
 
-      void bind( MeshFunctionView& meshFunction );
+   template< typename Vector >
+   void
+   bind( Vector& data, const IndexType& offset = 0 );
 
-      template< typename Vector >
-      void bind( Vector& data,
-                 const IndexType& offset = 0 );
+   template< typename Vector >
+   void
+   bind( const MeshPointer& meshPointer, Vector& data, const IndexType& offset = 0 );
 
-      template< typename Vector >
-      void bind( const MeshPointer& meshPointer,
-                 Vector& data,
-                 const IndexType& offset = 0 );
+   template< typename Vector >
+   void
+   bind( const MeshPointer& meshPointer, Pointers::SharedPointer< Vector >& dataPtr, const IndexType& offset = 0 );
 
-      template< typename Vector >
-      void bind( const MeshPointer& meshPointer,
-                 Pointers::SharedPointer< Vector >& dataPtr,
-                 const IndexType& offset = 0 );
+   void
+   setMesh( const MeshPointer& meshPointer );
 
-      void setMesh( const MeshPointer& meshPointer );
+   template< typename Device = Devices::Host >
+   __cuda_callable__
+   const MeshType&
+   getMesh() const;
 
-      template< typename Device = Devices::Host >
-      __cuda_callable__
-      const MeshType& getMesh() const;
+   const MeshPointer&
+   getMeshPointer() const;
 
-      const MeshPointer& getMeshPointer() const;
+   MeshPointer&
+   getMeshPointer();
 
-      MeshPointer& getMeshPointer();
+   static IndexType
+   getDofs( const MeshPointer& meshPointer );
 
-      static IndexType getDofs( const MeshPointer& meshPointer );
+   __cuda_callable__
+   const VectorType&
+   getData() const;
 
-      __cuda_callable__ const VectorType& getData() const;
+   __cuda_callable__
+   VectorType&
+   getData();
 
-      __cuda_callable__ VectorType& getData();
+   bool
+   refresh( const RealType& time = 0.0 ) const;
 
-      bool refresh( const RealType& time = 0.0 ) const;
+   bool
+   deepRefresh( const RealType& time = 0.0 ) const;
 
-      bool deepRefresh( const RealType& time = 0.0 ) const;
+   template< typename EntityType >
+   RealType
+   getValue( const EntityType& meshEntity ) const;
 
-      template< typename EntityType >
-      RealType getValue( const EntityType& meshEntity ) const;
+   template< typename EntityType >
+   void
+   setValue( const EntityType& meshEntity, const RealType& value );
 
-      template< typename EntityType >
-      void setValue( const EntityType& meshEntity,
-                     const RealType& value );
+   template< typename EntityType >
+   __cuda_callable__
+   RealType&
+   operator()( const EntityType& meshEntity, const RealType& time = 0 );
 
-      template< typename EntityType >
-      __cuda_callable__
-      RealType& operator()( const EntityType& meshEntity,
-                            const RealType& time = 0 );
+   template< typename EntityType >
+   __cuda_callable__
+   const RealType&
+   operator()( const EntityType& meshEntity, const RealType& time = 0 ) const;
 
-      template< typename EntityType >
-      __cuda_callable__
-      const RealType& operator()( const EntityType& meshEntity,
-                                  const RealType& time = 0 ) const;
+   __cuda_callable__
+   RealType&
+   operator[]( const IndexType& meshEntityIndex );
 
-      __cuda_callable__
-      RealType& operator[]( const IndexType& meshEntityIndex );
+   __cuda_callable__
+   const RealType&
+   operator[]( const IndexType& meshEntityIndex ) const;
 
-      __cuda_callable__
-      const RealType& operator[]( const IndexType& meshEntityIndex ) const;
+   MeshFunctionView&
+   operator=( const MeshFunctionView& f );
 
-      MeshFunctionView& operator = ( const MeshFunctionView& f );
+   template< typename Function >
+   MeshFunctionView&
+   operator=( const Function& f );
 
-      template< typename Function >
-      MeshFunctionView& operator = ( const Function& f );
+   template< typename Function >
+   MeshFunctionView&
+   operator-=( const Function& f );
 
-      template< typename Function >
-      MeshFunctionView& operator -= ( const Function& f );
+   template< typename Function >
+   MeshFunctionView&
+   operator+=( const Function& f );
 
-      template< typename Function >
-      MeshFunctionView& operator += ( const Function& f );
+   RealType
+   getLpNorm( const RealType& p ) const;
 
-      RealType getLpNorm( const RealType& p ) const;
+   RealType
+   getMaxNorm() const;
 
-      RealType getMaxNorm() const;
+   bool
+   write( const std::string& functionName, const std::string& fileName, const std::string& fileFormat = "auto" ) const;
 
-      bool write( const std::string& functionName,
-                  const std::string& fileName,
-                  const std::string& fileFormat = "auto" ) const;
+protected:
+   MeshPointer meshPointer;
 
-   protected:
+   VectorType data;
 
-      MeshPointer meshPointer;
-
-      VectorType data;
-
-      template< typename, typename > friend class MeshFunctionEvaluator;
+   template< typename, typename >
+   friend class MeshFunctionEvaluator;
 };
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-std::ostream& operator << ( std::ostream& str, const MeshFunctionView< Mesh, MeshEntityDimension, Real >& f );
+template< typename Mesh, int MeshEntityDimension, typename Real >
+std::ostream&
+operator<<( std::ostream& str, const MeshFunctionView< Mesh, MeshEntityDimension, Real >& f );
 
-} // namespace Functions
-} // namespace TNL
+}  // namespace Functions
+}  // namespace TNL
 
 #include <TNL/Functions/MeshFunctionView.hpp>
diff --git a/src/TNL/Functions/MeshFunctionView.hpp b/src/TNL/Functions/MeshFunctionView.hpp
index 4328b589d00866754d832ddb1f69d5240465ce74..9c7a9ea3ce891310eaefbde09952e8d181cac97e 100644
--- a/src/TNL/Functions/MeshFunctionView.hpp
+++ b/src/TNL/Functions/MeshFunctionView.hpp
@@ -16,79 +16,62 @@
 namespace TNL {
 namespace Functions {
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-MeshFunctionView()
-{
-}
+template< typename Mesh, int MeshEntityDimension, typename Real >
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::MeshFunctionView() = default;
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-MeshFunctionView( const MeshFunctionView& meshFunction )
+template< typename Mesh, int MeshEntityDimension, typename Real >
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::MeshFunctionView( const MeshFunctionView& meshFunction )
 {
    this->meshPointer = meshFunction.meshPointer;
    this->data.bind( meshFunction.getData() );
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-   template< typename Vector >
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-MeshFunctionView( const MeshPointer& meshPointer,
-              Vector& data,
-              const IndexType& offset )
+template< typename Mesh, int MeshEntityDimension, typename Real >
+template< typename Vector >
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::MeshFunctionView( const MeshPointer& meshPointer,
+                                                                       Vector& data,
+                                                                       const IndexType& offset )
 //: meshPointer( meshPointer )
 {
-   TNL_ASSERT_GE( data.getSize(), meshPointer->template getEntitiesCount< typename MeshType::template EntityType< MeshEntityDimension > >(),
+   TNL_ASSERT_GE( data.getSize(),
+                  meshPointer->template getEntitiesCount< typename MeshType::template EntityType< MeshEntityDimension > >(),
                   "The input vector is not large enough for binding to the mesh function." );
 
    this->meshPointer = meshPointer;
-   this->data.bind( data, offset, getMesh().template getEntitiesCount< typename Mesh::template EntityType< MeshEntityDimension > >() );
+   this->data.bind(
+      data, offset, getMesh().template getEntitiesCount< typename Mesh::template EntityType< MeshEntityDimension > >() );
 }
 
-
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-   template< typename Vector >
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-MeshFunctionView( const MeshPointer& meshPointer,
-              Pointers::SharedPointer<  Vector >& data,
-              const IndexType& offset )
+template< typename Mesh, int MeshEntityDimension, typename Real >
+template< typename Vector >
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::MeshFunctionView( const MeshPointer& meshPointer,
+                                                                       Pointers::SharedPointer< Vector >& data,
+                                                                       const IndexType& offset )
 //: meshPointer( meshPointer )
 {
-   TNL_ASSERT_GE( data->getSize(), offset + meshPointer->template getEntitiesCount< typename MeshType::template EntityType< MeshEntityDimension > >(),
-                  "The input vector is not large enough for binding to the mesh function." );
+   TNL_ASSERT_GE(
+      data->getSize(),
+      offset + meshPointer->template getEntitiesCount< typename MeshType::template EntityType< MeshEntityDimension > >(),
+      "The input vector is not large enough for binding to the mesh function." );
 
    this->meshPointer = meshPointer;
-   this->data.bind( *data, offset, getMesh().template getEntitiesCount< typename Mesh::template EntityType< MeshEntityDimension > >() );
+   this->data.bind(
+      *data, offset, getMesh().template getEntitiesCount< typename Mesh::template EntityType< MeshEntityDimension > >() );
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 void
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-configSetup( Config::ConfigDescription& config,
-             const String& prefix )
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::configSetup( Config::ConfigDescription& config, const String& prefix )
 {
    config.addEntry< String >( prefix + "file", "Dataset for the mesh function." );
    config.addEntry< String >( prefix + "function-name", "Name of the mesh function in the input file.", "f" );
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 bool
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-setup( const MeshPointer& meshPointer,
-       const Config::ParameterContainer& parameters,
-       const String& prefix )
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::setup( const MeshPointer& meshPointer,
+                                                            const Config::ParameterContainer& parameters,
+                                                            const String& prefix )
 {
    this->setMesh( meshPointer );
    const String fileName = parameters.getParameter< String >( prefix + "file" );
@@ -96,255 +79,201 @@ setup( const MeshPointer& meshPointer,
    return readMeshFunction( *this, functionName, fileName );
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 void
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-bind( MeshFunctionView& meshFunction )
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::bind( MeshFunctionView& meshFunction )
 {
    this->meshPointer = meshFunction.meshPointer;
    this->data.bind( meshFunction.getData() );
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-   template< typename Vector >
+template< typename Mesh, int MeshEntityDimension, typename Real >
+template< typename Vector >
 void
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-bind( Vector& data,
-      const IndexType& offset )
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::bind( Vector& data, const IndexType& offset )
 {
-   TNL_ASSERT_GE( data.getSize(), offset + meshPointer->template getEntitiesCount< typename MeshType::template EntityType< MeshEntityDimension > >(),
-                  "The input vector is not large enough for binding to the mesh function." );
-   this->data.bind( data.getData() + offset, getMesh().template getEntitiesCount< typename Mesh::template EntityType< MeshEntityDimension > >() );
+   TNL_ASSERT_GE(
+      data.getSize(),
+      offset + meshPointer->template getEntitiesCount< typename MeshType::template EntityType< MeshEntityDimension > >(),
+      "The input vector is not large enough for binding to the mesh function." );
+   this->data.bind( data.getData() + offset,
+                    getMesh().template getEntitiesCount< typename Mesh::template EntityType< MeshEntityDimension > >() );
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-   template< typename Vector >
+template< typename Mesh, int MeshEntityDimension, typename Real >
+template< typename Vector >
 void
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-bind( const MeshPointer& meshPointer,
-      Vector& data,
-      const IndexType& offset )
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::bind( const MeshPointer& meshPointer,
+                                                           Vector& data,
+                                                           const IndexType& offset )
 {
-   TNL_ASSERT_GE( data.getSize(), offset + meshPointer->template getEntitiesCount< typename MeshType::template EntityType< MeshEntityDimension > >(),
-                  "The input vector is not large enough for binding to the mesh function." );
+   TNL_ASSERT_GE(
+      data.getSize(),
+      offset + meshPointer->template getEntitiesCount< typename MeshType::template EntityType< MeshEntityDimension > >(),
+      "The input vector is not large enough for binding to the mesh function." );
 
    this->meshPointer = meshPointer;
-   this->data.bind( data.getData() + offset, getMesh().template getEntitiesCount< typename Mesh::template EntityType< MeshEntityDimension > >() );
+   this->data.bind( data.getData() + offset,
+                    getMesh().template getEntitiesCount< typename Mesh::template EntityType< MeshEntityDimension > >() );
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-   template< typename Vector >
+template< typename Mesh, int MeshEntityDimension, typename Real >
+template< typename Vector >
 void
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-bind( const MeshPointer& meshPointer,
-      Pointers::SharedPointer< Vector >& data,
-      const IndexType& offset )
-{
-   TNL_ASSERT_GE( data->getSize(), offset + meshPointer->template getEntitiesCount< typename MeshType::template EntityType< MeshEntityDimension > >(),
-                  "The input vector is not large enough for binding to the mesh function." );
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::bind( const MeshPointer& meshPointer,
+                                                           Pointers::SharedPointer< Vector >& data,
+                                                           const IndexType& offset )
+{
+   TNL_ASSERT_GE(
+      data->getSize(),
+      offset + meshPointer->template getEntitiesCount< typename MeshType::template EntityType< MeshEntityDimension > >(),
+      "The input vector is not large enough for binding to the mesh function." );
    static_assert( std::is_same< typename Vector::RealType, RealType >::value, "Cannot bind Vector with different Real type." );
 
    this->meshPointer = meshPointer;
-   this->data.bind( *data + offset, getMesh().template getEntitiesCount< typename Mesh::template EntityType< MeshEntityDimension > >() );
+   this->data.bind( *data + offset,
+                    getMesh().template getEntitiesCount< typename Mesh::template EntityType< MeshEntityDimension > >() );
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 void
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-setMesh( const MeshPointer& meshPointer )
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::setMesh( const MeshPointer& meshPointer )
 {
    this->meshPointer = meshPointer;
    this->data.reset();
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
- template< typename Device >
+template< typename Mesh, int MeshEntityDimension, typename Real >
+template< typename Device >
 __cuda_callable__
 const typename MeshFunctionView< Mesh, MeshEntityDimension, Real >::MeshType&
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-getMesh() const
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::getMesh() const
 {
    return this->meshPointer.template getData< Device >();
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 const typename MeshFunctionView< Mesh, MeshEntityDimension, Real >::MeshPointer&
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-getMeshPointer() const
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::getMeshPointer() const
 {
    return this->meshPointer;
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 typename MeshFunctionView< Mesh, MeshEntityDimension, Real >::MeshPointer&
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-getMeshPointer()
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::getMeshPointer()
 {
    return this->meshPointer;
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 typename MeshFunctionView< Mesh, MeshEntityDimension, Real >::IndexType
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-getDofs( const MeshPointer& meshPointer )
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::getDofs( const MeshPointer& meshPointer )
 {
    return meshPointer->template getEntitiesCount< getEntitiesDimension() >();
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 __cuda_callable__
 const typename MeshFunctionView< Mesh, MeshEntityDimension, Real >::VectorType&
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-getData() const
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::getData() const
 {
    return this->data;
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 __cuda_callable__
 typename MeshFunctionView< Mesh, MeshEntityDimension, Real >::VectorType&
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-getData()
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::getData()
 {
    return this->data;
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 bool
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-refresh( const RealType& time ) const
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::refresh( const RealType& time ) const
 {
    return true;
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 bool
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-deepRefresh( const RealType& time ) const
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::deepRefresh( const RealType& time ) const
 {
    return true;
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-   template< typename EntityType >
+template< typename Mesh, int MeshEntityDimension, typename Real >
+template< typename EntityType >
 typename Functions::MeshFunctionView< Mesh, MeshEntityDimension, Real >::RealType
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-getValue( const EntityType& meshEntity ) const
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::getValue( const EntityType& meshEntity ) const
 {
-   static_assert( EntityType::getEntityDimension() == MeshEntityDimension, "Calling with wrong EntityType -- entity dimensions do not match." );
+   static_assert( EntityType::getEntityDimension() == MeshEntityDimension,
+                  "Calling with wrong EntityType -- entity dimensions do not match." );
    return this->data.getElement( meshEntity.getIndex() );
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-   template< typename EntityType >
+template< typename Mesh, int MeshEntityDimension, typename Real >
+template< typename EntityType >
 void
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-setValue( const EntityType& meshEntity,
-          const RealType& value )
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::setValue( const EntityType& meshEntity, const RealType& value )
 {
-   static_assert( EntityType::getEntityDimension() == MeshEntityDimension, "Calling with wrong EntityType -- entity dimensions do not match." );
+   static_assert( EntityType::getEntityDimension() == MeshEntityDimension,
+                  "Calling with wrong EntityType -- entity dimensions do not match." );
    this->data.setElement( meshEntity.getIndex(), value );
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-   template< typename EntityType >
+template< typename Mesh, int MeshEntityDimension, typename Real >
+template< typename EntityType >
 __cuda_callable__
 typename Functions::MeshFunctionView< Mesh, MeshEntityDimension, Real >::RealType&
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-operator()( const EntityType& meshEntity,
-            const RealType& time )
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::operator()( const EntityType& meshEntity, const RealType& time )
 {
-   static_assert( EntityType::getEntityDimension() == MeshEntityDimension, "Calling with wrong EntityType -- entity dimensions do not match." );
+   static_assert( EntityType::getEntityDimension() == MeshEntityDimension,
+                  "Calling with wrong EntityType -- entity dimensions do not match." );
    return this->data[ meshEntity.getIndex() ];
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-   template< typename EntityType >
+template< typename Mesh, int MeshEntityDimension, typename Real >
+template< typename EntityType >
 __cuda_callable__
 const typename Functions::MeshFunctionView< Mesh, MeshEntityDimension, Real >::RealType&
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-operator()( const EntityType& meshEntity,
-            const RealType& time ) const
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::operator()( const EntityType& meshEntity, const RealType& time ) const
 {
-   static_assert( EntityType::getEntityDimension() == MeshEntityDimension, "Calling with wrong EntityType -- entity dimensions do not match." );
+   static_assert( EntityType::getEntityDimension() == MeshEntityDimension,
+                  "Calling with wrong EntityType -- entity dimensions do not match." );
    return this->data[ meshEntity.getIndex() ];
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 __cuda_callable__
 typename Functions::MeshFunctionView< Mesh, MeshEntityDimension, Real >::RealType&
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-operator[]( const IndexType& meshEntityIndex )
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::operator[]( const IndexType& meshEntityIndex )
 {
    return this->data[ meshEntityIndex ];
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 __cuda_callable__
 const typename Functions::MeshFunctionView< Mesh, MeshEntityDimension, Real >::RealType&
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-operator[]( const IndexType& meshEntityIndex ) const
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::operator[]( const IndexType& meshEntityIndex ) const
 {
    return this->data[ meshEntityIndex ];
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 MeshFunctionView< Mesh, MeshEntityDimension, Real >&
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-operator = ( const MeshFunctionView& f )
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::operator=( const MeshFunctionView& f )
 {
    this->setMesh( f.getMeshPointer() );
    this->getData() = f.getData();
    return *this;
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-   template< typename Function >
+template< typename Mesh, int MeshEntityDimension, typename Real >
+template< typename Function >
 MeshFunctionView< Mesh, MeshEntityDimension, Real >&
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-operator = ( const Function& f )
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::operator=( const Function& f )
 {
    Pointers::DevicePointer< MeshFunctionView > thisDevicePtr( *this );
    Pointers::DevicePointer< std::add_const_t< Function > > fDevicePtr( f );
@@ -352,75 +281,58 @@ operator = ( const Function& f )
    return *this;
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-   template< typename Function >
+template< typename Mesh, int MeshEntityDimension, typename Real >
+template< typename Function >
 MeshFunctionView< Mesh, MeshEntityDimension, Real >&
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-operator += ( const Function& f )
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::operator+=( const Function& f )
 {
    Pointers::DevicePointer< MeshFunctionView > thisDevicePtr( *this );
    Pointers::DevicePointer< std::add_const_t< Function > > fDevicePtr( f );
-   MeshFunctionEvaluator< MeshFunctionView, Function >::evaluate( thisDevicePtr, fDevicePtr, ( RealType ) 1.0, ( RealType ) 1.0 );
+   MeshFunctionEvaluator< MeshFunctionView, Function >::evaluate( thisDevicePtr, fDevicePtr, (RealType) 1.0, (RealType) 1.0 );
    return *this;
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
-   template< typename Function >
+template< typename Mesh, int MeshEntityDimension, typename Real >
+template< typename Function >
 MeshFunctionView< Mesh, MeshEntityDimension, Real >&
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-operator -= ( const Function& f )
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::operator-=( const Function& f )
 {
    Pointers::DevicePointer< MeshFunctionView > thisDevicePtr( *this );
    Pointers::DevicePointer< std::add_const_t< Function > > fDevicePtr( f );
-   MeshFunctionEvaluator< MeshFunctionView, Function >::evaluate( thisDevicePtr, fDevicePtr, ( RealType ) 1.0, ( RealType ) -1.0 );
+   MeshFunctionEvaluator< MeshFunctionView, Function >::evaluate( thisDevicePtr, fDevicePtr, (RealType) 1.0, (RealType) -1.0 );
    return *this;
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 Real
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-getLpNorm( const RealType& p ) const
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::getLpNorm( const RealType& p ) const
 {
    return MeshFunctionNormGetter< Mesh >::getNorm( *this, p );
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 Real
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-getMaxNorm() const
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::getMaxNorm() const
 {
    return max( abs( this->data ) );
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 bool
-MeshFunctionView< Mesh, MeshEntityDimension, Real >::
-write( const std::string& functionName,
-       const std::string& fileName,
-       const std::string& fileFormat ) const
+MeshFunctionView< Mesh, MeshEntityDimension, Real >::write( const std::string& functionName,
+                                                            const std::string& fileName,
+                                                            const std::string& fileFormat ) const
 {
    return writeMeshFunction( *this, functionName, fileName, fileFormat );
 }
 
-template< typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< typename Mesh, int MeshEntityDimension, typename Real >
 std::ostream&
-operator << ( std::ostream& str, const MeshFunctionView< Mesh, MeshEntityDimension, Real >& f )
+operator<<( std::ostream& str, const MeshFunctionView< Mesh, MeshEntityDimension, Real >& f )
 {
    str << f.getData();
    return str;
 }
 
-} // namespace Functions
-} // namespace TNL
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/OperatorFunction.h b/src/TNL/Functions/OperatorFunction.h
index 0c6e47b3291ebf572ffa1017f6e703dbd8143c8d..0ef476b94496f3f655f59d469ffba26cd64d2e1e 100644
--- a/src/TNL/Functions/OperatorFunction.h
+++ b/src/TNL/Functions/OperatorFunction.h
@@ -12,7 +12,7 @@
 #include <TNL/Solvers/PDE/BoundaryConditionsSetter.h>
 
 namespace TNL {
-namespace Functions {   
+namespace Functions {
 
 /***
  * This class evaluates given operator on given preimageFunction. If the flag
@@ -24,401 +24,462 @@ namespace Functions {
  * values on the boundary mesh entities are undefined. In this case, the mesh
  * preimageFunction evaluator evaluates this preimageFunction only on the INTERIOR mesh entities.
  */
-   
+
 template< typename Operator,
           typename Function = typename Operator::FunctionType,
           typename BoundaryConditions = void,
           bool EvaluateOnFly = false,
           bool IsAnalytic = ( Function::getDomainType() == SpaceDomain || Function::getDomainType() == NonspaceDomain ) >
-class OperatorFunction{};
+class OperatorFunction
+{};
 
 /****
  * Specialization for 'On the fly' evaluation with the boundary conditions does not make sense.
  */
-template< typename Operator,
-          typename MeshFunctionT,
-          typename BoundaryConditions,
-          bool IsAnalytic >
+template< typename Operator, typename MeshFunctionT, typename BoundaryConditions, bool IsAnalytic >
 class OperatorFunction< Operator, MeshFunctionT, BoundaryConditions, true, IsAnalytic >
- : public Domain< Operator::getDimension(), MeshDomain >
-{
-};
+: public Domain< Operator::getDimension(), MeshDomain >
+{};
 
 /****
  * Specialization for 'On the fly' evaluation and no boundary conditions.
  */
-template< typename Operator,
-          typename MeshFunctionT,
-          bool IsAnalytic >
+template< typename Operator, typename MeshFunctionT, bool IsAnalytic >
 class OperatorFunction< Operator, MeshFunctionT, void, true, IsAnalytic >
- : public Domain< Operator::getDomainDimension(), Operator::getDomainType() >
+: public Domain< Operator::getDomainDimension(), Operator::getDomainType() >
 {
-   public:
- 
-      static_assert( MeshFunctionT::getDomainType() == MeshDomain ||
-                     MeshFunctionT::getDomainType() == MeshInteriorDomain ||
-                     MeshFunctionT::getDomainType() == MeshBoundaryDomain,
-         "Only mesh preimageFnctions may be used in the operator preimageFunction. Use ExactOperatorFunction instead of OperatorFunction." );
-      static_assert( std::is_same< typename Operator::MeshType, typename MeshFunctionT::MeshType >::value,
-          "Both, operator and mesh preimageFunction must be defined on the same mesh." );
- 
-      typedef Operator OperatorType;
-      typedef MeshFunctionT FunctionType;
-      typedef typename OperatorType::MeshType MeshType;
-      typedef typename OperatorType::RealType RealType;
-      typedef typename OperatorType::DeviceType DeviceType;
-      typedef typename OperatorType::IndexType IndexType;
-      typedef typename OperatorType::ExactOperatorType ExactOperatorType;
-      typedef MeshFunction< MeshType, OperatorType::getPreimageEntitiesDimension() > PreimageFunctionType;
-      typedef Pointers::SharedPointer<  MeshType, DeviceType > MeshPointer;
-      
-      static constexpr int getEntitiesDimension() { return OperatorType::getImageEntitiesDimension(); };     
-      
-      OperatorFunction( const OperatorType& operator_ )
-      :  operator_( operator_ ), preimageFunction( 0 ){};
- 
-      OperatorFunction( const OperatorType& operator_,
-                           const FunctionType& preimageFunction )
-      :  operator_( operator_ ), preimageFunction( &preimageFunction ){};
- 
-      const MeshType& getMesh() const
-      {
-         TNL_ASSERT_TRUE( this->preimageFunction, "The preimage function was not set." );
-         return this->preimageFunction->getMesh();
-      };
-      
-      const MeshPointer& getMeshPointer() const
-      { 
-         TNL_ASSERT_TRUE( this->preimageFunction, "The preimage function was not set." );
-         return this->preimageFunction->getMeshPointer(); 
-      };
-
-      
-      void setPreimageFunction( const FunctionType& preimageFunction ) { this->preimageFunction = &preimageFunction; }
- 
-      Operator& getOperator() { return this->operator_; }
- 
-      const Operator& getOperator() const { return this->operator_; }
- 
-      bool refresh( const RealType& time = 0.0 ) { return true; };
- 
-      bool deepRefresh( const RealType& time = 0.0 ) { return true; };
- 
-      template< typename MeshEntity >
-      __cuda_callable__
-      RealType operator()(
-         const MeshEntity& meshEntity,
-         const RealType& time = 0.0 ) const
-      {
-         TNL_ASSERT_TRUE( this->preimageFunction, "The preimage function was not set." );
-         return operator_( *preimageFunction, meshEntity, time );
-      }
- 
-   protected:
- 
-      const Operator& operator_;
- 
-      const FunctionType* preimageFunction;
- 
-      template< typename, typename > friend class MeshFunctionEvaluator;
+public:
+   static_assert( MeshFunctionT::getDomainType() == MeshDomain || MeshFunctionT::getDomainType() == MeshInteriorDomain
+                     || MeshFunctionT::getDomainType() == MeshBoundaryDomain,
+                  "Only mesh preimageFnctions may be used in the operator preimageFunction. Use ExactOperatorFunction instead "
+                  "of OperatorFunction." );
+   static_assert( std::is_same< typename Operator::MeshType, typename MeshFunctionT::MeshType >::value,
+                  "Both, operator and mesh preimageFunction must be defined on the same mesh." );
+
+   typedef Operator OperatorType;
+   typedef MeshFunctionT FunctionType;
+   typedef typename OperatorType::MeshType MeshType;
+   typedef typename OperatorType::RealType RealType;
+   typedef typename OperatorType::DeviceType DeviceType;
+   typedef typename OperatorType::IndexType IndexType;
+   typedef typename OperatorType::ExactOperatorType ExactOperatorType;
+   typedef MeshFunction< MeshType, OperatorType::getPreimageEntitiesDimension() > PreimageFunctionType;
+   typedef Pointers::SharedPointer< MeshType, DeviceType > MeshPointer;
+
+   static constexpr int
+   getEntitiesDimension()
+   {
+      return OperatorType::getImageEntitiesDimension();
+   };
+
+   OperatorFunction( const OperatorType& operator_ ) : operator_( operator_ ), preimageFunction( 0 ){};
+
+   OperatorFunction( const OperatorType& operator_, const FunctionType& preimageFunction )
+   : operator_( operator_ ), preimageFunction( &preimageFunction ){};
+
+   const MeshType&
+   getMesh() const
+   {
+      TNL_ASSERT_TRUE( this->preimageFunction, "The preimage function was not set." );
+      return this->preimageFunction->getMesh();
+   };
+
+   const MeshPointer&
+   getMeshPointer() const
+   {
+      TNL_ASSERT_TRUE( this->preimageFunction, "The preimage function was not set." );
+      return this->preimageFunction->getMeshPointer();
+   };
+
+   void
+   setPreimageFunction( const FunctionType& preimageFunction )
+   {
+      this->preimageFunction = &preimageFunction;
+   }
+
+   Operator&
+   getOperator()
+   {
+      return this->operator_;
+   }
+
+   const Operator&
+   getOperator() const
+   {
+      return this->operator_;
+   }
+
+   bool
+   refresh( const RealType& time = 0.0 )
+   {
+      return true;
+   };
+
+   bool
+   deepRefresh( const RealType& time = 0.0 )
+   {
+      return true;
+   };
+
+   template< typename MeshEntity >
+   __cuda_callable__
+   RealType
+   operator()( const MeshEntity& meshEntity, const RealType& time = 0.0 ) const
+   {
+      TNL_ASSERT_TRUE( this->preimageFunction, "The preimage function was not set." );
+      return operator_( *preimageFunction, meshEntity, time );
+   }
+
+protected:
+   const Operator& operator_;
+
+   const FunctionType* preimageFunction;
+
+   template< typename, typename >
+   friend class MeshFunctionEvaluator;
 };
 
 /****
  * Specialization for precomputed evaluation and no boundary conditions.
  */
-template< typename Operator,
-          typename PreimageFunction,
-          bool IsAnalytic >
+template< typename Operator, typename PreimageFunction, bool IsAnalytic >
 class OperatorFunction< Operator, PreimageFunction, void, false, IsAnalytic >
- : public Domain< Operator::getDomainDimension(), Operator::getDomainType() >
+: public Domain< Operator::getDomainDimension(), Operator::getDomainType() >
 {
-   public:
- 
-      static_assert( PreimageFunction::getDomainType() == MeshDomain ||
-                     PreimageFunction::getDomainType() == MeshInteriorDomain ||
-                     PreimageFunction::getDomainType() == MeshBoundaryDomain,
-         "Only mesh preimageFunctions may be used in the operator preimageFunction. Use ExactOperatorFunction instead of OperatorFunction." );
-      static_assert( std::is_same< typename Operator::MeshType, typename PreimageFunction::MeshType >::value,
-          "Both, operator and mesh preimageFunction must be defined on the same mesh." );
- 
-      typedef Operator OperatorType;
-      typedef typename OperatorType::MeshType MeshType;
-      typedef typename OperatorType::RealType RealType;
-      typedef typename OperatorType::DeviceType DeviceType;
-      typedef typename OperatorType::IndexType IndexType;
-      typedef PreimageFunction PreimageFunctionType;
-      typedef Functions::MeshFunction< MeshType, Operator::getImageEntitiesDimension() > ImageFunctionType;
-      typedef OperatorFunction< Operator, PreimageFunction, void, true > OperatorFunctionType;
-      typedef typename OperatorType::ExactOperatorType ExactOperatorType;
-      typedef Pointers::SharedPointer<  MeshType, DeviceType > MeshPointer;
-      
-      static constexpr int getEntitiesDimension() { return OperatorType::getImageEntitiesDimension(); };     
-      
-      OperatorFunction( OperatorType& operator_,
-                           const MeshPointer& mesh )
-      :  operator_( operator_ ), imageFunction( mesh )
-      {};
- 
-      OperatorFunction( OperatorType& operator_,
-                           PreimageFunctionType& preimageFunction )
-      :  operator_( operator_ ), imageFunction( preimageFunction.getMeshPointer() ), preimageFunction( &preimageFunction )
-      {};
- 
-      const MeshType& getMesh() const { return this->imageFunction.getMesh(); };
-      
-      const MeshPointer& getMeshPointer() const { return this->imageFunction.getMeshPointer(); };
-      
-      ImageFunctionType& getImageFunction() { return this->imageFunction; };
- 
-      const ImageFunctionType& getImageFunction() const { return this->imageFunction; };
- 
-      void setPreimageFunction( PreimageFunctionType& preimageFunction )
-      {
-         this->preimageFunction = &preimageFunction;
-         this->imageFunction.setMesh( preimageFunction.getMeshPointer() );
-      };
- 
-      const PreimageFunctionType& getPreimageFunction() const { return *this->preimageFunction; };
- 
-      Operator& getOperator() { return this->operator_; }
- 
-      const Operator& getOperator() const { return this->operator_; }
-
-      bool refresh( const RealType& time = 0.0 )
-      {
-         OperatorFunction operatorFunction( this->operator_, *preimageFunction );
-         this->operator_.setPreimageFunction( *this->preimageFunction );
-         if( ! this->operator_.refresh( time ) ||
-             ! operatorFunction.refresh( time )  )
-             return false;
-         this->imageFunction = operatorFunction;
-         return true;
-      };
- 
-      bool deepRefresh( const RealType& time = 0.0 )
-      {
-         if( ! this->preimageFunction->deepRefresh( time ) )
-            return false;
-         return this->refresh( time );
-      };
- 
-      template< typename MeshEntity >
-      __cuda_callable__
-      RealType operator()(
-         const MeshEntity& meshEntity,
-         const RealType& time = 0 ) const
-      {
-         return imageFunction[ meshEntity.getIndex() ];
-      }
- 
-      __cuda_callable__
-      RealType operator[]( const IndexType& index ) const
-      {
-         return imageFunction[ index ];
-      }
- 
-   protected:
- 
-      Operator& operator_;
- 
-      PreimageFunctionType* preimageFunction;
- 
-      ImageFunctionType imageFunction;
- 
-      template< typename, typename > friend class MeshFunctionEvaluator;
+public:
+   static_assert( PreimageFunction::getDomainType() == MeshDomain || PreimageFunction::getDomainType() == MeshInteriorDomain
+                     || PreimageFunction::getDomainType() == MeshBoundaryDomain,
+                  "Only mesh preimageFunctions may be used in the operator preimageFunction. Use ExactOperatorFunction instead "
+                  "of OperatorFunction." );
+   static_assert( std::is_same< typename Operator::MeshType, typename PreimageFunction::MeshType >::value,
+                  "Both, operator and mesh preimageFunction must be defined on the same mesh." );
+
+   typedef Operator OperatorType;
+   typedef typename OperatorType::MeshType MeshType;
+   typedef typename OperatorType::RealType RealType;
+   typedef typename OperatorType::DeviceType DeviceType;
+   typedef typename OperatorType::IndexType IndexType;
+   typedef PreimageFunction PreimageFunctionType;
+   typedef Functions::MeshFunction< MeshType, Operator::getImageEntitiesDimension() > ImageFunctionType;
+   typedef OperatorFunction< Operator, PreimageFunction, void, true > OperatorFunctionType;
+   typedef typename OperatorType::ExactOperatorType ExactOperatorType;
+   typedef Pointers::SharedPointer< MeshType, DeviceType > MeshPointer;
+
+   static constexpr int
+   getEntitiesDimension()
+   {
+      return OperatorType::getImageEntitiesDimension();
+   };
+
+   OperatorFunction( OperatorType& operator_, const MeshPointer& mesh ) : operator_( operator_ ), imageFunction( mesh ){};
+
+   OperatorFunction( OperatorType& operator_, PreimageFunctionType& preimageFunction )
+   : operator_( operator_ ), imageFunction( preimageFunction.getMeshPointer() ), preimageFunction( &preimageFunction ){};
+
+   const MeshType&
+   getMesh() const
+   {
+      return this->imageFunction.getMesh();
+   };
+
+   const MeshPointer&
+   getMeshPointer() const
+   {
+      return this->imageFunction.getMeshPointer();
+   };
+
+   ImageFunctionType&
+   getImageFunction()
+   {
+      return this->imageFunction;
+   };
+
+   const ImageFunctionType&
+   getImageFunction() const
+   {
+      return this->imageFunction;
+   };
+
+   void
+   setPreimageFunction( PreimageFunctionType& preimageFunction )
+   {
+      this->preimageFunction = &preimageFunction;
+      this->imageFunction.setMesh( preimageFunction.getMeshPointer() );
+   };
+
+   const PreimageFunctionType&
+   getPreimageFunction() const
+   {
+      return *this->preimageFunction;
+   };
+
+   Operator&
+   getOperator()
+   {
+      return this->operator_;
+   }
+
+   const Operator&
+   getOperator() const
+   {
+      return this->operator_;
+   }
+
+   bool
+   refresh( const RealType& time = 0.0 )
+   {
+      OperatorFunction operatorFunction( this->operator_, *preimageFunction );
+      this->operator_.setPreimageFunction( *this->preimageFunction );
+      if( ! this->operator_.refresh( time ) || ! operatorFunction.refresh( time ) )
+         return false;
+      this->imageFunction = operatorFunction;
+      return true;
+   };
+
+   bool
+   deepRefresh( const RealType& time = 0.0 )
+   {
+      if( ! this->preimageFunction->deepRefresh( time ) )
+         return false;
+      return this->refresh( time );
+   };
+
+   template< typename MeshEntity >
+   __cuda_callable__
+   RealType
+   operator()( const MeshEntity& meshEntity, const RealType& time = 0 ) const
+   {
+      return imageFunction[ meshEntity.getIndex() ];
+   }
+
+   __cuda_callable__
+   RealType
+   operator[]( const IndexType& index ) const
+   {
+      return imageFunction[ index ];
+   }
+
+protected:
+   Operator& operator_;
+
+   PreimageFunctionType* preimageFunction;
+
+   ImageFunctionType imageFunction;
+
+   template< typename, typename >
+   friend class MeshFunctionEvaluator;
 };
 
 /****
  * Specialization for precomputed evaluation and with boundary conditions.
  */
-template< typename Operator,
-          typename Function,
-          typename BoundaryConditions,
-          bool IsAnalytic >
+template< typename Operator, typename Function, typename BoundaryConditions, bool IsAnalytic >
 class OperatorFunction< Operator, Function, BoundaryConditions, false, IsAnalytic >
-  : public Domain< Operator::getDimension(), MeshDomain >
+: public Domain< Operator::getDimension(), MeshDomain >
 {
-   public:
- 
-      static_assert( Function::getDomainType() == MeshDomain ||
-                     Function::getDomainType() == MeshInteriorDomain ||
-                     Function::getDomainType() == MeshBoundaryDomain,
-         "Only mesh preimageFunctions may be used in the operator preimageFunction. Use ExactOperatorFunction instead of OperatorFunction." );
-      static_assert( std::is_same< typename Operator::MeshType, typename Function::MeshType >::value,
-          "Both, operator and mesh preimageFunction must be defined on the same mesh." );
-      static_assert( std::is_same< typename BoundaryConditions::MeshType, typename Operator::MeshType >::value,
-         "The operator and the boundary conditions are defined on different mesh types." );
- 
-      typedef Operator OperatorType;
-      typedef typename OperatorType::MeshType MeshType;
-      typedef Pointers::SharedPointer<  MeshType > MeshPointer;
-      typedef typename OperatorType::RealType RealType;
-      typedef typename OperatorType::DeviceType DeviceType;
-      typedef typename OperatorType::IndexType IndexType;
-      typedef Function PreimageFunctionType;
-      typedef Functions::MeshFunction< MeshType, Operator::getImageEntitiesDimension() > ImageFunctionType;
-      typedef BoundaryConditions BoundaryConditionsType;
-      typedef OperatorFunction< Operator, Function, void, true > OperatorFunctionType;
-      typedef typename OperatorType::ExactOperatorType ExactOperatorType;
- 
-      static constexpr int getEntitiesDimension() { return OperatorType::getImageEntitiesDimension(); };
- 
-      OperatorFunction( OperatorType& operator_,
-                           const BoundaryConditionsType& boundaryConditions,
-                           const MeshPointer& meshPointer )
-      :  operator_( operator_ ),
-         boundaryConditions( boundaryConditions ),
-         imageFunction( meshPointer )//,
-         //preimageFunction( 0 )
-      {
-         this->preimageFunction = NULL;
-      };
-      
-      OperatorFunction( OperatorType& operator_,
-                           const BoundaryConditionsType& boundaryConditions,
-                           const PreimageFunctionType& preimageFunction )
-      :  operator_( operator_ ),
-         boundaryConditions( boundaryConditions ),
-         imageFunction( preimageFunction.getMeshPointer() ),
-         preimageFunction( &preimageFunction )
-      {};
- 
-      const MeshType& getMesh() const { return imageFunction.getMesh(); };
-      
-      const MeshPointer& getMeshPointer() const { return imageFunction.getMeshPointer(); };
-      
-      void setPreimageFunction( const PreimageFunctionType& preimageFunction )
-      {
-         this->preimageFunction = &preimageFunction;
-      }
- 
-      const PreimageFunctionType& getPreimageFunction() const
-      {
-         TNL_ASSERT_TRUE( this->preimageFunction, "The preimage function was not set." );
-         return *this->preimageFunction;
-      };
- 
-      PreimageFunctionType& getPreimageFunction()
-      {
-         TNL_ASSERT_TRUE( this->preimageFunction, "The preimage function was not set." );
-         return *this->preimageFunction;
-      };
- 
-      const ImageFunctionType& getImageFunction() const { return this->imageFunction; };
- 
-      ImageFunctionType& getImageFunction() { return this->imageFunction; };
- 
-      Operator& getOperator() { return this->operator_; }
- 
-      const Operator& getOperator() const { return this->operator_; }
-
-      bool refresh( const RealType& time = 0.0 )
-      {
-         OperatorFunctionType operatorFunction( this->operator_, *this->preimageFunction );
-         this->operator_.setPreimageFunction( *this->preimageFunction );
-         if( ! this->operator_.refresh( time ) ||
-             ! operatorFunction.refresh( time )  )
-             return false;
-         this->imageFunction = operatorFunction;
-         Solvers::PDE::BoundaryConditionsSetter< ImageFunctionType, BoundaryConditionsType >::apply( this->boundaryConditions, time, this->imageFunction );
-         return true;
-      };
- 
-      bool deepRefresh( const RealType& time = 0.0 )
-      {
-         return preimageFunction->deepRefresh( time ) &&
-                this->refresh( time );
-      };
- 
-      template< typename MeshEntity >
-      __cuda_callable__
-      const RealType& operator()(
-         const MeshEntity& meshEntity,
-         const RealType& time = 0 ) const
-      {
-         return imageFunction[ meshEntity.getIndex() ];
-      }
- 
-      __cuda_callable__
-      const RealType& operator[]( const IndexType& index ) const
-      {
-         return imageFunction[ index ];
-      }
- 
-   protected:
- 
-      Operator& operator_;
- 
-      const PreimageFunctionType* preimageFunction;
- 
-      ImageFunctionType imageFunction;
- 
-      const BoundaryConditionsType& boundaryConditions;
- 
-      template< typename, typename > friend class MeshFunctionEvaluator;
+public:
+   static_assert( Function::getDomainType() == MeshDomain || Function::getDomainType() == MeshInteriorDomain
+                     || Function::getDomainType() == MeshBoundaryDomain,
+                  "Only mesh preimageFunctions may be used in the operator preimageFunction. Use ExactOperatorFunction instead "
+                  "of OperatorFunction." );
+   static_assert( std::is_same< typename Operator::MeshType, typename Function::MeshType >::value,
+                  "Both, operator and mesh preimageFunction must be defined on the same mesh." );
+   static_assert( std::is_same< typename BoundaryConditions::MeshType, typename Operator::MeshType >::value,
+                  "The operator and the boundary conditions are defined on different mesh types." );
+
+   typedef Operator OperatorType;
+   typedef typename OperatorType::MeshType MeshType;
+   typedef Pointers::SharedPointer< MeshType > MeshPointer;
+   typedef typename OperatorType::RealType RealType;
+   typedef typename OperatorType::DeviceType DeviceType;
+   typedef typename OperatorType::IndexType IndexType;
+   typedef Function PreimageFunctionType;
+   typedef Functions::MeshFunction< MeshType, Operator::getImageEntitiesDimension() > ImageFunctionType;
+   typedef BoundaryConditions BoundaryConditionsType;
+   typedef OperatorFunction< Operator, Function, void, true > OperatorFunctionType;
+   typedef typename OperatorType::ExactOperatorType ExactOperatorType;
+
+   static constexpr int
+   getEntitiesDimension()
+   {
+      return OperatorType::getImageEntitiesDimension();
+   };
+
+   OperatorFunction( OperatorType& operator_, const BoundaryConditionsType& boundaryConditions, const MeshPointer& meshPointer )
+   : operator_( operator_ ), boundaryConditions( boundaryConditions ), imageFunction( meshPointer )  //,
+   // preimageFunction( 0 )
+   {
+      this->preimageFunction = NULL;
+   };
+
+   OperatorFunction( OperatorType& operator_,
+                     const BoundaryConditionsType& boundaryConditions,
+                     const PreimageFunctionType& preimageFunction )
+   : operator_( operator_ ), boundaryConditions( boundaryConditions ), imageFunction( preimageFunction.getMeshPointer() ),
+     preimageFunction( &preimageFunction ){};
+
+   const MeshType&
+   getMesh() const
+   {
+      return imageFunction.getMesh();
+   };
+
+   const MeshPointer&
+   getMeshPointer() const
+   {
+      return imageFunction.getMeshPointer();
+   };
+
+   void
+   setPreimageFunction( const PreimageFunctionType& preimageFunction )
+   {
+      this->preimageFunction = &preimageFunction;
+   }
+
+   const PreimageFunctionType&
+   getPreimageFunction() const
+   {
+      TNL_ASSERT_TRUE( this->preimageFunction, "The preimage function was not set." );
+      return *this->preimageFunction;
+   };
+
+   PreimageFunctionType&
+   getPreimageFunction()
+   {
+      TNL_ASSERT_TRUE( this->preimageFunction, "The preimage function was not set." );
+      return *this->preimageFunction;
+   };
+
+   const ImageFunctionType&
+   getImageFunction() const
+   {
+      return this->imageFunction;
+   };
+
+   ImageFunctionType&
+   getImageFunction()
+   {
+      return this->imageFunction;
+   };
+
+   Operator&
+   getOperator()
+   {
+      return this->operator_;
+   }
+
+   const Operator&
+   getOperator() const
+   {
+      return this->operator_;
+   }
+
+   bool
+   refresh( const RealType& time = 0.0 )
+   {
+      OperatorFunctionType operatorFunction( this->operator_, *this->preimageFunction );
+      this->operator_.setPreimageFunction( *this->preimageFunction );
+      if( ! this->operator_.refresh( time ) || ! operatorFunction.refresh( time ) )
+         return false;
+      this->imageFunction = operatorFunction;
+      Solvers::PDE::BoundaryConditionsSetter< ImageFunctionType, BoundaryConditionsType >::apply(
+         this->boundaryConditions, time, this->imageFunction );
+      return true;
+   };
+
+   bool
+   deepRefresh( const RealType& time = 0.0 )
+   {
+      return preimageFunction->deepRefresh( time ) && this->refresh( time );
+   };
+
+   template< typename MeshEntity >
+   __cuda_callable__
+   const RealType&
+   operator()( const MeshEntity& meshEntity, const RealType& time = 0 ) const
+   {
+      return imageFunction[ meshEntity.getIndex() ];
+   }
+
+   __cuda_callable__
+   const RealType&
+   operator[]( const IndexType& index ) const
+   {
+      return imageFunction[ index ];
+   }
+
+protected:
+   Operator& operator_;
+
+   const PreimageFunctionType* preimageFunction;
+
+   ImageFunctionType imageFunction;
+
+   const BoundaryConditionsType& boundaryConditions;
+
+   template< typename, typename >
+   friend class MeshFunctionEvaluator;
 };
 
 /****
  * Specialization for precomputed evaluation and with boundary conditions.
  */
-template< typename Operator,
-          typename Function >
+template< typename Operator, typename Function >
 class OperatorFunction< Operator, Function, void, false, true >
-  : public Domain< Function::getDomainDimension(), Function::getDomainType() >
+: public Domain< Function::getDomainDimension(), Function::getDomainType() >
 {
-   public:
-      
-      typedef Function FunctionType;
-      typedef typename FunctionType::RealType RealType;
-      typedef typename FunctionType::PointType PointType;
-      typedef Operator OperatorType;
-      
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" )
-      {
-         return( this->function.setup( parameters, prefix) &&
-                 this->operator_.setup( parameters, prefix ) );
-      }
-      
-      __cuda_callable__
-      FunctionType& getFunction()
-      {
-         return this->function;
-      }
-      
-      __cuda_callable__
-      const FunctionType& getFunction() const
-      {
-         return this->function;
-      }
-      
-      __cuda_callable__
-      OperatorType& getOperator()
-      {
-         return this->operator_;
-      }
-      
-      __cuda_callable__
-      const OperatorType& getOperator() const
-      {
-         return this->operator_;
-      }
-      
-      __cuda_callable__
-      RealType operator()( const PointType& v,
-                           const RealType& time = 0.0 ) const
-      {
-         return this->operator_( this->function, v, time );
-      }
-      
-   protected:
-      
-      Function function;
-      
-      Operator operator_;
- 
-};
+public:
+   typedef Function FunctionType;
+   typedef typename FunctionType::RealType RealType;
+   typedef typename FunctionType::PointType PointType;
+   typedef Operator OperatorType;
+
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" )
+   {
+      return ( this->function.setup( parameters, prefix ) && this->operator_.setup( parameters, prefix ) );
+   }
+
+   __cuda_callable__
+   FunctionType&
+   getFunction()
+   {
+      return this->function;
+   }
+
+   __cuda_callable__
+   const FunctionType&
+   getFunction() const
+   {
+      return this->function;
+   }
+
+   __cuda_callable__
+   OperatorType&
+   getOperator()
+   {
+      return this->operator_;
+   }
 
-} // namespace Functions
-} // namespace TNL
+   __cuda_callable__
+   const OperatorType&
+   getOperator() const
+   {
+      return this->operator_;
+   }
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& v, const RealType& time = 0.0 ) const
+   {
+      return this->operator_( this->function, v, time );
+   }
+
+protected:
+   Function function;
+
+   Operator operator_;
+};
 
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/TestFunction.h b/src/TNL/Functions/TestFunction.h
index c95bc291e714c90bf1391b2822f327dc1e6ba999..d34055f1f5ac6fccc7b8fed83b6fb024d0f13469 100644
--- a/src/TNL/Functions/TestFunction.h
+++ b/src/TNL/Functions/TestFunction.h
@@ -15,128 +15,134 @@
 namespace TNL {
 namespace Functions {
 
-template< int FunctionDimension,
-          typename Real = double,
-          typename Device = Devices::Host >
+template< int FunctionDimension, typename Real = double, typename Device = Devices::Host >
 class TestFunction : public Domain< FunctionDimension, SpaceDomain >
 {
-   protected:
-
-      enum TestFunctions{ constant,
-                          paraboloid,
-                          expBump,
-                          sinBumps,
-                          sinWave,
-                          cylinder,
-                          flowerpot,
-                          twins,
-                          pseudoSquare,
-                          blob,
-                          vectorNorm,
-                          paraboloidSDF,
-                          sinWaveSDF,
-                          sinBumpsSDF };
-
-      enum TimeDependence { none,
-                            linear,
-                            quadratic,
-                            cosine };
-
-      enum Operators { identity,
-                       heaviside,
-                       smoothHeaviside };
-
-   public:
-
-      enum{ Dimension = FunctionDimension };
-      typedef Real RealType;
-      typedef Containers::StaticVector< Dimension, Real > PointType;
-
-      TestFunction();
-
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" );
-
-      bool setup( const Config::ParameterContainer& parameters,
-                 const String& prefix = "" );
-
-      const TestFunction& operator = ( const TestFunction& function );
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      Real getPartialDerivative( const PointType& vertex,
-                                 const Real& time = 0 ) const;
-
-      __cuda_callable__
-      Real operator()( const PointType& vertex,
-                     const Real& time = 0 ) const
-      {
-         return this->getPartialDerivative< 0, 0, 0 >( vertex, time );
-      }
-
-
-      template< int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      Real getTimeDerivative( const PointType& vertex,
-                              const Real& time = 0 ) const;
-
-      std::ostream& print( std::ostream& str ) const;
-
-      ~TestFunction();
-
-   protected:
-
-      template< typename FunctionType >
-      bool setupFunction( const Config::ParameterContainer& parameters,
-                         const String& prefix = "" );
-      
-      template< typename OperatorType >
-      bool setupOperator( const Config::ParameterContainer& parameters,
-                          const String& prefix = "" );
-
-      template< typename FunctionType >
-      void deleteFunction();
-
-      template< typename OperatorType >
-      void deleteOperator();
-
-      void deleteFunctions();
-
-      template< typename FunctionType >
-      void copyFunction( const void* function );
-
-      template< typename FunctionType >
-      std::ostream& printFunction( std::ostream& str ) const;
-
-      void* function;
-
-      void* operator_;
-
-      TestFunctions functionType;
-      
-      Operators operatorType;
-
-      TimeDependence timeDependence;
-
-      Real timeScale;
+protected:
+   enum TestFunctions
+   {
+      constant,
+      paraboloid,
+      expBump,
+      sinBumps,
+      sinWave,
+      cylinder,
+      flowerpot,
+      twins,
+      pseudoSquare,
+      blob,
+      vectorNorm,
+      paraboloidSDF,
+      sinWaveSDF,
+      sinBumpsSDF
+   };
+
+   enum TimeDependence
+   {
+      none,
+      linear,
+      quadratic,
+      cosine
+   };
+
+   enum Operators
+   {
+      identity,
+      heaviside,
+      smoothHeaviside
+   };
+
+public:
+   enum
+   {
+      Dimension = FunctionDimension
+   };
+   using RealType = Real;
+   using PointType = Containers::StaticVector< Dimension, Real >;
+
+   TestFunction();
+
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" );
+
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
+
+   const TestFunction&
+   operator=( const TestFunction& function );
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   Real
+   getPartialDerivative( const PointType& vertex, const Real& time = 0 ) const;
+
+   __cuda_callable__
+   Real
+   operator()( const PointType& vertex, const Real& time = 0 ) const
+   {
+      return this->getPartialDerivative< 0, 0, 0 >( vertex, time );
+   }
+
+   template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   Real
+   getTimeDerivative( const PointType& vertex, const Real& time = 0 ) const;
+
+   std::ostream&
+   print( std::ostream& str ) const;
+
+   ~TestFunction();
+
+protected:
+   template< typename FunctionType >
+   bool
+   setupFunction( const Config::ParameterContainer& parameters, const String& prefix = "" );
+
+   template< typename OperatorType >
+   bool
+   setupOperator( const Config::ParameterContainer& parameters, const String& prefix = "" );
+
+   template< typename FunctionType >
+   void
+   deleteFunction();
+
+   template< typename OperatorType >
+   void
+   deleteOperator();
+
+   void
+   deleteFunctions();
+
+   template< typename FunctionType >
+   void
+   copyFunction( const void* function );
+
+   template< typename FunctionType >
+   std::ostream&
+   printFunction( std::ostream& str ) const;
+
+   void* function;
+
+   void* operator_;
+
+   TestFunctions functionType;
+
+   Operators operatorType;
+
+   TimeDependence timeDependence;
 
+   Real timeScale;
 };
 
-template< int FunctionDimension,
-          typename Real,
-          typename Device >
-std::ostream& operator << ( std::ostream& str, const TestFunction< FunctionDimension, Real, Device >& f )
+template< int FunctionDimension, typename Real, typename Device >
+std::ostream&
+operator<<( std::ostream& str, const TestFunction< FunctionDimension, Real, Device >& f )
 {
    str << "Test function: ";
    return f.print( str );
 }
 
-} // namespace Functions
-} // namespace TNL
+}  // namespace Functions
+}  // namespace TNL
 
 #include <TNL/Functions/TestFunction_impl.h>
-
diff --git a/src/TNL/Functions/TestFunction_impl.h b/src/TNL/Functions/TestFunction_impl.h
index 0a7f4d2db354d2f6d21d92ca18ceefc9c05ad3a8..c646c8a65307383c4e17373678fbb03e78724013 100644
--- a/src/TNL/Functions/TestFunction_impl.h
+++ b/src/TNL/Functions/TestFunction_impl.h
@@ -43,153 +43,125 @@
 namespace TNL {
 namespace Functions {
 
-template< int FunctionDimension,
-          typename Real,
-          typename Device >
-TestFunction< FunctionDimension, Real, Device >::
-TestFunction()
-: function( 0 ),
-  operator_( 0 ),
-  timeDependence( none ),
-  timeScale( 1.0 )
-{
-}
+template< int FunctionDimension, typename Real, typename Device >
+TestFunction< FunctionDimension, Real, Device >::TestFunction()
+: function( nullptr ), operator_( nullptr ), timeDependence( none ), timeScale( 1.0 )
+{}
 
-template< int FunctionDimension,
-          typename Real,
-          typename Device >
+template< int FunctionDimension, typename Real, typename Device >
 void
-TestFunction< FunctionDimension, Real, Device >::
-configSetup( Config::ConfigDescription& config,
-             const String& prefix )
+TestFunction< FunctionDimension, Real, Device >::configSetup( Config::ConfigDescription& config, const String& prefix )
 {
    config.addRequiredEntry< String >( prefix + "test-function", "Testing function." );
-      config.addEntryEnum( "constant" );
-      config.addEntryEnum( "paraboloid" );
-      config.addEntryEnum( "exp-bump" );
-      config.addEntryEnum( "sin-wave" );
-      config.addEntryEnum( "sin-bumps" );
-      config.addEntryEnum( "cylinder" );
-      config.addEntryEnum( "flowerpot" );
-      config.addEntryEnum( "twins" );
-      config.addEntryEnum( "pseudoSquare" );
-      config.addEntryEnum( "blob" );
-      config.addEntryEnum( "paraboloid-sdf" );      
-      config.addEntryEnum( "sin-wave-sdf" );
-      config.addEntryEnum( "sin-bumps-sdf" );
-      config.addEntryEnum( "heaviside-of-vector-norm" );
-      config.addEntryEnum( "smooth-heaviside-of-vector-norm" );
-
-   config.addEntry     < double >( prefix + "constant", "Value of the constant function.", 0.0 );
-   config.addEntry     < double >( prefix + "wave-length", "Wave length of the sine based test functions.", 1.0 );
-   config.addEntry     < double >( prefix + "wave-length-x", "Wave length of the sine based test functions.", 1.0 );
-   config.addEntry     < double >( prefix + "wave-length-y", "Wave length of the sine based test functions.", 1.0 );
-   config.addEntry     < double >( prefix + "wave-length-z", "Wave length of the sine based test functions.", 1.0 );
-   config.addEntry     < double >( prefix + "phase", "Phase of the sine based test functions.", 0.0 );
-   config.addEntry     < double >( prefix + "phase-x", "Phase of the sine based test functions.", 0.0 );
-   config.addEntry     < double >( prefix + "phase-y", "Phase of the sine based test functions.", 0.0 );
-   config.addEntry     < double >( prefix + "phase-z", "Phase of the sine based test functions.", 0.0 );
-   config.addEntry     < double >( prefix + "amplitude", "Amplitude length of the sine based test functions.", 1.0 );
-   config.addEntry     < double >( prefix + "waves-number", "Cut-off for the sine based test functions.", 0.0 );
-   config.addEntry     < double >( prefix + "waves-number-x", "Cut-off for the sine based test functions.", 0.0 );
-   config.addEntry     < double >( prefix + "waves-number-y", "Cut-off for the sine based test functions.", 0.0 );
-   config.addEntry     < double >( prefix + "waves-number-z", "Cut-off for the sine based test functions.", 0.0 );
-   config.addEntry     < double >( prefix + "sigma", "Sigma for the exp based test functions.", 1.0 );
-	config.addEntry     < double >( prefix + "radius", "Radius for paraboloids.", 1.0 );
-   config.addEntry     < double >( prefix + "coefficient", "Coefficient for paraboloids.", 1.0 );
-   config.addEntry     < double >( prefix + "x-center", "x-center for paraboloids.", 0.0 );
-   config.addEntry     < double >( prefix + "y-center", "y-center for paraboloids.", 0.0 );
-   config.addEntry     < double >( prefix + "z-center", "z-center for paraboloids.", 0.0 );
-   config.addEntry     < double >( prefix + "diameter", "Diameter for the cylinder, flowerpot test functions.", 1.0 );
-   config.addEntry     < double >( prefix + "height", "Height of zero-level-set function for the blob, pseudosquare test functions.", 1.0 );
+   config.addEntryEnum( "constant" );
+   config.addEntryEnum( "paraboloid" );
+   config.addEntryEnum( "exp-bump" );
+   config.addEntryEnum( "sin-wave" );
+   config.addEntryEnum( "sin-bumps" );
+   config.addEntryEnum( "cylinder" );
+   config.addEntryEnum( "flowerpot" );
+   config.addEntryEnum( "twins" );
+   config.addEntryEnum( "pseudoSquare" );
+   config.addEntryEnum( "blob" );
+   config.addEntryEnum( "paraboloid-sdf" );
+   config.addEntryEnum( "sin-wave-sdf" );
+   config.addEntryEnum( "sin-bumps-sdf" );
+   config.addEntryEnum( "heaviside-of-vector-norm" );
+   config.addEntryEnum( "smooth-heaviside-of-vector-norm" );
+
+   config.addEntry< double >( prefix + "constant", "Value of the constant function.", 0.0 );
+   config.addEntry< double >( prefix + "wave-length", "Wave length of the sine based test functions.", 1.0 );
+   config.addEntry< double >( prefix + "wave-length-x", "Wave length of the sine based test functions.", 1.0 );
+   config.addEntry< double >( prefix + "wave-length-y", "Wave length of the sine based test functions.", 1.0 );
+   config.addEntry< double >( prefix + "wave-length-z", "Wave length of the sine based test functions.", 1.0 );
+   config.addEntry< double >( prefix + "phase", "Phase of the sine based test functions.", 0.0 );
+   config.addEntry< double >( prefix + "phase-x", "Phase of the sine based test functions.", 0.0 );
+   config.addEntry< double >( prefix + "phase-y", "Phase of the sine based test functions.", 0.0 );
+   config.addEntry< double >( prefix + "phase-z", "Phase of the sine based test functions.", 0.0 );
+   config.addEntry< double >( prefix + "amplitude", "Amplitude length of the sine based test functions.", 1.0 );
+   config.addEntry< double >( prefix + "waves-number", "Cut-off for the sine based test functions.", 0.0 );
+   config.addEntry< double >( prefix + "waves-number-x", "Cut-off for the sine based test functions.", 0.0 );
+   config.addEntry< double >( prefix + "waves-number-y", "Cut-off for the sine based test functions.", 0.0 );
+   config.addEntry< double >( prefix + "waves-number-z", "Cut-off for the sine based test functions.", 0.0 );
+   config.addEntry< double >( prefix + "sigma", "Sigma for the exp based test functions.", 1.0 );
+   config.addEntry< double >( prefix + "radius", "Radius for paraboloids.", 1.0 );
+   config.addEntry< double >( prefix + "coefficient", "Coefficient for paraboloids.", 1.0 );
+   config.addEntry< double >( prefix + "x-center", "x-center for paraboloids.", 0.0 );
+   config.addEntry< double >( prefix + "y-center", "y-center for paraboloids.", 0.0 );
+   config.addEntry< double >( prefix + "z-center", "z-center for paraboloids.", 0.0 );
+   config.addEntry< double >( prefix + "diameter", "Diameter for the cylinder, flowerpot test functions.", 1.0 );
+   config.addEntry< double >(
+      prefix + "height", "Height of zero-level-set function for the blob, pseudosquare test functions.", 1.0 );
    Analytic::VectorNorm< 3, double >::configSetup( config, "vector-norm-" );
    TNL::Operators::Analytic::Heaviside< 3, double >::configSetup( config, "heaviside-" );
    TNL::Operators::Analytic::SmoothHeaviside< 3, double >::configSetup( config, "smooth-heaviside-" );
-   config.addEntry     < String >( prefix + "time-dependence", "Time dependence of the test function.", "none" );
-      config.addEntryEnum( "none" );
-      config.addEntryEnum( "linear" );
-      config.addEntryEnum( "quadratic" );
-      config.addEntryEnum( "cosine" );
-   config.addEntry     < double >( prefix + "time-scale", "Time scaling for the time dependency of the test function.", 1.0 );
-
+   config.addEntry< String >( prefix + "time-dependence", "Time dependence of the test function.", "none" );
+   config.addEntryEnum( "none" );
+   config.addEntryEnum( "linear" );
+   config.addEntryEnum( "quadratic" );
+   config.addEntryEnum( "cosine" );
+   config.addEntry< double >( prefix + "time-scale", "Time scaling for the time dependency of the test function.", 1.0 );
 }
 
-template< int FunctionDimension,
-          typename Real,
-          typename Device >
-   template< typename FunctionType >
+template< int FunctionDimension, typename Real, typename Device >
+template< typename FunctionType >
 bool
-TestFunction< FunctionDimension, Real, Device >::
-setupFunction( const Config::ParameterContainer& parameters,
-               const String& prefix )
+TestFunction< FunctionDimension, Real, Device >::setupFunction( const Config::ParameterContainer& parameters,
+                                                                const String& prefix )
 {
    FunctionType* auxFunction = new FunctionType;
-   if( ! auxFunction->setup( parameters, prefix ) )
-   {
+   if( ! auxFunction->setup( parameters, prefix ) ) {
       delete auxFunction;
       return false;
    }
 
-   if( std::is_same< Device, Devices::Host >::value )
-   {
+   if( std::is_same< Device, Devices::Host >::value ) {
       this->function = auxFunction;
    }
-   if( std::is_same< Device, Devices::Cuda >::value )
-   {
+   if( std::is_same< Device, Devices::Cuda >::value ) {
       this->function = Allocators::Cuda< FunctionType >{}.allocate( 1 );
-      Algorithms::MultiDeviceMemoryOperations< Devices::Cuda, Devices::Host >::copy( (FunctionType*) this->function, (FunctionType*) auxFunction, 1 );
+      Algorithms::MultiDeviceMemoryOperations< Devices::Cuda, Devices::Host >::copy(
+         (FunctionType*) this->function, (FunctionType*) auxFunction, 1 );
       delete auxFunction;
       TNL_CHECK_CUDA_DEVICE;
    }
    return true;
 }
 
-template< int FunctionDimension,
-          typename Real,
-          typename Device >
-   template< typename OperatorType >
+template< int FunctionDimension, typename Real, typename Device >
+template< typename OperatorType >
 bool
-TestFunction< FunctionDimension, Real, Device >::
-setupOperator( const Config::ParameterContainer& parameters,
-               const String& prefix )
+TestFunction< FunctionDimension, Real, Device >::setupOperator( const Config::ParameterContainer& parameters,
+                                                                const String& prefix )
 {
    OperatorType* auxOperator = new OperatorType;
-   if( ! auxOperator->setup( parameters, prefix ) )
-   {
+   if( ! auxOperator->setup( parameters, prefix ) ) {
       delete auxOperator;
       return false;
    }
 
-   if( std::is_same< Device, Devices::Host >::value )
-   {
+   if( std::is_same< Device, Devices::Host >::value ) {
       this->operator_ = auxOperator;
    }
-   if( std::is_same< Device, Devices::Cuda >::value )
-   {
+   if( std::is_same< Device, Devices::Cuda >::value ) {
       this->operator_ = Allocators::Cuda< OperatorType >{}.allocate( 1 );
-      Algorithms::MultiDeviceMemoryOperations< Devices::Cuda, Devices::Host >::copy( (OperatorType*) this->operator_, (OperatorType*) auxOperator, 1 );
+      Algorithms::MultiDeviceMemoryOperations< Devices::Cuda, Devices::Host >::copy(
+         (OperatorType*) this->operator_, (OperatorType*) auxOperator, 1 );
       delete auxOperator;
       TNL_CHECK_CUDA_DEVICE;
    }
    return true;
 }
 
-template< int FunctionDimension,
-          typename Real,
-          typename Device >
+template< int FunctionDimension, typename Real, typename Device >
 bool
-TestFunction< FunctionDimension, Real, Device >::
-setup( const Config::ParameterContainer& parameters,
-       const String& prefix )
+TestFunction< FunctionDimension, Real, Device >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    using namespace TNL::Functions::Analytic;
    using namespace TNL::Operators::Analytic;
    std::cout << "Test function setup ... " << std::endl;
-   const String& timeDependence =
-            parameters.getParameter< String >(
-                     prefix +
-                     "time-dependence" );
-  std::cout << "Time dependence ... " << timeDependence << std::endl;
+   const String& timeDependence = parameters.getParameter< String >( prefix + "time-dependence" );
+   std::cout << "Time dependence ... " << timeDependence << std::endl;
    if( timeDependence == "none" )
       this->timeDependence = none;
    if( timeDependence == "linear" )
@@ -203,174 +175,140 @@ setup( const Config::ParameterContainer& parameters,
 
    const String& testFunction = parameters.getParameter< String >( prefix + "test-function" );
    std::cout << "Test function ... " << testFunction << std::endl;
-   if( testFunction == "constant" )
-   {
-      typedef Constant< Dimension, Real > FunctionType;
-      typedef Identity< Dimension, Real > OperatorType;
+   if( testFunction == "constant" ) {
+      using FunctionType = Constant< Dimension, Real >;
+      using OperatorType = Identity< Dimension, Real >;
       functionType = constant;
       operatorType = identity;
-      return ( setupFunction< FunctionType >( parameters, prefix ) && 
-               setupOperator< OperatorType >( parameters, prefix ) );
+      return ( setupFunction< FunctionType >( parameters, prefix ) && setupOperator< OperatorType >( parameters, prefix ) );
    }
-   if( testFunction == "paraboloid" )
-   {
-      typedef Paraboloid< Dimension, Real > FunctionType;
-      typedef Identity< Dimension, Real > OperatorType;
+   if( testFunction == "paraboloid" ) {
+      using FunctionType = Paraboloid< Dimension, Real >;
+      using OperatorType = Identity< Dimension, Real >;
       functionType = paraboloid;
       operatorType = identity;
-      return ( setupFunction< FunctionType >( parameters, prefix ) && 
-               setupOperator< OperatorType >( parameters, prefix ) );
-   }   
-   if( testFunction == "exp-bump" )
-   {
-      typedef ExpBump< Dimension, Real > FunctionType;
-      typedef Identity< Dimension, Real > OperatorType;
+      return ( setupFunction< FunctionType >( parameters, prefix ) && setupOperator< OperatorType >( parameters, prefix ) );
+   }
+   if( testFunction == "exp-bump" ) {
+      using FunctionType = ExpBump< Dimension, Real >;
+      using OperatorType = Identity< Dimension, Real >;
       functionType = expBump;
       operatorType = identity;
-      return ( setupFunction< FunctionType >( parameters, prefix ) && 
-               setupOperator< OperatorType >( parameters, prefix ) );
+      return ( setupFunction< FunctionType >( parameters, prefix ) && setupOperator< OperatorType >( parameters, prefix ) );
    }
-   if( testFunction == "sin-bumps" )
-   {
-      typedef SinBumps< Dimension, Real > FunctionType;
-      typedef Identity< Dimension, Real > OperatorType;
+   if( testFunction == "sin-bumps" ) {
+      using FunctionType = SinBumps< Dimension, Real >;
+      using OperatorType = Identity< Dimension, Real >;
       functionType = sinBumps;
       operatorType = identity;
-      return ( setupFunction< FunctionType >( parameters, prefix ) && 
-               setupOperator< OperatorType >( parameters, prefix ) );
+      return ( setupFunction< FunctionType >( parameters, prefix ) && setupOperator< OperatorType >( parameters, prefix ) );
    }
-   if( testFunction == "sin-wave" )
-   {
-      typedef SinWave< Dimension, Real > FunctionType;
-      typedef Identity< Dimension, Real > OperatorType;
+   if( testFunction == "sin-wave" ) {
+      using FunctionType = SinWave< Dimension, Real >;
+      using OperatorType = Identity< Dimension, Real >;
       functionType = sinWave;
       operatorType = identity;
-      return ( setupFunction< FunctionType >( parameters, prefix ) && 
-               setupOperator< OperatorType >( parameters, prefix ) );
+      return ( setupFunction< FunctionType >( parameters, prefix ) && setupOperator< OperatorType >( parameters, prefix ) );
    }
-   if( testFunction == "cylinder" )
-   {
-      typedef Cylinder< Dimension, Real > FunctionType;
-      typedef Identity< Dimension, Real > OperatorType;
+   if( testFunction == "cylinder" ) {
+      using FunctionType = Cylinder< Dimension, Real >;
+      using OperatorType = Identity< Dimension, Real >;
       functionType = cylinder;
       operatorType = identity;
-      return ( setupFunction< FunctionType >( parameters, prefix ) && 
-               setupOperator< OperatorType >( parameters, prefix ) );
+      return ( setupFunction< FunctionType >( parameters, prefix ) && setupOperator< OperatorType >( parameters, prefix ) );
    }
-   if( testFunction == "flowerpot" )
-   {
-      typedef Flowerpot< Dimension, Real > FunctionType;
-      typedef Identity< Dimension, Real > OperatorType;
+   if( testFunction == "flowerpot" ) {
+      using FunctionType = Flowerpot< Dimension, Real >;
+      using OperatorType = Identity< Dimension, Real >;
       functionType = flowerpot;
       operatorType = identity;
-      return ( setupFunction< FunctionType >( parameters, prefix ) && 
-               setupOperator< OperatorType >( parameters, prefix ) );
+      return ( setupFunction< FunctionType >( parameters, prefix ) && setupOperator< OperatorType >( parameters, prefix ) );
    }
-   if( testFunction == "twins" )
-   {
-      typedef Twins< Dimension, Real > FunctionType;
-      typedef Identity< Dimension, Real > OperatorType;
+   if( testFunction == "twins" ) {
+      using FunctionType = Twins< Dimension, Real >;
+      using OperatorType = Identity< Dimension, Real >;
       functionType = twins;
       operatorType = identity;
-      return ( setupFunction< FunctionType >( parameters, prefix ) && 
-               setupOperator< OperatorType >( parameters, prefix ) );
+      return ( setupFunction< FunctionType >( parameters, prefix ) && setupOperator< OperatorType >( parameters, prefix ) );
    }
-   if( testFunction == "pseudoSquare" )
-   {
-      typedef PseudoSquare< Dimension, Real > FunctionType;
-      typedef Identity< Dimension, Real > OperatorType;
+   if( testFunction == "pseudoSquare" ) {
+      using FunctionType = PseudoSquare< Dimension, Real >;
+      using OperatorType = Identity< Dimension, Real >;
       functionType = pseudoSquare;
       operatorType = identity;
-      return ( setupFunction< FunctionType >( parameters, prefix ) && 
-               setupOperator< OperatorType >( parameters, prefix ) );
+      return ( setupFunction< FunctionType >( parameters, prefix ) && setupOperator< OperatorType >( parameters, prefix ) );
    }
-   if( testFunction == "blob" )
-   {
-      typedef Blob< Dimension, Real > FunctionType;
-      typedef Identity< Dimension, Real > OperatorType;
+   if( testFunction == "blob" ) {
+      using FunctionType = Blob< Dimension, Real >;
+      using OperatorType = Identity< Dimension, Real >;
       functionType = blob;
       operatorType = identity;
-      return ( setupFunction< FunctionType >( parameters, prefix ) && 
-               setupOperator< OperatorType >( parameters, prefix ) );
+      return ( setupFunction< FunctionType >( parameters, prefix ) && setupOperator< OperatorType >( parameters, prefix ) );
    }
-   if( testFunction == "paraboloid-sdf" )
-   {
-      typedef ParaboloidSDF< Dimension, Real > FunctionType;
-      typedef Identity< Dimension, Real > OperatorType;
+   if( testFunction == "paraboloid-sdf" ) {
+      using FunctionType = ParaboloidSDF< Dimension, Real >;
+      using OperatorType = Identity< Dimension, Real >;
       functionType = paraboloidSDF;
       operatorType = identity;
-      return ( setupFunction< FunctionType >( parameters, prefix ) && 
-               setupOperator< OperatorType >( parameters, prefix ) );
-   }   
-   if( testFunction == "sin-bumps-sdf" )
-   {
-      typedef SinBumpsSDF< Dimension, Real > FunctionType;
-      typedef Identity< Dimension, Real > OperatorType;
+      return ( setupFunction< FunctionType >( parameters, prefix ) && setupOperator< OperatorType >( parameters, prefix ) );
+   }
+   if( testFunction == "sin-bumps-sdf" ) {
+      using FunctionType = SinBumpsSDF< Dimension, Real >;
+      using OperatorType = Identity< Dimension, Real >;
       functionType = sinBumpsSDF;
       operatorType = identity;
-      return ( setupFunction< FunctionType >( parameters, prefix ) && 
-               setupOperator< OperatorType >( parameters, prefix ) );
-   }   
-   if( testFunction == "sin-wave-sdf" )
-   {
-      typedef SinWaveSDF< Dimension, Real > FunctionType;
-      typedef Identity< Dimension, Real > OperatorType;
+      return ( setupFunction< FunctionType >( parameters, prefix ) && setupOperator< OperatorType >( parameters, prefix ) );
+   }
+   if( testFunction == "sin-wave-sdf" ) {
+      using FunctionType = SinWaveSDF< Dimension, Real >;
+      using OperatorType = Identity< Dimension, Real >;
       functionType = sinWaveSDF;
       operatorType = identity;
-      return ( setupFunction< FunctionType >( parameters, prefix ) && 
-               setupOperator< OperatorType >( parameters, prefix ) );
+      return ( setupFunction< FunctionType >( parameters, prefix ) && setupOperator< OperatorType >( parameters, prefix ) );
    }
-   if( testFunction == "vector-norm" )
-   {
-      typedef VectorNorm< Dimension, Real > FunctionType;
-      typedef Identity< Dimension, Real > OperatorType;
+   if( testFunction == "vector-norm" ) {
+      using FunctionType = VectorNorm< Dimension, Real >;
+      using OperatorType = Identity< Dimension, Real >;
       functionType = vectorNorm;
       operatorType = identity;
-      return ( setupFunction< FunctionType >( parameters, prefix ) && 
-               setupOperator< OperatorType >( parameters, prefix ) );
+      return ( setupFunction< FunctionType >( parameters, prefix ) && setupOperator< OperatorType >( parameters, prefix ) );
    }
-   if( testFunction == "heaviside-of-vector-norm" )
-   {
-      typedef VectorNorm< Dimension, Real > FunctionType;
-      typedef Heaviside< Dimension, Real > OperatorType;
+   if( testFunction == "heaviside-of-vector-norm" ) {
+      using FunctionType = VectorNorm< Dimension, Real >;
+      using OperatorType = Heaviside< Dimension, Real >;
       functionType = vectorNorm;
       operatorType = heaviside;
-      return ( setupFunction< FunctionType >( parameters, prefix + "vector-norm-" ) && 
-               setupOperator< OperatorType >( parameters, prefix + "heaviside-" ) );
+      return ( setupFunction< FunctionType >( parameters, prefix + "vector-norm-" )
+               && setupOperator< OperatorType >( parameters, prefix + "heaviside-" ) );
    }
-   if( testFunction == "smooth-heaviside-of-vector-norm" )
-   {
-      typedef VectorNorm< Dimension, Real > FunctionType;
-      typedef SmoothHeaviside< Dimension, Real > OperatorType;
+   if( testFunction == "smooth-heaviside-of-vector-norm" ) {
+      using FunctionType = VectorNorm< Dimension, Real >;
+      using OperatorType = SmoothHeaviside< Dimension, Real >;
       functionType = vectorNorm;
       operatorType = smoothHeaviside;
-      return ( setupFunction< FunctionType >( parameters, prefix + "vector-norm-" ) && 
-               setupOperator< OperatorType >( parameters, prefix + "smooth-heaviside-" ) );
+      return ( setupFunction< FunctionType >( parameters, prefix + "vector-norm-" )
+               && setupOperator< OperatorType >( parameters, prefix + "smooth-heaviside-" ) );
    }
    std::cerr << "Unknown function " << testFunction << std::endl;
    return false;
 }
 
-template< int FunctionDimension,
-          typename Real,
-          typename Device >
+template< int FunctionDimension, typename Real, typename Device >
 const TestFunction< FunctionDimension, Real, Device >&
-TestFunction< FunctionDimension, Real, Device >::
-operator = ( const TestFunction& function )
+TestFunction< FunctionDimension, Real, Device >::operator=( const TestFunction& function )
 {
    /*****
     * TODO: if the function is on the device we cannot do the following
     */
    abort();
    using namespace TNL::Functions::Analytic;
-   this->functionType   = function.functionType;
+   this->functionType = function.functionType;
    this->timeDependence = function.timeDependence;
-   this->timeScale      = function.timeScale;
+   this->timeScale = function.timeScale;
 
    this->deleteFunctions();
 
-   switch( this->functionType )
-   {
+   switch( this->functionType ) {
       case constant:
          this->copyFunction< Constant< FunctionDimension, Real > >( function.function );
          break;
@@ -414,24 +352,17 @@ operator = ( const TestFunction& function )
    }
 }
 
-template< int FunctionDimension,
-          typename Real,
-          typename Device >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder >
+template< int FunctionDimension, typename Real, typename Device >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-TestFunction< FunctionDimension, Real, Device >::
-getPartialDerivative( const PointType& vertex,
-          const Real& time ) const
+TestFunction< FunctionDimension, Real, Device >::getPartialDerivative( const PointType& vertex, const Real& time ) const
 {
    TNL_ASSERT_TRUE( this->function, "The test function was not set properly." );
    using namespace TNL::Functions::Analytic;
    using namespace TNL::Operators::Analytic;
    Real scale( 1.0 );
-   switch( this->timeDependence )
-   {
+   switch( this->timeDependence ) {
       case none:
          break;
       case linear:
@@ -446,176 +377,198 @@ getPartialDerivative( const PointType& vertex,
          scale = ::cos( this->timeScale * time );
          break;
    }
-   switch( functionType )
-   {
+   switch( functionType ) {
       case constant:
-      {
-         typedef Constant< Dimension, Real > FunctionType;
-         typedef Identity< Dimension, Real > OperatorType;
+         {
+            using FunctionType = Constant< Dimension, Real >;
+            using OperatorType = Identity< Dimension, Real >;
 
-         return scale * ( ( OperatorType* ) this->operator_ )->
-                   template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >( * ( FunctionType*) this->function, vertex, time );
-      }
+            return scale
+                 * ( (OperatorType*) this->operator_ )
+                      ->template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >(
+                         *(FunctionType*) this->function, vertex, time );
+         }
       case paraboloid:
-      {
-         typedef Paraboloid< Dimension, Real > FunctionType;
-         if( operatorType == identity )
          {
-            typedef Identity< Dimension, Real > OperatorType;
-
-            return scale * ( ( OperatorType* ) this->operator_ )->
-                      template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >( * ( FunctionType*) this->function, vertex, time );
+            using FunctionType = Paraboloid< Dimension, Real >;
+            if( operatorType == identity ) {
+               using OperatorType = Identity< Dimension, Real >;
+
+               return scale
+                    * ( (OperatorType*) this->operator_ )
+                         ->template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >(
+                            *(FunctionType*) this->function, vertex, time );
+            }
+            if( operatorType == heaviside ) {
+               using OperatorType = Heaviside< Dimension, Real >;
+
+               return scale
+                    * ( (OperatorType*) this->operator_ )
+                         ->template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >(
+                            *(FunctionType*) this->function, vertex, time );
+            }
+            if( operatorType == smoothHeaviside ) {
+               using OperatorType = SmoothHeaviside< Dimension, Real >;
+
+               return scale
+                    * ( (OperatorType*) this->operator_ )
+                         ->template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >(
+                            *(FunctionType*) this->function, vertex, time );
+            }
          }
-         if( operatorType == heaviside )
+      case expBump:
          {
-            typedef Heaviside< Dimension, Real > OperatorType;
+            using FunctionType = ExpBump< Dimension, Real >;
+            using OperatorType = Identity< Dimension, Real >;
 
-            return scale * ( ( OperatorType* ) this->operator_ )->
-                      template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >( * ( FunctionType*) this->function, vertex, time );
+            return scale
+                 * ( (OperatorType*) this->operator_ )
+                      ->template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >(
+                         *(FunctionType*) this->function, vertex, time );
          }
-         if( operatorType == smoothHeaviside )
+      case sinBumps:
          {
-            typedef SmoothHeaviside< Dimension, Real > OperatorType;
+            using FunctionType = SinBumps< Dimension, Real >;
+            using OperatorType = Identity< Dimension, Real >;
 
-            return scale * ( ( OperatorType* ) this->operator_ )->
-                      template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >( * ( FunctionType*) this->function, vertex, time );
+            return scale
+                 * ( (OperatorType*) this->operator_ )
+                      ->template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >(
+                         *(FunctionType*) this->function, vertex, time );
          }
-      }
-      case expBump:
-      {
-         typedef ExpBump< Dimension, Real > FunctionType;
-         typedef Identity< Dimension, Real > OperatorType;
-         
-         return scale * ( ( OperatorType* ) this->operator_ )->
-                   template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >( * ( FunctionType*) this->function, vertex, time );
-      }
-      case sinBumps:
-      {
-         typedef SinBumps< Dimension, Real > FunctionType;
-         typedef Identity< Dimension, Real > OperatorType;
-         
-         return scale * ( ( OperatorType* ) this->operator_ )->
-                   template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >( * ( FunctionType*) this->function, vertex, time );
-      }
       case sinWave:
-      {
-         typedef SinWave< Dimension, Real > FunctionType;
-         typedef Identity< Dimension, Real > OperatorType;
-         
-         return scale * ( ( OperatorType* ) this->operator_ )->
-                   template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >( * ( FunctionType*) this->function, vertex, time );
-      }
+         {
+            using FunctionType = SinWave< Dimension, Real >;
+            using OperatorType = Identity< Dimension, Real >;
+
+            return scale
+                 * ( (OperatorType*) this->operator_ )
+                      ->template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >(
+                         *(FunctionType*) this->function, vertex, time );
+         }
       case cylinder:
-      {
-         typedef Cylinder< Dimension, Real > FunctionType;
-         typedef Identity< Dimension, Real > OperatorType;
-         
-         return scale * ( ( OperatorType* ) this->operator_ )->
-                   template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >( * ( FunctionType*) this->function, vertex, time );
-      }
+         {
+            using FunctionType = Cylinder< Dimension, Real >;
+            using OperatorType = Identity< Dimension, Real >;
+
+            return scale
+                 * ( (OperatorType*) this->operator_ )
+                      ->template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >(
+                         *(FunctionType*) this->function, vertex, time );
+         }
       case flowerpot:
-      {
-         typedef Flowerpot< Dimension, Real > FunctionType;
-         typedef Identity< Dimension, Real > OperatorType;
-         
-         return scale * ( ( OperatorType* ) this->operator_ )->
-                   template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >( * ( FunctionType*) this->function, vertex, time );
-      }
+         {
+            using FunctionType = Flowerpot< Dimension, Real >;
+            using OperatorType = Identity< Dimension, Real >;
+
+            return scale
+                 * ( (OperatorType*) this->operator_ )
+                      ->template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >(
+                         *(FunctionType*) this->function, vertex, time );
+         }
       case twins:
-      {
-         typedef Twins< Dimension, Real > FunctionType;
-         typedef Identity< Dimension, Real > OperatorType;
-         
-         return scale * ( ( OperatorType* ) this->operator_ )->
-                   template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >( * ( FunctionType*) this->function, vertex, time );
-      }
-      case pseudoSquare:
-      {
-         typedef PseudoSquare< Dimension, Real > FunctionType;
-         typedef Identity< Dimension, Real > OperatorType;
-         
-         return scale * ( ( OperatorType* ) this->operator_ )->
-                   template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >( * ( FunctionType*) this->function, vertex, time );
-      }
-      case blob:
-      {
-         typedef Blob< Dimension, Real > FunctionType;
-         typedef Identity< Dimension, Real > OperatorType;
-         
-         return scale * ( ( OperatorType* ) this->operator_ )->
-                   template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >( * ( FunctionType*) this->function, vertex, time );
-      }
-      case vectorNorm:
-      {
-         typedef VectorNorm< Dimension, Real > FunctionType;
-         if( operatorType == identity )
          {
-            typedef Identity< Dimension, Real > OperatorType;
+            using FunctionType = Twins< Dimension, Real >;
+            using OperatorType = Identity< Dimension, Real >;
 
-            return scale * ( ( OperatorType* ) this->operator_ )->
-                      template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >( * ( FunctionType*) this->function, vertex, time );
+            return scale
+                 * ( (OperatorType*) this->operator_ )
+                      ->template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >(
+                         *(FunctionType*) this->function, vertex, time );
          }
-         if( operatorType == heaviside )
+      case pseudoSquare:
          {
-            typedef Heaviside< Dimension, Real > OperatorType;
+            using FunctionType = PseudoSquare< Dimension, Real >;
+            using OperatorType = Identity< Dimension, Real >;
 
-            return scale * ( ( OperatorType* ) this->operator_ )->
-                      template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >( * ( FunctionType*) this->function, vertex, time );
+            return scale
+                 * ( (OperatorType*) this->operator_ )
+                      ->template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >(
+                         *(FunctionType*) this->function, vertex, time );
          }
-         if( operatorType == smoothHeaviside )
+      case blob:
          {
-            typedef SmoothHeaviside< Dimension, Real > OperatorType;
+            using FunctionType = Blob< Dimension, Real >;
+            using OperatorType = Identity< Dimension, Real >;
 
-            return scale * ( ( OperatorType* ) this->operator_ )->
-                      template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >( * ( FunctionType*) this->function, vertex, time );
+            return scale
+                 * ( (OperatorType*) this->operator_ )
+                      ->template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >(
+                         *(FunctionType*) this->function, vertex, time );
+         }
+      case vectorNorm:
+         {
+            using FunctionType = VectorNorm< Dimension, Real >;
+            if( operatorType == identity ) {
+               using OperatorType = Identity< Dimension, Real >;
+
+               return scale
+                    * ( (OperatorType*) this->operator_ )
+                         ->template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >(
+                            *(FunctionType*) this->function, vertex, time );
+            }
+            if( operatorType == heaviside ) {
+               using OperatorType = Heaviside< Dimension, Real >;
+
+               return scale
+                    * ( (OperatorType*) this->operator_ )
+                         ->template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >(
+                            *(FunctionType*) this->function, vertex, time );
+            }
+            if( operatorType == smoothHeaviside ) {
+               using OperatorType = SmoothHeaviside< Dimension, Real >;
+
+               return scale
+                    * ( (OperatorType*) this->operator_ )
+                         ->template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >(
+                            *(FunctionType*) this->function, vertex, time );
+            }
          }
-      }      
       case sinBumpsSDF:
-      {
-         typedef SinBumpsSDF< Dimension, Real > FunctionType;
-         typedef Identity< Dimension, Real > OperatorType;
-                  
-         return scale * ( ( OperatorType* ) this->operator_ )->
-                   template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >( * ( FunctionType*) this->function, vertex, time );
-      }
+         {
+            using FunctionType = SinBumpsSDF< Dimension, Real >;
+            using OperatorType = Identity< Dimension, Real >;
+
+            return scale
+                 * ( (OperatorType*) this->operator_ )
+                      ->template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >(
+                         *(FunctionType*) this->function, vertex, time );
+         }
       case sinWaveSDF:
-      {
-         typedef SinWaveSDF< Dimension, Real > FunctionType;
-         typedef Identity< Dimension, Real > OperatorType;
-         
-         return scale * ( ( OperatorType* ) this->operator_ )->
-                   template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >( * ( FunctionType*) this->function, vertex, time );
-      }
+         {
+            using FunctionType = SinWaveSDF< Dimension, Real >;
+            using OperatorType = Identity< Dimension, Real >;
+
+            return scale
+                 * ( (OperatorType*) this->operator_ )
+                      ->template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >(
+                         *(FunctionType*) this->function, vertex, time );
+         }
       case paraboloidSDF:
-      {
-         typedef ParaboloidSDF< Dimension, Real > FunctionType;
-         typedef Identity< Dimension, Real > OperatorType;
-         
-         return scale * ( ( OperatorType* ) this->operator_ )->
-                   template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >( * ( FunctionType*) this->function, vertex, time );
-      }
-      
+         {
+            using FunctionType = ParaboloidSDF< Dimension, Real >;
+            using OperatorType = Identity< Dimension, Real >;
+
+            return scale
+                 * ( (OperatorType*) this->operator_ )
+                      ->template getPartialDerivative< FunctionType, XDiffOrder, YDiffOrder, ZDiffOrder >(
+                         *(FunctionType*) this->function, vertex, time );
+         }
+
       default:
          return 0.0;
    }
 }
 
-template< int FunctionDimension,
-          typename Real,
-          typename Device >
-   template< int XDiffOrder,
-             int YDiffOrder,
-             int ZDiffOrder >
+template< int FunctionDimension, typename Real, typename Device >
+template< int XDiffOrder, int YDiffOrder, int ZDiffOrder >
 __cuda_callable__
 Real
-TestFunction< FunctionDimension, Real, Device >::
-getTimeDerivative( const PointType& vertex,
-                   const Real& time ) const
+TestFunction< FunctionDimension, Real, Device >::getTimeDerivative( const PointType& vertex, const Real& time ) const
 {
    using namespace TNL::Functions::Analytic;
    Real scale( 0.0 );
-   switch( timeDependence )
-   {
+   switch( timeDependence ) {
       case none:
          break;
       case linear:
@@ -628,291 +581,277 @@ getTimeDerivative( const PointType& vertex,
          scale = -this->timeScale * ::sin( this->timeScale * time );
          break;
    }
-   switch( functionType )
-   {
+   switch( functionType ) {
       case constant:
-      {
-         typedef Constant< Dimension, Real > FunctionType;
-         return scale * ( ( FunctionType* ) function )->template
-                  getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
-      }
+         {
+            using FunctionType = Constant< Dimension, Real >;
+            return scale
+                 * ( (FunctionType*) function )
+                      ->template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
+         }
       case paraboloid:
-      {
-         typedef Paraboloid< Dimension, Real > FunctionType;
-         return scale * ( ( FunctionType* ) function )->template
-                  getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
-      }
+         {
+            using FunctionType = Paraboloid< Dimension, Real >;
+            return scale
+                 * ( (FunctionType*) function )
+                      ->template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
+         }
       case expBump:
-      {
-         typedef ExpBump< Dimension, Real > FunctionType;
-         return scale * ( ( FunctionType* ) function )->template
-                  getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
-      }
+         {
+            using FunctionType = ExpBump< Dimension, Real >;
+            return scale
+                 * ( (FunctionType*) function )
+                      ->template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
+         }
       case sinBumps:
-      {
-         typedef SinBumps< Dimension, Real > FunctionType;
-         return scale * ( ( FunctionType* ) function )->template
-                  getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
-      }
+         {
+            using FunctionType = SinBumps< Dimension, Real >;
+            return scale
+                 * ( (FunctionType*) function )
+                      ->template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
+         }
       case sinWave:
-      {
-         typedef SinWave< Dimension, Real > FunctionType;
-         return scale * ( ( FunctionType* ) function )->template
-                  getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
-         break;
-      }
+         {
+            using FunctionType = SinWave< Dimension, Real >;
+            return scale
+                 * ( (FunctionType*) function )
+                      ->template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
+            break;
+         }
       case cylinder:
-      {
-         typedef Cylinder< Dimension, Real > FunctionType;
-         return scale * ( ( FunctionType* ) function )->template
-                  getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
-         break;
-      }
+         {
+            using FunctionType = Cylinder< Dimension, Real >;
+            return scale
+                 * ( (FunctionType*) function )
+                      ->template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
+            break;
+         }
       case flowerpot:
-      {
-         typedef Flowerpot< Dimension, Real > FunctionType;
-         return scale * ( ( FunctionType* ) function )->template
-                  getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
-         break;
-      }
+         {
+            using FunctionType = Flowerpot< Dimension, Real >;
+            return scale
+                 * ( (FunctionType*) function )
+                      ->template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
+            break;
+         }
       case twins:
-      {
-         typedef Twins< Dimension, Real > FunctionType;
-         return scale * ( ( FunctionType* ) function )->template
-                  getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
-         break;
-      }
+         {
+            using FunctionType = Twins< Dimension, Real >;
+            return scale
+                 * ( (FunctionType*) function )
+                      ->template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
+            break;
+         }
       case pseudoSquare:
-      {
-         typedef PseudoSquare< Dimension, Real > FunctionType;
-         return scale * ( ( FunctionType* ) function )->template
-                  getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
-         break;
-      }
+         {
+            using FunctionType = PseudoSquare< Dimension, Real >;
+            return scale
+                 * ( (FunctionType*) function )
+                      ->template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
+            break;
+         }
       case blob:
-      {
-         typedef Blob< Dimension, Real > FunctionType;
-         return scale * ( ( FunctionType* ) function )->template
-                  getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
-         break;
-      }
-
+         {
+            using FunctionType = Blob< Dimension, Real >;
+            return scale
+                 * ( (FunctionType*) function )
+                      ->template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
+            break;
+         }
 
       case paraboloidSDF:
-      {
-         typedef ParaboloidSDF< Dimension, Real > FunctionType;
-         return scale * ( ( FunctionType* ) function )->template
-                  getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
-      }
+         {
+            using FunctionType = ParaboloidSDF< Dimension, Real >;
+            return scale
+                 * ( (FunctionType*) function )
+                      ->template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
+         }
       case sinBumpsSDF:
-      {
-         typedef SinBumpsSDF< Dimension, Real > FunctionType;
-         return scale * ( ( FunctionType* ) function )->template
-                  getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
-      }
+         {
+            using FunctionType = SinBumpsSDF< Dimension, Real >;
+            return scale
+                 * ( (FunctionType*) function )
+                      ->template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
+         }
       case sinWaveSDF:
-      {
-         typedef SinWaveSDF< Dimension, Real > FunctionType;
-         return scale * ( ( FunctionType* ) function )->template
-                  getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
-      }
+         {
+            using FunctionType = SinWaveSDF< Dimension, Real >;
+            return scale
+                 * ( (FunctionType*) function )
+                      ->template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
+         }
       default:
          return 0.0;
    }
 }
 
-template< int FunctionDimension,
-          typename Real,
-          typename Device >
-   template< typename FunctionType >
+template< int FunctionDimension, typename Real, typename Device >
+template< typename FunctionType >
 void
-TestFunction< FunctionDimension, Real, Device >::
-deleteFunction()
+TestFunction< FunctionDimension, Real, Device >::deleteFunction()
 {
-   if( std::is_same< Device, Devices::Host >::value )
-   {
+   if( std::is_same< Device, Devices::Host >::value ) {
       if( function )
-         delete ( FunctionType * ) function;
+         delete(FunctionType*) function;
    }
-   if( std::is_same< Device, Devices::Cuda >::value )
-   {
+   if( std::is_same< Device, Devices::Cuda >::value ) {
       if( function )
          Allocators::Cuda< FunctionType >{}.deallocate( (FunctionType*) function, 1 );
    }
 }
 
-template< int FunctionDimension,
-          typename Real,
-          typename Device >
-   template< typename OperatorType >
+template< int FunctionDimension, typename Real, typename Device >
+template< typename OperatorType >
 void
-TestFunction< FunctionDimension, Real, Device >::
-deleteOperator()
+TestFunction< FunctionDimension, Real, Device >::deleteOperator()
 {
-   if( std::is_same< Device, Devices::Host >::value )
-   {
+   if( std::is_same< Device, Devices::Host >::value ) {
       if( operator_ )
-         delete ( OperatorType * ) operator_;
+         delete(OperatorType*) operator_;
    }
-   if( std::is_same< Device, Devices::Cuda >::value )
-   {
+   if( std::is_same< Device, Devices::Cuda >::value ) {
       if( operator_ )
          Allocators::Cuda< OperatorType >{}.deallocate( (OperatorType*) operator_, 1 );
    }
 }
 
-template< int FunctionDimension,
-          typename Real,
-          typename Device >
+template< int FunctionDimension, typename Real, typename Device >
 void
-TestFunction< FunctionDimension, Real, Device >::
-deleteFunctions()
+TestFunction< FunctionDimension, Real, Device >::deleteFunctions()
 {
    using namespace TNL::Functions::Analytic;
    using namespace TNL::Operators::Analytic;
-   switch( functionType )
-   {
+   switch( functionType ) {
       case constant:
-      {
-         typedef Constant< Dimension, Real> FunctionType;
-         deleteFunction< FunctionType >();
-         deleteOperator< Identity< Dimension, Real > >();
-         break;
-      }
-      case paraboloid:
-      {
-         typedef Paraboloid< Dimension, Real> FunctionType;
-         deleteFunction< FunctionType >();
-         if( operatorType == identity )
+         {
+            using FunctionType = Constant< Dimension, Real >;
+            deleteFunction< FunctionType >();
             deleteOperator< Identity< Dimension, Real > >();
-         if( operatorType == heaviside )
-            deleteOperator< Heaviside< Dimension, Real > >();
-         break;
-      }
+            break;
+         }
+      case paraboloid:
+         {
+            using FunctionType = Paraboloid< Dimension, Real >;
+            deleteFunction< FunctionType >();
+            if( operatorType == identity )
+               deleteOperator< Identity< Dimension, Real > >();
+            if( operatorType == heaviside )
+               deleteOperator< Heaviside< Dimension, Real > >();
+            break;
+         }
       case expBump:
-      {
-         typedef ExpBump< Dimension, Real> FunctionType;
-         deleteFunction< FunctionType >();
-         deleteOperator< Identity< Dimension, Real > >();
-         break;
-      }
+         {
+            using FunctionType = ExpBump< Dimension, Real >;
+            deleteFunction< FunctionType >();
+            deleteOperator< Identity< Dimension, Real > >();
+            break;
+         }
       case sinBumps:
-      {
-         typedef SinBumps< Dimension, Real> FunctionType;
-         deleteFunction< FunctionType >();
-         deleteOperator< Identity< Dimension, Real > >();
-         break;
-      }
+         {
+            using FunctionType = SinBumps< Dimension, Real >;
+            deleteFunction< FunctionType >();
+            deleteOperator< Identity< Dimension, Real > >();
+            break;
+         }
       case sinWave:
-      {
-         typedef SinWave< Dimension, Real> FunctionType;
-         deleteFunction< FunctionType >();
-         deleteOperator< Identity< Dimension, Real > >();
-         break;
-      }
+         {
+            using FunctionType = SinWave< Dimension, Real >;
+            deleteFunction< FunctionType >();
+            deleteOperator< Identity< Dimension, Real > >();
+            break;
+         }
       case cylinder:
-      {
-         typedef Cylinder< Dimension, Real> FunctionType;
-         deleteFunction< FunctionType >();
-         deleteOperator< Identity< Dimension, Real > >();
-         break;
-      }
+         {
+            using FunctionType = Cylinder< Dimension, Real >;
+            deleteFunction< FunctionType >();
+            deleteOperator< Identity< Dimension, Real > >();
+            break;
+         }
       case flowerpot:
-      {
-         typedef Flowerpot< Dimension, Real> FunctionType;
-         deleteFunction< FunctionType >();
-         deleteOperator< Identity< Dimension, Real > >();
-         break;
-      }
+         {
+            using FunctionType = Flowerpot< Dimension, Real >;
+            deleteFunction< FunctionType >();
+            deleteOperator< Identity< Dimension, Real > >();
+            break;
+         }
       case twins:
-      {
-         typedef Twins< Dimension, Real> FunctionType;
-         deleteFunction< FunctionType >();
-         deleteOperator< Identity< Dimension, Real > >();
-         break;
-      }
+         {
+            using FunctionType = Twins< Dimension, Real >;
+            deleteFunction< FunctionType >();
+            deleteOperator< Identity< Dimension, Real > >();
+            break;
+         }
       case pseudoSquare:
-      {
-         typedef PseudoSquare< Dimension, Real> FunctionType;
-         deleteFunction< FunctionType >();
-         deleteOperator< Identity< Dimension, Real > >();
-         break;
-      }
+         {
+            using FunctionType = PseudoSquare< Dimension, Real >;
+            deleteFunction< FunctionType >();
+            deleteOperator< Identity< Dimension, Real > >();
+            break;
+         }
       case blob:
-      {
-         typedef Blob< Dimension, Real> FunctionType;
-         deleteFunction< FunctionType >();
-         deleteOperator< Identity< Dimension, Real > >();
-         break;
-      }
+         {
+            using FunctionType = Blob< Dimension, Real >;
+            deleteFunction< FunctionType >();
+            deleteOperator< Identity< Dimension, Real > >();
+            break;
+         }
       case vectorNorm:
-      {
-         typedef VectorNorm< Dimension, Real> FunctionType;
-         deleteFunction< FunctionType >();
-         deleteOperator< Identity< Dimension, Real > >();
-         break;
-      }
-      
-      
+         {
+            using FunctionType = VectorNorm< Dimension, Real >;
+            deleteFunction< FunctionType >();
+            deleteOperator< Identity< Dimension, Real > >();
+            break;
+         }
+
       case paraboloidSDF:
-      {
-         typedef ParaboloidSDF< Dimension, Real> FunctionType;
-         deleteFunction< FunctionType >();
-         deleteOperator< Identity< Dimension, Real > >();
-         break;
-      }
+         {
+            using FunctionType = ParaboloidSDF< Dimension, Real >;
+            deleteFunction< FunctionType >();
+            deleteOperator< Identity< Dimension, Real > >();
+            break;
+         }
       case sinBumpsSDF:
-      {
-         typedef SinBumpsSDF< Dimension, Real> FunctionType;
-         deleteFunction< FunctionType >();
-         deleteOperator< Identity< Dimension, Real > >();
-         break;
-      }
+         {
+            using FunctionType = SinBumpsSDF< Dimension, Real >;
+            deleteFunction< FunctionType >();
+            deleteOperator< Identity< Dimension, Real > >();
+            break;
+         }
       case sinWaveSDF:
-      {
-         typedef SinWaveSDF< Dimension, Real> FunctionType;
-         deleteFunction< FunctionType >();
-         deleteOperator< Identity< Dimension, Real > >();
-         break;
-      }
+         {
+            using FunctionType = SinWaveSDF< Dimension, Real >;
+            deleteFunction< FunctionType >();
+            deleteOperator< Identity< Dimension, Real > >();
+            break;
+         }
    }
 }
 
-template< int FunctionDimension,
-          typename Real,
-          typename Device >
-   template< typename FunctionType >
+template< int FunctionDimension, typename Real, typename Device >
+template< typename FunctionType >
 void
-TestFunction< FunctionDimension, Real, Device >::
-copyFunction( const void* function )
+TestFunction< FunctionDimension, Real, Device >::copyFunction( const void* function )
 {
-   if( std::is_same< Device, Devices::Host >::value )
-   {
+   if( std::is_same< Device, Devices::Host >::value ) {
       FunctionType* f = new FunctionType;
-      *f = * ( FunctionType* )function;
+      *f = *(FunctionType*) function;
    }
-   if( std::is_same< Device, Devices::Cuda >::value )
-   {
+   if( std::is_same< Device, Devices::Cuda >::value ) {
       throw Exceptions::NotImplementedError( "Assignment operator is not implemented for CUDA." );
    }
 }
 
-template< int FunctionDimension,
-          typename Real,
-          typename Device >
-   template< typename FunctionType >
+template< int FunctionDimension, typename Real, typename Device >
+template< typename FunctionType >
 std::ostream&
-TestFunction< FunctionDimension, Real, Device >::
-printFunction( std::ostream& str ) const
+TestFunction< FunctionDimension, Real, Device >::printFunction( std::ostream& str ) const
 {
-   if( std::is_same< Device, Devices::Host >::value )
-   {
-      FunctionType* f = ( FunctionType* ) this->function;
+   if( std::is_same< Device, Devices::Host >::value ) {
+      FunctionType* f = (FunctionType*) this->function;
       str << *f;
       return str;
    }
-   if( std::is_same< Device, Devices::Cuda >::value )
-   {
+   if( std::is_same< Device, Devices::Cuda >::value ) {
       FunctionType f;
       Algorithms::MultiDeviceMemoryOperations< Devices::Host, Devices::Cuda >::copy( &f, (FunctionType*) this->function, 1 );
       str << f;
@@ -920,49 +859,42 @@ printFunction( std::ostream& str ) const
    }
 }
 
-template< int FunctionDimension,
-          typename Real,
-          typename Device >
+template< int FunctionDimension, typename Real, typename Device >
 std::ostream&
-TestFunction< FunctionDimension, Real, Device >::
-print( std::ostream& str ) const
+TestFunction< FunctionDimension, Real, Device >::print( std::ostream& str ) const
 {
    using namespace TNL::Functions::Analytic;
    str << " timeDependence = " << this->timeDependence;
    str << " functionType = " << this->functionType;
    str << " function = " << this->function << "; ";
-   switch( functionType )
-   {
+   switch( functionType ) {
       case constant:
-         return printFunction< Constant< Dimension, Real> >( str );
+         return printFunction< Constant< Dimension, Real > >( str );
       case expBump:
-         return printFunction< ExpBump< Dimension, Real> >( str );
+         return printFunction< ExpBump< Dimension, Real > >( str );
       case sinBumps:
-         return printFunction< SinBumps< Dimension, Real> >( str );
+         return printFunction< SinBumps< Dimension, Real > >( str );
       case sinWave:
-         return printFunction< SinWave< Dimension, Real> >( str );
+         return printFunction< SinWave< Dimension, Real > >( str );
       case cylinder:
-         return printFunction< Cylinder< Dimension, Real> >( str );
+         return printFunction< Cylinder< Dimension, Real > >( str );
       case flowerpot:
-         return printFunction< Flowerpot< Dimension, Real> >( str );
+         return printFunction< Flowerpot< Dimension, Real > >( str );
       case twins:
-         return printFunction< Twins< Dimension, Real> >( str );
+         return printFunction< Twins< Dimension, Real > >( str );
       case pseudoSquare:
-         return printFunction< PseudoSquare< Dimension, Real> >( str );
+         return printFunction< PseudoSquare< Dimension, Real > >( str );
       case blob:
-         return printFunction< Blob< Dimension, Real> >( str );
+         return printFunction< Blob< Dimension, Real > >( str );
    }
    return str;
 }
 
-template< int FunctionDimension,
-          typename Real,
-          typename Device >
-TestFunction< FunctionDimension, Real, Device >::
-~TestFunction()
+template< int FunctionDimension, typename Real, typename Device >
+TestFunction< FunctionDimension, Real, Device >::~TestFunction()
 {
    deleteFunctions();
 }
 
-} // namespace Functions
-} // namespace TNL
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/VectorField.h b/src/TNL/Functions/VectorField.h
index 04b6b25ee09fab16de4db3b09270c09c81c5f7c9..3a659c925fc36292fe81045ca100ec6656370b2f 100644
--- a/src/TNL/Functions/VectorField.h
+++ b/src/TNL/Functions/VectorField.h
@@ -21,514 +21,526 @@
 namespace TNL {
 namespace Functions {
 
-template< int Size,
-          typename Function >
-class VectorField
-   : public Functions::Domain< Function::getDomainDimension(),
-                               Function::getDomainType() >
+template< int Size, typename Function >
+class VectorField : public Functions::Domain< Function::getDomainDimension(), Function::getDomainType() >
 {
-   public:
+public:
+   typedef Function FunctionType;
+   typedef typename FunctionType::RealType RealType;
+   typedef typename FunctionType::PointType PointType;
 
-      typedef Function FunctionType;
-      typedef typename FunctionType::RealType RealType;
-      typedef typename FunctionType::PointType PointType;
-
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" )
-      {
-         for( int i = 0; i < Size; i++ )
-            FunctionType::configSetup( config, prefix + convertToString( i ) + "-" );
-      }
-
-      template< typename MeshPointer >
-      bool setup( const MeshPointer& meshPointer,
-                  const Config::ParameterContainer& parameters,
-                  const String& prefix = "" )
-      {
-         for( int i = 0; i < Size; i++ )
-            if( ! vectorField[ i ].setup( parameters, prefix + convertToString( i ) + "-" ) )
-            {
-               std::cerr << "Unable to setup " << i << "-th coordinate of the vector field." << std::endl;
-               return false;
-            }
-         return true;
-      }
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" )
+   {
+      for( int i = 0; i < Size; i++ )
+         FunctionType::configSetup( config, prefix + convertToString( i ) + "-" );
+   }
 
-      __cuda_callable__
-      const FunctionType& operator[]( int i ) const
-      {
-         return this->vectorField[ i ];
-      }
+   template< typename MeshPointer >
+   bool
+   setup( const MeshPointer& meshPointer, const Config::ParameterContainer& parameters, const String& prefix = "" )
+   {
+      for( int i = 0; i < Size; i++ )
+         if( ! vectorField[ i ].setup( parameters, prefix + convertToString( i ) + "-" ) ) {
+            std::cerr << "Unable to setup " << i << "-th coordinate of the vector field." << std::endl;
+            return false;
+         }
+      return true;
+   }
 
-      __cuda_callable__
-      FunctionType& operator[]( int i )
-      {
-         return this->vectorField[ i ];
-      }
+   __cuda_callable__
+   const FunctionType&
+   operator[]( int i ) const
+   {
+      return this->vectorField[ i ];
+   }
 
-   protected:
+   __cuda_callable__
+   FunctionType&
+   operator[]( int i )
+   {
+      return this->vectorField[ i ];
+   }
 
-      Containers::StaticArray< Size, FunctionType > vectorField;
+protected:
+   Containers::StaticArray< Size, FunctionType > vectorField;
 };
 
-
-template< int Size,
-          typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< int Size, typename Mesh, int MeshEntityDimension, typename Real >
 class VectorField< Size, MeshFunction< Mesh, MeshEntityDimension, Real > >
 : public Functions::Domain< MeshFunction< Mesh, MeshEntityDimension, Real >::getDomainDimension(),
                             MeshFunction< Mesh, MeshEntityDimension, Real >::getDomainType() >
 {
-   public:
-
-      typedef Mesh MeshType;
-      typedef Real RealType;
-      typedef Pointers::SharedPointer<  MeshType > MeshPointer;
-      typedef MeshFunction< MeshType, MeshEntityDimension, RealType > FunctionType;
-      typedef Pointers::SharedPointer<  FunctionType > FunctionPointer;
-      typedef typename MeshType::DeviceType DeviceType;
-      typedef typename MeshType::GlobalIndexType IndexType;
-      typedef Containers::StaticVector< Size, RealType > VectorType;
-
-      static constexpr int getEntitiesDimension() { return FunctionType::getEntitiesDimension(); }
-
-      static constexpr int getMeshDimension() { return MeshType::getMeshDimension(); }
+public:
+   typedef Mesh MeshType;
+   typedef Real RealType;
+   typedef Pointers::SharedPointer< MeshType > MeshPointer;
+   typedef MeshFunction< MeshType, MeshEntityDimension, RealType > FunctionType;
+   typedef Pointers::SharedPointer< FunctionType > FunctionPointer;
+   typedef typename MeshType::DeviceType DeviceType;
+   typedef typename MeshType::GlobalIndexType IndexType;
+   typedef Containers::StaticVector< Size, RealType > VectorType;
+
+   static constexpr int
+   getEntitiesDimension()
+   {
+      return FunctionType::getEntitiesDimension();
+   }
 
-	  static constexpr int getVectorDimension() { return Size; }
+   static constexpr int
+   getMeshDimension()
+   {
+      return MeshType::getMeshDimension();
+   }
 
+   static constexpr int
+   getVectorDimension()
+   {
+      return Size;
+   }
 
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" )
-      {
-         for( int i = 0; i < Size; i++ )
-            FunctionType::configSetup( config, prefix + convertToString( i ) + "-" );
-      }
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" )
+   {
+      for( int i = 0; i < Size; i++ )
+         FunctionType::configSetup( config, prefix + convertToString( i ) + "-" );
+   }
 
-      VectorField() {};
+   VectorField(){};
 
-      VectorField( const MeshPointer& meshPointer )
-      {
-         for( int i = 0; i < Size; i++ )
-            this->vectorField[ i ]->setMesh( meshPointer );
-      };
+   VectorField( const MeshPointer& meshPointer )
+   {
+      for( int i = 0; i < Size; i++ )
+         this->vectorField[ i ]->setMesh( meshPointer );
+   };
 
-      void setMesh( const MeshPointer& meshPointer )
-      {
-         for( int i = 0; i < Size; i++ )
-            this->vectorField[ i ]->setMesh( meshPointer );
-      }
+   void
+   setMesh( const MeshPointer& meshPointer )
+   {
+      for( int i = 0; i < Size; i++ )
+         this->vectorField[ i ]->setMesh( meshPointer );
+   }
 
-      template< typename Device = Devices::Host >
-      __cuda_callable__
-      const MeshType& getMesh() const
-      {
-         return this->vectorField[ 0 ].template getData< Device >().template getMesh< Device >();
-      }
+   template< typename Device = Devices::Host >
+   __cuda_callable__
+   const MeshType&
+   getMesh() const
+   {
+      return this->vectorField[ 0 ].template getData< Device >().template getMesh< Device >();
+   }
 
-      const MeshPointer& getMeshPointer() const
-      {
-         return this->vectorField[ 0 ]->getMeshPointer();
-      }
+   const MeshPointer&
+   getMeshPointer() const
+   {
+      return this->vectorField[ 0 ]->getMeshPointer();
+   }
 
-      bool setup( const MeshPointer& meshPointer,
-                  const Config::ParameterContainer& parameters,
-                  const String& prefix = "" )
-      {
-         for( int i = 0; i < Size; i++ )
-            if( ! vectorField[ i ].setup( meshPointer, parameters, prefix + convertToString( i ) + "-" ) )
-            {
-               std::cerr << "Unable to setup " << i << "-th coordinate of the vector field." << std::endl;
-               return false;
-            }
-         return true;
-      }
+   bool
+   setup( const MeshPointer& meshPointer, const Config::ParameterContainer& parameters, const String& prefix = "" )
+   {
+      for( int i = 0; i < Size; i++ )
+         if( ! vectorField[ i ].setup( meshPointer, parameters, prefix + convertToString( i ) + "-" ) ) {
+            std::cerr << "Unable to setup " << i << "-th coordinate of the vector field." << std::endl;
+            return false;
+         }
+      return true;
+   }
 
-      static IndexType getDofs( const MeshPointer& meshPointer )
-      {
-         return Size * FunctionType::getDofs( meshPointer );
-      }
+   static IndexType
+   getDofs( const MeshPointer& meshPointer )
+   {
+      return Size * FunctionType::getDofs( meshPointer );
+   }
 
-      __cuda_callable__
-      const FunctionPointer& operator[]( int i ) const
-      {
-         return this->vectorField[ i ];
-      }
+   __cuda_callable__
+   const FunctionPointer&
+   operator[]( int i ) const
+   {
+      return this->vectorField[ i ];
+   }
 
-      __cuda_callable__
-      FunctionPointer& operator[]( int i )
-      {
-         return this->vectorField[ i ];
-      }
+   __cuda_callable__
+   FunctionPointer&
+   operator[]( int i )
+   {
+      return this->vectorField[ i ];
+   }
 
-      __cuda_callable__
-      void setElement( const IndexType i, const VectorType& v )
-      {
-         for( int j = 0; j < Size; j++ )
-            ( *this )[ j ]->getData().setElement( i, v[ j ] );
-      }
+   __cuda_callable__
+   void
+   setElement( const IndexType i, const VectorType& v )
+   {
+      for( int j = 0; j < Size; j++ )
+         ( *this )[ j ]->getData().setElement( i, v[ j ] );
+   }
 
-      VectorType getElement( const IndexType i ) const
-      {
-         VectorType v;
-         for( int j = 0; j < Size; j++ )
-            v[ j ] = ( *this )[ j ]->getData().getElement( i );
-         return v;
-      }
+   VectorType
+   getElement( const IndexType i ) const
+   {
+      VectorType v;
+      for( int j = 0; j < Size; j++ )
+         v[ j ] = ( *this )[ j ]->getData().getElement( i );
+      return v;
+   }
 
-      __cuda_callable__
-      VectorType getVector( const IndexType index ) const
-      {
-         VectorType v;
-         for( int i = 0; i < Size; i++ )
-            // FIXME: fix the dereferencing operator in smart pointers to be __cuda_callable__
-            v[ i ] = this->vectorField[ i ].template getData< Devices::Cuda >()[ index ];
-         return v;
-      }
+   __cuda_callable__
+   VectorType
+   getVector( const IndexType index ) const
+   {
+      VectorType v;
+      for( int i = 0; i < Size; i++ )
+         // FIXME: fix the dereferencing operator in smart pointers to be __cuda_callable__
+         v[ i ] = this->vectorField[ i ].template getData< Devices::Cuda >()[ index ];
+      return v;
+   }
 
-      template< typename EntityType >
-      void setValue( const EntityType& meshEntity,
-                     const FunctionType& value )
-      {
-         for(int i = 0; i < Size; i++ )
-            this->vectorfield[ i ].setValue( meshEntity.getIndex(), value[ i ] );
-      }
+   template< typename EntityType >
+   void
+   setValue( const EntityType& meshEntity, const FunctionType& value )
+   {
+      for( int i = 0; i < Size; i++ )
+         this->vectorfield[ i ].setValue( meshEntity.getIndex(), value[ i ] );
+   }
 
-      template< typename EntityType >
-      __cuda_callable__
-      VectorType getVector( const EntityType& meshEntity ) const
-      {
-         VectorType v;
-         for( int i = 0; i < Size; i++ )
-            // FIXME: fix the dereferencing operator in smart pointers to be __cuda_callable__
-            v[ i ] = this->vectorField[ i ].template getData< Devices::Cuda >()( meshEntity );
-         return v;
-      }
+   template< typename EntityType >
+   __cuda_callable__
+   VectorType
+   getVector( const EntityType& meshEntity ) const
+   {
+      VectorType v;
+      for( int i = 0; i < Size; i++ )
+         // FIXME: fix the dereferencing operator in smart pointers to be __cuda_callable__
+         v[ i ] = this->vectorField[ i ].template getData< Devices::Cuda >()( meshEntity );
+      return v;
+   }
 
-      bool write( const std::string& functionName,
-                  const std::string& fileName,
-                  const std::string& fileFormat = "auto" ) const
-      {
-         std::fstream file;
-         file.open( fileName, std::ios::out );
-         if( ! file )
-         {
-            std::cerr << "Unable to open a file " << fileName << "." << std::endl;
-            return false;
+   bool
+   write( const std::string& functionName, const std::string& fileName, const std::string& fileFormat = "auto" ) const
+   {
+      std::fstream file;
+      file.open( fileName, std::ios::out );
+      if( ! file ) {
+         std::cerr << "Unable to open a file " << fileName << "." << std::endl;
+         return false;
+      }
+
+      namespace fs = std::experimental::filesystem;
+      std::string format = fileFormat;
+      if( format == "auto" ) {
+         format = fs::path( fileName ).extension();
+         if( format.length() > 0 )
+            // remove dot from the extension
+            format = format.substr( 1 );
+      }
+
+      if( format == "vtk" || format == "vtu" || format == "vti" ) {
+         // copy all values from the vector field into a contiguous array
+         using BufferType = Containers::Array< typename VectorField::RealType, Devices::Host, IndexType >;
+         const IndexType entitiesCount = getMeshPointer()->template getEntitiesCount< getEntitiesDimension() >();
+         BufferType buffer( 3 * entitiesCount );
+         IndexType k = 0;
+         for( IndexType i = 0; i < entitiesCount; i++ ) {
+            const VectorType vector = getElement( i );
+            static_assert( getVectorDimension() <= 3, "VTK formats support only up to 3D vector fields." );
+            for( int j = 0; j < 3; j++ )
+               buffer[ k++ ] = ( j < vector.getSize() ? vector[ j ] : 0 );
          }
 
-         namespace fs = std::experimental::filesystem;
-         std::string format = fileFormat;
-         if( format == "auto" ) {
-            format = fs::path(fileName).extension();
-            if( format.length() > 0 )
-               // remove dot from the extension
-               format = format.substr(1);
+         if( format == "vtk" ) {
+            Meshes::Writers::VTKWriter< Mesh > writer( file );
+            writer.template writeEntities< getEntitiesDimension() >( *getMeshPointer() );
+            if( getEntitiesDimension() == 0 )
+               writer.writePointData( buffer, functionName, 3 );
+            else
+               writer.writeCellData( buffer, functionName, 3 );
          }
-
-         if( format == "vtk" || format == "vtu" || format == "vti" ) {
-            // copy all values from the vector field into a contiguous array
-            using BufferType = Containers::Array< typename VectorField::RealType, Devices::Host, IndexType >;
-            const IndexType entitiesCount = getMeshPointer()->template getEntitiesCount< getEntitiesDimension() >();
-            BufferType buffer( 3 * entitiesCount );
-            IndexType k = 0;
-            for( IndexType i = 0; i < entitiesCount; i++ ) {
-               const VectorType vector = getElement( i );
-               static_assert( getVectorDimension() <= 3, "VTK formats support only up to 3D vector fields." );
-               for( int j = 0; j < 3; j++ )
-                  buffer[ k++ ] = ( j < vector.getSize() ? vector[ j ] : 0 );
-            }
-
-            if( format == "vtk" ) {
-               Meshes::Writers::VTKWriter< Mesh > writer( file );
-               writer.template writeEntities< getEntitiesDimension() >( *getMeshPointer() );
-               if( getEntitiesDimension() == 0 )
-                  writer.writePointData( buffer, functionName, 3 );
-               else
-                  writer.writeCellData( buffer, functionName, 3 );
-            }
-            else if( format == "vtu" ) {
-               Meshes::Writers::VTUWriter< Mesh > writer( file );
-               writer.template writeEntities< getEntitiesDimension() >( *getMeshPointer() );
-               if( getEntitiesDimension() == 0 )
-                  writer.writePointData( buffer, functionName, 3 );
-               else
-                  writer.writeCellData( buffer, functionName, 3 );
-            }
-            else if( format == "vti" ) {
-               Meshes::Writers::VTIWriter< Mesh > writer( file );
-               writer.template writeEntities< getEntitiesDimension() >( *getMeshPointer() );
-               if( getEntitiesDimension() == 0 )
-                  writer.writePointData( buffer, functionName, 3 );
-               else
-                  writer.writeCellData( buffer, functionName, 3 );
-            }
+         else if( format == "vtu" ) {
+            Meshes::Writers::VTUWriter< Mesh > writer( file );
+            writer.template writeEntities< getEntitiesDimension() >( *getMeshPointer() );
+            if( getEntitiesDimension() == 0 )
+               writer.writePointData( buffer, functionName, 3 );
+            else
+               writer.writeCellData( buffer, functionName, 3 );
          }
-         else if( format == "gnuplot" || format == "gplt" || format == "plt" )
-            return VectorFieldGnuplotWriter< VectorField >::write( *this, file );
-         else {
-            std::cerr << "Unknown output format: " << format << std::endl;
-            return false;
+         else if( format == "vti" ) {
+            Meshes::Writers::VTIWriter< Mesh > writer( file );
+            writer.template writeEntities< getEntitiesDimension() >( *getMeshPointer() );
+            if( getEntitiesDimension() == 0 )
+               writer.writePointData( buffer, functionName, 3 );
+            else
+               writer.writeCellData( buffer, functionName, 3 );
          }
-         return true;
       }
+      else if( format == "gnuplot" || format == "gplt" || format == "plt" )
+         return VectorFieldGnuplotWriter< VectorField >::write( *this, file );
+      else {
+         std::cerr << "Unknown output format: " << format << std::endl;
+         return false;
+      }
+      return true;
+   }
 
-   protected:
-
-      Containers::StaticArray< Size, FunctionPointer > vectorField;
-
+protected:
+   Containers::StaticArray< Size, FunctionPointer > vectorField;
 };
 
-
-template< int Size,
-          typename Mesh,
-          int MeshEntityDimension,
-          typename Real >
+template< int Size, typename Mesh, int MeshEntityDimension, typename Real >
 class VectorField< Size, MeshFunctionView< Mesh, MeshEntityDimension, Real > >
 : public Functions::Domain< MeshFunctionView< Mesh, MeshEntityDimension, Real >::getDomainDimension(),
                             MeshFunctionView< Mesh, MeshEntityDimension, Real >::getDomainType() >
 {
-   public:
-
-      typedef Mesh MeshType;
-      typedef Real RealType;
-      typedef Pointers::SharedPointer<  MeshType > MeshPointer;
-      typedef MeshFunctionView< MeshType, MeshEntityDimension, RealType > FunctionType;
-      typedef Pointers::SharedPointer<  FunctionType > FunctionPointer;
-      typedef typename MeshType::DeviceType DeviceType;
-      typedef typename MeshType::GlobalIndexType IndexType;
-      typedef Containers::StaticVector< Size, RealType > VectorType;
-
-      static constexpr int getEntitiesDimension() { return FunctionType::getEntitiesDimension(); }
+public:
+   typedef Mesh MeshType;
+   typedef Real RealType;
+   typedef Pointers::SharedPointer< MeshType > MeshPointer;
+   typedef MeshFunctionView< MeshType, MeshEntityDimension, RealType > FunctionType;
+   typedef Pointers::SharedPointer< FunctionType > FunctionPointer;
+   typedef typename MeshType::DeviceType DeviceType;
+   typedef typename MeshType::GlobalIndexType IndexType;
+   typedef Containers::StaticVector< Size, RealType > VectorType;
+
+   static constexpr int
+   getEntitiesDimension()
+   {
+      return FunctionType::getEntitiesDimension();
+   }
 
-      static constexpr int getMeshDimension() { return MeshType::getMeshDimension(); }
+   static constexpr int
+   getMeshDimension()
+   {
+      return MeshType::getMeshDimension();
+   }
 
-	  static constexpr int getVectorDimension() { return Size; }
+   static constexpr int
+   getVectorDimension()
+   {
+      return Size;
+   }
 
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" )
+   {
+      for( int i = 0; i < Size; i++ )
+         FunctionType::configSetup( config, prefix + convertToString( i ) + "-" );
+   }
 
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" )
-      {
-         for( int i = 0; i < Size; i++ )
-            FunctionType::configSetup( config, prefix + convertToString( i ) + "-" );
-      }
+   VectorField(){};
 
-      VectorField() {};
+   VectorField( const MeshPointer& meshPointer )
+   {
+      for( int i = 0; i < Size; i++ )
+         this->vectorField[ i ]->setMesh( meshPointer );
+   };
 
-      VectorField( const MeshPointer& meshPointer )
-      {
-         for( int i = 0; i < Size; i++ )
-            this->vectorField[ i ]->setMesh( meshPointer );
-      };
+   void
+   setMesh( const MeshPointer& meshPointer )
+   {
+      for( int i = 0; i < Size; i++ )
+         this->vectorField[ i ]->setMesh( meshPointer );
+   }
 
-      void setMesh( const MeshPointer& meshPointer )
-      {
-         for( int i = 0; i < Size; i++ )
-            this->vectorField[ i ]->setMesh( meshPointer );
-      }
+   template< typename Device = Devices::Host >
+   __cuda_callable__
+   const MeshType&
+   getMesh() const
+   {
+      return this->vectorField[ 0 ].template getData< Device >().template getMesh< Device >();
+   }
 
-      template< typename Device = Devices::Host >
-      __cuda_callable__
-      const MeshType& getMesh() const
-      {
-         return this->vectorField[ 0 ].template getData< Device >().template getMesh< Device >();
-      }
+   const MeshPointer&
+   getMeshPointer() const
+   {
+      return this->vectorField[ 0 ]->getMeshPointer();
+   }
 
-      const MeshPointer& getMeshPointer() const
-      {
-         return this->vectorField[ 0 ]->getMeshPointer();
-      }
+   bool
+   setup( const MeshPointer& meshPointer, const Config::ParameterContainer& parameters, const String& prefix = "" )
+   {
+      for( int i = 0; i < Size; i++ )
+         if( ! vectorField[ i ].setup( meshPointer, parameters, prefix + convertToString( i ) + "-" ) ) {
+            std::cerr << "Unable to setup " << i << "-th coordinate of the vector field." << std::endl;
+            return false;
+         }
+      return true;
+   }
 
-      bool setup( const MeshPointer& meshPointer,
-                  const Config::ParameterContainer& parameters,
-                  const String& prefix = "" )
-      {
-         for( int i = 0; i < Size; i++ )
-            if( ! vectorField[ i ].setup( meshPointer, parameters, prefix + convertToString( i ) + "-" ) )
-            {
-               std::cerr << "Unable to setup " << i << "-th coordinate of the vector field." << std::endl;
-               return false;
-            }
-         return true;
-      }
+   static IndexType
+   getDofs( const MeshPointer& meshPointer )
+   {
+      return Size * FunctionType::getDofs( meshPointer );
+   }
 
-      static IndexType getDofs( const MeshPointer& meshPointer )
-      {
-         return Size * FunctionType::getDofs( meshPointer );
+   void
+   bind( VectorField& vectorField )
+   {
+      for( int i = 0; i < Size; i++ ) {
+         this->vectorField[ i ]->bind( vectorField[ i ] );
       }
+   };
 
-      void bind( VectorField& vectorField )
-      {
-         for( int i = 0; i < Size; i ++ )
-         {
-            this->vectorField[ i ]->bind( vectorField[ i ] );
-         }
-      };
-
-      template< typename Vector >
-      void bind( const MeshPointer& meshPointer,
-                 Vector& data,
-                 IndexType offset = 0 )
-      {
-         TNL_ASSERT_GE( data.getSize(), offset + Size * this->vectorField[ 0 ]->getDofs( meshPointer ),
-                        "Attempt to bind vector which is not large enough."  );
-         for( int i = 0; i < Size; i ++ )
-         {
-            this->vectorField[ i ]->bind( meshPointer, data, offset );
-            offset += this->vectorField[ i ]->getDofs(meshPointer);
-         }
+   template< typename Vector >
+   void
+   bind( const MeshPointer& meshPointer, Vector& data, IndexType offset = 0 )
+   {
+      TNL_ASSERT_GE( data.getSize(),
+                     offset + Size * this->vectorField[ 0 ]->getDofs( meshPointer ),
+                     "Attempt to bind vector which is not large enough." );
+      for( int i = 0; i < Size; i++ ) {
+         this->vectorField[ i ]->bind( meshPointer, data, offset );
+         offset += this->vectorField[ i ]->getDofs( meshPointer );
       }
+   }
 
-      template< typename Vector >
-      void bind( const MeshPointer& meshPointer,
-                 Pointers::SharedPointer< Vector >& dataPtr,
-                 IndexType offset = 0 )
-      {
-         TNL_ASSERT_GE( dataPtr->getSize(), offset + Size * this->vectorField[ 0 ]->getDofs( meshPointer ),
-                        "Attempt to bind vector which is not large enough." );
-         for( int i = 0; i < Size; i ++ )
-         {
-            this->vectorField[ i ]->bind( meshPointer, dataPtr, offset );
-            offset += this->vectorField[ i ]->getDofs( meshPointer );
-         }
+   template< typename Vector >
+   void
+   bind( const MeshPointer& meshPointer, Pointers::SharedPointer< Vector >& dataPtr, IndexType offset = 0 )
+   {
+      TNL_ASSERT_GE( dataPtr->getSize(),
+                     offset + Size * this->vectorField[ 0 ]->getDofs( meshPointer ),
+                     "Attempt to bind vector which is not large enough." );
+      for( int i = 0; i < Size; i++ ) {
+         this->vectorField[ i ]->bind( meshPointer, dataPtr, offset );
+         offset += this->vectorField[ i ]->getDofs( meshPointer );
       }
+   }
 
-      __cuda_callable__
-      const FunctionPointer& operator[]( int i ) const
-      {
-         return this->vectorField[ i ];
-      }
+   __cuda_callable__
+   const FunctionPointer&
+   operator[]( int i ) const
+   {
+      return this->vectorField[ i ];
+   }
 
-      __cuda_callable__
-      FunctionPointer& operator[]( int i )
-      {
-         return this->vectorField[ i ];
-      }
+   __cuda_callable__
+   FunctionPointer&
+   operator[]( int i )
+   {
+      return this->vectorField[ i ];
+   }
 
-      __cuda_callable__
-      void setElement( const IndexType i, const VectorType& v )
-      {
-         for( int j = 0; j < Size; j++ )
-            ( *this )[ j ]->getData().setElement( i, v[ j ] );
-      }
+   __cuda_callable__
+   void
+   setElement( const IndexType i, const VectorType& v )
+   {
+      for( int j = 0; j < Size; j++ )
+         ( *this )[ j ]->getData().setElement( i, v[ j ] );
+   }
 
-      VectorType getElement( const IndexType i ) const
-      {
-         VectorType v;
-         for( int j = 0; j < Size; j++ )
-            v[ j ] = ( *this )[ j ]->getData().getElement( i );
-         return v;
-      }
+   VectorType
+   getElement( const IndexType i ) const
+   {
+      VectorType v;
+      for( int j = 0; j < Size; j++ )
+         v[ j ] = ( *this )[ j ]->getData().getElement( i );
+      return v;
+   }
 
-      __cuda_callable__
-      VectorType getVector( const IndexType index ) const
-      {
-         VectorType v;
-         for( int i = 0; i < Size; i++ )
-            // FIXME: fix the dereferencing operator in smart pointers to be __cuda_callable__
-            v[ i ] = this->vectorField[ i ].template getData< Devices::Cuda >()[ index ];
-         return v;
-      }
+   __cuda_callable__
+   VectorType
+   getVector( const IndexType index ) const
+   {
+      VectorType v;
+      for( int i = 0; i < Size; i++ )
+         // FIXME: fix the dereferencing operator in smart pointers to be __cuda_callable__
+         v[ i ] = this->vectorField[ i ].template getData< Devices::Cuda >()[ index ];
+      return v;
+   }
 
-      template< typename EntityType >
-      void setValue( const EntityType& meshEntity,
-                     const FunctionType& value )
-      {
-         for(int i = 0; i < Size; i++ )
-            this->vectorfield[ i ].setValue( meshEntity.getIndex(), value[ i ] );
-      }
+   template< typename EntityType >
+   void
+   setValue( const EntityType& meshEntity, const FunctionType& value )
+   {
+      for( int i = 0; i < Size; i++ )
+         this->vectorfield[ i ].setValue( meshEntity.getIndex(), value[ i ] );
+   }
 
-      template< typename EntityType >
-      __cuda_callable__
-      VectorType getVector( const EntityType& meshEntity ) const
-      {
-         VectorType v;
-         for( int i = 0; i < Size; i++ )
-            // FIXME: fix the dereferencing operator in smart pointers to be __cuda_callable__
-            v[ i ] = this->vectorField[ i ].template getData< Devices::Cuda >()( meshEntity );
-         return v;
-      }
+   template< typename EntityType >
+   __cuda_callable__
+   VectorType
+   getVector( const EntityType& meshEntity ) const
+   {
+      VectorType v;
+      for( int i = 0; i < Size; i++ )
+         // FIXME: fix the dereferencing operator in smart pointers to be __cuda_callable__
+         v[ i ] = this->vectorField[ i ].template getData< Devices::Cuda >()( meshEntity );
+      return v;
+   }
 
-      bool write( const std::string& functionName,
-                  const std::string& fileName,
-                  const std::string& fileFormat = "auto" ) const
-      {
-         std::fstream file;
-         file.open( fileName, std::ios::out );
-         if( ! file )
-         {
-            std::cerr << "Unable to open a file " << fileName << "." << std::endl;
-            return false;
+   bool
+   write( const std::string& functionName, const std::string& fileName, const std::string& fileFormat = "auto" ) const
+   {
+      std::fstream file;
+      file.open( fileName, std::ios::out );
+      if( ! file ) {
+         std::cerr << "Unable to open a file " << fileName << "." << std::endl;
+         return false;
+      }
+
+      namespace fs = std::experimental::filesystem;
+      std::string format = fileFormat;
+      if( format == "auto" ) {
+         format = fs::path( fileName ).extension();
+         if( format.length() > 0 )
+            // remove dot from the extension
+            format = format.substr( 1 );
+      }
+
+      if( format == "vtk" || format == "vtu" || format == "vti" ) {
+         // copy all values from the vector field into a contiguous array
+         using BufferType = Containers::Array< typename VectorField::RealType, Devices::Host, IndexType >;
+         const IndexType entitiesCount = getMeshPointer()->template getEntitiesCount< getEntitiesDimension() >();
+         BufferType buffer( 3 * entitiesCount );
+         IndexType k = 0;
+         for( IndexType i = 0; i < entitiesCount; i++ ) {
+            const VectorType vector = getElement( i );
+            static_assert( getVectorDimension() <= 3, "VTK formats support only up to 3D vector fields." );
+            for( int j = 0; j < 3; j++ )
+               buffer[ k++ ] = ( j < vector.getSize() ? vector[ j ] : 0 );
          }
 
-         namespace fs = std::experimental::filesystem;
-         std::string format = fileFormat;
-         if( format == "auto" ) {
-            format = fs::path(fileName).extension();
-            if( format.length() > 0 )
-               // remove dot from the extension
-               format = format.substr(1);
+         if( format == "vtk" ) {
+            Meshes::Writers::VTKWriter< Mesh > writer( file );
+            writer.template writeEntities< getEntitiesDimension() >( *getMeshPointer() );
+            if( getEntitiesDimension() == 0 )
+               writer.writePointData( buffer, functionName, 3 );
+            else
+               writer.writeCellData( buffer, functionName, 3 );
          }
-
-         if( format == "vtk" || format == "vtu" || format == "vti" ) {
-            // copy all values from the vector field into a contiguous array
-            using BufferType = Containers::Array< typename VectorField::RealType, Devices::Host, IndexType >;
-            const IndexType entitiesCount = getMeshPointer()->template getEntitiesCount< getEntitiesDimension() >();
-            BufferType buffer( 3 * entitiesCount );
-            IndexType k = 0;
-            for( IndexType i = 0; i < entitiesCount; i++ ) {
-               const VectorType vector = getElement( i );
-               static_assert( getVectorDimension() <= 3, "VTK formats support only up to 3D vector fields." );
-               for( int j = 0; j < 3; j++ )
-                  buffer[ k++ ] = ( j < vector.getSize() ? vector[ j ] : 0 );
-            }
-
-            if( format == "vtk" ) {
-               Meshes::Writers::VTKWriter< Mesh > writer( file );
-               writer.template writeEntities< getEntitiesDimension() >( *getMeshPointer() );
-               if( getEntitiesDimension() == 0 )
-                  writer.writePointData( buffer, functionName, 3 );
-               else
-                  writer.writeCellData( buffer, functionName, 3 );
-            }
-            else if( format == "vtu" ) {
-               Meshes::Writers::VTUWriter< Mesh > writer( file );
-               writer.template writeEntities< getEntitiesDimension() >( *getMeshPointer() );
-               if( getEntitiesDimension() == 0 )
-                  writer.writePointData( buffer, functionName, 3 );
-               else
-                  writer.writeCellData( buffer, functionName, 3 );
-            }
-            else if( format == "vti" ) {
-               Meshes::Writers::VTIWriter< Mesh > writer( file );
-               writer.template writeEntities< getEntitiesDimension() >( *getMeshPointer() );
-               if( getEntitiesDimension() == 0 )
-                  writer.writePointData( buffer, functionName, 3 );
-               else
-                  writer.writeCellData( buffer, functionName, 3 );
-            }
+         else if( format == "vtu" ) {
+            Meshes::Writers::VTUWriter< Mesh > writer( file );
+            writer.template writeEntities< getEntitiesDimension() >( *getMeshPointer() );
+            if( getEntitiesDimension() == 0 )
+               writer.writePointData( buffer, functionName, 3 );
+            else
+               writer.writeCellData( buffer, functionName, 3 );
          }
-         else if( format == "gnuplot" || format == "gplt" || format == "plt" )
-            return VectorFieldGnuplotWriter< VectorField >::write( *this, file );
-         else {
-            std::cerr << "Unknown output format: " << format << std::endl;
-            return false;
+         else if( format == "vti" ) {
+            Meshes::Writers::VTIWriter< Mesh > writer( file );
+            writer.template writeEntities< getEntitiesDimension() >( *getMeshPointer() );
+            if( getEntitiesDimension() == 0 )
+               writer.writePointData( buffer, functionName, 3 );
+            else
+               writer.writeCellData( buffer, functionName, 3 );
          }
-         return true;
       }
+      else if( format == "gnuplot" || format == "gplt" || format == "plt" )
+         return VectorFieldGnuplotWriter< VectorField >::write( *this, file );
+      else {
+         std::cerr << "Unknown output format: " << format << std::endl;
+         return false;
+      }
+      return true;
+   }
 
-   protected:
-
-      Containers::StaticArray< Size, FunctionPointer > vectorField;
-
+protected:
+   Containers::StaticArray< Size, FunctionPointer > vectorField;
 };
 
-template< int Dimension,
-          typename Function >
-std::ostream& operator << ( std::ostream& str, const VectorField< Dimension, Function >& f )
+template< int Dimension, typename Function >
+std::ostream&
+operator<<( std::ostream& str, const VectorField< Dimension, Function >& f )
 {
-   for( int i = 0; i < Dimension; i++ )
-   {
+   for( int i = 0; i < Dimension; i++ ) {
       str << "[ " << f[ i ] << " ]";
       if( i < Dimension - 1 )
          str << ", ";
@@ -536,5 +548,5 @@ std::ostream& operator << ( std::ostream& str, const VectorField< Dimension, Fun
    return str;
 }
 
-} // namespace Functions
-} // namepsace TNL
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/VectorFieldEvaluator.h b/src/TNL/Functions/VectorFieldEvaluator.h
index 54e24a54ed7de2943a281132b82cbc0db4b611c0..aebecde8d4287bcbd0f22efdf3bac7490293793f 100644
--- a/src/TNL/Functions/VectorFieldEvaluator.h
+++ b/src/TNL/Functions/VectorFieldEvaluator.h
@@ -11,35 +11,28 @@
 #include <TNL/Functions/FunctionAdapter.h>
 
 namespace TNL {
-namespace Functions {   
+namespace Functions {
 
-template< typename OutVectorField,
-          typename InVectorField,
-          typename Real >
+template< typename OutVectorField, typename InVectorField, typename Real >
 class VectorFieldEvaluatorTraverserUserData
 {
-   public:
-      typedef InVectorField InVectorFieldType;
-
-      VectorFieldEvaluatorTraverserUserData( const InVectorField* inVectorField,
-                                             const Real& time,
-                                             OutVectorField* outVectorField,
-                                             const Real& outVectorFieldMultiplicator,
-                                             const Real& inVectorFieldMultiplicator )
-      : outVectorField( outVectorField ),
-        inVectorField( inVectorField ),
-        time( time ),
-        outVectorFieldMultiplicator( outVectorFieldMultiplicator ),
-        inVectorFieldMultiplicator( inVectorFieldMultiplicator )
-      {}
-
-      OutVectorField* outVectorField;
-      const InVectorField* inVectorField;
-      const Real time, outVectorFieldMultiplicator, inVectorFieldMultiplicator;
-
+public:
+   typedef InVectorField InVectorFieldType;
+
+   VectorFieldEvaluatorTraverserUserData( const InVectorField* inVectorField,
+                                          const Real& time,
+                                          OutVectorField* outVectorField,
+                                          const Real& outVectorFieldMultiplicator,
+                                          const Real& inVectorFieldMultiplicator )
+   : outVectorField( outVectorField ), inVectorField( inVectorField ), time( time ),
+     outVectorFieldMultiplicator( outVectorFieldMultiplicator ), inVectorFieldMultiplicator( inVectorFieldMultiplicator )
+   {}
+
+   OutVectorField* outVectorField;
+   const InVectorField* inVectorField;
+   const Real time, outVectorFieldMultiplicator, inVectorFieldMultiplicator;
 };
 
-
 /***
  * General vector field evaluator. As an input function any type implementing
  * getValue( meshEntity, time ) may be substituted.
@@ -49,121 +42,118 @@ class VectorFieldEvaluatorTraverserUserData
  *  evaluateInteriorEntities() - evaluate the input function only on the INTERIOR mesh entities
  *  evaluateBoundaryEntities() - evaluate the input function only on the BOUNDARY mesh entities
  */
-template< typename OutVectorField,
-          typename InVectorField >
+template< typename OutVectorField, typename InVectorField >
 class VectorFieldEvaluator
 {
    static_assert( OutVectorField::getDomainDimension() == InVectorField::getDomainDimension(),
                   "Input and output vector field must have the same domain dimensions." );
 
-   public:
-      typedef typename OutVectorField::RealType RealType;
-      typedef typename OutVectorField::MeshType MeshType;
-      typedef typename MeshType::DeviceType DeviceType;
-      typedef Functions::VectorFieldEvaluatorTraverserUserData< OutVectorField, InVectorField, RealType > TraverserUserData;
-
-      template< typename OutVectorFieldPointer, typename InVectorFieldPointer >
-      static void evaluate( OutVectorFieldPointer& meshFunction,
-                            const InVectorFieldPointer& function,
-                            const RealType& time = 0.0,
-                            const RealType& outFunctionMultiplicator = 0.0,
-                            const RealType& inFunctionMultiplicator = 1.0 );
-
-      template< typename OutVectorFieldPointer, typename InVectorFieldPointer >
-      static void evaluateAllEntities( OutVectorFieldPointer& meshFunction,
-                                       const InVectorFieldPointer& function,
-                                       const RealType& time = 0.0,
-                                       const RealType& outFunctionMultiplicator = 0.0,
-                                       const RealType& inFunctionMultiplicator = 1.0 );
- 
-      template< typename OutVectorFieldPointer, typename InVectorFieldPointer >
-      static void evaluateInteriorEntities( OutVectorFieldPointer& meshFunction,
-                                            const InVectorFieldPointer& function,
-                                            const RealType& time = 0.0,
-                                            const RealType& outFunctionMultiplicator = 0.0,
-                                            const RealType& inFunctionMultiplicator = 1.0 );
-
-      template< typename OutVectorFieldPointer, typename InVectorFieldPointer >
-      static void evaluateBoundaryEntities( OutVectorFieldPointer& meshFunction,
-                                            const InVectorFieldPointer& function,
-                                            const RealType& time = 0.0,
-                                            const RealType& outFunctionMultiplicator = 0.0,
-                                            const RealType& inFunctionMultiplicator = 1.0 );
-
-   protected:
-
-      enum EntitiesType { all, boundary, interior };
- 
-      template< typename OutVectorFieldPointer, typename InVectorFieldPointer >
-      static void evaluateEntities( OutVectorFieldPointer& meshFunction,
-                                    const InVectorFieldPointer& function,
-                                    const RealType& time,
-                                    const RealType& outFunctionMultiplicator,
-                                    const RealType& inFunctionMultiplicator,
-                                    EntitiesType entitiesType );
-
- 
+public:
+   typedef typename OutVectorField::RealType RealType;
+   typedef typename OutVectorField::MeshType MeshType;
+   typedef typename MeshType::DeviceType DeviceType;
+   typedef Functions::VectorFieldEvaluatorTraverserUserData< OutVectorField, InVectorField, RealType > TraverserUserData;
+
+   template< typename OutVectorFieldPointer, typename InVectorFieldPointer >
+   static void
+   evaluate( OutVectorFieldPointer& meshFunction,
+             const InVectorFieldPointer& function,
+             const RealType& time = 0.0,
+             const RealType& outFunctionMultiplicator = 0.0,
+             const RealType& inFunctionMultiplicator = 1.0 );
+
+   template< typename OutVectorFieldPointer, typename InVectorFieldPointer >
+   static void
+   evaluateAllEntities( OutVectorFieldPointer& meshFunction,
+                        const InVectorFieldPointer& function,
+                        const RealType& time = 0.0,
+                        const RealType& outFunctionMultiplicator = 0.0,
+                        const RealType& inFunctionMultiplicator = 1.0 );
+
+   template< typename OutVectorFieldPointer, typename InVectorFieldPointer >
+   static void
+   evaluateInteriorEntities( OutVectorFieldPointer& meshFunction,
+                             const InVectorFieldPointer& function,
+                             const RealType& time = 0.0,
+                             const RealType& outFunctionMultiplicator = 0.0,
+                             const RealType& inFunctionMultiplicator = 1.0 );
+
+   template< typename OutVectorFieldPointer, typename InVectorFieldPointer >
+   static void
+   evaluateBoundaryEntities( OutVectorFieldPointer& meshFunction,
+                             const InVectorFieldPointer& function,
+                             const RealType& time = 0.0,
+                             const RealType& outFunctionMultiplicator = 0.0,
+                             const RealType& inFunctionMultiplicator = 1.0 );
+
+protected:
+   enum EntitiesType
+   {
+      all,
+      boundary,
+      interior
+   };
+
+   template< typename OutVectorFieldPointer, typename InVectorFieldPointer >
+   static void
+   evaluateEntities( OutVectorFieldPointer& meshFunction,
+                     const InVectorFieldPointer& function,
+                     const RealType& time,
+                     const RealType& outFunctionMultiplicator,
+                     const RealType& inFunctionMultiplicator,
+                     EntitiesType entitiesType );
 };
 
-
-template< typename MeshType,
-          typename UserData >
+template< typename MeshType, typename UserData >
 class VectorFieldEvaluatorAssignmentEntitiesProcessor
 {
-   public:
-
-      template< typename EntityType >
-      __cuda_callable__
-      static inline void processEntity( const MeshType& mesh,
-                                        UserData& userData,
-                                        const EntityType& entity )
-      {
-         userData.outVectorField->setElement(
-            entity.getIndex(),
-            userData.inVectorFieldMultiplicator * ( *userData.inVectorField )( entity, userData.time ) );         
-         
-         /*typedef FunctionAdapter< MeshType, typename UserData::InVectorFieldType > FunctionAdapter;
-         ( *userData.meshFunction )( entity ) =
-            userData.inFunctionMultiplicator *
-            FunctionAdapter::getValue( *userData.function, entity, userData.time );*/
-         /*cerr << "Idx = " << entity.getIndex()
-            << " Value = " << FunctionAdapter::getValue( *userData.function, entity, userData.time )
-            << " stored value = " << ( *userData.meshFunction )( entity )
-            << " multiplicators = " << std::endl;*/
-      }
+public:
+   template< typename EntityType >
+   __cuda_callable__
+   static inline void
+   processEntity( const MeshType& mesh, UserData& userData, const EntityType& entity )
+   {
+      userData.outVectorField->setElement(
+         entity.getIndex(), userData.inVectorFieldMultiplicator * ( *userData.inVectorField )( entity, userData.time ) );
+
+      /*typedef FunctionAdapter< MeshType, typename UserData::InVectorFieldType > FunctionAdapter;
+      ( *userData.meshFunction )( entity ) =
+         userData.inFunctionMultiplicator *
+         FunctionAdapter::getValue( *userData.function, entity, userData.time );*/
+      /*cerr << "Idx = " << entity.getIndex()
+         << " Value = " << FunctionAdapter::getValue( *userData.function, entity, userData.time )
+         << " stored value = " << ( *userData.meshFunction )( entity )
+         << " multiplicators = " << std::endl;*/
+   }
 };
 
-template< typename MeshType,
-          typename UserData >
+template< typename MeshType, typename UserData >
 class VectorFieldEvaluatorAdditionEntitiesProcessor
 {
-   public:
-
-      template< typename EntityType >
-      __cuda_callable__
-      static inline void processEntity( const MeshType& mesh,
-                                        UserData& userData,
-                                        const EntityType& entity )
-      {
-         const auto& i = entity.getIndex();
-         const auto v = userData.outVectorFieldMultiplicator * userData.outVectorField->getElement( i );
-         userData.outVectorField->setElement(
-            i,
-            v + userData.inVectorFieldMultiplicator * ( *userData.inVectorField )( entity, userData.time ) );
-         
-         /*typedef FunctionAdapter< MeshType, typename UserData::InVectorFieldType > FunctionAdapter;
-         ( *userData.meshFunction )( entity ) =
-            userData.outFunctionMultiplicator * ( *userData.meshFunction )( entity ) +
-            userData.inFunctionMultiplicator *
-            FunctionAdapter::getValue( *userData.function, entity, userData.time );*/
-         /*cerr << "Idx = " << entity.getIndex()
-            << " Value = " << FunctionAdapter::getValue( *userData.function, entity, userData.time )
-            << " stored value = " << ( *userData.meshFunction )( entity )
-            << " multiplicators = " << std::endl;*/
-      }
+public:
+   template< typename EntityType >
+   __cuda_callable__
+   static inline void
+   processEntity( const MeshType& mesh, UserData& userData, const EntityType& entity )
+   {
+      const auto& i = entity.getIndex();
+      const auto v = userData.outVectorFieldMultiplicator * userData.outVectorField->getElement( i );
+      userData.outVectorField->setElement(
+         i, v + userData.inVectorFieldMultiplicator * ( *userData.inVectorField )( entity, userData.time ) );
+
+      /*typedef FunctionAdapter< MeshType, typename UserData::InVectorFieldType > FunctionAdapter;
+      ( *userData.meshFunction )( entity ) =
+         userData.outFunctionMultiplicator * ( *userData.meshFunction )( entity ) +
+         userData.inFunctionMultiplicator *
+         FunctionAdapter::getValue( *userData.function, entity, userData.time );*/
+      /*cerr << "Idx = " << entity.getIndex()
+         << " Value = " << FunctionAdapter::getValue( *userData.function, entity, userData.time )
+         << " stored value = " << ( *userData.meshFunction )( entity )
+         << " multiplicators = " << std::endl;*/
+   }
 };
 
-} // namespace Functions
-} // namespace TNL
+}  // namespace Functions
+}  // namespace TNL
 
 #include <TNL/Functions/VectorFieldEvaluator_impl.h>
diff --git a/src/TNL/Functions/VectorFieldEvaluator_impl.h b/src/TNL/Functions/VectorFieldEvaluator_impl.h
index 3edf6e81a17f914aad88e7333138a459b66a9b59..b4b09f06950c017f9de253232bf3a58c0b073d5b 100644
--- a/src/TNL/Functions/VectorFieldEvaluator_impl.h
+++ b/src/TNL/Functions/VectorFieldEvaluator_impl.h
@@ -10,24 +10,24 @@
 #include <TNL/Meshes/Traverser.h>
 
 namespace TNL {
-namespace Functions {   
+namespace Functions {
 
-template< typename OutVectorField,
-          typename InVectorField >
-   template< typename OutVectorFieldPointer, typename InVectorFieldPointer >
+template< typename OutVectorField, typename InVectorField >
+template< typename OutVectorFieldPointer, typename InVectorFieldPointer >
 void
-VectorFieldEvaluator< OutVectorField, InVectorField >::
-evaluate( OutVectorFieldPointer& meshFunction,
-          const InVectorFieldPointer& function,
-          const RealType& time,
-          const RealType& outFunctionMultiplicator,
-          const RealType& inFunctionMultiplicator )
+VectorFieldEvaluator< OutVectorField, InVectorField >::evaluate( OutVectorFieldPointer& meshFunction,
+                                                                 const InVectorFieldPointer& function,
+                                                                 const RealType& time,
+                                                                 const RealType& outFunctionMultiplicator,
+                                                                 const RealType& inFunctionMultiplicator )
 {
-   static_assert( std::is_same< typename std::decay< typename OutVectorFieldPointer::ObjectType >::type, OutVectorField >::value, "expected a smart pointer" );
-   static_assert( std::is_same< typename std::decay< typename InVectorFieldPointer::ObjectType >::type, InVectorField >::value, "expected a smart pointer" );
+   static_assert(
+      std::is_same< typename std::decay< typename OutVectorFieldPointer::ObjectType >::type, OutVectorField >::value,
+      "expected a smart pointer" );
+   static_assert( std::is_same< typename std::decay< typename InVectorFieldPointer::ObjectType >::type, InVectorField >::value,
+                  "expected a smart pointer" );
 
-   switch( InVectorField::getDomainType() )
-   {
+   switch( InVectorField::getDomainType() ) {
       case NonspaceDomain:
       case SpaceDomain:
       case MeshDomain:
@@ -42,128 +42,116 @@ evaluate( OutVectorFieldPointer& meshFunction,
    }
 }
 
-
-template< typename OutVectorField,
-          typename InVectorField >
-   template< typename OutVectorFieldPointer, typename InVectorFieldPointer >
+template< typename OutVectorField, typename InVectorField >
+template< typename OutVectorFieldPointer, typename InVectorFieldPointer >
 void
-VectorFieldEvaluator< OutVectorField, InVectorField >::
-evaluateAllEntities( OutVectorFieldPointer& meshFunction,
-                     const InVectorFieldPointer& function,
-                     const RealType& time,
-                     const RealType& outFunctionMultiplicator,
-                     const RealType& inFunctionMultiplicator )
+VectorFieldEvaluator< OutVectorField, InVectorField >::evaluateAllEntities( OutVectorFieldPointer& meshFunction,
+                                                                            const InVectorFieldPointer& function,
+                                                                            const RealType& time,
+                                                                            const RealType& outFunctionMultiplicator,
+                                                                            const RealType& inFunctionMultiplicator )
 {
-   static_assert( std::is_same< typename std::decay< typename OutVectorFieldPointer::ObjectType >::type, OutVectorField >::value, "expected a smart pointer" );
-   static_assert( std::is_same< typename std::decay< typename InVectorFieldPointer::ObjectType >::type, InVectorField >::value, "expected a smart pointer" );
+   static_assert(
+      std::is_same< typename std::decay< typename OutVectorFieldPointer::ObjectType >::type, OutVectorField >::value,
+      "expected a smart pointer" );
+   static_assert( std::is_same< typename std::decay< typename InVectorFieldPointer::ObjectType >::type, InVectorField >::value,
+                  "expected a smart pointer" );
 
    return evaluateEntities( meshFunction, function, time, outFunctionMultiplicator, inFunctionMultiplicator, all );
 }
 
-template< typename OutVectorField,
-          typename InVectorField >
-   template< typename OutVectorFieldPointer, typename InVectorFieldPointer >
+template< typename OutVectorField, typename InVectorField >
+template< typename OutVectorFieldPointer, typename InVectorFieldPointer >
 void
-VectorFieldEvaluator< OutVectorField, InVectorField >::
-evaluateInteriorEntities( OutVectorFieldPointer& meshFunction,
-                          const InVectorFieldPointer& function,
-                          const RealType& time,
-                          const RealType& outFunctionMultiplicator,
-                          const RealType& inFunctionMultiplicator )
+VectorFieldEvaluator< OutVectorField, InVectorField >::evaluateInteriorEntities( OutVectorFieldPointer& meshFunction,
+                                                                                 const InVectorFieldPointer& function,
+                                                                                 const RealType& time,
+                                                                                 const RealType& outFunctionMultiplicator,
+                                                                                 const RealType& inFunctionMultiplicator )
 {
-   static_assert( std::is_same< typename std::decay< typename OutVectorFieldPointer::ObjectType >::type, OutVectorField >::value, "expected a smart pointer" );
-   static_assert( std::is_same< typename std::decay< typename InVectorFieldPointer::ObjectType >::type, InVectorField >::value, "expected a smart pointer" );
+   static_assert(
+      std::is_same< typename std::decay< typename OutVectorFieldPointer::ObjectType >::type, OutVectorField >::value,
+      "expected a smart pointer" );
+   static_assert( std::is_same< typename std::decay< typename InVectorFieldPointer::ObjectType >::type, InVectorField >::value,
+                  "expected a smart pointer" );
 
    return evaluateEntities( meshFunction, function, time, outFunctionMultiplicator, inFunctionMultiplicator, interior );
 }
 
-template< typename OutVectorField,
-          typename InVectorField >
-   template< typename OutVectorFieldPointer, typename InVectorFieldPointer >
+template< typename OutVectorField, typename InVectorField >
+template< typename OutVectorFieldPointer, typename InVectorFieldPointer >
 void
-VectorFieldEvaluator< OutVectorField, InVectorField >::
-evaluateBoundaryEntities( OutVectorFieldPointer& meshFunction,
-                          const InVectorFieldPointer& function,
-                          const RealType& time,
-                          const RealType& outFunctionMultiplicator,
-                          const RealType& inFunctionMultiplicator )
+VectorFieldEvaluator< OutVectorField, InVectorField >::evaluateBoundaryEntities( OutVectorFieldPointer& meshFunction,
+                                                                                 const InVectorFieldPointer& function,
+                                                                                 const RealType& time,
+                                                                                 const RealType& outFunctionMultiplicator,
+                                                                                 const RealType& inFunctionMultiplicator )
 {
-   static_assert( std::is_same< typename std::decay< typename OutVectorFieldPointer::ObjectType >::type, OutVectorField >::value, "expected a smart pointer" );
-   static_assert( std::is_same< typename std::decay< typename InVectorFieldPointer::ObjectType >::type, InVectorField >::value, "expected a smart pointer" );
+   static_assert(
+      std::is_same< typename std::decay< typename OutVectorFieldPointer::ObjectType >::type, OutVectorField >::value,
+      "expected a smart pointer" );
+   static_assert( std::is_same< typename std::decay< typename InVectorFieldPointer::ObjectType >::type, InVectorField >::value,
+                  "expected a smart pointer" );
 
    return evaluateEntities( meshFunction, function, time, outFunctionMultiplicator, inFunctionMultiplicator, boundary );
 }
 
-
-
-template< typename OutVectorField,
-          typename InVectorField >
-   template< typename OutVectorFieldPointer, typename InVectorFieldPointer >
+template< typename OutVectorField, typename InVectorField >
+template< typename OutVectorFieldPointer, typename InVectorFieldPointer >
 void
-VectorFieldEvaluator< OutVectorField, InVectorField >::
-evaluateEntities( OutVectorFieldPointer& meshFunction,
-                  const InVectorFieldPointer& function,
-                  const RealType& time,
-                  const RealType& outFunctionMultiplicator,
-                  const RealType& inFunctionMultiplicator,
-                  EntitiesType entitiesType )
+VectorFieldEvaluator< OutVectorField, InVectorField >::evaluateEntities( OutVectorFieldPointer& meshFunction,
+                                                                         const InVectorFieldPointer& function,
+                                                                         const RealType& time,
+                                                                         const RealType& outFunctionMultiplicator,
+                                                                         const RealType& inFunctionMultiplicator,
+                                                                         EntitiesType entitiesType )
 {
-   static_assert( std::is_same< typename std::decay< typename OutVectorFieldPointer::ObjectType >::type, OutVectorField >::value, "expected a smart pointer" );
-   static_assert( std::is_same< typename std::decay< typename InVectorFieldPointer::ObjectType >::type, InVectorField >::value, "expected a smart pointer" );
+   static_assert(
+      std::is_same< typename std::decay< typename OutVectorFieldPointer::ObjectType >::type, OutVectorField >::value,
+      "expected a smart pointer" );
+   static_assert( std::is_same< typename std::decay< typename InVectorFieldPointer::ObjectType >::type, InVectorField >::value,
+                  "expected a smart pointer" );
 
    typedef typename MeshType::template EntityType< OutVectorField::getEntitiesDimension() > MeshEntityType;
-   typedef Functions::VectorFieldEvaluatorAssignmentEntitiesProcessor< MeshType, TraverserUserData > AssignmentEntitiesProcessor;
+   typedef Functions::VectorFieldEvaluatorAssignmentEntitiesProcessor< MeshType, TraverserUserData >
+      AssignmentEntitiesProcessor;
    typedef Functions::VectorFieldEvaluatorAdditionEntitiesProcessor< MeshType, TraverserUserData > AdditionEntitiesProcessor;
-   //typedef typename OutVectorField::MeshPointer OutMeshPointer;
+   // typedef typename OutVectorField::MeshPointer OutMeshPointer;
    typedef Pointers::SharedPointer< TraverserUserData, DeviceType > TraverserUserDataPointer;
-   
-   SharedPointer< TraverserUserData, DeviceType >
-      userData( &function.template getData< DeviceType >(),
-                time,
-                &meshFunction.template modifyData< DeviceType >(),
-                outFunctionMultiplicator,
-                inFunctionMultiplicator );
+
+   SharedPointer< TraverserUserData, DeviceType > userData( &function.template getData< DeviceType >(),
+                                                            time,
+                                                            &meshFunction.template modifyData< DeviceType >(),
+                                                            outFunctionMultiplicator,
+                                                            inFunctionMultiplicator );
    Meshes::Traverser< MeshType, MeshEntityType > meshTraverser;
-   switch( entitiesType )
-   {
+   switch( entitiesType ) {
       case all:
          if( outFunctionMultiplicator )
-            meshTraverser.template processAllEntities< TraverserUserData,
-                                                       AdditionEntitiesProcessor >
-                                                     ( meshFunction->getMeshPointer(),
-                                                       userData );
+            meshTraverser.template processAllEntities< TraverserUserData, AdditionEntitiesProcessor >(
+               meshFunction->getMeshPointer(), userData );
          else
-            meshTraverser.template processAllEntities< TraverserUserData,
-                                                       AssignmentEntitiesProcessor >
-                                                    ( meshFunction->getMeshPointer(),
-                                                      userData );
+            meshTraverser.template processAllEntities< TraverserUserData, AssignmentEntitiesProcessor >(
+               meshFunction->getMeshPointer(), userData );
          break;
       case interior:
          if( outFunctionMultiplicator )
-            meshTraverser.template processInteriorEntities< TraverserUserData,
-                                                            AdditionEntitiesProcessor >
-                                                          ( meshFunction->getMeshPointer(),
-                                                            userData );
+            meshTraverser.template processInteriorEntities< TraverserUserData, AdditionEntitiesProcessor >(
+               meshFunction->getMeshPointer(), userData );
          else
-            meshTraverser.template processInteriorEntities< TraverserUserData,
-                                                            AssignmentEntitiesProcessor >
-                                                          ( meshFunction->getMeshPointer(),
-                                                            userData );
+            meshTraverser.template processInteriorEntities< TraverserUserData, AssignmentEntitiesProcessor >(
+               meshFunction->getMeshPointer(), userData );
          break;
       case boundary:
          if( outFunctionMultiplicator )
-            meshTraverser.template processBoundaryEntities< TraverserUserData,
-                                                            AdditionEntitiesProcessor >
-                                                          ( meshFunction->getMeshPointer(),
-                                                            userData );
+            meshTraverser.template processBoundaryEntities< TraverserUserData, AdditionEntitiesProcessor >(
+               meshFunction->getMeshPointer(), userData );
          else
-            meshTraverser.template processBoundaryEntities< TraverserUserData,
-                                                            AssignmentEntitiesProcessor >
-                                                          ( meshFunction->getMeshPointer(),
-                                                            userData );
+            meshTraverser.template processBoundaryEntities< TraverserUserData, AssignmentEntitiesProcessor >(
+               meshFunction->getMeshPointer(), userData );
          break;
    }
 }
 
-} // namespace Functions
-} // namespace TNL
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Functions/VectorFieldGnuplotWriter.h b/src/TNL/Functions/VectorFieldGnuplotWriter.h
index dea9edc005549b1274f73b174503e90849e86166..161fbf27aea80bfbca6674cd5724014aaf9a9a89 100644
--- a/src/TNL/Functions/VectorFieldGnuplotWriter.h
+++ b/src/TNL/Functions/VectorFieldGnuplotWriter.h
@@ -11,172 +11,148 @@
 namespace TNL {
 namespace Functions {
 
-template< int, typename > class VectorField;
-template< typename, int, typename > class MeshFunction;
+template< int, typename >
+class VectorField;
+template< typename, int, typename >
+class MeshFunction;
 
 template< typename VectorField >
 class VectorFieldGnuplotWriter
 {
 public:
-   static bool write( const VectorField& function,
-                      std::ostream& str );
+   static bool
+   write( const VectorField& function, std::ostream& str );
 };
 
 /***
  * 1D grids cells
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          int VectorFieldSize >
-class VectorFieldGnuplotWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 1, Real > > >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, int VectorFieldSize >
+class VectorFieldGnuplotWriter<
+   VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 1, Real > > >
 {
 public:
    using MeshType = Meshes::Grid< 1, MeshReal, Device, MeshIndex >;
    using RealType = Real;
    using VectorFieldType = Functions::VectorField< VectorFieldSize, MeshFunction< MeshType, 1, RealType > >;
 
-   static bool write( const VectorFieldType& function,
-                      std::ostream& str );
+   static bool
+   write( const VectorFieldType& function, std::ostream& str );
 };
 
 /***
  * 1D grids vertices
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          int VectorFieldSize >
-class VectorFieldGnuplotWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 0, Real > > >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, int VectorFieldSize >
+class VectorFieldGnuplotWriter<
+   VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 0, Real > > >
 {
 public:
    using MeshType = Meshes::Grid< 1, MeshReal, Device, MeshIndex >;
    using RealType = Real;
    using VectorFieldType = Functions::VectorField< VectorFieldSize, MeshFunction< MeshType, 0, RealType > >;
 
-   static bool write( const VectorFieldType& function,
-                      std::ostream& str );
+   static bool
+   write( const VectorFieldType& function, std::ostream& str );
 };
 
-
 /***
  * 2D grids cells
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          int VectorFieldSize >
-class VectorFieldGnuplotWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 2, Real > > >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, int VectorFieldSize >
+class VectorFieldGnuplotWriter<
+   VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 2, Real > > >
 {
 public:
    using MeshType = Meshes::Grid< 2, MeshReal, Device, MeshIndex >;
    using RealType = Real;
    using VectorFieldType = Functions::VectorField< VectorFieldSize, MeshFunction< MeshType, 2, RealType > >;
 
-   static bool write( const VectorFieldType& function,
-                      std::ostream& str );
+   static bool
+   write( const VectorFieldType& function, std::ostream& str );
 };
 
 /***
  * 2D grids faces
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          int VectorFieldSize >
-class VectorFieldGnuplotWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 1, Real > > >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, int VectorFieldSize >
+class VectorFieldGnuplotWriter<
+   VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 1, Real > > >
 {
 public:
    using MeshType = Meshes::Grid< 2, MeshReal, Device, MeshIndex >;
    using RealType = Real;
    using VectorFieldType = Functions::VectorField< VectorFieldSize, MeshFunction< MeshType, 1, RealType > >;
 
-   static bool write( const VectorFieldType& function,
-                      std::ostream& str );
+   static bool
+   write( const VectorFieldType& function, std::ostream& str );
 };
 
 /***
  * 2D grids vertices
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          int VectorFieldSize >
-class VectorFieldGnuplotWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 0, Real > > >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, int VectorFieldSize >
+class VectorFieldGnuplotWriter<
+   VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 0, Real > > >
 {
 public:
    using MeshType = Meshes::Grid< 2, MeshReal, Device, MeshIndex >;
    using RealType = Real;
    using VectorFieldType = Functions::VectorField< VectorFieldSize, MeshFunction< MeshType, 0, RealType > >;
 
-   static bool write( const VectorFieldType& function,
-                      std::ostream& str );
+   static bool
+   write( const VectorFieldType& function, std::ostream& str );
 };
 
-
 /***
  * 3D grids cells
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          int VectorFieldSize >
-class VectorFieldGnuplotWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 3, Real > > >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, int VectorFieldSize >
+class VectorFieldGnuplotWriter<
+   VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 3, Real > > >
 {
 public:
    using MeshType = Meshes::Grid< 3, MeshReal, Device, MeshIndex >;
    using RealType = Real;
    using VectorFieldType = Functions::VectorField< VectorFieldSize, MeshFunction< MeshType, 3, RealType > >;
 
-   static bool write( const VectorFieldType& function,
-                      std::ostream& str );
+   static bool
+   write( const VectorFieldType& function, std::ostream& str );
 };
 
 /***
  * 3D grids faces
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          int VectorFieldSize >
-class VectorFieldGnuplotWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 2, Real > > >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, int VectorFieldSize >
+class VectorFieldGnuplotWriter<
+   VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 2, Real > > >
 {
 public:
    using MeshType = Meshes::Grid< 3, MeshReal, Device, MeshIndex >;
    using RealType = Real;
    using VectorFieldType = Functions::VectorField< VectorFieldSize, MeshFunction< MeshType, 2, RealType > >;
 
-   static bool write( const VectorFieldType& function,
-                      std::ostream& str );
+   static bool
+   write( const VectorFieldType& function, std::ostream& str );
 };
 
 /***
  * 3D grids vertices
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          int VectorFieldSize >
-class VectorFieldGnuplotWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 0, Real > > >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, int VectorFieldSize >
+class VectorFieldGnuplotWriter<
+   VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 0, Real > > >
 {
 public:
    using MeshType = Meshes::Grid< 3, MeshReal, Device, MeshIndex >;
    using RealType = Real;
    using VectorFieldType = Functions::VectorField< VectorFieldSize, MeshFunction< MeshType, 0, RealType > >;
 
-   static bool write( const VectorFieldType& function,
-                      std::ostream& str );
+   static bool
+   write( const VectorFieldType& function, std::ostream& str );
 };
 
-} // namespace Functions
-} // namespace TNL
+}  // namespace Functions
+}  // namespace TNL
 
 #include <TNL/Functions/VectorFieldGnuplotWriter_impl.h>
diff --git a/src/TNL/Functions/VectorFieldGnuplotWriter_impl.h b/src/TNL/Functions/VectorFieldGnuplotWriter_impl.h
index 0f1bc4bf19c1bbb0bb3755af14f0adefc9f60d71..a1d786c522c7b8f6a3d8a5821e74dd00dbf52385 100644
--- a/src/TNL/Functions/VectorFieldGnuplotWriter_impl.h
+++ b/src/TNL/Functions/VectorFieldGnuplotWriter_impl.h
@@ -14,37 +14,31 @@ namespace Functions {
 
 template< typename VectorField >
 bool
-VectorFieldGnuplotWriter< VectorField >::
-write( const VectorField& vectorField,
-       std::ostream& str )
+VectorFieldGnuplotWriter< VectorField >::write( const VectorField& vectorField, std::ostream& str )
 {
-   std::cerr << "Gnuplot writer for mesh vectorFields defined on mesh type " << getType< typename VectorField::MeshType >() << " is not (yet) implemented." << std::endl;
+   std::cerr << "Gnuplot writer for mesh vectorFields defined on mesh type " << getType< typename VectorField::MeshType >()
+             << " is not (yet) implemented." << std::endl;
    return false;
 }
 
 /****
  * 1D grid, cells
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          int VectorFieldSize >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, int VectorFieldSize >
 bool
-VectorFieldGnuplotWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 1, Real > > >::
-write( const VectorFieldType& vectorField,
-       std::ostream& str )
+VectorFieldGnuplotWriter<
+   VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 1, Real > > >::
+   write( const VectorFieldType& vectorField, std::ostream& str )
 {
    const MeshType& mesh = vectorField.getMesh();
    typename MeshType::Cell entity( mesh );
    auto& c = entity.getCoordinates();
-   for( c.x() = 0; c.x() < mesh.getDimensions().x(); c.x()++ )
-   {
+   for( c.x() = 0; c.x() < mesh.getDimensions().x(); c.x()++ ) {
       entity.refresh();
       typename MeshType::PointType v = entity.getCenter();
       str << v.x();
       for( int i = 0; i < VectorFieldSize; i++ )
-          str << " " << vectorField[ i ]->getData().getElement( entity.getIndex() );
+         str << " " << vectorField[ i ]->getData().getElement( entity.getIndex() );
       str << std::endl;
    }
    return true;
@@ -53,57 +47,45 @@ write( const VectorFieldType& vectorField,
 /****
  * 1D grid, vertices
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          int VectorFieldSize >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, int VectorFieldSize >
 bool
-VectorFieldGnuplotWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 0, Real > > >::
-write( const VectorFieldType& vectorField,
-       std::ostream& str )
+VectorFieldGnuplotWriter<
+   VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 0, Real > > >::
+   write( const VectorFieldType& vectorField, std::ostream& str )
 {
    const MeshType& mesh = vectorField.getMesh();
    typename MeshType::Vertex entity( mesh );
    auto& c = entity.getCoordinates();
-   for( c.x() = 0; c.x() <= mesh.getDimensions().x(); c.x()++ )
-   {
+   for( c.x() = 0; c.x() <= mesh.getDimensions().x(); c.x()++ ) {
       entity.refresh();
       typename MeshType::PointType v = entity.getCenter();
       str << v.x();
       for( int i = 0; i < VectorFieldSize; i++ )
-          str << " " << vectorField[ i ]->getData().getElement( entity.getIndex() );
+         str << " " << vectorField[ i ]->getData().getElement( entity.getIndex() );
       str << std::endl;
    }
    return true;
 }
 
-
 /****
  * 2D grid, cells
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          int VectorFieldSize >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, int VectorFieldSize >
 bool
-VectorFieldGnuplotWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 2, Real > > >::
-write( const VectorFieldType& vectorField,
-       std::ostream& str )
+VectorFieldGnuplotWriter<
+   VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 2, Real > > >::
+   write( const VectorFieldType& vectorField, std::ostream& str )
 {
    const MeshType& mesh = vectorField.getMesh();
    typename MeshType::Cell entity( mesh );
    auto& c = entity.getCoordinates();
-   for( c.y() = 0; c.y() < mesh.getDimensions().y(); c.y()++ )
-   {
-      for( c.x() = 0; c.x() < mesh.getDimensions().x(); c.x()++ )
-      {
+   for( c.y() = 0; c.y() < mesh.getDimensions().y(); c.y()++ ) {
+      for( c.x() = 0; c.x() < mesh.getDimensions().x(); c.x()++ ) {
          entity.refresh();
          typename MeshType::PointType v = entity.getCenter();
          str << v.x() << " " << v.y();
          for( int i = 0; i < VectorFieldSize; i++ )
-             str << " " << vectorField[ i ]->getData().getElement( entity.getIndex() );
+            str << " " << vectorField[ i ]->getData().getElement( entity.getIndex() );
          str << std::endl;
       }
       str << std::endl;
@@ -114,15 +96,11 @@ write( const VectorFieldType& vectorField,
 /****
  * 2D grid, faces
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          int VectorFieldSize >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, int VectorFieldSize >
 bool
-VectorFieldGnuplotWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 1, Real > > >::
-write( const VectorFieldType& vectorField,
-       std::ostream& str )
+VectorFieldGnuplotWriter<
+   VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 1, Real > > >::
+   write( const VectorFieldType& vectorField, std::ostream& str )
 {
    const MeshType& mesh = vectorField.getMesh();
    typedef typename MeshType::Face EntityType;
@@ -131,30 +109,26 @@ write( const VectorFieldType& vectorField,
    auto& c = entity.getCoordinates();
 
    entity.setOrientation( EntityOrientation( 1.0, 0.0 ) );
-   for( c.y() = 0; c.y() < mesh.getDimensions().y(); c.y()++ )
-   {
-      for( c.x() = 0; c.x() <= mesh.getDimensions().x(); c.x()++ )
-      {
+   for( c.y() = 0; c.y() < mesh.getDimensions().y(); c.y()++ ) {
+      for( c.x() = 0; c.x() <= mesh.getDimensions().x(); c.x()++ ) {
          entity.refresh();
          typename MeshType::PointType v = entity.getCenter();
          str << v.x() << " " << v.y();
          for( int i = 0; i < VectorFieldSize; i++ )
-             str << " " << vectorField[ i ]->getData().getElement( entity.getIndex() );
+            str << " " << vectorField[ i ]->getData().getElement( entity.getIndex() );
          str << std::endl;
       }
       str << std::endl;
    }
 
    entity.setOrientation( EntityOrientation( 0.0, 1.0 ) );
-   for( c.x() = 0; c.x() < mesh.getDimensions().x(); c.x()++ )
-   {
-      for( c.y() = 0; c.y() <= mesh.getDimensions().y(); c.y()++ )
-      {
+   for( c.x() = 0; c.x() < mesh.getDimensions().x(); c.x()++ ) {
+      for( c.y() = 0; c.y() <= mesh.getDimensions().y(); c.y()++ ) {
          entity.refresh();
          typename MeshType::PointType v = entity.getCenter();
          str << v.x() << " " << v.y();
          for( int i = 0; i < VectorFieldSize; i++ )
-             str << " " << vectorField[ i ]->getData().getElement( entity.getIndex() );
+            str << " " << vectorField[ i ]->getData().getElement( entity.getIndex() );
          str << std::endl;
       }
       str << std::endl;
@@ -162,32 +136,25 @@ write( const VectorFieldType& vectorField,
    return true;
 }
 
-
 /****
  * 2D grid, vertices
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          int VectorFieldSize >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, int VectorFieldSize >
 bool
-VectorFieldGnuplotWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 0, Real > > >::
-write( const VectorFieldType& vectorField,
-       std::ostream& str )
+VectorFieldGnuplotWriter<
+   VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 0, Real > > >::
+   write( const VectorFieldType& vectorField, std::ostream& str )
 {
    const MeshType& mesh = vectorField.getMesh();
    typename MeshType::Vertex entity( mesh );
    auto& c = entity.getCoordinates();
-   for( c.y() = 0; c.y() <= mesh.getDimensions().y(); c.y()++ )
-   {
-      for( c.x() = 0; c.x() <= mesh.getDimensions().x(); c.x()++ )
-      {
+   for( c.y() = 0; c.y() <= mesh.getDimensions().y(); c.y()++ ) {
+      for( c.x() = 0; c.x() <= mesh.getDimensions().x(); c.x()++ ) {
          entity.refresh();
          typename MeshType::PointType v = entity.getCenter();
          str << v.x() << " " << v.y();
          for( int i = 0; i < VectorFieldSize; i++ )
-             str << " " << vectorField[ i ]->getData().getElement( entity.getIndex() );
+            str << " " << vectorField[ i ]->getData().getElement( entity.getIndex() );
          str << std::endl;
       }
       str << std::endl;
@@ -195,33 +162,26 @@ write( const VectorFieldType& vectorField,
    return true;
 }
 
-
 /****
  * 3D grid, cells
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          int VectorFieldSize >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, int VectorFieldSize >
 bool
-VectorFieldGnuplotWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 3, Real > > >::
-write( const VectorFieldType& vectorField,
-       std::ostream& str )
+VectorFieldGnuplotWriter<
+   VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 3, Real > > >::
+   write( const VectorFieldType& vectorField, std::ostream& str )
 {
    const MeshType& mesh = vectorField.getMesh();
    typename MeshType::Cell entity( mesh );
    auto& c = entity.getCoordinates();
    for( c.z() = 0; c.z() < mesh.getDimensions().z(); c.z()++ )
-      for( c.y() = 0; c.y() < mesh.getDimensions().y(); c.y()++ )
-      {
-         for( c.x() = 0; c.x() < mesh.getDimensions().x(); c.x()++ )
-         {
+      for( c.y() = 0; c.y() < mesh.getDimensions().y(); c.y()++ ) {
+         for( c.x() = 0; c.x() < mesh.getDimensions().x(); c.x()++ ) {
             entity.refresh();
             typename MeshType::PointType v = entity.getCenter();
             str << v.x() << " " << v.y() << " " << v.z();
             for( int i = 0; i < VectorFieldSize; i++ )
-                str << " " << vectorField[ i ]->getData().getElement( entity.getIndex() );
+               str << " " << vectorField[ i ]->getData().getElement( entity.getIndex() );
             str << std::endl;
          }
          str << std::endl;
@@ -232,15 +192,11 @@ write( const VectorFieldType& vectorField,
 /****
  * 3D grid, faces
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          int VectorFieldSize >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, int VectorFieldSize >
 bool
-VectorFieldGnuplotWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 2, Real > > >::
-write( const VectorFieldType& vectorField,
-       std::ostream& str )
+VectorFieldGnuplotWriter<
+   VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 2, Real > > >::
+   write( const VectorFieldType& vectorField, std::ostream& str )
 {
    const MeshType& mesh = vectorField.getMesh();
    typedef typename MeshType::Face EntityType;
@@ -250,15 +206,13 @@ write( const VectorFieldType& vectorField,
 
    entity.setOrientation( EntityOrientation( 1.0, 0.0, 0.0 ) );
    for( c.z() = 0; c.z() < mesh.getDimensions().z(); c.z()++ )
-      for( c.y() = 0; c.y() < mesh.getDimensions().y(); c.y()++ )
-      {
-         for( c.x() = 0; c.x() <= mesh.getDimensions().x(); c.x()++ )
-         {
+      for( c.y() = 0; c.y() < mesh.getDimensions().y(); c.y()++ ) {
+         for( c.x() = 0; c.x() <= mesh.getDimensions().x(); c.x()++ ) {
             entity.refresh();
             typename MeshType::PointType v = entity.getCenter();
             str << v.x() << " " << v.y() << " " << v.z();
             for( int i = 0; i < VectorFieldSize; i++ )
-                str << " " << vectorField[ i ]->getData().getElement( entity.getIndex() );
+               str << " " << vectorField[ i ]->getData().getElement( entity.getIndex() );
             str << std::endl;
          }
          str << std::endl;
@@ -266,15 +220,13 @@ write( const VectorFieldType& vectorField,
 
    entity.setOrientation( EntityOrientation( 0.0, 1.0, 0.0 ) );
    for( c.z() = 0; c.z() < mesh.getDimensions().z(); c.z()++ )
-      for( c.x() = 0; c.x() < mesh.getDimensions().x(); c.x()++ )
-      {
-         for( c.y() = 0; c.y() <= mesh.getDimensions().y(); c.y()++ )
-         {
+      for( c.x() = 0; c.x() < mesh.getDimensions().x(); c.x()++ ) {
+         for( c.y() = 0; c.y() <= mesh.getDimensions().y(); c.y()++ ) {
             entity.refresh();
             typename MeshType::PointType v = entity.getCenter();
             str << v.x() << " " << v.y() << " " << v.z();
             for( int i = 0; i < VectorFieldSize; i++ )
-                str << " " << vectorField[ i ]->getData().getElement( entity.getIndex() );
+               str << " " << vectorField[ i ]->getData().getElement( entity.getIndex() );
             str << std::endl;
          }
          str << std::endl;
@@ -282,15 +234,13 @@ write( const VectorFieldType& vectorField,
 
    entity.setOrientation( EntityOrientation( 0.0, 0.0, 1.0 ) );
    for( c.x() = 0; c.x() < mesh.getDimensions().x(); c.x()++ )
-      for( c.y() = 0; c.y() <= mesh.getDimensions().y(); c.y()++ )
-      {
-         for( c.z() = 0; c.z() < mesh.getDimensions().z(); c.z()++ )
-         {
+      for( c.y() = 0; c.y() <= mesh.getDimensions().y(); c.y()++ ) {
+         for( c.z() = 0; c.z() < mesh.getDimensions().z(); c.z()++ ) {
             entity.refresh();
             typename MeshType::PointType v = entity.getCenter();
             str << v.x() << " " << v.y() << " " << v.z();
             for( int i = 0; i < VectorFieldSize; i++ )
-                str << " " << vectorField[ i ]->getData().getElement( entity.getIndex() );
+               str << " " << vectorField[ i ]->getData().getElement( entity.getIndex() );
             str << std::endl;
          }
          str << std::endl;
@@ -298,33 +248,26 @@ write( const VectorFieldType& vectorField,
    return true;
 }
 
-
 /****
  * 3D grid, vertices
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          int VectorFieldSize >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, int VectorFieldSize >
 bool
-VectorFieldGnuplotWriter< VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 0, Real > > >::
-write( const VectorFieldType& vectorField,
-       std::ostream& str )
+VectorFieldGnuplotWriter<
+   VectorField< VectorFieldSize, MeshFunction< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 0, Real > > >::
+   write( const VectorFieldType& vectorField, std::ostream& str )
 {
    const MeshType& mesh = vectorField.getMesh();
    typename MeshType::Vertex entity( mesh );
    auto& c = entity.getCoordinates();
    for( c.z() = 0; c.z() <= mesh.getDimensions().z(); c.z()++ )
-      for( c.y() = 0; c.y() <= mesh.getDimensions().y(); c.y()++ )
-      {
-         for( c.x() = 0; c.x() <= mesh.getDimensions().x(); c.x()++ )
-         {
+      for( c.y() = 0; c.y() <= mesh.getDimensions().y(); c.y()++ ) {
+         for( c.x() = 0; c.x() <= mesh.getDimensions().x(); c.x()++ ) {
             entity.refresh();
             typename MeshType::PointType v = entity.getCenter();
             str << v.x() << " " << v.y() << " " << v.z();
             for( int i = 0; i < VectorFieldSize; i++ )
-                str << " " << vectorField[ i ]->getData().getElement( entity.getIndex() );
+               str << " " << vectorField[ i ]->getData().getElement( entity.getIndex() );
             str << std::endl;
          }
          str << std::endl;
@@ -332,5 +275,5 @@ write( const VectorFieldType& vectorField,
    return true;
 }
 
-} // namespace Functions
-} // namespace TNL
+}  // namespace Functions
+}  // namespace TNL
diff --git a/src/TNL/Images/DicomHeader.h b/src/TNL/Images/DicomHeader.h
index 44905b1dff574fb9c0bdb3a12d54fe2ea33ed6df..9258330fe71cd6a76c74223c27164af81e31285c 100644
--- a/src/TNL/Images/DicomHeader.h
+++ b/src/TNL/Images/DicomHeader.h
@@ -7,9 +7,9 @@
 #pragma once
 
 #ifdef HAVE_DCMTK_H
-#define HAVE_CONFIG_H
-#include <dcmtk/dcmdata/dcfilefo.h>
-#include <dcmtk/dcmdata/dcdeftag.h>
+   #define HAVE_CONFIG_H
+   #include <dcmtk/dcmdata/dcfilefo.h>
+   #include <dcmtk/dcmdata/dcdeftag.h>
 #endif
 
 namespace TNL {
@@ -26,40 +26,43 @@ class DicomImageInfo;
  */
 class DicomHeader
 {
-   public:
+public:
+   inline DicomHeader();
 
-      inline DicomHeader();
-
-      inline virtual ~DicomHeader();
+   inline virtual ~DicomHeader();
 
 #ifdef HAVE_DCMTK_H
-      inline DcmFileFormat &getFileFormat();
+   inline DcmFileFormat&
+   getFileFormat();
 #endif
 
-      inline DicomImageInfo &getImageInfo();
-
-      inline DicomPatientInfo &getPatientInfo();
+   inline DicomImageInfo&
+   getImageInfo();
 
-      inline DicomSeriesInfo &getSeriesInfo();
+   inline DicomPatientInfo&
+   getPatientInfo();
 
-      inline bool loadFromFile( const String& fileName );
+   inline DicomSeriesInfo&
+   getSeriesInfo();
 
-   protected:
+   inline bool
+   loadFromFile( const String& fileName );
 
-      DicomImageInfo *imageInfoObj;
+protected:
+   DicomImageInfo* imageInfoObj;
 
-      DicomPatientInfo *patientInfoObj;
+   DicomPatientInfo* patientInfoObj;
 
-      DicomSeriesInfo *seriesInfoObj;
+   DicomSeriesInfo* seriesInfoObj;
 
 #ifdef HAVE_DCMTK_H
-      DcmFileFormat *fileFormat;
+   DcmFileFormat* fileFormat;
 #endif
 
-      bool isLoaded;
+   bool isLoaded;
 };
 
-} // namespace Images
-} // namespace TNL
+}  // namespace Images
+}  // namespace TNL
 
 #include <TNL/Images/DicomHeader_impl.h>
diff --git a/src/TNL/Images/DicomHeader_impl.h b/src/TNL/Images/DicomHeader_impl.h
index 13257439c8b1188358c0d37887c7dbfab7547bb5..3338c05aa31ce99ab79d46f585c9f439808b9f6b 100644
--- a/src/TNL/Images/DicomHeader_impl.h
+++ b/src/TNL/Images/DicomHeader_impl.h
@@ -17,60 +17,63 @@ namespace Images {
 inline DicomHeader::DicomHeader()
 {
 #ifdef HAVE_DCMTK_H
-    fileFormat = new DcmFileFormat();
+   fileFormat = new DcmFileFormat();
 #endif
-    isLoaded = false;
-    imageInfoObj = new DicomImageInfo(*this);
-    patientInfoObj = new DicomPatientInfo(*this);
-    seriesInfoObj = new DicomSeriesInfo(*this);
+   isLoaded = false;
+   imageInfoObj = new DicomImageInfo( *this );
+   patientInfoObj = new DicomPatientInfo( *this );
+   seriesInfoObj = new DicomSeriesInfo( *this );
 }
 
 inline DicomHeader::~DicomHeader()
 {
-    delete imageInfoObj;
-    delete patientInfoObj;
-    delete seriesInfoObj;
+   delete imageInfoObj;
+   delete patientInfoObj;
+   delete seriesInfoObj;
 #ifdef HAVE_DCMTK_H
-    delete fileFormat;
+   delete fileFormat;
 #endif
 }
 
-inline bool DicomHeader::loadFromFile( const String& fileName )
+inline bool
+DicomHeader::loadFromFile( const String& fileName )
 {
 #ifdef HAVE_DCMTK_H
-    OFCondition status = fileFormat->loadFile( fileName.getString() );
-    if(status.good())
-    {
-        isLoaded = true;
-        return true;
-    }
+   OFCondition status = fileFormat->loadFile( fileName.getString() );
+   if( status.good() ) {
+      isLoaded = true;
+      return true;
+   }
 #endif
-    isLoaded = false;
-    return false;
+   isLoaded = false;
+   return false;
 }
 
 #ifdef HAVE_DCMTK_H
-inline DcmFileFormat &DicomHeader::getFileFormat()
+inline DcmFileFormat&
+DicomHeader::getFileFormat()
 {
-    return *fileFormat;
+   return *fileFormat;
 }
 #endif
 
-inline DicomImageInfo &DicomHeader::getImageInfo()
+inline DicomImageInfo&
+DicomHeader::getImageInfo()
 {
-    return *imageInfoObj;
+   return *imageInfoObj;
 }
 
-inline DicomPatientInfo &DicomHeader::getPatientInfo()
+inline DicomPatientInfo&
+DicomHeader::getPatientInfo()
 {
-    return *patientInfoObj;
+   return *patientInfoObj;
 }
 
-inline DicomSeriesInfo &DicomHeader::getSeriesInfo()
+inline DicomSeriesInfo&
+DicomHeader::getSeriesInfo()
 {
-    return *seriesInfoObj;
+   return *seriesInfoObj;
 }
 
-} // namespace Images
-} // namespace TNL
-
+}  // namespace Images
+}  // namespace TNL
diff --git a/src/TNL/Images/DicomImageInfo.h b/src/TNL/Images/DicomImageInfo.h
index 0b6362830fa7c097280f53b8e469de016e937486..aeb745ed57e241b83803e7383fadf86070f80b28 100644
--- a/src/TNL/Images/DicomImageInfo.h
+++ b/src/TNL/Images/DicomImageInfo.h
@@ -7,9 +7,9 @@
 #pragma once
 
 #ifdef HAVE_DCMTK_H
-#define HAVE_CONFIG_H
-#include <dcmtk/dcmdata/dcfilefo.h>
-#include <dcmtk/dcmdata/dcdeftag.h>
+   #define HAVE_CONFIG_H
+   #include <dcmtk/dcmdata/dcfilefo.h>
+   #include <dcmtk/dcmdata/dcdeftag.h>
 #endif
 
 namespace TNL {
@@ -21,70 +21,75 @@ class DicomHeader;
   (accesses information via DicomHeader class)
   ***/
 struct ImagePositionToPatient
-    {
-    double x, y,z;
-    };
+{
+   double x, y, z;
+};
 
 struct DirectionCosines
-    {
-    double x, y, z;
-    };
+{
+   double x, y, z;
+};
 
 struct ImageOrientationToPatient
-    {
-    DirectionCosines row;
-    DirectionCosines column;
-    };
+{
+   DirectionCosines row;
+   DirectionCosines column;
+};
 
 struct PixelSpacing
-    {
-    double x, y;
-    };
+{
+   double x, y;
+};
 
 class DicomImageInfo
 {
-   public:
-
-      inline DicomImageInfo( DicomHeader &DicomHeader);
-
-      inline virtual ~DicomImageInfo();
+public:
+   inline DicomImageInfo( DicomHeader& DicomHeader );
 
-      inline ImagePositionToPatient getImagePositionToPatient();
+   inline virtual ~DicomImageInfo();
 
-      inline ImageOrientationToPatient getImageOrientationToPatient();
+   inline ImagePositionToPatient
+   getImagePositionToPatient();
 
-      inline double getSliceThickness();
+   inline ImageOrientationToPatient
+   getImageOrientationToPatient();
 
-      inline double getSliceLocation();
+   inline double
+   getSliceThickness();
 
-      inline PixelSpacing getPixelSpacing();
+   inline double
+   getSliceLocation();
 
-      inline int getNumberOfSlices();
+   inline PixelSpacing
+   getPixelSpacing();
 
-   private:
+   inline int
+   getNumberOfSlices();
 
-      DicomHeader &dicomHeader;
+private:
+   DicomHeader& dicomHeader;
 
-      bool retrieveInfo();
+   bool
+   retrieveInfo();
 
-      bool isObjectRetrieved;
+   bool isObjectRetrieved;
 
-      double sliceLocation;
+   double sliceLocation;
 
-      double sliceThickness;
+   double sliceThickness;
 
-      ImagePositionToPatient imagePositionToPatient;
+   ImagePositionToPatient imagePositionToPatient;
 
-      ImageOrientationToPatient imageOrientationToPatient;
+   ImageOrientationToPatient imageOrientationToPatient;
 
-      PixelSpacing pixelSpacing;
+   PixelSpacing pixelSpacing;
 
-      int numberOfSlices;
+   int numberOfSlices;
 
-      int width, height, depth;
+   int width, height, depth;
 };
 
-} // namespace Images
-} // namespace TNL
+}  // namespace Images
+}  // namespace TNL
 
 #include <TNL/Images/DicomImageInfo_impl.h>
diff --git a/src/TNL/Images/DicomImageInfo_impl.h b/src/TNL/Images/DicomImageInfo_impl.h
index 6c709c16618fb4e4ca1d1842ff91acd0217ed4d5..5d00bc91366ec3e477805fbbaee75472fb62299e 100644
--- a/src/TNL/Images/DicomImageInfo_impl.h
+++ b/src/TNL/Images/DicomImageInfo_impl.h
@@ -12,42 +12,46 @@
 namespace TNL {
 namespace Images {
 
-inline DicomImageInfo::DicomImageInfo( DicomHeader& dicomHeader )
-: dicomHeader( dicomHeader )
+inline DicomImageInfo::DicomImageInfo( DicomHeader& dicomHeader ) : dicomHeader( dicomHeader )
 {
-    isObjectRetrieved = false;
-    width = 0;
-    height = 0;
-    depth = 0;
+   isObjectRetrieved = false;
+   width = 0;
+   height = 0;
+   depth = 0;
 }
 
-inline DicomImageInfo::~DicomImageInfo()
-{
-}
+inline DicomImageInfo::~DicomImageInfo() = default;
 
-inline bool DicomImageInfo::retrieveInfo()
+inline bool
+DicomImageInfo::retrieveInfo()
 {
 #ifdef HAVE_DCMTK_H
-   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64(DCM_ImagePositionPatient,imagePositionToPatient.x,0);
-   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64(DCM_ImagePositionPatient,imagePositionToPatient.y,1);
-   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64(DCM_ImagePositionPatient,imagePositionToPatient.z,2);
-
-   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64(DCM_ImageOrientationPatient,imageOrientationToPatient.row.x,0);
-   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64(DCM_ImageOrientationPatient,imageOrientationToPatient.row.y,1);
-   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64(DCM_ImageOrientationPatient,imageOrientationToPatient.row.z,2);
-   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64(DCM_ImageOrientationPatient,imageOrientationToPatient.column.x,3);
-   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64(DCM_ImageOrientationPatient,imageOrientationToPatient.column.y,4);
-   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64(DCM_ImageOrientationPatient,imageOrientationToPatient.column.z,5);
-
-   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64(DCM_SliceThickness,sliceThickness);
-   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64(DCM_SliceLocation,sliceLocation);
+   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64( DCM_ImagePositionPatient, imagePositionToPatient.x, 0 );
+   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64( DCM_ImagePositionPatient, imagePositionToPatient.y, 1 );
+   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64( DCM_ImagePositionPatient, imagePositionToPatient.z, 2 );
+
+   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64(
+      DCM_ImageOrientationPatient, imageOrientationToPatient.row.x, 0 );
+   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64(
+      DCM_ImageOrientationPatient, imageOrientationToPatient.row.y, 1 );
+   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64(
+      DCM_ImageOrientationPatient, imageOrientationToPatient.row.z, 2 );
+   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64(
+      DCM_ImageOrientationPatient, imageOrientationToPatient.column.x, 3 );
+   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64(
+      DCM_ImageOrientationPatient, imageOrientationToPatient.column.y, 4 );
+   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64(
+      DCM_ImageOrientationPatient, imageOrientationToPatient.column.z, 5 );
+
+   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64( DCM_SliceThickness, sliceThickness );
+   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64( DCM_SliceLocation, sliceLocation );
 
    Uint16 slicesCount;
-   dicomHeader.getFileFormat().getDataset()->findAndGetUint16 (DCM_NumberOfSlices, slicesCount);
+   dicomHeader.getFileFormat().getDataset()->findAndGetUint16( DCM_NumberOfSlices, slicesCount );
    numberOfSlices = slicesCount;
 
-   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64(DCM_PixelSpacing,pixelSpacing.x,0);
-   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64(DCM_PixelSpacing,pixelSpacing.y,1);
+   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64( DCM_PixelSpacing, pixelSpacing.x, 0 );
+   dicomHeader.getFileFormat().getDataset()->findAndGetFloat64( DCM_PixelSpacing, pixelSpacing.y, 1 );
 
    isObjectRetrieved = true;
    return true;
@@ -57,47 +61,53 @@ inline bool DicomImageInfo::retrieveInfo()
 #endif
 }
 
-inline ImagePositionToPatient DicomImageInfo::getImagePositionToPatient()
+inline ImagePositionToPatient
+DicomImageInfo::getImagePositionToPatient()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return imagePositionToPatient;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return imagePositionToPatient;
 }
 
-inline ImageOrientationToPatient DicomImageInfo::getImageOrientationToPatient()
+inline ImageOrientationToPatient
+DicomImageInfo::getImageOrientationToPatient()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return imageOrientationToPatient;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return imageOrientationToPatient;
 }
 
-inline double DicomImageInfo::getSliceThickness()
+inline double
+DicomImageInfo::getSliceThickness()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return sliceThickness;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return sliceThickness;
 }
 
-inline double DicomImageInfo::getSliceLocation()
+inline double
+DicomImageInfo::getSliceLocation()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return sliceLocation;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return sliceLocation;
 }
 
-inline PixelSpacing DicomImageInfo::getPixelSpacing()
+inline PixelSpacing
+DicomImageInfo::getPixelSpacing()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return pixelSpacing;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return pixelSpacing;
 }
 
-inline int DicomImageInfo::getNumberOfSlices()
+inline int
+DicomImageInfo::getNumberOfSlices()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return numberOfSlices;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return numberOfSlices;
 }
 
-} // namespace Images
-} // namespace TNL
+}  // namespace Images
+}  // namespace TNL
diff --git a/src/TNL/Images/DicomPatientInfo.h b/src/TNL/Images/DicomPatientInfo.h
index 73894bbc08c7cb4976e1d6898cf65ac6137c48ec..87878af97950d3feb622ce9fe1bfb57e34cd4212 100644
--- a/src/TNL/Images/DicomPatientInfo.h
+++ b/src/TNL/Images/DicomPatientInfo.h
@@ -9,11 +9,11 @@
 #include <TNL/String.h>
 
 #ifdef HAVE_DCMTK_H
-#define HAVE_CONFIG_H
-#define HAVE_STD_STRING
-#include <dcmtk/dcmdata/dcfilefo.h>
-#include <dcmtk/dcmdata/dcdeftag.h>
-#include <dcmtk/ofstd/ofstring.h>
+   #define HAVE_CONFIG_H
+   #define HAVE_STD_STRING
+   #include <dcmtk/dcmdata/dcfilefo.h>
+   #include <dcmtk/dcmdata/dcdeftag.h>
+   #include <dcmtk/ofstd/ofstring.h>
 #endif
 
 namespace TNL {
@@ -27,44 +27,49 @@ class DicomHeader;
  */
 class DicomPatientInfo
 {
-   public:
+public:
+   inline DicomPatientInfo( DicomHeader& aDicomHeader );
 
-      inline DicomPatientInfo(DicomHeader &aDicomHeader);
+   inline virtual ~DicomPatientInfo();
 
-      inline virtual ~DicomPatientInfo();
+   inline const String&
+   getName();
 
-      inline const String& getName();
+   inline const String&
+   getSex();
 
-      inline const String& getSex();
+   inline const String&
+   getID();
 
-      inline const String& getID();
+   inline const String&
+   getWeight();
 
-      inline const String& getWeight();
+   inline const String&
+   getPosition();
 
-      inline const String& getPosition();
+   inline const String&
+   getOrientation();
 
-      inline const String& getOrientation();
+private:
+   DicomHeader& dicomHeader;
+   bool
+   retrieveInfo();
+   bool isObjectRetrieved;
 
-   private:
+   String name;
 
-       DicomHeader &dicomHeader;
-       bool retrieveInfo();
-       bool isObjectRetrieved;
+   String sex;
 
-       String name;
+   String ID;
 
-       String sex;
+   String weight;
 
-       String ID;
+   String patientPosition;
 
-       String weight;
-
-       String patientPosition;
-
-       String patientOrientation;
+   String patientOrientation;
 };
 
-} // namespace Images
-} // namespace TNL
+}  // namespace Images
+}  // namespace TNL
 
 #include <TNL/Images/DicomPatientInfo_impl.h>
diff --git a/src/TNL/Images/DicomPatientInfo_impl.h b/src/TNL/Images/DicomPatientInfo_impl.h
index 887712665ed5af4541920ce73022cd0f516d681c..ea3f7987d588cea7ac9db91ae1b5c936d650a932 100644
--- a/src/TNL/Images/DicomPatientInfo_impl.h
+++ b/src/TNL/Images/DicomPatientInfo_impl.h
@@ -10,39 +10,37 @@
 #include <TNL/Images/DicomHeader.h>
 
 #ifdef HAVE_DCMTK_H
-#define HAVE_CONFIG_H
-#define HAVE_STD_STRING
-#include <dcmtk/ofstd/ofstring.h>
+   #define HAVE_CONFIG_H
+   #define HAVE_STD_STRING
+   #include <dcmtk/ofstd/ofstring.h>
 #endif
 
 namespace TNL {
-namespace Images {   
+namespace Images {
 
-inline DicomPatientInfo::DicomPatientInfo( DicomHeader &dicomHeader )
-: dicomHeader( dicomHeader )
+inline DicomPatientInfo::DicomPatientInfo( DicomHeader& dicomHeader ) : dicomHeader( dicomHeader )
 {
-    isObjectRetrieved = false;
+   isObjectRetrieved = false;
 }
 
-inline DicomPatientInfo::~DicomPatientInfo()
-{
-}
+inline DicomPatientInfo::~DicomPatientInfo() = default;
 
-inline bool DicomPatientInfo::retrieveInfo()
+inline bool
+DicomPatientInfo::retrieveInfo()
 {
 #ifdef HAVE_DCMTK_H
    OFString str;
-   dicomHeader.getFileFormat().getDataset()->findAndGetOFString(DCM_PatientName, str );
+   dicomHeader.getFileFormat().getDataset()->findAndGetOFString( DCM_PatientName, str );
    this->name = str.data();
-   dicomHeader.getFileFormat().getDataset()->findAndGetOFString(DCM_PatientSex, str );
+   dicomHeader.getFileFormat().getDataset()->findAndGetOFString( DCM_PatientSex, str );
    this->sex = str.data();
-   dicomHeader.getFileFormat().getDataset()->findAndGetOFString(DCM_PatientID, str );
+   dicomHeader.getFileFormat().getDataset()->findAndGetOFString( DCM_PatientID, str );
    this->ID = str.data();
-   dicomHeader.getFileFormat().getDataset()->findAndGetOFString(DCM_PatientWeight, str );
+   dicomHeader.getFileFormat().getDataset()->findAndGetOFString( DCM_PatientWeight, str );
    this->weight = str.data();
-   dicomHeader.getFileFormat().getDataset()->findAndGetOFString(DCM_PatientPosition, str );
+   dicomHeader.getFileFormat().getDataset()->findAndGetOFString( DCM_PatientPosition, str );
    this->patientPosition = str.data();
-   dicomHeader.getFileFormat().getDataset()->findAndGetOFString(DCM_PatientOrientation, str );
+   dicomHeader.getFileFormat().getDataset()->findAndGetOFString( DCM_PatientOrientation, str );
    this->patientOrientation = str.data();
 
    isObjectRetrieved = true;
@@ -53,47 +51,53 @@ inline bool DicomPatientInfo::retrieveInfo()
 #endif
 }
 
-inline const String& DicomPatientInfo::getName()
+inline const String&
+DicomPatientInfo::getName()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return name;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return name;
 }
 
-inline const String& DicomPatientInfo::getSex()
+inline const String&
+DicomPatientInfo::getSex()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return sex;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return sex;
 }
 
-inline const String& DicomPatientInfo::getID()
+inline const String&
+DicomPatientInfo::getID()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return ID;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return ID;
 }
 
-inline const String& DicomPatientInfo::getWeight()
+inline const String&
+DicomPatientInfo::getWeight()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return weight;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return weight;
 }
 
-inline const String& DicomPatientInfo::getPosition()
+inline const String&
+DicomPatientInfo::getPosition()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return patientPosition;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return patientPosition;
 }
 
-inline const String& DicomPatientInfo::getOrientation()
+inline const String&
+DicomPatientInfo::getOrientation()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return patientOrientation;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return patientOrientation;
 }
 
-} // namespace Images
-} // namespace TNL
+}  // namespace Images
+}  // namespace TNL
diff --git a/src/TNL/Images/DicomSeries.h b/src/TNL/Images/DicomSeries.h
index f6005751ac31a8466fa45a929452db1edbdff9f1..b4bb706407df434b9a6756e2e8188f7e4135894b 100644
--- a/src/TNL/Images/DicomSeries.h
+++ b/src/TNL/Images/DicomSeries.h
@@ -18,9 +18,9 @@
 #include <TNL/Images/RegionOfInterest.h>
 
 #ifdef HAVE_DCMTK_H
-#define USING_STD_NAMESPACE
-#include <dcmtk/config/osconfig.h>
-#include <dcmtk/dcmimgle/dcmimage.h>
+   #define USING_STD_NAMESPACE
+   #include <dcmtk/config/osconfig.h>
+   #include <dcmtk/dcmimgle/dcmimage.h>
 #endif
 
 #include <dirent.h>
@@ -31,15 +31,14 @@ namespace Images {
 
 struct WindowCenterWidth
 {
-    float center;
-    float width;
+   float center;
+   float width;
 };
 
 struct ImagesInfo
 {
-    int imagesCount, frameUintsCount, bps, colorsCount, mainFrameIndex,
-        frameSize, maxColorValue, minColorValue;
-    WindowCenterWidth window;
+   int imagesCount, frameUintsCount, bps, colorsCount, mainFrameIndex, frameSize, maxColorValue, minColorValue;
+   WindowCenterWidth window;
 };
 
 /***
@@ -49,69 +48,75 @@ struct ImagesInfo
  */
 class DicomSeries : public Image< int >
 {
-   public:
+public:
+   using IndexType = int;
 
-      typedef int IndexType;
+   inline DicomSeries( const String& filePath );
 
-      inline DicomSeries( const String& filePath );
+   inline virtual ~DicomSeries();
 
-      inline virtual ~DicomSeries();
+   inline int
+   getImagesCount();
 
-      inline int getImagesCount();
-
-      template< typename Real,
-                typename Device,
-                typename Index,
-                typename Vector >
-      bool getImage( const int imageIdx,
-                     const Meshes::Grid< 2, Real, Device, Index >& grid,
-                     const RegionOfInterest< int > roi,
-                     Vector& vector );
+   template< typename Real, typename Device, typename Index, typename Vector >
+   bool
+   getImage( int imageIdx, const Meshes::Grid< 2, Real, Device, Index >& grid, RegionOfInterest< int > roi, Vector& vector );
 
 #ifdef HAVE_DCMTK_H
-      inline const Uint16 *getData( int imageNumber = 0 );
+   inline const Uint16*
+   getData( int imageNumber = 0 );
 #endif
 
-      inline int getColorCount();
-
-      inline int getBitsPerSampleCount();
+   inline int
+   getColorCount();
 
-      inline int getMinColorValue();
+   inline int
+   getBitsPerSampleCount();
 
-      inline WindowCenterWidth getWindowDefaults();
+   inline int
+   getMinColorValue();
 
-      inline int getMaxColorValue();
+   inline WindowCenterWidth
+   getWindowDefaults();
 
-      inline void freeData();
+   inline int
+   getMaxColorValue();
 
-      inline DicomHeader &getHeader(int image);
+   inline void
+   freeData();
 
-      inline bool isDicomSeriesLoaded();
+   inline DicomHeader&
+   getHeader( int image );
 
-   private:
+   inline bool
+   isDicomSeriesLoaded();
 
-      bool loadDicomSeries( const String& filePath );
+private:
+   bool
+   loadDicomSeries( const String& filePath );
 
-      bool retrieveFileList( const String& filePath );
+   bool
+   retrieveFileList( const String& filePath );
 
-      bool loadImage( const String& filePath, int number );
+   bool
+   loadImage( const String& filePath, int number );
 
-      std::list< String > fileList;
+   std::list< String > fileList;
 
-      Containers::Array<DicomHeader *,Devices::Host,int> dicomSeriesHeaders;
+   Containers::Array< DicomHeader*, Devices::Host, int > dicomSeriesHeaders;
 
-      bool isLoaded;
+   bool isLoaded;
 
 #ifdef HAVE_DCMTK_H
-      DicomImage *dicomImage;
+   DicomImage* dicomImage;
 
-      Uint16 *pixelData;
+   Uint16* pixelData;
 #endif
 
-      ImagesInfo imagesInfo;
+   ImagesInfo imagesInfo;
 };
 
-} // namespace Images
-} // namespace TNL
+}  // namespace Images
+}  // namespace TNL
 
 #include <TNL/Images/DicomSeries_impl.h>
diff --git a/src/TNL/Images/DicomSeriesInfo.h b/src/TNL/Images/DicomSeriesInfo.h
index c630b299e38deafa1ba5a302e139ed4e6cada1db..dfad2268a95a264d19b1f5925ac16e0221ccefb0 100644
--- a/src/TNL/Images/DicomSeriesInfo.h
+++ b/src/TNL/Images/DicomSeriesInfo.h
@@ -9,11 +9,11 @@
 #include <TNL/String.h>
 
 #ifdef HAVE_DCMTK_H
-#define HAVE_CONFIG_H
-#include <dcmtk/dcmdata/dcfilefo.h>
-#include <dcmtk/dcmdata/dcdeftag.h>
-#define HAVE_STD_STRING
-#include <dcmtk/ofstd/ofstring.h>
+   #define HAVE_CONFIG_H
+   #include <dcmtk/dcmdata/dcfilefo.h>
+   #include <dcmtk/dcmdata/dcdeftag.h>
+   #define HAVE_STD_STRING
+   #include <dcmtk/ofstd/ofstring.h>
 #endif
 
 namespace TNL {
@@ -27,78 +27,89 @@ class DicomHeader;
  */
 class DicomSeriesInfo
 {
-   public:
+public:
+   inline DicomSeriesInfo( DicomHeader& dicomHeader );
 
-       inline DicomSeriesInfo( DicomHeader &dicomHeader );
+   inline virtual ~DicomSeriesInfo();
 
-       inline virtual ~DicomSeriesInfo();
+   inline const String&
+   getModality();
 
-       inline const String& getModality();
+   inline const String&
+   getStudyInstanceUID();
 
-       inline const String& getStudyInstanceUID();
+   inline const String&
+   getSeriesInstanceUID();
 
-       inline const String& getSeriesInstanceUID();
+   inline const String&
+   getSeriesDescription();
 
-       inline const String& getSeriesDescription();
+   inline const String&
+   getSeriesNumber();
 
-       inline const String& getSeriesNumber();
+   inline const String&
+   getSeriesDate();
 
-       inline const String& getSeriesDate();
+   inline const String&
+   getSeriesTime();
 
-       inline const String& getSeriesTime();
+   inline const String&
+   getPerformingPhysiciansName();
 
-       inline const String& getPerformingPhysiciansName();
+   inline const String&
+   getPerformingPhysicianIdentificationSequence();
 
-       inline const String& getPerformingPhysicianIdentificationSequence();
+   inline const String&
+   getOperatorsName();
 
-       inline const String& getOperatorsName();
+   inline const String&
+   getOperatorIdentificationSequence();
 
-       inline const String& getOperatorIdentificationSequence();
+   inline const String&
+   getAcquisitionTime();
 
-       inline const String& getAcquisitionTime();
+private:
+   DicomHeader& dicomHeader;
 
-   private:
+   bool
+   retrieveInfo();
 
-       DicomHeader &dicomHeader;
+   bool isObjectRetrieved;
 
-       bool retrieveInfo();
+   String modality;
 
-       bool isObjectRetrieved;
+   String studyInstanceUID;
 
-       String modality;
+   String seriesInstanceUID;
 
-       String studyInstanceUID;
+   String seriesNumber;
 
-       String seriesInstanceUID;
+   String seriesDescription;
 
-       String seriesNumber;
+   String seriesDate;
 
-       String seriesDescription;
+   String seriesTime;
 
-       String seriesDate;
+   String performingPhysiciansName;
 
-       String seriesTime;
+   String performingPhysicianIdentificationSequence;
 
-       String performingPhysiciansName;
+   String operatorsName;
 
-       String performingPhysicianIdentificationSequence;
+   String operatorIdentificationSequence;
 
-       String operatorsName;
+   String frameTime;
 
-       String operatorIdentificationSequence;
+   String faDateTime;
 
-       String frameTime;
+   String faRefTime;
 
-       String faDateTime;
+   String AFD;
 
-       String faRefTime;
-
-       String AFD;
-
-       String acquisitionTime;
+   String acquisitionTime;
 };
 
-} // namespace Images
-} // namespace TNL
+}  // namespace Images
+}  // namespace TNL
 
 #include <TNL/Images/DicomSeriesInfo_impl.h>
diff --git a/src/TNL/Images/DicomSeriesInfo_impl.h b/src/TNL/Images/DicomSeriesInfo_impl.h
index 6a90666ec7a1e94280a64f828260d1288cb39ca8..c553c3ae8dc66625d9929d9fc774f89406e5e5a8 100644
--- a/src/TNL/Images/DicomSeriesInfo_impl.h
+++ b/src/TNL/Images/DicomSeriesInfo_impl.h
@@ -6,7 +6,7 @@
 
 #pragma once
 
-#include <stdio.h>
+#include <cstdio>
 
 #include <TNL/Images/DicomHeader.h>
 #include <TNL/Images/DicomSeriesInfo.h>
@@ -14,17 +14,15 @@
 namespace TNL {
 namespace Images {
 
-inline DicomSeriesInfo::DicomSeriesInfo( DicomHeader &dicomHeader)
-: dicomHeader( dicomHeader )
+inline DicomSeriesInfo::DicomSeriesInfo( DicomHeader& dicomHeader ) : dicomHeader( dicomHeader )
 {
-    isObjectRetrieved = false;
+   isObjectRetrieved = false;
 }
 
-inline DicomSeriesInfo::~DicomSeriesInfo()
-{
-}
+inline DicomSeriesInfo::~DicomSeriesInfo() = default;
 
-inline bool DicomSeriesInfo::retrieveInfo()
+inline bool
+DicomSeriesInfo::retrieveInfo()
 {
 #ifdef HAVE_DCMTK_H
    OFString str;
@@ -76,103 +74,115 @@ inline bool DicomSeriesInfo::retrieveInfo()
    dicomHeader.getFileFormat().getDataset()->findAndGetOFString( DCM_AcquisitionTime, str );
    this->acquisitionTime = str.data();
 
-    //prostudovat delay time
-    //OFString delayTime = "";
-    //dicomHeader.getFileFormat().getDataset()->findAndGetOFString(DCM_DelayTime, delayTime);
+   // prostudovat delay time
+   // OFString delayTime = "";
+   // dicomHeader.getFileFormat().getDataset()->findAndGetOFString(DCM_DelayTime, delayTime);
 
-    //std::cout << faDateTime << " " << faRefTime << " "<< AFD << " " << AT << std::endl;
+   // std::cout << faDateTime << " " << faRefTime << " "<< AFD << " " << AT << std::endl;
 
-    isObjectRetrieved = true;
-    return true;
+   isObjectRetrieved = true;
+   return true;
 #else
-    std::cerr << "DICOM format is not supported in this build of TNL." << std::endl;
-    return false;
+   std::cerr << "DICOM format is not supported in this build of TNL." << std::endl;
+   return false;
 #endif
 }
 
-inline const String& DicomSeriesInfo::getModality()
+inline const String&
+DicomSeriesInfo::getModality()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return this->modality;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return this->modality;
 }
 
-inline const String& DicomSeriesInfo::getStudyInstanceUID()
+inline const String&
+DicomSeriesInfo::getStudyInstanceUID()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return this->studyInstanceUID;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return this->studyInstanceUID;
 }
 
-inline const String& DicomSeriesInfo::getSeriesInstanceUID()
+inline const String&
+DicomSeriesInfo::getSeriesInstanceUID()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return this->seriesInstanceUID;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return this->seriesInstanceUID;
 }
 
-inline const String& DicomSeriesInfo::getSeriesNumber()
+inline const String&
+DicomSeriesInfo::getSeriesNumber()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return this->seriesNumber;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return this->seriesNumber;
 }
 
-inline const String& DicomSeriesInfo::getSeriesDescription()
+inline const String&
+DicomSeriesInfo::getSeriesDescription()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return this->seriesDescription;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return this->seriesDescription;
 }
 
-inline const String& DicomSeriesInfo::getSeriesDate()
+inline const String&
+DicomSeriesInfo::getSeriesDate()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return this->seriesDate;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return this->seriesDate;
 }
 
-inline const String& DicomSeriesInfo::getSeriesTime()
+inline const String&
+DicomSeriesInfo::getSeriesTime()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return this->seriesTime;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return this->seriesTime;
 }
 
-inline const String& DicomSeriesInfo::getPerformingPhysiciansName()
+inline const String&
+DicomSeriesInfo::getPerformingPhysiciansName()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return this->performingPhysiciansName;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return this->performingPhysiciansName;
 }
 
-inline const String& DicomSeriesInfo::getPerformingPhysicianIdentificationSequence()
+inline const String&
+DicomSeriesInfo::getPerformingPhysicianIdentificationSequence()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return this->performingPhysicianIdentificationSequence;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return this->performingPhysicianIdentificationSequence;
 }
 
-inline const String& DicomSeriesInfo::getOperatorsName()
+inline const String&
+DicomSeriesInfo::getOperatorsName()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return this->operatorsName;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return this->operatorsName;
 }
 
-inline const String& DicomSeriesInfo::getOperatorIdentificationSequence()
+inline const String&
+DicomSeriesInfo::getOperatorIdentificationSequence()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return this->operatorIdentificationSequence;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return this->operatorIdentificationSequence;
 }
 
-inline const String& DicomSeriesInfo::getAcquisitionTime()
+inline const String&
+DicomSeriesInfo::getAcquisitionTime()
 {
-    if(!isObjectRetrieved)
-        retrieveInfo();
-    return this->acquisitionTime;
+   if( ! isObjectRetrieved )
+      retrieveInfo();
+   return this->acquisitionTime;
 }
 
-} // namespace Images
-} // namespace TNL
+}  // namespace Images
+}  // namespace TNL
diff --git a/src/TNL/Images/DicomSeries_impl.h b/src/TNL/Images/DicomSeries_impl.h
index b6253a5baaa23f5c036806438823f9cbac508b51..a645ee187d581e546a41d21d50bcaa3d52addc68 100644
--- a/src/TNL/Images/DicomSeries_impl.h
+++ b/src/TNL/Images/DicomSeries_impl.h
@@ -14,97 +14,87 @@
 namespace TNL {
 namespace Images {
 
-int findLastIndexOf(String &str, const char* c)
+int
+findLastIndexOf( String& str, const char* c )
 {
-    for (int i = str.getLength(); i > -1; i--)
-    {
-        char *a = &(str.operator [](i-1));
-        if(*a == *c)
-            return i;
-    }
-    return -1;
+   for( int i = str.getLength(); i > -1; i-- ) {
+      char* a = &( str.operator[]( i - 1 ) );
+      if( *a == *c )
+         return i;
+   }
+   return -1;
 }
 
-int filter(const struct dirent *dire)
+int
+filter( const struct dirent* dire )
 {
-    //check it is not DIR or unknowm d_type
-    if(dire->d_type == DT_UNKNOWN && dire->d_type == DT_DIR)
-        return 0;
+   // check it is not DIR or unknowm d_type
+   if( dire->d_type == DT_UNKNOWN && dire->d_type == DT_DIR )
+      return 0;
 
-    return 1;
+   return 1;
 }
 
-inline DicomSeries::DicomSeries( const String& filePath)
+inline DicomSeries::DicomSeries( const String& filePath )
 {
 #ifdef HAVE_DCMTK_H
-    dicomImage = 0;
-    pixelData = 0;
+   dicomImage = nullptr;
+   pixelData = nullptr;
 #endif
-    imagesInfo.imagesCount = 0;
-    imagesInfo.maxColorValue = 0;
-    imagesInfo.minColorValue = 128000;
-
-    if( !loadDicomSeries( filePath ) )
-        isLoaded = false;
-    else
-        isLoaded = true;
+   imagesInfo.imagesCount = 0;
+   imagesInfo.maxColorValue = 0;
+   imagesInfo.minColorValue = 128000;
+
+   isLoaded = loadDicomSeries( filePath );
 }
 
 inline DicomSeries::~DicomSeries()
 {
-    int length = dicomSeriesHeaders.getSize();
-    for(int i = 0; i < length; i++)
-    {
-        DicomHeader *header = dicomSeriesHeaders[i];
-        delete header;
-        header = 0;
-    }
+   int length = dicomSeriesHeaders.getSize();
+   for( int i = 0; i < length; i++ ) {
+      DicomHeader* header = dicomSeriesHeaders[ i ];
+      delete header;
+      header = nullptr;
+   }
 
 #ifdef HAVE_DCMTK_H
-    if(dicomImage)
-        delete dicomImage;
+   if( dicomImage )
+      delete dicomImage;
 
-    if(pixelData)
-        delete pixelData;
+   if( pixelData )
+      delete pixelData;
 #endif
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Vector >
+template< typename Real, typename Device, typename Index, typename Vector >
 bool
-DicomSeries::
-getImage( const int imageIdx,
-          const Meshes::Grid< 2, Real, Device, Index >& grid,
-          const RegionOfInterest< int > roi,
-          Vector& vector )
+DicomSeries::getImage( const int imageIdx,
+                       const Meshes::Grid< 2, Real, Device, Index >& grid,
+                       const RegionOfInterest< int > roi,
+                       Vector& vector )
 {
 #ifdef HAVE_DCMTK_H
    const Uint16* imageData = this->getData( imageIdx );
-   typedef Meshes::Grid< 2, Real, Device, Index > GridType;
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
    typename GridType::Cell cell( grid );
 
    Index i, j;
    int position( 0 );
-   for( i = 0; i < this->height; i ++ )
-   {
-      for( j = 0; j < this->width; j ++ )
-      {
-         if( roi.isIn( i, j ) )
-         {
+   for( i = 0; i < this->height; i++ ) {
+      for( j = 0; j < this->width; j++ ) {
+         if( roi.isIn( i, j ) ) {
             cell.getCoordinates().x() = j - roi.getLeft();
             cell.getCoordinates().y() = roi.getBottom() - 1 - i;
             cell.refresh();
-            //Index cellIndex = grid.getCellIndex( CoordinatesType( j - roi.getLeft(),
-            //                                                      roi.getBottom() - 1 - i ) );
+            // Index cellIndex = grid.getCellIndex( CoordinatesType( j - roi.getLeft(),
+            //                                                       roi.getBottom() - 1 - i ) );
             Uint16 col = imageData[ position ];
-            vector.setElement( cell.getIndex(), ( Real ) col / ( Real ) 65535 );
-            //cout << vector.getElement( cellIndex ) << " ";
+            vector.setElement( cell.getIndex(), (Real) col / (Real) 65535 );
+            // cout << vector.getElement( cellIndex ) << " ";
          }
          position++;
       }
-      //cout << std::endl;
+      // cout << std::endl;
    }
    return true;
 #else
@@ -113,17 +103,17 @@ getImage( const int imageIdx,
 #endif
 }
 
-inline bool DicomSeries::retrieveFileList( const String& filePath)
+inline bool
+DicomSeries::retrieveFileList( const String& filePath )
 {
-    String filePathString(filePath);
-    String suffix(filePath.getString(), filePathString.getLength() - 3);
-
-    /***
-     * Check DICOM files
-     */
-   if( suffix != "ima" && suffix != "dcm" )
-   {
-       std::cerr << "The given file is not a DICOM file." << std::endl;
+   String filePathString( filePath );
+   String suffix( filePath.getString(), filePathString.getLength() - 3 );
+
+   /***
+    * Check DICOM files
+    */
+   if( suffix != "ima" && suffix != "dcm" ) {
+      std::cerr << "The given file is not a DICOM file." << std::endl;
       return false;
    }
 
@@ -132,38 +122,33 @@ inline bool DicomSeries::retrieveFileList( const String& filePath)
    /***
     * Parse file path
     */
-   String fileName(filePath.getString(), fileNamePosition);
-   String directoryPath(filePath.getString(), 0, filePathString.getLength() - fileNamePosition);
-
-   int separatorPosition = findLastIndexOf(fileName, "_");
-   if (separatorPosition == -1)
-   {
-      //try another separator
-      separatorPosition = findLastIndexOf(fileName, "-");
+   String fileName( filePath.getString(), fileNamePosition );
+   String directoryPath( filePath.getString(), 0, filePathString.getLength() - fileNamePosition );
+
+   int separatorPosition = findLastIndexOf( fileName, "_" );
+   if( separatorPosition == -1 ) {
+      // try another separator
+      separatorPosition = findLastIndexOf( fileName, "-" );
    }
    if( separatorPosition == -1 )
       return false;
-   else
-   {
-      //numbered files
-      String fileNamePrefix(fileName.getString(), 0, fileName.getLength() - separatorPosition);
+   else {
+      // numbered files
+      String fileNamePrefix( fileName.getString(), 0, fileName.getLength() - separatorPosition );
 
-      struct dirent **dirp;
+      struct dirent** dirp;
       std::list< String > files;
 
-      //scan and sort directory
-      int ndirs = scandir(directoryPath.getString(), &dirp, filter, alphasort);
-      for(int i = 0 ; i < ndirs; ++i)
-      {
-         files.push_back( String((char *)dirp[i]->d_name) );
-         delete dirp[i];
+      // scan and sort directory
+      int ndirs = scandir( directoryPath.getString(), &dirp, filter, alphasort );
+      for( int i = 0; i < ndirs; ++i ) {
+         files.push_back( String( (char*) dirp[ i ]->d_name ) );
+         delete dirp[ i ];
       }
 
-      for (auto& file : files)
-      {
-         //check if file prefix contained
-         if (strstr(file.getString(), fileNamePrefix.getString()))
-         {
+      for( auto& file : files ) {
+         // check if file prefix contained
+         if( strstr( file.getString(), fileNamePrefix.getString() ) ) {
             fileList.push_back( directoryPath + file );
          }
       }
@@ -171,162 +156,146 @@ inline bool DicomSeries::retrieveFileList( const String& filePath)
    return true;
 }
 
-inline bool DicomSeries::loadImage( const String& filePath, int number)
+inline bool
+DicomSeries::loadImage( const String& filePath, int number )
 {
 #ifdef HAVE_DCMTK_H
-   //load header
-   DicomHeader *header = new DicomHeader();
+   // load header
+   auto* header = new DicomHeader();
    dicomSeriesHeaders.setSize( fileList.size() );
    dicomSeriesHeaders.setElement( number, header );
-   if( !header->loadFromFile( filePath ) )
+   if( ! header->loadFromFile( filePath ) )
       return false;
 
-   //check series UID
+   // check series UID
    const String& seriesUID = dicomSeriesHeaders[ 0 ]->getSeriesInfo().getSeriesInstanceUID();
    if( seriesUID != header->getSeriesInfo().getSeriesInstanceUID() )
       return false;
 
-   //load image
-   if( dicomImage ) delete dicomImage;
-   dicomImage = NULL;
+   // load image
+   if( dicomImage )
+      delete dicomImage;
+   dicomImage = nullptr;
 
    dicomImage = new DicomImage( filePath.getString() );
 
-   if(dicomImage->getFrameCount() > 1)
-   {
-     std::cout << filePath <<" not supported format-Dicom Image has more than one frame";
+   if( dicomImage->getFrameCount() > 1 ) {
+      std::cout << filePath << " not supported format-Dicom Image has more than one frame";
       return false;
    }
 
-   if(!dicomImage->isMonochrome())
-   {
-     std::cout << filePath <<" not supported format--Dicom Image is not monochrome";
+   if( ! dicomImage->isMonochrome() ) {
+      std::cout << filePath << " not supported format--Dicom Image is not monochrome";
       return false;
    }
 
-    if (dicomImage != NULL)
-    {
-        EI_Status imageStatus = dicomImage->getStatus();
-        if (imageStatus == EIS_Normal)
-        {
-            //ok - image loaded
-        }
-        else if (imageStatus == EIS_MissingAttribute)
-        {
-            //bitmap is propably old ARC/NEMA format
-            std::cerr << "Error: cannot load DICOM image(ACR/NEMA) (" << DicomImage::getString (dicomImage->getStatus()) << ")" << std::endl;
-
-            delete dicomImage;
-            dicomImage = NULL;
-            return false;
-        }
-        else
-        {
-            delete dicomImage;
-            dicomImage = NULL;
-            std::cerr << "Error: cannot load DICOM image (" << DicomImage::getString (dicomImage->getStatus()) << ")" << std::endl;
-            return false;
-        }
-    }
-
-    if(number == 0)
-    {
-        this->height = dicomImage->getHeight();
-    }
-    else if( ( IndexType ) dicomImage->getHeight() != this->height)
-    {
-        std::cerr << filePath <<" image has bad height value\n";
-    }
-
-    if(number == 0)
-    {
-        this->width = dicomImage->getWidth ();
-    }
-    else if( ( IndexType ) dicomImage->getWidth() != this->width)
-    {
-        std::cerr << filePath <<" image has bad width value\n";
-    }
-
-    if(number == 0)
-    {
-        imagesInfo.bps = dicomImage->getDepth ();
-    }
-    else if( ( IndexType ) dicomImage->getDepth() != imagesInfo.bps )
-    {
-        std::cerr << filePath <<" image has bad bps value\n";
-    }
-
-    //update vales
-    double min, max;
-    dicomImage->getMinMaxValues( min, max );
-    if(imagesInfo.minColorValue > min)
-    {
-        imagesInfo.minColorValue = min;
-    }
-
-    if(imagesInfo.maxColorValue < max)
-    {
-        imagesInfo.maxColorValue = max;
-    }
-
-    const unsigned long size = dicomImage->getOutputDataSize(16);
-    //number of unsigned ints to allocate
-    imagesInfo.frameUintsCount = size / sizeof(Uint16);
-    if (number == 0)
-    {//perform allocation only once
-        imagesInfo.frameSize = size;
-        if (pixelData)
-            delete pixelData;
-        pixelData = new Uint16[imagesInfo.frameUintsCount * fileList.size()];
-    }
-    else
-    {//check image size for compatibility
-        if( ( unsigned long ) imagesInfo.frameSize != size )
-        {
-            std::cerr << filePath << " image has bad frame size value\n";
-            return false;
-        }
-    }
-
-    dicomImage->setMinMaxWindow();
-    double center, width;
-    dicomImage->getWindow(center,width);
-    imagesInfo.window.center = center;
-    imagesInfo.window.width = width ;
-    dicomImage->setWindow(imagesInfo.window.center, imagesInfo.window.width);
-
-    void *target = pixelData + (imagesInfo.frameUintsCount * imagesInfo.imagesCount);
-    dicomImage->getOutputData(target,size,16);
-    imagesInfo.imagesCount++;
-
-    //delete image object - data are stored separately
-    delete dicomImage;
-    dicomImage = NULL;
-    return true;
+   if( dicomImage != nullptr ) {
+      EI_Status imageStatus = dicomImage->getStatus();
+      if( imageStatus == EIS_Normal ) {
+         // ok - image loaded
+      }
+      else if( imageStatus == EIS_MissingAttribute ) {
+         // bitmap is propably old ARC/NEMA format
+         std::cerr << "Error: cannot load DICOM image(ACR/NEMA) (" << DicomImage::getString( dicomImage->getStatus() ) << ")"
+                   << std::endl;
+
+         delete dicomImage;
+         dicomImage = nullptr;
+         return false;
+      }
+      else {
+         delete dicomImage;
+         dicomImage = nullptr;
+         std::cerr << "Error: cannot load DICOM image (" << DicomImage::getString( dicomImage->getStatus() ) << ")"
+                   << std::endl;
+         return false;
+      }
+   }
+
+   if( number == 0 ) {
+      this->height = dicomImage->getHeight();
+   }
+   else if( (IndexType) dicomImage->getHeight() != this->height ) {
+      std::cerr << filePath << " image has bad height value\n";
+   }
+
+   if( number == 0 ) {
+      this->width = dicomImage->getWidth();
+   }
+   else if( (IndexType) dicomImage->getWidth() != this->width ) {
+      std::cerr << filePath << " image has bad width value\n";
+   }
+
+   if( number == 0 ) {
+      imagesInfo.bps = dicomImage->getDepth();
+   }
+   else if( (IndexType) dicomImage->getDepth() != imagesInfo.bps ) {
+      std::cerr << filePath << " image has bad bps value\n";
+   }
+
+   // update vales
+   double min, max;
+   dicomImage->getMinMaxValues( min, max );
+   if( imagesInfo.minColorValue > min ) {
+      imagesInfo.minColorValue = min;
+   }
+
+   if( imagesInfo.maxColorValue < max ) {
+      imagesInfo.maxColorValue = max;
+   }
+
+   const unsigned long size = dicomImage->getOutputDataSize( 16 );
+   // number of unsigned ints to allocate
+   imagesInfo.frameUintsCount = size / sizeof( Uint16 );
+   if( number == 0 ) {  // perform allocation only once
+      imagesInfo.frameSize = size;
+      if( pixelData )
+         delete pixelData;
+      pixelData = new Uint16[ imagesInfo.frameUintsCount * fileList.size() ];
+   }
+   else {  // check image size for compatibility
+      if( (unsigned long) imagesInfo.frameSize != size ) {
+         std::cerr << filePath << " image has bad frame size value\n";
+         return false;
+      }
+   }
+
+   dicomImage->setMinMaxWindow();
+   double center, width;
+   dicomImage->getWindow( center, width );
+   imagesInfo.window.center = center;
+   imagesInfo.window.width = width;
+   dicomImage->setWindow( imagesInfo.window.center, imagesInfo.window.width );
+
+   void* target = pixelData + ( imagesInfo.frameUintsCount * imagesInfo.imagesCount );
+   dicomImage->getOutputData( target, size, 16 );
+   imagesInfo.imagesCount++;
+
+   // delete image object - data are stored separately
+   delete dicomImage;
+   dicomImage = nullptr;
+   return true;
 #else
-    std::cerr << "DICOM format is not supported in this build of TNL." << std::endl;
-    return false;
+   std::cerr << "DICOM format is not supported in this build of TNL." << std::endl;
+   return false;
 #endif
 }
 
-
-inline bool DicomSeries::loadDicomSeries( const String& filePath )
+inline bool
+DicomSeries::loadDicomSeries( const String& filePath )
 {
    /***
     * Load list of files
     */
-   if( ! retrieveFileList( filePath ) )
-   {
+   if( ! retrieveFileList( filePath ) ) {
       std::cerr << "I am not able to retrieve the files of the DICOM series in " << filePath << "." << std::endl;
       return false;
    }
 
-   //load images
+   // load images
    int counter = 0;
-   for( auto& file : fileList )
-   {
-      if( !loadImage( file.getString(), counter ) )
-      {
+   for( auto& file : fileList ) {
+      if( ! loadImage( file.getString(), counter ) ) {
          std::cerr << file << " skipped";
       }
       counter++;
@@ -334,64 +303,74 @@ inline bool DicomSeries::loadDicomSeries( const String& filePath )
    return true;
 }
 
-inline int DicomSeries::getImagesCount()
+inline int
+DicomSeries::getImagesCount()
 {
-    return imagesInfo.imagesCount;
+   return imagesInfo.imagesCount;
 }
 
 #ifdef HAVE_DCMTK_H
-inline const Uint16 *DicomSeries::getData( int imageNumber )
+inline const Uint16*
+DicomSeries::getData( int imageNumber )
 {
-    return &pixelData[ imageNumber * imagesInfo.frameUintsCount ];
+   return &pixelData[ imageNumber * imagesInfo.frameUintsCount ];
 }
 #endif
 
-inline int DicomSeries::getColorCount()
+inline int
+DicomSeries::getColorCount()
 {
-    return imagesInfo.colorsCount;
+   return imagesInfo.colorsCount;
 }
 
-inline int DicomSeries::getBitsPerSampleCount()
+inline int
+DicomSeries::getBitsPerSampleCount()
 {
-    return imagesInfo.bps;
+   return imagesInfo.bps;
 }
 
-inline int DicomSeries::getMinColorValue()
+inline int
+DicomSeries::getMinColorValue()
 {
-    return imagesInfo.minColorValue;
+   return imagesInfo.minColorValue;
 }
 
-inline WindowCenterWidth DicomSeries::getWindowDefaults()
+inline WindowCenterWidth
+DicomSeries::getWindowDefaults()
 {
-    return imagesInfo.window;
+   return imagesInfo.window;
 }
 
-inline int DicomSeries::getMaxColorValue()
+inline int
+DicomSeries::getMaxColorValue()
 {
-    return imagesInfo.maxColorValue;
+   return imagesInfo.maxColorValue;
 }
 
-inline void DicomSeries::freeData()
+inline void
+DicomSeries::freeData()
 {
 #ifdef HAVE_DCMTK_H
-    if (pixelData)
-        delete pixelData;
-    pixelData = NULL;
+   if( pixelData )
+      delete pixelData;
+   pixelData = nullptr;
 #endif
 }
 
-inline DicomHeader &DicomSeries::getHeader(int image)
+inline DicomHeader&
+DicomSeries::getHeader( int image )
 {
-    //check user argument
-    if((image > 0) | (image <= dicomSeriesHeaders.getSize()))
-        return *dicomSeriesHeaders.getElement(image);
-    throw std::out_of_range("image index out of range");
+   // check user argument
+   if( ( image > 0 ) | ( image <= dicomSeriesHeaders.getSize() ) )
+      return *dicomSeriesHeaders.getElement( image );
+   throw std::out_of_range( "image index out of range" );
 }
 
-inline bool DicomSeries::isDicomSeriesLoaded()
+inline bool
+DicomSeries::isDicomSeriesLoaded()
 {
-    return isLoaded;
+   return isLoaded;
 }
 
-} // namespace Images
-} // namespace TNL
+}  // namespace Images
+}  // namespace TNL
diff --git a/src/TNL/Images/Image.h b/src/TNL/Images/Image.h
index 77c1a4e423baaa8ec17dd4032f3e4ba000cc70d6..c17e22ddc647a65667e78d23e918bee7af29a64b 100644
--- a/src/TNL/Images/Image.h
+++ b/src/TNL/Images/Image.h
@@ -15,28 +15,26 @@ namespace Images {
 template< typename Index = int >
 class Image
 {
-   public:
- 
-      typedef Index IndexType;
- 
-      Image() : width( 0 ), height( 0 ) {};
- 
-      IndexType getWidth() const
-      {
-         return this->width;
-      }
- 
-      IndexType getHeight() const
-      {
-         return this->height;
-      }
- 
-   protected:
- 
-      IndexType width, height;
- 
-};
+public:
+   using IndexType = Index;
+
+   Image() : width( 0 ), height( 0 ){};
+
+   IndexType
+   getWidth() const
+   {
+      return this->width;
+   }
 
-} // namespace Images
-} // namespace TNL
+   IndexType
+   getHeight() const
+   {
+      return this->height;
+   }
+
+protected:
+   IndexType width, height;
+};
 
+}  // namespace Images
+}  // namespace TNL
diff --git a/src/TNL/Images/JPEGImage.h b/src/TNL/Images/JPEGImage.h
index ce08b43b186078c39bce20eb95e34daf30bd9f2d..79c7c6c927b19efe8ffe1d4e75298c934430ed8a 100644
--- a/src/TNL/Images/JPEGImage.h
+++ b/src/TNL/Images/JPEGImage.h
@@ -7,7 +7,7 @@
 #pragma once
 
 #ifdef HAVE_JPEG_H
-#include <jpeglib.h>
+   #include <jpeglib.h>
 #endif
 
 #include <TNL/String.h>
@@ -28,65 +28,59 @@ namespace Images {
 template< typename Index = int >
 class JPEGImage : public Image< Index >
 {
-   public:
+public:
+   using IndexType = Index;
 
-      typedef Index IndexType;
+   JPEGImage();
 
-      JPEGImage();
+   bool
+   openForRead( const String& fileName );
 
-      bool openForRead( const String& fileName );
+   template< typename MeshReal, typename Device, typename Real >
+   bool
+   read( RegionOfInterest< Index > roi,
+         Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function );
 
-      template< typename MeshReal,
-                typename Device,
-                typename Real >
-      bool read( const RegionOfInterest< Index > roi,
-                 Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function );
+   template< typename Real, typename Device >
+   bool
+   openForWrite( const String& fileName, Meshes::Grid< 2, Real, Device, Index >& grid );
 
+   // TODO: Obsolete
+   template< typename Real, typename Device, typename Vector >
+   bool
+   write( const Meshes::Grid< 2, Real, Device, Index >& grid, Vector& vector );
 
-      template< typename Real,
-                typename Device >
-      bool openForWrite( const String& fileName,
-                         Meshes::Grid< 2, Real, Device, Index >& grid );
+   template< typename MeshReal, typename Device, typename Real >
+   bool
+   write( const Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function );
 
-      // TODO: Obsolete
-      template< typename Real,
-                typename Device,
-                typename Vector >
-      bool write( const Meshes::Grid< 2, Real, Device, Index >& grid,
-                  Vector& vector );
+   void
+   close();
 
-      template< typename MeshReal,
-                typename Device,
-                typename Real >
-      bool write( const Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function );
+   ~JPEGImage();
 
+protected:
+   bool
+   readHeader();
 
-      void close();
+   template< typename Real, typename Device >
+   bool
+   writeHeader( const Meshes::Grid< 2, Real, Device, Index >& grid );
 
-      ~JPEGImage();
+   FILE* file;
 
-   protected:
-
-      bool readHeader();
-
-      template< typename Real,
-                typename Device >
-      bool writeHeader( const Meshes::Grid< 2, Real, Device, Index >& grid );
-
-      FILE* file;
-
-      bool fileOpen;
+   bool fileOpen;
 
 #ifdef HAVE_JPEG_H
-      my_error_mgr jerr;
-      jpeg_decompress_struct decinfo;
-      jpeg_compress_struct cinfo;
-      int components;
-      J_COLOR_SPACE color_space;
+   my_error_mgr jerr;
+   jpeg_decompress_struct decinfo;
+   jpeg_compress_struct cinfo;
+   int components;
+   J_COLOR_SPACE color_space;
 #endif
 };
 
-} // namespace Images
-} // namespace TNL
+}  // namespace Images
+}  // namespace TNL
 
 #include <TNL/Images/JPEGImage_impl.h>
diff --git a/src/TNL/Images/JPEGImage_impl.h b/src/TNL/Images/JPEGImage_impl.h
index cc94c1f7cbc0886a9c3f4cb0c0e52b7df2f431d7..a8c7335898deceb853b84121e030cbd332294894 100644
--- a/src/TNL/Images/JPEGImage_impl.h
+++ b/src/TNL/Images/JPEGImage_impl.h
@@ -6,7 +6,7 @@
 
 #pragma once
 
-#include <setjmp.h>
+#include <csetjmp>
 
 #include <TNL/Images/JPEGImage.h>
 
@@ -14,45 +14,41 @@ namespace TNL {
 namespace Images {
 
 #ifdef HAVE_JPEG_H
-inline void my_error_exit( j_common_ptr cinfo )
+inline void
+my_error_exit( j_common_ptr cinfo )
 {
-  /* cinfo->err really points to a my_error_mgr struct, so coerce pointer */
-  my_error_mgr* myerr = ( my_error_mgr* ) cinfo->err;
+   /* cinfo->err really points to a my_error_mgr struct, so coerce pointer */
+   my_error_mgr* myerr = (my_error_mgr*) cinfo->err;
 
-  /* Always display the message. */
-  /* We could postpone this until after returning, if we chose. */
-  ( *cinfo->err->output_message )( cinfo );
+   /* Always display the message. */
+   /* We could postpone this until after returning, if we chose. */
+   ( *cinfo->err->output_message )( cinfo );
 
-  /* Return control to the setjmp point */
-  longjmp( myerr->setjmp_buffer, 1 );
+   /* Return control to the setjmp point */
+   longjmp( myerr->setjmp_buffer, 1 );
 }
 #endif
 
 template< typename Index >
-JPEGImage< Index >::
-JPEGImage() :
-   fileOpen( false )
-{
-}
+JPEGImage< Index >::JPEGImage() : fileOpen( false )
+{}
 
 template< typename Index >
 bool
-JPEGImage< Index >::
-readHeader()
+JPEGImage< Index >::readHeader()
 {
 #ifdef HAVE_JPEG_H
-   this->decinfo.err = jpeg_std_error(&jerr.pub);
+   this->decinfo.err = jpeg_std_error( &jerr.pub );
    this->jerr.pub.error_exit = my_error_exit;
 
    /***
     * Prepare the long jump back from libjpeg.
     */
-   if( setjmp( jerr.setjmp_buffer ) )
-   {
-       /****
-        * If we get here, the JPEG code has signaled an error.
-        * We need to clean up the JPEG object, close the input file, and return.
-        */
+   if( setjmp( jerr.setjmp_buffer ) ) {
+      /****
+       * If we get here, the JPEG code has signaled an error.
+       * We need to clean up the JPEG object, close the input file, and return.
+       */
       jpeg_destroy_decompress( &this->decinfo );
       return false;
    }
@@ -64,8 +60,8 @@ readHeader()
    this->height = this->decinfo.image_height;
    this->width = this->decinfo.image_width;
    this->components = this->decinfo.num_components;
-   //this->color_space = this->cinfo.jpeg_color_space;
-   //cout << this->height << " x " << this->width << " : " << this->components << " " << this->color_space << std::endl;
+   // this->color_space = this->cinfo.jpeg_color_space;
+   // cout << this->height << " x " << this->width << " : " << this->components << " " << this->color_space << std::endl;
    return true;
 #else
    std::cerr << "TNL was not compiled with support of JPEG. You may still use PGM format." << std::endl;
@@ -75,13 +71,11 @@ readHeader()
 
 template< typename Index >
 bool
-JPEGImage< Index >::
-openForRead( const String& fileName )
+JPEGImage< Index >::openForRead( const String& fileName )
 {
    this->close();
    this->file = fopen( fileName.getString(), "r" );
-   if( ! this->file )
-   {
+   if( ! this->file ) {
       std::cerr << "Unable to open the file " << fileName << std::endl;
       return false;
    }
@@ -92,70 +86,60 @@ openForRead( const String& fileName )
 }
 
 template< typename Index >
-   template< typename MeshReal,
-             typename Device,
-             typename Real >
+template< typename MeshReal, typename Device, typename Real >
 bool
-JPEGImage< Index >::
-read( const RegionOfInterest< Index > roi,
-      Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function )
+JPEGImage< Index >::read( const RegionOfInterest< Index > roi,
+                          Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function )
 {
 #ifdef HAVE_JPEG_H
-   typedef Meshes::Grid< 2, Real, Device, Index > GridType;
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
    const GridType& grid = function.getMesh();
    typename GridType::Cell cell( grid );
 
    /***
     * Prepare the long jump back from libjpeg.
     */
-   if( setjmp( jerr.setjmp_buffer ) )
-   {
-       /****
-        * If we get here, the JPEG code has signaled an error.
-        * We need to clean up the JPEG object, close the input file, and return.
-        */
+   if( setjmp( jerr.setjmp_buffer ) ) {
+      /****
+       * If we get here, the JPEG code has signaled an error.
+       * We need to clean up the JPEG object, close the input file, and return.
+       */
       jpeg_destroy_decompress( &this->decinfo );
       return false;
    }
 
    jpeg_start_decompress( &this->decinfo );
    int row_stride = this->decinfo.output_width * this->decinfo.output_components;
-   JSAMPARRAY row = ( *( this->decinfo.mem->alloc_sarray ) )( ( j_common_ptr ) &this->decinfo,
-                                                              JPOOL_IMAGE,
-                                                              row_stride,
-                                                              1 );
+   JSAMPARRAY row = ( *( this->decinfo.mem->alloc_sarray ) )( ( j_common_ptr ) & this->decinfo, JPOOL_IMAGE, row_stride, 1 );
 
    Index i( 0 ), j;
-   while( this->decinfo.output_scanline < this->decinfo.output_height)
-   {
+   while( this->decinfo.output_scanline < this->decinfo.output_height ) {
       jpeg_read_scanlines( &this->decinfo, row, 1 );
-      for( j = 0; j < this->width; j ++ )
-      {
-         if( !roi.isIn( i, j ) )
+      for( j = 0; j < this->width; j++ ) {
+         if( ! roi.isIn( i, j ) )
             continue;
 
-         cell.getCoordinates().x() =  j - roi.getLeft();
+         cell.getCoordinates().x() = j - roi.getLeft();
          cell.getCoordinates().y() = roi.getBottom() - 1 - i;
-         //Index cellIndex = grid.getCellIndex( CoordinatesType( j - roi.getLeft(),
-         //                                     roi.getBottom() - 1 - i ) );
+         // Index cellIndex = grid.getCellIndex( CoordinatesType( j - roi.getLeft(),
+         //                                      roi.getBottom() - 1 - i ) );
          cell.refresh();
          unsigned char char_color[ 4 ];
-         //unsigned int int_color[ 4 ];
+         // unsigned int int_color[ 4 ];
          Real value, r, g, b;
-         switch( this->components )
-         {
+         switch( this->components ) {
             case 1:
                char_color[ 0 ] = row[ 0 ][ j ];
-               value = char_color[ 0 ] / ( Real ) 255.0;
+               value = char_color[ 0 ] / (Real) 255.0;
                function.getData().setElement( cell.getIndex(), value );
                break;
             case 3:
                char_color[ 0 ] = row[ 0 ][ 3 * j ];
                char_color[ 1 ] = row[ 0 ][ 3 * j + 1 ];
                char_color[ 2 ] = row[ 0 ][ 3 * j + 2 ];
-               r = char_color[ 0 ] / ( Real ) 255.0;
-               g = char_color[ 1 ] / ( Real ) 255.0;
-               b = char_color[ 2 ] / ( Real ) 255.0;
+               r = char_color[ 0 ] / (Real) 255.0;
+               g = char_color[ 1 ] / (Real) 255.0;
+               b = char_color[ 2 ] / (Real) 255.0;
                value = 0.2989 * r + 0.5870 * g + 0.1140 * b;
                function.getData().setElement( cell.getIndex(), value );
                break;
@@ -168,17 +152,15 @@ read( const RegionOfInterest< Index > roi,
    }
    return true;
 #else
-   //cerr << "TNL was not compiled with support of JPEG. You may still use PGM format." << std::endl;
+   // cerr << "TNL was not compiled with support of JPEG. You may still use PGM format." << std::endl;
    return false;
 #endif
 }
 
 template< typename Index >
-   template< typename Real,
-             typename Device >
+template< typename Real, typename Device >
 bool
-JPEGImage< Index >::
-writeHeader( const Meshes::Grid< 2, Real, Device, Index >& grid )
+JPEGImage< Index >::writeHeader( const Meshes::Grid< 2, Real, Device, Index >& grid )
 {
 #ifdef HAVE_JPEG_H
    this->cinfo.err = jpeg_std_error( &this->jerr.pub );
@@ -192,23 +174,19 @@ writeHeader( const Meshes::Grid< 2, Real, Device, Index >& grid )
    jpeg_start_compress( &this->cinfo, true );
    return true;
 #else
-   //cerr << "TNL was not compiled with support of JPEG. You may still use PGM format." << std::endl;
+   // cerr << "TNL was not compiled with support of JPEG. You may still use PGM format." << std::endl;
    return false;
 #endif
 }
 
 template< typename Index >
-   template< typename Real,
-             typename Device >
+template< typename Real, typename Device >
 bool
-JPEGImage< Index >::
-openForWrite( const String& fileName,
-              Meshes::Grid< 2, Real, Device, Index >& grid )
+JPEGImage< Index >::openForWrite( const String& fileName, Meshes::Grid< 2, Real, Device, Index >& grid )
 {
    this->close();
    this->file = fopen( fileName.getString(), "w" );
-   if( ! this->file )
-   {
+   if( ! this->file ) {
       std::cerr << "Unable to open the file " << fileName << std::endl;
       return false;
    }
@@ -219,31 +197,25 @@ openForWrite( const String& fileName,
 }
 
 template< typename Index >
-   template< typename Real,
-             typename Device,
-             typename Vector >
+template< typename Real, typename Device, typename Vector >
 bool
-JPEGImage< Index >::
-write( const Meshes::Grid< 2, Real, Device, Index >& grid,
-       Vector& vector )
+JPEGImage< Index >::write( const Meshes::Grid< 2, Real, Device, Index >& grid, Vector& vector )
 {
-   typedef Meshes::Grid< 2, Real, Device, Index > GridType;
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
    typename GridType::Cell cell( grid );
 
 #ifdef HAVE_JPEG_H
    Index i( 0 ), j;
-   JSAMPROW row[1];
+   JSAMPROW row[ 1 ];
    row[ 0 ] = new JSAMPLE[ grid.getDimensions().x() ];
    // JSAMPLE is unsigned char
-   while( this->cinfo.next_scanline < this->cinfo.image_height )
-   {
-      for( j = 0; j < grid.getDimensions().x(); j ++ )
-      {
+   while( this->cinfo.next_scanline < this->cinfo.image_height ) {
+      for( j = 0; j < grid.getDimensions().x(); j++ ) {
          cell.getCoordinates().x() = j;
          cell.getCoordinates().y() = grid.getDimensions().y() - 1 - i;
 
-         //Index cellIndex = grid.getCellIndex( CoordinatesType( j,
-         //                                     grid.getDimensions().y() - 1 - i ) );
+         // Index cellIndex = grid.getCellIndex( CoordinatesType( j,
+         //                                      grid.getDimensions().y() - 1 - i ) );
 
          row[ 0 ][ j ] = 255 * vector.getElement( cell.getIndex() );
       }
@@ -260,31 +232,26 @@ write( const Meshes::Grid< 2, Real, Device, Index >& grid,
 }
 
 template< typename Index >
-   template< typename MeshReal,
-             typename Device,
-             typename Real >
+template< typename MeshReal, typename Device, typename Real >
 bool
-JPEGImage< Index >::
-write( const Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function )
+JPEGImage< Index >::write( const Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function )
 {
-   typedef Meshes::Grid< 2, Real, Device, Index > GridType;
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
    const GridType& grid = function.getMesh();
    typename GridType::Cell cell( grid );
 
 #ifdef HAVE_JPEG_H
    Index i( 0 ), j;
-   JSAMPROW row[1];
+   JSAMPROW row[ 1 ];
    row[ 0 ] = new JSAMPLE[ grid.getDimensions().x() ];
    // JSAMPLE is unsigned char
-   while( this->cinfo.next_scanline < this->cinfo.image_height )
-   {
-      for( j = 0; j < grid.getDimensions().x(); j ++ )
-      {
+   while( this->cinfo.next_scanline < this->cinfo.image_height ) {
+      for( j = 0; j < grid.getDimensions().x(); j++ ) {
          cell.getCoordinates().x() = j;
          cell.getCoordinates().y() = grid.getDimensions().y() - 1 - i;
 
-         //Index cellIndex = grid.getCellIndex( CoordinatesType( j,
-         //                                     grid.getDimensions().y() - 1 - i ) );
+         // Index cellIndex = grid.getCellIndex( CoordinatesType( j,
+         //                                      grid.getDimensions().y() - 1 - i ) );
 
          row[ 0 ][ j ] = 255 * function.getData().getElement( cell.getIndex() );
       }
@@ -300,12 +267,9 @@ write( const Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >
 #endif
 }
 
-
-
 template< typename Index >
 void
-JPEGImage< Index >::
-close()
+JPEGImage< Index >::close()
 {
    if( this->fileOpen )
       fclose( file );
@@ -313,13 +277,10 @@ close()
 }
 
 template< typename Index >
-JPEGImage< Index >::
-~JPEGImage()
+JPEGImage< Index >::~JPEGImage()
 {
    close();
 }
 
-} // namespace Images
-} // namespace TNL
-
-
+}  // namespace Images
+}  // namespace TNL
diff --git a/src/TNL/Images/PGMImage.h b/src/TNL/Images/PGMImage.h
index e8a6adc4b09567bfedd2f16ecfcdd54933490393..c8cf365abfa78f6d60cd571791d1b17fc3768010 100644
--- a/src/TNL/Images/PGMImage.h
+++ b/src/TNL/Images/PGMImage.h
@@ -19,61 +19,55 @@ namespace Images {
 template< typename Index = int >
 class PGMImage : public Image< Index >
 {
-   public:
+public:
+   using IndexType = Index;
 
-      typedef Index IndexType;
+   PGMImage();
 
-      PGMImage();
+   bool
+   openForRead( const String& fileName );
 
-      bool openForRead( const String& fileName );
+   template< typename MeshReal, typename Device, typename Real >
+   bool
+   read( RegionOfInterest< Index > roi,
+         Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function );
 
-      template< typename MeshReal,
-                typename Device,
-                typename Real >
-      bool read( const RegionOfInterest< Index > roi,
-                 Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function );
+   template< typename Real, typename Device >
+   bool
+   openForWrite( const String& fileName, Meshes::Grid< 2, Real, Device, Index >& grid, bool binary = true );
 
-      template< typename Real,
-                typename Device >
-      bool openForWrite( const String& fileName,
-                         Meshes::Grid< 2, Real, Device, Index >& grid,
-                         bool binary = true );
+   // TODO: obsolete
+   template< typename Real, typename Device, typename Vector >
+   bool
+   write( const Meshes::Grid< 2, Real, Device, Index >& grid, Vector& vector );
 
-      // TODO: obsolete
-      template< typename Real,
-                typename Device,
-                typename Vector >
-      bool write( const Meshes::Grid< 2, Real, Device, Index >& grid,
-                  Vector& vector );
+   template< typename MeshReal, typename Device, typename Real >
+   bool
+   write( const Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function );
 
-      template< typename MeshReal,
-                typename Device,
-                typename Real >
-      bool write( const Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function );
+   void
+   close();
 
-      void close();
+   ~PGMImage();
 
-      ~PGMImage();
+protected:
+   bool
+   readHeader();
 
-      protected:
+   template< typename Real, typename Device >
+   bool
+   writeHeader( const Meshes::Grid< 2, Real, Device, Index >& grid, bool binary );
 
-         bool readHeader();
+   bool binary;
 
-         template< typename Real,
-                   typename Device >
-         bool writeHeader( const Meshes::Grid< 2, Real, Device, Index >& grid,
-                           bool binary );
+   IndexType maxColors;
 
-         bool binary;
+   std::fstream file;
 
-         IndexType maxColors;
-
-         std::fstream file;
-
-         bool fileOpen;
+   bool fileOpen;
 };
 
-} // namespace Images
-} // namespace TNL
+}  // namespace Images
+}  // namespace TNL
 
 #include <TNL/Images/PGMImage_impl.h>
diff --git a/src/TNL/Images/PGMImage_impl.h b/src/TNL/Images/PGMImage_impl.h
index 7dc64823392f24910ac25d2231da9fd193de8fed..d14575925d6b9a9251f7bf1a1943c332e43090c0 100644
--- a/src/TNL/Images/PGMImage_impl.h
+++ b/src/TNL/Images/PGMImage_impl.h
@@ -14,21 +14,16 @@ namespace TNL {
 namespace Images {
 
 template< typename Index >
-PGMImage< Index >::
-PGMImage() :
-   binary( false ), maxColors( 0 ), fileOpen( false )
-{
-}
+PGMImage< Index >::PGMImage() : binary( false ), maxColors( 0 ), fileOpen( false )
+{}
 
 template< typename Index >
 bool
-PGMImage< Index >::
-readHeader()
+PGMImage< Index >::readHeader()
 {
    std::string magicNumber;
    this->file >> magicNumber;
-   if( this->file.fail() )
-   {
+   if( this->file.fail() ) {
       std::cerr << "Unable to read the magic number." << std::endl;
       return false;
    }
@@ -36,17 +31,16 @@ readHeader()
    if( magicNumber != "P5" && magicNumber != "P2" )
       return false;
 
-   if(  magicNumber == "P5" )
+   if( magicNumber == "P5" )
       this->binary = true;
 
    char character;
-   this->file.get(character);
-   while ( ! this->file.eof() and ( character == ' ' || character == '\t' || character == '\r' || character == '\n') )
-   {
-	this->file.get(character);
-	if ( character == '#' )
-		while (! this->file.eof() && ( character != '\n' ) )
-			this->file.get( character );
+   this->file.get( character );
+   while( ! this->file.eof() and ( character == ' ' || character == '\t' || character == '\r' || character == '\n' ) ) {
+      this->file.get( character );
+      if( character == '#' )
+         while( ! this->file.eof() && ( character != '\n' ) )
+            this->file.get( character );
    }
    this->file.unget();
 
@@ -56,16 +50,14 @@ readHeader()
 
 template< typename Index >
 bool
-PGMImage< Index >::
-openForRead( const String& fileName )
+PGMImage< Index >::openForRead( const String& fileName )
 {
    this->close();
-   if ( this->binary )
-   	this->file.open( fileName.getString(), std::fstream::in | std::fstream::binary);
+   if( this->binary )
+      this->file.open( fileName.getString(), std::fstream::in | std::fstream::binary );
    else
-	this->file.open( fileName.getString(), std::fstream::in );
-   if( ! this->file )
-   {
+      this->file.open( fileName.getString(), std::fstream::in );
+   if( ! this->file ) {
       std::cerr << "Unable to open the file " << fileName << std::endl;
       return false;
    }
@@ -76,74 +68,61 @@ openForRead( const String& fileName )
 }
 
 template< typename Index >
-   template< typename MeshReal,
-             typename Device,
-             typename Real >
+template< typename MeshReal, typename Device, typename Real >
 bool
-PGMImage< Index >::
-read( const RegionOfInterest< Index > roi,
-      Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function )
+PGMImage< Index >::read( const RegionOfInterest< Index > roi,
+                         Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function )
 {
-   typedef Meshes::Grid< 2, Real, Device, Index > GridType;
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
    const GridType& grid = function.getMesh();
    typename GridType::Cell cell( grid );
 
    Index i, j;
-   for( i = 0; i < this->height; i ++ )
-      for( j = 0; j < this->width; j ++ )
-      {
+   for( i = 0; i < this->height; i++ )
+      for( j = 0; j < this->width; j++ ) {
          int col;
          unsigned char col_aux;
-         if( this->binary )
-         {
-           this->file >> col_aux;
-           col = (int)col_aux;
+         if( this->binary ) {
+            this->file >> col_aux;
+            col = (int) col_aux;
          }
-         else this->file >> col;
-         if( roi.isIn( i, j ) )
-         {
+         else
+            this->file >> col;
+         if( roi.isIn( i, j ) ) {
             cell.getCoordinates().x() = j - roi.getLeft();
             cell.getCoordinates().y() = roi.getBottom() - 1 - i;
             cell.refresh();
-            function.getData().setElement( cell.getIndex(), ( Real ) col / ( Real ) this->maxColors );
+            function.getData().setElement( cell.getIndex(), (Real) col / (Real) this->maxColors );
          }
       }
    return true;
 }
 
 template< typename Index >
-   template< typename Real,
-             typename Device >
+template< typename Real, typename Device >
 bool
-PGMImage< Index >::
-writeHeader( const Meshes::Grid< 2, Real, Device, Index >& grid,
-             bool binary )
+PGMImage< Index >::writeHeader( const Meshes::Grid< 2, Real, Device, Index >& grid, bool binary )
 {
    if( binary )
       this->file << "P5\n";
    else
       this->file << "P2\n";
    this->file << "# This file was generated by TNL (tnl-image-converter)\n";
-   this->file << grid.getDimensions().x() << ' '<< grid.getDimensions().y() << '\n' << "255\n";
+   this->file << grid.getDimensions().x() << ' ' << grid.getDimensions().y() << '\n' << "255\n";
    return true;
 }
 
 template< typename Index >
-   template< typename Real,
-             typename Device >
+template< typename Real, typename Device >
 bool
-PGMImage< Index >::
-openForWrite( const String& fileName,
-              Meshes::Grid< 2, Real, Device, Index >& grid,
-              bool binary )
+PGMImage< Index >::openForWrite( const String& fileName, Meshes::Grid< 2, Real, Device, Index >& grid, bool binary )
 {
    this->close();
    if( binary )
-        this->file.open( fileName.getString(), std::fstream::out | std::fstream::binary);
+      this->file.open( fileName.getString(), std::fstream::out | std::fstream::binary );
    else
-        this->file.open( fileName.getString(), std::fstream::out);
-   if( this->file.fail() )
-   {
+      this->file.open( fileName.getString(), std::fstream::out );
+   if( this->file.fail() ) {
       std::cerr << "Unable to open the file " << fileName << std::endl;
       return false;
    }
@@ -155,88 +134,75 @@ openForWrite( const String& fileName,
 }
 
 template< typename Index >
-   template< typename Real,
-             typename Device,
-             typename Vector >
+template< typename Real, typename Device, typename Vector >
 bool
-PGMImage< Index >::
-write( const Meshes::Grid< 2, Real, Device, Index >& grid,
-       Vector& vector )
+PGMImage< Index >::write( const Meshes::Grid< 2, Real, Device, Index >& grid, Vector& vector )
 {
-   typedef Meshes::Grid< 2, Real, Device, Index > GridType;
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
    typename GridType::Cell cell( grid );
 
    Index i, j;
-   for( i = 0; i < grid.getDimensions().y(); i ++ )
-   {
-      for( j = 0; j < grid.getDimensions().x(); j ++ )
-      {
+   for( i = 0; i < grid.getDimensions().y(); i++ ) {
+      for( j = 0; j < grid.getDimensions().x(); j++ ) {
          cell.getCoordinates().x() = j;
          cell.getCoordinates().y() = grid.getDimensions().y() - 1 - i;
          cell.refresh();
 
-         //Index cellIndex = grid.getCellIndex( CoordinatesType( j,
-         //                                     grid.getDimensions().y() - 1 - i ) );
+         // Index cellIndex = grid.getCellIndex( CoordinatesType( j,
+         //                                      grid.getDimensions().y() - 1 - i ) );
 
          unsigned char color = 255 * vector.getElement( cell.getIndex() );
-         if ( ! this->binary )
-         {
-             int color_aux = (int)color;
-             this->file << color_aux;
-                  this->file << ' ';
+         if( ! this->binary ) {
+            int color_aux = (int) color;
+            this->file << color_aux;
+            this->file << ' ';
          }
-         else this->file << color;
+         else
+            this->file << color;
       }
-      if ( ! this->binary )
+      if( ! this->binary )
          this->file << '\n';
    }
    return true;
 }
 
 template< typename Index >
-   template< typename MeshReal,
-             typename Device,
-             typename Real >
+template< typename MeshReal, typename Device, typename Real >
 bool
-PGMImage< Index >::
-write( const Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function )
+PGMImage< Index >::write( const Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function )
 {
-   typedef Meshes::Grid< 2, Real, Device, Index > GridType;
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
    const GridType& grid = function.getMesh();
    typename GridType::Cell cell( grid );
 
    Index i, j;
-   for( i = 0; i < grid.getDimensions().y(); i ++ )
-   {
-      for( j = 0; j < grid.getDimensions().x(); j ++ )
-      {
+   for( i = 0; i < grid.getDimensions().y(); i++ ) {
+      for( j = 0; j < grid.getDimensions().x(); j++ ) {
          cell.getCoordinates().x() = j;
          cell.getCoordinates().y() = grid.getDimensions().y() - 1 - i;
          cell.refresh();
 
-         //Index cellIndex = grid.getCellIndex( CoordinatesType( j,
-         //                                     grid.getDimensions().y() - 1 - i ) );
+         // Index cellIndex = grid.getCellIndex( CoordinatesType( j,
+         //                                      grid.getDimensions().y() - 1 - i ) );
 
          unsigned char color = 255 * function.getData().getElement( cell.getIndex() );
-         if ( ! this->binary )
-         {
-             int color_aux = (int)color;
-             this->file << color_aux;
-                  this->file << ' ';
+         if( ! this->binary ) {
+            int color_aux = (int) color;
+            this->file << color_aux;
+            this->file << ' ';
          }
-         else this->file << color;
+         else
+            this->file << color;
       }
-      if ( ! this->binary )
+      if( ! this->binary )
          this->file << '\n';
    }
    return true;
 }
 
-
 template< typename Index >
 void
-PGMImage< Index >::
-close()
+PGMImage< Index >::close()
 {
    if( this->fileOpen )
       this->file.close();
@@ -244,12 +210,10 @@ close()
 }
 
 template< typename Index >
-PGMImage< Index >::
-~PGMImage()
+PGMImage< Index >::~PGMImage()
 {
    close();
 }
 
-} // namespace Images
-} // namespace TNL
-
+}  // namespace Images
+}  // namespace TNL
diff --git a/src/TNL/Images/PNGImage.h b/src/TNL/Images/PNGImage.h
index 16ae7a0ebaadda432b19fbf1b132e58d38924834..5fbdefa42c7996c9c0109c481623bf82a06ad61b 100644
--- a/src/TNL/Images/PNGImage.h
+++ b/src/TNL/Images/PNGImage.h
@@ -7,7 +7,7 @@
 #pragma once
 
 #ifdef HAVE_PNG_H
-#include <png.h>
+   #include <png.h>
 #endif
 
 #include <TNL/String.h>
@@ -21,64 +21,59 @@ namespace Images {
 template< typename Index = int >
 class PNGImage : public Image< Index >
 {
-   public:
+public:
+   using IndexType = Index;
 
-      using IndexType = Index;
+   PNGImage();
 
-      PNGImage();
+   bool
+   openForRead( const String& fileName );
 
-      bool openForRead( const String& fileName );
+   template< typename MeshReal, typename Device, typename Real >
+   bool
+   read( RegionOfInterest< Index > roi,
+         Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function );
 
-      template< typename MeshReal,
-                typename Device,
-                typename Real >
-      bool read( const RegionOfInterest< Index > roi,
-                 Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function );
+   template< typename Real, typename Device >
+   bool
+   openForWrite( const String& fileName, Meshes::Grid< 2, Real, Device, Index >& grid );
 
-      template< typename Real,
-                typename Device >
-      bool openForWrite( const String& fileName,
-                         Meshes::Grid< 2, Real, Device, Index >& grid );
+   // TODO: Obsolete
+   template< typename Real, typename Device, typename Vector >
+   bool
+   write( const Meshes::Grid< 2, Real, Device, Index >& grid, Vector& vector );
 
-      // TODO: Obsolete
-      template< typename Real,
-                typename Device,
-                typename Vector >
-      bool write( const Meshes::Grid< 2, Real, Device, Index >& grid,
-                  Vector& vector );
+   template< typename MeshReal, typename Device, typename Real >
+   bool
+   write( const Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function );
 
-      template< typename MeshReal,
-                typename Device,
-                typename Real >
-      bool write( const Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function );
+   void
+   close();
 
+   ~PNGImage();
 
-      void close();
+protected:
+   bool
+   readHeader();
 
-      ~PNGImage();
+   template< typename Real, typename Device >
+   bool
+   writeHeader( const Meshes::Grid< 2, Real, Device, Index >& grid );
 
-   protected:
+   FILE* file;
 
-      bool readHeader();
-
-      template< typename Real,
-                typename Device >
-      bool writeHeader( const Meshes::Grid< 2, Real, Device, Index >& grid );
-
-      FILE* file;
-
-      bool fileOpen;
+   bool fileOpen;
 
 #ifdef HAVE_PNG_H
-      png_structp png_ptr;
+   png_structp png_ptr;
 
-      png_infop info_ptr, end_info;
+   png_infop info_ptr, end_info;
 
-      png_byte color_type, bit_depth;
+   png_byte color_type, bit_depth;
 #endif
 };
 
-} // namespace Images
-} // namespace TNL
+}  // namespace Images
+}  // namespace TNL
 
 #include <TNL/Images/PNGImage_impl.h>
diff --git a/src/TNL/Images/PNGImage_impl.h b/src/TNL/Images/PNGImage_impl.h
index b75528ee651218eba2d1fe300aa2fface630d5dd..3b946ff8276f5ea798f92dad5039adedd7417a73 100644
--- a/src/TNL/Images/PNGImage_impl.h
+++ b/src/TNL/Images/PNGImage_impl.h
@@ -12,16 +12,12 @@ namespace TNL {
 namespace Images {
 
 template< typename Index >
-PNGImage< Index >::
-PNGImage() :
-   fileOpen( false )
-{
-}
+PNGImage< Index >::PNGImage() : fileOpen( false )
+{}
 
 template< typename Index >
 bool
-PNGImage< Index >::
-readHeader()
+PNGImage< Index >::readHeader()
 {
 #ifdef HAVE_PNG_H
    /***
@@ -29,51 +25,38 @@ readHeader()
     */
    const int headerSize( 8 );
    png_byte header[ headerSize ];
-   if( fread( header, sizeof( char ), headerSize, this->file ) != headerSize )
-   {
+   if( fread( header, sizeof( char ), headerSize, this->file ) != headerSize ) {
       std::cerr << "I am not able to read PNG image header." << std::endl;
       return false;
    }
-   bool isPNG = !png_sig_cmp( header, 0, headerSize );
+   bool isPNG = ! png_sig_cmp( header, 0, headerSize );
    if( ! isPNG )
       return false;
 
    /****
     * Allocate necessary memory
     */
-   this->png_ptr = png_create_read_struct( PNG_LIBPNG_VER_STRING,
-                                           NULL,
-                                           NULL,
-                                           NULL );
-   if( !this->png_ptr )
+   this->png_ptr = png_create_read_struct( PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr );
+   if( ! this->png_ptr )
       return false;
 
    this->info_ptr = png_create_info_struct( this->png_ptr );
-   if( !this->info_ptr )
-   {
-      png_destroy_read_struct( &this->png_ptr,
-                              ( png_infopp ) NULL,
-                              ( png_infopp ) NULL );
+   if( ! this->info_ptr ) {
+      png_destroy_read_struct( &this->png_ptr, nullptr, nullptr );
       return false;
    }
 
    this->end_info = png_create_info_struct( this->png_ptr );
-   if( !this->end_info )
-   {
-      png_destroy_read_struct( &this->png_ptr,
-                               &this->info_ptr,
-                               ( png_infopp ) NULL );
+   if( ! this->end_info ) {
+      png_destroy_read_struct( &this->png_ptr, &this->info_ptr, nullptr );
       return false;
    }
 
    /***
     * Prepare the long jump back from libpng.
     */
-   if( setjmp(png_jmpbuf( this->png_ptr ) ) )
-   {
-      png_destroy_read_struct( &this->png_ptr,
-                               &this->info_ptr,
-                               &end_info );
+   if( setjmp( png_jmpbuf( this->png_ptr ) ) ) {
+      png_destroy_read_struct( &this->png_ptr, &this->info_ptr, &end_info );
       return false;
    }
    png_init_io( this->png_ptr, this->file );
@@ -82,28 +65,26 @@ readHeader()
    /****
     * Read the header
     */
-   png_read_png( this->png_ptr, this->info_ptr, PNG_TRANSFORM_IDENTITY, NULL );
-   this->height = ( Index ) png_get_image_height( this->png_ptr, this->info_ptr );
-   this->width = ( Index ) png_get_image_width( this->png_ptr, this->info_ptr );
+   png_read_png( this->png_ptr, this->info_ptr, PNG_TRANSFORM_IDENTITY, nullptr );
+   this->height = (Index) png_get_image_height( this->png_ptr, this->info_ptr );
+   this->width = (Index) png_get_image_width( this->png_ptr, this->info_ptr );
    this->bit_depth = png_get_bit_depth( this->png_ptr, this->info_ptr );
    this->color_type = png_get_color_type( this->png_ptr, this->info_ptr );
-  std::cout << this->height << " x " << this->width << std::endl;
+   std::cout << this->height << " x " << this->width << std::endl;
    return true;
 #else
-   //cerr << "TNL was not compiled with support of PNG. You may still use PGM format." << std::endl;
+   // cerr << "TNL was not compiled with support of PNG. You may still use PGM format." << std::endl;
    return false;
 #endif
 }
 
 template< typename Index >
 bool
-PNGImage< Index >::
-openForRead( const String& fileName )
+PNGImage< Index >::openForRead( const String& fileName )
 {
    this->close();
    this->file = fopen( fileName.getString(), "r" );
-   if( ! this->file )
-   {
+   if( ! this->file ) {
       std::cerr << "Unable to open the file " << fileName << std::endl;
       return false;
    }
@@ -114,85 +95,72 @@ openForRead( const String& fileName )
 }
 
 template< typename Index >
-   template< typename MeshReal,
-             typename Device,
-             typename Real >
+template< typename MeshReal, typename Device, typename Real >
 bool
-PNGImage< Index >::
-read( const RegionOfInterest< Index > roi,
-      Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function )
+PNGImage< Index >::read( const RegionOfInterest< Index > roi,
+                         Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function )
 {
 #ifdef HAVE_PNG_H
-   typedef Meshes::Grid< 2, MeshReal, Device, Index > GridType;
+   using GridType = Meshes::Grid< 2, MeshReal, Device, Index >;
    const GridType& grid = function.getMesh();
    typename GridType::Cell cell( grid );
 
    /***
     * Prepare the long jump back from libpng.
     */
-   if( setjmp(png_jmpbuf( this->png_ptr ) ) )
-   {
-      png_destroy_read_struct( &this->png_ptr,
-                               &this->info_ptr,
-                               &this->end_info );
+   if( setjmp( png_jmpbuf( this->png_ptr ) ) ) {
+      png_destroy_read_struct( &this->png_ptr, &this->info_ptr, &this->end_info );
       return false;
    }
 
    png_bytepp row_pointers = png_get_rows( this->png_ptr, this->info_ptr );
 
    Index i, j;
-   for( i = 0; i < this->height; i ++ )
-   {
-      for( j = 0; j < this->width; j ++ )
-      {
-         if( !roi.isIn( i, j ) )
+   for( i = 0; i < this->height; i++ ) {
+      for( j = 0; j < this->width; j++ ) {
+         if( ! roi.isIn( i, j ) )
             continue;
 
          cell.getCoordinates().x() = j - roi.getLeft();
          cell.getCoordinates().y() = roi.getBottom() - 1 - i;
          cell.refresh();
-         //Index cellIndex = grid.getCellIndex( CoordinatesType( j - roi.getLeft(),
-         //                                     roi.getBottom() - 1 - i ) );
+         // Index cellIndex = grid.getCellIndex( CoordinatesType( j - roi.getLeft(),
+         //                                      roi.getBottom() - 1 - i ) );
          unsigned char char_color[ 4 ];
          unsigned short int int_color[ 4 ];
-         switch( this->color_type )
-         {
+         switch( this->color_type ) {
             case PNG_COLOR_TYPE_GRAY:
-               if( this->bit_depth == 8 )
-               {
+               if( this->bit_depth == 8 ) {
                   char_color[ 0 ] = row_pointers[ i ][ j ];
-                  Real value = char_color[ 0 ] / ( Real ) 255.0;
+                  Real value = char_color[ 0 ] / (Real) 255.0;
                   function.getData().setElement( cell.getIndex(), value );
                }
-               if( this->bit_depth == 16 )
-               {
+               if( this->bit_depth == 16 ) {
                   int_color[ 0 ] = row_pointers[ i ][ j ];
-                  Real value = int_color[ 0 ] / ( Real ) 65535.0;
+                  Real value = int_color[ 0 ] / (Real) 65535.0;
                   function.getData().setElement( cell.getIndex(), value );
                }
                break;
             case PNG_COLOR_TYPE_RGB:
-               if( this->bit_depth == 8 )
-               {
-                  unsigned char* row = ( unsigned char* ) row_pointers[ i ];
+               if( this->bit_depth == 8 ) {
+                  unsigned char* row = (unsigned char*) row_pointers[ i ];
                   char_color[ 0 ] = row[ 3 * j ];
                   char_color[ 1 ] = row[ 3 * j + 1 ];
                   char_color[ 2 ] = row[ 3 * j + 2 ];
-                  Real r = char_color[ 0 ] / ( Real ) 255.0;
-                  Real g = char_color[ 1 ] / ( Real ) 255.0;
-                  Real b = char_color[ 2 ] / ( Real ) 255.0;
+                  Real r = char_color[ 0 ] / (Real) 255.0;
+                  Real g = char_color[ 1 ] / (Real) 255.0;
+                  Real b = char_color[ 2 ] / (Real) 255.0;
                   Real value = 0.2989 * r + 0.5870 * g + 0.1140 * b;
                   function.getData().setElement( cell.getIndex(), value );
                }
-               if( this->bit_depth == 16 )
-               {
-                  unsigned short int* row = ( unsigned short int* ) row_pointers[ i ];
+               if( this->bit_depth == 16 ) {
+                  unsigned short int* row = (unsigned short int*) row_pointers[ i ];
                   int_color[ 0 ] = row[ 3 * j ];
                   int_color[ 1 ] = row[ 3 * j + 1 ];
                   int_color[ 2 ] = row[ 3 * j + 2 ];
-                  Real r = int_color[ 0 ] / ( Real ) 65535.0;
-                  Real g = int_color[ 1 ] / ( Real ) 66355.0;
-                  Real b = int_color[ 2 ] / ( Real ) 65535.0;
+                  Real r = int_color[ 0 ] / (Real) 65535.0;
+                  Real g = int_color[ 1 ] / (Real) 66355.0;
+                  Real b = int_color[ 2 ] / (Real) 65535.0;
                   Real value = 0.2989 * r + 0.5870 * g + 0.1140 * b;
                   function.getData().setElement( cell.getIndex(), value );
                }
@@ -205,56 +173,46 @@ read( const RegionOfInterest< Index > roi,
    }
    return true;
 #else
-   //cerr << "TNL was not compiled with support of PNG. You may still use PGM format." << std::endl;
+   // cerr << "TNL was not compiled with support of PNG. You may still use PGM format." << std::endl;
    return false;
 #endif
 }
 
 template< typename Index >
-   template< typename Real,
-             typename Device >
+template< typename Real, typename Device >
 bool
-PNGImage< Index >::
-writeHeader( const Meshes::Grid< 2, Real, Device, Index >& grid )
+PNGImage< Index >::writeHeader( const Meshes::Grid< 2, Real, Device, Index >& grid )
 {
 #ifdef HAVE_PNG_H
-   this->png_ptr = png_create_write_struct( PNG_LIBPNG_VER_STRING,
-                                            NULL,
-                                            NULL,
-                                            NULL );
-   if( !png_ptr )
+   this->png_ptr = png_create_write_struct( PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr );
+   if( ! png_ptr )
       return false;
 
    this->info_ptr = png_create_info_struct( this->png_ptr );
-   if( !this->info_ptr )
-   {
-      png_destroy_write_struct( &this->png_ptr,
-                                NULL);
+   if( ! this->info_ptr ) {
+      png_destroy_write_struct( &this->png_ptr, nullptr );
       return false;
    }
 
    /***
     * Prepare the long jump back from libpng.
     */
-   if( setjmp(png_jmpbuf( this->png_ptr ) ) )
-   {
-      png_destroy_read_struct( &this->png_ptr,
-                               &this->info_ptr,
-                               &this->end_info );
+   if( setjmp( png_jmpbuf( this->png_ptr ) ) ) {
+      png_destroy_read_struct( &this->png_ptr, &this->info_ptr, &this->end_info );
       return false;
    }
 
    /****
     * Set the zlib compression level
     */
-   //png_set_compression_level( this->png_ptr, Z_BEST_COMPRESSION );
+   // png_set_compression_level( this->png_ptr, Z_BEST_COMPRESSION );
 
-   //const int bitDepth( 8 );
+   // const int bitDepth( 8 );
    png_set_IHDR( this->png_ptr,
                  this->info_ptr,
                  grid.getDimensions().x(),
                  grid.getDimensions().y(),
-                 8, //bitDepth,
+                 8,  // bitDepth,
                  PNG_COLOR_TYPE_GRAY,
                  PNG_INTERLACE_NONE,
                  PNG_COMPRESSION_TYPE_DEFAULT,
@@ -269,17 +227,13 @@ writeHeader( const Meshes::Grid< 2, Real, Device, Index >& grid )
 }
 
 template< typename Index >
-   template< typename Real,
-             typename Device >
+template< typename Real, typename Device >
 bool
-PNGImage< Index >::
-openForWrite( const String& fileName,
-              Meshes::Grid< 2, Real, Device, Index >& grid )
+PNGImage< Index >::openForWrite( const String& fileName, Meshes::Grid< 2, Real, Device, Index >& grid )
 {
    this->close();
    this->file = fopen( fileName.getString(), "w" );
-   if( ! this->file )
-   {
+   if( ! this->file ) {
       std::cerr << "Unable to open the file " << fileName << std::endl;
       return false;
    }
@@ -290,40 +244,31 @@ openForWrite( const String& fileName,
 }
 
 template< typename Index >
-   template< typename Real,
-             typename Device,
-             typename Vector >
+template< typename Real, typename Device, typename Vector >
 bool
-PNGImage< Index >::
-write( const Meshes::Grid< 2, Real, Device, Index >& grid,
-       Vector& vector )
+PNGImage< Index >::write( const Meshes::Grid< 2, Real, Device, Index >& grid, Vector& vector )
 {
 #ifdef HAVE_PNG_H
-   typedef Meshes::Grid< 2, Real, Device, Index > GridType;
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
    typename GridType::Cell cell( grid );
 
    /***
     * Prepare the long jump back from libpng.
     */
-   if( setjmp(png_jmpbuf( this->png_ptr ) ) )
-   {
-      png_destroy_read_struct( &this->png_ptr,
-                               &this->info_ptr,
-                               &this->end_info );
+   if( setjmp( png_jmpbuf( this->png_ptr ) ) ) {
+      png_destroy_read_struct( &this->png_ptr, &this->info_ptr, &this->end_info );
       return false;
    }
 
    Index i, j;
    png_bytep row = new png_byte[ 3 * grid.getDimensions().x() ];
-   for( i = 0; i < grid.getDimensions().y(); i ++ )
-   {
-      for( j = 0; j < grid.getDimensions().x(); j ++ )
-      {
+   for( i = 0; i < grid.getDimensions().y(); i++ ) {
+      for( j = 0; j < grid.getDimensions().x(); j++ ) {
          cell.getCoordinates().x() = j;
          cell.getCoordinates().y() = grid.getDimensions().y() - 1 - i;
 
-         //Index cellIndex = grid.getCellIndex( CoordinatesType( j,
-         //                                     grid.getDimensions().y() - 1 - i ) );
+         // Index cellIndex = grid.getCellIndex( CoordinatesType( j,
+         //                                      grid.getDimensions().y() - 1 - i ) );
 
          row[ j ] = 255 * vector.getElement( cell.getIndex() );
       }
@@ -337,40 +282,32 @@ write( const Meshes::Grid< 2, Real, Device, Index >& grid,
 }
 
 template< typename Index >
-   template< typename MeshReal,
-             typename Device,
-             typename Real >
+template< typename MeshReal, typename Device, typename Real >
 bool
-PNGImage< Index >::
-write( const Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function )
+PNGImage< Index >::write( const Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >, 2, Real >& function )
 {
 #ifdef HAVE_PNG_H
-   typedef Meshes::Grid< 2, Real, Device, Index > GridType;
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
    const GridType& grid = function.getMesh();
    typename GridType::Cell cell( grid );
 
    /***
     * Prepare the long jump back from libpng.
     */
-   if( setjmp(png_jmpbuf( this->png_ptr ) ) )
-   {
-      png_destroy_read_struct( &this->png_ptr,
-                               &this->info_ptr,
-                               &this->end_info );
+   if( setjmp( png_jmpbuf( this->png_ptr ) ) ) {
+      png_destroy_read_struct( &this->png_ptr, &this->info_ptr, &this->end_info );
       return false;
    }
 
    Index i, j;
    png_bytep row = new png_byte[ 3 * grid.getDimensions().x() ];
-   for( i = 0; i < grid.getDimensions().y(); i ++ )
-   {
-      for( j = 0; j < grid.getDimensions().x(); j ++ )
-      {
+   for( i = 0; i < grid.getDimensions().y(); i++ ) {
+      for( j = 0; j < grid.getDimensions().x(); j++ ) {
          cell.getCoordinates().x() = j;
          cell.getCoordinates().y() = grid.getDimensions().y() - 1 - i;
 
-         //Index cellIndex = grid.getCellIndex( CoordinatesType( j,
-         //                                     grid.getDimensions().y() - 1 - i ) );
+         // Index cellIndex = grid.getCellIndex( CoordinatesType( j,
+         //                                      grid.getDimensions().y() - 1 - i ) );
 
          row[ j ] = 255 * function.getData().getElement( cell.getIndex() );
       }
@@ -383,12 +320,9 @@ write( const Functions::MeshFunction< Meshes::Grid< 2, MeshReal, Device, Index >
 #endif
 }
 
-
-
 template< typename Index >
 void
-PNGImage< Index >::
-close()
+PNGImage< Index >::close()
 {
    if( this->fileOpen )
       fclose( file );
@@ -396,12 +330,10 @@ close()
 }
 
 template< typename Index >
-PNGImage< Index >::
-~PNGImage()
+PNGImage< Index >::~PNGImage()
 {
    close();
 }
 
-} // namespace Images
-} // namespace TNL
-
+}  // namespace Images
+}  // namespace TNL
diff --git a/src/TNL/Images/RegionOfInterest.h b/src/TNL/Images/RegionOfInterest.h
index 4fc399b34622551579ad9703f8b1e740a7f06b66..5851725eafe785a5cc4b1d0c733057cb0ca90768 100644
--- a/src/TNL/Images/RegionOfInterest.h
+++ b/src/TNL/Images/RegionOfInterest.h
@@ -16,39 +16,45 @@ namespace Images {
 template< typename Index = int >
 class RegionOfInterest
 {
-   public:
+public:
+   RegionOfInterest();
 
-      RegionOfInterest();
+   bool
+   setup( const Config::ParameterContainer& parameters, const Image< Index >* image );
 
-      bool setup( const Config::ParameterContainer& parameters,
-                  const Image< Index >* image );
+   bool
+   check( const Image< Index >* image ) const;
 
-      bool check( const Image< Index >* image ) const;
+   Index
+   getTop() const;
 
-      Index getTop() const;
+   Index
+   getBottom() const;
 
-      Index getBottom() const;
+   Index
+   getLeft() const;
 
-      Index getLeft() const;
+   Index
+   getRight() const;
 
-      Index getRight() const;
+   Index
+   getWidth() const;
 
-      Index getWidth() const;
+   Index
+   getHeight() const;
 
-      Index getHeight() const;
+   template< typename Grid >
+   bool
+   setGrid( Grid& grid, bool verbose = false );
 
-      template< typename Grid >
-         bool setGrid( Grid& grid,
-                       bool verbose = false );
+   bool
+   isIn( Index row, Index column ) const;
 
-      bool isIn( const Index row, const Index column ) const;
-
-   protected:
-
-      Index top, bottom, left, right;
+protected:
+   Index top, bottom, left, right;
 };
 
-} // namespace Images
-} // namespace TNL
+}  // namespace Images
+}  // namespace TNL
 
 #include <TNL/Images/RegionOfInterest_impl.h>
diff --git a/src/TNL/Images/RegionOfInterest_impl.h b/src/TNL/Images/RegionOfInterest_impl.h
index a5128d0bcc0ca43564821857c2aaafe621bd9ee4..ae300c6a29da6a121a4ce9de206c8869cac894da 100644
--- a/src/TNL/Images/RegionOfInterest_impl.h
+++ b/src/TNL/Images/RegionOfInterest_impl.h
@@ -9,79 +9,64 @@
 #include <TNL/Images/Image.h>
 
 namespace TNL {
-namespace Images {   
+namespace Images {
 
 template< typename Index >
-RegionOfInterest< Index >::
-RegionOfInterest()
-: top( -1 ), bottom( -1 ), left( -1 ), right( -1 )
-{
-}
- 
+RegionOfInterest< Index >::RegionOfInterest() : top( -1 ), bottom( -1 ), left( -1 ), right( -1 )
+{}
+
 template< typename Index >
 bool
-RegionOfInterest< Index >::
-setup( const Config::ParameterContainer& parameters,
-       const Image< Index >* image )
+RegionOfInterest< Index >::setup( const Config::ParameterContainer& parameters, const Image< Index >* image )
 {
-   const int roiTop    = parameters.getParameter< int >( "roi-top" );
+   const int roiTop = parameters.getParameter< int >( "roi-top" );
    const int roiBottom = parameters.getParameter< int >( "roi-bottom" );
-   const int roiRight  = parameters.getParameter< int >( "roi-right" );
-   const int roiLeft   = parameters.getParameter< int >( "roi-left" );
- 
-   if( roiBottom < roiTop )
-   {
+   const int roiRight = parameters.getParameter< int >( "roi-right" );
+   const int roiLeft = parameters.getParameter< int >( "roi-left" );
+
+   if( roiBottom < roiTop ) {
       std::cerr << "Error: roi-bottom (" << roiBottom << ") is smaller than roi-top (" << roiTop << ")." << std::endl;
       return false;
    }
-   if( roiRight < roiLeft )
-   {
+   if( roiRight < roiLeft ) {
       std::cerr << "Error: roi-right (" << roiRight << ") is smaller than roi-left (" << roiLeft << ")." << std::endl;
       return false;
    }
 
    if( roiLeft == -1 )
-        this->left = 0;
-   else
-   {
-      if( roiLeft >= image->getWidth() )
-      {
+      this->left = 0;
+   else {
+      if( roiLeft >= image->getWidth() ) {
          std::cerr << "ROI left column is larger than image width ( " << image->getWidth() << ")." << std::endl;
          return false;
       }
       this->left = roiLeft;
    }
- 
+
    if( roiRight == -1 )
       this->right = image->getWidth();
-   else
-   {
-      if( roiRight >= image->getWidth() )
-      {
+   else {
+      if( roiRight >= image->getWidth() ) {
          std::cerr << "ROI right column is larger than image width ( " << image->getWidth() << ")." << std::endl;
          return false;
       }
       this->right = roiRight;
    }
- 
+
    if( roiTop == -1 )
       this->top = 0;
-   else
-   {
-      if( roiTop >= image->getHeight() )
-      {
+   else {
+      if( roiTop >= image->getHeight() ) {
          std::cerr << "ROI top line is larger than image height ( " << image->getHeight() << ")." << std::endl;
          return false;
       }
       this->top = roiTop;
    }
- 
+
    if( roiBottom == -1 )
       this->bottom = image->getHeight();
-   else
-   {
-      if( roiBottom >= image->getHeight() )
-      {
+   else {
+      if( roiBottom >= image->getHeight() ) {
          std::cerr << "ROI bottom line is larger than image height ( " << image->getHeight() << ")." << std::endl;
          return false;
       }
@@ -92,98 +77,82 @@ setup( const Config::ParameterContainer& parameters,
 
 template< typename Index >
 bool
-RegionOfInterest< Index >::
-check( const Image< Index >* image ) const
+RegionOfInterest< Index >::check( const Image< Index >* image ) const
 {
-   if( top >= image->getHeight() ||
-       bottom >= image->getHeight() ||
-       left >= image->getWidth() ||
-       right >= image->getWidth() )
+   if( top >= image->getHeight() || bottom >= image->getHeight() || left >= image->getWidth() || right >= image->getWidth() )
       return false;
    return true;
 }
 
 template< typename Index >
 Index
-RegionOfInterest< Index >::
-getTop() const
+RegionOfInterest< Index >::getTop() const
 {
    return this->top;
 }
 
 template< typename Index >
 Index
-RegionOfInterest< Index >::
-getBottom() const
+RegionOfInterest< Index >::getBottom() const
 {
    return this->bottom;
 }
 
 template< typename Index >
 Index
-RegionOfInterest< Index >::
-getLeft() const
+RegionOfInterest< Index >::getLeft() const
 {
    return this->left;
 }
 
 template< typename Index >
 Index
-RegionOfInterest< Index >::
-getRight() const
+RegionOfInterest< Index >::getRight() const
 {
    return this->right;
 }
 
 template< typename Index >
 Index
-RegionOfInterest< Index >::
-getWidth() const
+RegionOfInterest< Index >::getWidth() const
 {
    return this->right - this->left;
 }
 
 template< typename Index >
 Index
-RegionOfInterest< Index >::
-getHeight() const
+RegionOfInterest< Index >::getHeight() const
 {
    return this->bottom - this->top;
 }
 
 template< typename Index >
-   template< typename Grid >
+template< typename Grid >
 bool
-RegionOfInterest< Index >::
-setGrid( Grid& grid,
-         bool verbose )
+RegionOfInterest< Index >::setGrid( Grid& grid, bool verbose )
 {
-    grid.setDimensions( this->getWidth(), this->getHeight() );
-    typename Grid::PointType origin, proportions;
-    origin.x() = 0.0;
-    origin.y() = 0.0;
-    proportions.x() = 1.0;
-    proportions.y() = ( double ) grid.getDimensions().y() / ( double ) grid.getDimensions().x();
-    grid.setDomain( origin, proportions );
-    if( verbose )
-    {
-       std::cout << "Setting grid to dimensions " << grid.getDimensions() <<
-                " and proportions " << grid.getProportions() << std::endl;
-    }
-    return true;
+   grid.setDimensions( this->getWidth(), this->getHeight() );
+   typename Grid::PointType origin, proportions;
+   origin.x() = 0.0;
+   origin.y() = 0.0;
+   proportions.x() = 1.0;
+   proportions.y() = (double) grid.getDimensions().y() / (double) grid.getDimensions().x();
+   grid.setDomain( origin, proportions );
+   if( verbose ) {
+      std::cout << "Setting grid to dimensions " << grid.getDimensions() << " and proportions " << grid.getProportions()
+                << std::endl;
+   }
+   return true;
 }
 
-
 template< typename Index >
 bool
-RegionOfInterest< Index >::
-isIn( const Index row, const Index column ) const
+RegionOfInterest< Index >::isIn( const Index row, const Index column ) const
 {
-   if( row >= top && row < bottom &&
-       column >= left && column < right )
+   if( row >= top && row < bottom && column >= left && column < right )
       return true;
    return false;
 }
 
-} // namespace Images
-} // namespace TNL
\ No newline at end of file
+}  // namespace Images
+}  // namespace TNL
\ No newline at end of file
diff --git a/src/TNL/Logger.h b/src/TNL/Logger.h
index 646f3a4ac3cb2c1253adb29cae13c4a4550dd62e..3ffa325c7e609fe0d64049790075d7d1c1665c5b 100644
--- a/src/TNL/Logger.h
+++ b/src/TNL/Logger.h
@@ -22,31 +22,33 @@ public:
    ///
    /// \param _width Integer that defines the width of the log.
    /// \param _stream Defines output stream where the log will be printed out.
-   Logger( int width, std::ostream& stream )
-   : width( width ), stream( stream )
-   {}
+   Logger( int width, std::ostream& stream ) : width( width ), stream( stream ) {}
 
    /////
    /// \brief Creates header in given log.
-   /// 
+   ///
    /// The header usually contains title of the program.
    ///
    /// \param title A String containing the header title.
-   void writeHeader( const String& title );
+   void
+   writeHeader( const String& title );
 
    /// \brief Creates separator used as a log structure.
-   void writeSeparator();
+   void
+   writeSeparator();
 
    /// \brief Inserts information about various system parameters into the log.
    ///
    /// \param printGPUInfo When \e true, prints information about available GPUs.
-   bool writeSystemInformation( bool printGPUInfo = false );
+   bool
+   writeSystemInformation( bool printGPUInfo = false );
 
    /////
    /// \brief Inserts a line with current time into the log.
    ///
    /// \param label Label to be printed to the log together with the current time.
-   void writeCurrentTime( const char* label );
+   void
+   writeCurrentTime( const char* label );
 
    /// \brief Inserts parameter information into the log.
    ///
@@ -58,10 +60,11 @@ public:
 
    // TODO: add units
    template< typename ParameterType >
-   void writeParameter( const String& label,
-                        const String& parameterName,
-                        const Config::ParameterContainer& parameters,
-                        int parameterLevel = 0 );
+   void
+   writeParameter( const String& label,
+                   const String& parameterName,
+                   const Config::ParameterContainer& parameters,
+                   int parameterLevel = 0 );
 
    /// \brief Inserts parameter information into the log.
    ///
@@ -70,9 +73,8 @@ public:
    /// \param value Parameter value.
    /// \param parameterLevel Integer defining the indent used in the log.
    template< typename ParameterType >
-   void writeParameter( const String& label,
-                        const ParameterType& value,
-                        int parameterLevel = 0 );
+   void
+   writeParameter( const String& label, const ParameterType& value, int parameterLevel = 0 );
 
 protected:
    /// \brief Integer defining the width of the log.
@@ -82,6 +84,6 @@ protected:
    std::ostream& stream;
 };
 
-} // namespace TNL
+}  // namespace TNL
 
 #include <TNL/Logger_impl.h>
diff --git a/src/TNL/Logger_impl.h b/src/TNL/Logger_impl.h
index 30dd9784e42a9dcb98c5d9335faaaa8be53e9c05..a68f5bbd0ee44eb59a751709e11ec299437b8c6c 100644
--- a/src/TNL/Logger_impl.h
+++ b/src/TNL/Logger_impl.h
@@ -22,8 +22,8 @@ Logger::writeHeader( const String& title )
    const int titleLength = title.getLength();
    stream << "+" << std::setfill( '-' ) << std::setw( width ) << "+" << std::endl;
    stream << "|" << std::setfill( ' ' ) << std::setw( width ) << "|" << std::endl;
-   stream << "|" << std::setw( width / 2 + titleLength / 2 )
-          << title << std::setw( width / 2 - titleLength / 2  ) << "|" << std::endl;
+   stream << "|" << std::setw( width / 2 + titleLength / 2 ) << title << std::setw( width / 2 - titleLength / 2 ) << "|"
+          << std::endl;
    stream << "|" << std::setfill( ' ' ) << std::setw( width ) << "|" << std::endl;
    stream << "+" << std::setfill( '-' ) << std::setw( width ) << "+" << std::endl;
    stream.fill( fill );
@@ -43,18 +43,19 @@ Logger::writeSystemInformation( bool printGPUInfo )
 // compiler detection macros:
 // http://nadeausoftware.com/articles/2012/10/c_c_tip_how_detect_compiler_name_and_version_using_compiler_predefined_macros
 // https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#compilation-phases
-#if defined(__NVCC__)
-   #define TNL_STRINGIFY_IMPL(x) #x
+#if defined( __NVCC__ )
+   #define TNL_STRINGIFY_IMPL( x ) #x
    // indirection is necessary in order to expand macros in the argument
-   #define TNL_STRINGIFY(x) TNL_STRINGIFY_IMPL(x)
-   const char* compiler_name = "Nvidia NVCC (" TNL_STRINGIFY(__CUDACC_VER_MAJOR__) "." TNL_STRINGIFY(__CUDACC_VER_MINOR__) "." TNL_STRINGIFY(__CUDACC_VER_BUILD__) ")";
+   #define TNL_STRINGIFY( x ) TNL_STRINGIFY_IMPL( x )
+   const char* compiler_name = "Nvidia NVCC (" TNL_STRINGIFY( __CUDACC_VER_MAJOR__ ) "." TNL_STRINGIFY(
+      __CUDACC_VER_MINOR__ ) "." TNL_STRINGIFY( __CUDACC_VER_BUILD__ ) ")";
    #undef TNL_STRINGIFY
    #undef TNL_STRINGIFY_IMPL
-#elif defined(__clang__)
+#elif defined( __clang__ )
    const char* compiler_name = "Clang/LLVM (" __VERSION__ ")";
-#elif defined(__ICC) || defined(__INTEL_COMPILER)
+#elif defined( __ICC ) || defined( __INTEL_COMPILER )
    const char* compiler_name = "Intel ICPC (" __VERSION__ ")";
-#elif defined(__GNUC__) || defined(__GNUG__)
+#elif defined( __GNUC__ ) || defined( __GNUG__ )
    const char* compiler_name = "GNU G++ (" __VERSION__ ")";
 #else
    const char* compiler_name = "(unknown)";
@@ -78,10 +79,8 @@ Logger::writeSystemInformation( bool printGPUInfo )
    writeParameter< int >( "Threads per core:", threadsPerCore, 1 );
    writeParameter< double >( "Max clock rate (in MHz):", SystemInfo::getCPUMaxFrequency( cpu_id ) / 1000, 1 );
    const CacheSizes cacheSizes = SystemInfo::getCPUCacheSizes( cpu_id );
-   const String cacheInfo = convertToString( cacheSizes.L1data ) + ", "
-                          + convertToString( cacheSizes.L1instruction ) + ", "
-                          + convertToString( cacheSizes.L2 ) + ", "
-                          + convertToString( cacheSizes.L3 );
+   const String cacheInfo = convertToString( cacheSizes.L1data ) + ", " + convertToString( cacheSizes.L1instruction ) + ", "
+                          + convertToString( cacheSizes.L2 ) + ", " + convertToString( cacheSizes.L3 );
    writeParameter< String >( "Cache (L1d, L1i, L2, L3):", cacheInfo, 1 );
 
    if( printGPUInfo ) {
@@ -89,25 +88,25 @@ Logger::writeSystemInformation( bool printGPUInfo )
       // TODO: Printing all devices does not make sense until TNL can actually
       //       use more than one device for computations. Printing only the active
       //       device for now...
-   //   int devices = getNumberOfDevices();
-   //   writeParameter< int >( "Number of devices", devices, 1 );
-   //   for( int i = 0; i < devices; i++ )
-   //   {
-   //      logger.writeParameter< int >( "Device no.", i, 1 );
-         const int i = Cuda::DeviceInfo::getActiveDevice();
-         writeParameter< String >( "Name", Cuda::DeviceInfo::getDeviceName( i ), 2 );
-         const String deviceArch = convertToString( Cuda::DeviceInfo::getArchitectureMajor( i ) ) + "." +
-                                   convertToString( Cuda::DeviceInfo::getArchitectureMinor( i ) );
-         writeParameter< String >( "Architecture", deviceArch, 2 );
-         writeParameter< int >( "CUDA cores", Cuda::DeviceInfo::getCudaCores( i ), 2 );
-         const double clockRate = ( double ) Cuda::DeviceInfo::getClockRate( i ) / 1.0e3;
-         writeParameter< double >( "Clock rate (in MHz)", clockRate, 2 );
-         const double globalMemory = ( double ) Cuda::DeviceInfo::getGlobalMemory( i ) / 1.0e9;
-         writeParameter< double >( "Global memory (in GB)", globalMemory, 2 );
-         const double memoryClockRate = ( double ) Cuda::DeviceInfo::getMemoryClockRate( i ) / 1.0e3;
-         writeParameter< double >( "Memory clock rate (in Mhz)", memoryClockRate, 2 );
-         writeParameter< bool >( "ECC enabled", Cuda::DeviceInfo::getECCEnabled( i ), 2 );
-   //   }
+      //   int devices = getNumberOfDevices();
+      //   writeParameter< int >( "Number of devices", devices, 1 );
+      //   for( int i = 0; i < devices; i++ )
+      //   {
+      //      logger.writeParameter< int >( "Device no.", i, 1 );
+      const int i = Cuda::DeviceInfo::getActiveDevice();
+      writeParameter< String >( "Name", Cuda::DeviceInfo::getDeviceName( i ), 2 );
+      const String deviceArch = convertToString( Cuda::DeviceInfo::getArchitectureMajor( i ) ) + "."
+                              + convertToString( Cuda::DeviceInfo::getArchitectureMinor( i ) );
+      writeParameter< String >( "Architecture", deviceArch, 2 );
+      writeParameter< int >( "CUDA cores", Cuda::DeviceInfo::getCudaCores( i ), 2 );
+      const double clockRate = (double) Cuda::DeviceInfo::getClockRate( i ) / 1.0e3;
+      writeParameter< double >( "Clock rate (in MHz)", clockRate, 2 );
+      const double globalMemory = (double) Cuda::DeviceInfo::getGlobalMemory( i ) / 1.0e9;
+      writeParameter< double >( "Global memory (in GB)", globalMemory, 2 );
+      const double memoryClockRate = (double) Cuda::DeviceInfo::getMemoryClockRate( i ) / 1.0e3;
+      writeParameter< double >( "Memory clock rate (in Mhz)", memoryClockRate, 2 );
+      writeParameter< bool >( "ECC enabled", Cuda::DeviceInfo::getECCEnabled( i ), 2 );
+      //   }
    }
    return true;
 }
@@ -130,9 +129,7 @@ Logger::writeParameter( const String& label,
 
 template< typename T >
 void
-Logger::writeParameter( const String& label,
-                        const T& value,
-                        int parameterLevel )
+Logger::writeParameter( const String& label, const T& value, int parameterLevel )
 {
    stream << "| ";
    int i;
@@ -140,9 +137,7 @@ Logger::writeParameter( const String& label,
       stream << " ";
    std::stringstream str;
    str << value;
-   stream << label
-          << std::setw( width - label.getLength() - parameterLevel - 3 )
-          << str.str() << " |" << std::endl;
+   stream << label << std::setw( width - label.getLength() - parameterLevel - 3 ) << str.str() << " |" << std::endl;
 }
 
-} // namespace TNL
+}  // namespace TNL
diff --git a/src/TNL/MPI/Config.h b/src/TNL/MPI/Config.h
index aa30667049f56c49b26a1a648fab50d1bd522c56..7e2fe1ce2794848fbbf691a588621a9080c0ff85 100644
--- a/src/TNL/MPI/Config.h
+++ b/src/TNL/MPI/Config.h
@@ -9,12 +9,12 @@
 #include <iostream>
 
 #ifdef HAVE_MPI
-#ifdef OMPI_MAJOR_VERSION
-   // header specific to OpenMPI (needed for CUDA-aware detection)
-   #include <mpi-ext.h>
-#endif
+   #ifdef OMPI_MAJOR_VERSION
+      // header specific to OpenMPI (needed for CUDA-aware detection)
+      #include <mpi-ext.h>
+   #endif
 
-#include <unistd.h>  // getpid
+   #include <unistd.h>  // getpid
 #endif
 
 #include <TNL/Config/ConfigDescription.h>
@@ -24,61 +24,59 @@
 namespace TNL {
 namespace MPI {
 
-inline void configSetup( Config::ConfigDescription& config, const String& prefix = "" )
+inline void
+configSetup( Config::ConfigDescription& config, const String& prefix = "" )
 {
 #ifdef HAVE_MPI
-   config.addEntry< bool >( "redirect-mpi-output", "Only process with rank 0 prints to console. Other processes are redirected to files.", true );
-   config.addEntry< String >( "redirect-mpi-output-dir", "Directory where ranks will store the files if their output is redirected.", "." );
+   config.addEntry< bool >(
+      "redirect-mpi-output", "Only process with rank 0 prints to console. Other processes are redirected to files.", true );
+   config.addEntry< String >(
+      "redirect-mpi-output-dir", "Directory where ranks will store the files if their output is redirected.", "." );
    config.addEntry< bool >( "mpi-gdb-debug", "Wait for GDB to attach the master MPI process.", false );
-   config.addEntry< int >( "mpi-process-to-attach", "Number of the MPI process to be attached by GDB. Set -1 for all processes.", 0 );
+   config.addEntry< int >(
+      "mpi-process-to-attach", "Number of the MPI process to be attached by GDB. Set -1 for all processes.", 0 );
 #endif
 }
 
-inline bool setup( const Config::ParameterContainer& parameters,
-                   const String& prefix = "" )
+inline bool
+setup( const Config::ParameterContainer& parameters, const String& prefix = "" )
 {
 #ifdef HAVE_MPI
-   if( Initialized() && ! Finalized() )
-   {
+   if( Initialized() && ! Finalized() ) {
       const bool redirect = parameters.getParameter< bool >( "redirect-mpi-output" );
       const String outputDirectory = parameters.getParameter< String >( "redirect-mpi-output-dir" );
       if( redirect )
          MPI::setupRedirection( outputDirectory );
-#ifdef HAVE_CUDA
-      if( GetSize() > 1 )
-      {
-#if defined( MPIX_CUDA_AWARE_SUPPORT ) && MPIX_CUDA_AWARE_SUPPORT
+   #ifdef HAVE_CUDA
+      if( GetSize() > 1 ) {
+      #if defined( MPIX_CUDA_AWARE_SUPPORT ) && MPIX_CUDA_AWARE_SUPPORT
          std::cout << "CUDA-aware MPI detected on this system ... " << std::endl;
-#elif defined( MPIX_CUDA_AWARE_SUPPORT ) && !MPIX_CUDA_AWARE_SUPPORT
+      #elif defined( MPIX_CUDA_AWARE_SUPPORT ) && ! MPIX_CUDA_AWARE_SUPPORT
          std::cerr << "MPI is not CUDA-aware. Please install correct version of MPI." << std::endl;
          return false;
-#else
+      #else
          std::cerr << "WARNING: TNL cannot detect if you have CUDA-aware MPI. Some problems may occur." << std::endl;
-#endif
+      #endif
       }
-#endif // HAVE_CUDA
+   #endif  // HAVE_CUDA
       bool gdbDebug = parameters.getParameter< bool >( "mpi-gdb-debug" );
       int processToAttach = parameters.getParameter< int >( "mpi-process-to-attach" );
 
-      if( gdbDebug )
-      {
+      if( gdbDebug ) {
          int rank = GetRank( MPI_COMM_WORLD );
          int pid = getpid();
 
          volatile int tnlMPIDebugAttached = 0;
          MPI_Send( &pid, 1, MPI_INT, 0, 0, MPI_COMM_WORLD );
          MPI_Barrier( MPI_COMM_WORLD );
-         if( rank == 0 )
-         {
+         if( rank == 0 ) {
             std::cout << "Attach GDB to MPI process(es) by entering:" << std::endl;
-            for( int i = 0; i < GetSize(); i++ )
-            {
+            for( int i = 0; i < GetSize(); i++ ) {
                MPI_Status status;
                int recvPid;
                MPI_Recv( &recvPid, 1, MPI_INT, i, 0, MPI_COMM_WORLD, &status );
 
-               if( i == processToAttach || processToAttach == -1 )
-               {
+               if( i == processToAttach || processToAttach == -1 ) {
                   std::cout << "  For MPI process " << i << ": gdb -q -ex \"attach " << recvPid << "\""
                             << " -ex \"set variable tnlMPIDebugAttached=1\""
                             << " -ex \"continue\"" << std::endl;
@@ -87,13 +85,14 @@ inline bool setup( const Config::ParameterContainer& parameters,
             std::cout << std::flush;
          }
          if( rank == processToAttach || processToAttach == -1 )
-            while( ! tnlMPIDebugAttached );
+            while( ! tnlMPIDebugAttached )
+               ;
          MPI_Barrier( MPI_COMM_WORLD );
       }
    }
-#endif // HAVE_MPI
+#endif  // HAVE_MPI
    return true;
 }
 
-} // namespace MPI
-} // namespace TNL
+}  // namespace MPI
+}  // namespace TNL
diff --git a/src/TNL/MPI/DummyDefs.h b/src/TNL/MPI/DummyDefs.h
index 05afcd638e3a97a6c29ec2cabd27d42382fdf5c9..25a460305c981b66df05da898e1a1db1dc66ea12 100644
--- a/src/TNL/MPI/DummyDefs.h
+++ b/src/TNL/MPI/DummyDefs.h
@@ -10,7 +10,8 @@
 using MPI_Request = int;
 using MPI_Comm = int;
 
-enum MPI_Op {
+enum MPI_Op
+{
    MPI_MAX,
    MPI_MIN,
    MPI_SUM,
@@ -26,39 +27,40 @@ enum MPI_Op {
 };
 
 // MPI_Init_thread constants
-enum {
+enum
+{
    MPI_THREAD_SINGLE,
    MPI_THREAD_FUNNELED,
    MPI_THREAD_SERIALIZED,
    MPI_THREAD_MULTIPLE
 };
 
-// Miscellaneous constants
-#define MPI_ANY_SOURCE         -1                      /* match any source rank */
-#define MPI_PROC_NULL          -2                      /* rank of null process */
-#define MPI_ROOT               -4                      /* special value for intercomms */
-#define MPI_ANY_TAG            -1                      /* match any message tag */
-#define MPI_UNDEFINED          -32766                  /* undefined stuff */
-#define MPI_DIST_GRAPH         3                       /* dist graph topology */
-#define MPI_CART               1                       /* cartesian topology */
-#define MPI_GRAPH              2                       /* graph topology */
-#define MPI_KEYVAL_INVALID     -1                      /* invalid key value */
+   // Miscellaneous constants
+   #define MPI_ANY_SOURCE -1     /* match any source rank */
+   #define MPI_PROC_NULL -2      /* rank of null process */
+   #define MPI_ROOT -4           /* special value for intercomms */
+   #define MPI_ANY_TAG -1        /* match any message tag */
+   #define MPI_UNDEFINED -32766  /* undefined stuff */
+   #define MPI_DIST_GRAPH 3      /* dist graph topology */
+   #define MPI_CART 1            /* cartesian topology */
+   #define MPI_GRAPH 2           /* graph topology */
+   #define MPI_KEYVAL_INVALID -1 /* invalid key value */
 
-// MPI handles
-// (According to the MPI standard, they are only link-time constants (not
-// compile-time constants). OpenMPI implements them as global variables.)
-#define MPI_COMM_WORLD 1
-#define MPI_COMM_SELF  MPI_COMM_WORLD
-// NULL handles
-#define MPI_GROUP_NULL        0
-#define MPI_COMM_NULL         0
-#define MPI_REQUEST_NULL      0
-#define MPI_MESSAGE_NULL      0
-#define MPI_OP_NULL           0
-#define MPI_ERRHANDLER_NULL   0
-#define MPI_INFO_NULL         0
-#define MPI_WIN_NULL          0
-#define MPI_FILE_NULL         0
-#define MPI_T_ENUM_NULL       0
+   // MPI handles
+   // (According to the MPI standard, they are only link-time constants (not
+   // compile-time constants). OpenMPI implements them as global variables.)
+   #define MPI_COMM_WORLD 1
+   #define MPI_COMM_SELF MPI_COMM_WORLD
+   // NULL handles
+   #define MPI_GROUP_NULL 0
+   #define MPI_COMM_NULL 0
+   #define MPI_REQUEST_NULL 0
+   #define MPI_MESSAGE_NULL 0
+   #define MPI_OP_NULL 0
+   #define MPI_ERRHANDLER_NULL 0
+   #define MPI_INFO_NULL 0
+   #define MPI_WIN_NULL 0
+   #define MPI_FILE_NULL 0
+   #define MPI_T_ENUM_NULL 0
 
 #endif
diff --git a/src/TNL/MPI/Print.h b/src/TNL/MPI/Print.h
index 818f595a7cb8b8ffe9785a64d685a55a59a2cf42..f52fd3f79050c2a9c52e5b4ed2c1c75a74924098 100644
--- a/src/TNL/MPI/Print.h
+++ b/src/TNL/MPI/Print.h
@@ -13,89 +13,75 @@
 #include <TNL/MPI/Utils.h>
 
 #ifdef HAVE_MPI
-#define TNL_MPI_PRINT( message )                                                                                                 \
-if( ! TNL::MPI::Initialized() || TNL::MPI::Finalized() )                                                                         \
-   std::cerr << message << std::endl;                                                                                            \
-else                                                                                                                             \
-{                                                                                                                                \
-   if( TNL::MPI::GetRank() > 0 )                                                                                                 \
-   {                                                                                                                             \
-      std::stringstream __tnl_mpi_print_stream_;                                                                                 \
-      __tnl_mpi_print_stream_ << "Node " << TNL::MPI::GetRank() << " of " << TNL::MPI::GetSize() << " : "                        \
-                              << message << std::endl;                                                                           \
-      TNL::String __tnl_mpi_print_string_( __tnl_mpi_print_stream_.str() );                                                      \
-      TNL::MPI::send( __tnl_mpi_print_string_, 0, std::numeric_limits< int >::max() );                                           \
-   }                                                                                                                             \
-   else                                                                                                                          \
-   {                                                                                                                             \
-      std::cerr << "Node 0 of " << TNL::MPI::GetSize() << " : " << message << std::endl;                                         \
-      for( int __tnl_mpi_print_j = 1; __tnl_mpi_print_j < TNL::MPI::GetSize(); __tnl_mpi_print_j++ )                             \
-      {                                                                                                                          \
-         TNL::String __tnl_mpi_print_string_;                                                                                    \
-         TNL::MPI::recv( __tnl_mpi_print_string_, __tnl_mpi_print_j, std::numeric_limits< int >::max() );                        \
-         std::cerr << __tnl_mpi_print_string_;                                                                                   \
-      }                                                                                                                          \
-   }                                                                                                                             \
-}
+   #define TNL_MPI_PRINT( message )                                                                                        \
+      if( ! TNL::MPI::Initialized() || TNL::MPI::Finalized() )                                                             \
+         std::cerr << message << std::endl;                                                                                \
+      else {                                                                                                               \
+         if( TNL::MPI::GetRank() > 0 ) {                                                                                   \
+            std::stringstream __tnl_mpi_print_stream_;                                                                     \
+            __tnl_mpi_print_stream_ << "Node " << TNL::MPI::GetRank() << " of " << TNL::MPI::GetSize() << " : " << message \
+                                    << std::endl;                                                                          \
+            TNL::String __tnl_mpi_print_string_( __tnl_mpi_print_stream_.str() );                                          \
+            TNL::MPI::send( __tnl_mpi_print_string_, 0, std::numeric_limits< int >::max() );                               \
+         }                                                                                                                 \
+         else {                                                                                                            \
+            std::cerr << "Node 0 of " << TNL::MPI::GetSize() << " : " << message << std::endl;                             \
+            for( int __tnl_mpi_print_j = 1; __tnl_mpi_print_j < TNL::MPI::GetSize(); __tnl_mpi_print_j++ ) {               \
+               TNL::String __tnl_mpi_print_string_;                                                                        \
+               TNL::MPI::recv( __tnl_mpi_print_string_, __tnl_mpi_print_j, std::numeric_limits< int >::max() );            \
+               std::cerr << __tnl_mpi_print_string_;                                                                       \
+            }                                                                                                              \
+         }                                                                                                                 \
+      }
 #else
-#define TNL_MPI_PRINT( message )                                                                                                 \
-   std::cerr << message << std::endl;
+   #define TNL_MPI_PRINT( message ) std::cerr << message << std::endl;
 #endif
 
 #ifdef HAVE_MPI
-#define TNL_MPI_PRINT_MASTER( message )                                                                                          \
-if( ! TNL::MPI::Initialized() || TNL::MPI::Finalized() )                                                                         \
-   std::cerr << message << std::endl;                                                                                            \
-else                                                                                                                             \
-{                                                                                                                                \
-   if( TNL::MPI::GetRank() == 0 )                                                                     \
-   {                                                                                                                             \
-      std::cerr << "Master node : " << message << std::endl;                                                                     \
-   }                                                                                                                             \
-}
+   #define TNL_MPI_PRINT_MASTER( message )                         \
+      if( ! TNL::MPI::Initialized() || TNL::MPI::Finalized() )     \
+         std::cerr << message << std::endl;                        \
+      else {                                                       \
+         if( TNL::MPI::GetRank() == 0 ) {                          \
+            std::cerr << "Master node : " << message << std::endl; \
+         }                                                         \
+      }
 #else
-#define TNL_MPI_PRINT_MASTER( message )                                                                                          \
-   std::cerr << message << std::endl;
+   #define TNL_MPI_PRINT_MASTER( message ) std::cerr << message << std::endl;
 #endif
 
 #ifdef HAVE_MPI
-#define TNL_MPI_PRINT_COND( condition, message )                                                                                 \
-if( ! TNL::MPI::Initialized() || TNL::MPI::Finalized() )                                                                         \
-{                                                                                                                                \
-   if( condition) std::cerr << message << std::endl;                                                                             \
-}                                                                                                                                \
-else                                                                                                                             \
-{                                                                                                                                \
-   if( TNL::MPI::GetRank() > 0 )                                                                                                 \
-   {                                                                                                                             \
-      int __tnl_mpi_print_cnd = ( condition );                                                                                   \
-      TNL::MPI::Send( &__tnl_mpi_print_cnd, 1, 0, 0 );                                                                           \
-      if( condition ) {                                                                                                          \
-         std::stringstream __tnl_mpi_print_stream_;                                                                              \
-         __tnl_mpi_print_stream_ << "Node " << TNL::MPI::GetRank() << " of " << TNL::MPI::GetSize() << " : "                     \
-                                 << message << std::endl;                                                                        \
-         TNL::String __tnl_mpi_print_string_( __tnl_mpi_print_stream_.str() );                                                   \
-         TNL::MPI::send( __tnl_mpi_print_string_, 0, std::numeric_limits< int >::max() );                                        \
-      }                                                                                                                          \
-   }                                                                                                                             \
-   else                                                                                                                          \
-   {                                                                                                                             \
-      if( condition )                                                                                                            \
-         std::cerr << "Node 0 of " << TNL::MPI::GetSize() << " : " << message << std::endl;                                      \
-      for( int __tnl_mpi_print_j = 1; __tnl_mpi_print_j < TNL::MPI::GetSize(); __tnl_mpi_print_j++ )                             \
-         {                                                                                                                       \
-            int __tnl_mpi_print_cond;                                                                                            \
-            TNL::MPI::Recv( &__tnl_mpi_print_cond, 1, __tnl_mpi_print_j, 0 );                                                    \
-            if( __tnl_mpi_print_cond )                                                                                           \
-            {                                                                                                                    \
-               TNL::String __tnl_mpi_print_string_;                                                                              \
-               TNL::MPI::recv( __tnl_mpi_print_string_, __tnl_mpi_print_j, std::numeric_limits< int >::max() );                  \
-               std::cerr << __tnl_mpi_print_string_;                                                                             \
-            }                                                                                                                    \
-         }                                                                                                                       \
-   }                                                                                                                             \
-}
+   #define TNL_MPI_PRINT_COND( condition, message )                                                                           \
+      if( ! TNL::MPI::Initialized() || TNL::MPI::Finalized() ) {                                                              \
+         if( condition )                                                                                                      \
+            std::cerr << message << std::endl;                                                                                \
+      }                                                                                                                       \
+      else {                                                                                                                  \
+         if( TNL::MPI::GetRank() > 0 ) {                                                                                      \
+            int __tnl_mpi_print_cnd = ( condition );                                                                          \
+            TNL::MPI::Send( &__tnl_mpi_print_cnd, 1, 0, 0 );                                                                  \
+            if( condition ) {                                                                                                 \
+               std::stringstream __tnl_mpi_print_stream_;                                                                     \
+               __tnl_mpi_print_stream_ << "Node " << TNL::MPI::GetRank() << " of " << TNL::MPI::GetSize() << " : " << message \
+                                       << std::endl;                                                                          \
+               TNL::String __tnl_mpi_print_string_( __tnl_mpi_print_stream_.str() );                                          \
+               TNL::MPI::send( __tnl_mpi_print_string_, 0, std::numeric_limits< int >::max() );                               \
+            }                                                                                                                 \
+         }                                                                                                                    \
+         else {                                                                                                               \
+            if( condition )                                                                                                   \
+               std::cerr << "Node 0 of " << TNL::MPI::GetSize() << " : " << message << std::endl;                             \
+            for( int __tnl_mpi_print_j = 1; __tnl_mpi_print_j < TNL::MPI::GetSize(); __tnl_mpi_print_j++ ) {                  \
+               int __tnl_mpi_print_cond;                                                                                      \
+               TNL::MPI::Recv( &__tnl_mpi_print_cond, 1, __tnl_mpi_print_j, 0 );                                              \
+               if( __tnl_mpi_print_cond ) {                                                                                   \
+                  TNL::String __tnl_mpi_print_string_;                                                                        \
+                  TNL::MPI::recv( __tnl_mpi_print_string_, __tnl_mpi_print_j, std::numeric_limits< int >::max() );            \
+                  std::cerr << __tnl_mpi_print_string_;                                                                       \
+               }                                                                                                              \
+            }                                                                                                                 \
+         }                                                                                                                    \
+      }
 #else
-#define TNL_MPI_PRINT_COND( condition, message )                                                                                 \
-   std::cerr << message << std::endl;
+   #define TNL_MPI_PRINT_COND( condition, message ) std::cerr << message << std::endl;
 #endif
diff --git a/src/TNL/MPI/Profiling.h b/src/TNL/MPI/Profiling.h
index 7520cf5f9a5c29a66a2cfc2eff9a29545a2128a9..0e158cfa1a35692868b8dccf7cb176ad52d014dd 100644
--- a/src/TNL/MPI/Profiling.h
+++ b/src/TNL/MPI/Profiling.h
@@ -11,11 +11,12 @@
 namespace TNL {
 namespace MPI {
 
-inline Timer& getTimerAllreduce()
+inline Timer&
+getTimerAllreduce()
 {
    static Timer t;
    return t;
 }
 
-} // namespace MPI
-} // namespace TNL
+}  // namespace MPI
+}  // namespace TNL
diff --git a/src/TNL/MPI/ScopedInitializer.h b/src/TNL/MPI/ScopedInitializer.h
index e46abb617de02b02db4ee3cf57fb373c0fd45c7e..141afc141ef5e829eaf7342e431ea2440b0e7f1c 100644
--- a/src/TNL/MPI/ScopedInitializer.h
+++ b/src/TNL/MPI/ScopedInitializer.h
@@ -28,5 +28,5 @@ struct ScopedInitializer
    }
 };
 
-} // namespace MPI
-} // namespace TNL
+}  // namespace MPI
+}  // namespace TNL
diff --git a/src/TNL/MPI/Utils.h b/src/TNL/MPI/Utils.h
index 7f3d9129a99ef1a2531146079f65ff6694e56634..3f6f08a9c0a97824fb71d6393044ccb0573812bd 100644
--- a/src/TNL/MPI/Utils.h
+++ b/src/TNL/MPI/Utils.h
@@ -14,17 +14,19 @@
 namespace TNL {
 namespace MPI {
 
-inline bool isInitialized()
+inline bool
+isInitialized()
 {
    return Initialized() && ! Finalized();
 }
 
-inline void setupRedirection( std::string outputDirectory )
+inline void
+setupRedirection( const std::string& outputDirectory )
 {
 #ifdef HAVE_MPI
    if( GetSize() > 1 && GetRank() != 0 ) {
-      const std::string stdoutFile = outputDirectory + "/stdout_" + std::to_string(GetRank()) + ".txt";
-      const std::string stderrFile = outputDirectory + "/stderr_" + std::to_string(GetRank()) + ".txt";
+      const std::string stdoutFile = outputDirectory + "/stdout_" + std::to_string( GetRank() ) + ".txt";
+      const std::string stderrFile = outputDirectory + "/stderr_" + std::to_string( GetRank() ) + ".txt";
       std::cout << GetRank() << ": Redirecting stdout and stderr to files " << stdoutFile << " and " << stderrFile << std::endl;
       Debugging::redirect_stdout_stderr( stdoutFile, stderrFile );
    }
@@ -32,7 +34,8 @@ inline void setupRedirection( std::string outputDirectory )
 }
 
 // restore redirection (usually not necessary, it uses RAII internally...)
-inline void restoreRedirection()
+inline void
+restoreRedirection()
 {
    if( GetSize() > 1 && GetRank() != 0 ) {
       Debugging::redirect_stdout_stderr( "", "", true );
@@ -47,7 +50,8 @@ inline void restoreRedirection()
  * `MPI_COMM_TYPE_SHARED` type (from MPI-3) and the rank ID of the process
  * within the group is returned.
  */
-inline int getRankOnNode( MPI_Comm communicator = MPI_COMM_WORLD )
+inline int
+getRankOnNode( MPI_Comm communicator = MPI_COMM_WORLD )
 {
 #ifdef HAVE_MPI
    const int rank = GetRank( communicator );
@@ -60,8 +64,8 @@ inline int getRankOnNode( MPI_Comm communicator = MPI_COMM_WORLD )
 
    const int local_rank = GetRank( local_comm );
 
-   MPI_Comm_free(&local_comm);
-   MPI_Info_free(&info);
+   MPI_Comm_free( &local_comm );
+   MPI_Info_free( &info );
 
    return local_rank;
 #else
@@ -86,7 +90,8 @@ inline int getRankOnNode( MPI_Comm communicator = MPI_COMM_WORLD )
  *         value).
  */
 template< typename T >
-T reduce( T value, const MPI_Op& op, MPI_Comm communicator = MPI_COMM_WORLD )
+T
+reduce( T value, const MPI_Op& op, MPI_Comm communicator = MPI_COMM_WORLD )
 {
    // call the in-place variant of Allreduce
    Allreduce( &value, 1, op, communicator );
@@ -102,7 +107,8 @@ T reduce( T value, const MPI_Op& op, MPI_Comm communicator = MPI_COMM_WORLD )
  * to receive the data.
  */
 template< typename Array >
-void send( const Array& array, int dest, int tag, MPI_Comm communicator = MPI_COMM_WORLD )
+void
+send( const Array& array, int dest, int tag, MPI_Comm communicator = MPI_COMM_WORLD )
 {
    const auto size = array.getSize();
    MPI::Send( &size, 1, dest, tag, communicator );
@@ -119,7 +125,7 @@ template< typename Array >
 std::enable_if_t< ! IsViewType< Array >::value >
 recv( Array& array, int src, int tag, MPI_Comm communicator = MPI_COMM_WORLD )
 {
-   using Index = decltype(array.getSize());
+   using Index = decltype( array.getSize() );
    Index size;
    MPI::Recv( &size, 1, src, tag, communicator );
    array.setSize( size );
@@ -139,12 +145,14 @@ template< typename Array >
 std::enable_if_t< IsViewType< Array >::value >
 recv( Array& view, int src, int tag, MPI_Comm communicator = MPI_COMM_WORLD )
 {
-   using Index = decltype(view.getSize());
+   using Index = decltype( view.getSize() );
    Index size;
    MPI::Recv( &size, 1, src, tag, communicator );
    if( size != view.getSize() )
-      throw std::runtime_error( "MPI::recv error: The received size (" + std::to_string(size) + ") does not match "
-                                "the array view size (" + std::to_string(view.getSize()) + ")" );
+      throw std::runtime_error( "MPI::recv error: The received size (" + std::to_string( size )
+                                + ") does not match "
+                                  "the array view size ("
+                                + std::to_string( view.getSize() ) + ")" );
    MPI::Recv( view.getData(), size, src, tag, communicator );
 }
 
@@ -162,14 +170,22 @@ sendrecv( const SendArray& sendArray,
           int recvTag,
           MPI_Comm communicator = MPI_COMM_WORLD )
 {
-   using SendIndex = decltype(sendArray.getSize());
-   using RecvIndex = decltype(recvArray.getSize());
+   using SendIndex = decltype( sendArray.getSize() );
+   using RecvIndex = decltype( recvArray.getSize() );
 
    const SendIndex sendSize = sendArray.getSize();
    RecvIndex recvSize;
    MPI::Sendrecv( &sendSize, 1, dest, sendTag, &recvSize, 1, src, recvTag, communicator );
    recvArray.setSize( recvSize );
-   MPI::Sendrecv( sendArray.getData(), sendArray.getSize(), dest, sendTag, recvArray.getData(), recvArray.getSize(), src, recvTag, communicator );
+   MPI::Sendrecv( sendArray.getData(),
+                  sendArray.getSize(),
+                  dest,
+                  sendTag,
+                  recvArray.getData(),
+                  recvArray.getSize(),
+                  src,
+                  recvTag,
+                  communicator );
 }
 
 /**
@@ -189,16 +205,26 @@ sendrecv( const SendArray& sendArray,
           int recvTag,
           MPI_Comm communicator = MPI_COMM_WORLD )
 {
-   using SendIndex = decltype(sendArray.getSize());
-   using RecvIndex = decltype(recvArray.getSize());
+   using SendIndex = decltype( sendArray.getSize() );
+   using RecvIndex = decltype( recvArray.getSize() );
 
    const SendIndex sendSize = sendArray.getSize();
    RecvIndex recvSize;
    MPI::Sendrecv( &sendSize, 1, dest, sendTag, &recvSize, 1, src, recvTag, communicator );
    if( recvSize != recvArray.getSize() )
-      throw std::runtime_error( "MPI::sendrecv error: The received size (" + std::to_string(recvSize) + ") does not match "
-                                "the array view size (" + std::to_string(recvArray.getSize()) + ")" );
-   MPI::Sendrecv( sendArray.getData(), sendArray.getSize(), dest, sendTag, recvArray.getData(), recvArray.getSize(), src, recvTag, communicator );
+      throw std::runtime_error( "MPI::sendrecv error: The received size (" + std::to_string( recvSize )
+                                + ") does not match "
+                                  "the array view size ("
+                                + std::to_string( recvArray.getSize() ) + ")" );
+   MPI::Sendrecv( sendArray.getData(),
+                  sendArray.getSize(),
+                  dest,
+                  sendTag,
+                  recvArray.getData(),
+                  recvArray.getSize(),
+                  src,
+                  recvTag,
+                  communicator );
 }
 
 /**
@@ -206,9 +232,7 @@ sendrecv( const SendArray& sendArray,
  */
 template< typename T >
 std::enable_if_t< IsScalarType< T >::value, T >
-bcast( T value,
-       int root,
-       MPI_Comm communicator = MPI_COMM_WORLD )
+bcast( T value, int root, MPI_Comm communicator = MPI_COMM_WORLD )
 {
    MPI::Bcast( &value, 1, root, communicator );
    return value;
@@ -219,9 +243,7 @@ bcast( T value,
  */
 template< typename Array >
 std::enable_if_t< ! IsScalarType< Array >::value && ! IsViewType< Array >::value >
-bcast( Array& array,
-       int root,
-       MPI_Comm communicator = MPI_COMM_WORLD )
+bcast( Array& array, int root, MPI_Comm communicator = MPI_COMM_WORLD )
 {
    auto size = array.getSize();
    MPI::Bcast( &size, 1, root, communicator );
@@ -229,5 +251,5 @@ bcast( Array& array,
    MPI::Bcast( array.getData(), size, root, communicator );
 }
 
-} // namespace MPI
-} // namespace TNL
+}  // namespace MPI
+}  // namespace TNL
diff --git a/src/TNL/MPI/Wrappers.h b/src/TNL/MPI/Wrappers.h
index 1c224bf0d95a739fa3bb5cda991a3212a1ee5217..872e4ad4dedd4100c5fee435c5ee06b5a4b55fe2 100644
--- a/src/TNL/MPI/Wrappers.h
+++ b/src/TNL/MPI/Wrappers.h
@@ -25,22 +25,25 @@ namespace TNL {
 namespace MPI {
 
 // forward declaration to break cyclic inclusion
-inline void selectGPU();
+inline void
+selectGPU();
 
 // wrappers for basic MPI functions
 
-inline void Init( int& argc, char**& argv, int required_thread_level = MPI_THREAD_SINGLE )
+inline void
+Init( int& argc, char**& argv, int required_thread_level = MPI_THREAD_SINGLE )
 {
 #ifdef HAVE_MPI
    switch( required_thread_level ) {
-      case MPI_THREAD_SINGLE:       // application is single-threaded
-      case MPI_THREAD_FUNNELED:     // application is multithreaded, but all MPI calls will be issued from the master thread only
-      case MPI_THREAD_SERIALIZED:   // application is multithreaded and any thread may issue MPI calls, but different threads will never issue MPI calls at the same time
-      case MPI_THREAD_MULTIPLE:     // application is multithreaded and any thread may issue MPI calls at any time
+      case MPI_THREAD_SINGLE:      // application is single-threaded
+      case MPI_THREAD_FUNNELED:    // application is multithreaded, but all MPI calls will be issued from the master thread only
+      case MPI_THREAD_SERIALIZED:  // application is multithreaded and any thread may issue MPI calls, but different threads
+                                   // will never issue MPI calls at the same time
+      case MPI_THREAD_MULTIPLE:    // application is multithreaded and any thread may issue MPI calls at any time
          break;
       default:
          std::cerr << "ERROR: invalid argument for the 'required' thread level support: " << required_thread_level << std::endl;
-         MPI_Abort(MPI_COMM_WORLD, 1);
+         MPI_Abort( MPI_COMM_WORLD, 1 );
    }
 
    int provided;
@@ -62,43 +65,47 @@ inline void Init( int& argc, char**& argv, int required_thread_level = MPI_THREA
             break;
       }
       std::cerr << "ERROR: The MPI library does not have the required level of thread support: " << level << std::endl;
-      MPI_Abort(MPI_COMM_WORLD, 1);
+      MPI_Abort( MPI_COMM_WORLD, 1 );
    }
 
    selectGPU();
 #endif
 }
 
-inline void Finalize()
+inline void
+Finalize()
 {
 #ifdef HAVE_MPI
    MPI_Finalize();
 #endif
 }
 
-inline bool Initialized()
+inline bool
+Initialized()
 {
 #ifdef HAVE_MPI
    int flag;
    MPI_Initialized( &flag );
-   return flag;
+   return flag != 0;
 #else
    return true;
 #endif
 }
 
-inline bool Finalized()
+inline bool
+Finalized()
 {
 #ifdef HAVE_MPI
    int flag;
    MPI_Finalized( &flag );
-   return flag;
+   return flag != 0;
 #else
    return false;
 #endif
 }
 
-inline int GetRank( MPI_Comm communicator = MPI_COMM_WORLD )
+inline int
+GetRank( MPI_Comm communicator = MPI_COMM_WORLD )
 {
    TNL_ASSERT_NE( communicator, MPI_COMM_NULL, "GetRank cannot be called with MPI_COMM_NULL" );
 #ifdef HAVE_MPI
@@ -111,7 +118,8 @@ inline int GetRank( MPI_Comm communicator = MPI_COMM_WORLD )
 #endif
 }
 
-inline int GetSize( MPI_Comm communicator = MPI_COMM_WORLD )
+inline int
+GetSize( MPI_Comm communicator = MPI_COMM_WORLD )
 {
    TNL_ASSERT_NE( communicator, MPI_COMM_NULL, "GetSize cannot be called with MPI_COMM_NULL" );
 #ifdef HAVE_MPI
@@ -126,7 +134,8 @@ inline int GetSize( MPI_Comm communicator = MPI_COMM_WORLD )
 
 // wrappers for MPI helper functions
 
-inline MPI_Comm Comm_split( MPI_Comm comm, int color, int key )
+inline MPI_Comm
+Comm_split( MPI_Comm comm, int color, int key )
 {
 #ifdef HAVE_MPI
    MPI_Comm newcomm;
@@ -150,7 +159,8 @@ inline MPI_Comm Comm_split( MPI_Comm comm, int color, int key )
  *
  * See the MPI documentation for more information.
  */
-inline void Compute_dims( int nnodes, int ndims, int* dims )
+inline void
+Compute_dims( int nnodes, int ndims, int* dims )
 {
 #ifdef HAVE_MPI
    int prod = 1;
@@ -163,19 +173,23 @@ inline void Compute_dims( int nnodes, int ndims, int* dims )
 
    if( nnodes % prod != 0 )
       throw std::logic_error( "The program tries to call MPI_Dims_create with wrong dimensions."
-            "The product of the non-zero values dims[i] is " + std::to_string(prod) + " and the "
-            "number of processes (" + std::to_string(nnodes) + ") is not a multiple of the product." );
+                              "The product of the non-zero values dims[i] is "
+                              + std::to_string( prod )
+                              + " and the "
+                                "number of processes ("
+                              + std::to_string( nnodes ) + ") is not a multiple of the product." );
 
    MPI_Dims_create( nnodes, ndims, dims );
 #else
-   for( int i = 0; i < ndims; i++)
+   for( int i = 0; i < ndims; i++ )
       dims[ i ] = 1;
 #endif
 }
 
 // wrappers for MPI communication functions
 
-inline void Barrier( MPI_Comm communicator = MPI_COMM_WORLD )
+inline void
+Barrier( MPI_Comm communicator = MPI_COMM_WORLD )
 {
    TNL_ASSERT_NE( communicator, MPI_COMM_NULL, "Barrier cannot be called with MPI_COMM_NULL" );
 #ifdef HAVE_MPI
@@ -184,7 +198,8 @@ inline void Barrier( MPI_Comm communicator = MPI_COMM_WORLD )
 #endif
 }
 
-inline void Waitall( MPI_Request* reqs, int length )
+inline void
+Waitall( MPI_Request* reqs, int length )
 {
 #ifdef HAVE_MPI
    TNL_ASSERT_TRUE( Initialized() && ! Finalized(), "Fatal Error - MPI is not initialized" );
@@ -193,55 +208,50 @@ inline void Waitall( MPI_Request* reqs, int length )
 }
 
 template< typename T >
-void Send( const T* data,
-           int count,
-           int dest,
-           int tag,
-           MPI_Comm communicator = MPI_COMM_WORLD )
+void
+Send( const T* data, int count, int dest, int tag, MPI_Comm communicator = MPI_COMM_WORLD )
 {
    TNL_ASSERT_NE( communicator, MPI_COMM_NULL, "Send cannot be called with MPI_COMM_NULL" );
 #ifdef HAVE_MPI
    TNL_ASSERT_TRUE( Initialized() && ! Finalized(), "Fatal Error - MPI is not initialized" );
-   MPI_Send( (const void*) data, count, getDataType<T>(), dest, tag, communicator );
+   MPI_Send( (const void*) data, count, getDataType< T >(), dest, tag, communicator );
 #endif
 }
 
 template< typename T >
-void Recv( T* data,
-           int count,
-           int src,
-           int tag,
-           MPI_Comm communicator = MPI_COMM_WORLD )
+void
+Recv( T* data, int count, int src, int tag, MPI_Comm communicator = MPI_COMM_WORLD )
 {
    TNL_ASSERT_NE( communicator, MPI_COMM_NULL, "Recv cannot be called with MPI_COMM_NULL" );
 #ifdef HAVE_MPI
    TNL_ASSERT_TRUE( Initialized() && ! Finalized(), "Fatal Error - MPI is not initialized" );
-   MPI_Recv( (void*) data, count, getDataType<T>(), src, tag, communicator, MPI_STATUS_IGNORE );
+   MPI_Recv( (void*) data, count, getDataType< T >(), src, tag, communicator, MPI_STATUS_IGNORE );
 #endif
 }
 
 template< typename T >
-void Sendrecv( const T* sendData,
-               int sendCount,
-               int destination,
-               int sendTag,
-               T* receiveData,
-               int receiveCount,
-               int source,
-               int receiveTag,
-               MPI_Comm communicator = MPI_COMM_WORLD )
+void
+Sendrecv( const T* sendData,
+          int sendCount,
+          int destination,
+          int sendTag,
+          T* receiveData,
+          int receiveCount,
+          int source,
+          int receiveTag,
+          MPI_Comm communicator = MPI_COMM_WORLD )
 {
    TNL_ASSERT_NE( communicator, MPI_COMM_NULL, "Sendrecv cannot be called with MPI_COMM_NULL" );
 #ifdef HAVE_MPI
    TNL_ASSERT_TRUE( Initialized() && ! Finalized(), "Fatal Error - MPI is not initialized" );
    MPI_Sendrecv( (void*) sendData,
                  sendCount,
-                 getDataType<T>(),
+                 getDataType< T >(),
                  destination,
                  sendTag,
                  (void*) receiveData,
                  receiveCount,
-                 getDataType<T>(),
+                 getDataType< T >(),
                  source,
                  receiveTag,
                  communicator,
@@ -252,17 +262,14 @@ void Sendrecv( const T* sendData,
 }
 
 template< typename T >
-MPI_Request Isend( const T* data,
-                   int count,
-                   int dest,
-                   int tag,
-                   MPI_Comm communicator = MPI_COMM_WORLD )
+MPI_Request
+Isend( const T* data, int count, int dest, int tag, MPI_Comm communicator = MPI_COMM_WORLD )
 {
    TNL_ASSERT_NE( communicator, MPI_COMM_NULL, "Isend cannot be called with MPI_COMM_NULL" );
 #ifdef HAVE_MPI
    TNL_ASSERT_TRUE( Initialized() && ! Finalized(), "Fatal Error - MPI is not initialized" );
    MPI_Request req;
-   MPI_Isend( (const void*) data, count, getDataType<T>(), dest, tag, communicator, &req );
+   MPI_Isend( (const void*) data, count, getDataType< T >(), dest, tag, communicator, &req );
    return req;
 #else
    return MPI_REQUEST_NULL;
@@ -270,17 +277,14 @@ MPI_Request Isend( const T* data,
 }
 
 template< typename T >
-MPI_Request Irecv( T* data,
-                   int count,
-                   int src,
-                   int tag,
-                   MPI_Comm communicator = MPI_COMM_WORLD )
+MPI_Request
+Irecv( T* data, int count, int src, int tag, MPI_Comm communicator = MPI_COMM_WORLD )
 {
    TNL_ASSERT_NE( communicator, MPI_COMM_NULL, "Irecv cannot be called with MPI_COMM_NULL" );
 #ifdef HAVE_MPI
    TNL_ASSERT_TRUE( Initialized() && ! Finalized(), "Fatal Error - MPI is not initialized" );
    MPI_Request req;
-   MPI_Irecv( (void*) data, count, getDataType<T>(), src, tag, communicator, &req );
+   MPI_Irecv( (void*) data, count, getDataType< T >(), src, tag, communicator, &req );
    return req;
 #else
    return MPI_REQUEST_NULL;
@@ -288,90 +292,76 @@ MPI_Request Irecv( T* data,
 }
 
 template< typename T >
-void Allreduce( const T* data,
-                T* reduced_data,
-                int count,
-                const MPI_Op& op,
-                MPI_Comm communicator = MPI_COMM_WORLD )
+void
+Allreduce( const T* data, T* reduced_data, int count, const MPI_Op& op, MPI_Comm communicator = MPI_COMM_WORLD )
 {
    TNL_ASSERT_NE( communicator, MPI_COMM_NULL, "Allreduce cannot be called with MPI_COMM_NULL" );
 #ifdef HAVE_MPI
    getTimerAllreduce().start();
-   MPI_Allreduce( (const void*) data, (void*) reduced_data, count, getDataType<T>(), op, communicator );
+   MPI_Allreduce( (const void*) data, (void*) reduced_data, count, getDataType< T >(), op, communicator );
    getTimerAllreduce().stop();
 #else
-   std::memcpy( (void*) reduced_data, (const void*) data, count * sizeof(T) );
+   std::memcpy( (void*) reduced_data, (const void*) data, count * sizeof( T ) );
 #endif
 }
 
 // in-place variant of Allreduce
 template< typename T >
-void Allreduce( T* data,
-                int count,
-                const MPI_Op& op,
-                MPI_Comm communicator = MPI_COMM_WORLD )
+void
+Allreduce( T* data, int count, const MPI_Op& op, MPI_Comm communicator = MPI_COMM_WORLD )
 {
    TNL_ASSERT_NE( communicator, MPI_COMM_NULL, "Allreduce cannot be called with MPI_COMM_NULL" );
 #ifdef HAVE_MPI
    getTimerAllreduce().start();
-   MPI_Allreduce( MPI_IN_PLACE, (void*) data, count, getDataType<T>(), op, communicator );
+   MPI_Allreduce( MPI_IN_PLACE, (void*) data, count, getDataType< T >(), op, communicator );
    getTimerAllreduce().stop();
 #endif
 }
 
 template< typename T >
-void Reduce( const T* data,
-             T* reduced_data,
-             int count,
-             const MPI_Op& op,
-             int root,
-             MPI_Comm communicator = MPI_COMM_WORLD )
+void
+Reduce( const T* data, T* reduced_data, int count, const MPI_Op& op, int root, MPI_Comm communicator = MPI_COMM_WORLD )
 {
    TNL_ASSERT_NE( communicator, MPI_COMM_NULL, "Reduce cannot be called with MPI_COMM_NULL" );
 #ifdef HAVE_MPI
-   MPI_Reduce( (const void*) data, (void*) reduced_data, count, getDataType<T>(), op, root, communicator );
+   MPI_Reduce( (const void*) data, (void*) reduced_data, count, getDataType< T >(), op, root, communicator );
 #else
-   std::memcpy( (void*) reduced_data, (void*) data, count * sizeof(T) );
+   std::memcpy( (void*) reduced_data, (void*) data, count * sizeof( T ) );
 #endif
 }
 
 template< typename T >
-void Bcast( T* data,
-            int count,
-            int root,
-            MPI_Comm communicator = MPI_COMM_WORLD )
+void
+Bcast( T* data, int count, int root, MPI_Comm communicator = MPI_COMM_WORLD )
 {
    TNL_ASSERT_NE( communicator, MPI_COMM_NULL, "Bcast cannot be called with MPI_COMM_NULL" );
 #ifdef HAVE_MPI
    TNL_ASSERT_TRUE( Initialized() && ! Finalized(), "Fatal Error - MPI is not initialized" );
-   MPI_Bcast( (void*) data, count, getDataType<T>(), root, communicator );
+   MPI_Bcast( (void*) data, count, getDataType< T >(), root, communicator );
 #endif
 }
 
 template< typename T >
-void Alltoall( const T* sendData,
-               int sendCount,
-               T* receiveData,
-               int receiveCount,
-               MPI_Comm communicator = MPI_COMM_WORLD )
+void
+Alltoall( const T* sendData, int sendCount, T* receiveData, int receiveCount, MPI_Comm communicator = MPI_COMM_WORLD )
 {
    TNL_ASSERT_NE( communicator, MPI_COMM_NULL, "Alltoall cannot be called with MPI_COMM_NULL" );
 #ifdef HAVE_MPI
    MPI_Alltoall( (const void*) sendData,
                  sendCount,
-                 getDataType<T>(),
+                 getDataType< T >(),
                  (void*) receiveData,
                  receiveCount,
-                 getDataType<T>(),
+                 getDataType< T >(),
                  communicator );
 #else
    TNL_ASSERT_EQ( sendCount, receiveCount, "sendCount must be equal to receiveCount when running without MPI." );
-   std::memcpy( (void*) receiveData, (const void*) sendData, sendCount * sizeof(T) );
+   std::memcpy( (void*) receiveData, (const void*) sendData, sendCount * sizeof( T ) );
 #endif
 }
 
-} // namespace MPI
-} // namespace TNL
+}  // namespace MPI
+}  // namespace TNL
 
 // late inclusion to break cyclic inclusion
 #include "selectGPU.h"
diff --git a/src/TNL/MPI/getDataType.h b/src/TNL/MPI/getDataType.h
index 97a44674016d6ff59f33e9608ca6322cc7409e5b..0d6c09cafde17cc48e98d9fc7ea320577793a9ff 100644
--- a/src/TNL/MPI/getDataType.h
+++ b/src/TNL/MPI/getDataType.h
@@ -17,22 +17,20 @@ namespace MPI {
 template< typename T >
 struct TypeResolver
 {
-   static inline MPI_Datatype getType()
+   static inline MPI_Datatype
+   getType()
    {
-      static_assert( sizeof(T) == sizeof(char) ||
-                     sizeof(T) == sizeof(int) ||
-                     sizeof(T) == sizeof(short int) ||
-                     sizeof(T) == sizeof(long int),
-                     "Fatal Error - Unknown MPI Type");
-      switch( sizeof(T) )
-      {
-         case sizeof(char):
+      static_assert( sizeof( T ) == sizeof( char ) || sizeof( T ) == sizeof( int ) || sizeof( T ) == sizeof( short int )
+                        || sizeof( T ) == sizeof( long int ),
+                     "Fatal Error - Unknown MPI Type" );
+      switch( sizeof( T ) ) {
+         case sizeof( char ):
             return MPI_CHAR;
-         case sizeof(int):
+         case sizeof( int ):
             return MPI_INT;
-         case sizeof(short int):
+         case sizeof( short int ):
             return MPI_SHORT;
-         case sizeof(long int):
+         case sizeof( long int ):
             return MPI_LONG;
       }
       // This will never happen thanks to the static_assert above, but icpc is
@@ -42,74 +40,135 @@ struct TypeResolver
    }
 };
 
-template<> struct TypeResolver< char >
+template<>
+struct TypeResolver< char >
 {
-   static inline MPI_Datatype getType(){return MPI_CHAR;};
+   static inline MPI_Datatype
+   getType()
+   {
+      return MPI_CHAR;
+   };
 };
 
-template<> struct TypeResolver< int >
+template<>
+struct TypeResolver< int >
 {
-   static inline MPI_Datatype getType(){return MPI_INT;};
+   static inline MPI_Datatype
+   getType()
+   {
+      return MPI_INT;
+   };
 };
 
-template<> struct TypeResolver< short int >
+template<>
+struct TypeResolver< short int >
 {
-   static inline MPI_Datatype getType(){return MPI_SHORT;};
+   static inline MPI_Datatype
+   getType()
+   {
+      return MPI_SHORT;
+   };
 };
 
-template<> struct TypeResolver< long int >
+template<>
+struct TypeResolver< long int >
 {
-   static inline MPI_Datatype getType(){return MPI_LONG;};
+   static inline MPI_Datatype
+   getType()
+   {
+      return MPI_LONG;
+   };
 };
 
-template<> struct TypeResolver< unsigned char >
+template<>
+struct TypeResolver< unsigned char >
 {
-   static inline MPI_Datatype getType(){return MPI_UNSIGNED_CHAR;};
+   static inline MPI_Datatype
+   getType()
+   {
+      return MPI_UNSIGNED_CHAR;
+   };
 };
 
-template<> struct TypeResolver< unsigned short int >
+template<>
+struct TypeResolver< unsigned short int >
 {
-   static inline MPI_Datatype getType(){return MPI_UNSIGNED_SHORT;};
+   static inline MPI_Datatype
+   getType()
+   {
+      return MPI_UNSIGNED_SHORT;
+   };
 };
 
-template<> struct TypeResolver< unsigned int >
+template<>
+struct TypeResolver< unsigned int >
 {
-   static inline MPI_Datatype getType(){return MPI_UNSIGNED;};
+   static inline MPI_Datatype
+   getType()
+   {
+      return MPI_UNSIGNED;
+   };
 };
 
-template<> struct TypeResolver< unsigned long int >
+template<>
+struct TypeResolver< unsigned long int >
 {
-   static inline MPI_Datatype getType(){return MPI_UNSIGNED_LONG;};
+   static inline MPI_Datatype
+   getType()
+   {
+      return MPI_UNSIGNED_LONG;
+   };
 };
 
-template<> struct TypeResolver< float >
+template<>
+struct TypeResolver< float >
 {
-   static inline MPI_Datatype getType(){return MPI_FLOAT;};
+   static inline MPI_Datatype
+   getType()
+   {
+      return MPI_FLOAT;
+   };
 };
 
-template<> struct TypeResolver< double >
+template<>
+struct TypeResolver< double >
 {
-   static inline MPI_Datatype getType(){return MPI_DOUBLE;};
+   static inline MPI_Datatype
+   getType()
+   {
+      return MPI_DOUBLE;
+   };
 };
 
-template<> struct TypeResolver< long double >
+template<>
+struct TypeResolver< long double >
 {
-   static inline MPI_Datatype getType(){return MPI_LONG_DOUBLE;};
+   static inline MPI_Datatype
+   getType()
+   {
+      return MPI_LONG_DOUBLE;
+   };
 };
 
-template<> struct TypeResolver< bool >
+template<>
+struct TypeResolver< bool >
 {
    // sizeof(bool) is implementation-defined: https://stackoverflow.com/a/4897859
-   static_assert( sizeof(bool) == 1, "The systems where sizeof(bool) != 1 are not supported by MPI." );
-   static inline MPI_Datatype getType() { return MPI_C_BOOL; };
+   static_assert( sizeof( bool ) == 1, "The systems where sizeof(bool) != 1 are not supported by MPI." );
+   static inline MPI_Datatype
+   getType()
+   {
+      return MPI_C_BOOL;
+   };
 };
 
 template< typename T >
-MPI_Datatype getDataType( const T& = T{} )
+MPI_Datatype
+getDataType( const T& = T{} )
 {
    return TypeResolver< T >::getType();
 }
 #endif
 
-} // namespace MPI
-} // namespace TNL
+}  // namespace MPI
+}  // namespace TNL
diff --git a/src/TNL/MPI/selectGPU.h b/src/TNL/MPI/selectGPU.h
index dba1407a500f2c9f6cb80f7c162eb9af953e286f..9ebf1bcccbf7214e481c006e858d8c34f0efeaaa 100644
--- a/src/TNL/MPI/selectGPU.h
+++ b/src/TNL/MPI/selectGPU.h
@@ -15,30 +15,29 @@
 namespace TNL {
 namespace MPI {
 
-inline void selectGPU()
+inline void
+selectGPU()
 {
 #ifdef HAVE_MPI
-#ifdef HAVE_CUDA
+   #ifdef HAVE_CUDA
    int gpuCount;
-   cudaGetDeviceCount(&gpuCount);
+   cudaGetDeviceCount( &gpuCount );
 
    const int local_rank = getRankOnNode();
    const int gpuNumber = local_rank % gpuCount;
 
    // write debug output before calling cudaSetDevice
-   const char* cuda_visible_devices = std::getenv("CUDA_VISIBLE_DEVICES");
-   if( !cuda_visible_devices )
+   const char* cuda_visible_devices = std::getenv( "CUDA_VISIBLE_DEVICES" );
+   if( ! cuda_visible_devices )
       cuda_visible_devices = "";
-   std::cout << "Rank " << GetRank() << ": rank on node is " << local_rank
-             << ", using GPU id " << gpuNumber << " of " << gpuCount
-             << ", CUDA_VISIBLE_DEVICES=" << cuda_visible_devices
-             << std::endl;
+   std::cout << "Rank " << GetRank() << ": rank on node is " << local_rank << ", using GPU id " << gpuNumber << " of "
+             << gpuCount << ", CUDA_VISIBLE_DEVICES=" << cuda_visible_devices << std::endl;
 
-   cudaSetDevice(gpuNumber);
+   cudaSetDevice( gpuNumber );
    TNL_CHECK_CUDA_DEVICE;
-#endif
+   #endif
 #endif
 }
 
-} // namespace MPI
-} // namespace TNL
+}  // namespace MPI
+}  // namespace TNL
diff --git a/src/TNL/Math.h b/src/TNL/Math.h
index f00ae7917f3ec0aadecae7ab0bc1e90339e55ecd..d060946ec858b78047cab8f4d2020eff9f7ea12d 100644
--- a/src/TNL/Math.h
+++ b/src/TNL/Math.h
@@ -21,10 +21,13 @@ namespace TNL {
  * GPU device code uses the functions defined in the CUDA's math_functions.h,
  * host uses the STL functions.
  */
-template< typename T1, typename T2, typename ResultType = typename std::common_type< T1, T2 >::type,
+template< typename T1,
+          typename T2,
+          typename ResultType = typename std::common_type< T1, T2 >::type,
           // enable_if is necessary to avoid ambiguity in vector expressions
-          std::enable_if_t< std::is_arithmetic<T1>::value && std::is_arithmetic<T2>::value, bool > = true >
-constexpr ResultType min( const T1& a, const T2& b )
+          std::enable_if_t< std::is_arithmetic< T1 >::value && std::is_arithmetic< T2 >::value, bool > = true >
+constexpr ResultType
+min( const T1& a, const T2& b )
 {
    // std::min is constexpr since C++14 so it can be reused directly
    return std::min( (ResultType) a, (ResultType) b );
@@ -39,8 +42,8 @@ template< typename T1, typename T2, typename T3, typename... Ts >
 constexpr typename std::common_type< T1, T2, T3, Ts... >::type
 min( T1&& val1, T2&& val2, T3&& val3, Ts&&... vs )
 {
-   return min( min( std::forward<T1>(val1), std::forward<T2>(val2) ),
-               std::forward<T3>(val3), std::forward<Ts>(vs)... );
+   return min(
+      min( std::forward< T1 >( val1 ), std::forward< T2 >( val2 ) ), std::forward< T3 >( val3 ), std::forward< Ts >( vs )... );
 }
 
 /**
@@ -49,10 +52,13 @@ min( T1&& val1, T2&& val2, T3&& val3, Ts&&... vs )
  * GPU device code uses the functions defined in the CUDA's math_functions.h,
  * host uses the STL functions.
  */
-template< typename T1, typename T2, typename ResultType = typename std::common_type< T1, T2 >::type,
+template< typename T1,
+          typename T2,
+          typename ResultType = typename std::common_type< T1, T2 >::type,
           // enable_if is necessary to avoid ambiguity in vector expressions
-          std::enable_if_t< std::is_arithmetic<T1>::value && std::is_arithmetic<T2>::value, bool > = true >
-constexpr ResultType max( const T1& a, const T2& b )
+          std::enable_if_t< std::is_arithmetic< T1 >::value && std::is_arithmetic< T2 >::value, bool > = true >
+constexpr ResultType
+max( const T1& a, const T2& b )
 {
    // std::max is constexpr since C++14 so it can be reused directly
    return std::max( (ResultType) a, (ResultType) b );
@@ -68,19 +74,19 @@ __cuda_callable__
 typename std::common_type< T1, T2, T3, Ts... >::type
 max( T1&& val1, T2&& val2, T3&& val3, Ts&&... vs )
 {
-   return max( max( std::forward<T1>(val1), std::forward<T2>(val2) ),
-               std::forward<T3>(val3), std::forward<Ts>(vs)... );
+   return max(
+      max( std::forward< T1 >( val1 ), std::forward< T2 >( val2 ) ), std::forward< T3 >( val3 ), std::forward< Ts >( vs )... );
 }
 
 /**
  * \brief This function returns absolute value of given number \e n.
  */
-template< class T,
-          std::enable_if_t< std::is_arithmetic<T>::value && ! std::is_unsigned<T>::value, bool > = true >
+template< class T, std::enable_if_t< std::is_arithmetic< T >::value && ! std::is_unsigned< T >::value, bool > = true >
 __cuda_callable__
-T abs( const T& n )
+T
+abs( const T& n )
 {
-#if defined(__CUDA_ARCH__)
+#if defined( __CUDA_ARCH__ )
    if( std::is_integral< T >::value )
       return ::abs( n );
    else
@@ -93,10 +99,10 @@ T abs( const T& n )
 /**
  * \brief This function returns the absolute value of given unsigned number \e n, i.e. \e n.
  */
-template< class T,
-          std::enable_if_t< std::is_unsigned<T>::value, bool > = true >
+template< class T, std::enable_if_t< std::is_unsigned< T >::value, bool > = true >
 __cuda_callable__
-T abs( const T& n )
+T
+abs( const T& n )
 {
    return n;
 }
@@ -106,9 +112,10 @@ T abs( const T& n )
  */
 template< typename T1, typename T2, typename ResultType = typename std::common_type< T1, T2 >::type >
 __cuda_callable__
-ResultType argMin( const T1& a, const T2& b )
+ResultType
+argMin( const T1& a, const T2& b )
 {
-   return ( a < b ) ?  a : b;
+   return ( a < b ) ? a : b;
 }
 
 /***
@@ -116,9 +123,10 @@ ResultType argMin( const T1& a, const T2& b )
  */
 template< typename T1, typename T2, typename ResultType = typename std::common_type< T1, T2 >::type >
 __cuda_callable__
-ResultType argMax( const T1& a, const T2& b )
+ResultType
+argMax( const T1& a, const T2& b )
 {
-   return ( a > b ) ?  a : b;
+   return ( a > b ) ? a : b;
 }
 
 /***
@@ -126,9 +134,10 @@ ResultType argMax( const T1& a, const T2& b )
  */
 template< typename T1, typename T2, typename ResultType = typename std::common_type< T1, T2 >::type >
 __cuda_callable__
-ResultType argAbsMin( const T1& a, const T2& b )
+ResultType
+argAbsMin( const T1& a, const T2& b )
 {
-   return ( TNL::abs( a ) < TNL::abs( b ) ) ?  a : b;
+   return ( TNL::abs( a ) < TNL::abs( b ) ) ? a : b;
 }
 
 /***
@@ -136,21 +145,25 @@ ResultType argAbsMin( const T1& a, const T2& b )
  */
 template< typename T1, typename T2, typename ResultType = typename std::common_type< T1, T2 >::type >
 __cuda_callable__
-ResultType argAbsMax( const T1& a, const T2& b )
+ResultType
+argAbsMax( const T1& a, const T2& b )
 {
-   return ( TNL::abs( a ) > TNL::abs( b ) ) ?  a : b;
+   return ( TNL::abs( a ) > TNL::abs( b ) ) ? a : b;
 }
 
 /**
  * \brief This function returns the result of \e base to the power of \e exp.
  */
-template< typename T1, typename T2, typename ResultType = typename std::common_type< T1, T2 >::type,
+template< typename T1,
+          typename T2,
+          typename ResultType = typename std::common_type< T1, T2 >::type,
           // enable_if is necessary to avoid ambiguity in vector expressions
-          std::enable_if_t< std::is_arithmetic<T1>::value && std::is_arithmetic<T2>::value, bool > = true >
+          std::enable_if_t< std::is_arithmetic< T1 >::value && std::is_arithmetic< T2 >::value, bool > = true >
 __cuda_callable__
-ResultType pow( const T1& base, const T2& exp )
+ResultType
+pow( const T1& base, const T2& exp )
 {
-#if defined(__CUDA_ARCH__)
+#if defined( __CUDA_ARCH__ )
    return ::pow( (ResultType) base, (ResultType) exp );
 #else
    return std::pow( (ResultType) base, (ResultType) exp );
@@ -162,9 +175,10 @@ ResultType pow( const T1& base, const T2& exp )
  */
 template< typename T >
 __cuda_callable__
-auto exp( const T& value ) -> decltype( std::exp(value) )
+auto
+exp( const T& value ) -> decltype( std::exp( value ) )
 {
-#if defined(__CUDA_ARCH__)
+#if defined( __CUDA_ARCH__ )
    return ::exp( value );
 #else
    return std::exp( value );
@@ -176,9 +190,10 @@ auto exp( const T& value ) -> decltype( std::exp(value) )
  */
 template< typename T >
 __cuda_callable__
-auto sqrt( const T& value ) -> decltype( std::sqrt(value) )
+auto
+sqrt( const T& value ) -> decltype( std::sqrt( value ) )
 {
-#if defined(__CUDA_ARCH__)
+#if defined( __CUDA_ARCH__ )
    return ::sqrt( value );
 #else
    return std::sqrt( value );
@@ -190,9 +205,10 @@ auto sqrt( const T& value ) -> decltype( std::sqrt(value) )
  */
 template< typename T >
 __cuda_callable__
-auto cbrt( const T& value ) -> decltype( std::cbrt(value) )
+auto
+cbrt( const T& value ) -> decltype( std::cbrt( value ) )
 {
-#if defined(__CUDA_ARCH__)
+#if defined( __CUDA_ARCH__ )
    return ::cbrt( value );
 #else
    return std::cbrt( value );
@@ -204,9 +220,10 @@ auto cbrt( const T& value ) -> decltype( std::cbrt(value) )
  */
 template< typename T >
 __cuda_callable__
-auto log( const T& value ) -> decltype( std::log(value) )
+auto
+log( const T& value ) -> decltype( std::log( value ) )
 {
-#if defined(__CUDA_ARCH__)
+#if defined( __CUDA_ARCH__ )
    return ::log( value );
 #else
    return std::log( value );
@@ -218,9 +235,10 @@ auto log( const T& value ) -> decltype( std::log(value) )
  */
 template< typename T >
 __cuda_callable__
-auto log10( const T& value ) -> decltype( std::log10(value) )
+auto
+log10( const T& value ) -> decltype( std::log10( value ) )
 {
-#if defined(__CUDA_ARCH__)
+#if defined( __CUDA_ARCH__ )
    return ::log10( value );
 #else
    return std::log10( value );
@@ -232,9 +250,10 @@ auto log10( const T& value ) -> decltype( std::log10(value) )
  */
 template< typename T >
 __cuda_callable__
-auto log2( const T& value ) -> decltype( std::log2(value) )
+auto
+log2( const T& value ) -> decltype( std::log2( value ) )
 {
-#if defined(__CUDA_ARCH__)
+#if defined( __CUDA_ARCH__ )
    return ::log2( value );
 #else
    return std::log2( value );
@@ -246,9 +265,10 @@ auto log2( const T& value ) -> decltype( std::log2(value) )
  */
 template< typename T >
 __cuda_callable__
-auto sin( const T& value ) -> decltype( std::sin(value) )
+auto
+sin( const T& value ) -> decltype( std::sin( value ) )
 {
-#if defined(__CUDA_ARCH__)
+#if defined( __CUDA_ARCH__ )
    return ::sin( value );
 #else
    return std::sin( value );
@@ -260,9 +280,10 @@ auto sin( const T& value ) -> decltype( std::sin(value) )
  */
 template< typename T >
 __cuda_callable__
-auto cos( const T& value ) -> decltype( std::cos(value) )
+auto
+cos( const T& value ) -> decltype( std::cos( value ) )
 {
-#if defined(__CUDA_ARCH__)
+#if defined( __CUDA_ARCH__ )
    return ::cos( value );
 #else
    return std::cos( value );
@@ -274,9 +295,10 @@ auto cos( const T& value ) -> decltype( std::cos(value) )
  */
 template< typename T >
 __cuda_callable__
-auto tan( const T& value ) -> decltype( std::tan(value) )
+auto
+tan( const T& value ) -> decltype( std::tan( value ) )
 {
-#if defined(__CUDA_ARCH__)
+#if defined( __CUDA_ARCH__ )
    return ::tan( value );
 #else
    return std::tan( value );
@@ -288,9 +310,10 @@ auto tan( const T& value ) -> decltype( std::tan(value) )
  */
 template< typename T >
 __cuda_callable__
-auto asin( const T& value ) -> decltype( std::asin(value) )
+auto
+asin( const T& value ) -> decltype( std::asin( value ) )
 {
-#if defined(__CUDA_ARCH__)
+#if defined( __CUDA_ARCH__ )
    return ::asin( value );
 #else
    return std::asin( value );
@@ -302,9 +325,10 @@ auto asin( const T& value ) -> decltype( std::asin(value) )
  */
 template< typename T >
 __cuda_callable__
-auto acos( const T& value ) -> decltype( std::acos(value) )
+auto
+acos( const T& value ) -> decltype( std::acos( value ) )
 {
-#if defined(__CUDA_ARCH__)
+#if defined( __CUDA_ARCH__ )
    return ::acos( value );
 #else
    return std::acos( value );
@@ -316,9 +340,10 @@ auto acos( const T& value ) -> decltype( std::acos(value) )
  */
 template< typename T >
 __cuda_callable__
-auto atan( const T& value ) -> decltype( std::atan(value) )
+auto
+atan( const T& value ) -> decltype( std::atan( value ) )
 {
-#if defined(__CUDA_ARCH__)
+#if defined( __CUDA_ARCH__ )
    return ::atan( value );
 #else
    return std::atan( value );
@@ -330,9 +355,10 @@ auto atan( const T& value ) -> decltype( std::atan(value) )
  */
 template< typename T >
 __cuda_callable__
-auto sinh( const T& value ) -> decltype( std::sinh(value) )
+auto
+sinh( const T& value ) -> decltype( std::sinh( value ) )
 {
-#if defined(__CUDA_ARCH__)
+#if defined( __CUDA_ARCH__ )
    return ::sinh( value );
 #else
    return std::sinh( value );
@@ -344,9 +370,10 @@ auto sinh( const T& value ) -> decltype( std::sinh(value) )
  */
 template< typename T >
 __cuda_callable__
-auto cosh( const T& value ) -> decltype( std::cosh(value) )
+auto
+cosh( const T& value ) -> decltype( std::cosh( value ) )
 {
-#if defined(__CUDA_ARCH__)
+#if defined( __CUDA_ARCH__ )
    return ::cosh( value );
 #else
    return std::cosh( value );
@@ -358,9 +385,10 @@ auto cosh( const T& value ) -> decltype( std::cosh(value) )
  */
 template< typename T >
 __cuda_callable__
-auto tanh( const T& value ) -> decltype( std::tanh(value) )
+auto
+tanh( const T& value ) -> decltype( std::tanh( value ) )
 {
-#if defined(__CUDA_ARCH__)
+#if defined( __CUDA_ARCH__ )
    return ::tanh( value );
 #else
    return std::tanh( value );
@@ -372,9 +400,10 @@ auto tanh( const T& value ) -> decltype( std::tanh(value) )
  */
 template< typename T >
 __cuda_callable__
-auto asinh( const T& value ) -> decltype( std::asinh(value) )
+auto
+asinh( const T& value ) -> decltype( std::asinh( value ) )
 {
-#if defined(__CUDA_ARCH__)
+#if defined( __CUDA_ARCH__ )
    return ::asinh( value );
 #else
    return std::asinh( value );
@@ -386,9 +415,10 @@ auto asinh( const T& value ) -> decltype( std::asinh(value) )
  */
 template< typename T >
 __cuda_callable__
-auto acosh( const T& value ) -> decltype( std::acosh(value) )
+auto
+acosh( const T& value ) -> decltype( std::acosh( value ) )
 {
-#if defined(__CUDA_ARCH__)
+#if defined( __CUDA_ARCH__ )
    return ::acosh( value );
 #else
    return std::acosh( value );
@@ -400,9 +430,10 @@ auto acosh( const T& value ) -> decltype( std::acosh(value) )
  */
 template< typename T >
 __cuda_callable__
-auto atanh( const T& value ) -> decltype( std::atanh(value) )
+auto
+atanh( const T& value ) -> decltype( std::atanh( value ) )
 {
-#if defined(__CUDA_ARCH__)
+#if defined( __CUDA_ARCH__ )
    return ::atanh( value );
 #else
    return std::atanh( value );
@@ -414,9 +445,10 @@ auto atanh( const T& value ) -> decltype( std::atanh(value) )
  */
 template< typename T >
 __cuda_callable__
-auto floor( const T& value ) -> decltype( std::floor(value) )
+auto
+floor( const T& value ) -> decltype( std::floor( value ) )
 {
-#if defined(__CUDA_ARCH__)
+#if defined( __CUDA_ARCH__ )
    return ::floor( value );
 #else
    return std::floor( value );
@@ -428,9 +460,10 @@ auto floor( const T& value ) -> decltype( std::floor(value) )
  */
 template< typename T >
 __cuda_callable__
-auto ceil( const T& value ) -> decltype( std::ceil(value) )
+auto
+ceil( const T& value ) -> decltype( std::ceil( value ) )
 {
-#if defined(__CUDA_ARCH__)
+#if defined( __CUDA_ARCH__ )
    return ::ceil( value );
 #else
    return std::ceil( value );
@@ -444,7 +477,8 @@ auto ceil( const T& value ) -> decltype( std::ceil(value) )
  */
 template< typename Type >
 __cuda_callable__
-void swap( Type& a, Type& b )
+void
+swap( Type& a, Type& b )
 {
    Type tmp( a );
    a = b;
@@ -459,13 +493,16 @@ void swap( Type& a, Type& b )
  */
 template< class T,
           // enable_if is necessary to avoid ambiguity in vector expressions
-          std::enable_if_t< ! HasSubscriptOperator<T>::value, bool > = true >
+          std::enable_if_t< ! HasSubscriptOperator< T >::value, bool > = true >
 __cuda_callable__
-T sign( const T& a )
+T
+sign( const T& a )
 {
-   if( a < ( T ) 0 ) return ( T ) -1;
-   if( a == ( T ) 0 ) return ( T ) 0;
-   return ( T ) 1;
+   if( a < (T) 0 )
+      return (T) -1;
+   if( a == (T) 0 )
+      return (T) 0;
+   return (T) 1;
 }
 
 /**
@@ -478,8 +515,8 @@ T sign( const T& a )
  */
 template< typename Real >
 __cuda_callable__
-bool isSmall( const Real& v,
-              const Real& tolerance = 1.0e-5 )
+bool
+isSmall( const Real& v, const Real& tolerance = 1.0e-5 )
 {
    return ( -tolerance <= v && v <= tolerance );
 }
@@ -491,9 +528,10 @@ bool isSmall( const Real& v,
  * \param div An integer considered as divisor.
  */
 __cuda_callable__
-inline int roundUpDivision( const int num, const int div )
+inline int
+roundUpDivision( const int num, const int div )
 {
-   return num / div + ( num % div != 0 );
+   return num / div + static_cast< int >( num % div != 0 );
 }
 
 /**
@@ -503,9 +541,10 @@ inline int roundUpDivision( const int num, const int div )
  * \param multiple Integer.
  */
 __cuda_callable__
-inline int roundToMultiple( int number, int multiple )
+inline int
+roundToMultiple( int number, int multiple )
 {
-   return multiple*( number/ multiple + ( number % multiple != 0 ) );
+   return multiple * ( number / multiple + static_cast< int >( number % multiple != 0 ) );
 }
 
 /**
@@ -515,7 +554,8 @@ inline int roundToMultiple( int number, int multiple )
  * \param x Integer.
  */
 __cuda_callable__
-inline bool isPow2( int x )
+inline bool
+isPow2( int x )
 {
    return ( ( x & ( x - 1 ) ) == 0 );
 }
@@ -527,9 +567,10 @@ inline bool isPow2( int x )
  * \param x Long integer.
  */
 __cuda_callable__
-inline bool isPow2( long int x )
+inline bool
+isPow2( long int x )
 {
    return ( ( x & ( x - 1 ) ) == 0 );
 }
 
-} // namespace TNL
+}  // namespace TNL
diff --git a/src/TNL/Matrices/DenseMatrix.h b/src/TNL/Matrices/DenseMatrix.h
index e6ebec9e5faccf0f49faa719180bcc7fedd102f4..fdb287738777f9a42dbdf6f151d345f03392dd5e 100644
--- a/src/TNL/Matrices/DenseMatrix.h
+++ b/src/TNL/Matrices/DenseMatrix.h
@@ -33,1028 +33,1085 @@ template< typename Real = double,
           typename RealAllocator = typename Allocators::Default< Device >::template Allocator< Real > >
 class DenseMatrix : public Matrix< Real, Device, Index, RealAllocator >
 {
-   protected:
-      using BaseType = Matrix< Real, Device, Index, RealAllocator >;
-      using ValuesVectorType = typename BaseType::ValuesType;
-      using ValuesViewType = typename ValuesVectorType::ViewType;
-      using SegmentsType = Algorithms::Segments::Ellpack< Device, Index, typename Allocators::Default< Device >::template Allocator< Index >, Organization, 1 >;
-      using SegmentViewType = typename SegmentsType::SegmentViewType;
-
-   public:
-
-      /**
-       * \brief The type of matrix elements.
-       */
-      using RealType = Real;
-
-      /**
-       * \brief The device where the matrix is allocated.
-       */
-      using DeviceType = Device;
-
-      /**
-       * \brief The type used for matrix elements indexing.
-       */
-      using IndexType = Index;
-
-      /**
-       * \brief Matrix elements organization getter.
-       *
-       * \return matrix elements organization - RowMajorOrder of ColumnMajorOrder.
-       */
-      static constexpr ElementsOrganization getOrganization() { return Organization; };
-
-      /**
-       * \brief This is only for compatibility with sparse matrices.
-       *
-       * \return \e  \e false.
-       */
-      static constexpr bool isSymmetric() { return false; };
-
-      /**
-       * \brief The allocator for matrix elements.
-       */
-      using RealAllocatorType = RealAllocator;
-
-      /**
-       * \brief Type of related matrix view.
-       *
-       * See \ref DenseMatrixView.
-       */
-      using ViewType = DenseMatrixView< Real, Device, Index, Organization >;
-
-      /**
-       * \brief Matrix view type for constant instances.
-       *
-       * See \ref DenseMatrixView.
-       */
-      using ConstViewType = typename DenseMatrixView< Real, Device, Index, Organization >::ConstViewType;
-
-      /**
-       * \brief Type for accessing matrix rows.
-       */
-      using RowView = DenseMatrixRowView< SegmentViewType, ValuesViewType >;
-
-      /**
-       * \brief Type of vector holding values of matrix elements.
-       */
-      using typename Matrix< Real, Device, Index, RealAllocator >::ValuesType;
-
-      /**
-       * \brief Type of constant vector holding values of matrix elements.
-       */
-      using typename Matrix< Real, Device, Index, RealAllocator >::ConstValuesType;
-
-      /**
-       * \brief Type of vector view holding values of matrix elements.
-       */
-      using typename Matrix< Real, Device, Index, RealAllocator >::ValuesView;
-
-      /**
-       * \brief Type of constant vector view holding values of matrix elements.
-       */
-      using typename Matrix< Real, Device, Index, RealAllocator >::ConstValuesView;
-
-      /**
-       * \brief Helper type for getting self type or its modifications.
-       */
-      template< typename _Real = Real,
-                typename _Device = Device,
-                typename _Index = Index,
-                ElementsOrganization _Organization = Algorithms::Segments::DefaultElementsOrganization< _Device >::getOrganization(),
-                typename _RealAllocator = typename Allocators::Default< _Device >::template Allocator< _Real > >
-      using Self = DenseMatrix< _Real, _Device, _Index, _Organization, _RealAllocator >;
-
-      /**
-       * \brief Constructor only with values allocator.
-       *
-       * \param allocator is used for allocation of matrix elements values.
-       */
-      DenseMatrix( const RealAllocatorType& allocator = RealAllocatorType() );
-
-      /**
-       * \brief Copy constructor.
-       *
-       * \param matrix is the source matrix
-       */
-      DenseMatrix( const DenseMatrix& matrix ) = default;
-
-      /**
-       * \brief Move constructor.
-       *
-       * \param matrix is the source matrix
-       */
-      DenseMatrix( DenseMatrix&& matrix ) = default;
-
-      /**
-       * \brief Constructor with matrix dimensions.
-       *
-       * \param rows is number of matrix rows.
-       * \param columns is number of matrix columns.
-       * \param allocator is used for allocation of matrix elements values.
-       */
-      DenseMatrix( const IndexType rows, const IndexType columns,
-                   const RealAllocatorType& allocator = RealAllocatorType() );
-
-      /**
-       * \brief Constructor with 2D initializer list.
-       *
-       * The number of matrix rows is set to the outer list size and the number
-       * of matrix columns is set to maximum size of inner lists. Missing elements
-       * are filled in with zeros.
-       *
-       * \param data is a initializer list of initializer lists representing
-       * list of matrix rows.
-       * \param allocator is used for allocation of matrix elements values.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixExample_Constructor_init_list.cpp
-       * \par Output
-       * \include DenseMatrixExample_Constructor_init_list.out
-       */
-      template< typename Value >
-      DenseMatrix( std::initializer_list< std::initializer_list< Value > > data,
-                  const RealAllocatorType& allocator = RealAllocatorType() );
-
-      /**
-       * \brief Returns a modifiable view of the dense matrix.
-       *
-       * See \ref DenseMatrixView.
-       *
-       * \return dense matrix view.
-       */
-      ViewType getView();
-
-      /**
-       * \brief Returns a non-modifiable view of the dense matrix.
-       *
-       * See \ref DenseMatrixView.
-       *
-       * \return dense matrix view.
-       */
-      ConstViewType getConstView() const;
-
-      /**
-       * \brief Returns string with serialization type.
-       *
-       * The string has a form \e `Matrices::DenseMatrix< RealType,  [any_device], IndexType, [any_allocator], true/false >`.
-       *
-       * \return \e String with the serialization type.
-       */
-      static String getSerializationType();
-
-      /**
-       * \brief Returns string with serialization type.
-       *
-       * See \ref DenseMatrix::getSerializationType.
-       *
-       * \return \e String with the serialization type.
-       */
-      virtual String getSerializationTypeVirtual() const;
-
-      /**
-       * \brief Set number of rows and columns of this matrix.
-       *
-       * \param rows is the number of matrix rows.
-       * \param columns is the number of matrix columns.
-       */
-      void setDimensions( const IndexType rows,
-                          const IndexType columns );
-
-      /**
-       * \brief Set the number of matrix rows and columns by the given matrix.
-       *
-       * \tparam Matrix is matrix type. This can be any matrix having methods
-       *  \ref getRows and \ref getColumns.
-       *
-       * \param matrix in the input matrix dimensions of which are to be adopted.
-       */
-      template< typename Matrix >
-      void setLike( const Matrix& matrix );
-
-      /**
-       * \brief This method is only for the compatibility with the sparse matrices.
-       *
-       * This method does nothing. In debug mode it contains assertions checking
-       * that given rowCapacities are compatible with the current matrix dimensions.
-       */
-      template< typename RowCapacitiesVector >
-      void setRowCapacities( const RowCapacitiesVector& rowCapacities );
-
-      /**
-       * \brief Compute capacities of all rows.
-       *
-       * The row capacities are not stored explicitly and must be computed.
-       *
-       * \param rowCapacities is a vector where the row capacities will be stored.
-       */
-      template< typename Vector >
-      void getRowCapacities( Vector& rowCapacities ) const;
-
-      /**
-       * \brief This method recreates the dense matrix from 2D initializer list.
-       *
-       * The number of matrix rows is set to the outer list size and the number
-       * of matrix columns is set to maximum size of inner lists. Missing elements
-       * are filled in with zeros.
-       *
-       * \param data is a initializer list of initializer lists representing
-       * list of matrix rows.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixExample_setElements.cpp
-       * \par Output
-       * \include DenseMatrixExample_setElements.out
-       */
-      template< typename Value >
-      void setElements( std::initializer_list< std::initializer_list< Value > > data );
-
-      /**
-       * \brief Computes number of non-zeros in each row.
-       *
-       * \param rowLengths is a vector into which the number of non-zeros in each row
-       * will be stored.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixExample_getCompressedRowLengths.cpp
-       * \par Output
-       * \include DenseMatrixExample_getCompressedRowLengths.out
-       */
-      template< typename RowLengthsVector >
-      void getCompressedRowLengths( RowLengthsVector& rowLengths ) const;
-
-      /**
-       * \brief Returns number of non-zero matrix elements.
-       *
-       * \return number of all non-zero matrix elements.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixExample_getElementsCount.cpp
-       * \par Output
-       * \include DenseMatrixExample_getElementsCount.out
-       */
-      IndexType getNonzeroElementsCount() const;
-
-      /**
-       * \brief Resets the matrix to zero dimensions.
-       */
-      void reset();
-
-      /**
-       * \brief Constant getter of simple structure for accessing given matrix row.
-       *
-       * \param rowIdx is matrix row index.
-       *
-       * \return RowView for accessing given matrix row.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixExample_getConstRow.cpp
-       * \par Output
-       * \include DenseMatrixExample_getConstRow.out
-       *
-       * See \ref DenseMatrixRowView.
-       */
-      __cuda_callable__
-      const RowView getRow( const IndexType& rowIdx ) const;
-
-      /**
-       * \brief Non-constant getter of simple structure for accessing given matrix row.
-       *
-       * \param rowIdx is matrix row index.
-       *
-       * \return RowView for accessing given matrix row.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixExample_getRow.cpp
-       * \par Output
-       * \include DenseMatrixExample_getRow.out
-       *
-       * See \ref DenseMatrixRowView.
-       */
-      __cuda_callable__
-      RowView getRow( const IndexType& rowIdx );
-
-      /**
-       * \brief Sets all matrix elements to value \e v.
-       *
-       * \param v is value all matrix elements will be set to.
-       */
-      void setValue( const RealType& v );
-
-      /**
-       * \brief Returns non-constant reference to element at row \e row and column column.
-       *
-       * Since this method returns reference to the element, it cannot be called across
-       * different address spaces. It means that it can be called only form CPU if the matrix
-       * is allocated on CPU or only from GPU kernels if the matrix is allocated on GPU.
-       *
-       * \param row is a row index of the element.
-       * \param column is a columns index of the element.
-       * \return reference to given matrix element.
-       */
-      __cuda_callable__
-      Real& operator()( const IndexType row,
-                        const IndexType column );
-
-      /**
-       * \brief Returns constant reference to element at row \e row and column column.
-       *
-       * Since this method returns reference to the element, it cannot be called across
-       * different address spaces. It means that it can be called only form CPU if the matrix
-       * is allocated on CPU or only from GPU kernels if the matrix is allocated on GPU.
-       *
-       * \param row is a row index of the element.
-       * \param column is a columns index of the element.
-       * \return reference to given matrix element.
-       */
-      __cuda_callable__
-      const Real& operator()( const IndexType row,
-                              const IndexType column ) const;
-
-      /**
-       * \brief Sets element at given \e row and \e column to given \e value.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref DenseMatrix::getRow
-       * or \ref DenseMatrix::forElements and \ref DenseMatrix::forAllElements.
-       *
-       * \param row is row index of the element.
-       * \param column is columns index of the element.
-       * \param value is the value the element will be set to.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixExample_setElement.cpp
-       * \par Output
-       * \include DenseMatrixExample_setElement.out
-       */
-      __cuda_callable__
-      void setElement( const IndexType row,
-                       const IndexType column,
-                       const RealType& value );
-
-      /**
-       * \brief Add element at given \e row and \e column to given \e value.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref DenseMatrix::getRow
-       * or \ref DenseMatrix::forElements and \ref DenseMatrix::forAllElements.
-       *
-       * \param row is row index of the element.
-       * \param column is columns index of the element.
-       * \param value is the value the element will be set to.
-       * \param thisElementMultiplicator is multiplicator the original matrix element
-       *   value is multiplied by before addition of given \e value.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixExample_addElement.cpp
-       * \par Output
-       * \include DenseMatrixExample_addElement.out
-       *
-       */
-      __cuda_callable__
-      void addElement( const IndexType row,
-                       const IndexType column,
-                       const RealType& value,
-                       const RealType& thisElementMultiplicator = 1.0 );
-
-      /**
-       * \brief Returns value of matrix element at position given by its row and column index.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref DenseMatrix::getRow
-       * or \ref DenseMatrix::forElements and \ref DenseMatrix::forAllElements.
-       *
-       * \param row is a row index of the matrix element.
-       * \param column i a column index of the matrix element.
-       *
-       * \return value of given matrix element.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixExample_getElement.cpp
-       * \par Output
-       * \include DenseMatrixExample_getElement.out
-       *
-       */
-      __cuda_callable__
-      Real getElement( const IndexType row,
-                       const IndexType column ) const;
-
-      /**
-       * \brief Method for iteration over all matrix rows for constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements.
-       *    It is should have form like
-       *
-       * ```
-       * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value ) { ... };
-       * ```
-       *
-       *  The column index repeats twice only for compatibility with sparse matrices.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixExample_forRows.cpp
-       * \par Output
-       * \include DenseMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function&& function ) const;
-
-      /**
-       * \brief Method for iteration over all matrix rows for non-constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements.
-       *    It is should have form like
-       *
-       * ```
-       * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value ) { ... };
-       * ```
-       *
-       *  The column index repeats twice only for compatibility with sparse matrices.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixExample_forRows.cpp
-       * \par Output
-       * \include DenseMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function&& function );
-
-      /**
-       * \brief This method calls \e forElements for all matrix rows (for constant instances).
-       *
-       * See \ref DenseMatrix::forElements.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixExample_forAllRows.cpp
-       * \par Output
-       * \include DenseMatrixExample_forAllRows.out
-       */
-      template< typename Function >
-      void forAllElements( Function&& function ) const;
-
-      /**
-       * \brief This method calls \e forElements for all matrix rows.
-       *
-       * See \ref DenseMatrix::forAllElements.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixExample_forAllRows.cpp
-       * \par Output
-       * \include DenseMatrixExample_forAllRows.out
-       */
-      template< typename Function >
-      void forAllElements( Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end).
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref DenseMatrix::forElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrix::RowView.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixExample_forRows.cpp
-       * \par Output
-       * \include DenseMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forRows( IndexType begin, IndexType end, Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end) for constant instances.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref DenseMatrix::forElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrix::RowView.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixExample_forRows.cpp
-       * \par Output
-       * \include DenseMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forRows( IndexType begin, IndexType end, Function&& function ) const;
-
-      /**
-       * \brief Method for parallel iteration over all matrix rows.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref DenseMatrix::forAllElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrix::RowView.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixExample_forRows.cpp
-       * \par Output
-       * \include DenseMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forAllRows( Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over all matrix rows for constant instances.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref DenseMatrix::forAllElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrix::RowView.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixExample_forRows.cpp
-       * \par Output
-       * \include DenseMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forAllRows( Function&& function ) const;
-
-      /**
-       * \brief Method for sequential iteration over all matrix rows for constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements.
-       *    It is should have form like
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrix::RowView.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForRows( IndexType begin, IndexType end, Function&& function ) const;
-
-      /**
-       * \brief Method for sequential iteration over all matrix rows for non-constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements.
-       *    It is should have form like
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrix::RowView.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForRows( IndexType begin, IndexType end, Function&& function );
-
-      /**
-       * \brief This method calls \e sequentialForRows for all matrix rows (for constant instances).
-       *
-       * See \ref DenseMatrix::sequentialForRows.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForAllRows( Function&& function ) const;
-
-      /**
-       * \brief This method calls \e sequentialForRows for all matrix rows.
-       *
-       * See \ref DenseMatrix::sequentialForAllRows.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForAllRows( Function&& function );
-
-      /**
-       * \brief Method for performing general reduction on matrix rows.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, RealType elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       * The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row.
-       *  It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixExample_reduceRows.cpp
-       * \par Output
-       * \include DenseMatrixExample_reduceRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
-      void reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchValue& identity );
-
-      /**
-       * \brief Method for performing general reduction on matrix rows for constant instances.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, RealType elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       * The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row.
-       *          It is declared as
-       *
-       * ````
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixExample_reduceRows.cpp
-       * \par Output
-       * \include DenseMatrixExample_reduceRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
-      void reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchValue& identity ) const;
-
-      /**
-       * \brief Method for performing general reduction on ALL matrix rows.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, RealType elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       *      The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ````
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row.
-       *          It is declared as
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixExample_reduceAllRows.cpp
-       * \par Output
-       * \include DenseMatrixExample_reduceAllRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity );
-
-      /**
-       * \brief Method for performing general reduction on ALL matrix rows for constant instances.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, RealType elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       *          The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row.
-       *          It is declared as
-       *
-       *  ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixExample_reduceAllRows.cpp
-       * \par Output
-       * \include DenseMatrixExample_reduceAllRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const;
-
-      /**
-       * \brief Computes product of matrix and vector.
-       *
-       * More precisely, it computes:
-       *
-       * ```
-       * outVector = matrixMultiplicator * ( *this ) * inVector + outVectorMultiplicator * outVector
-       * ```
-       *
-       * \tparam InVector is type of input vector.  It can be \ref Vector,
-       *     \ref VectorView, \ref Array, \ref ArraView or similar container.
-       * \tparam OutVector is type of output vector. It can be \ref Vector,
-       *     \ref VectorView, \ref Array, \ref ArraView or similar container.
-       *
-       * \param inVector is input vector.
-       * \param outVector is output vector.
-       * \param matrixMultiplicator is a factor by which the matrix is multiplied. It is one by default.
-       * \param outVectorMultiplicator is a factor by which the outVector is multiplied before added
-       *    to the result of matrix-vector product. It is zero by default.
-       * \param begin is the beginning of the rows range for which the vector product
-       *    is computed. It is zero by default.
-       * \param end is the end of the rows range for which the vector product
-       *    is computed. It is number if the matrix rows by default.
-       *
-       * Note that the ouput vector dimension must be the same as the number of matrix rows
-       * no matter how we set `begin` and `end` parameters. These parameters just say that
-       * some matrix rows and the output vector elements are omitted.
-       */
-      template< typename InVector, typename OutVector >
-      void vectorProduct( const InVector& inVector,
-                          OutVector& outVector,
-                          const RealType& matrixMultiplicator = 1.0,
-                          const RealType& outVectorMultiplicator = 0.0,
-                          const IndexType begin = 0,
-                          const IndexType end = 0 ) const;
-
-      template< typename Matrix >
-      void addMatrix( const Matrix& matrix,
-                      const RealType& matrixMultiplicator = 1.0,
-                      const RealType& thisMatrixMultiplicator = 1.0 );
-
-      template< typename Matrix1, typename Matrix2, int tileDim = 32 >
-      void getMatrixProduct( const Matrix1& matrix1,
-                          const Matrix2& matrix2,
-                          const RealType& matrix1Multiplicator = 1.0,
-                          const RealType& matrix2Multiplicator = 1.0 );
-
-      template< typename Matrix, int tileDim = 32 >
-      void getTransposition( const Matrix& matrix,
-                             const RealType& matrixMultiplicator = 1.0 );
-
-      /**
-       * \brief Assignment operator with exactly the same type of the dense matrix.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return reference to this matrix.
-       */
-      DenseMatrix& operator=( const DenseMatrix& matrix );
-
-      /**
-       * \brief Assignment operator with the same organization.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return reference to this matrix.
-       */
-      template< typename RHSReal, typename RHSDevice, typename RHSIndex, typename RHSRealAllocator >
-      DenseMatrix& operator=( const DenseMatrix< RHSReal, RHSDevice, RHSIndex, Organization, RHSRealAllocator >& matrix );
-
-      /**
-       * \brief Assignment operator with matrix view having the same elements organization.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return reference to this matrix.
-       */
-      template< typename RHSReal, typename RHSDevice, typename RHSIndex >
-      DenseMatrix& operator=( const DenseMatrixView< RHSReal, RHSDevice, RHSIndex, Organization >& matrix );
-
-      /**
-       * \brief Assignment operator with other dense matrices.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return reference to this matrix.
-       */
-      template< typename RHSReal, typename RHSDevice, typename RHSIndex,
-                 ElementsOrganization RHSOrganization, typename RHSRealAllocator >
-      DenseMatrix& operator=( const DenseMatrix< RHSReal, RHSDevice, RHSIndex, RHSOrganization, RHSRealAllocator >& matrix );
-
-      /**
-       * \brief Assignment operator with other dense matrices.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return reference to this matrix.
-       */
-      template< typename RHSReal, typename RHSDevice, typename RHSIndex,
-                 ElementsOrganization RHSOrganization >
-      DenseMatrix& operator=( const DenseMatrixView< RHSReal, RHSDevice, RHSIndex, RHSOrganization >& matrix );
-
-      /**
-       * \brief Assignment operator with other (sparse) types of matrices.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return reference to this matrix.
-       */
-      template< typename RHSMatrix >
-      DenseMatrix& operator=( const RHSMatrix& matrix );
-
-      /**
-       * \brief Comparison operator with another dense matrix.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return \e true if the RHS matrix is equal, \e false otherwise.
-       */
-      template< typename Real_, typename Device_, typename Index_, typename RealAllocator_ >
-      bool operator==( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator_ >& matrix ) const;
-
-      /**
-       * \brief Comparison operator with another dense matrix.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return \e false if the RHS matrix is equal, \e true otherwise.
-       */
-      template< typename Real_, typename Device_, typename Index_, typename RealAllocator_ >
-      bool operator!=( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator_ >& matrix ) const;
-
-      /**
-       * \brief Comparison operator with another dense matrix view.
-       *
-       * \param matrix is the right-hand side matrix view.
-       * \return \e true if the RHS matrix view is equal, \e false otherwise.
-       */
-      template< typename Real_, typename Device_, typename Index_ >
-      bool operator==( const DenseMatrixView< Real_, Device_, Index_, Organization >& matrix ) const;
-
-      /**
-       * \brief Comparison operator with another dense matrix view.
-       *
-       * \param matrix is the right-hand side matrix view.
-       * \return \e false if the RHS matrix view is equal, \e true otherwise.
-       */
-      template< typename Real_, typename Device_, typename Index_ >
-      bool operator!=( const DenseMatrixView< Real_, Device_, Index_, Organization >& matrix ) const;
-
-      /**
-       * \brief Comparison operator with another arbitrary matrix type.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return \e true if the RHS matrix is equal, \e false otherwise.
-       */
-      template< typename Matrix >
-      bool operator==( const Matrix& m ) const;
-
-      /**
-       * \brief Comparison operator with another arbitrary matrix type.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return \e true if the RHS matrix is equal, \e false otherwise.
-       */
-      template< typename Matrix >
-      bool operator!=( const Matrix& m ) const;
-
-      /**
-       * \brief Method for saving the matrix to the file with given filename.
-       *
-       * \param fileName is name of the file.
-       */
-      void save( const String& fileName ) const;
-
-      /**
-       * \brief Method for loading the matrix from the file with given filename.
-       *
-       * \param fileName is name of the file.
-       */
-      void load( const String& fileName );
-
-      /**
-       * \brief Method for saving the matrix to a file.
-       *
-       * \param fileName is name of the file.
-       */
-      void save( File& file ) const;
-
-      /**
-       * \brief Method for loading the matrix from a file.
-       *
-       * \param fileName is name of the file.
-       */
-      void load( File& file );
-
-      /**
-       * \brief Method for printing the matrix to output stream.
-       *
-       * \param str is the output stream.
-       */
-      void print( std::ostream& str ) const;
-
-   protected:
-
-      __cuda_callable__
-      IndexType getElementIndex( const IndexType row,
-                                 const IndexType column ) const;
-
-      SegmentsType segments;
-
-      ViewType view;
+protected:
+   using BaseType = Matrix< Real, Device, Index, RealAllocator >;
+   using ValuesVectorType = typename BaseType::ValuesType;
+   using ValuesViewType = typename ValuesVectorType::ViewType;
+   using SegmentsType = Algorithms::Segments::
+      Ellpack< Device, Index, typename Allocators::Default< Device >::template Allocator< Index >, Organization, 1 >;
+   using SegmentViewType = typename SegmentsType::SegmentViewType;
+
+public:
+   /**
+    * \brief The type of matrix elements.
+    */
+   using RealType = Real;
+
+   /**
+    * \brief The device where the matrix is allocated.
+    */
+   using DeviceType = Device;
+
+   /**
+    * \brief The type used for matrix elements indexing.
+    */
+   using IndexType = Index;
+
+   /**
+    * \brief Matrix elements organization getter.
+    *
+    * \return matrix elements organization - RowMajorOrder of ColumnMajorOrder.
+    */
+   static constexpr ElementsOrganization
+   getOrganization()
+   {
+      return Organization;
+   };
+
+   /**
+    * \brief This is only for compatibility with sparse matrices.
+    *
+    * \return \e  \e false.
+    */
+   static constexpr bool
+   isSymmetric()
+   {
+      return false;
+   };
+
+   /**
+    * \brief The allocator for matrix elements.
+    */
+   using RealAllocatorType = RealAllocator;
+
+   /**
+    * \brief Type of related matrix view.
+    *
+    * See \ref DenseMatrixView.
+    */
+   using ViewType = DenseMatrixView< Real, Device, Index, Organization >;
+
+   /**
+    * \brief Matrix view type for constant instances.
+    *
+    * See \ref DenseMatrixView.
+    */
+   using ConstViewType = typename DenseMatrixView< Real, Device, Index, Organization >::ConstViewType;
+
+   /**
+    * \brief Type for accessing matrix rows.
+    */
+   using RowView = DenseMatrixRowView< SegmentViewType, ValuesViewType >;
+
+   /**
+    * \brief Type of vector holding values of matrix elements.
+    */
+   using typename Matrix< Real, Device, Index, RealAllocator >::ValuesType;
+
+   /**
+    * \brief Type of constant vector holding values of matrix elements.
+    */
+   using typename Matrix< Real, Device, Index, RealAllocator >::ConstValuesType;
+
+   /**
+    * \brief Type of vector view holding values of matrix elements.
+    */
+   using typename Matrix< Real, Device, Index, RealAllocator >::ValuesView;
+
+   /**
+    * \brief Type of constant vector view holding values of matrix elements.
+    */
+   using typename Matrix< Real, Device, Index, RealAllocator >::ConstValuesView;
+
+   /**
+    * \brief Helper type for getting self type or its modifications.
+    */
+   template< typename _Real = Real,
+             typename _Device = Device,
+             typename _Index = Index,
+             ElementsOrganization _Organization =
+                Algorithms::Segments::DefaultElementsOrganization< _Device >::getOrganization(),
+             typename _RealAllocator = typename Allocators::Default< _Device >::template Allocator< _Real > >
+   using Self = DenseMatrix< _Real, _Device, _Index, _Organization, _RealAllocator >;
+
+   /**
+    * \brief Constructor only with values allocator.
+    *
+    * \param allocator is used for allocation of matrix elements values.
+    */
+   DenseMatrix( const RealAllocatorType& allocator = RealAllocatorType() );
+
+   /**
+    * \brief Copy constructor.
+    *
+    * \param matrix is the source matrix
+    */
+   DenseMatrix( const DenseMatrix& matrix ) = default;
+
+   /**
+    * \brief Move constructor.
+    *
+    * \param matrix is the source matrix
+    */
+   DenseMatrix( DenseMatrix&& matrix ) noexcept = default;
+
+   /**
+    * \brief Constructor with matrix dimensions.
+    *
+    * \param rows is number of matrix rows.
+    * \param columns is number of matrix columns.
+    * \param allocator is used for allocation of matrix elements values.
+    */
+   DenseMatrix( IndexType rows, IndexType columns, const RealAllocatorType& allocator = RealAllocatorType() );
+
+   /**
+    * \brief Constructor with 2D initializer list.
+    *
+    * The number of matrix rows is set to the outer list size and the number
+    * of matrix columns is set to maximum size of inner lists. Missing elements
+    * are filled in with zeros.
+    *
+    * \param data is a initializer list of initializer lists representing
+    * list of matrix rows.
+    * \param allocator is used for allocation of matrix elements values.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixExample_Constructor_init_list.cpp
+    * \par Output
+    * \include DenseMatrixExample_Constructor_init_list.out
+    */
+   template< typename Value >
+   DenseMatrix( std::initializer_list< std::initializer_list< Value > > data,
+                const RealAllocatorType& allocator = RealAllocatorType() );
+
+   /**
+    * \brief Returns a modifiable view of the dense matrix.
+    *
+    * See \ref DenseMatrixView.
+    *
+    * \return dense matrix view.
+    */
+   ViewType
+   getView();
+
+   /**
+    * \brief Returns a non-modifiable view of the dense matrix.
+    *
+    * See \ref DenseMatrixView.
+    *
+    * \return dense matrix view.
+    */
+   ConstViewType
+   getConstView() const;
+
+   /**
+    * \brief Returns string with serialization type.
+    *
+    * The string has a form \e `Matrices::DenseMatrix< RealType,  [any_device], IndexType, [any_allocator], true/false >`.
+    *
+    * \return \e String with the serialization type.
+    */
+   static std::string
+   getSerializationType();
+
+   /**
+    * \brief Returns string with serialization type.
+    *
+    * See \ref DenseMatrix::getSerializationType.
+    *
+    * \return \e String with the serialization type.
+    */
+   std::string
+   getSerializationTypeVirtual() const override;
+
+   /**
+    * \brief Set number of rows and columns of this matrix.
+    *
+    * \param rows is the number of matrix rows.
+    * \param columns is the number of matrix columns.
+    */
+   void
+   setDimensions( IndexType rows, IndexType columns ) override;
+
+   /**
+    * \brief Set the number of matrix rows and columns by the given matrix.
+    *
+    * \tparam Matrix is matrix type. This can be any matrix having methods
+    *  \ref getRows and \ref getColumns.
+    *
+    * \param matrix in the input matrix dimensions of which are to be adopted.
+    */
+   template< typename Matrix >
+   void
+   setLike( const Matrix& matrix );
+
+   /**
+    * \brief This method is only for the compatibility with the sparse matrices.
+    *
+    * This method does nothing. In debug mode it contains assertions checking
+    * that given rowCapacities are compatible with the current matrix dimensions.
+    */
+   template< typename RowCapacitiesVector >
+   void
+   setRowCapacities( const RowCapacitiesVector& rowCapacities );
+
+   /**
+    * \brief Compute capacities of all rows.
+    *
+    * The row capacities are not stored explicitly and must be computed.
+    *
+    * \param rowCapacities is a vector where the row capacities will be stored.
+    */
+   template< typename Vector >
+   void
+   getRowCapacities( Vector& rowCapacities ) const;
+
+   /**
+    * \brief This method recreates the dense matrix from 2D initializer list.
+    *
+    * The number of matrix rows is set to the outer list size and the number
+    * of matrix columns is set to maximum size of inner lists. Missing elements
+    * are filled in with zeros.
+    *
+    * \param data is a initializer list of initializer lists representing
+    * list of matrix rows.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixExample_setElements.cpp
+    * \par Output
+    * \include DenseMatrixExample_setElements.out
+    */
+   template< typename Value >
+   void
+   setElements( std::initializer_list< std::initializer_list< Value > > data );
+
+   /**
+    * \brief Computes number of non-zeros in each row.
+    *
+    * \param rowLengths is a vector into which the number of non-zeros in each row
+    * will be stored.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixExample_getCompressedRowLengths.cpp
+    * \par Output
+    * \include DenseMatrixExample_getCompressedRowLengths.out
+    */
+   template< typename RowLengthsVector >
+   void
+   getCompressedRowLengths( RowLengthsVector& rowLengths ) const;
+
+   /**
+    * \brief Returns number of non-zero matrix elements.
+    *
+    * \return number of all non-zero matrix elements.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixExample_getElementsCount.cpp
+    * \par Output
+    * \include DenseMatrixExample_getElementsCount.out
+    */
+   IndexType
+   getNonzeroElementsCount() const override;
+
+   /**
+    * \brief Resets the matrix to zero dimensions.
+    */
+   void
+   reset();
+
+   /**
+    * \brief Constant getter of simple structure for accessing given matrix row.
+    *
+    * \param rowIdx is matrix row index.
+    *
+    * \return RowView for accessing given matrix row.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixExample_getConstRow.cpp
+    * \par Output
+    * \include DenseMatrixExample_getConstRow.out
+    *
+    * See \ref DenseMatrixRowView.
+    */
+   __cuda_callable__
+   const RowView
+   getRow( const IndexType& rowIdx ) const;
+
+   /**
+    * \brief Non-constant getter of simple structure for accessing given matrix row.
+    *
+    * \param rowIdx is matrix row index.
+    *
+    * \return RowView for accessing given matrix row.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixExample_getRow.cpp
+    * \par Output
+    * \include DenseMatrixExample_getRow.out
+    *
+    * See \ref DenseMatrixRowView.
+    */
+   __cuda_callable__
+   RowView
+   getRow( const IndexType& rowIdx );
+
+   /**
+    * \brief Sets all matrix elements to value \e v.
+    *
+    * \param v is value all matrix elements will be set to.
+    */
+   void
+   setValue( const RealType& v );
+
+   /**
+    * \brief Returns non-constant reference to element at row \e row and column column.
+    *
+    * Since this method returns reference to the element, it cannot be called across
+    * different address spaces. It means that it can be called only form CPU if the matrix
+    * is allocated on CPU or only from GPU kernels if the matrix is allocated on GPU.
+    *
+    * \param row is a row index of the element.
+    * \param column is a columns index of the element.
+    * \return reference to given matrix element.
+    */
+   __cuda_callable__
+   Real&
+   operator()( IndexType row, IndexType column );
+
+   /**
+    * \brief Returns constant reference to element at row \e row and column column.
+    *
+    * Since this method returns reference to the element, it cannot be called across
+    * different address spaces. It means that it can be called only form CPU if the matrix
+    * is allocated on CPU or only from GPU kernels if the matrix is allocated on GPU.
+    *
+    * \param row is a row index of the element.
+    * \param column is a columns index of the element.
+    * \return reference to given matrix element.
+    */
+   __cuda_callable__
+   const Real&
+   operator()( IndexType row, IndexType column ) const;
+
+   /**
+    * \brief Sets element at given \e row and \e column to given \e value.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref DenseMatrix::getRow
+    * or \ref DenseMatrix::forElements and \ref DenseMatrix::forAllElements.
+    *
+    * \param row is row index of the element.
+    * \param column is columns index of the element.
+    * \param value is the value the element will be set to.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixExample_setElement.cpp
+    * \par Output
+    * \include DenseMatrixExample_setElement.out
+    */
+   __cuda_callable__
+   void
+   setElement( IndexType row, IndexType column, const RealType& value );
+
+   /**
+    * \brief Add element at given \e row and \e column to given \e value.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref DenseMatrix::getRow
+    * or \ref DenseMatrix::forElements and \ref DenseMatrix::forAllElements.
+    *
+    * \param row is row index of the element.
+    * \param column is columns index of the element.
+    * \param value is the value the element will be set to.
+    * \param thisElementMultiplicator is multiplicator the original matrix element
+    *   value is multiplied by before addition of given \e value.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixExample_addElement.cpp
+    * \par Output
+    * \include DenseMatrixExample_addElement.out
+    *
+    */
+   __cuda_callable__
+   void
+   addElement( IndexType row, IndexType column, const RealType& value, const RealType& thisElementMultiplicator = 1.0 );
+
+   /**
+    * \brief Returns value of matrix element at position given by its row and column index.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref DenseMatrix::getRow
+    * or \ref DenseMatrix::forElements and \ref DenseMatrix::forAllElements.
+    *
+    * \param row is a row index of the matrix element.
+    * \param column i a column index of the matrix element.
+    *
+    * \return value of given matrix element.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixExample_getElement.cpp
+    * \par Output
+    * \include DenseMatrixExample_getElement.out
+    *
+    */
+   __cuda_callable__
+   Real
+   getElement( IndexType row, IndexType column ) const;
+
+   /**
+    * \brief Method for iteration over all matrix rows for constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements.
+    *    It is should have form like
+    *
+    * ```
+    * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value
+    * ) { ... };
+    * ```
+    *
+    *  The column index repeats twice only for compatibility with sparse matrices.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixExample_forRows.cpp
+    * \par Output
+    * \include DenseMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function&& function ) const;
+
+   /**
+    * \brief Method for iteration over all matrix rows for non-constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements.
+    *    It is should have form like
+    *
+    * ```
+    * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value ) {
+    * ... };
+    * ```
+    *
+    *  The column index repeats twice only for compatibility with sparse matrices.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixExample_forRows.cpp
+    * \par Output
+    * \include DenseMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function&& function );
+
+   /**
+    * \brief This method calls \e forElements for all matrix rows (for constant instances).
+    *
+    * See \ref DenseMatrix::forElements.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixExample_forAllRows.cpp
+    * \par Output
+    * \include DenseMatrixExample_forAllRows.out
+    */
+   template< typename Function >
+   void
+   forAllElements( Function&& function ) const;
+
+   /**
+    * \brief This method calls \e forElements for all matrix rows.
+    *
+    * See \ref DenseMatrix::forAllElements.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixExample_forAllRows.cpp
+    * \par Output
+    * \include DenseMatrixExample_forAllRows.out
+    */
+   template< typename Function >
+   void
+   forAllElements( Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end).
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref DenseMatrix::forElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrix::RowView.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixExample_forRows.cpp
+    * \par Output
+    * \include DenseMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forRows( IndexType begin, IndexType end, Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end) for constant instances.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref DenseMatrix::forElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrix::RowView.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixExample_forRows.cpp
+    * \par Output
+    * \include DenseMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forRows( IndexType begin, IndexType end, Function&& function ) const;
+
+   /**
+    * \brief Method for parallel iteration over all matrix rows.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref DenseMatrix::forAllElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrix::RowView.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixExample_forRows.cpp
+    * \par Output
+    * \include DenseMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forAllRows( Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over all matrix rows for constant instances.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref DenseMatrix::forAllElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrix::RowView.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixExample_forRows.cpp
+    * \par Output
+    * \include DenseMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forAllRows( Function&& function ) const;
+
+   /**
+    * \brief Method for sequential iteration over all matrix rows for constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements.
+    *    It is should have form like
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrix::RowView.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForRows( IndexType begin, IndexType end, Function&& function ) const;
+
+   /**
+    * \brief Method for sequential iteration over all matrix rows for non-constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements.
+    *    It is should have form like
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrix::RowView.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForRows( IndexType begin, IndexType end, Function&& function );
+
+   /**
+    * \brief This method calls \e sequentialForRows for all matrix rows (for constant instances).
+    *
+    * See \ref DenseMatrix::sequentialForRows.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForAllRows( Function&& function ) const;
+
+   /**
+    * \brief This method calls \e sequentialForRows for all matrix rows.
+    *
+    * See \ref DenseMatrix::sequentialForAllRows.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForAllRows( Function&& function );
+
+   /**
+    * \brief Method for performing general reduction on matrix rows.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, RealType elementValue ) -> FetchValue { ... };
+    * ```
+    *
+    * The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row.
+    *  It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixExample_reduceRows.cpp
+    * \par Output
+    * \include DenseMatrixExample_reduceRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
+   void
+   reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchValue& identity );
+
+   /**
+    * \brief Method for performing general reduction on matrix rows for constant instances.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, RealType elementValue ) -> FetchValue { ... };
+    * ```
+    *
+    * The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row.
+    *          It is declared as
+    *
+    * ````
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixExample_reduceRows.cpp
+    * \par Output
+    * \include DenseMatrixExample_reduceRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
+   void
+   reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchValue& identity )
+      const;
+
+   /**
+    * \brief Method for performing general reduction on ALL matrix rows.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, RealType elementValue ) -> FetchValue { ... };
+    * ```
+    *
+    *      The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ````
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row.
+    *          It is declared as
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixExample_reduceAllRows.cpp
+    * \par Output
+    * \include DenseMatrixExample_reduceAllRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity );
+
+   /**
+    * \brief Method for performing general reduction on ALL matrix rows for constant instances.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, RealType elementValue ) -> FetchValue { ... };
+    * ```
+    *
+    *          The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row.
+    *          It is declared as
+    *
+    *  ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixExample_reduceAllRows.cpp
+    * \par Output
+    * \include DenseMatrixExample_reduceAllRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const;
+
+   /**
+    * \brief Computes product of matrix and vector.
+    *
+    * More precisely, it computes:
+    *
+    * ```
+    * outVector = matrixMultiplicator * ( *this ) * inVector + outVectorMultiplicator * outVector
+    * ```
+    *
+    * \tparam InVector is type of input vector.  It can be \ref Vector,
+    *     \ref VectorView, \ref Array, \ref ArraView or similar container.
+    * \tparam OutVector is type of output vector. It can be \ref Vector,
+    *     \ref VectorView, \ref Array, \ref ArraView or similar container.
+    *
+    * \param inVector is input vector.
+    * \param outVector is output vector.
+    * \param matrixMultiplicator is a factor by which the matrix is multiplied. It is one by default.
+    * \param outVectorMultiplicator is a factor by which the outVector is multiplied before added
+    *    to the result of matrix-vector product. It is zero by default.
+    * \param begin is the beginning of the rows range for which the vector product
+    *    is computed. It is zero by default.
+    * \param end is the end of the rows range for which the vector product
+    *    is computed. It is number if the matrix rows by default.
+    *
+    * Note that the ouput vector dimension must be the same as the number of matrix rows
+    * no matter how we set `begin` and `end` parameters. These parameters just say that
+    * some matrix rows and the output vector elements are omitted.
+    */
+   template< typename InVector, typename OutVector >
+   void
+   vectorProduct( const InVector& inVector,
+                  OutVector& outVector,
+                  const RealType& matrixMultiplicator = 1.0,
+                  const RealType& outVectorMultiplicator = 0.0,
+                  IndexType begin = 0,
+                  IndexType end = 0 ) const;
+
+   template< typename Matrix >
+   void
+   addMatrix( const Matrix& matrix, const RealType& matrixMultiplicator = 1.0, const RealType& thisMatrixMultiplicator = 1.0 );
+
+   template< typename Matrix1, typename Matrix2, int tileDim = 32 >
+   void
+   getMatrixProduct( const Matrix1& matrix1,
+                     const Matrix2& matrix2,
+                     const RealType& matrix1Multiplicator = 1.0,
+                     const RealType& matrix2Multiplicator = 1.0 );
+
+   template< typename Matrix, int tileDim = 32 >
+   void
+   getTransposition( const Matrix& matrix, const RealType& matrixMultiplicator = 1.0 );
+
+   /**
+    * \brief Assignment operator with exactly the same type of the dense matrix.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return reference to this matrix.
+    */
+   DenseMatrix&
+   operator=( const DenseMatrix& matrix );
+
+   /**
+    * \brief Assignment operator with the same organization.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return reference to this matrix.
+    */
+   template< typename RHSReal, typename RHSDevice, typename RHSIndex, typename RHSRealAllocator >
+   DenseMatrix&
+   operator=( const DenseMatrix< RHSReal, RHSDevice, RHSIndex, Organization, RHSRealAllocator >& matrix );
+
+   /**
+    * \brief Assignment operator with matrix view having the same elements organization.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return reference to this matrix.
+    */
+   template< typename RHSReal, typename RHSDevice, typename RHSIndex >
+   DenseMatrix&
+   operator=( const DenseMatrixView< RHSReal, RHSDevice, RHSIndex, Organization >& matrix );
+
+   /**
+    * \brief Assignment operator with other dense matrices.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return reference to this matrix.
+    */
+   template< typename RHSReal,
+             typename RHSDevice,
+             typename RHSIndex,
+             ElementsOrganization RHSOrganization,
+             typename RHSRealAllocator >
+   DenseMatrix&
+   operator=( const DenseMatrix< RHSReal, RHSDevice, RHSIndex, RHSOrganization, RHSRealAllocator >& matrix );
+
+   /**
+    * \brief Assignment operator with other dense matrices.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return reference to this matrix.
+    */
+   template< typename RHSReal, typename RHSDevice, typename RHSIndex, ElementsOrganization RHSOrganization >
+   DenseMatrix&
+   operator=( const DenseMatrixView< RHSReal, RHSDevice, RHSIndex, RHSOrganization >& matrix );
+
+   /**
+    * \brief Assignment operator with other (sparse) types of matrices.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return reference to this matrix.
+    */
+   template< typename RHSMatrix >
+   DenseMatrix&
+   operator=( const RHSMatrix& matrix );
+
+   /**
+    * \brief Comparison operator with another dense matrix.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return \e true if the RHS matrix is equal, \e false otherwise.
+    */
+   template< typename Real_, typename Device_, typename Index_, typename RealAllocator_ >
+   bool
+   operator==( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator_ >& matrix ) const;
+
+   /**
+    * \brief Comparison operator with another dense matrix.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return \e false if the RHS matrix is equal, \e true otherwise.
+    */
+   template< typename Real_, typename Device_, typename Index_, typename RealAllocator_ >
+   bool
+   operator!=( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator_ >& matrix ) const;
+
+   /**
+    * \brief Comparison operator with another dense matrix view.
+    *
+    * \param matrix is the right-hand side matrix view.
+    * \return \e true if the RHS matrix view is equal, \e false otherwise.
+    */
+   template< typename Real_, typename Device_, typename Index_ >
+   bool
+   operator==( const DenseMatrixView< Real_, Device_, Index_, Organization >& matrix ) const;
+
+   /**
+    * \brief Comparison operator with another dense matrix view.
+    *
+    * \param matrix is the right-hand side matrix view.
+    * \return \e false if the RHS matrix view is equal, \e true otherwise.
+    */
+   template< typename Real_, typename Device_, typename Index_ >
+   bool
+   operator!=( const DenseMatrixView< Real_, Device_, Index_, Organization >& matrix ) const;
+
+   /**
+    * \brief Comparison operator with another arbitrary matrix type.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return \e true if the RHS matrix is equal, \e false otherwise.
+    */
+   template< typename Matrix >
+   bool
+   operator==( const Matrix& m ) const;
+
+   /**
+    * \brief Comparison operator with another arbitrary matrix type.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return \e true if the RHS matrix is equal, \e false otherwise.
+    */
+   template< typename Matrix >
+   bool
+   operator!=( const Matrix& m ) const;
+
+   /**
+    * \brief Method for saving the matrix to the file with given filename.
+    *
+    * \param fileName is name of the file.
+    */
+   void
+   save( const String& fileName ) const;
+
+   /**
+    * \brief Method for loading the matrix from the file with given filename.
+    *
+    * \param fileName is name of the file.
+    */
+   void
+   load( const String& fileName );
+
+   /**
+    * \brief Method for saving the matrix to a file.
+    *
+    * \param fileName is name of the file.
+    */
+   void
+   save( File& file ) const override;
+
+   /**
+    * \brief Method for loading the matrix from a file.
+    *
+    * \param fileName is name of the file.
+    */
+   void
+   load( File& file ) override;
+
+   /**
+    * \brief Method for printing the matrix to output stream.
+    *
+    * \param str is the output stream.
+    */
+   void
+   print( std::ostream& str ) const override;
+
+protected:
+   __cuda_callable__
+   IndexType
+   getElementIndex( IndexType row, IndexType column ) const;
+
+   SegmentsType segments;
+
+   ViewType view;
 };
 
 /**
@@ -1064,12 +1121,9 @@ class DenseMatrix : public Matrix< Real, Device, Index, RealAllocator >
  * \param matrix is the dense matrix.
  * \return  reference to the stream.
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-std::ostream& operator<< ( std::ostream& str, const DenseMatrix< Real, Device, Index, Organization, RealAllocator >& matrix );
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+std::ostream&
+operator<<( std::ostream& str, const DenseMatrix< Real, Device, Index, Organization, RealAllocator >& matrix );
 
 /**
  * \brief Comparison operator with another dense matrix view.
@@ -1078,11 +1132,17 @@ std::ostream& operator<< ( std::ostream& str, const DenseMatrix< Real, Device, I
  * \param rightMatrix is the right-hand side matrix.
  * \return \e true if the both matrices are is equal, \e false otherwise.
  */
-template< typename Real, typename Device, typename Index,
-          typename Real_, typename Device_, typename Index_,
-          ElementsOrganization Organization, typename RealAllocator >
-bool operator==( const DenseMatrixView< Real, Device, Index, Organization >& leftMatrix,
-                 const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator >& rightMatrix );
+template< typename Real,
+          typename Device,
+          typename Index,
+          typename Real_,
+          typename Device_,
+          typename Index_,
+          ElementsOrganization Organization,
+          typename RealAllocator >
+bool
+operator==( const DenseMatrixView< Real, Device, Index, Organization >& leftMatrix,
+            const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator >& rightMatrix );
 
 /**
  * \brief Comparison operator with another dense matrix view.
@@ -1091,14 +1151,19 @@ bool operator==( const DenseMatrixView< Real, Device, Index, Organization >& lef
  * \param rightMatrix is the right-hand side matrix.
  * \return \e false if the both matrices are is equal, \e true otherwise.
  */
-template< typename Real, typename Device, typename Index,
-          typename Real_, typename Device_, typename Index_,
-          ElementsOrganization Organization, typename RealAllocator >
-bool operator!=( const DenseMatrixView< Real, Device, Index, Organization >& leftMatrix,
-                 const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator >& rightMatrix );
-
+template< typename Real,
+          typename Device,
+          typename Index,
+          typename Real_,
+          typename Device_,
+          typename Index_,
+          ElementsOrganization Organization,
+          typename RealAllocator >
+bool
+operator!=( const DenseMatrixView< Real, Device, Index, Organization >& leftMatrix,
+            const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator >& rightMatrix );
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/DenseMatrix.hpp>
diff --git a/src/TNL/Matrices/DenseMatrix.hpp b/src/TNL/Matrices/DenseMatrix.hpp
index cabbe6f47868c0861617741dd1bdfd7c342f194a..cb305374cddb83234f61f44a4d6fdc13b99ffde5 100644
--- a/src/TNL/Matrices/DenseMatrix.hpp
+++ b/src/TNL/Matrices/DenseMatrix.hpp
@@ -13,65 +13,45 @@
 namespace TNL {
 namespace Matrices {
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-DenseMatrix( const RealAllocatorType& allocator )
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::DenseMatrix( const RealAllocatorType& allocator )
 : Matrix< Real, Device, Index, RealAllocator >( allocator )
-{
-}
+{}
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-DenseMatrix( const IndexType rows, const IndexType columns,
-             const RealAllocatorType& allocator )
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::DenseMatrix( const IndexType rows,
+                                                                              const IndexType columns,
+                                                                              const RealAllocatorType& allocator )
 : Matrix< Real, Device, Index, RealAllocator >( allocator )
 {
    this->setDimensions( rows, columns );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Value >
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-DenseMatrix( std::initializer_list< std::initializer_list< Value > > data,
-             const RealAllocatorType& allocator )
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Value >
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::DenseMatrix(
+   std::initializer_list< std::initializer_list< Value > > data,
+   const RealAllocatorType& allocator )
 : Matrix< Real, Device, Index, RealAllocator >( allocator )
 {
    this->setElements( data );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Value >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Value >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-setElements( std::initializer_list< std::initializer_list< Value > > data )
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::setElements(
+   std::initializer_list< std::initializer_list< Value > > data )
 {
    IndexType rows = data.size();
    IndexType columns = 0;
    for( auto row : data )
       columns = max( columns, row.size() );
    this->setDimensions( rows, columns );
-   if( ! std::is_same< DeviceType, Devices::Host >::value )
-   {
+   if( ! std::is_same< DeviceType, Devices::Host >::value ) {
       DenseMatrix< RealType, Devices::Host, IndexType > hostDense( rows, columns );
       IndexType rowIdx( 0 );
-      for( auto row : data )
-      {
+      for( auto row : data ) {
          IndexType columnIdx( 0 );
          for( auto element : row )
             hostDense.setElement( rowIdx, columnIdx++, element );
@@ -79,11 +59,9 @@ setElements( std::initializer_list< std::initializer_list< Value > > data )
       }
       *this = hostDense;
    }
-   else
-   {
+   else {
       IndexType rowIdx( 0 );
-      for( auto row : data )
-      {
+      for( auto row : data ) {
          IndexType columnIdx( 0 );
          for( auto element : row )
             this->setElement( rowIdx, columnIdx++, element );
@@ -92,69 +70,39 @@ setElements( std::initializer_list< std::initializer_list< Value > > data )
    }
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 auto
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-getView() -> ViewType
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::getView() -> ViewType
 {
    ValuesView values_view = this->getValues().getView();
    // note this is improtant here to avoid const qualifier to appear in - somehow :(
-   return ViewType( this->getRows(),
-                    this->getColumns(),
-                    values_view );
+   return ViewType( this->getRows(), this->getColumns(), values_view );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 auto
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-getConstView() const -> ConstViewType
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::getConstView() const -> ConstViewType
 {
-   return ConstViewType( this->getRows(),
-                         this->getColumns(),
-                         this->getValues().getConstView() );
+   return ConstViewType( this->getRows(), this->getColumns(), this->getValues().getConstView() );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-String
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-getSerializationType()
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+std::string
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::getSerializationType()
 {
    return ViewType::getSerializationType();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-String
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-getSerializationTypeVirtual() const
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+std::string
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::getSerializationTypeVirtual() const
 {
    return this->getSerializationType();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-setDimensions( const IndexType rows,
-               const IndexType columns )
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::setDimensions( const IndexType rows, const IndexType columns )
 {
    Matrix< Real, Device, Index, RealAllocator >::setDimensions( rows, columns );
    this->segments.setSegmentsSizes( rows, columns );
@@ -163,431 +111,301 @@ setDimensions( const IndexType rows,
    this->view = this->getView();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Matrix_ >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Matrix_ >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-setLike( const Matrix_& matrix )
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::setLike( const Matrix_& matrix )
 {
    this->setDimensions( matrix.getRows(), matrix.getColumns() );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename RowCapacitiesVector >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename RowCapacitiesVector >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-setRowCapacities( const RowCapacitiesVector& rowCapacities )
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::setRowCapacities( const RowCapacitiesVector& rowCapacities )
 {
    TNL_ASSERT_EQ( rowCapacities.getSize(), this->getRows(), "" );
    TNL_ASSERT_LE( max( rowCapacities ), this->getColumns(), "" );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Vector >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Vector >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-getRowCapacities( Vector& rowLengths ) const
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::getRowCapacities( Vector& rowLengths ) const
 {
    this->view.getCompressedRowLengths( rowLengths );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename RowLengthsVector >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename RowLengthsVector >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-getCompressedRowLengths( RowLengthsVector& rowLengths ) const
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::getCompressedRowLengths( RowLengthsVector& rowLengths ) const
 {
    this->view.getCompressedRowLengths( rowLengths );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 Index
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-getNonzeroElementsCount() const
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::getNonzeroElementsCount() const
 {
    return this->view.getNonzeroElementsCount();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-reset()
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::reset()
 {
    Matrix< Real, Device, Index >::reset();
    this->segments.reset();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-setValue( const Real& value )
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::setValue( const Real& value )
 {
    this->view.setValue( value );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-__cuda_callable__ auto
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-getRow( const IndexType& rowIdx ) const -> const RowView
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+__cuda_callable__
+auto
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::getRow( const IndexType& rowIdx ) const -> const RowView
 {
    return this->view.getRow( rowIdx );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-__cuda_callable__ auto
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-getRow( const IndexType& rowIdx ) -> RowView
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+__cuda_callable__
+auto
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::getRow( const IndexType& rowIdx ) -> RowView
 {
    return this->view.getRow( rowIdx );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 __cuda_callable__
-Real& DenseMatrix< Real, Device, Index, Organization, RealAllocator >::operator()( const IndexType row,
-                                                const IndexType column )
+Real&
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::operator()( const IndexType row, const IndexType column )
 {
    return this->view.operator()( row, column );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 __cuda_callable__
-const Real& DenseMatrix< Real, Device, Index, Organization, RealAllocator >::operator()( const IndexType row,
-                                                      const IndexType column ) const
+const Real&
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::operator()( const IndexType row, const IndexType column ) const
 {
    return this->view.operator()( row, column );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-__cuda_callable__ void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-setElement( const IndexType row,
-            const IndexType column,
-            const RealType& value )
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+__cuda_callable__
+void
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::setElement( const IndexType row,
+                                                                             const IndexType column,
+                                                                             const RealType& value )
 {
    this->view.setElement( row, column, value );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-__cuda_callable__ void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-addElement( const IndexType row,
-            const IndexType column,
-            const RealType& value,
-            const RealType& thisElementMultiplicator )
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+__cuda_callable__
+void
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::addElement( const IndexType row,
+                                                                             const IndexType column,
+                                                                             const RealType& value,
+                                                                             const RealType& thisElementMultiplicator )
 {
    this->view.addElement( row, column, value, thisElementMultiplicator );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-__cuda_callable__ Real
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-getElement( const IndexType row,
-            const IndexType column ) const
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+__cuda_callable__
+Real
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::getElement( const IndexType row, const IndexType column ) const
 {
    return this->view.getElement( row, column );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchValue& identity )
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::reduceRows( IndexType begin,
+                                                                             IndexType end,
+                                                                             Fetch& fetch,
+                                                                             const Reduce& reduce,
+                                                                             Keep& keep,
+                                                                             const FetchValue& identity )
 {
    this->view.reduceRows( begin, end, fetch, reduce, keep, identity );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchValue& identity ) const
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::reduceRows( IndexType begin,
+                                                                             IndexType end,
+                                                                             Fetch& fetch,
+                                                                             const Reduce& reduce,
+                                                                             Keep& keep,
+                                                                             const FetchValue& identity ) const
 {
    this->view.reduceRows( begin, end, fetch, reduce, keep, identity );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity )
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::reduceAllRows( Fetch& fetch,
+                                                                                const Reduce& reduce,
+                                                                                Keep& keep,
+                                                                                const FetchReal& identity )
 {
    this->reduceRows( (IndexType) 0, this->getRows(), fetch, reduce, keep, identity );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::reduceAllRows( Fetch& fetch,
+                                                                                const Reduce& reduce,
+                                                                                Keep& keep,
+                                                                                const FetchReal& identity ) const
 {
    this->reduceRows( (IndexType) 0, this->getRows(), fetch, reduce, keep, identity );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-forElements( IndexType begin, IndexType end, Function&& function ) const
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::forElements( IndexType begin,
+                                                                              IndexType end,
+                                                                              Function&& function ) const
 {
    this->view.forElements( begin, end, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-forElements( IndexType first, IndexType last, Function&& function )
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::forElements( IndexType first,
+                                                                              IndexType last,
+                                                                              Function&& function )
 {
    this->view.forElements( first, last, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-forAllElements( Function&& function ) const
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::forAllElements( Function&& function ) const
 {
    this->forElements( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-forAllElements( Function&& function )
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::forAllElements( Function&& function )
 {
    this->forElements( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-forRows( IndexType begin, IndexType end, Function&& function )
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::forRows( IndexType begin, IndexType end, Function&& function )
 {
    this->getView().forRows( begin, end, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-forRows( IndexType begin, IndexType end, Function&& function ) const
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::forRows( IndexType begin,
+                                                                          IndexType end,
+                                                                          Function&& function ) const
 {
    this->getConstView().forRows( begin, end, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-forAllRows( Function&& function )
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::forAllRows( Function&& function )
 {
    this->getView().forAllRows( function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-forAllRows( Function&& function ) const
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::forAllRows( Function&& function ) const
 {
    this->getConsView().forAllRows( function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-sequentialForRows( IndexType begin, IndexType end, Function&& function ) const
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::sequentialForRows( IndexType begin,
+                                                                                    IndexType end,
+                                                                                    Function&& function ) const
 {
    this->view.sequentialForRows( begin, end, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-sequentialForRows( IndexType first, IndexType last, Function&& function )
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::sequentialForRows( IndexType first,
+                                                                                    IndexType last,
+                                                                                    Function&& function )
 {
    this->view.sequentialForRows( first, last, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-sequentialForAllRows( Function&& function ) const
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::sequentialForAllRows( Function&& function ) const
 {
    this->sequentialForRows( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-sequentialForAllRows( Function&& function )
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::sequentialForAllRows( Function&& function )
 {
    this->sequentialForRows( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename InVector,
-             typename OutVector >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename InVector, typename OutVector >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-vectorProduct( const InVector& inVector,
-               OutVector& outVector,
-               const RealType& matrixMultiplicator,
-               const RealType& outVectorMultiplicator,
-               const IndexType begin,
-               const IndexType end ) const
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::vectorProduct( const InVector& inVector,
+                                                                                OutVector& outVector,
+                                                                                const RealType& matrixMultiplicator,
+                                                                                const RealType& outVectorMultiplicator,
+                                                                                const IndexType begin,
+                                                                                const IndexType end ) const
 {
    this->view.vectorProduct( inVector, outVector, matrixMultiplicator, outVectorMultiplicator, begin, end );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Matrix >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Matrix >
 void
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-addMatrix( const Matrix& matrix,
-           const RealType& matrixMultiplicator,
-           const RealType& thisMatrixMultiplicator )
-{
-   TNL_ASSERT( this->getColumns() == matrix.getColumns() &&
-              this->getRows() == matrix.getRows(),
-            std::cerr << "This matrix columns: " << this->getColumns() << std::endl
-                 << "This matrix rows: " << this->getRows() << std::endl
-                 << "That matrix columns: " << matrix.getColumns() << std::endl
-                 << "That matrix rows: " << matrix.getRows() << std::endl );
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::addMatrix( const Matrix& matrix,
+                                                                            const RealType& matrixMultiplicator,
+                                                                            const RealType& thisMatrixMultiplicator )
+{
+   TNL_ASSERT( this->getColumns() == matrix.getColumns() && this->getRows() == matrix.getRows(),
+               std::cerr << "This matrix columns: " << this->getColumns() << std::endl
+                         << "This matrix rows: " << this->getRows() << std::endl
+                         << "That matrix columns: " << matrix.getColumns() << std::endl
+                         << "That matrix rows: " << matrix.getRows() << std::endl );
 
    if( thisMatrixMultiplicator == 1.0 )
       this->values += matrixMultiplicator * matrix.values;
@@ -604,13 +422,15 @@ template< typename Real,
           typename Matrix2,
           int tileDim,
           int tileRowBlockSize >
-__global__ void DenseMatrixProductKernel( DenseMatrix< Real, Devices::Cuda, Index >* resultMatrix,
-                                                   const Matrix1* matrixA,
-                                                   const Matrix2* matrixB,
-                                                   const Real matrixAMultiplicator,
-                                                   const Real matrixBMultiplicator,
-                                                   const Index gridIdx_x,
-                                                   const Index gridIdx_y )
+__global__
+void
+DenseMatrixProductKernel( DenseMatrix< Real, Devices::Cuda, Index >* resultMatrix,
+                          const Matrix1* matrixA,
+                          const Matrix2* matrixB,
+                          const Real matrixAMultiplicator,
+                          const Real matrixBMultiplicator,
+                          const Index gridIdx_x,
+                          const Index gridIdx_y )
 {
    /****
     * Here we compute product C = A * B. To profit from the fast
@@ -619,9 +439,9 @@ __global__ void DenseMatrixProductKernel( DenseMatrix< Real, Devices::Cuda, Inde
 
    typedef Index IndexType;
    typedef Real RealType;
-   __shared__ Real tileA[ tileDim*tileDim ];
-   __shared__ Real tileB[ tileDim*tileDim ];
-   __shared__ Real tileC[ tileDim*tileDim ];
+   __shared__ Real tileA[ tileDim * tileDim ];
+   __shared__ Real tileB[ tileDim * tileDim ];
+   __shared__ Real tileC[ tileDim * tileDim ];
 
    const IndexType& matrixARows = matrixA->getRows();
    const IndexType& matrixAColumns = matrixA->getColumns();
@@ -632,31 +452,29 @@ __global__ void DenseMatrixProductKernel( DenseMatrix< Real, Devices::Cuda, Inde
     * Reset the tile C
     */
    for( IndexType row = 0; row < tileDim; row += tileRowBlockSize )
-      tileC[ ( row + threadIdx.y )*tileDim + threadIdx.x ] = 0.0;
+      tileC[ ( row + threadIdx.y ) * tileDim + threadIdx.x ] = 0.0;
 
    /****
     * Compute the result tile coordinates
     */
-   const IndexType resultTileRow = ( gridIdx_y*gridDim.y + blockIdx.y )*tileDim;
-   const IndexType resultTileColumn = ( gridIdx_x*gridDim.x + blockIdx.x )*tileDim;
+   const IndexType resultTileRow = ( gridIdx_y * gridDim.y + blockIdx.y ) * tileDim;
+   const IndexType resultTileColumn = ( gridIdx_x * gridDim.x + blockIdx.x ) * tileDim;
 
    /****
     * Sum over the matrix tiles
     */
-   for( IndexType i = 0; i < matrixAColumns; i += tileDim )
-   {
-      for( IndexType row = 0; row < tileDim; row += tileRowBlockSize )
-      {
+   for( IndexType i = 0; i < matrixAColumns; i += tileDim ) {
+      for( IndexType row = 0; row < tileDim; row += tileRowBlockSize ) {
          const IndexType matrixARow = resultTileRow + threadIdx.y + row;
          const IndexType matrixAColumn = i + threadIdx.x;
          if( matrixARow < matrixARows && matrixAColumn < matrixAColumns )
-            tileA[ (threadIdx.y + row)*tileDim + threadIdx.x ] =
-               matrixAMultiplicator * matrixA->getElementFast( matrixARow,  matrixAColumn );
+            tileA[ ( threadIdx.y + row ) * tileDim + threadIdx.x ] =
+               matrixAMultiplicator * matrixA->getElementFast( matrixARow, matrixAColumn );
 
          const IndexType matrixBRow = i + threadIdx.y + row;
          const IndexType matrixBColumn = resultTileColumn + threadIdx.x;
          if( matrixBRow < matrixBRows && matrixBColumn < matrixBColumns )
-            tileB[ (threadIdx.y + row)*tileDim + threadIdx.x ] =
+            tileB[ ( threadIdx.y + row ) * tileDim + threadIdx.x ] =
                matrixBMultiplicator * matrixB->getElementFast( matrixBRow, matrixBColumn );
       }
       __syncthreads();
@@ -664,16 +482,13 @@ __global__ void DenseMatrixProductKernel( DenseMatrix< Real, Devices::Cuda, Inde
       const IndexType tileALastRow = tnlCudaMin( tileDim, matrixARows - resultTileRow );
       const IndexType tileALastColumn = tnlCudaMin( tileDim, matrixAColumns - i );
       const IndexType tileBLastRow = tnlCudaMin( tileDim, matrixBRows - i );
-      const IndexType tileBLastColumn =
-         tnlCudaMin( tileDim, matrixBColumns - resultTileColumn );
+      const IndexType tileBLastColumn = tnlCudaMin( tileDim, matrixBColumns - resultTileColumn );
 
-      for( IndexType row = 0; row < tileALastRow; row += tileRowBlockSize )
-      {
+      for( IndexType row = 0; row < tileALastRow; row += tileRowBlockSize ) {
          RealType sum( 0.0 );
          for( IndexType j = 0; j < tileALastColumn; j++ )
-            sum += tileA[ ( threadIdx.y + row )*tileDim + j ]*
-                      tileB[ j*tileDim + threadIdx.x ];
-         tileC[ ( row + threadIdx.y )*tileDim + threadIdx.x ] += sum;
+            sum += tileA[ ( threadIdx.y + row ) * tileDim + j ] * tileB[ j * tileDim + threadIdx.x ];
+         tileC[ ( row + threadIdx.y ) * tileDim + threadIdx.x ] += sum;
       }
       __syncthreads();
    }
@@ -683,62 +498,51 @@ __global__ void DenseMatrixProductKernel( DenseMatrix< Real, Devices::Cuda, Inde
     */
    const IndexType& matrixCRows = resultMatrix->getRows();
    const IndexType& matrixCColumns = resultMatrix->getColumns();
-   for( IndexType row = 0; row < tileDim; row += tileRowBlockSize )
-   {
+   for( IndexType row = 0; row < tileDim; row += tileRowBlockSize ) {
       const IndexType matrixCRow = resultTileRow + row + threadIdx.y;
       const IndexType matrixCColumn = resultTileColumn + threadIdx.x;
       if( matrixCRow < matrixCRows && matrixCColumn < matrixCColumns )
-         resultMatrix->setElementFast( matrixCRow,
-                                       matrixCColumn,
-                                       tileC[ ( row + threadIdx.y )*tileDim + threadIdx.x ] );
+         resultMatrix->setElementFast( matrixCRow, matrixCColumn, tileC[ ( row + threadIdx.y ) * tileDim + threadIdx.x ] );
    }
-
 }
 #endif
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Matrix1, typename Matrix2, int tileDim >
-void DenseMatrix< Real, Device, Index, Organization, RealAllocator >::getMatrixProduct( const Matrix1& matrix1,
-                                                              const Matrix2& matrix2,
-                                                              const RealType& matrix1Multiplicator,
-                                                              const RealType& matrix2Multiplicator )
-{
-   TNL_ASSERT( matrix1.getColumns() == matrix2.getRows() &&
-              this->getRows() == matrix1.getRows() &&
-              this->getColumns() == matrix2.getColumns(),
-            std::cerr << "This matrix columns: " << this->getColumns() << std::endl
-                 << "This matrix rows: " << this->getRows() << std::endl
-                 << "Matrix1 columns: " << matrix1.getColumns() << std::endl
-                 << "Matrix1 rows: " << matrix1.getRows() << std::endl
-                 << "Matrix2 columns: " << matrix2.getColumns() << std::endl
-                 << "Matrix2 rows: " << matrix2.getRows() << std::endl );
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Matrix1, typename Matrix2, int tileDim >
+void
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::getMatrixProduct( const Matrix1& matrix1,
+                                                                                   const Matrix2& matrix2,
+                                                                                   const RealType& matrix1Multiplicator,
+                                                                                   const RealType& matrix2Multiplicator )
+{
+   TNL_ASSERT( matrix1.getColumns() == matrix2.getRows() && this->getRows() == matrix1.getRows()
+                  && this->getColumns() == matrix2.getColumns(),
+               std::cerr << "This matrix columns: " << this->getColumns() << std::endl
+                         << "This matrix rows: " << this->getRows() << std::endl
+                         << "Matrix1 columns: " << matrix1.getColumns() << std::endl
+                         << "Matrix1 rows: " << matrix1.getRows() << std::endl
+                         << "Matrix2 columns: " << matrix2.getColumns() << std::endl
+                         << "Matrix2 rows: " << matrix2.getRows() << std::endl );
 
    if( std::is_same< Device, Devices::Host >::value )
       for( IndexType i = 0; i < this->getRows(); i += tileDim )
-         for( IndexType j = 0; j < this->getColumns(); j += tileDim )
-         {
+         for( IndexType j = 0; j < this->getColumns(); j += tileDim ) {
             const IndexType tileRows = min( tileDim, this->getRows() - i );
             const IndexType tileColumns = min( tileDim, this->getColumns() - j );
             for( IndexType i1 = i; i1 < i + tileRows; i1++ )
                for( IndexType j1 = j; j1 < j + tileColumns; j1++ )
                   this->setElementFast( i1, j1, 0.0 );
 
-            for( IndexType k = 0; k < matrix1.getColumns(); k += tileDim )
-            {
+            for( IndexType k = 0; k < matrix1.getColumns(); k += tileDim ) {
                const IndexType lastK = min( k + tileDim, matrix1.getColumns() );
                for( IndexType i1 = 0; i1 < tileRows; i1++ )
                   for( IndexType j1 = 0; j1 < tileColumns; j1++ )
                      for( IndexType k1 = k; k1 < lastK; k1++ )
-                        this->addElementFast( i + i1, j + j1,
-                            matrix1.getElementFast( i + i1, k1 ) * matrix2.getElementFast( k1, j + j1 ) );
+                        this->addElementFast(
+                           i + i1, j + j1, matrix1.getElementFast( i + i1, k1 ) * matrix2.getElementFast( k1, j + j1 ) );
             }
          }
-   if( std::is_same< Device, Devices::Cuda >::value )
-   {
+   if( std::is_same< Device, Devices::Cuda >::value ) {
 #ifdef HAVE_CUDA
       dim3 cudaBlockSize( 0 ), cudaGridSize( 0 );
       const IndexType matrixProductCudaBlockSize( 256 );
@@ -752,8 +556,7 @@ void DenseMatrix< Real, Device, Index, Organization, RealAllocator >::getMatrixP
       const IndexType columnGrids = roundUpDivision( columnTiles, Cuda::getMaxGridSize() );
 
       for( IndexType gridIdx_x = 0; gridIdx_x < columnGrids; gridIdx_x++ )
-         for( IndexType gridIdx_y = 0; gridIdx_y < rowGrids; gridIdx_y++ )
-         {
+         for( IndexType gridIdx_y = 0; gridIdx_y < rowGrids; gridIdx_y++ ) {
             cudaGridSize.x = cudaGridSize.y = Cuda::getMaxGridSize();
             if( gridIdx_x == columnGrids - 1 )
                cudaGridSize.x = columnTiles % Cuda::getMaxGridSize();
@@ -762,22 +565,16 @@ void DenseMatrix< Real, Device, Index, Organization, RealAllocator >::getMatrixP
             DenseMatrix* this_kernel = Cuda::passToDevice( *this );
             Matrix1* matrix1_kernel = Cuda::passToDevice( matrix1 );
             Matrix2* matrix2_kernel = Cuda::passToDevice( matrix2 );
-            DenseMatrixProductKernel< Real,
-                                               Index,
-                                               Matrix1,
-                                               Matrix2,
-                                               tileDim,
-                                               cudaBlockRows >
-                                           <<< cudaGridSize,
-                                               cudaBlockSize,
-                                               3*tileDim*tileDim >>>
-                                             ( this_kernel,
-                                               matrix1_kernel,
-                                               matrix2_kernel,
-                                               matrix1Multiplicator,
-                                               matrix2Multiplicator,
-                                               gridIdx_x,
-                                               gridIdx_y );
+            DenseMatrixProductKernel< Real, Index, Matrix1, Matrix2, tileDim, cudaBlockRows > <<< cudaGridSize,
+               cudaBlockSize,
+               3
+                  * tileDim *tileDim >>>( this_kernel,
+                                                         matrix1_kernel,
+                                                         matrix2_kernel,
+                                                         matrix1Multiplicator,
+                                                         matrix2Multiplicator,
+                                                         gridIdx_x,
+                                                         gridIdx_y );
             Cuda::freeFromDevice( this_kernel );
             Cuda::freeFromDevice( matrix1_kernel );
             Cuda::freeFromDevice( matrix2_kernel );
@@ -794,30 +591,29 @@ template< typename Real,
           typename RealAllocator,
           int tileDim,
           int tileRowBlockSize >
-__global__ void DenseTranspositionAlignedKernel( DenseMatrix< Real, Devices::Cuda, Index >* resultMatrix,
-                                                          const Matrix* inputMatrix,
-                                                          const Real matrixMultiplicator,
-                                                          const Index gridIdx_x,
-                                                          const Index gridIdx_y )
+__global__
+void
+DenseTranspositionAlignedKernel( DenseMatrix< Real, Devices::Cuda, Index >* resultMatrix,
+                                 const Matrix* inputMatrix,
+                                 const Real matrixMultiplicator,
+                                 const Index gridIdx_x,
+                                 const Index gridIdx_y )
 {
-   __shared__ Real tile[ tileDim*tileDim ];
+   __shared__ Real tile[ tileDim * tileDim ];
 
    const Index columns = inputMatrix->getColumns();
    const Index rows = inputMatrix->getRows();
 
-
    /****
     * Diagonal mapping of the CUDA blocks
     */
    Index blockIdx_x, blockIdx_y;
-   if( columns == rows )
-   {
+   if( columns == rows ) {
       blockIdx_y = blockIdx.x;
-      blockIdx_x = (blockIdx.x+blockIdx.y)%gridDim.x;
+      blockIdx_x = ( blockIdx.x + blockIdx.y ) % gridDim.x;
    }
-   else
-   {
-      Index bID = blockIdx.x + gridDim.x*blockIdx.y;
+   else {
+      Index bID = blockIdx.x + gridDim.x * blockIdx.y;
       blockIdx_y = bID % gridDim.y;
       blockIdx_x = ( ( bID / gridDim.y ) + blockIdx_y ) % gridDim.x;
    }
@@ -825,37 +621,25 @@ __global__ void DenseTranspositionAlignedKernel( DenseMatrix< Real, Devices::Cud
    /****
     * Read the tile to the shared memory
     */
-   const Index readRowPosition =
-      ( gridIdx_y*gridDim.y + blockIdx_y )*tileDim + threadIdx.y;
-   const Index readColumnPosition =
-      ( gridIdx_x*gridDim.x + blockIdx_x )*tileDim + threadIdx.x;
-   for( Index rowBlock = 0;
-        rowBlock < tileDim;
-        rowBlock += tileRowBlockSize )
-   {
-      tile[ Cuda::getInterleaving( threadIdx.x*tileDim +  threadIdx.y + rowBlock ) ] =
-               inputMatrix->getElementFast( readColumnPosition,
-                                            readRowPosition + rowBlock );
+   const Index readRowPosition = ( gridIdx_y * gridDim.y + blockIdx_y ) * tileDim + threadIdx.y;
+   const Index readColumnPosition = ( gridIdx_x * gridDim.x + blockIdx_x ) * tileDim + threadIdx.x;
+   for( Index rowBlock = 0; rowBlock < tileDim; rowBlock += tileRowBlockSize ) {
+      tile[ Cuda::getInterleaving( threadIdx.x * tileDim + threadIdx.y + rowBlock ) ] =
+         inputMatrix->getElementFast( readColumnPosition, readRowPosition + rowBlock );
    }
    __syncthreads();
 
    /****
     * Write the tile to the global memory
     */
-   const Index writeRowPosition =
-      ( gridIdx_x*gridDim.x + blockIdx_x )*tileDim + threadIdx.y;
-   const Index writeColumnPosition =
-      ( gridIdx_y*gridDim.y + blockIdx_y )*tileDim + threadIdx.x;
-   for( Index rowBlock = 0;
-        rowBlock < tileDim;
-        rowBlock += tileRowBlockSize )
-   {
+   const Index writeRowPosition = ( gridIdx_x * gridDim.x + blockIdx_x ) * tileDim + threadIdx.y;
+   const Index writeColumnPosition = ( gridIdx_y * gridDim.y + blockIdx_y ) * tileDim + threadIdx.x;
+   for( Index rowBlock = 0; rowBlock < tileDim; rowBlock += tileRowBlockSize ) {
       resultMatrix->setElementFast( writeColumnPosition,
                                     writeRowPosition + rowBlock,
-                                    matrixMultiplicator * tile[ Cuda::getInterleaving( ( threadIdx.y + rowBlock ) * tileDim + threadIdx.x ) ] );
-
+                                    matrixMultiplicator
+                                       * tile[ Cuda::getInterleaving( ( threadIdx.y + rowBlock ) * tileDim + threadIdx.x ) ] );
    }
-
 }
 
 template< typename Real,
@@ -865,13 +649,15 @@ template< typename Real,
           typename Matrix,
           int tileDim,
           int tileRowBlockSize >
-__global__ void DenseTranspositionNonAlignedKernel( DenseMatrix< Real, Devices::Cuda, Index >* resultMatrix,
-                                                             const Matrix* inputMatrix,
-                                                             const Real matrixMultiplicator,
-                                                             const Index gridIdx_x,
-                                                             const Index gridIdx_y )
+__global__
+void
+DenseTranspositionNonAlignedKernel( DenseMatrix< Real, Devices::Cuda, Index >* resultMatrix,
+                                    const Matrix* inputMatrix,
+                                    const Real matrixMultiplicator,
+                                    const Index gridIdx_x,
+                                    const Index gridIdx_y )
 {
-   __shared__ Real tile[ tileDim*tileDim ];
+   __shared__ Real tile[ tileDim * tileDim ];
 
    const Index columns = inputMatrix->getColumns();
    const Index rows = inputMatrix->getRows();
@@ -880,14 +666,12 @@ __global__ void DenseTranspositionNonAlignedKernel( DenseMatrix< Real, Devices::
     * Diagonal mapping of the CUDA blocks
     */
    Index blockIdx_x, blockIdx_y;
-   if( columns == rows )
-   {
+   if( columns == rows ) {
       blockIdx_y = blockIdx.x;
-      blockIdx_x = (blockIdx.x+blockIdx.y)%gridDim.x;
+      blockIdx_x = ( blockIdx.x + blockIdx.y ) % gridDim.x;
    }
-   else
-   {
-      Index bID = blockIdx.x + gridDim.x*blockIdx.y;
+   else {
+      Index bID = blockIdx.x + gridDim.x * blockIdx.y;
       blockIdx_y = bID % gridDim.y;
       blockIdx_x = ( ( bID / gridDim.y ) + blockIdx_y ) % gridDim.x;
    }
@@ -895,21 +679,14 @@ __global__ void DenseTranspositionNonAlignedKernel( DenseMatrix< Real, Devices::
    /****
     * Read the tile to the shared memory
     */
-   const Index readRowPosition =
-      ( gridIdx_y*gridDim.y + blockIdx_y )*tileDim + threadIdx.y;
-   const Index readColumnPosition =
-      ( gridIdx_x*gridDim.x + blockIdx_x )*tileDim + threadIdx.x;
-   if( readColumnPosition < columns )
-   {
+   const Index readRowPosition = ( gridIdx_y * gridDim.y + blockIdx_y ) * tileDim + threadIdx.y;
+   const Index readColumnPosition = ( gridIdx_x * gridDim.x + blockIdx_x ) * tileDim + threadIdx.x;
+   if( readColumnPosition < columns ) {
       const Index readOffset = readRowPosition * columns + readColumnPosition;
-      for( Index rowBlock = 0;
-           rowBlock < tileDim;
-           rowBlock += tileRowBlockSize )
-      {
+      for( Index rowBlock = 0; rowBlock < tileDim; rowBlock += tileRowBlockSize ) {
          if( readRowPosition + rowBlock < rows )
-            tile[ Cuda::getInterleaving( threadIdx.x*tileDim +  threadIdx.y + rowBlock ) ] =
-               inputMatrix->getElementFast( readColumnPosition,
-                                            readRowPosition + rowBlock );
+            tile[ Cuda::getInterleaving( threadIdx.x * tileDim + threadIdx.y + rowBlock ) ] =
+               inputMatrix->getElementFast( readColumnPosition, readRowPosition + rowBlock );
       }
    }
    __syncthreads();
@@ -917,57 +694,44 @@ __global__ void DenseTranspositionNonAlignedKernel( DenseMatrix< Real, Devices::
    /****
     * Write the tile to the global memory
     */
-   const Index writeRowPosition =
-      ( gridIdx_x*gridDim.x + blockIdx_x )*tileDim + threadIdx.y;
-   const Index writeColumnPosition =
-      ( gridIdx_y*gridDim.y + blockIdx_y )*tileDim + threadIdx.x;
-   if( writeColumnPosition < rows )
-   {
+   const Index writeRowPosition = ( gridIdx_x * gridDim.x + blockIdx_x ) * tileDim + threadIdx.y;
+   const Index writeColumnPosition = ( gridIdx_y * gridDim.y + blockIdx_y ) * tileDim + threadIdx.x;
+   if( writeColumnPosition < rows ) {
       const Index writeOffset = writeRowPosition * rows + writeColumnPosition;
-      for( Index rowBlock = 0;
-           rowBlock < tileDim;
-           rowBlock += tileRowBlockSize )
-      {
+      for( Index rowBlock = 0; rowBlock < tileDim; rowBlock += tileRowBlockSize ) {
          if( writeRowPosition + rowBlock < columns )
-            resultMatrix->setElementFast( writeColumnPosition,
-                                          writeRowPosition + rowBlock,
-                                          matrixMultiplicator * tile[ Cuda::getInterleaving( ( threadIdx.y + rowBlock ) * tileDim + threadIdx.x ) ] );
+            resultMatrix->setElementFast(
+               writeColumnPosition,
+               writeRowPosition + rowBlock,
+               matrixMultiplicator * tile[ Cuda::getInterleaving( ( threadIdx.y + rowBlock ) * tileDim + threadIdx.x ) ] );
       }
    }
-
 }
 
-
 #endif
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Matrix, int tileDim >
-void DenseMatrix< Real, Device, Index, Organization, RealAllocator >::getTransposition( const Matrix& matrix,
-                                                              const RealType& matrixMultiplicator )
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Matrix, int tileDim >
+void
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::getTransposition( const Matrix& matrix,
+                                                                                   const RealType& matrixMultiplicator )
 {
-   TNL_ASSERT( this->getColumns() == matrix.getRows() &&
-              this->getRows() == matrix.getColumns(),
+   TNL_ASSERT( this->getColumns() == matrix.getRows() && this->getRows() == matrix.getColumns(),
                std::cerr << "This matrix columns: " << this->getColumns() << std::endl
-                    << "This matrix rows: " << this->getRows() << std::endl
-                    << "That matrix columns: " << matrix.getColumns() << std::endl
-                    << "That matrix rows: " << matrix.getRows() << std::endl );
+                         << "This matrix rows: " << this->getRows() << std::endl
+                         << "That matrix columns: " << matrix.getColumns() << std::endl
+                         << "That matrix rows: " << matrix.getRows() << std::endl );
 
-   if( std::is_same< Device, Devices::Host >::value )
-   {
+   if( std::is_same< Device, Devices::Host >::value ) {
       const IndexType& rows = matrix.getRows();
       const IndexType& columns = matrix.getColumns();
       for( IndexType i = 0; i < rows; i += tileDim )
          for( IndexType j = 0; j < columns; j += tileDim )
             for( IndexType k = i; k < i + tileDim && k < rows; k++ )
                for( IndexType l = j; l < j + tileDim && l < columns; l++ )
-                  this->setElement( l, k, matrixMultiplicator * matrix. getElement( k, l ) );
+                  this->setElement( l, k, matrixMultiplicator * matrix.getElement( k, l ) );
    }
-   if( std::is_same< Device, Devices::Cuda >::value )
-   {
+   if( std::is_same< Device, Devices::Cuda >::value ) {
 #ifdef HAVE_CUDA
       dim3 cudaBlockSize( 0 ), cudaGridSize( 0 );
       const IndexType matrixProductCudaBlockSize( 256 );
@@ -979,51 +743,29 @@ void DenseMatrix< Real, Device, Index, Organization, RealAllocator >::getTranspo
       cudaBlockSize.y = cudaBlockRows;
       const IndexType rowGrids = roundUpDivision( rowTiles, Cuda::getMaxGridSize() );
       const IndexType columnGrids = roundUpDivision( columnTiles, Cuda::getMaxGridSize() );
-      const IndexType sharedMemorySize = tileDim*tileDim + tileDim*tileDim/Cuda::getNumberOfSharedMemoryBanks();
+      const IndexType sharedMemorySize = tileDim * tileDim + tileDim * tileDim / Cuda::getNumberOfSharedMemoryBanks();
 
       DenseMatrix* this_device = Cuda::passToDevice( *this );
       Matrix* matrix_device = Cuda::passToDevice( matrix );
 
       for( IndexType gridIdx_x = 0; gridIdx_x < columnGrids; gridIdx_x++ )
-         for( IndexType gridIdx_y = 0; gridIdx_y < rowGrids; gridIdx_y++ )
-         {
+         for( IndexType gridIdx_y = 0; gridIdx_y < rowGrids; gridIdx_y++ ) {
             cudaGridSize.x = cudaGridSize.y = Cuda::getMaxGridSize();
-            if( gridIdx_x == columnGrids - 1)
+            if( gridIdx_x == columnGrids - 1 )
                cudaGridSize.x = columnTiles % Cuda::getMaxGridSize();
             if( gridIdx_y == rowGrids - 1 )
                cudaGridSize.y = rowTiles % Cuda::getMaxGridSize();
-            if( ( gridIdx_x < columnGrids - 1 || matrix.getColumns() % tileDim == 0 ) &&
-                ( gridIdx_y < rowGrids - 1 || matrix.getRows() % tileDim == 0 ) )
+            if( ( gridIdx_x < columnGrids - 1 || matrix.getColumns() % tileDim == 0 )
+                && ( gridIdx_y < rowGrids - 1 || matrix.getRows() % tileDim == 0 ) )
             {
-               DenseTranspositionAlignedKernel< Real,
-                                                         Index,
-                                                         Matrix,
-                                                         tileDim,
-                                                         cudaBlockRows >
-                                                     <<< cudaGridSize,
-                                                         cudaBlockSize,
-                                                         sharedMemorySize  >>>
-                                                       ( this_device,
-                                                         matrix_device,
-                                                         matrixMultiplicator,
-                                                         gridIdx_x,
-                                                         gridIdx_y );
+               DenseTranspositionAlignedKernel< Real, Index, Matrix, tileDim, cudaBlockRows > <<< cudaGridSize,
+                  cudaBlockSize,
+                  sharedMemorySize >>>( this_device, matrix_device, matrixMultiplicator, gridIdx_x, gridIdx_y );
             }
-            else
-            {
-               DenseTranspositionNonAlignedKernel< Real,
-                                                         Index,
-                                                         Matrix,
-                                                         tileDim,
-                                                         cudaBlockRows >
-                                                     <<< cudaGridSize,
-                                                         cudaBlockSize,
-                                                         sharedMemorySize  >>>
-                                                       ( this_device,
-                                                         matrix_device,
-                                                         matrixMultiplicator,
-                                                         gridIdx_x,
-                                                         gridIdx_y );
+            else {
+               DenseTranspositionNonAlignedKernel< Real, Index, Matrix, tileDim, cudaBlockRows > <<< cudaGridSize,
+                  cudaBlockSize,
+                  sharedMemorySize >>>( this_device, matrix_device, matrixMultiplicator, gridIdx_x, gridIdx_y );
             }
             TNL_CHECK_CUDA_DEVICE;
          }
@@ -1033,70 +775,52 @@ void DenseMatrix< Real, Device, Index, Organization, RealAllocator >::getTranspo
    }
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 DenseMatrix< Real, Device, Index, Organization, RealAllocator >&
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-operator=( const DenseMatrix< Real, Device, Index, Organization, RealAllocator >& matrix )
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::operator=(
+   const DenseMatrix< Real, Device, Index, Organization, RealAllocator >& matrix )
 {
    return this->operator=( matrix.getConstView() );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename RHSReal, typename RHSDevice, typename RHSIndex, typename RHSRealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename RHSReal, typename RHSDevice, typename RHSIndex, typename RHSRealAllocator >
 DenseMatrix< Real, Device, Index, Organization, RealAllocator >&
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-operator=( const DenseMatrix< RHSReal, RHSDevice, RHSIndex, Organization, RHSRealAllocator >& matrix )
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::operator=(
+   const DenseMatrix< RHSReal, RHSDevice, RHSIndex, Organization, RHSRealAllocator >& matrix )
 {
    return this->operator=( matrix.getConstView() );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename RHSReal, typename RHSDevice, typename RHSIndex >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename RHSReal, typename RHSDevice, typename RHSIndex >
 DenseMatrix< Real, Device, Index, Organization, RealAllocator >&
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-operator=( const DenseMatrixView< RHSReal, RHSDevice, RHSIndex, Organization >& matrix )
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::operator=(
+   const DenseMatrixView< RHSReal, RHSDevice, RHSIndex, Organization >& matrix )
 {
    this->setLike( matrix );
    this->values = matrix.getValues();
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename RHSReal, typename RHSDevice, typename RHSIndex,
-             ElementsOrganization RHSOrganization, typename RHSRealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename RHSReal,
+          typename RHSDevice,
+          typename RHSIndex,
+          ElementsOrganization RHSOrganization,
+          typename RHSRealAllocator >
 DenseMatrix< Real, Device, Index, Organization, RealAllocator >&
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-operator=( const DenseMatrix< RHSReal, RHSDevice, RHSIndex, RHSOrganization, RHSRealAllocator >& matrix )
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::operator=(
+   const DenseMatrix< RHSReal, RHSDevice, RHSIndex, RHSOrganization, RHSRealAllocator >& matrix )
 {
    return this->operator=( matrix.getConstView() );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename RHSReal, typename RHSDevice, typename RHSIndex,
-             ElementsOrganization RHSOrganization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename RHSReal, typename RHSDevice, typename RHSIndex, ElementsOrganization RHSOrganization >
 DenseMatrix< Real, Device, Index, Organization, RealAllocator >&
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-operator=( const DenseMatrixView< RHSReal, RHSDevice, RHSIndex, RHSOrganization >& matrix )
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::operator=(
+   const DenseMatrixView< RHSReal, RHSDevice, RHSIndex, RHSOrganization >& matrix )
 {
    using RHSMatrix = DenseMatrixView< RHSReal, RHSDevice, RHSIndex, RHSOrganization >;
    using RHSIndexType = typename RHSMatrix::IndexType;
@@ -1104,22 +828,21 @@ operator=( const DenseMatrixView< RHSReal, RHSDevice, RHSIndex, RHSOrganization
    using RHSDeviceType = typename RHSMatrix::DeviceType;
 
    this->setLike( matrix );
-   if( Organization == RHSOrganization )
-   {
+   if( Organization == RHSOrganization ) {
       this->values = matrix.getValues();
       return *this;
    }
 
    auto this_view = this->view;
-   if( std::is_same< DeviceType, RHSDeviceType >::value )
-   {
-      auto f = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIdx, const RHSRealType& value ) mutable {
+   if( std::is_same< DeviceType, RHSDeviceType >::value ) {
+      auto f = [ = ] __cuda_callable__(
+                  RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIdx, const RHSRealType& value ) mutable
+      {
          this_view( rowIdx, columnIdx ) = value;
       };
       matrix.forAllElements( f );
    }
-   else
-   {
+   else {
       const IndexType maxRowLength = matrix.getColumns();
       const IndexType bufferRowsCount( 128 );
       const size_t bufferSize = bufferRowsCount * maxRowLength;
@@ -1130,13 +853,14 @@ operator=( const DenseMatrixView< RHSReal, RHSDevice, RHSIndex, RHSOrganization
 
       IndexType baseRow( 0 );
       const IndexType rowsCount = this->getRows();
-      while( baseRow < rowsCount )
-      {
+      while( baseRow < rowsCount ) {
          const IndexType lastRow = min( baseRow + bufferRowsCount, rowsCount );
 
          ////
          // Copy matrix elements into buffer
-         auto f1 = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIdx, const RHSRealType& value ) mutable {
+         auto f1 = [ = ] __cuda_callable__(
+                      RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIdx, const RHSRealType& value ) mutable
+         {
             const IndexType bufferIdx = ( rowIdx - baseRow ) * maxRowLength + columnIdx;
             matrixValuesBuffer_view[ bufferIdx ] = value;
          };
@@ -1149,26 +873,23 @@ operator=( const DenseMatrixView< RHSReal, RHSDevice, RHSIndex, RHSOrganization
          ////
          // Copy matrix elements from the buffer to the matrix.
          auto this_view = this->view;
-         auto f2 = [=] __cuda_callable__ ( IndexType columnIdx, IndexType bufferRowIdx ) mutable {
+         auto f2 = [ = ] __cuda_callable__( IndexType columnIdx, IndexType bufferRowIdx ) mutable
+         {
             IndexType bufferIdx = bufferRowIdx * maxRowLength + columnIdx;
             this_view( baseRow + bufferRowIdx, columnIdx ) = thisValuesBuffer_view[ bufferIdx ];
          };
-         Algorithms::ParallelFor2D< DeviceType >::exec( (IndexType) 0, (IndexType) 0, maxRowLength, (IndexType) min( bufferRowsCount, this->getRows() - baseRow ), f2 );
+         Algorithms::ParallelFor2D< DeviceType >::exec(
+            (IndexType) 0, (IndexType) 0, maxRowLength, (IndexType) min( bufferRowsCount, this->getRows() - baseRow ), f2 );
          baseRow += bufferRowsCount;
       }
    }
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename RHSMatrix >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename RHSMatrix >
 DenseMatrix< Real, Device, Index, Organization, RealAllocator >&
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-operator=( const RHSMatrix& matrix )
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::operator=( const RHSMatrix& matrix )
 {
    using RHSIndexType = typename RHSMatrix::IndexType;
    using RHSRealType = typename RHSMatrix::RealType;
@@ -1185,17 +906,17 @@ operator=( const RHSMatrix& matrix )
    RHSIndexType padding_index = matrix.getPaddingIndex();
    this->values = 0.0;
 
-   if( std::is_same< DeviceType, RHSDeviceType >::value )
-   {
+   if( std::is_same< DeviceType, RHSDeviceType >::value ) {
       const auto segments_view = this->segments.getView();
-      auto f = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx_, RHSIndexType columnIdx, const RHSRealType& value ) mutable {
+      auto f = [ = ] __cuda_callable__(
+                  RHSIndexType rowIdx, RHSIndexType localIdx_, RHSIndexType columnIdx, const RHSRealType& value ) mutable
+      {
          if( value != 0.0 && columnIdx != padding_index )
             values_view[ segments_view.getGlobalIndex( rowIdx, columnIdx ) ] = value;
       };
       matrix.forAllElements( f );
    }
-   else
-   {
+   else {
       const IndexType maxRowLength = max( rowLengths );
       const IndexType bufferRowsCount( 128 );
       const size_t bufferSize = bufferRowsCount * maxRowLength;
@@ -1210,17 +931,17 @@ operator=( const RHSMatrix& matrix )
 
       IndexType baseRow( 0 );
       const IndexType rowsCount = this->getRows();
-      while( baseRow < rowsCount )
-      {
+      while( baseRow < rowsCount ) {
          const IndexType lastRow = min( baseRow + bufferRowsCount, rowsCount );
          thisColumnsBuffer = padding_index;
          matrixColumnsBuffer_view = padding_index;
 
          ////
          // Copy matrix elements into buffer
-         auto f1 = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIndex, const RHSRealType& value ) mutable {
-            if( columnIndex != padding_index )
-            {
+         auto f1 = [ = ] __cuda_callable__(
+                      RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIndex, const RHSRealType& value ) mutable
+         {
+            if( columnIndex != padding_index ) {
                const IndexType bufferIdx = ( rowIdx - baseRow ) * maxRowLength + localIdx;
                matrixColumnsBuffer_view[ bufferIdx ] = columnIndex;
                matrixValuesBuffer_view[ bufferIdx ] = value;
@@ -1236,13 +957,15 @@ operator=( const RHSMatrix& matrix )
          ////
          // Copy matrix elements from the buffer to the matrix
          auto this_view = this->view;
-         auto f2 = [=] __cuda_callable__ ( IndexType bufferColumnIdx, IndexType bufferRowIdx ) mutable {
+         auto f2 = [ = ] __cuda_callable__( IndexType bufferColumnIdx, IndexType bufferRowIdx ) mutable
+         {
             IndexType bufferIdx = bufferRowIdx * maxRowLength + bufferColumnIdx;
             IndexType columnIdx = thisColumnsBuffer_view[ bufferIdx ];
             if( columnIdx != padding_index )
                this_view( baseRow + bufferRowIdx, columnIdx ) = thisValuesBuffer_view[ bufferIdx ];
          };
-         Algorithms::ParallelFor2D< DeviceType >::exec( (IndexType) 0, (IndexType) 0, maxRowLength, (IndexType) min( bufferRowsCount, this->getRows() - baseRow ), f2 );
+         Algorithms::ParallelFor2D< DeviceType >::exec(
+            (IndexType) 0, (IndexType) 0, maxRowLength, (IndexType) min( bufferRowsCount, this->getRows() - baseRow ), f2 );
          baseRow += bufferRowsCount;
       }
    }
@@ -1250,181 +973,143 @@ operator=( const RHSMatrix& matrix )
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Real_, typename Device_, typename Index_, typename RealAllocator_ >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Real_, typename Device_, typename Index_, typename RealAllocator_ >
 bool
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-operator==( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator_ >& matrix ) const
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::operator==(
+   const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator_ >& matrix ) const
 {
-   return( this->getRows() == matrix.getRows() &&
-           this->getColumns() == matrix.getColumns() &&
-           this->getValues() == matrix.getValues() );
+   return ( this->getRows() == matrix.getRows() && this->getColumns() == matrix.getColumns()
+            && this->getValues() == matrix.getValues() );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Real_, typename Device_, typename Index_, typename RealAllocator_ >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Real_, typename Device_, typename Index_, typename RealAllocator_ >
 bool
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-operator!=( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator_ >& matrix ) const
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::operator!=(
+   const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator_ >& matrix ) const
 {
    return ! ( *this == matrix );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Real_, typename Device_, typename Index_ >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Real_, typename Device_, typename Index_ >
 bool
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-operator==( const DenseMatrixView< Real_, Device_, Index_, Organization >& matrix ) const
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::operator==(
+   const DenseMatrixView< Real_, Device_, Index_, Organization >& matrix ) const
 {
-   return( this->getRows() == matrix.getRows() &&
-           this->getColumns() == matrix.getColumns() &&
-           this->getValues() == matrix.getValues() );
+   return ( this->getRows() == matrix.getRows() && this->getColumns() == matrix.getColumns()
+            && this->getValues() == matrix.getValues() );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Real_, typename Device_, typename Index_ >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Real_, typename Device_, typename Index_ >
 bool
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-operator!=( const DenseMatrixView< Real_, Device_, Index_, Organization >& matrix ) const
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::operator!=(
+   const DenseMatrixView< Real_, Device_, Index_, Organization >& matrix ) const
 {
    return ! ( *this == matrix );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Matrix >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Matrix >
 bool
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-operator==( const Matrix& m ) const
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::operator==( const Matrix& m ) const
 {
    return ( this->view == m );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Matrix >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Matrix >
 bool
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-operator!=( const Matrix& m ) const
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::operator!=( const Matrix& m ) const
 {
    return ( this->view != m );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-void DenseMatrix< Real, Device, Index, Organization, RealAllocator >::save( const String& fileName ) const
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+void
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::save( const String& fileName ) const
 {
    this->view.save( fileName );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-void DenseMatrix< Real, Device, Index, Organization, RealAllocator >::load( const String& fileName )
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+void
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::load( const String& fileName )
 {
    Object::load( fileName );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-void DenseMatrix< Real, Device, Index, Organization, RealAllocator >::save( File& file ) const
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+void
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::save( File& file ) const
 {
    this->view.save( file );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-void DenseMatrix< Real, Device, Index, Organization, RealAllocator >::load( File& file )
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+void
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::load( File& file )
 {
    Matrix< Real, Device, Index, RealAllocator >::load( file );
    this->segments.load( file );
    this->view = this->getView();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-void DenseMatrix< Real, Device, Index, Organization, RealAllocator >::print( std::ostream& str ) const
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+void
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::print( std::ostream& str ) const
 {
    this->view.print( str );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 __cuda_callable__
 Index
-DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
-getElementIndex( const IndexType row, const IndexType column ) const
+DenseMatrix< Real, Device, Index, Organization, RealAllocator >::getElementIndex( const IndexType row,
+                                                                                  const IndexType column ) const
 {
    return this->segments.getGlobalIndex( row, column );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-std::ostream& operator<< ( std::ostream& str, const DenseMatrix< Real, Device, Index, Organization, RealAllocator >& matrix )
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+std::ostream&
+operator<<( std::ostream& str, const DenseMatrix< Real, Device, Index, Organization, RealAllocator >& matrix )
 {
    matrix.print( str );
    return str;
 }
 
-template< typename Real, typename Device, typename Index,
-          typename Real_, typename Device_, typename Index_,
-          ElementsOrganization Organization, typename RealAllocator >
-bool operator==( const DenseMatrixView< Real, Device, Index, Organization >& leftMatrix,
-                 const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator >& rightMatrix )
+template< typename Real,
+          typename Device,
+          typename Index,
+          typename Real_,
+          typename Device_,
+          typename Index_,
+          ElementsOrganization Organization,
+          typename RealAllocator >
+bool
+operator==( const DenseMatrixView< Real, Device, Index, Organization >& leftMatrix,
+            const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator >& rightMatrix )
 {
    return rightMatrix == leftMatrix;
 }
 
-template< typename Real, typename Device, typename Index,
-          typename Real_, typename Device_, typename Index_,
-          ElementsOrganization Organization, typename RealAllocator >
-bool operator!=( const DenseMatrixView< Real, Device, Index, Organization >& leftMatrix,
-                 const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator >& rightMatrix )
+template< typename Real,
+          typename Device,
+          typename Index,
+          typename Real_,
+          typename Device_,
+          typename Index_,
+          ElementsOrganization Organization,
+          typename RealAllocator >
+bool
+operator!=( const DenseMatrixView< Real, Device, Index, Organization >& leftMatrix,
+            const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator >& rightMatrix )
 {
    return rightMatrix != leftMatrix;
 }
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/DenseMatrixElement.h b/src/TNL/Matrices/DenseMatrixElement.h
index 87bbe0a679243e91df56ee5dd400cb79546e84c9..64e6d390ff020cd7b8b856cf9d582ac0743685f5 100644
--- a/src/TNL/Matrices/DenseMatrixElement.h
+++ b/src/TNL/Matrices/DenseMatrixElement.h
@@ -19,85 +19,102 @@ namespace Matrices {
  * \tparam Real is a type of matrix elements values.
  * \tparam Index is a type of matrix elements column indexes.
  */
-template< typename Real,
-          typename Index >
+template< typename Real, typename Index >
 class DenseMatrixElement
 {
-   public:
-
-      /**
-       * \brief Type of matrix elements values.
-       */
-      using RealType = Real;
-
-      /**
-       * \brief Type of matrix elements column indexes.
-       */
-      using IndexType = Index;
-
-      /**
-       * \brief Constructor.
-       *
-       * \param value is matrix element value.
-       * \param rowIdx is row index of the matrix element.
-       * \param columnIdx is a column index of the matrix element.
-       * \param localIdx is the column index of the matrix element as well.
-       */
-      __cuda_callable__
-      DenseMatrixElement( RealType& value,
-                          const IndexType& rowIdx,
-                          const IndexType& columnIdx,
-                          const IndexType& localIdx )  // localIdx is here only for compatibility with SparseMatrixElement
-      : value_( value ), rowIdx( rowIdx ), columnIdx( columnIdx ) {};
-
-      /**
-       * \brief Returns reference on matrix element value.
-       *
-       * \return reference on matrix element value.
-       */
-      __cuda_callable__
-      RealType& value() { return value_; };
-
-      /**
-       * \brief Returns constant reference on matrix element value.
-       *
-       * \return constant reference on matrix element value.
-       */
-      __cuda_callable__
-      const RealType& value() const { return value_; };
-
-      /**
-       * \brief Returns constant reference on matrix element row index.
-       *
-       * \return constant reference on matrix element row index.
-       */
-      __cuda_callable__
-      const IndexType& rowIndex() const { return rowIdx; };
-
-      /**
-       * \brief Returns constant reference on matrix element column index.
-       *
-       * \return constant reference on matrix element column index.
-       */
-      __cuda_callable__
-      const IndexType& columnIndex() const { return columnIdx; };
-
-      /**
-       * \brief Returns constant reference on matrix element column index.
-       *
-       * \return constant reference on matrix element column index.
-       */
-      __cuda_callable__
-      const IndexType& localIndex() const { return columnIdx; };
-
-   protected:
-
-      RealType& value_;
-
-      const IndexType& rowIdx;
-
-      const IndexType columnIdx;
+public:
+   /**
+    * \brief Type of matrix elements values.
+    */
+   using RealType = Real;
+
+   /**
+    * \brief Type of matrix elements column indexes.
+    */
+   using IndexType = Index;
+
+   /**
+    * \brief Constructor.
+    *
+    * \param value is matrix element value.
+    * \param rowIdx is row index of the matrix element.
+    * \param columnIdx is a column index of the matrix element.
+    * \param localIdx is the column index of the matrix element as well.
+    */
+   __cuda_callable__
+   DenseMatrixElement( RealType& value,
+                       const IndexType& rowIdx,
+                       const IndexType& columnIdx,
+                       const IndexType& localIdx )  // localIdx is here only for compatibility with SparseMatrixElement
+   : value_( value ), rowIdx( rowIdx ), columnIdx( columnIdx ){};
+
+   /**
+    * \brief Returns reference on matrix element value.
+    *
+    * \return reference on matrix element value.
+    */
+   __cuda_callable__
+   RealType&
+   value()
+   {
+      return value_;
+   };
+
+   /**
+    * \brief Returns constant reference on matrix element value.
+    *
+    * \return constant reference on matrix element value.
+    */
+   __cuda_callable__
+   const RealType&
+   value() const
+   {
+      return value_;
+   };
+
+   /**
+    * \brief Returns constant reference on matrix element row index.
+    *
+    * \return constant reference on matrix element row index.
+    */
+   __cuda_callable__
+   const IndexType&
+   rowIndex() const
+   {
+      return rowIdx;
+   };
+
+   /**
+    * \brief Returns constant reference on matrix element column index.
+    *
+    * \return constant reference on matrix element column index.
+    */
+   __cuda_callable__
+   const IndexType&
+   columnIndex() const
+   {
+      return columnIdx;
+   };
+
+   /**
+    * \brief Returns constant reference on matrix element column index.
+    *
+    * \return constant reference on matrix element column index.
+    */
+   __cuda_callable__
+   const IndexType&
+   localIndex() const
+   {
+      return columnIdx;
+   };
+
+protected:
+   RealType& value_;
+
+   const IndexType& rowIdx;
+
+   const IndexType columnIdx;
 };
 
-   } // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/DenseMatrixRowView.h b/src/TNL/Matrices/DenseMatrixRowView.h
index 90a1412df93a1c9c4dbe4c94f9a2aae1bad70bcd..15295e34a834ddacae19fcb203f10fe4ffe34f03 100644
--- a/src/TNL/Matrices/DenseMatrixRowView.h
+++ b/src/TNL/Matrices/DenseMatrixRowView.h
@@ -11,7 +11,7 @@
 #include <TNL/Matrices/DenseMatrixElement.h>
 
 namespace TNL {
-   namespace Matrices {
+namespace Matrices {
 
 /**
  * \brief RowView is a simple structure for accessing rows of dense matrix.
@@ -31,176 +31,180 @@ namespace TNL {
  * \par Output
  * \include DenseMatrixViewExample_getRow.out
  */
-template< typename SegmentView,
-          typename ValuesView >
+template< typename SegmentView, typename ValuesView >
 class DenseMatrixRowView
 {
-   public:
-
-      /**
-       * \brief The type of matrix elements.
-       */
-      using RealType = typename ValuesView::RealType;
-
-      /**
-       * \brief The type used for matrix elements indexing.
-       */
-      using IndexType = typename SegmentView::IndexType;
-
-      /**
-       * \brief Type representing matrix row format.
-       */
-      using SegmentViewType = SegmentView;
-
-      /**
-       * \brief Type of container view used for storing matrix elements values.
-       */
-      using ValuesViewType = ValuesView;
-
-      /**
-       * \brief Type of constant container view used for storing the matrix elements values.
-       */
-      using ConstValuesViewType = typename ValuesViewType::ConstViewType;
-
-      /**
-       * \brief Type of dense matrix row view.
-       */
-      using RowView = DenseMatrixRowView< SegmentView, ValuesViewType >;
-
-      /**
-       * \brief Type of constant sparse matrix row view.
-       */
-      using ConstView = DenseMatrixRowView< SegmentView, ConstValuesViewType >;
-
-      /**
-       * \brief The type of related matrix element.
-       */
-      using MatrixElementType = DenseMatrixElement< RealType, IndexType >;
-
-      /**
-       * \brief Type of iterator for the matrix row.
-       */
-      using IteratorType = MatrixRowViewIterator< RowView >;
-
-      /**
-       * \brief Constructor with \e segmentView and \e values
-       *
-       * \param segmentView instance of SegmentViewType representing matrix row.
-       * \param values is a container view for storing the matrix elements values.
-       */
-      __cuda_callable__
-      DenseMatrixRowView( const SegmentViewType& segmentView,
-                          const ValuesViewType& values );
-
-      /**
-       * \brief Returns size of the matrix row, i.e. number of matrix elements in this row.
-       *
-       * \return Size of the matrix row.
-       */
-      __cuda_callable__
-      IndexType getSize() const;
-
-      /**
-       * \brief Returns the matrix row index.
-       *
-       * \return matrix row index.
-       */
-      __cuda_callable__
-      const IndexType& getRowIndex() const;
-
-      /**
-       * \brief Returns constants reference to an element with given column index.
-       *
-       * \param column is column index of the matrix element.
-       *
-       * \return constant reference to the matrix element.
-       */
-      __cuda_callable__
-      const RealType& getValue( const IndexType column ) const;
-
-      /**
-       * \brief Returns non-constants reference to an element with given column index.
-       *
-       * \param column is a column index of the matrix element.
-       *
-       * \return non-constant reference to the matrix element.
-       */
-      __cuda_callable__
-      RealType& getValue( const IndexType column );
-
-      /**
-       * \brief This method is only for compatibility with sparse matrix row.
-       *
-       * \param localIdx is the rank of the matrix element in given row.
-       *
-       * \return the value of \ref localIdx as column index.
-       */
-      __cuda_callable__
-      IndexType getColumnIndex( const IndexType localIdx ) const;
-
-      /**
-       * \brief Sets value of matrix element with given column index
-       * .
-       * \param column is a column index of the matrix element.
-       * \param value is a value the matrix element will be set to.
-       */
-      __cuda_callable__
-      void setValue( const IndexType column,
-                     const RealType& value );
-
-      /**
-       * \brief Sets value of matrix element with given column index
-       *
-       * The \e localIdx parameter is here only for compatibility with
-       * the sparse matrices and it is omitted.
-       *
-       * \param column is a column index of the matrix element.
-       * \param value is a value the matrix element will be set to.
-       */
-      __cuda_callable__
-      void setElement( const IndexType localIdx,
-                       const IndexType column,
-                       const RealType& value );
-
-      /**
-       * \brief Returns iterator pointing at the beginning of the matrix row.
-       *
-       * \return iterator pointing at the beginning.
-       */
-      __cuda_callable__
-      IteratorType begin();
-
-      /**
-       * \brief Returns iterator pointing at the end of the matrix row.
-       *
-       * \return iterator pointing at the end.
-       */
-      __cuda_callable__
-      IteratorType end();
-
-      /**
-       * \brief Returns constant iterator pointing at the beginning of the matrix row.
-       *
-       * \return iterator pointing at the beginning.
-       */
-      __cuda_callable__
-      const IteratorType cbegin() const;
-
-      /**
-       * \brief Returns constant iterator pointing at the end of the matrix row.
-       *
-       * \return iterator pointing at the end.
-       */
-      __cuda_callable__
-      const IteratorType cend() const;
-
-   protected:
-
-      SegmentViewType segmentView;
-
-      ValuesViewType values;
+public:
+   /**
+    * \brief The type of matrix elements.
+    */
+   using RealType = typename ValuesView::RealType;
+
+   /**
+    * \brief The type used for matrix elements indexing.
+    */
+   using IndexType = typename SegmentView::IndexType;
+
+   /**
+    * \brief Type representing matrix row format.
+    */
+   using SegmentViewType = SegmentView;
+
+   /**
+    * \brief Type of container view used for storing matrix elements values.
+    */
+   using ValuesViewType = ValuesView;
+
+   /**
+    * \brief Type of constant container view used for storing the matrix elements values.
+    */
+   using ConstValuesViewType = typename ValuesViewType::ConstViewType;
+
+   /**
+    * \brief Type of dense matrix row view.
+    */
+   using RowView = DenseMatrixRowView< SegmentView, ValuesViewType >;
+
+   /**
+    * \brief Type of constant sparse matrix row view.
+    */
+   using ConstView = DenseMatrixRowView< SegmentView, ConstValuesViewType >;
+
+   /**
+    * \brief The type of related matrix element.
+    */
+   using MatrixElementType = DenseMatrixElement< RealType, IndexType >;
+
+   /**
+    * \brief Type of iterator for the matrix row.
+    */
+   using IteratorType = MatrixRowViewIterator< RowView >;
+
+   /**
+    * \brief Constructor with \e segmentView and \e values
+    *
+    * \param segmentView instance of SegmentViewType representing matrix row.
+    * \param values is a container view for storing the matrix elements values.
+    */
+   __cuda_callable__
+   DenseMatrixRowView( const SegmentViewType& segmentView, const ValuesViewType& values );
+
+   /**
+    * \brief Returns size of the matrix row, i.e. number of matrix elements in this row.
+    *
+    * \return Size of the matrix row.
+    */
+   __cuda_callable__
+   IndexType
+   getSize() const;
+
+   /**
+    * \brief Returns the matrix row index.
+    *
+    * \return matrix row index.
+    */
+   __cuda_callable__
+   const IndexType&
+   getRowIndex() const;
+
+   /**
+    * \brief Returns constants reference to an element with given column index.
+    *
+    * \param column is column index of the matrix element.
+    *
+    * \return constant reference to the matrix element.
+    */
+   __cuda_callable__
+   const RealType&
+   getValue( IndexType column ) const;
+
+   /**
+    * \brief Returns non-constants reference to an element with given column index.
+    *
+    * \param column is a column index of the matrix element.
+    *
+    * \return non-constant reference to the matrix element.
+    */
+   __cuda_callable__
+   RealType&
+   getValue( IndexType column );
+
+   /**
+    * \brief This method is only for compatibility with sparse matrix row.
+    *
+    * \param localIdx is the rank of the matrix element in given row.
+    *
+    * \return the value of \ref localIdx as column index.
+    */
+   __cuda_callable__
+   IndexType
+   getColumnIndex( IndexType localIdx ) const;
+
+   /**
+    * \brief Sets value of matrix element with given column index
+    * .
+    * \param column is a column index of the matrix element.
+    * \param value is a value the matrix element will be set to.
+    */
+   __cuda_callable__
+   void
+   setValue( IndexType column, const RealType& value );
+
+   /**
+    * \brief Sets value of matrix element with given column index
+    *
+    * The \e localIdx parameter is here only for compatibility with
+    * the sparse matrices and it is omitted.
+    *
+    * \param column is a column index of the matrix element.
+    * \param value is a value the matrix element will be set to.
+    */
+   __cuda_callable__
+   void
+   setElement( IndexType localIdx, IndexType column, const RealType& value );
+
+   /**
+    * \brief Returns iterator pointing at the beginning of the matrix row.
+    *
+    * \return iterator pointing at the beginning.
+    */
+   __cuda_callable__
+   IteratorType
+   begin();
+
+   /**
+    * \brief Returns iterator pointing at the end of the matrix row.
+    *
+    * \return iterator pointing at the end.
+    */
+   __cuda_callable__
+   IteratorType
+   end();
+
+   /**
+    * \brief Returns constant iterator pointing at the beginning of the matrix row.
+    *
+    * \return iterator pointing at the beginning.
+    */
+   __cuda_callable__
+   const IteratorType
+   cbegin() const;
+
+   /**
+    * \brief Returns constant iterator pointing at the end of the matrix row.
+    *
+    * \return iterator pointing at the end.
+    */
+   __cuda_callable__
+   const IteratorType
+   cend() const;
+
+protected:
+   SegmentViewType segmentView;
+
+   ValuesViewType values;
 };
-   } // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/DenseMatrixRowView.hpp>
diff --git a/src/TNL/Matrices/DenseMatrixRowView.hpp b/src/TNL/Matrices/DenseMatrixRowView.hpp
index b016f920a5f60ef70cbc65b25e9947394e547e29..65d20968bdd6003e8fed9834ba7ba9cc2ffb8141 100644
--- a/src/TNL/Matrices/DenseMatrixRowView.hpp
+++ b/src/TNL/Matrices/DenseMatrixRowView.hpp
@@ -9,127 +9,111 @@
 #include <TNL/Matrices/DenseMatrixRowView.h>
 
 namespace TNL {
-   namespace Matrices {
+namespace Matrices {
 
-template< typename SegmentView,
-          typename ValuesView >
+template< typename SegmentView, typename ValuesView >
 __cuda_callable__
-DenseMatrixRowView< SegmentView, ValuesView >::
-DenseMatrixRowView( const SegmentViewType& segmentView,
-                     const ValuesViewType& values )
- : segmentView( segmentView ), values( values )
-{
-}
+DenseMatrixRowView< SegmentView, ValuesView >::DenseMatrixRowView( const SegmentViewType& segmentView,
+                                                                   const ValuesViewType& values )
+: segmentView( segmentView ), values( values )
+{}
 
-template< typename SegmentView,
-          typename ValuesView >
-__cuda_callable__ auto
-DenseMatrixRowView< SegmentView, ValuesView >::
-getSize() const -> IndexType
+template< typename SegmentView, typename ValuesView >
+__cuda_callable__
+auto
+DenseMatrixRowView< SegmentView, ValuesView >::getSize() const -> IndexType
 {
    return segmentView.getSize();
 }
 
-template< typename SegmentView,
-          typename ValuesView >
-__cuda_callable__ auto
-DenseMatrixRowView< SegmentView, ValuesView >::
-getRowIndex() const -> const IndexType&
+template< typename SegmentView, typename ValuesView >
+__cuda_callable__
+auto
+DenseMatrixRowView< SegmentView, ValuesView >::getRowIndex() const -> const IndexType&
 {
    return segmentView.getSegmentIndex();
 }
 
-template< typename SegmentView,
-          typename ValuesView >
-__cuda_callable__ auto
-DenseMatrixRowView< SegmentView, ValuesView >::
-getValue( const IndexType column ) const -> const RealType&
+template< typename SegmentView, typename ValuesView >
+__cuda_callable__
+auto
+DenseMatrixRowView< SegmentView, ValuesView >::getValue( const IndexType column ) const -> const RealType&
 {
    TNL_ASSERT_LT( column, this->getSize(), "Column index exceeds matrix row size." );
    return values[ segmentView.getGlobalIndex( column ) ];
 }
 
-template< typename SegmentView,
-          typename ValuesView >
-__cuda_callable__ auto
-DenseMatrixRowView< SegmentView, ValuesView >::
-getValue( const IndexType column ) -> RealType&
+template< typename SegmentView, typename ValuesView >
+__cuda_callable__
+auto
+DenseMatrixRowView< SegmentView, ValuesView >::getValue( const IndexType column ) -> RealType&
 {
    TNL_ASSERT_LT( column, this->getSize(), "Column index exceeds matrix row size." );
    return values[ segmentView.getGlobalIndex( column ) ];
 }
 
-template< typename SegmentView,
-          typename ValuesView >
-__cuda_callable__ auto
-DenseMatrixRowView< SegmentView, ValuesView >::
-getColumnIndex( const IndexType localIdx ) const -> IndexType
+template< typename SegmentView, typename ValuesView >
+__cuda_callable__
+auto
+DenseMatrixRowView< SegmentView, ValuesView >::getColumnIndex( const IndexType localIdx ) const -> IndexType
 {
    TNL_ASSERT_LT( localIdx, this->getSize(), "Column index exceeds matrix row size." );
    return localIdx;
 }
 
-
-template< typename SegmentView,
-          typename ValuesView >
-__cuda_callable__ void
-DenseMatrixRowView< SegmentView, ValuesView >::
-setValue( const IndexType column,
-          const RealType& value )
+template< typename SegmentView, typename ValuesView >
+__cuda_callable__
+void
+DenseMatrixRowView< SegmentView, ValuesView >::setValue( const IndexType column, const RealType& value )
 {
    TNL_ASSERT_LT( column, this->getSize(), "Column index exceeds matrix row size." );
    const IndexType globalIdx = segmentView.getGlobalIndex( column );
    values[ globalIdx ] = value;
 }
 
-template< typename SegmentView,
-          typename ValuesView >
-__cuda_callable__ void
-DenseMatrixRowView< SegmentView, ValuesView >::
-setElement( const IndexType localIdx,
-            const IndexType column,
-            const RealType& value )
+template< typename SegmentView, typename ValuesView >
+__cuda_callable__
+void
+DenseMatrixRowView< SegmentView, ValuesView >::setElement( const IndexType localIdx,
+                                                           const IndexType column,
+                                                           const RealType& value )
 {
    TNL_ASSERT_LT( column, this->getSize(), "Column index exceeds matrix row size." );
    const IndexType globalIdx = segmentView.getGlobalIndex( column );
    values[ globalIdx ] = value;
 }
 
-template< typename SegmentView,
-          typename ValuesView >
-__cuda_callable__ auto
-DenseMatrixRowView< SegmentView, ValuesView >::
-begin() -> IteratorType
+template< typename SegmentView, typename ValuesView >
+__cuda_callable__
+auto
+DenseMatrixRowView< SegmentView, ValuesView >::begin() -> IteratorType
 {
    return IteratorType( *this, 0 );
 }
 
-template< typename SegmentView,
-          typename ValuesView >
-__cuda_callable__ auto
-DenseMatrixRowView< SegmentView, ValuesView >::
-end() -> IteratorType
+template< typename SegmentView, typename ValuesView >
+__cuda_callable__
+auto
+DenseMatrixRowView< SegmentView, ValuesView >::end() -> IteratorType
 {
    return IteratorType( *this, this->getSize() );
 }
 
-template< typename SegmentView,
-          typename ValuesView >
-__cuda_callable__ auto
-DenseMatrixRowView< SegmentView, ValuesView >::
-cbegin() const -> const IteratorType
+template< typename SegmentView, typename ValuesView >
+__cuda_callable__
+auto
+DenseMatrixRowView< SegmentView, ValuesView >::cbegin() const -> const IteratorType
 {
    return IteratorType( *this, 0 );
 }
 
-template< typename SegmentView,
-          typename ValuesView >
-__cuda_callable__ auto
-DenseMatrixRowView< SegmentView, ValuesView >::
-cend() const -> const IteratorType
+template< typename SegmentView, typename ValuesView >
+__cuda_callable__
+auto
+DenseMatrixRowView< SegmentView, ValuesView >::cend() const -> const IteratorType
 {
    return IteratorType( *this, this->getSize() );
 }
 
-   } // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/DenseMatrixView.h b/src/TNL/Matrices/DenseMatrixView.h
index 369b93e2fe36c776168608f768dd495f37dda54e..2f4e5d6e628a03fb5b958aa6914f1ef0190db632 100644
--- a/src/TNL/Matrices/DenseMatrixView.h
+++ b/src/TNL/Matrices/DenseMatrixView.h
@@ -37,900 +37,932 @@ template< typename Real = double,
           ElementsOrganization Organization = Algorithms::Segments::DefaultElementsOrganization< Device >::getOrganization() >
 class DenseMatrixView : public MatrixView< Real, Device, Index >
 {
-   protected:
-      using BaseType = Matrix< Real, Device, Index >;
-      using ValuesType = typename BaseType::ValuesType;
-      using SegmentsType = Algorithms::Segments::Ellpack< Device, Index, typename Allocators::Default< Device >::template Allocator< Index >, Organization, 1 >;
-      using SegmentsViewType = typename SegmentsType::ViewType;
-      using SegmentViewType = typename SegmentsType::SegmentViewType;
-
-   public:
-
-      /**
-       * \brief The type of matrix elements.
-       */
-      using RealType = Real;
-
-      /**
-       * \brief The device where the matrix is allocated.
-       */
-      using DeviceType = Device;
-
-      /**
-       * \brief The type used for matrix elements indexing.
-       */
-      using IndexType = Index;
-
-      /**
-       * \brief Matrix elements organization getter.
-       *
-       * \return matrix elements organization - RowMajorOrder of ColumnMajorOrder.
-       */
-      static constexpr ElementsOrganization getOrganization() { return Organization; };
-
-      /**
-       * \brief Matrix elements container view type.
-       *
-       * Use this for embedding of the matrix elements values.
-       */
-      using ValuesViewType = typename ValuesType::ViewType;
-
-      /**
-       * \brief Matrix elements container view type.
-       *
-       * Use this for embedding of the matrix elements values.
-       */
-      using ConstValuesViewType = typename ValuesType::ConstViewType;
-
-      /**
-       * \brief Matrix view type.
-       *
-       * See \ref DenseMatrixView.
-       */
-      using ViewType = DenseMatrixView< Real, Device, Index, Organization >;
-
-      /**
-       * \brief Matrix view type for constant instances.
-       *
-       * See \ref DenseMatrixView.
-       */
-      using ConstViewType = DenseMatrixView< std::add_const_t< Real >, Device, Index, Organization >;
-
-      /**
-       * \brief Type for accessing matrix row.
-       */
-      using RowView = DenseMatrixRowView< SegmentViewType, ValuesViewType >;
-
-      /**
-       * \brief Helper type for getting self type or its modifications.
-       */
-      template< typename _Real = Real,
-                typename _Device = Device,
-                typename _Index = Index >
-      using Self = DenseMatrixView< _Real, _Device, _Index >;
-
-      /**
-       * \brief Constructor without parameters.
-       */
-      __cuda_callable__
-      DenseMatrixView();
-
-      /**
-       * \brief Constructor with matrix dimensions and values.
-       *
-       * Organization of matrix elements values in
-       *
-       * \param rows number of matrix rows.
-       * \param columns number of matrix columns.
-       * \param values is vector view with matrix elements values.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixViewExample_constructor.cpp
-       * \par Output
-       * \include DenseMatrixViewExample_constructor.out
-       */
-      __cuda_callable__
-      DenseMatrixView( const IndexType rows,
-                       const IndexType columns,
-                       const ValuesViewType& values );
-
-      /**
-       * \brief Constructor with matrix dimensions and values.
-       *
-       * Organization of matrix elements values in
-       *
-       * \param rows number of matrix rows.
-       * \param columns number of matrix columns.
-       * \param values is vector view with matrix elements values.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixViewExample_constructor.cpp
-       * \par Output
-       * \include DenseMatrixViewExample_constructor.out
-       */
-       template< typename Real_ >
-      __cuda_callable__
-      DenseMatrixView( const IndexType rows,
-                       const IndexType columns,
-                       const Containers::VectorView< Real_, Device, Index >& values );
-
-
-      /**
-       * \brief Copy constructor.
-       *
-       * \param matrix is the source matrix view.
-       */
-      __cuda_callable__
-      DenseMatrixView( const DenseMatrixView& matrix ) = default;
-
-      /**
-       * \brief Returns a modifiable dense matrix view.
-       *
-       * \return dense matrix view.
-       */
-      __cuda_callable__
-      ViewType getView();
-
-      /**
-       * \brief Returns a non-modifiable dense matrix view.
-       *
-       * \return dense matrix view.
-       */
-      __cuda_callable__
-      ConstViewType getConstView() const;
-
-      /**
-       * \brief Returns string with serialization type.
-       *
-       * The string has a form \e `Matrices::DenseMatrix< RealType,  [any_device], IndexType, [any_allocator], true/false >`.
-       *
-       * \return \e String with the serialization type.
-       */
-      static String getSerializationType();
-
-      /**
-       * \brief Returns string with serialization type.
-       *
-       * See \ref DenseMatrixView::getSerializationType.
-       *
-       * \return \e String with the serialization type.
-       */
-      virtual String getSerializationTypeVirtual() const;
-
-      /**
-       * \brief Compute capacities of all rows.
-       *
-       * The row capacities are not stored explicitly and must be computed.
-       *
-       * \param rowCapacities is a vector where the row capacities will be stored.
-       */
-      template< typename Vector >
-      void getRowCapacities( Vector& rowCapacities ) const;
-
-      /**
-       * \brief Computes number of non-zeros in each row.
-       *
-       * \param rowLengths is a vector into which the number of non-zeros in each row
-       * will be stored.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixViewExample_getCompressedRowLengths.cpp
-       * \par Output
-       * \include DenseMatrixViewExample_getCompressedRowLengths.out
-       */
-      template< typename Vector >
-      void getCompressedRowLengths( Vector& rowLengths ) const;
-
-      /**
-       * \brief Returns number of all matrix elements.
-       *
-       * This method is here mainly for compatibility with sparse matrices since
-       * the number of all matrix elements is just number of rows times number of
-       * columns.
-       *
-       * \return number of all matrix elements.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixViewExample_getElementsCount.cpp
-       * \par Output
-       * \include DenseMatrixViewExample_getElementsCount.out
-       */
-      IndexType getAllocatedElementsCount() const;
-
-      /**
-       * \brief Returns number of non-zero matrix elements.
-       *
-       * \return number of all non-zero matrix elements.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixViewExample_getElementsCount.cpp
-       * \par Output
-       * \include DenseMatrixViewExample_getElementsCount.out
-       */
-      IndexType getNonzeroElementsCount() const;
-
-      /**
-       * \brief Constant getter of simple structure for accessing given matrix row.
-       *
-       * \param rowIdx is matrix row index.
-       *
-       * \return RowView for accessing given matrix row.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixViewExample_getConstRow.cpp
-       * \par Output
-       * \include DenseMatrixViewExample_getConstRow.out
-       *
-       * See \ref DenseMatrixRowView.
-       */
-      __cuda_callable__
-      const RowView getRow( const IndexType& rowIdx ) const;
-
-      /**
-       * \brief Non-constant getter of simple structure for accessing given matrix row.
-       *
-       * \param rowIdx is matrix row index.
-       *
-       * \return RowView for accessing given matrix row.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixViewExample_getRow.cpp
-       * \par Output
-       * \include DenseMatrixExample_getRow.out
-       *
-       * See \ref DenseMatrixRowView.
-       */
-      __cuda_callable__
-      RowView getRow( const IndexType& rowIdx );
-
-      /**
-       * \brief Sets all matrix elements to value \e v.
-       *
-       * \param v is value all matrix elements will be set to.
-       */
-      void setValue( const RealType& v );
-
-      /**
-       * \brief Returns non-constant reference to element at row \e row and column column.
-       *
-       * Since this method returns reference to the element, it cannot be called across
-       * different address spaces. It means that it can be called only form CPU if the matrix
-       * is allocated on CPU or only from GPU kernels if the matrix is allocated on GPU.
-       *
-       * \param row is a row index of the element.
-       * \param column is a columns index of the element.
-       * \return reference to given matrix element.
-       */
-      __cuda_callable__
-      Real& operator()( const IndexType row,
-                        const IndexType column );
-
-      /**
-       * \brief Returns constant reference to element at row \e row and column column.
-       *
-       * Since this method returns reference to the element, it cannot be called across
-       * different address spaces. It means that it can be called only form CPU if the matrix
-       * is allocated on CPU or only from GPU kernels if the matrix is allocated on GPU.
-       *
-       * \param row is a row index of the element.
-       * \param column is a columns index of the element.
-       * \return reference to given matrix element.
-       */
-      __cuda_callable__
-      const Real& operator()( const IndexType row,
-                              const IndexType column ) const;
-
-      /**
-       * \brief Sets element at given \e row and \e column to given \e value.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref DenseMatrix::getRow
-       * or \ref DenseMatrix::forElements and \ref DenseMatrix::forAllElements.
-       *
-       * \param row is row index of the element.
-       * \param column is columns index of the element.
-       * \param value is the value the element will be set to.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixViewExample_setElement.cpp
-       * \par Output
-       * \include DenseMatrixExample_setElement.out
-       */
-      __cuda_callable__
-      void setElement( const IndexType row,
-                       const IndexType column,
-                       const RealType& value );
-
-      /**
-       * \brief Add element at given \e row and \e column to given \e value.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref DenseMatrix::getRow
-       * or \ref DenseMatrix::forElements and \ref DenseMatrix::forAllElements.
-       *
-       * \param row is row index of the element.
-       * \param column is columns index of the element.
-       * \param value is the value the element will be set to.
-       * \param thisElementMultiplicator is multiplicator the original matrix element
-       *   value is multiplied by before addition of given \e value.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixViewExample_addElement.cpp
-       * \par Output
-       * \include DenseMatrixExample_addElement.out
-       *
-       */
-      __cuda_callable__
-      void addElement( const IndexType row,
-                       const IndexType column,
-                       const RealType& value,
-                       const RealType& thisElementMultiplicator = 1.0 );
-
-      /**
-       * \brief Returns value of matrix element at position given by its row and column index.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref DenseMatrix::getRow
-       * or \ref DenseMatrix::forElements and \ref DenseMatrix::forAllElements.
-       *
-       * \param row is a row index of the matrix element.
-       * \param column i a column index of the matrix element.
-       *
-       * \return value of given matrix element.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixViewExample_getElement.cpp
-       * \par Output
-       * \include DenseMatrixExample_getElement.out
-       *
-       */
-      __cuda_callable__
-      Real getElement( const IndexType row,
-                       const IndexType column ) const;
-
-      /**
-       * \brief Method for performing general reduction on matrix rows.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, RealType elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       *   The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row.
-       *          It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixViewExample_reduceRows.cpp
-       * \par Output
-       * \include DenseMatrixViewExample_reduceRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity );
-
-      /**
-       * \brief Method for performing general reduction on matrix rows for constant instances.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, RealType elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       *  The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row.
-       *          It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixViewExample_reduceRows.cpp
-       * \par Output
-       * \include DenseMatrixViewExample_reduceRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const;
-
-      /**
-       * \brief Method for performing general reduction on ALL matrix rows.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, RealType elementValue ) -> FetchValue
-       * ```
-       *
-       * The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row.
-       *   It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixViewExample_reduceAllRows.cpp
-       * \par Output
-       * \include DenseMatrixViewExample_reduceAllRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity );
-
-      /**
-       * \brief Method for performing general reduction on ALL matrix rows for constant instances.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, RealType elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       *  The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row.
-       *  It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixViewExample_reduceAllRows.cpp
-       * \par Output
-       * \include DenseMatrixViewExample_reduceAllRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const;
-
-      /**
-       * \brief Method for iteration over all matrix rows for constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements.
-       *    It is should have form like
-       *
-       * ```
-       * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx, const RealType& value ) { ... };
-       * ```
-       *
-       *  The column index repeats twice only for compatibility with sparse matrices.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include DenseMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function&& function ) const;
-
-      /**
-       * \brief Method for iteration over all matrix rows for non-constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements.
-       *    It is should have form like
-       *
-       * ```
-       * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx, RealType& value ) { ... };
-       * ```
-       *
-       *  The column index repeats twice only for compatibility with sparse matrices.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include DenseMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function&& function );
-
-      /**
-       * \brief This method calls \e forElements for all matrix rows.
-       *
-       * See \ref DenseMatrix::forElements.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixViewExample_forAllRows.cpp
-       * \par Output
-       * \include DenseMatrixViewExample_forAllRows.out
-       */
-      template< typename Function >
-      void forAllElements( Function&& function ) const;
-
-      /**
-       * \brief This method calls \e forElements for all matrix rows.
-       *
-       * See \ref DenseMatrix::forAllElements.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixExample_forAllRows.cpp
-       * \par Output
-       * \include DenseMatrixExample_forAllRows.out
-       */
-      template< typename Function >
-      void forAllElements( Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end).
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref DenseMatrix::forElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrix::RowView.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixExample_forRows.cpp
-       * \par Output
-       * \include DenseMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forRows( IndexType begin, IndexType end, Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end) for constant instances.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref DenseMatrixView::forElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrixView::RowView.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include DenseMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forRows( IndexType begin, IndexType end, Function&& function ) const;
-
-      /**
-       * \brief Method for parallel iteration over all matrix rows.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref DenseMatrixView::forAllElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrixView::RowView.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include DenseMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forAllRows( Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over all matrix rows for constant instances.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref DenseMatrixView::forAllElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrixView::RowView.
-       *
-       * \par Example
-       * \include Matrices/DenseMatrix/DenseMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include DenseMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forAllRows( Function&& function ) const;
-
-      /**
-       * \brief Method for sequential iteration over all matrix rows for constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements.
-       *    It is should have form like
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrixView::RowView.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForRows( IndexType begin, IndexType end, Function&& function ) const;
-
-      /**
-       * \brief Method for sequential iteration over all matrix rows for non-constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements.
-       *    It is should have form like
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrixView::RowView.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForRows( IndexType begin, IndexType end, Function&& function );
-
-      /**
-       * \brief This method calls \e sequentialForRows for all matrix rows (for constant instances).
-       *
-       * See \ref DenseMatrixView::sequentialForRows.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForAllRows( Function&& function ) const;
-
-      /**
-       * \brief This method calls \e sequentialForRows for all matrix rows.
-       *
-       * See \ref DenseMatrixView::sequentialForAllRows.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForAllRows( Function&& function );
-
-      /**
-       * \brief Computes product of matrix and vector.
-       *
-       * More precisely, it computes:
-       *
-       * ```
-       * outVector = matrixMultiplicator * ( *this ) * inVector + outVectorMultiplicator * outVector
-       * ```
-       *
-       * \tparam InVector is type of input vector.  It can be \ref Vector,
-       *     \ref VectorView, \ref Array, \ref ArraView or similar container.
-       * \tparam OutVector is type of output vector. It can be \ref Vector,
-       *     \ref VectorView, \ref Array, \ref ArraView or similar container.
-       *
-       * \param inVector is input vector.
-       * \param outVector is output vector.
-       * \param matrixMultiplicator is a factor by which the matrix is multiplied. It is one by default.
-       * \param outVectorMultiplicator is a factor by which the outVector is multiplied before added
-       *    to the result of matrix-vector product. It is zero by default.
-       * \param begin is the beginning of the rows range for which the vector product
-       *    is computed. It is zero by default.
-       * \param end is the end of the rows range for which the vector product
-       *    is computed. It is number if the matrix rows by default.
-       *
-       * Note that the ouput vector dimension must be the same as the number of matrix rows
-       * no matter how we set `begin` and `end` parameters. These parameters just say that
-       * some matrix rows and the output vector elements are omitted.
-       */
-      template< typename InVector, typename OutVector >
-      void vectorProduct( const InVector& inVector,
-                          OutVector& outVector,
-                          const RealType& matrixMultiplicator = 1.0,
-                          const RealType& outVectorMultiplicator = 0.0,
-                          const IndexType begin = 0,
-                          IndexType end = 0 ) const;
-
-      template< typename Matrix >
-      void addMatrix( const Matrix& matrix,
-                      const RealType& matrixMultiplicator = 1.0,
-                      const RealType& thisMatrixMultiplicator = 1.0 );
-
-      template< typename Matrix1, typename Matrix2, int tileDim = 32 >
-      void getMatrixProduct( const Matrix1& matrix1,
-                          const Matrix2& matrix2,
-                          const RealType& matrix1Multiplicator = 1.0,
-                          const RealType& matrix2Multiplicator = 1.0 );
-
-      template< typename Matrix, int tileDim = 32 >
-      void getTransposition( const Matrix& matrix,
-                             const RealType& matrixMultiplicator = 1.0 );
-
-      /**
-       * \brief Assignment operator with DenseMatrix.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return reference to this matrix.
-       */
-      DenseMatrixView& operator=( const DenseMatrixView& matrix );
-
-      /**
-       * \brief Comparison operator with another dense matrix view.
-       *
-       * \param matrix is the right-hand side matrix view.
-       * \return \e true if the RHS matrix view is equal, \e false otherwise.
-       */
-      template< typename Real_, typename Device_, typename Index_ >
-      bool operator==( const DenseMatrixView< Real_, Device_, Index_, Organization >& matrix ) const;
-
-      /**
-       * \brief Comparison operator with another dense matrix view.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return \e false if the RHS matrix view is equal, \e true otherwise.
-       */
-      template< typename Real_, typename Device_, typename Index_ >
-      bool operator!=( const DenseMatrixView< Real_, Device_, Index_, Organization >& matrix ) const;
-
-      /**
-       * \brief Comparison operator with another arbitrary matrix type.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return \e true if the RHS matrix is equal, \e false otherwise.
-       */
-      template< typename Matrix >
-      bool operator==( const Matrix& m ) const;
-
-      /**
-       * \brief Comparison operator with another arbitrary matrix type.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return \e true if the RHS matrix is equal, \e false otherwise.
-       */
-      template< typename Matrix >
-      bool operator!=( const Matrix& m ) const;
-
-      /**
-       * \brief Method for saving the matrix view to the file with given filename.
-       *
-       * The ouput file can be loaded by \ref DenseMatrix.
-       *
-       * \param fileName is name of the file.
-       */
-      void save( const String& fileName ) const;
-
-      /**
-       * \brief Method for saving the matrix view to a file.
-       *
-       * The ouput file can be loaded by \ref DenseMatrix.
-       *
-       * \param fileName is name of the file.
-       */
-      void save( File& file ) const;
-
-      /**
-       * \brief Method for printing the matrix to output stream.
-       *
-       * \param str is the output stream.
-       */
-      void print( std::ostream& str ) const;
-
-   protected:
-
-      __cuda_callable__
-      IndexType getElementIndex( const IndexType row,
-                                 const IndexType column ) const;
-
-      SegmentsViewType segments;
+protected:
+   using BaseType = Matrix< Real, Device, Index >;
+   using ValuesType = typename BaseType::ValuesType;
+   using SegmentsType = Algorithms::Segments::
+      Ellpack< Device, Index, typename Allocators::Default< Device >::template Allocator< Index >, Organization, 1 >;
+   using SegmentsViewType = typename SegmentsType::ViewType;
+   using SegmentViewType = typename SegmentsType::SegmentViewType;
+
+public:
+   /**
+    * \brief The type of matrix elements.
+    */
+   using RealType = Real;
+
+   /**
+    * \brief The device where the matrix is allocated.
+    */
+   using DeviceType = Device;
+
+   /**
+    * \brief The type used for matrix elements indexing.
+    */
+   using IndexType = Index;
+
+   /**
+    * \brief Matrix elements organization getter.
+    *
+    * \return matrix elements organization - RowMajorOrder of ColumnMajorOrder.
+    */
+   static constexpr ElementsOrganization
+   getOrganization()
+   {
+      return Organization;
+   };
+
+   /**
+    * \brief Matrix elements container view type.
+    *
+    * Use this for embedding of the matrix elements values.
+    */
+   using ValuesViewType = typename ValuesType::ViewType;
+
+   /**
+    * \brief Matrix elements container view type.
+    *
+    * Use this for embedding of the matrix elements values.
+    */
+   using ConstValuesViewType = typename ValuesType::ConstViewType;
+
+   /**
+    * \brief Matrix view type.
+    *
+    * See \ref DenseMatrixView.
+    */
+   using ViewType = DenseMatrixView< Real, Device, Index, Organization >;
+
+   /**
+    * \brief Matrix view type for constant instances.
+    *
+    * See \ref DenseMatrixView.
+    */
+   using ConstViewType = DenseMatrixView< std::add_const_t< Real >, Device, Index, Organization >;
+
+   /**
+    * \brief Type for accessing matrix row.
+    */
+   using RowView = DenseMatrixRowView< SegmentViewType, ValuesViewType >;
+
+   /**
+    * \brief Helper type for getting self type or its modifications.
+    */
+   template< typename _Real = Real, typename _Device = Device, typename _Index = Index >
+   using Self = DenseMatrixView< _Real, _Device, _Index >;
+
+   /**
+    * \brief Constructor without parameters.
+    */
+   __cuda_callable__
+   DenseMatrixView();
+
+   /**
+    * \brief Constructor with matrix dimensions and values.
+    *
+    * Organization of matrix elements values in
+    *
+    * \param rows number of matrix rows.
+    * \param columns number of matrix columns.
+    * \param values is vector view with matrix elements values.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixViewExample_constructor.cpp
+    * \par Output
+    * \include DenseMatrixViewExample_constructor.out
+    */
+   __cuda_callable__
+   DenseMatrixView( IndexType rows, IndexType columns, const ValuesViewType& values );
+
+   /**
+    * \brief Constructor with matrix dimensions and values.
+    *
+    * Organization of matrix elements values in
+    *
+    * \param rows number of matrix rows.
+    * \param columns number of matrix columns.
+    * \param values is vector view with matrix elements values.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixViewExample_constructor.cpp
+    * \par Output
+    * \include DenseMatrixViewExample_constructor.out
+    */
+   template< typename Real_ >
+   __cuda_callable__
+   DenseMatrixView( IndexType rows, IndexType columns, const Containers::VectorView< Real_, Device, Index >& values );
+
+   /**
+    * \brief Copy constructor.
+    *
+    * \param matrix is the source matrix view.
+    */
+   __cuda_callable__
+   DenseMatrixView( const DenseMatrixView& matrix ) = default;
+
+   /**
+    * \brief Returns a modifiable dense matrix view.
+    *
+    * \return dense matrix view.
+    */
+   __cuda_callable__
+   ViewType
+   getView();
+
+   /**
+    * \brief Returns a non-modifiable dense matrix view.
+    *
+    * \return dense matrix view.
+    */
+   __cuda_callable__
+   ConstViewType
+   getConstView() const;
+
+   /**
+    * \brief Returns string with serialization type.
+    *
+    * The string has a form \e `Matrices::DenseMatrix< RealType,  [any_device], IndexType, [any_allocator], true/false >`.
+    *
+    * \return \e String with the serialization type.
+    */
+   static std::string
+   getSerializationType();
+
+   /**
+    * \brief Returns string with serialization type.
+    *
+    * See \ref DenseMatrixView::getSerializationType.
+    *
+    * \return \e String with the serialization type.
+    */
+   std::string
+   getSerializationTypeVirtual() const override;
+
+   /**
+    * \brief Compute capacities of all rows.
+    *
+    * The row capacities are not stored explicitly and must be computed.
+    *
+    * \param rowCapacities is a vector where the row capacities will be stored.
+    */
+   template< typename Vector >
+   void
+   getRowCapacities( Vector& rowCapacities ) const;
+
+   /**
+    * \brief Computes number of non-zeros in each row.
+    *
+    * \param rowLengths is a vector into which the number of non-zeros in each row
+    * will be stored.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixViewExample_getCompressedRowLengths.cpp
+    * \par Output
+    * \include DenseMatrixViewExample_getCompressedRowLengths.out
+    */
+   template< typename Vector >
+   void
+   getCompressedRowLengths( Vector& rowLengths ) const;
+
+   /**
+    * \brief Returns number of all matrix elements.
+    *
+    * This method is here mainly for compatibility with sparse matrices since
+    * the number of all matrix elements is just number of rows times number of
+    * columns.
+    *
+    * \return number of all matrix elements.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixViewExample_getElementsCount.cpp
+    * \par Output
+    * \include DenseMatrixViewExample_getElementsCount.out
+    */
+   IndexType
+   getAllocatedElementsCount() const;
+
+   /**
+    * \brief Returns number of non-zero matrix elements.
+    *
+    * \return number of all non-zero matrix elements.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixViewExample_getElementsCount.cpp
+    * \par Output
+    * \include DenseMatrixViewExample_getElementsCount.out
+    */
+   IndexType
+   getNonzeroElementsCount() const override;
+
+   /**
+    * \brief Constant getter of simple structure for accessing given matrix row.
+    *
+    * \param rowIdx is matrix row index.
+    *
+    * \return RowView for accessing given matrix row.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixViewExample_getConstRow.cpp
+    * \par Output
+    * \include DenseMatrixViewExample_getConstRow.out
+    *
+    * See \ref DenseMatrixRowView.
+    */
+   __cuda_callable__
+   const RowView
+   getRow( const IndexType& rowIdx ) const;
+
+   /**
+    * \brief Non-constant getter of simple structure for accessing given matrix row.
+    *
+    * \param rowIdx is matrix row index.
+    *
+    * \return RowView for accessing given matrix row.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixViewExample_getRow.cpp
+    * \par Output
+    * \include DenseMatrixExample_getRow.out
+    *
+    * See \ref DenseMatrixRowView.
+    */
+   __cuda_callable__
+   RowView
+   getRow( const IndexType& rowIdx );
+
+   /**
+    * \brief Sets all matrix elements to value \e v.
+    *
+    * \param v is value all matrix elements will be set to.
+    */
+   void
+   setValue( const RealType& v );
+
+   /**
+    * \brief Returns non-constant reference to element at row \e row and column column.
+    *
+    * Since this method returns reference to the element, it cannot be called across
+    * different address spaces. It means that it can be called only form CPU if the matrix
+    * is allocated on CPU or only from GPU kernels if the matrix is allocated on GPU.
+    *
+    * \param row is a row index of the element.
+    * \param column is a columns index of the element.
+    * \return reference to given matrix element.
+    */
+   __cuda_callable__
+   Real&
+   operator()( IndexType row, IndexType column );
+
+   /**
+    * \brief Returns constant reference to element at row \e row and column column.
+    *
+    * Since this method returns reference to the element, it cannot be called across
+    * different address spaces. It means that it can be called only form CPU if the matrix
+    * is allocated on CPU or only from GPU kernels if the matrix is allocated on GPU.
+    *
+    * \param row is a row index of the element.
+    * \param column is a columns index of the element.
+    * \return reference to given matrix element.
+    */
+   __cuda_callable__
+   const Real&
+   operator()( IndexType row, IndexType column ) const;
+
+   /**
+    * \brief Sets element at given \e row and \e column to given \e value.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref DenseMatrix::getRow
+    * or \ref DenseMatrix::forElements and \ref DenseMatrix::forAllElements.
+    *
+    * \param row is row index of the element.
+    * \param column is columns index of the element.
+    * \param value is the value the element will be set to.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixViewExample_setElement.cpp
+    * \par Output
+    * \include DenseMatrixExample_setElement.out
+    */
+   __cuda_callable__
+   void
+   setElement( IndexType row, IndexType column, const RealType& value );
+
+   /**
+    * \brief Add element at given \e row and \e column to given \e value.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref DenseMatrix::getRow
+    * or \ref DenseMatrix::forElements and \ref DenseMatrix::forAllElements.
+    *
+    * \param row is row index of the element.
+    * \param column is columns index of the element.
+    * \param value is the value the element will be set to.
+    * \param thisElementMultiplicator is multiplicator the original matrix element
+    *   value is multiplied by before addition of given \e value.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixViewExample_addElement.cpp
+    * \par Output
+    * \include DenseMatrixExample_addElement.out
+    *
+    */
+   __cuda_callable__
+   void
+   addElement( IndexType row, IndexType column, const RealType& value, const RealType& thisElementMultiplicator = 1.0 );
+
+   /**
+    * \brief Returns value of matrix element at position given by its row and column index.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref DenseMatrix::getRow
+    * or \ref DenseMatrix::forElements and \ref DenseMatrix::forAllElements.
+    *
+    * \param row is a row index of the matrix element.
+    * \param column i a column index of the matrix element.
+    *
+    * \return value of given matrix element.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixViewExample_getElement.cpp
+    * \par Output
+    * \include DenseMatrixExample_getElement.out
+    *
+    */
+   __cuda_callable__
+   Real
+   getElement( IndexType row, IndexType column ) const;
+
+   /**
+    * \brief Method for performing general reduction on matrix rows.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, RealType elementValue ) -> FetchValue { ... };
+    * ```
+    *
+    *   The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row.
+    *          It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixViewExample_reduceRows.cpp
+    * \par Output
+    * \include DenseMatrixViewExample_reduceRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity );
+
+   /**
+    * \brief Method for performing general reduction on matrix rows for constant instances.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, RealType elementValue ) -> FetchValue { ... };
+    * ```
+    *
+    *  The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row.
+    *          It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixViewExample_reduceRows.cpp
+    * \par Output
+    * \include DenseMatrixViewExample_reduceRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity )
+      const;
+
+   /**
+    * \brief Method for performing general reduction on ALL matrix rows.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, RealType elementValue ) -> FetchValue
+    * ```
+    *
+    * The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row.
+    *   It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixViewExample_reduceAllRows.cpp
+    * \par Output
+    * \include DenseMatrixViewExample_reduceAllRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity );
+
+   /**
+    * \brief Method for performing general reduction on ALL matrix rows for constant instances.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, RealType elementValue ) -> FetchValue { ... };
+    * ```
+    *
+    *  The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row.
+    *  It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixViewExample_reduceAllRows.cpp
+    * \par Output
+    * \include DenseMatrixViewExample_reduceAllRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const;
+
+   /**
+    * \brief Method for iteration over all matrix rows for constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements.
+    *    It is should have form like
+    *
+    * ```
+    * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx, const RealType& value
+    * ) { ... };
+    * ```
+    *
+    *  The column index repeats twice only for compatibility with sparse matrices.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include DenseMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function&& function ) const;
+
+   /**
+    * \brief Method for iteration over all matrix rows for non-constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements.
+    *    It is should have form like
+    *
+    * ```
+    * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx, RealType& value ) {
+    * ... };
+    * ```
+    *
+    *  The column index repeats twice only for compatibility with sparse matrices.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include DenseMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function&& function );
+
+   /**
+    * \brief This method calls \e forElements for all matrix rows.
+    *
+    * See \ref DenseMatrix::forElements.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixViewExample_forAllRows.cpp
+    * \par Output
+    * \include DenseMatrixViewExample_forAllRows.out
+    */
+   template< typename Function >
+   void
+   forAllElements( Function&& function ) const;
+
+   /**
+    * \brief This method calls \e forElements for all matrix rows.
+    *
+    * See \ref DenseMatrix::forAllElements.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixExample_forAllRows.cpp
+    * \par Output
+    * \include DenseMatrixExample_forAllRows.out
+    */
+   template< typename Function >
+   void
+   forAllElements( Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end).
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref DenseMatrix::forElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrix::RowView.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixExample_forRows.cpp
+    * \par Output
+    * \include DenseMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forRows( IndexType begin, IndexType end, Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end) for constant instances.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref DenseMatrixView::forElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrixView::RowView.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include DenseMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forRows( IndexType begin, IndexType end, Function&& function ) const;
+
+   /**
+    * \brief Method for parallel iteration over all matrix rows.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref DenseMatrixView::forAllElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrixView::RowView.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include DenseMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forAllRows( Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over all matrix rows for constant instances.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref DenseMatrixView::forAllElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrixView::RowView.
+    *
+    * \par Example
+    * \include Matrices/DenseMatrix/DenseMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include DenseMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forAllRows( Function&& function ) const;
+
+   /**
+    * \brief Method for sequential iteration over all matrix rows for constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements.
+    *    It is should have form like
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrixView::RowView.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForRows( IndexType begin, IndexType end, Function&& function ) const;
+
+   /**
+    * \brief Method for sequential iteration over all matrix rows for non-constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements.
+    *    It is should have form like
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::DenseMatrixView::RowView.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForRows( IndexType begin, IndexType end, Function&& function );
+
+   /**
+    * \brief This method calls \e sequentialForRows for all matrix rows (for constant instances).
+    *
+    * See \ref DenseMatrixView::sequentialForRows.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForAllRows( Function&& function ) const;
+
+   /**
+    * \brief This method calls \e sequentialForRows for all matrix rows.
+    *
+    * See \ref DenseMatrixView::sequentialForAllRows.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForAllRows( Function&& function );
+
+   /**
+    * \brief Computes product of matrix and vector.
+    *
+    * More precisely, it computes:
+    *
+    * ```
+    * outVector = matrixMultiplicator * ( *this ) * inVector + outVectorMultiplicator * outVector
+    * ```
+    *
+    * \tparam InVector is type of input vector.  It can be \ref Vector,
+    *     \ref VectorView, \ref Array, \ref ArraView or similar container.
+    * \tparam OutVector is type of output vector. It can be \ref Vector,
+    *     \ref VectorView, \ref Array, \ref ArraView or similar container.
+    *
+    * \param inVector is input vector.
+    * \param outVector is output vector.
+    * \param matrixMultiplicator is a factor by which the matrix is multiplied. It is one by default.
+    * \param outVectorMultiplicator is a factor by which the outVector is multiplied before added
+    *    to the result of matrix-vector product. It is zero by default.
+    * \param begin is the beginning of the rows range for which the vector product
+    *    is computed. It is zero by default.
+    * \param end is the end of the rows range for which the vector product
+    *    is computed. It is number if the matrix rows by default.
+    *
+    * Note that the ouput vector dimension must be the same as the number of matrix rows
+    * no matter how we set `begin` and `end` parameters. These parameters just say that
+    * some matrix rows and the output vector elements are omitted.
+    */
+   template< typename InVector, typename OutVector >
+   void
+   vectorProduct( const InVector& inVector,
+                  OutVector& outVector,
+                  const RealType& matrixMultiplicator = 1.0,
+                  const RealType& outVectorMultiplicator = 0.0,
+                  IndexType begin = 0,
+                  IndexType end = 0 ) const;
+
+   template< typename Matrix >
+   void
+   addMatrix( const Matrix& matrix, const RealType& matrixMultiplicator = 1.0, const RealType& thisMatrixMultiplicator = 1.0 );
+
+   template< typename Matrix1, typename Matrix2, int tileDim = 32 >
+   void
+   getMatrixProduct( const Matrix1& matrix1,
+                     const Matrix2& matrix2,
+                     const RealType& matrix1Multiplicator = 1.0,
+                     const RealType& matrix2Multiplicator = 1.0 );
+
+   template< typename Matrix, int tileDim = 32 >
+   void
+   getTransposition( const Matrix& matrix, const RealType& matrixMultiplicator = 1.0 );
+
+   /**
+    * \brief Assignment operator with DenseMatrix.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return reference to this matrix.
+    */
+   DenseMatrixView&
+   operator=( const DenseMatrixView& matrix );
+
+   /**
+    * \brief Comparison operator with another dense matrix view.
+    *
+    * \param matrix is the right-hand side matrix view.
+    * \return \e true if the RHS matrix view is equal, \e false otherwise.
+    */
+   template< typename Real_, typename Device_, typename Index_ >
+   bool
+   operator==( const DenseMatrixView< Real_, Device_, Index_, Organization >& matrix ) const;
+
+   /**
+    * \brief Comparison operator with another dense matrix view.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return \e false if the RHS matrix view is equal, \e true otherwise.
+    */
+   template< typename Real_, typename Device_, typename Index_ >
+   bool
+   operator!=( const DenseMatrixView< Real_, Device_, Index_, Organization >& matrix ) const;
+
+   /**
+    * \brief Comparison operator with another arbitrary matrix type.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return \e true if the RHS matrix is equal, \e false otherwise.
+    */
+   template< typename Matrix >
+   bool
+   operator==( const Matrix& m ) const;
+
+   /**
+    * \brief Comparison operator with another arbitrary matrix type.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return \e true if the RHS matrix is equal, \e false otherwise.
+    */
+   template< typename Matrix >
+   bool
+   operator!=( const Matrix& m ) const;
+
+   /**
+    * \brief Method for saving the matrix view to the file with given filename.
+    *
+    * The ouput file can be loaded by \ref DenseMatrix.
+    *
+    * \param fileName is name of the file.
+    */
+   void
+   save( const String& fileName ) const;
+
+   /**
+    * \brief Method for saving the matrix view to a file.
+    *
+    * The ouput file can be loaded by \ref DenseMatrix.
+    *
+    * \param fileName is name of the file.
+    */
+   void
+   save( File& file ) const override;
+
+   /**
+    * \brief Method for printing the matrix to output stream.
+    *
+    * \param str is the output stream.
+    */
+   void
+   print( std::ostream& str ) const override;
+
+protected:
+   __cuda_callable__
+   IndexType
+   getElementIndex( IndexType row, IndexType column ) const;
+
+   SegmentsViewType segments;
 };
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/DenseMatrixView.hpp>
diff --git a/src/TNL/Matrices/DenseMatrixView.hpp b/src/TNL/Matrices/DenseMatrixView.hpp
index ab21a59cfbab3066185f0766297a4b189ce4fdea..d563a2e3fb3e91b8fb0edc8ff558475e8d36c063 100644
--- a/src/TNL/Matrices/DenseMatrixView.hpp
+++ b/src/TNL/Matrices/DenseMatrixView.hpp
@@ -20,12 +20,18 @@ namespace Matrices {
  * The following kernel is an attempt to map more CUDA threads to one matrix row.
  */
 template< int BlockSize, int ThreadsPerRow, typename Matrix, typename InVector, typename OutVector >
-__global__ void
-VectorColumnMajorDenseMatrixViewVectorMultiplicationKernel( const Matrix matrix, const InVector inVector, OutVector outVector, const int begin, const int end, int gridIdx )
+__global__
+void
+VectorColumnMajorDenseMatrixViewVectorMultiplicationKernel( const Matrix matrix,
+                                                            const InVector inVector,
+                                                            OutVector outVector,
+                                                            const int begin,
+                                                            const int end,
+                                                            int gridIdx )
 {
    using Real = typename Matrix::RealType;
    using Index = typename Matrix::IndexType;
-   constexpr int  inVectorCacheSize = 20480 / sizeof( Real );
+   constexpr int inVectorCacheSize = 20480 / sizeof( Real );
    __shared__ Real inVectorCache[ inVectorCacheSize ];
    __shared__ Real result_[ BlockSize ];
 
@@ -40,13 +46,11 @@ VectorColumnMajorDenseMatrixViewVectorMultiplicationKernel( const Matrix matrix,
    const auto& rowsCount = matrix.getRows();
    Index valuesPtr = rowIdx + localColIdx * rowsCount;
 
-   while( columnIdx < matrix.getColumns() )
-   {
+   while( columnIdx < matrix.getColumns() ) {
       const Index lastIdx = min( matrix.getColumns(), columnIdx + inVectorCacheSize );
       Index matrixColIdx = columnIdx + threadIdx.x;
       Index cacheColIdx = threadIdx.x;
-      while( matrixColIdx < lastIdx )
-      {
+      while( matrixColIdx < lastIdx ) {
          inVectorCache[ cacheColIdx ] = inVector[ matrixColIdx ];
          cacheColIdx += 256;
          matrixColIdx += 256;
@@ -56,8 +60,7 @@ VectorColumnMajorDenseMatrixViewVectorMultiplicationKernel( const Matrix matrix,
       matrixColIdx = columnIdx + localColIdx;
       cacheColIdx = localColIdx;
       if( rowIdx < end )
-         while( matrixColIdx < lastIdx )
-         {
+         while( matrixColIdx < lastIdx ) {
             result += values[ valuesPtr ] * inVectorCache[ cacheColIdx ];
             cacheColIdx += ThreadsPerRow;
             matrixColIdx += ThreadsPerRow;
@@ -85,12 +88,18 @@ VectorColumnMajorDenseMatrixViewVectorMultiplicationKernel( const Matrix matrix,
 }
 
 template< typename Matrix, typename InVector, typename OutVector >
-__global__ void
-ColumnMajorDenseMatrixViewVectorMultiplicationKernel( const Matrix matrix, const InVector inVector, OutVector outVector, const int begin, const int end, int gridIdx )
+__global__
+void
+ColumnMajorDenseMatrixViewVectorMultiplicationKernel( const Matrix matrix,
+                                                      const InVector inVector,
+                                                      OutVector outVector,
+                                                      const int begin,
+                                                      const int end,
+                                                      int gridIdx )
 {
    using Real = typename Matrix::RealType;
    using Index = typename Matrix::IndexType;
-   constexpr int  inVectorCacheSize = 20480 / sizeof( Real );
+   constexpr int inVectorCacheSize = 20480 / sizeof( Real );
    __shared__ Real inVectorCache[ inVectorCacheSize ];
 
    const int rowIdx = ( gridIdx * Cuda::getMaxGridSize() + blockIdx.x ) * 256 + threadIdx.x + begin;
@@ -101,13 +110,11 @@ ColumnMajorDenseMatrixViewVectorMultiplicationKernel( const Matrix matrix, const
    const auto& rowsCount = matrix.getRows();
    Index valuesPtr = rowIdx;
 
-   while( columnIdx < matrix.getColumns() )
-   {
+   while( columnIdx < matrix.getColumns() ) {
       const Index lastIdx = min( matrix.getColumns(), columnIdx + inVectorCacheSize );
       Index matrixColIdx = columnIdx + threadIdx.x;
       Index cacheColIdx = threadIdx.x;
-      while( matrixColIdx < lastIdx )
-      {
+      while( matrixColIdx < lastIdx ) {
          inVectorCache[ cacheColIdx ] = inVector[ matrixColIdx ];
          cacheColIdx += 256;
          matrixColIdx += 256;
@@ -117,8 +124,7 @@ ColumnMajorDenseMatrixViewVectorMultiplicationKernel( const Matrix matrix, const
       matrixColIdx = columnIdx;
       cacheColIdx = 0;
       if( rowIdx < end )
-         while( matrixColIdx < lastIdx )
-         {
+         while( matrixColIdx < lastIdx ) {
             result += values[ valuesPtr ] * inVectorCache[ cacheColIdx ];
             cacheColIdx++;
             matrixColIdx++;
@@ -131,20 +137,27 @@ ColumnMajorDenseMatrixViewVectorMultiplicationKernel( const Matrix matrix, const
 }
 
 template< typename Matrix, typename InVector, typename OutVector >
-__global__ void
-RowMajorDenseMatrixViewVectorMultiplicationKernel( const Matrix matrix, const InVector inVector, OutVector outVector, const int first, const int last, int gridIdx )
+__global__
+void
+RowMajorDenseMatrixViewVectorMultiplicationKernel( const Matrix matrix,
+                                                   const InVector inVector,
+                                                   OutVector outVector,
+                                                   const int first,
+                                                   const int last,
+                                                   int gridIdx )
 {
    using Real = typename Matrix::RealType;
    using Index = typename Matrix::IndexType;
-   constexpr int  inVectorCacheSize = 20480 / sizeof( Real );
+   constexpr int inVectorCacheSize = 20480 / sizeof( Real );
    __shared__ Real inVectorCache[ inVectorCacheSize ];
 
    constexpr int threadsPerRow = 32;
-   //const Index rowIdx = begin + ((gridIdx * TNL::Cuda::getMaxGridXSize() ) + (blockIdx.x * blockDim.x) + threadIdx.x) / threadsPerRow;
-   const Index rowIdx = first + ( ( gridIdx * Cuda::getMaxGridSize() + blockIdx.x ) * 256 + threadIdx.x ) /  threadsPerRow;
+   // const Index rowIdx = begin + ((gridIdx * TNL::Cuda::getMaxGridXSize() ) + (blockIdx.x * blockDim.x) + threadIdx.x) /
+   // threadsPerRow;
+   const Index rowIdx = first + ( ( gridIdx * Cuda::getMaxGridSize() + blockIdx.x ) * 256 + threadIdx.x ) / threadsPerRow;
 
    Real result = 0.0;
-   const Index laneID = threadIdx.x & 31; // & is cheaper than %
+   const Index laneID = threadIdx.x & 31;  // & is cheaper than %
    const Real* values = matrix.getValues().getData();
 
    Index columnIdx( 0 );
@@ -174,8 +187,7 @@ RowMajorDenseMatrixViewVectorMultiplicationKernel( const Matrix matrix, const In
       columnIdx = lastIdx;
    }*/
 
-   if( rowIdx < last )
-   {
+   if( rowIdx < last ) {
       const Index begin = rowIdx * matrix.getColumns();
       const Index end = begin + matrix.getColumns();
 
@@ -183,19 +195,18 @@ RowMajorDenseMatrixViewVectorMultiplicationKernel( const Matrix matrix, const In
          result += values[ i ] * inVector[ columnIdx ];
    }
 
-   if( rowIdx < last )
-   {
+   if( rowIdx < last ) {
       // Reduction
       if( threadsPerRow > 16 )
-         result += __shfl_down_sync(0xFFFFFFFF, result, 16 );
+         result += __shfl_down_sync( 0xFFFFFFFF, result, 16 );
       if( threadsPerRow > 8 )
-         result += __shfl_down_sync(0xFFFFFFFF, result,  8 );
+         result += __shfl_down_sync( 0xFFFFFFFF, result, 8 );
       if( threadsPerRow > 4 )
-         result += __shfl_down_sync(0xFFFFFFFF, result,  4 );
+         result += __shfl_down_sync( 0xFFFFFFFF, result, 4 );
       if( threadsPerRow > 2 )
-         result += __shfl_down_sync(0xFFFFFFFF, result,  2 );
+         result += __shfl_down_sync( 0xFFFFFFFF, result, 2 );
       if( threadsPerRow > 1 )
-         result += __shfl_down_sync(0xFFFFFFFF, result,  1 );
+         result += __shfl_down_sync( 0xFFFFFFFF, result, 1 );
       // Write result
       if( laneID == 0 )
          outVector[ rowIdx ] = result;
@@ -203,200 +214,136 @@ RowMajorDenseMatrixViewVectorMultiplicationKernel( const Matrix matrix, const In
 }
 #endif
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
-DenseMatrixView< Real, Device, Index, Organization >::
-DenseMatrixView()
-{
-}
+DenseMatrixView< Real, Device, Index, Organization >::DenseMatrixView() = default;
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
-DenseMatrixView< Real, Device, Index, Organization >::
-DenseMatrixView( const IndexType rows,
-                 const IndexType columns,
-                 const ValuesViewType& values )
- : MatrixView< Real, Device, Index >( rows, columns, values ), segments( rows, columns )
-{
-}
-
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Value_ >
+DenseMatrixView< Real, Device, Index, Organization >::DenseMatrixView( const IndexType rows,
+                                                                       const IndexType columns,
+                                                                       const ValuesViewType& values )
+: MatrixView< Real, Device, Index >( rows, columns, values ), segments( rows, columns )
+{}
+
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Value_ >
 __cuda_callable__
-DenseMatrixView< Real, Device, Index, Organization >::
-DenseMatrixView( const IndexType rows,
-                 const IndexType columns,
-                 const Containers::VectorView< Value_, Device, Index >& values )
- : MatrixView< Real, Device, Index >( rows, columns, values ), segments( rows, columns, true )
-{
-}
-
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+DenseMatrixView< Real, Device, Index, Organization >::DenseMatrixView(
+   const IndexType rows,
+   const IndexType columns,
+   const Containers::VectorView< Value_, Device, Index >& values )
+: MatrixView< Real, Device, Index >( rows, columns, values ), segments( rows, columns, true )
+{}
+
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
 auto
-DenseMatrixView< Real, Device, Index, Organization >::
-getView() -> ViewType
+DenseMatrixView< Real, Device, Index, Organization >::getView() -> ViewType
 {
-   return ViewType( this->getRows(),
-                    this->getColumns(),
-                    this->getValues().getView() );
+   return ViewType( this->getRows(), this->getColumns(), this->getValues().getView() );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
 auto
-DenseMatrixView< Real, Device, Index, Organization >::
-getConstView() const -> ConstViewType
+DenseMatrixView< Real, Device, Index, Organization >::getConstView() const -> ConstViewType
 {
-   return ConstViewType( this->getRows(),
-                         this->getColumns(),
-                         this->getValues().getConstView(),
-                         this->getColumnsIndexes().getConstView() );
+   return ConstViewType(
+      this->getRows(), this->getColumns(), this->getValues().getConstView(), this->getColumnsIndexes().getConstView() );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-String
-DenseMatrixView< Real, Device, Index, Organization >::
-getSerializationType()
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+std::string
+DenseMatrixView< Real, Device, Index, Organization >::getSerializationType()
 {
-   return String( "Matrices::DenseMatrix< " ) +
-      TNL::getSerializationType< RealType >() + ", [any_device], " +
-      TNL::getSerializationType< IndexType >() + ", " +
-      TNL::getSerializationType( Organization ) + " >";
+   return "Matrices::DenseMatrix< " + TNL::getSerializationType< RealType >() + ", [any_device], "
+        + TNL::getSerializationType< IndexType >() + ", " + TNL::getSerializationType( Organization ) + " >";
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-String
-DenseMatrixView< Real, Device, Index, Organization >::
-getSerializationTypeVirtual() const
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+std::string
+DenseMatrixView< Real, Device, Index, Organization >::getSerializationTypeVirtual() const
 {
    return this->getSerializationType();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Vector >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Vector >
 void
-DenseMatrixView< Real, Device, Index, Organization >::
-getRowCapacities( Vector& rowCapacities ) const
+DenseMatrixView< Real, Device, Index, Organization >::getRowCapacities( Vector& rowCapacities ) const
 {
    rowCapacities.setSize( this->getRows() );
    rowCapacities = this->getColumns();
 }
 
-
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Vector >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Vector >
 void
-DenseMatrixView< Real, Device, Index, Organization >::
-getCompressedRowLengths( Vector& rowLengths ) const
+DenseMatrixView< Real, Device, Index, Organization >::getCompressedRowLengths( Vector& rowLengths ) const
 {
    rowLengths.setSize( this->getRows() );
    rowLengths = 0;
    auto rowLengths_view = rowLengths.getView();
-   auto fetch = [] __cuda_callable__ ( IndexType row, IndexType column, const RealType& value ) -> IndexType {
+   auto fetch = [] __cuda_callable__( IndexType row, IndexType column, const RealType& value ) -> IndexType
+   {
       return ( value != 0.0 );
    };
-   auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const IndexType value ) mutable {
+   auto keep = [ = ] __cuda_callable__( const IndexType rowIdx, const IndexType value ) mutable
+   {
       rowLengths_view[ rowIdx ] = value;
    };
    this->reduceAllRows( fetch, std::plus<>{}, keep, 0 );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 Index
-DenseMatrixView< Real, Device, Index, Organization >::
-getAllocatedElementsCount() const
+DenseMatrixView< Real, Device, Index, Organization >::getAllocatedElementsCount() const
 {
    return this->getRows() * this->getColumns();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 Index
-DenseMatrixView< Real, Device, Index, Organization >::
-getNonzeroElementsCount() const
+DenseMatrixView< Real, Device, Index, Organization >::getNonzeroElementsCount() const
 {
    const auto values_view = this->values.getConstView();
-   auto fetch = [=] __cuda_callable__ ( const IndexType i ) -> IndexType {
+   auto fetch = [ = ] __cuda_callable__( const IndexType i ) -> IndexType
+   {
       return ( values_view[ i ] != 0.0 );
    };
    return Algorithms::reduce< DeviceType >( (IndexType) 0, this->values.getSize(), fetch, std::plus<>{}, 0 );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 void
-DenseMatrixView< Real, Device, Index, Organization >::
-setValue( const Real& value )
+DenseMatrixView< Real, Device, Index, Organization >::setValue( const Real& value )
 {
    this->values = value;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-__cuda_callable__ auto
-DenseMatrixView< Real, Device, Index, Organization >::
-getRow( const IndexType& rowIdx ) const -> const RowView
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+__cuda_callable__
+auto
+DenseMatrixView< Real, Device, Index, Organization >::getRow( const IndexType& rowIdx ) const -> const RowView
 {
    TNL_ASSERT_LT( rowIdx, this->getRows(), "Row index is larger than number of matrix rows." );
    return RowView( this->segments.getSegmentView( rowIdx ), this->values.getConstView() );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-__cuda_callable__ auto
-DenseMatrixView< Real, Device, Index, Organization >::
-getRow( const IndexType& rowIdx ) -> RowView
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+__cuda_callable__
+auto
+DenseMatrixView< Real, Device, Index, Organization >::getRow( const IndexType& rowIdx ) -> RowView
 {
    TNL_ASSERT_LT( rowIdx, this->getRows(), "Row index is larger than number of matrix rows." );
    return RowView( this->segments.getSegmentView( rowIdx ), this->values.getView() );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
-Real& DenseMatrixView< Real, Device, Index, Organization >::operator()( const IndexType row,
-                                                const IndexType column )
+Real&
+DenseMatrixView< Real, Device, Index, Organization >::operator()( const IndexType row, const IndexType column )
 {
    TNL_ASSERT_GE( row, 0, "Row index must be non-negative." );
    TNL_ASSERT_LT( row, this->getRows(), "Row index is out of bounds." );
@@ -406,13 +353,10 @@ Real& DenseMatrixView< Real, Device, Index, Organization >::operator()( const In
    return this->values.operator[]( this->getElementIndex( row, column ) );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
-const Real& DenseMatrixView< Real, Device, Index, Organization >::operator()( const IndexType row,
-                                                      const IndexType column ) const
+const Real&
+DenseMatrixView< Real, Device, Index, Organization >::operator()( const IndexType row, const IndexType column ) const
 {
    TNL_ASSERT_GE( row, 0, "Row index must be non-negative." );
    TNL_ASSERT_LT( row, this->getRows(), "Row index is out of bounds." );
@@ -422,290 +366,234 @@ const Real& DenseMatrixView< Real, Device, Index, Organization >::operator()( co
    return this->values.operator[]( this->getElementIndex( row, column ) );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-__cuda_callable__ void
-DenseMatrixView< Real, Device, Index, Organization >::
-setElement( const IndexType row,
-            const IndexType column,
-            const RealType& value )
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+__cuda_callable__
+void
+DenseMatrixView< Real, Device, Index, Organization >::setElement( const IndexType row,
+                                                                  const IndexType column,
+                                                                  const RealType& value )
 {
    this->values.setElement( this->getElementIndex( row, column ), value );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-__cuda_callable__ void
-DenseMatrixView< Real, Device, Index, Organization >::
-addElement( const IndexType row,
-            const IndexType column,
-            const RealType& value,
-            const RealType& thisElementMultiplicator )
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+__cuda_callable__
+void
+DenseMatrixView< Real, Device, Index, Organization >::addElement( const IndexType row,
+                                                                  const IndexType column,
+                                                                  const RealType& value,
+                                                                  const RealType& thisElementMultiplicator )
 {
    const IndexType elementIndex = this->getElementIndex( row, column );
    if( thisElementMultiplicator == 1.0 )
-      this->values.setElement( elementIndex,
-                               this->values.getElement( elementIndex ) + value );
+      this->values.setElement( elementIndex, this->values.getElement( elementIndex ) + value );
    else
-      this->values.setElement( elementIndex,
-                               thisElementMultiplicator * this->values.getElement( elementIndex ) + value );
+      this->values.setElement( elementIndex, thisElementMultiplicator * this->values.getElement( elementIndex ) + value );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-__cuda_callable__ Real
-DenseMatrixView< Real, Device, Index, Organization >::
-getElement( const IndexType row,
-            const IndexType column ) const
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+__cuda_callable__
+Real
+DenseMatrixView< Real, Device, Index, Organization >::getElement( const IndexType row, const IndexType column ) const
 {
    return this->values.getElement( this->getElementIndex( row, column ) );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
 void
-DenseMatrixView< Real, Device, Index, Organization >::
-reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchValue& identity )
+DenseMatrixView< Real, Device, Index, Organization >::reduceRows( IndexType begin,
+                                                                  IndexType end,
+                                                                  Fetch& fetch,
+                                                                  const Reduce& reduce,
+                                                                  Keep& keep,
+                                                                  const FetchValue& identity )
 {
    auto values_view = this->values.getView();
-   auto fetch_ = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, IndexType globalIdx, bool& compute ) mutable -> decltype( fetch( IndexType(), IndexType(), RealType() ) ) {
-         return fetch( rowIdx, columnIdx, values_view[ globalIdx ] );
+   auto fetch_ = [ = ] __cuda_callable__( IndexType rowIdx, IndexType columnIdx, IndexType globalIdx, bool& compute ) mutable
+      -> decltype( fetch( IndexType(), IndexType(), RealType() ) )
+   {
+      return fetch( rowIdx, columnIdx, values_view[ globalIdx ] );
       return identity;
    };
    this->segments.reduceSegments( begin, end, fetch_, reduce, keep, identity );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
 void
-DenseMatrixView< Real, Device, Index, Organization >::
-reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchValue& identity ) const
+DenseMatrixView< Real, Device, Index, Organization >::reduceRows( IndexType begin,
+                                                                  IndexType end,
+                                                                  Fetch& fetch,
+                                                                  const Reduce& reduce,
+                                                                  Keep& keep,
+                                                                  const FetchValue& identity ) const
 {
    const auto values_view = this->values.getConstView();
-   auto fetch_ = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, IndexType globalIdx, bool& compute ) mutable -> decltype( fetch( IndexType(), IndexType(), RealType() ) ) {
-         return fetch( rowIdx, columnIdx, values_view[ globalIdx ] );
+   auto fetch_ = [ = ] __cuda_callable__( IndexType rowIdx, IndexType columnIdx, IndexType globalIdx, bool& compute ) mutable
+      -> decltype( fetch( IndexType(), IndexType(), RealType() ) )
+   {
+      return fetch( rowIdx, columnIdx, values_view[ globalIdx ] );
       return identity;
    };
    this->segments.reduceSegments( begin, end, fetch_, reduce, keep, identity );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-DenseMatrixView< Real, Device, Index, Organization >::
-reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity )
+DenseMatrixView< Real, Device, Index, Organization >::reduceAllRows( Fetch& fetch,
+                                                                     const Reduce& reduce,
+                                                                     Keep& keep,
+                                                                     const FetchReal& identity )
 {
    this->reduceRows( (IndexType) 0, this->getRows(), fetch, reduce, keep, identity );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-DenseMatrixView< Real, Device, Index, Organization >::
-reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const
+DenseMatrixView< Real, Device, Index, Organization >::reduceAllRows( Fetch& fetch,
+                                                                     const Reduce& reduce,
+                                                                     Keep& keep,
+                                                                     const FetchReal& identity ) const
 {
    this->reduceRows( (IndexType) 0, this->getRows(), fetch, reduce, keep, identity );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-DenseMatrixView< Real, Device, Index, Organization >::
-forElements( IndexType begin, IndexType end, Function&& function ) const
+DenseMatrixView< Real, Device, Index, Organization >::forElements( IndexType begin, IndexType end, Function&& function ) const
 {
    const auto values_view = this->values.getConstView();
-   auto f = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, IndexType globalIdx ) mutable {
+   auto f = [ = ] __cuda_callable__( IndexType rowIdx, IndexType columnIdx, IndexType globalIdx ) mutable
+   {
       function( rowIdx, columnIdx, columnIdx, values_view[ globalIdx ] );
    };
    this->segments.forElements( begin, end, f );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-DenseMatrixView< Real, Device, Index, Organization >::
-forElements( IndexType begin, IndexType end, Function&& function )
+DenseMatrixView< Real, Device, Index, Organization >::forElements( IndexType begin, IndexType end, Function&& function )
 {
    auto values_view = this->values.getView();
-   auto f = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, IndexType globalIdx ) mutable {
+   auto f = [ = ] __cuda_callable__( IndexType rowIdx, IndexType columnIdx, IndexType globalIdx ) mutable
+   {
       function( rowIdx, columnIdx, globalIdx, values_view[ globalIdx ] );
    };
    this->segments.forElements( begin, end, f );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-DenseMatrixView< Real, Device, Index, Organization >::
-forAllElements( Function&& function ) const
+DenseMatrixView< Real, Device, Index, Organization >::forAllElements( Function&& function ) const
 {
    this->forElements( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-DenseMatrixView< Real, Device, Index, Organization >::
-forAllElements( Function&& function )
+DenseMatrixView< Real, Device, Index, Organization >::forAllElements( Function&& function )
 {
    this->forElements( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-DenseMatrixView< Real, Device, Index, Organization >::
-forRows( IndexType begin, IndexType end, Function&& function )
+DenseMatrixView< Real, Device, Index, Organization >::forRows( IndexType begin, IndexType end, Function&& function )
 {
    auto values_view = this->values.getView();
    using SegmentViewType = typename SegmentsViewType::SegmentViewType;
-   auto f = [=] __cuda_callable__ ( SegmentViewType& segmentView ) mutable {
+   auto f = [ = ] __cuda_callable__( SegmentViewType & segmentView ) mutable
+   {
       auto rowView = RowView( segmentView, values_view );
       function( rowView );
    };
    this->segments.forSegments( begin, end, f );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-DenseMatrixView< Real, Device, Index, Organization >::
-forRows( IndexType begin, IndexType end, Function&& function ) const
+DenseMatrixView< Real, Device, Index, Organization >::forRows( IndexType begin, IndexType end, Function&& function ) const
 {
    const auto values_view = this->values.getConstView();
    using SegmentViewType = typename SegmentsViewType::SegmentViewType;
-   auto f = [=] __cuda_callable__ ( SegmentViewType&& segmentView ) mutable {
+   auto f = [ = ] __cuda_callable__( SegmentViewType && segmentView ) mutable
+   {
       const auto rowView = RowViewType( segmentView, values_view );
       function( rowView );
    };
    this->segments.forSegments( begin, end, f );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-DenseMatrixView< Real, Device, Index, Organization >::
-forAllRows( Function&& function )
+DenseMatrixView< Real, Device, Index, Organization >::forAllRows( Function&& function )
 {
    this->forRows( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-DenseMatrixView< Real, Device, Index, Organization >::
-forAllRows( Function&& function ) const
+DenseMatrixView< Real, Device, Index, Organization >::forAllRows( Function&& function ) const
 {
    this->forRows( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-DenseMatrixView< Real, Device, Index, Organization >::
-sequentialForRows( IndexType begin, IndexType end, Function&& function ) const
+DenseMatrixView< Real, Device, Index, Organization >::sequentialForRows( IndexType begin,
+                                                                         IndexType end,
+                                                                         Function&& function ) const
 {
-   for( IndexType row = begin; row < end; row ++ )
+   for( IndexType row = begin; row < end; row++ )
       this->forRows( row, row + 1, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-DenseMatrixView< Real, Device, Index, Organization >::
-sequentialForRows( IndexType begin, IndexType end, Function&& function )
+DenseMatrixView< Real, Device, Index, Organization >::sequentialForRows( IndexType begin, IndexType end, Function&& function )
 {
-   for( IndexType row = begin; row < end; row ++ )
+   for( IndexType row = begin; row < end; row++ )
       this->forRows( row, row + 1, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-DenseMatrixView< Real, Device, Index, Organization >::
-sequentialForAllRows( Function&& function ) const
+DenseMatrixView< Real, Device, Index, Organization >::sequentialForAllRows( Function&& function ) const
 {
    this->sequentialForRows( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-DenseMatrixView< Real, Device, Index, Organization >::
-sequentialForAllRows( Function&& function )
+DenseMatrixView< Real, Device, Index, Organization >::sequentialForAllRows( Function&& function )
 {
    this->sequentialForRows( (IndexType) 0, this->getRows(), function );
 }
 
-
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename InVector,
-             typename OutVector >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename InVector, typename OutVector >
 void
-DenseMatrixView< Real, Device, Index, Organization >::
-vectorProduct( const InVector& inVector,
-               OutVector& outVector,
-               const RealType& matrixMultiplicator,
-               const RealType& outVectorMultiplicator,
-               const IndexType begin,
-               IndexType end ) const
+DenseMatrixView< Real, Device, Index, Organization >::vectorProduct( const InVector& inVector,
+                                                                     OutVector& outVector,
+                                                                     const RealType& matrixMultiplicator,
+                                                                     const RealType& outVectorMultiplicator,
+                                                                     const IndexType begin,
+                                                                     IndexType end ) const
 {
    TNL_ASSERT_EQ( this->getColumns(), inVector.getSize(), "Matrix columns count differs with input vector size." );
    TNL_ASSERT_EQ( this->getRows(), outVector.getSize(), "Matrix rows count differs with output vector size." );
@@ -716,42 +604,38 @@ vectorProduct( const InVector& inVector,
    if( end == 0 )
       end = this->getRows();
 
-   if( std::is_same< DeviceType, Devices::Cuda >::value &&
-      matrixMultiplicator == 1.0 && outVectorMultiplicator == 0.0 )
-   {
+   if( std::is_same< DeviceType, Devices::Cuda >::value && matrixMultiplicator == 1.0 && outVectorMultiplicator == 0.0 ) {
 #ifdef HAVE_CUDA
-      if( Organization == Algorithms::Segments::ColumnMajorOrder )
-      {
+      if( Organization == Algorithms::Segments::ColumnMajorOrder ) {
          constexpr int BlockSize = 256;
          constexpr int ThreadsPerRow = 1;
          const size_t threadsCount = ( end - begin ) * ThreadsPerRow;
          const size_t blocksCount = roundUpDivision( threadsCount, BlockSize );
          const size_t gridsCount = roundUpDivision( blocksCount, Cuda::getMaxGridSize() );
          const size_t sharedMemSize = 20480;
-         for( size_t gridIdx = 0; gridIdx < gridsCount; gridIdx++ )
-         {
+         for( size_t gridIdx = 0; gridIdx < gridsCount; gridIdx++ ) {
             dim3 blocks( Cuda::getMaxGridSize() );
             if( gridIdx == gridsCount - 1 )
                blocks = blocksCount % Cuda::getMaxGridSize();
-            ColumnMajorDenseMatrixViewVectorMultiplicationKernel<<< blocks, BlockSize, sharedMemSize >>>( *this, inVectorView, outVectorView, begin, end, gridIdx );
+            ColumnMajorDenseMatrixViewVectorMultiplicationKernel<<< blocks, BlockSize,
+               sharedMemSize >>>( *this, inVectorView, outVectorView, begin, end, gridIdx );
          }
          TNL_CHECK_CUDA_DEVICE;
          return;
       }
-      if( Organization == Algorithms::Segments::RowMajorOrder )
-      {
+      if( Organization == Algorithms::Segments::RowMajorOrder ) {
          constexpr int BlockSize = 256;
          constexpr int ThreadsPerRow = 32;
          const size_t threadsCount = ( end - begin ) * ThreadsPerRow;
          const size_t blocksCount = roundUpDivision( threadsCount, BlockSize );
          const size_t gridsCount = roundUpDivision( blocksCount, Cuda::getMaxGridSize() );
          const size_t sharedMemSize = 20480;
-         for( size_t gridIdx = 0; gridIdx < gridsCount; gridIdx++ )
-         {
+         for( size_t gridIdx = 0; gridIdx < gridsCount; gridIdx++ ) {
             dim3 blocks( Cuda::getMaxGridSize() );
             if( gridIdx == gridsCount - 1 )
                blocks = blocksCount % Cuda::getMaxGridSize();
-            RowMajorDenseMatrixViewVectorMultiplicationKernel<<< blocks, BlockSize, sharedMemSize >>>( *this, inVectorView, outVectorView, begin, end, gridIdx );
+            RowMajorDenseMatrixViewVectorMultiplicationKernel<<< blocks, BlockSize,
+               sharedMemSize >>>( *this, inVectorView, outVectorView, begin, end, gridIdx );
          }
          TNL_CHECK_CUDA_DEVICE;
          return;
@@ -764,55 +648,53 @@ vectorProduct( const InVector& inVector,
     * The rest is general implementation based on segments
     */
 
-   auto fetch = [=] __cuda_callable__ ( IndexType row, IndexType column, IndexType offset, bool& compute ) -> RealType {
+   auto fetch = [ = ] __cuda_callable__( IndexType row, IndexType column, IndexType offset, bool& compute ) -> RealType
+   {
       return valuesView[ offset ] * inVectorView[ column ];
    };
-   auto keeperGeneral = [=] __cuda_callable__ ( IndexType row, const RealType& value ) mutable {
+   auto keeperGeneral = [ = ] __cuda_callable__( IndexType row, const RealType& value ) mutable
+   {
       outVectorView[ row ] = matrixMultiplicator * value + outVectorMultiplicator * outVectorView[ row ];
    };
-   auto keeperDirect = [=] __cuda_callable__ ( IndexType row, const RealType& value ) mutable {
+   auto keeperDirect = [ = ] __cuda_callable__( IndexType row, const RealType& value ) mutable
+   {
       outVectorView[ row ] = value;
    };
-   auto keeperMatrixMult = [=] __cuda_callable__ ( IndexType row, const RealType& value ) mutable {
+   auto keeperMatrixMult = [ = ] __cuda_callable__( IndexType row, const RealType& value ) mutable
+   {
       outVectorView[ row ] = matrixMultiplicator * value;
    };
-   auto keeperVectorMult = [=] __cuda_callable__ ( IndexType row, const RealType& value ) mutable {
+   auto keeperVectorMult = [ = ] __cuda_callable__( IndexType row, const RealType& value ) mutable
+   {
       outVectorView[ row ] = outVectorMultiplicator * outVectorView[ row ] + value;
    };
 
-   if( outVectorMultiplicator == 0.0 )
-   {
+   if( outVectorMultiplicator == 0.0 ) {
       if( matrixMultiplicator == 1.0 )
-         this->segments.reduceSegments( begin, end, fetch, std::plus<>{}, keeperDirect, ( RealType ) 0.0 );
+         this->segments.reduceSegments( begin, end, fetch, std::plus<>{}, keeperDirect, (RealType) 0.0 );
       else
-         this->segments.reduceSegments( begin, end, fetch, std::plus<>{}, keeperMatrixMult, ( RealType ) 0.0 );
+         this->segments.reduceSegments( begin, end, fetch, std::plus<>{}, keeperMatrixMult, (RealType) 0.0 );
    }
-   else
-   {
+   else {
       if( matrixMultiplicator == 1.0 )
-         this->segments.reduceSegments( begin, end, fetch, std::plus<>{}, keeperVectorMult, ( RealType ) 0.0 );
+         this->segments.reduceSegments( begin, end, fetch, std::plus<>{}, keeperVectorMult, (RealType) 0.0 );
       else
-         this->segments.reduceSegments( begin, end, fetch, std::plus<>{}, keeperGeneral, ( RealType ) 0.0 );
+         this->segments.reduceSegments( begin, end, fetch, std::plus<>{}, keeperGeneral, (RealType) 0.0 );
    }
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Matrix >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Matrix >
 void
-DenseMatrixView< Real, Device, Index, Organization >::
-addMatrix( const Matrix& matrix,
-           const RealType& matrixMultiplicator,
-           const RealType& thisMatrixMultiplicator )
+DenseMatrixView< Real, Device, Index, Organization >::addMatrix( const Matrix& matrix,
+                                                                 const RealType& matrixMultiplicator,
+                                                                 const RealType& thisMatrixMultiplicator )
 {
-   TNL_ASSERT( this->getColumns() == matrix.getColumns() &&
-              this->getRows() == matrix.getRows(),
-            std::cerr << "This matrix columns: " << this->getColumns() << std::endl
-                 << "This matrix rows: " << this->getRows() << std::endl
-                 << "That matrix columns: " << matrix.getColumns() << std::endl
-                 << "That matrix rows: " << matrix.getRows() << std::endl );
+   TNL_ASSERT( this->getColumns() == matrix.getColumns() && this->getRows() == matrix.getRows(),
+               std::cerr << "This matrix columns: " << this->getColumns() << std::endl
+                         << "This matrix rows: " << this->getRows() << std::endl
+                         << "That matrix columns: " << matrix.getColumns() << std::endl
+                         << "That matrix rows: " << matrix.getRows() << std::endl );
 
    if( thisMatrixMultiplicator == 1.0 )
       this->values += matrixMultiplicator * matrix.values;
@@ -820,48 +702,42 @@ addMatrix( const Matrix& matrix,
       this->values = thisMatrixMultiplicator * this->values + matrixMultiplicator * matrix.values;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Matrix1, typename Matrix2, int tileDim >
-void DenseMatrixView< Real, Device, Index, Organization >::getMatrixProduct( const Matrix1& matrix1,
-                                                              const Matrix2& matrix2,
-                                                              const RealType& matrix1Multiplicator,
-                                                              const RealType& matrix2Multiplicator )
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Matrix1, typename Matrix2, int tileDim >
+void
+DenseMatrixView< Real, Device, Index, Organization >::getMatrixProduct( const Matrix1& matrix1,
+                                                                        const Matrix2& matrix2,
+                                                                        const RealType& matrix1Multiplicator,
+                                                                        const RealType& matrix2Multiplicator )
 {
-   TNL_ASSERT( matrix1.getColumns() == matrix2.getRows() &&
-              this->getRows() == matrix1.getRows() &&
-              this->getColumns() == matrix2.getColumns(),
-            std::cerr << "This matrix columns: " << this->getColumns() << std::endl
-                 << "This matrix rows: " << this->getRows() << std::endl
-                 << "Matrix1 columns: " << matrix1.getColumns() << std::endl
-                 << "Matrix1 rows: " << matrix1.getRows() << std::endl
-                 << "Matrix2 columns: " << matrix2.getColumns() << std::endl
-                 << "Matrix2 rows: " << matrix2.getRows() << std::endl );
+   TNL_ASSERT( matrix1.getColumns() == matrix2.getRows() && this->getRows() == matrix1.getRows()
+                  && this->getColumns() == matrix2.getColumns(),
+               std::cerr << "This matrix columns: " << this->getColumns() << std::endl
+                         << "This matrix rows: " << this->getRows() << std::endl
+                         << "Matrix1 columns: " << matrix1.getColumns() << std::endl
+                         << "Matrix1 rows: " << matrix1.getRows() << std::endl
+                         << "Matrix2 columns: " << matrix2.getColumns() << std::endl
+                         << "Matrix2 rows: " << matrix2.getRows() << std::endl );
 
    if( std::is_same< Device, Devices::Host >::value )
       for( IndexType i = 0; i < this->getRows(); i += tileDim )
-         for( IndexType j = 0; j < this->getColumns(); j += tileDim )
-         {
+         for( IndexType j = 0; j < this->getColumns(); j += tileDim ) {
             const IndexType tileRows = min( tileDim, this->getRows() - i );
             const IndexType tileColumns = min( tileDim, this->getColumns() - j );
             for( IndexType i1 = i; i1 < i + tileRows; i1++ )
                for( IndexType j1 = j; j1 < j + tileColumns; j1++ )
                   this->setElementFast( i1, j1, 0.0 );
 
-            for( IndexType k = 0; k < matrix1.getColumns(); k += tileDim )
-            {
+            for( IndexType k = 0; k < matrix1.getColumns(); k += tileDim ) {
                const IndexType lastK = min( k + tileDim, matrix1.getColumns() );
                for( IndexType i1 = 0; i1 < tileRows; i1++ )
                   for( IndexType j1 = 0; j1 < tileColumns; j1++ )
                      for( IndexType k1 = k; k1 < lastK; k1++ )
-                        this->addElementFast( i + i1, j + j1,
-                            matrix1.getElementFast( i + i1, k1 ) * matrix2.getElementFast( k1, j + j1 ) );
+                        this->addElementFast(
+                           i + i1, j + j1, matrix1.getElementFast( i + i1, k1 ) * matrix2.getElementFast( k1, j + j1 ) );
             }
          }
-   if( std::is_same< Device, Devices::Cuda >::value )
-   {
+   if( std::is_same< Device, Devices::Cuda >::value ) {
 #ifdef HAVE_CUDA
       /*dim3 cudaBlockSize( 0 ), cudaGridSize( 0 );
       const IndexType matrixProductCudaBlockSize( 256 );
@@ -909,34 +785,28 @@ void DenseMatrixView< Real, Device, Index, Organization >::getMatrixProduct( con
    }
 }
 
-
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Matrix, int tileDim >
-void DenseMatrixView< Real, Device, Index, Organization >::getTransposition( const Matrix& matrix,
-                                                              const RealType& matrixMultiplicator )
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Matrix, int tileDim >
+void
+DenseMatrixView< Real, Device, Index, Organization >::getTransposition( const Matrix& matrix,
+                                                                        const RealType& matrixMultiplicator )
 {
-   TNL_ASSERT( this->getColumns() == matrix.getRows() &&
-              this->getRows() == matrix.getColumns(),
+   TNL_ASSERT( this->getColumns() == matrix.getRows() && this->getRows() == matrix.getColumns(),
                std::cerr << "This matrix columns: " << this->getColumns() << std::endl
-                    << "This matrix rows: " << this->getRows() << std::endl
-                    << "That matrix columns: " << matrix.getColumns() << std::endl
-                    << "That matrix rows: " << matrix.getRows() << std::endl );
+                         << "This matrix rows: " << this->getRows() << std::endl
+                         << "That matrix columns: " << matrix.getColumns() << std::endl
+                         << "That matrix rows: " << matrix.getRows() << std::endl );
 
-   if( std::is_same< Device, Devices::Host >::value )
-   {
+   if( std::is_same< Device, Devices::Host >::value ) {
       const IndexType& rows = matrix.getRows();
       const IndexType& columns = matrix.getColumns();
       for( IndexType i = 0; i < rows; i += tileDim )
          for( IndexType j = 0; j < columns; j += tileDim )
             for( IndexType k = i; k < i + tileDim && k < rows; k++ )
                for( IndexType l = j; l < j + tileDim && l < columns; l++ )
-                  this->setElement( l, k, matrixMultiplicator * matrix. getElement( k, l ) );
+                  this->setElement( l, k, matrixMultiplicator * matrix.getElement( k, l ) );
    }
-   if( std::is_same< Device, Devices::Cuda >::value )
-   {
+   if( std::is_same< Device, Devices::Cuda >::value ) {
 #ifdef HAVE_CUDA
       /*dim3 cudaBlockSize( 0 ), cudaGridSize( 0 );
       const IndexType matrixProductCudaBlockSize( 256 );
@@ -1002,108 +872,81 @@ void DenseMatrixView< Real, Device, Index, Organization >::getTransposition( con
    }
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 DenseMatrixView< Real, Device, Index, Organization >&
-DenseMatrixView< Real, Device, Index, Organization >::
-operator=( const DenseMatrixView& matrix )
+DenseMatrixView< Real, Device, Index, Organization >::operator=( const DenseMatrixView& matrix )
 {
    MatrixView< Real, Device, Index >::operator=( matrix );
    this->segments = matrix.segments;
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Real_, typename Device_, typename Index_ >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Real_, typename Device_, typename Index_ >
 bool
-DenseMatrixView< Real, Device, Index, Organization >::
-operator==( const DenseMatrixView< Real_, Device_, Index_, Organization >& matrix ) const
+DenseMatrixView< Real, Device, Index, Organization >::operator==(
+   const DenseMatrixView< Real_, Device_, Index_, Organization >& matrix ) const
 {
-   return( this->getRows() == matrix.getRows() &&
-           this->getColumns() == matrix.getColumns() &&
-           this->getValues() == matrix.getValues() );
+   return ( this->getRows() == matrix.getRows() && this->getColumns() == matrix.getColumns()
+            && this->getValues() == matrix.getValues() );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Real_, typename Device_, typename Index_ >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Real_, typename Device_, typename Index_ >
 bool
-DenseMatrixView< Real, Device, Index, Organization >::
-operator!=( const DenseMatrixView< Real_, Device_, Index_, Organization >& matrix ) const
+DenseMatrixView< Real, Device, Index, Organization >::operator!=(
+   const DenseMatrixView< Real_, Device_, Index_, Organization >& matrix ) const
 {
    return ! ( *this == matrix );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Matrix >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Matrix >
 bool
-DenseMatrixView< Real, Device, Index, Organization >::
-operator==( const Matrix& m ) const
+DenseMatrixView< Real, Device, Index, Organization >::operator==( const Matrix& m ) const
 {
    const auto& view1 = *this;
    const auto view2 = m.getConstView();
-   auto fetch = [=] __cuda_callable__ ( const IndexType i ) -> bool
+   auto fetch = [ = ] __cuda_callable__( const IndexType i ) -> bool
    {
       return view1.getRow( i ) == view2.getRow( i );
    };
-   return Algorithms::reduce< DeviceType >( ( IndexType ) 0, this->getRows(), fetch, std::logical_and<>{}, true );
+   return Algorithms::reduce< DeviceType >( (IndexType) 0, this->getRows(), fetch, std::logical_and<>{}, true );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Matrix >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Matrix >
 bool
-DenseMatrixView< Real, Device, Index, Organization >::
-operator!=( const Matrix& m ) const
+DenseMatrixView< Real, Device, Index, Organization >::operator!=( const Matrix& m ) const
 {
    return ! ( *this == m );
 }
 
-
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-void DenseMatrixView< Real, Device, Index, Organization >::save( const String& fileName ) const
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+void
+DenseMatrixView< Real, Device, Index, Organization >::save( const String& fileName ) const
 {
    Object::save( fileName );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-void DenseMatrixView< Real, Device, Index, Organization >::save( File& file ) const
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+void
+DenseMatrixView< Real, Device, Index, Organization >::save( File& file ) const
 {
    MatrixView< Real, Device, Index >::save( file );
    this->segments.save( file );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-void DenseMatrixView< Real, Device, Index, Organization >::print( std::ostream& str ) const
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+void
+DenseMatrixView< Real, Device, Index, Organization >::print( std::ostream& str ) const
 {
-   for( IndexType row = 0; row < this->getRows(); row++ )
-   {
-      str <<"Row: " << row << " -> ";
-      for( IndexType column = 0; column < this->getColumns(); column++ )
-      {
+   for( IndexType row = 0; row < this->getRows(); row++ ) {
+      str << "Row: " << row << " -> ";
+      for( IndexType column = 0; column < this->getColumns(); column++ ) {
          std::stringstream str_;
-         str_ << std::setw( 4 ) << std::right << column << ":" << std::setw( 4 ) << std::left << this->getElement( row, column );
+         str_ << std::setw( 4 ) << std::right << column << ":" << std::setw( 4 ) << std::left
+              << this->getElement( row, column );
          str << std::setw( 10 ) << str_.str();
       }
       if( row < this->getRows() - 1 )
@@ -1111,16 +954,13 @@ void DenseMatrixView< Real, Device, Index, Organization >::print( std::ostream&
    }
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
-Index DenseMatrixView< Real, Device, Index, Organization >::getElementIndex( const IndexType row,
-                                                              const IndexType column ) const
+Index
+DenseMatrixView< Real, Device, Index, Organization >::getElementIndex( const IndexType row, const IndexType column ) const
 {
    return this->segments.getGlobalIndex( row, column );
 }
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/DistributedMatrix.h b/src/TNL/Matrices/DistributedMatrix.h
index f8b34a09493562988e590ff355442d16a58f2881..ccc901d9db519ac47d82699772df1a3ea08993bc 100644
--- a/src/TNL/Matrices/DistributedMatrix.h
+++ b/src/TNL/Matrices/DistributedMatrix.h
@@ -35,9 +35,7 @@ public:
    using MatrixRow = typename Matrix::RowView;
    using ConstMatrixRow = typename Matrix::ConstRowView;
 
-   template< typename _Real = RealType,
-             typename _Device = DeviceType,
-             typename _Index = IndexType >
+   template< typename _Real = RealType, typename _Device = DeviceType, typename _Index = IndexType >
    using Self = DistributedMatrix< typename MatrixType::template Self< _Real, _Device, _Index > >;
 
    DistributedMatrix() = default;
@@ -46,147 +44,170 @@ public:
 
    DistributedMatrix( LocalRangeType localRowRange, IndexType rows, IndexType columns, MPI_Comm communicator );
 
-   void setDistribution( LocalRangeType localRowRange, IndexType rows, IndexType columns, MPI_Comm communicator );
+   void
+   setDistribution( LocalRangeType localRowRange, IndexType rows, IndexType columns, MPI_Comm communicator );
 
-   const LocalRangeType& getLocalRowRange() const;
+   const LocalRangeType&
+   getLocalRowRange() const;
 
-   MPI_Comm getCommunicator() const;
+   MPI_Comm
+   getCommunicator() const;
 
-   const Matrix& getLocalMatrix() const;
-
-   Matrix& getLocalMatrix();
+   const Matrix&
+   getLocalMatrix() const;
 
+   Matrix&
+   getLocalMatrix();
 
    /*
     * Some common Matrix methods follow below.
     */
 
-   DistributedMatrix& operator=( const DistributedMatrix& matrix );
+   DistributedMatrix&
+   operator=( const DistributedMatrix& matrix );
 
    template< typename MatrixT >
-   DistributedMatrix& operator=( const MatrixT& matrix );
+   DistributedMatrix&
+   operator=( const MatrixT& matrix );
 
    template< typename MatrixT >
-   void setLike( const MatrixT& matrix );
+   void
+   setLike( const MatrixT& matrix );
 
-   void reset();
+   void
+   reset();
 
-   IndexType getRows() const;
+   IndexType
+   getRows() const;
 
-   IndexType getColumns() const;
+   IndexType
+   getColumns() const;
 
    template< typename RowCapacitiesVector >
-   void setRowCapacities( const RowCapacitiesVector& rowCapacities );
+   void
+   setRowCapacities( const RowCapacitiesVector& rowCapacities );
 
    template< typename Vector >
-   void getCompressedRowLengths( Vector& rowLengths ) const;
+   void
+   getCompressedRowLengths( Vector& rowLengths ) const;
 
-   IndexType getRowCapacity( IndexType row ) const;
+   IndexType
+   getRowCapacity( IndexType row ) const;
 
-   void setElement( IndexType row,
-                    IndexType column,
-                    RealType value );
+   void
+   setElement( IndexType row, IndexType column, RealType value );
 
-   RealType getElement( IndexType row,
-                        IndexType column ) const;
+   RealType
+   getElement( IndexType row, IndexType column ) const;
 
-   RealType getElementFast( IndexType row,
-                            IndexType column ) const;
+   RealType
+   getElementFast( IndexType row, IndexType column ) const;
 
-   MatrixRow getRow( IndexType row );
+   MatrixRow
+   getRow( IndexType row );
 
-   ConstMatrixRow getRow( IndexType row ) const;
+   ConstMatrixRow
+   getRow( IndexType row ) const;
 
    // multiplication with a global vector
-   template< typename InVector,
-             typename OutVector >
+   template< typename InVector, typename OutVector >
    typename std::enable_if< ! HasGetCommunicatorMethod< InVector >::value >::type
-   vectorProduct( const InVector& inVector,
-                  OutVector& outVector ) const;
+   vectorProduct( const InVector& inVector, OutVector& outVector ) const;
 
    // Optimization for distributed matrix-vector multiplication
-   void updateVectorProductCommunicationPattern();
+   void
+   updateVectorProductCommunicationPattern();
 
    // multiplication with a distributed vector
    // (not const because it modifies internal bufers)
-   template< typename InVector,
-             typename OutVector >
+   template< typename InVector, typename OutVector >
    typename std::enable_if< HasGetCommunicatorMethod< InVector >::value >::type
-   vectorProduct( const InVector& inVector,
-                  OutVector& outVector ) const;
+   vectorProduct( const InVector& inVector, OutVector& outVector ) const;
 
    // TODO
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity )
-      {
-         throw Exceptions::NotImplementedError( "reduceRows is not implemented in DistributedMatrix" );
-      }
-
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const
-      {
-         throw Exceptions::NotImplementedError( "reduceRows is not implemented in DistributedMatrix" );
-      }
-
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity )
-      {
-         throw Exceptions::NotImplementedError( "reduceAllRows is not implemented in DistributedMatrix" );
-      }
-
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const
-      {
-         throw Exceptions::NotImplementedError( "reduceAllRows is not implemented in DistributedMatrix" );
-      }
-
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function&& function ) const
-      {
-         throw Exceptions::NotImplementedError( "forElements is not implemented in DistributedMatrix" );
-      }
-
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function&& function )
-      {
-         throw Exceptions::NotImplementedError( "forElements is not implemented in DistributedMatrix" );
-      }
-
-      template< typename Function >
-      void forAllElements( Function&& function ) const
-      {
-         throw Exceptions::NotImplementedError( "forAllElements is not implemented in DistributedMatrix" );
-      }
-
-      template< typename Function >
-      void forAllElements( Function&& function )
-      {
-         throw Exceptions::NotImplementedError( "forAllElements is not implemented in DistributedMatrix" );
-      }
-
-      template< typename Function >
-      void forRows( IndexType begin, IndexType end, Function&& function )
-      {
-         throw Exceptions::NotImplementedError( "forRows is not implemented in DistributedMatrix" );
-      }
-
-      template< typename Function >
-      void forRows( IndexType begin, IndexType end, Function&& function ) const
-      {
-         throw Exceptions::NotImplementedError( "forRows is not implemented in DistributedMatrix" );
-      }
-
-      template< typename Function >
-      void forAllRows( Function&& function )
-      {
-         throw Exceptions::NotImplementedError( "forAllRows is not implemented in DistributedMatrix" );
-      }
-
-      template< typename Function >
-      void forAllRows( Function&& function ) const
-      {
-         throw Exceptions::NotImplementedError( "forAllRows is not implemented in DistributedMatrix" );
-      }
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity )
+   {
+      throw Exceptions::NotImplementedError( "reduceRows is not implemented in DistributedMatrix" );
+   }
+
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const
+   {
+      throw Exceptions::NotImplementedError( "reduceRows is not implemented in DistributedMatrix" );
+   }
+
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity )
+   {
+      throw Exceptions::NotImplementedError( "reduceAllRows is not implemented in DistributedMatrix" );
+   }
+
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const
+   {
+      throw Exceptions::NotImplementedError( "reduceAllRows is not implemented in DistributedMatrix" );
+   }
+
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function&& function ) const
+   {
+      throw Exceptions::NotImplementedError( "forElements is not implemented in DistributedMatrix" );
+   }
+
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function&& function )
+   {
+      throw Exceptions::NotImplementedError( "forElements is not implemented in DistributedMatrix" );
+   }
+
+   template< typename Function >
+   void
+   forAllElements( Function&& function ) const
+   {
+      throw Exceptions::NotImplementedError( "forAllElements is not implemented in DistributedMatrix" );
+   }
+
+   template< typename Function >
+   void
+   forAllElements( Function&& function )
+   {
+      throw Exceptions::NotImplementedError( "forAllElements is not implemented in DistributedMatrix" );
+   }
+
+   template< typename Function >
+   void
+   forRows( IndexType begin, IndexType end, Function&& function )
+   {
+      throw Exceptions::NotImplementedError( "forRows is not implemented in DistributedMatrix" );
+   }
+
+   template< typename Function >
+   void
+   forRows( IndexType begin, IndexType end, Function&& function ) const
+   {
+      throw Exceptions::NotImplementedError( "forRows is not implemented in DistributedMatrix" );
+   }
+
+   template< typename Function >
+   void
+   forAllRows( Function&& function )
+   {
+      throw Exceptions::NotImplementedError( "forAllRows is not implemented in DistributedMatrix" );
+   }
+
+   template< typename Function >
+   void
+   forAllRows( Function&& function ) const
+   {
+      throw Exceptions::NotImplementedError( "forAllRows is not implemented in DistributedMatrix" );
+   }
 
 protected:
    LocalRangeType localRowRange;
@@ -195,7 +216,7 @@ protected:
    Matrix localMatrix;
 };
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
 
 #include "DistributedMatrix_impl.h"
diff --git a/src/TNL/Matrices/DistributedMatrix_impl.h b/src/TNL/Matrices/DistributedMatrix_impl.h
index 5798eb985df764a05fc983e0d1fbe7a5787ce273..f48124946b4d88b4fb70db4a3321f1fd2a1ba32f 100644
--- a/src/TNL/Matrices/DistributedMatrix_impl.h
+++ b/src/TNL/Matrices/DistributedMatrix_impl.h
@@ -14,16 +14,20 @@ namespace TNL {
 namespace Matrices {
 
 template< typename Matrix >
-DistributedMatrix< Matrix >::
-DistributedMatrix( LocalRangeType localRowRange, IndexType rows, IndexType columns, MPI_Comm communicator )
+DistributedMatrix< Matrix >::DistributedMatrix( LocalRangeType localRowRange,
+                                                IndexType rows,
+                                                IndexType columns,
+                                                MPI_Comm communicator )
 {
    setDistribution( localRowRange, rows, columns, communicator );
 }
 
 template< typename Matrix >
 void
-DistributedMatrix< Matrix >::
-setDistribution( LocalRangeType localRowRange, IndexType rows, IndexType columns, MPI_Comm communicator )
+DistributedMatrix< Matrix >::setDistribution( LocalRangeType localRowRange,
+                                              IndexType rows,
+                                              IndexType columns,
+                                              MPI_Comm communicator )
 {
    this->localRowRange = localRowRange;
    this->rows = rows;
@@ -34,45 +38,39 @@ setDistribution( LocalRangeType localRowRange, IndexType rows, IndexType columns
 
 template< typename Matrix >
 const Containers::Subrange< typename Matrix::IndexType >&
-DistributedMatrix< Matrix >::
-getLocalRowRange() const
+DistributedMatrix< Matrix >::getLocalRowRange() const
 {
    return localRowRange;
 }
 
 template< typename Matrix >
 MPI_Comm
-DistributedMatrix< Matrix >::
-getCommunicator() const
+DistributedMatrix< Matrix >::getCommunicator() const
 {
    return communicator;
 }
 
 template< typename Matrix >
 const Matrix&
-DistributedMatrix< Matrix >::
-getLocalMatrix() const
+DistributedMatrix< Matrix >::getLocalMatrix() const
 {
    return localMatrix;
 }
 
 template< typename Matrix >
 Matrix&
-DistributedMatrix< Matrix >::
-getLocalMatrix()
+DistributedMatrix< Matrix >::getLocalMatrix()
 {
    return localMatrix;
 }
 
-
 /*
  * Some common Matrix methods follow below.
  */
 
 template< typename Matrix >
 DistributedMatrix< Matrix >&
-DistributedMatrix< Matrix >::
-operator=( const DistributedMatrix& matrix )
+DistributedMatrix< Matrix >::operator=( const DistributedMatrix& matrix )
 {
    setLike( matrix );
    localMatrix = matrix.getLocalMatrix();
@@ -80,10 +78,9 @@ operator=( const DistributedMatrix& matrix )
 }
 
 template< typename Matrix >
-   template< typename MatrixT >
+template< typename MatrixT >
 DistributedMatrix< Matrix >&
-DistributedMatrix< Matrix >::
-operator=( const MatrixT& matrix )
+DistributedMatrix< Matrix >::operator=( const MatrixT& matrix )
 {
    setLike( matrix );
    localMatrix = matrix.getLocalMatrix();
@@ -91,10 +88,9 @@ operator=( const MatrixT& matrix )
 }
 
 template< typename Matrix >
-   template< typename MatrixT >
+template< typename MatrixT >
 void
-DistributedMatrix< Matrix >::
-setLike( const MatrixT& matrix )
+DistributedMatrix< Matrix >::setLike( const MatrixT& matrix )
 {
    localRowRange = matrix.getLocalRowRange();
    rows = matrix.getRows();
@@ -104,8 +100,7 @@ setLike( const MatrixT& matrix )
 
 template< typename Matrix >
 void
-DistributedMatrix< Matrix >::
-reset()
+DistributedMatrix< Matrix >::reset()
 {
    localRowRange.reset();
    rows = 0;
@@ -115,25 +110,22 @@ reset()
 
 template< typename Matrix >
 typename Matrix::IndexType
-DistributedMatrix< Matrix >::
-getRows() const
+DistributedMatrix< Matrix >::getRows() const
 {
    return rows;
 }
 
 template< typename Matrix >
 typename Matrix::IndexType
-DistributedMatrix< Matrix >::
-getColumns() const
+DistributedMatrix< Matrix >::getColumns() const
 {
    return localMatrix.getColumns();
 }
 
 template< typename Matrix >
-   template< typename RowCapacitiesVector >
+template< typename RowCapacitiesVector >
 void
-DistributedMatrix< Matrix >::
-setRowCapacities( const RowCapacitiesVector& rowCapacities )
+DistributedMatrix< Matrix >::setRowCapacities( const RowCapacitiesVector& rowCapacities )
 {
    TNL_ASSERT_EQ( rowCapacities.getSize(), getRows(), "row lengths vector has wrong size" );
    TNL_ASSERT_EQ( rowCapacities.getLocalRange(), getLocalRowRange(), "row lengths vector has wrong distribution" );
@@ -145,10 +137,9 @@ setRowCapacities( const RowCapacitiesVector& rowCapacities )
 }
 
 template< typename Matrix >
-   template< typename Vector >
+template< typename Vector >
 void
-DistributedMatrix< Matrix >::
-getCompressedRowLengths( Vector& rowLengths ) const
+DistributedMatrix< Matrix >::getCompressedRowLengths( Vector& rowLengths ) const
 {
    if( getCommunicator() != MPI_COMM_NULL ) {
       rowLengths.setDistribution( getLocalRowRange(), 0, getRows(), getCommunicator() );
@@ -159,8 +150,7 @@ getCompressedRowLengths( Vector& rowLengths ) const
 
 template< typename Matrix >
 typename Matrix::IndexType
-DistributedMatrix< Matrix >::
-getRowCapacity( IndexType row ) const
+DistributedMatrix< Matrix >::getRowCapacity( IndexType row ) const
 {
    const IndexType localRow = localRowRange.getLocalIndex( row );
    return localMatrix.getRowCapacity( localRow );
@@ -168,10 +158,7 @@ getRowCapacity( IndexType row ) const
 
 template< typename Matrix >
 void
-DistributedMatrix< Matrix >::
-setElement( IndexType row,
-            IndexType column,
-            RealType value )
+DistributedMatrix< Matrix >::setElement( IndexType row, IndexType column, RealType value )
 {
    const IndexType localRow = localRowRange.getLocalIndex( row );
    localMatrix.setElement( localRow, column, value );
@@ -179,9 +166,7 @@ setElement( IndexType row,
 
 template< typename Matrix >
 typename Matrix::RealType
-DistributedMatrix< Matrix >::
-getElement( IndexType row,
-            IndexType column ) const
+DistributedMatrix< Matrix >::getElement( IndexType row, IndexType column ) const
 {
    const IndexType localRow = localRowRange.getLocalIndex( row );
    return localMatrix.getElement( localRow, column );
@@ -189,9 +174,7 @@ getElement( IndexType row,
 
 template< typename Matrix >
 typename Matrix::RealType
-DistributedMatrix< Matrix >::
-getElementFast( IndexType row,
-                IndexType column ) const
+DistributedMatrix< Matrix >::getElementFast( IndexType row, IndexType column ) const
 {
    const IndexType localRow = localRowRange.getLocalIndex( row );
    return localMatrix.getElementFast( localRow, column );
@@ -199,8 +182,7 @@ getElementFast( IndexType row,
 
 template< typename Matrix >
 typename DistributedMatrix< Matrix >::MatrixRow
-DistributedMatrix< Matrix >::
-getRow( IndexType row )
+DistributedMatrix< Matrix >::getRow( IndexType row )
 {
    const IndexType localRow = localRowRange.getLocalIndex( row );
    return localMatrix.getRow( localRow );
@@ -208,20 +190,16 @@ getRow( IndexType row )
 
 template< typename Matrix >
 typename DistributedMatrix< Matrix >::ConstMatrixRow
-DistributedMatrix< Matrix >::
-getRow( IndexType row ) const
+DistributedMatrix< Matrix >::getRow( IndexType row ) const
 {
    const IndexType localRow = localRowRange.getLocalIndex( row );
    return localMatrix.getRow( localRow );
 }
 
 template< typename Matrix >
-   template< typename InVector,
-             typename OutVector >
+template< typename InVector, typename OutVector >
 typename std::enable_if< ! HasGetCommunicatorMethod< InVector >::value >::type
-DistributedMatrix< Matrix >::
-vectorProduct( const InVector& inVector,
-               OutVector& outVector ) const
+DistributedMatrix< Matrix >::vectorProduct( const InVector& inVector, OutVector& outVector ) const
 {
    TNL_ASSERT_EQ( inVector.getSize(), getColumns(), "input vector has wrong size" );
    TNL_ASSERT_EQ( outVector.getSize(), getRows(), "output vector has wrong size" );
@@ -233,12 +211,9 @@ vectorProduct( const InVector& inVector,
 }
 
 template< typename Matrix >
-   template< typename InVector,
-             typename OutVector >
+template< typename InVector, typename OutVector >
 typename std::enable_if< HasGetCommunicatorMethod< InVector >::value >::type
-DistributedMatrix< Matrix >::
-vectorProduct( const InVector& inVector,
-               OutVector& outVector ) const
+DistributedMatrix< Matrix >::vectorProduct( const InVector& inVector, OutVector& outVector ) const
 {
    TNL_ASSERT_EQ( inVector.getLocalRange(), getLocalRowRange(), "input vector has wrong distribution" );
    TNL_ASSERT_EQ( inVector.getCommunicator(), getCommunicator(), "input vector has wrong communicator" );
@@ -249,18 +224,24 @@ vectorProduct( const InVector& inVector,
    if( getCommunicator() == MPI_COMM_NULL )
       return;
 
-   TNL_ASSERT_EQ( inVector.getConstLocalViewWithGhosts().getSize(), localMatrix.getColumns(), "the matrix uses non-local and non-ghost column indices" );
-   TNL_ASSERT_EQ( inVector.getGhosts(), localMatrix.getColumns() - localMatrix.getRows(), "input vector has wrong ghosts size" );
-   TNL_ASSERT_EQ( outVector.getGhosts(), localMatrix.getColumns() - localMatrix.getRows(), "output vector has wrong ghosts size" );
-   TNL_ASSERT_EQ( outVector.getConstLocalView().getSize(), localMatrix.getRows(), "number of local matrix rows does not match the output vector local size" );
+   TNL_ASSERT_EQ( inVector.getConstLocalViewWithGhosts().getSize(),
+                  localMatrix.getColumns(),
+                  "the matrix uses non-local and non-ghost column indices" );
+   TNL_ASSERT_EQ(
+      inVector.getGhosts(), localMatrix.getColumns() - localMatrix.getRows(), "input vector has wrong ghosts size" );
+   TNL_ASSERT_EQ(
+      outVector.getGhosts(), localMatrix.getColumns() - localMatrix.getRows(), "output vector has wrong ghosts size" );
+   TNL_ASSERT_EQ( outVector.getConstLocalView().getSize(),
+                  localMatrix.getRows(),
+                  "number of local matrix rows does not match the output vector local size" );
 
    inVector.waitForSynchronization();
    const auto inView = inVector.getConstLocalViewWithGhosts();
    auto outView = outVector.getLocalView();
    localMatrix.vectorProduct( inView, outView );
    // TODO: synchronization is not always necessary, e.g. when a preconditioning step follows
-//   outVector.startSynchronization();
+   //   outVector.startSynchronization();
 }
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/LambdaMatrix.h b/src/TNL/Matrices/LambdaMatrix.h
index b24fae4e04fb09a0a5945257613ba910f4fc46e2..c6081eb39dca8c587b8ba0a420825716467082f2 100644
--- a/src/TNL/Matrices/LambdaMatrix.h
+++ b/src/TNL/Matrices/LambdaMatrix.h
@@ -27,13 +27,14 @@ namespace Matrices {
  * It has the following form:
  *
  * ```
- * auto matrixElements = [] __cuda_callable__ ( Index rows, Index columns, Index rowIdx, Index localIdx, Index& columnIdx, Real& value ) { ... }
+ * auto matrixElements = [] __cuda_callable__ ( Index rows, Index columns, Index rowIdx, Index localIdx, Index& columnIdx, Real&
+ * value ) { ... }
  * ```
  *
- *    where \e rows is the number of matrix rows, \e columns is the number of matrix columns, \e rowIdx is the index of matrix row being queried,
- *    \e localIdx is the rank of the non-zero element in given row, \e columnIdx is a column index of the matrix element computed by
- *    this lambda and \e value is a value of the matrix element computed by this lambda.
- * \tparam CompressedRowLengthsLambda is a lambda function returning a number of non-zero elements in each row.
+ *    where \e rows is the number of matrix rows, \e columns is the number of matrix columns, \e rowIdx is the index of matrix
+ * row being queried, \e localIdx is the rank of the non-zero element in given row, \e columnIdx is a column index of the matrix
+ * element computed by this lambda and \e value is a value of the matrix element computed by this lambda. \tparam
+ * CompressedRowLengthsLambda is a lambda function returning a number of non-zero elements in each row.
  *
  * It has the following form:
  *
@@ -41,7 +42,8 @@ namespace Matrices {
  * auto rowLengths = [] __cuda_callable__ ( Index rows, Index columns, Index rowIdx ) -> IndexType { ...  }
  * ```
  *
- *    where \e rows is the number of matrix rows, \e columns is the number of matrix columns and \e rowIdx is an index of the row being queried.
+ *    where \e rows is the number of matrix rows, \e columns is the number of matrix columns and \e rowIdx is an index of the
+ * row being queried.
  *
  * \tparam Real is a type of matrix elements values.
  * \tparam Device is a device on which the lambda functions will be evaluated.
@@ -54,452 +56,475 @@ template< typename MatrixElementsLambda,
           typename Index = int >
 class LambdaMatrix
 {
-   public:
-
-      /**
-       * \brief The type of matrix elements.
-       */
-      using RealType = Real;
-
-      /**
-       * \brief The device where the matrix is allocated.
-       */
-      using DeviceType = Device;
-
-      /**
-       * \brief The type used for matrix elements indexing.
-       */
-      using IndexType = Index;
-
-      /**
-       * \brief Type of the lambda function returning the matrix elements.
-       */
-      using MatrixElementsLambdaType = MatrixElementsLambda;
-
-      /**
-       * \brief Type of the lambda function returning the number of non-zero elements in each row.
-       */
-      using CompressedRowLengthsLambdaType = CompressedRowLengthsLambda;
-
-      /**
-       * \brief Type of Lambda matrix row view.
-       */
-      using RowView = LambdaMatrixRowView< MatrixElementsLambdaType, CompressedRowLengthsLambdaType, RealType, IndexType >;
-
-      /**
-       * \brief Type of constant Lambda matrix row view.
-       */
-      using ConstRowView = RowView;
-
-      static constexpr bool isSymmetric() { return false; };
-      static constexpr bool isBinary() { return false; };
-
-      /**
-       * \brief Constructor with lambda functions defining the matrix elements.
-       *
-       * Note: It might be difficult to express the types of the lambdas. For easier creation of
-       * \e LambdaMatrix you may use \ref LambdaMatrixFactory.
-       *
-       * \param matrixElements is a lambda function giving matrix elements position and value.
-       * \param compressedRowLentghs is a lambda function returning how many non-zero matrix elements are in given row.
-       *
-       * \par Example
-       * \include Matrices/LambdaMatrix/LambdaMatrixExample_Constructor.cpp
-       * \par Output
-       * \include LambdaMatrixExample_Constructor.out
-       */
-      LambdaMatrix( MatrixElementsLambda& matrixElements,
-                    CompressedRowLengthsLambda& compressedRowLentghs );
-
-      /**
-       * \brief Constructor with matrix dimensions and lambda functions defining the matrix elements.
-       *
-       * Note: It might be difficult to express the types of the lambdas. For easier creation of
-       * \e LambdaMatrix you may use \ref LambdaMatrixFactory.
-       *
-       * \param rows is a number of the matrix rows.
-       * \param columns is a number of the matrix columns.
-       * \param matrixElements is a lambda function giving matrix elements position and value.
-       * \param compressedRowLentghs is a lambda function returning how many non-zero matrix elements are in given row.
-       *
-       * \par Example
-       * \include Matrices/LambdaMatrix/LambdaMatrixExample_Constructor.cpp
-       * \par Output
-       * \include LambdaMatrixExample_Constructor.out
-       */
-      LambdaMatrix( const IndexType& rows,
-                    const IndexType& columns,
-                    MatrixElementsLambda& matrixElements,
-                    CompressedRowLengthsLambda& compressedRowLentghs );
-
-      /**
-       * \brief Copy constructor.
-       *
-       * \param matrix is input matrix.
-       */
-      LambdaMatrix( const LambdaMatrix& matrix ) = default;
-
-      /**
-       * \brief Move constructor.
-       *
-       * \param matrix is input matrix.
-       */
-      LambdaMatrix( LambdaMatrix&& matrix ) = default;
-
-      /**
-       * \brief Set number of rows and columns of this matrix.
-       *
-       * \param rows is the number of matrix rows.
-       * \param columns is the number of matrix columns.
-       */
-      void setDimensions( const IndexType& rows,
-                          const IndexType& columns );
-
-      /**
-       * \brief Returns a number of matrix rows.
-       *
-       * \return number of matrix rows.
-       */
-      __cuda_callable__
-      IndexType getRows() const;
-
-      /**
-       * \brief Returns a number of matrix columns.
-       *
-       * \return number of matrix columns.
-       */
-      __cuda_callable__
-      IndexType getColumns() const;
-
-      /**
-       * \brief Get reference to the lambda function returning number of non-zero elements in each row.
-       *
-       * \return constant reference to CompressedRowLengthsLambda.
-       */
-      __cuda_callable__
-      const CompressedRowLengthsLambda& getCompressedRowLengthsLambda() const;
-
-      /**
-       * \brief Get reference to the lambda function returning the matrix elements values and column indexes.
-       *
-       * \return constant reference to MatrixElementsLambda.
-       */
-      __cuda_callable__
-      const MatrixElementsLambda& getMatrixElementsLambda() const;
-
-      /**
-       * \brief Compute capacities of all rows.
-       *
-       * The row capacities are not stored explicitly and must be computed.
-       *
-       * \param rowCapacities is a vector where the row capacities will be stored.
-       */
-      template< typename Vector >
-      void getRowCapacities( Vector& rowCapacities ) const;
-
-      /**
-       * \brief Computes number of non-zeros in each row.
-       *
-       * \param rowLengths is a vector into which the number of non-zeros in each row
-       * will be stored.
-       *
-       * \par Example
-       * \include Matrices/LambdaMatrix/LambdaMatrixExample_getCompressedRowLengths.cpp
-       * \par Output
-       * \include LambdaMatrixExample_getCompressedRowLengths.out
-       */
-      template< typename RowLentghsVector >
-      void getCompressedRowLengths( RowLentghsVector& rowLengths ) const;
-
-      /**
-       * \brief Returns number of non-zero matrix elements.
-       *
-       * \return number of all non-zero matrix elements.
-       *
-       * \par Example
-       * \include Matrices/LambdaMatrix/LambdaMatrixExample_getElementsCount.cpp
-       * \par Output
-       * \include LambdaMatrixExample_getElementsCount.out
-       */
-      IndexType getNonzeroElementsCount() const;
-
-      /**
-       * \brief Getter of simple structure for accessing given matrix row.
-       *
-       * \param rowIdx is matrix row index.
-       *
-       * \return RowView for accessing given matrix row.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/LambdaMatrixExample_getRow.cpp
-       * \par Output
-       * \include LambdaMatrixExample_getRow.out
-       *
-       * See \ref LambdaMatrixRowView.
-       */
-      __cuda_callable__
-      const RowView getRow( const IndexType& rowIdx ) const;
-
-      /**
-       * \brief Returns value of matrix element at position given by its row and column index.
-       *
-       * \param row is a row index of the matrix element.
-       * \param column i a column index of the matrix element.
-       *
-       * \return value of given matrix element.
-       */
-      RealType getElement( const IndexType row,
-                           const IndexType column ) const;
-
-      /**
-       * \brief Method for iteration over all matrix rows for constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements.
-       *    It is should have form like
-       *
-       * ```
-       * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value ) { ... };
-       * ```
-       *
-       *  The column index repeats twice only for compatibility with sparse matrices.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/LambdaMatrix/LambdaMatrixExample_forRows.cpp
-       * \par Output
-       * \include LambdaMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function& function ) const;
-
-      /**
-       * \brief This method calls \e forElements for all matrix rows (for constant instances).
-       *
-       * See \ref LambdaMatrix::forElements.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/LambdaMatrix/LambdaMatrixExample_forAllRows.cpp
-       * \par Output
-       * \include LambdaMatrixExample_forAllRows.out
-       */
-      template< typename Function >
-      void forAllElements( Function& function ) const;
-
-      /**
-       * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end) for constant instances.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref LambdaMatrix::forElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::LambdaMatrix::RowView.
-       *
-       * \par Example
-       * \include Matrices/LambdaMatrix/LambdaMatrixExample_forRows.cpp
-       * \par Output
-       * \include LambdaMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forRows( IndexType begin, IndexType end, Function&& function ) const;
-
-      /**
-       * \brief Method for parallel iteration over all matrix rows for constant instances.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref LambdaMatrix::forAllElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::LambdaMatrix::RowView.
-       *
-       * \par Example
-       * \include Matrices/LambdaMatrix/LambdaMatrixExample_forRows.cpp
-       * \par Output
-       * \include LambdaMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forAllRows( Function&& function ) const;
-
-      /**
-       * \brief Method for sequential iteration over all matrix rows for constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements.
-       *    It is should have form like
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::LambdaMatrix::RowView.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForRows( IndexType begin, IndexType end, Function&& function ) const;
-
-      /**
-       * \brief This method calls \e sequentialForRows for all matrix rows (for constant instances).
-       *
-       * See \ref LambdaMatrix::sequentialForRows.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForAllRows( Function&& function ) const;
-
-      /**
-       * \brief Method for performing general reduction on matrix rows.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, RealType elementValue ) -> FetchValue
-       * ```
-       *
-       *  The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callbale__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row.
-       *    It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value )
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param begin defines beginning of the range [\e begin, \e end) of rows to be processed.
-       * \param end defines ending of the range [\e begin,\e end) of rows to be processed.
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/LambdaMatrix/LambdaMatrixExample_reduceRows.cpp
-       * \par Output
-       * \include LambdaMatrixExample_reduceRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& zero ) const;
-
-      /**
-       * \brief Method for performing general reduction on ALL matrix rows.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, RealType elementValue ) -> FetchValue
-       * ```
-       *
-       *  The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row.
-       *   It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value )
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/LambdaMatrix/LambdaMatrixExample_reduceAllRows.cpp
-       * \par Output
-       * \include LambdaMatrixExample_reduceAllRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const;
-
-      /**
-       * \brief Computes product of matrix and vector.
-       *
-       * More precisely, it computes:
-       *
-       * ```
-       * outVector = matrixMultiplicator * ( *this ) * inVector + outVectorMultiplicator * outVector
-       * ```
-       *
-       * \tparam InVector is type of input vector.  It can be \ref Vector,
-       *     \ref VectorView, \ref Array, \ref ArraView or similar container.
-       * \tparam OutVector is type of output vector. It can be \ref Vector,
-       *     \ref VectorView, \ref Array, \ref ArraView or similar container.
-       *
-       * \param inVector is input vector.
-       * \param outVector is output vector.
-       * \param matrixMultiplicator is a factor by which the matrix is multiplied. It is one by default.
-       * \param outVectorMultiplicator is a factor by which the outVector is multiplied before added
-       *    to the result of matrix-vector product. It is zero by default.
-       * \param begin is the beginning of the rows range for which the vector product
-       *    is computed. It is zero by default.
-       * \param end is the end of the rows range for which the vector product
-       *    is computed. It is number if the matrix rows by default.
-       */
-      template< typename InVector,
-                typename OutVector >
-      void vectorProduct( const InVector& inVector,
-                          OutVector& outVector,
-                          const RealType& matrixMultiplicator = 1.0,
-                          const RealType& outVectorMultiplicator = 0.0,
-                          const IndexType begin = 0,
-                          IndexType end = 0 ) const;
-
-      /**
-       * \brief Method for printing the matrix to output stream.
-       *
-       * \param str is the output stream.
-       */
-      void print( std::ostream& str ) const;
-
-   protected:
-
-      IndexType rows, columns;
-
-      MatrixElementsLambda matrixElementsLambda;
-
-      CompressedRowLengthsLambda compressedRowLengthsLambda;
+public:
+   /**
+    * \brief The type of matrix elements.
+    */
+   using RealType = Real;
+
+   /**
+    * \brief The device where the matrix is allocated.
+    */
+   using DeviceType = Device;
+
+   /**
+    * \brief The type used for matrix elements indexing.
+    */
+   using IndexType = Index;
+
+   /**
+    * \brief Type of the lambda function returning the matrix elements.
+    */
+   using MatrixElementsLambdaType = MatrixElementsLambda;
+
+   /**
+    * \brief Type of the lambda function returning the number of non-zero elements in each row.
+    */
+   using CompressedRowLengthsLambdaType = CompressedRowLengthsLambda;
+
+   /**
+    * \brief Type of Lambda matrix row view.
+    */
+   using RowView = LambdaMatrixRowView< MatrixElementsLambdaType, CompressedRowLengthsLambdaType, RealType, IndexType >;
+
+   /**
+    * \brief Type of constant Lambda matrix row view.
+    */
+   using ConstRowView = RowView;
+
+   static constexpr bool
+   isSymmetric()
+   {
+      return false;
+   };
+   static constexpr bool
+   isBinary()
+   {
+      return false;
+   };
+
+   /**
+    * \brief Constructor with lambda functions defining the matrix elements.
+    *
+    * Note: It might be difficult to express the types of the lambdas. For easier creation of
+    * \e LambdaMatrix you may use \ref LambdaMatrixFactory.
+    *
+    * \param matrixElements is a lambda function giving matrix elements position and value.
+    * \param compressedRowLentghs is a lambda function returning how many non-zero matrix elements are in given row.
+    *
+    * \par Example
+    * \include Matrices/LambdaMatrix/LambdaMatrixExample_Constructor.cpp
+    * \par Output
+    * \include LambdaMatrixExample_Constructor.out
+    */
+   LambdaMatrix( MatrixElementsLambda& matrixElements, CompressedRowLengthsLambda& compressedRowLentghs );
+
+   /**
+    * \brief Constructor with matrix dimensions and lambda functions defining the matrix elements.
+    *
+    * Note: It might be difficult to express the types of the lambdas. For easier creation of
+    * \e LambdaMatrix you may use \ref LambdaMatrixFactory.
+    *
+    * \param rows is a number of the matrix rows.
+    * \param columns is a number of the matrix columns.
+    * \param matrixElements is a lambda function giving matrix elements position and value.
+    * \param compressedRowLentghs is a lambda function returning how many non-zero matrix elements are in given row.
+    *
+    * \par Example
+    * \include Matrices/LambdaMatrix/LambdaMatrixExample_Constructor.cpp
+    * \par Output
+    * \include LambdaMatrixExample_Constructor.out
+    */
+   LambdaMatrix( const IndexType& rows,
+                 const IndexType& columns,
+                 MatrixElementsLambda& matrixElements,
+                 CompressedRowLengthsLambda& compressedRowLentghs );
+
+   /**
+    * \brief Copy constructor.
+    *
+    * \param matrix is input matrix.
+    */
+   LambdaMatrix( const LambdaMatrix& matrix ) = default;
+
+   /**
+    * \brief Move constructor.
+    *
+    * \param matrix is input matrix.
+    */
+   LambdaMatrix( LambdaMatrix&& matrix ) = default;
+
+   /**
+    * \brief Set number of rows and columns of this matrix.
+    *
+    * \param rows is the number of matrix rows.
+    * \param columns is the number of matrix columns.
+    */
+   void
+   setDimensions( const IndexType& rows, const IndexType& columns );
+
+   /**
+    * \brief Returns a number of matrix rows.
+    *
+    * \return number of matrix rows.
+    */
+   __cuda_callable__
+   IndexType
+   getRows() const;
+
+   /**
+    * \brief Returns a number of matrix columns.
+    *
+    * \return number of matrix columns.
+    */
+   __cuda_callable__
+   IndexType
+   getColumns() const;
+
+   /**
+    * \brief Get reference to the lambda function returning number of non-zero elements in each row.
+    *
+    * \return constant reference to CompressedRowLengthsLambda.
+    */
+   __cuda_callable__
+   const CompressedRowLengthsLambda&
+   getCompressedRowLengthsLambda() const;
+
+   /**
+    * \brief Get reference to the lambda function returning the matrix elements values and column indexes.
+    *
+    * \return constant reference to MatrixElementsLambda.
+    */
+   __cuda_callable__
+   const MatrixElementsLambda&
+   getMatrixElementsLambda() const;
+
+   /**
+    * \brief Compute capacities of all rows.
+    *
+    * The row capacities are not stored explicitly and must be computed.
+    *
+    * \param rowCapacities is a vector where the row capacities will be stored.
+    */
+   template< typename Vector >
+   void
+   getRowCapacities( Vector& rowCapacities ) const;
+
+   /**
+    * \brief Computes number of non-zeros in each row.
+    *
+    * \param rowLengths is a vector into which the number of non-zeros in each row
+    * will be stored.
+    *
+    * \par Example
+    * \include Matrices/LambdaMatrix/LambdaMatrixExample_getCompressedRowLengths.cpp
+    * \par Output
+    * \include LambdaMatrixExample_getCompressedRowLengths.out
+    */
+   template< typename RowLentghsVector >
+   void
+   getCompressedRowLengths( RowLentghsVector& rowLengths ) const;
+
+   /**
+    * \brief Returns number of non-zero matrix elements.
+    *
+    * \return number of all non-zero matrix elements.
+    *
+    * \par Example
+    * \include Matrices/LambdaMatrix/LambdaMatrixExample_getElementsCount.cpp
+    * \par Output
+    * \include LambdaMatrixExample_getElementsCount.out
+    */
+   IndexType
+   getNonzeroElementsCount() const;
+
+   /**
+    * \brief Getter of simple structure for accessing given matrix row.
+    *
+    * \param rowIdx is matrix row index.
+    *
+    * \return RowView for accessing given matrix row.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/LambdaMatrixExample_getRow.cpp
+    * \par Output
+    * \include LambdaMatrixExample_getRow.out
+    *
+    * See \ref LambdaMatrixRowView.
+    */
+   __cuda_callable__
+   const RowView
+   getRow( const IndexType& rowIdx ) const;
+
+   /**
+    * \brief Returns value of matrix element at position given by its row and column index.
+    *
+    * \param row is a row index of the matrix element.
+    * \param column i a column index of the matrix element.
+    *
+    * \return value of given matrix element.
+    */
+   RealType
+   getElement( const IndexType row, const IndexType column ) const;
+
+   /**
+    * \brief Method for iteration over all matrix rows for constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements.
+    *    It is should have form like
+    *
+    * ```
+    * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value
+    * ) { ... };
+    * ```
+    *
+    *  The column index repeats twice only for compatibility with sparse matrices.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/LambdaMatrix/LambdaMatrixExample_forRows.cpp
+    * \par Output
+    * \include LambdaMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function& function ) const;
+
+   /**
+    * \brief This method calls \e forElements for all matrix rows (for constant instances).
+    *
+    * See \ref LambdaMatrix::forElements.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/LambdaMatrix/LambdaMatrixExample_forAllRows.cpp
+    * \par Output
+    * \include LambdaMatrixExample_forAllRows.out
+    */
+   template< typename Function >
+   void
+   forAllElements( Function& function ) const;
+
+   /**
+    * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end) for constant instances.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref LambdaMatrix::forElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::LambdaMatrix::RowView.
+    *
+    * \par Example
+    * \include Matrices/LambdaMatrix/LambdaMatrixExample_forRows.cpp
+    * \par Output
+    * \include LambdaMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forRows( IndexType begin, IndexType end, Function&& function ) const;
+
+   /**
+    * \brief Method for parallel iteration over all matrix rows for constant instances.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref LambdaMatrix::forAllElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::LambdaMatrix::RowView.
+    *
+    * \par Example
+    * \include Matrices/LambdaMatrix/LambdaMatrixExample_forRows.cpp
+    * \par Output
+    * \include LambdaMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forAllRows( Function&& function ) const;
+
+   /**
+    * \brief Method for sequential iteration over all matrix rows for constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements.
+    *    It is should have form like
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::LambdaMatrix::RowView.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForRows( IndexType begin, IndexType end, Function&& function ) const;
+
+   /**
+    * \brief This method calls \e sequentialForRows for all matrix rows (for constant instances).
+    *
+    * See \ref LambdaMatrix::sequentialForRows.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForAllRows( Function&& function ) const;
+
+   /**
+    * \brief Method for performing general reduction on matrix rows.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, RealType elementValue ) -> FetchValue
+    * ```
+    *
+    *  The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callbale__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row.
+    *    It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value )
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param begin defines beginning of the range [\e begin, \e end) of rows to be processed.
+    * \param end defines ending of the range [\e begin,\e end) of rows to be processed.
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/LambdaMatrix/LambdaMatrixExample_reduceRows.cpp
+    * \par Output
+    * \include LambdaMatrixExample_reduceRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& zero ) const;
+
+   /**
+    * \brief Method for performing general reduction on ALL matrix rows.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, RealType elementValue ) -> FetchValue
+    * ```
+    *
+    *  The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row.
+    *   It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value )
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/LambdaMatrix/LambdaMatrixExample_reduceAllRows.cpp
+    * \par Output
+    * \include LambdaMatrixExample_reduceAllRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const;
+
+   /**
+    * \brief Computes product of matrix and vector.
+    *
+    * More precisely, it computes:
+    *
+    * ```
+    * outVector = matrixMultiplicator * ( *this ) * inVector + outVectorMultiplicator * outVector
+    * ```
+    *
+    * \tparam InVector is type of input vector.  It can be \ref Vector,
+    *     \ref VectorView, \ref Array, \ref ArraView or similar container.
+    * \tparam OutVector is type of output vector. It can be \ref Vector,
+    *     \ref VectorView, \ref Array, \ref ArraView or similar container.
+    *
+    * \param inVector is input vector.
+    * \param outVector is output vector.
+    * \param matrixMultiplicator is a factor by which the matrix is multiplied. It is one by default.
+    * \param outVectorMultiplicator is a factor by which the outVector is multiplied before added
+    *    to the result of matrix-vector product. It is zero by default.
+    * \param begin is the beginning of the rows range for which the vector product
+    *    is computed. It is zero by default.
+    * \param end is the end of the rows range for which the vector product
+    *    is computed. It is number if the matrix rows by default.
+    */
+   template< typename InVector, typename OutVector >
+   void
+   vectorProduct( const InVector& inVector,
+                  OutVector& outVector,
+                  const RealType& matrixMultiplicator = 1.0,
+                  const RealType& outVectorMultiplicator = 0.0,
+                  const IndexType begin = 0,
+                  IndexType end = 0 ) const;
+
+   /**
+    * \brief Method for printing the matrix to output stream.
+    *
+    * \param str is the output stream.
+    */
+   void
+   print( std::ostream& str ) const;
+
+protected:
+   IndexType rows, columns;
+
+   MatrixElementsLambda matrixElementsLambda;
+
+   CompressedRowLengthsLambda compressedRowLengthsLambda;
 };
 
 /**
@@ -509,12 +534,10 @@ class LambdaMatrix
  * \param matrix is the lambda matrix.
  * \return reference to the stream.
  */
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
-std::ostream& operator<< ( std::ostream& str, const LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >& matrix );
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
+std::ostream&
+operator<<( std::ostream& str,
+            const LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >& matrix );
 
 /**
  * \brief Helper class for creating instances of LambdaMatrix.
@@ -524,9 +547,7 @@ std::ostream& operator<< ( std::ostream& str, const LambdaMatrix< MatrixElements
  * \param matrixElementsLambda
  * \param compressedRowLengthsLambda
  */
-template< typename Real = double,
-          typename Device = Devices::Host,
-          typename Index = int >
+template< typename Real = double, typename Device = Devices::Host, typename Index = int >
 struct LambdaMatrixFactory
 {
    using RealType = Real;
@@ -545,24 +566,26 @@ struct LambdaMatrixFactory
     * \par Output
     * \include LambdaMatrixExample_Constructor.out
     */
-   template< typename MatrixElementsLambda,
-             typename CompressedRowLengthsLambda >
-   static auto create( MatrixElementsLambda& matrixElementsLambda,
-                       CompressedRowLengthsLambda& compressedRowLengthsLambda )
-   -> LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >
+   template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda >
+   static auto
+   create( MatrixElementsLambda& matrixElementsLambda, CompressedRowLengthsLambda& compressedRowLengthsLambda )
+      -> LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >
    {
       // TODO: fix the following asserts, they do not work in fact
-      static_assert( std::is_same<
-            std::enable_if_t< true, decltype(matrixElementsLambda( Index(), Index(), Index(), Index(), std::declval< Index& >(), std::declval< Real& >() ) ) >,
+      static_assert(
+         std::is_same<
+            std::enable_if_t< true,
+                              decltype( matrixElementsLambda(
+                                 Index(), Index(), Index(), Index(), std::declval< Index& >(), std::declval< Real& >() ) ) >,
             void >::value,
-         "Wong type of MatrixElementsLambda, it should be - matrixElementsLambda( Index rows, Index columns, Index rowIdx, Index localIdx, Index& columnIdx, Real& value )" );
+         "Wong type of MatrixElementsLambda, it should be - matrixElementsLambda( Index rows, Index columns, Index rowIdx, "
+         "Index localIdx, Index& columnIdx, Real& value )" );
       static_assert( std::is_integral<
-         std::enable_if_t< true, decltype(compressedRowLengthsLambda( Index(), Index(), Index() ) ) >
-          >::value ,
-         "Wong type of CompressedRowLengthsLambda, it should be - matrixElementsLambda( Index rows, Index columns, Index rowIdx )" );
+                        std::enable_if_t< true, decltype( compressedRowLengthsLambda( Index(), Index(), Index() ) ) > >::value,
+                     "Wong type of CompressedRowLengthsLambda, it should be - matrixElementsLambda( Index rows, Index columns, "
+                     "Index rowIdx )" );
       return LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >(
-         matrixElementsLambda,
-         compressedRowLengthsLambda );
+         matrixElementsLambda, compressedRowLengthsLambda );
    };
 
    /**
@@ -580,32 +603,34 @@ struct LambdaMatrixFactory
     * \par Output
     * \include LambdaMatrixExample_Constructor.out
     */
-   template< typename MatrixElementsLambda,
-             typename CompressedRowLengthsLambda >
-   static auto create( const IndexType& rows,
-                       const IndexType& columns,
-                       MatrixElementsLambda& matrixElementsLambda,
-                       CompressedRowLengthsLambda& compressedRowLengthsLambda )
-   -> LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >
+   template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda >
+   static auto
+   create( const IndexType& rows,
+           const IndexType& columns,
+           MatrixElementsLambda& matrixElementsLambda,
+           CompressedRowLengthsLambda& compressedRowLengthsLambda )
+      -> LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >
    {
       // TODO: fix the following asserts, they do not work in fact
-      static_assert( std::is_same<
-            std::enable_if_t< true, decltype(matrixElementsLambda( Index(), Index(), Index(), Index(), std::declval< Index& >(), std::declval< Real& >() ) ) >,
+      static_assert(
+         std::is_same<
+            std::enable_if_t< true,
+                              decltype( matrixElementsLambda(
+                                 Index(), Index(), Index(), Index(), std::declval< Index& >(), std::declval< Real& >() ) ) >,
             void >::value,
-         "Wong type of MatrixElementsLambda, it should be - matrixElementsLambda( Index rows, Index columns, Index rowIdx, Index localIdx, Index& columnIdx, Real& value )" );
+         "Wong type of MatrixElementsLambda, it should be - matrixElementsLambda( Index rows, Index columns, Index rowIdx, "
+         "Index localIdx, Index& columnIdx, Real& value )" );
       static_assert( std::is_integral<
-         std::enable_if_t< true, decltype(compressedRowLengthsLambda( Index(), Index(), Index() ) ) >
-          >::value ,
-         "Wong type of CompressedRowLengthsLambda, it should be - matrixElementsLambda( Index rows, Index columns, Index rowIdx )" );
+                        std::enable_if_t< true, decltype( compressedRowLengthsLambda( Index(), Index(), Index() ) ) > >::value,
+                     "Wong type of CompressedRowLengthsLambda, it should be - matrixElementsLambda( Index rows, Index columns, "
+                     "Index rowIdx )" );
 
       return LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >(
-         rows, columns,
-         matrixElementsLambda,
-         compressedRowLengthsLambda );
+         rows, columns, matrixElementsLambda, compressedRowLengthsLambda );
    };
 };
 
-} //namespace Matrices
-} //namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/LambdaMatrix.hpp>
diff --git a/src/TNL/Matrices/LambdaMatrix.hpp b/src/TNL/Matrices/LambdaMatrix.hpp
index 61aa296d2820f384e55f02c7ed4c4c12bd583c78..9233c89655826e8e79cabf6cf59241d4c835bdd0 100644
--- a/src/TNL/Matrices/LambdaMatrix.hpp
+++ b/src/TNL/Matrices/LambdaMatrix.hpp
@@ -18,156 +18,106 @@
 namespace TNL {
 namespace Matrices {
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
-LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
-LambdaMatrix( MatrixElementsLambda& matrixElements,
-              CompressedRowLengthsLambda& compressedRowLengths )
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
+LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::LambdaMatrix(
+   MatrixElementsLambda& matrixElements,
+   CompressedRowLengthsLambda& compressedRowLengths )
 : rows( 0 ), columns( 0 ), matrixElementsLambda( matrixElements ), compressedRowLengthsLambda( compressedRowLengths )
-{
-}
+{}
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
-LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
-LambdaMatrix( const IndexType& rows,
-              const IndexType& columns,
-              MatrixElementsLambda& matrixElements,
-              CompressedRowLengthsLambda& compressedRowLengths )
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
+LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::LambdaMatrix(
+   const IndexType& rows,
+   const IndexType& columns,
+   MatrixElementsLambda& matrixElements,
+   CompressedRowLengthsLambda& compressedRowLengths )
 : rows( rows ), columns( columns ), matrixElementsLambda( matrixElements ), compressedRowLengthsLambda( compressedRowLengths )
-{
-}
+{}
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
 void
-LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
-setDimensions( const IndexType& rows,
-               const IndexType& columns )
+LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::setDimensions( const IndexType& rows,
+                                                                                                      const IndexType& columns )
 {
    this->rows = rows;
    this->columns = columns;
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
 __cuda_callable__
 Index
-LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
-getRows() const
+LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::getRows() const
 {
    return this->rows;
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
 __cuda_callable__
 Index
-LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
-getColumns() const
+LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::getColumns() const
 {
    return this->columns;
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
 __cuda_callable__
 const CompressedRowLengthsLambda&
-LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
-getCompressedRowLengthsLambda() const
+LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::getCompressedRowLengthsLambda() const
 {
    return this->compressedRowLengthsLambda;
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
 __cuda_callable__
 const MatrixElementsLambda&
-LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
-getMatrixElementsLambda() const
+LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::getMatrixElementsLambda() const
 {
    return this->matrixElementsLambda;
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
-   template< typename Vector >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
+template< typename Vector >
 void
-LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
-getRowCapacities( Vector& rowCapacities ) const
+LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::getRowCapacities(
+   Vector& rowCapacities ) const
 {
    this->getCompressedRowLengths( rowCapacities );
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
-   template< typename Vector >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
+template< typename Vector >
 void
-LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
-getCompressedRowLengths( Vector& rowLengths ) const
+LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::getCompressedRowLengths(
+   Vector& rowLengths ) const
 {
    details::set_size_if_resizable( rowLengths, this->getRows() );
    rowLengths = 0;
    auto rowLengths_view = rowLengths.getView();
-   auto fetch = [] __cuda_callable__ ( IndexType row, IndexType column, const RealType& value ) -> IndexType {
+   auto fetch = [] __cuda_callable__( IndexType row, IndexType column, const RealType& value ) -> IndexType
+   {
       return ( value != 0.0 );
    };
-   auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const IndexType value ) mutable {
+   auto keep = [ = ] __cuda_callable__( const IndexType rowIdx, const IndexType value ) mutable
+   {
       rowLengths_view[ rowIdx ] = value;
    };
    this->reduceAllRows( fetch, std::plus<>{}, keep, 0 );
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
 Index
-LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
-getNonzeroElementsCount() const
+LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::getNonzeroElementsCount() const
 {
    Containers::Vector< IndexType, DeviceType, IndexType > rowLengthsVector;
    this->getCompressedRowLengths( rowLengthsVector );
    return sum( rowLengthsVector );
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
 Real
-LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
-getElement( const IndexType row,
-            const IndexType column ) const
+LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::getElement(
+   const IndexType row,
+   const IndexType column ) const
 {
    Containers::Array< RealType, DeviceType > value( 1 );
    auto valueView = value.getView();
@@ -175,16 +125,15 @@ getElement( const IndexType row,
    auto matrixElements = this->matrixElementsLambda;
    const IndexType rows = this->getRows();
    const IndexType columns = this->getColumns();
-   auto getValue = [=] __cuda_callable__ (  IndexType rowIdx ) mutable {
+   auto getValue = [ = ] __cuda_callable__( IndexType rowIdx ) mutable
+   {
       const IndexType rowSize = rowLengths( rows, columns, row );
       valueView[ 0 ] = 0.0;
-      for( IndexType localIdx = 0; localIdx < rowSize; localIdx++ )
-      {
+      for( IndexType localIdx = 0; localIdx < rowSize; localIdx++ ) {
          RealType elementValue;
          IndexType elementColumn;
          matrixElements( rows, columns, row, localIdx, elementColumn, elementValue );
-         if( elementColumn == column )
-         {
+         if( elementColumn == column ) {
             valueView[ 0 ] = elementValue;
             break;
          }
@@ -194,53 +143,44 @@ getElement( const IndexType row,
    return valueView.getElement( 0 );
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
 __cuda_callable__
 auto
-LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
-getRow( const IndexType& rowIdx ) const -> const RowView
+LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::getRow( const IndexType& rowIdx ) const
+   -> const RowView
 {
-   return RowView( this->getMatrixElementsLambda(),
-                   this->getCompressedRowLengthsLambda(),
-                   this->getRows(),
-                   this->getColumns(),
-                   rowIdx );
+   return RowView(
+      this->getMatrixElementsLambda(), this->getCompressedRowLengthsLambda(), this->getRows(), this->getColumns(), rowIdx );
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
-   template< typename InVector,
-             typename OutVector >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
+template< typename InVector, typename OutVector >
 void
-LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
-vectorProduct( const InVector& inVector,
-               OutVector& outVector,
-               const RealType& matrixMultiplicator,
-               const RealType& outVectorMultiplicator,
-               const IndexType begin,
-               IndexType end ) const
+LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::vectorProduct(
+   const InVector& inVector,
+   OutVector& outVector,
+   const RealType& matrixMultiplicator,
+   const RealType& outVectorMultiplicator,
+   const IndexType begin,
+   IndexType end ) const
 {
    TNL_ASSERT_EQ( this->getColumns(), inVector.getSize(), "Matrix columns do not fit with input vector." );
    TNL_ASSERT_EQ( this->getRows(), outVector.getSize(), "Matrix rows do not fit with output vector." );
 
    const auto inVectorView = inVector.getConstView();
    auto outVectorView = outVector.getView();
-   auto fetch = [=] __cuda_callable__ ( IndexType row, IndexType columnIdx, const RealType& value ) mutable -> RealType {
+   auto fetch = [ = ] __cuda_callable__( IndexType row, IndexType columnIdx, const RealType& value ) mutable -> RealType
+   {
       if( value == 0.0 )
          return 0.0;
       return value * inVectorView[ columnIdx ];
    };
-   auto reduce = [] __cuda_callable__ ( RealType& sum, const RealType& value ) -> RealType {
+   auto reduce = [] __cuda_callable__( RealType & sum, const RealType& value ) -> RealType
+   {
       return sum + value;
    };
-   auto keep = [=] __cuda_callable__ ( IndexType row, const RealType& value ) mutable {
+   auto keep = [ = ] __cuda_callable__( IndexType row, const RealType& value ) mutable
+   {
       if( outVectorMultiplicator == 0.0 )
          outVectorView[ row ] = matrixMultiplicator * value;
       else
@@ -251,15 +191,16 @@ vectorProduct( const InVector& inVector,
    this->reduceRows( begin, end, fetch, reduce, keep, 0.0 );
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
-reduceRows( IndexType first, IndexType last, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const
+LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::reduceRows(
+   IndexType first,
+   IndexType last,
+   Fetch& fetch,
+   const Reduce& reduce,
+   Keep& keep,
+   const FetchReal& identity ) const
 {
    using FetchType = decltype( fetch( IndexType(), IndexType(), RealType() ) );
 
@@ -267,153 +208,124 @@ reduceRows( IndexType first, IndexType last, Fetch& fetch, const Reduce& reduce,
    const IndexType columns = this->getColumns();
    auto rowLengths = this->compressedRowLengthsLambda;
    auto matrixElements = this->matrixElementsLambda;
-   auto processRow = [=] __cuda_callable__ ( IndexType rowIdx ) mutable {
+   auto processRow = [ = ] __cuda_callable__( IndexType rowIdx ) mutable
+   {
       const IndexType rowLength = rowLengths( rows, columns, rowIdx );
       FetchType result = identity;
-      for( IndexType localIdx = 0; localIdx < rowLength; localIdx++ )
-      {
-        IndexType elementColumn( 0 );
-        RealType elementValue( 0.0 );
-        matrixElements( rows, columns, rowIdx, localIdx, elementColumn, elementValue );
-        FetchType fetchValue = identity;
-        if( elementValue != 0.0 )
+      for( IndexType localIdx = 0; localIdx < rowLength; localIdx++ ) {
+         IndexType elementColumn( 0 );
+         RealType elementValue( 0.0 );
+         matrixElements( rows, columns, rowIdx, localIdx, elementColumn, elementValue );
+         FetchType fetchValue = identity;
+         if( elementValue != 0.0 )
             fetchValue = fetch( rowIdx, elementColumn, elementValue );
-        result = reduce( result, fetchValue );
+         result = reduce( result, fetchValue );
       }
       keep( rowIdx, result );
    };
    Algorithms::ParallelFor< DeviceType >::exec( first, last, processRow );
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
-reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const
+LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::reduceAllRows(
+   Fetch& fetch,
+   const Reduce& reduce,
+   Keep& keep,
+   const FetchReal& identity ) const
 {
    this->reduceRows( (IndexType) 0, this->getRows(), fetch, reduce, keep, identity );
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
-   template< typename Function >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
+template< typename Function >
 void
-LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
-forElements( IndexType first, IndexType last, Function& function ) const
+LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::forElements( IndexType first,
+                                                                                                    IndexType last,
+                                                                                                    Function& function ) const
 {
    const IndexType rows = this->getRows();
    const IndexType columns = this->getColumns();
    auto rowLengths = this->compressedRowLengthsLambda;
    auto matrixElements = this->matrixElementsLambda;
-   auto processRow = [=] __cuda_callable__ ( IndexType rowIdx ) mutable {
+   auto processRow = [ = ] __cuda_callable__( IndexType rowIdx ) mutable
+   {
       const IndexType rowLength = rowLengths( rows, columns, rowIdx );
-      for( IndexType localIdx = 0; localIdx < rowLength; localIdx++ )
-      {
-        IndexType elementColumn( 0 );
-        RealType elementValue( 0.0 );
-        matrixElements( rows, columns, rowIdx, localIdx, elementColumn, elementValue );
-        if( elementValue != 0.0 )
+      for( IndexType localIdx = 0; localIdx < rowLength; localIdx++ ) {
+         IndexType elementColumn( 0 );
+         RealType elementValue( 0.0 );
+         matrixElements( rows, columns, rowIdx, localIdx, elementColumn, elementValue );
+         if( elementValue != 0.0 )
             function( rowIdx, localIdx, elementColumn, elementValue );
       }
    };
    Algorithms::ParallelFor< DeviceType >::exec( first, last, processRow );
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
-   template< typename Function >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
+template< typename Function >
 void
-LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
-forAllElements( Function& function ) const
+LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::forAllElements(
+   Function& function ) const
 {
    forElements( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
-   template< typename Function >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
+template< typename Function >
 void
-LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
-forRows( IndexType begin, IndexType end, Function&& function ) const
+LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::forRows( IndexType begin,
+                                                                                                IndexType end,
+                                                                                                Function&& function ) const
 {
    auto view = *this;
-   auto f = [=] __cuda_callable__ ( const IndexType rowIdx ) mutable {
+   auto f = [ = ] __cuda_callable__( const IndexType rowIdx ) mutable
+   {
       auto rowView = view.getRow( rowIdx );
       function( rowView );
    };
    TNL::Algorithms::ParallelFor< DeviceType >::exec( begin, end, f );
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
-   template< typename Function >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
+template< typename Function >
 void
-LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
-forAllRows( Function&& function ) const
+LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::forAllRows( Function&& function ) const
 {
    this->forRows( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
-   template< typename Function >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
+template< typename Function >
 void
-LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
-sequentialForRows( IndexType begin, IndexType end, Function&& function ) const
+LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::sequentialForRows(
+   IndexType begin,
+   IndexType end,
+   Function&& function ) const
 {
-   for( IndexType row = begin; row < end; row ++ )
+   for( IndexType row = begin; row < end; row++ )
       this->forRows( row, row + 1, function );
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
-   template< typename Function >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
+template< typename Function >
 void
-LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
-sequentialForAllRows( Function&& function ) const
+LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::sequentialForAllRows(
+   Function&& function ) const
 {
    sequentialForRows( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
 void
-LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
-print( std::ostream& str ) const
+LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::print( std::ostream& str ) const
 {
-   for( IndexType row = 0; row < this->getRows(); row++ )
-   {
-      str <<"Row: " << row << " -> ";
-      for( IndexType column = 0; column < this->getColumns(); column++ )
-      {
+   for( IndexType row = 0; row < this->getRows(); row++ ) {
+      str << "Row: " << row << " -> ";
+      for( IndexType column = 0; column < this->getColumns(); column++ ) {
          RealType value = this->getElement( row, column );
-         if( value )
-         {
+         if( value ) {
             std::stringstream str_;
             str_ << std::setw( 4 ) << std::right << column << ":" << std::setw( 4 ) << std::left << value;
             str << std::setw( 10 ) << str_.str();
@@ -430,16 +342,14 @@ print( std::ostream& str ) const
  * \param matrix is the lambda matrix.
  * \return reference to the stream.
  */
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Device,
-          typename Index >
-std::ostream& operator<< ( std::ostream& str, const LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >& matrix )
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Device, typename Index >
+std::ostream&
+operator<<( std::ostream& str,
+            const LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >& matrix )
 {
    matrix.print( str );
    return str;
 }
 
-} //namespace Matrices
-} //namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/LambdaMatrixElement.h b/src/TNL/Matrices/LambdaMatrixElement.h
index 0113bb50ba745c71fd5669584fe5a0ffd6ec5a58..4f30b833cae5e8e66c152f7e746ec81455712ba9 100644
--- a/src/TNL/Matrices/LambdaMatrixElement.h
+++ b/src/TNL/Matrices/LambdaMatrixElement.h
@@ -19,87 +19,97 @@ namespace Matrices {
  * \tparam Real is type of matrix elements values.
  * \tparam Index is a type of matrix elements column indexes.
  */
-template< typename Real,
-          typename Index >
+template< typename Real, typename Index >
 class LambdaMatrixElement
 {
-   public:
-
-      /**
-       * \brief Type of matrix elements values.
-       */
-      using RealType = Real;
-
-      /**
-       * \brief Type of matrix elements column indexes.
-       */
-      using IndexType = Index;
-
-      /**
-       * \brief Constructor.
-       *
-       * \param value is matrix element value.
-       * \param rowIdx is row index of the matrix element.
-       * \param columnIdx is a column index of the matrix element.
-       * \param localIdx is the rank of the non-zero elements in the matrix row.
-       */
-      __cuda_callable__
-      LambdaMatrixElement( const RealType& value,
-                           const IndexType& rowIdx,
-                           const IndexType& columnIdx,
-                           const IndexType& localIdx )
-      : value_( value ), rowIdx( rowIdx ), columnIdx( columnIdx ), localIdx( localIdx ) {};
-
-      /**
-       * \brief Copy constructor.
-       *
-       * \param el is the source matrix element.
-       */
-      __cuda_callable__
-      LambdaMatrixElement( const LambdaMatrixElement& el ) = default;
-
-      /**
-       * \brief Returns constant reference on matrix element value.
-       *
-       * \return constant reference on matrix element value.
-       */
-      __cuda_callable__
-      const RealType& value() const { return value_; };
-
-      /**
-       * \brief Returns constant reference on matrix element row index.
-       *
-       * \return constant reference on matrix element row index.
-       */
-      __cuda_callable__
-      const IndexType& rowIndex() const { return rowIdx; };
-
-      /**
-       * \brief Returns constant reference on matrix element column index.
-       *
-       * \return constant reference on matrix element column index.
-       */
-      __cuda_callable__
-      const IndexType& columnIndex() const { return columnIdx; };
-
-      /**
-       * \brief Returns constant reference on the rank of the non-zero matrix element in the row.
-       *
-       * \return constant reference on the rank of the non-zero matrix element in the row.
-       */
-      __cuda_callable__
-      const IndexType& localIndex() const { return localIdx; };
-
-   protected:
-
-      const RealType value_;
-
-      const IndexType& rowIdx;
-
-      const IndexType columnIdx;
-
-      const IndexType& localIdx;
+public:
+   /**
+    * \brief Type of matrix elements values.
+    */
+   using RealType = Real;
+
+   /**
+    * \brief Type of matrix elements column indexes.
+    */
+   using IndexType = Index;
+
+   /**
+    * \brief Constructor.
+    *
+    * \param value is matrix element value.
+    * \param rowIdx is row index of the matrix element.
+    * \param columnIdx is a column index of the matrix element.
+    * \param localIdx is the rank of the non-zero elements in the matrix row.
+    */
+   __cuda_callable__
+   LambdaMatrixElement( const RealType& value, const IndexType& rowIdx, const IndexType& columnIdx, const IndexType& localIdx )
+   : value_( value ), rowIdx( rowIdx ), columnIdx( columnIdx ), localIdx( localIdx ){};
+
+   /**
+    * \brief Copy constructor.
+    *
+    * \param el is the source matrix element.
+    */
+   __cuda_callable__
+   LambdaMatrixElement( const LambdaMatrixElement& el ) = default;
+
+   /**
+    * \brief Returns constant reference on matrix element value.
+    *
+    * \return constant reference on matrix element value.
+    */
+   __cuda_callable__
+   const RealType&
+   value() const
+   {
+      return value_;
+   };
+
+   /**
+    * \brief Returns constant reference on matrix element row index.
+    *
+    * \return constant reference on matrix element row index.
+    */
+   __cuda_callable__
+   const IndexType&
+   rowIndex() const
+   {
+      return rowIdx;
+   };
+
+   /**
+    * \brief Returns constant reference on matrix element column index.
+    *
+    * \return constant reference on matrix element column index.
+    */
+   __cuda_callable__
+   const IndexType&
+   columnIndex() const
+   {
+      return columnIdx;
+   };
+
+   /**
+    * \brief Returns constant reference on the rank of the non-zero matrix element in the row.
+    *
+    * \return constant reference on the rank of the non-zero matrix element in the row.
+    */
+   __cuda_callable__
+   const IndexType&
+   localIndex() const
+   {
+      return localIdx;
+   };
+
+protected:
+   const RealType value_;
+
+   const IndexType& rowIdx;
+
+   const IndexType columnIdx;
+
+   const IndexType& localIdx;
 };
 
-   } // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/LambdaMatrixRowView.h b/src/TNL/Matrices/LambdaMatrixRowView.h
index a4f82064d67e2e5fb929d1d3bbb4463c1fec4c99..a162e545ca875ce457bf4a7ca0b72b1d7fc61110 100644
--- a/src/TNL/Matrices/LambdaMatrixRowView.h
+++ b/src/TNL/Matrices/LambdaMatrixRowView.h
@@ -12,7 +12,6 @@
 #include <TNL/Matrices/LambdaMatrixRowViewIterator.h>
 #include <TNL/Matrices/LambdaMatrixElement.h>
 
-
 namespace TNL {
 namespace Matrices {
 
@@ -24,13 +23,14 @@ namespace Matrices {
  * It has the following form:
  *
  * ```
- * auto matrixElements = [] __cuda_callable__ ( Index rows, Index columns, Index rowIdx, Index localIdx, Index& columnIdx, Real& value ) { ... }
+ * auto matrixElements = [] __cuda_callable__ ( Index rows, Index columns, Index rowIdx, Index localIdx, Index& columnIdx, Real&
+ * value ) { ... }
  * ```
  *
- *    where \e rows is the number of matrix rows, \e columns is the number of matrix columns, \e rowIdx is the index of matrix row being queried,
- *    \e localIdx is the rank of the non-zero element in given row, \e columnIdx is a column index of the matrix element computed by
- *    this lambda and \e value is a value of the matrix element computed by this lambda.
- * \tparam CompressedRowLengthsLambda is a lambda function returning a number of non-zero elements in each row.
+ *    where \e rows is the number of matrix rows, \e columns is the number of matrix columns, \e rowIdx is the index of matrix
+ * row being queried, \e localIdx is the rank of the non-zero element in given row, \e columnIdx is a column index of the matrix
+ * element computed by this lambda and \e value is a value of the matrix element computed by this lambda. \tparam
+ * CompressedRowLengthsLambda is a lambda function returning a number of non-zero elements in each row.
  *
  * It has the following form:
  *
@@ -38,7 +38,8 @@ namespace Matrices {
  * auto rowLengths = [] __cuda_callable__ ( Index rows, Index columns, Index rowIdx ) -> IndexType { ... }
  * ```
  *
- *    where \e rows is the number of matrix rows, \e columns is the number of matrix columns and \e rowIdx is an index of the row being queried.
+ *    where \e rows is the number of matrix rows, \e columns is the number of matrix columns and \e rowIdx is an index of the
+ * row being queried.
  *
  * \tparam Real is a type of matrix elements values.
  * \tparam Index is a type to be used for indexing.
@@ -48,161 +49,160 @@ namespace Matrices {
  * \par Output
  * \include LambdaMatrixExample_getRow.out
  */
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real = double,
-          typename Index = int >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real = double, typename Index = int >
 class LambdaMatrixRowView
 {
-   public:
-
-      /**
-       * \brief The type of matrix elements.
-       */
-      using RealType = Real;
-
-      /**
-       * \brief The type used for matrix elements indexing.
-       */
-      using IndexType = Index;
-
-      /**
-       * \brief Type of the lambda function returning the matrix elements.
-       */
-      using MatrixElementsLambdaType = MatrixElementsLambda;
-
-      /**
-       * \brief Type of the lambda function returning the number of non-zero elements in each row.
-       */
-      using CompressedRowLengthsLambdaType = CompressedRowLengthsLambda;
-
-      /**
-       * \brief Type of Lambda matrix row view.
-       */
-      using RowView = LambdaMatrixRowView< MatrixElementsLambdaType, CompressedRowLengthsLambdaType, RealType, IndexType >;
-
-      /**
-       * \brief Type of constant Lambda matrix row view.
-       */
-      using ConstRowView = RowView;
-
-      /**
-       * \brief The type of related matrix element.
-       */
-      using MatrixElementType = LambdaMatrixElement< RealType, IndexType >;
-
-      /**
-       * \brief Type of iterator for the matrix row.
-       */
-      using IteratorType = LambdaMatrixRowViewIterator< RowView >;
-
-      /**
-       * \brief Constructor with related lambda functions, matrix dimensions and row index.
-       *
-       * \param matrixElementsLambda is a constant reference to the lambda function evaluating matrix elements.
-       * \param compressedRowLengthsLambda is a constant reference to the lambda function returning the number of nonzero elements in each row.
-       * \param rows is number of matrix rows.
-       * \param columns is number of matrix columns.
-       * \param rowIdx is the matrix row index.
-       */
-      __cuda_callable__
-      LambdaMatrixRowView( const MatrixElementsLambdaType& matrixElementsLambda,
-                           const CompressedRowLengthsLambdaType& compressedRowLengthsLambda,
-                           const IndexType& rows,
-                           const IndexType& columns,
-                           const IndexType& rowIdx );
-
-      /**
-       * \brief Returns size of the matrix row, i.e. number of matrix elements in this row.
-       *
-       * \return Size of the matrix row.
-       */
-      __cuda_callable__
-      IndexType getSize() const;
-
-      /**
-       * \brief Returns the matrix row index.
-       *
-       * \return matrix row index.
-       */
-      __cuda_callable__
-      const IndexType& getRowIndex() const;
-
-      /**
-       * \brief Returns constants reference to a column index of an element with given rank in the row.
-       *
-       * \param localIdx is the rank of the non-zero element in given row.
-       *
-       * \return constant reference to the matrix element column index.
-       */
-      __cuda_callable__
-      IndexType getColumnIndex( const IndexType localIdx ) const;
-
-      /**
-       * \brief Returns constants reference to value of an element with given rank in the row.
-       *
-       * \param localIdx is the rank of the non-zero element in given row.
-       *
-       * \return constant reference to the matrix element value.
-       */
-      __cuda_callable__
-      RealType getValue( const IndexType localIdx ) const;
-
-      /**
-       * \brief Comparison of two matrix rows.
-       *
-       * The other matrix row can be from any other matrix.
-       *
-       * \param other is another matrix row.
-       * \return \e true if both rows are the same, \e false otherwise.
-       */
-      template< typename MatrixElementsLambda_,
-                typename CompressedRowLengthsLambda_,
-                typename Real_,
-                typename Index_ >
-      __cuda_callable__
-      bool operator==( const LambdaMatrixRowView< MatrixElementsLambda_, CompressedRowLengthsLambda_, Real_, Index_ >& other ) const;
-
-      /**
-       * \brief Returns non-constant iterator pointing at the beginning of the matrix row.
-       *
-       * \return iterator pointing at the beginning.
-       */
-      __cuda_callable__
-      const IteratorType begin() const;
-
-      /**
-       * \brief Returns non-constant iterator pointing at the end of the matrix row.
-       *
-       * \return iterator pointing at the end.
-       */
-      __cuda_callable__
-      const IteratorType end() const;
-
-      /**
-       * \brief Returns constant iterator pointing at the beginning of the matrix row.
-       *
-       * \return iterator pointing at the beginning.
-       */
-      __cuda_callable__
-      const IteratorType cbegin() const;
-
-      /**
-       * \brief Returns constant iterator pointing at the end of the matrix row.
-       *
-       * \return iterator pointing at the end.
-       */
-      __cuda_callable__
-      const IteratorType cend() const;
-
-
-   protected:
-
-      const MatrixElementsLambda& matrixElementsLambda;
-
-      const CompressedRowLengthsLambda& compressedRowLengthsLambda;
-
-      IndexType rows, columns, rowIdx;
+public:
+   /**
+    * \brief The type of matrix elements.
+    */
+   using RealType = Real;
+
+   /**
+    * \brief The type used for matrix elements indexing.
+    */
+   using IndexType = Index;
+
+   /**
+    * \brief Type of the lambda function returning the matrix elements.
+    */
+   using MatrixElementsLambdaType = MatrixElementsLambda;
+
+   /**
+    * \brief Type of the lambda function returning the number of non-zero elements in each row.
+    */
+   using CompressedRowLengthsLambdaType = CompressedRowLengthsLambda;
+
+   /**
+    * \brief Type of Lambda matrix row view.
+    */
+   using RowView = LambdaMatrixRowView< MatrixElementsLambdaType, CompressedRowLengthsLambdaType, RealType, IndexType >;
+
+   /**
+    * \brief Type of constant Lambda matrix row view.
+    */
+   using ConstRowView = RowView;
+
+   /**
+    * \brief The type of related matrix element.
+    */
+   using MatrixElementType = LambdaMatrixElement< RealType, IndexType >;
+
+   /**
+    * \brief Type of iterator for the matrix row.
+    */
+   using IteratorType = LambdaMatrixRowViewIterator< RowView >;
+
+   /**
+    * \brief Constructor with related lambda functions, matrix dimensions and row index.
+    *
+    * \param matrixElementsLambda is a constant reference to the lambda function evaluating matrix elements.
+    * \param compressedRowLengthsLambda is a constant reference to the lambda function returning the number of nonzero elements
+    * in each row. \param rows is number of matrix rows. \param columns is number of matrix columns. \param rowIdx is the matrix
+    * row index.
+    */
+   __cuda_callable__
+   LambdaMatrixRowView( const MatrixElementsLambdaType& matrixElementsLambda,
+                        const CompressedRowLengthsLambdaType& compressedRowLengthsLambda,
+                        const IndexType& rows,
+                        const IndexType& columns,
+                        const IndexType& rowIdx );
+
+   /**
+    * \brief Returns size of the matrix row, i.e. number of matrix elements in this row.
+    *
+    * \return Size of the matrix row.
+    */
+   __cuda_callable__
+   IndexType
+   getSize() const;
+
+   /**
+    * \brief Returns the matrix row index.
+    *
+    * \return matrix row index.
+    */
+   __cuda_callable__
+   const IndexType&
+   getRowIndex() const;
+
+   /**
+    * \brief Returns constants reference to a column index of an element with given rank in the row.
+    *
+    * \param localIdx is the rank of the non-zero element in given row.
+    *
+    * \return constant reference to the matrix element column index.
+    */
+   __cuda_callable__
+   IndexType
+   getColumnIndex( const IndexType localIdx ) const;
+
+   /**
+    * \brief Returns constants reference to value of an element with given rank in the row.
+    *
+    * \param localIdx is the rank of the non-zero element in given row.
+    *
+    * \return constant reference to the matrix element value.
+    */
+   __cuda_callable__
+   RealType
+   getValue( const IndexType localIdx ) const;
+
+   /**
+    * \brief Comparison of two matrix rows.
+    *
+    * The other matrix row can be from any other matrix.
+    *
+    * \param other is another matrix row.
+    * \return \e true if both rows are the same, \e false otherwise.
+    */
+   template< typename MatrixElementsLambda_, typename CompressedRowLengthsLambda_, typename Real_, typename Index_ >
+   __cuda_callable__
+   bool
+   operator==( const LambdaMatrixRowView< MatrixElementsLambda_, CompressedRowLengthsLambda_, Real_, Index_ >& other ) const;
+
+   /**
+    * \brief Returns non-constant iterator pointing at the beginning of the matrix row.
+    *
+    * \return iterator pointing at the beginning.
+    */
+   __cuda_callable__
+   const IteratorType
+   begin() const;
+
+   /**
+    * \brief Returns non-constant iterator pointing at the end of the matrix row.
+    *
+    * \return iterator pointing at the end.
+    */
+   __cuda_callable__
+   const IteratorType
+   end() const;
+
+   /**
+    * \brief Returns constant iterator pointing at the beginning of the matrix row.
+    *
+    * \return iterator pointing at the beginning.
+    */
+   __cuda_callable__
+   const IteratorType
+   cbegin() const;
+
+   /**
+    * \brief Returns constant iterator pointing at the end of the matrix row.
+    *
+    * \return iterator pointing at the end.
+    */
+   __cuda_callable__
+   const IteratorType
+   cend() const;
+
+protected:
+   const MatrixElementsLambda& matrixElementsLambda;
+
+   const CompressedRowLengthsLambda& compressedRowLengthsLambda;
+
+   IndexType rows, columns, rowIdx;
 };
 
 /**
@@ -212,13 +212,12 @@ class LambdaMatrixRowView
  * \param row is an input Lambda matrix row.
  * \return  reference to the output stream.
  */
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Index >
-std::ostream& operator<<( std::ostream& str, const LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >& row );
-
-} // namespace Matrices
-} // namespace TNL
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Index >
+std::ostream&
+operator<<( std::ostream& str,
+            const LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >& row );
+
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/LambdaMatrixRowView.hpp>
diff --git a/src/TNL/Matrices/LambdaMatrixRowView.hpp b/src/TNL/Matrices/LambdaMatrixRowView.hpp
index b3f138edcca33e82c3fde9607030828e434ed7d5..312f129ef7f1f42b00a9f99960ace1cf3cc61ff9 100644
--- a/src/TNL/Matrices/LambdaMatrixRowView.hpp
+++ b/src/TNL/Matrices/LambdaMatrixRowView.hpp
@@ -12,55 +12,39 @@
 namespace TNL {
 namespace Matrices {
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Index >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Index >
 __cuda_callable__
-LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >::
-LambdaMatrixRowView( const MatrixElementsLambdaType& matrixElementsLambda,
-                     const CompressedRowLengthsLambdaType& compressedRowLengthsLambda,
-                     const IndexType& rows,
-                     const IndexType& columns,
-                     const IndexType& rowIdx )
- : matrixElementsLambda( matrixElementsLambda ),
-  compressedRowLengthsLambda( compressedRowLengthsLambda ),
-  rows( rows ),
-  columns( columns ),
-  rowIdx( rowIdx )
-{
-}
+LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >::LambdaMatrixRowView(
+   const MatrixElementsLambdaType& matrixElementsLambda,
+   const CompressedRowLengthsLambdaType& compressedRowLengthsLambda,
+   const IndexType& rows,
+   const IndexType& columns,
+   const IndexType& rowIdx )
+: matrixElementsLambda( matrixElementsLambda ), compressedRowLengthsLambda( compressedRowLengthsLambda ), rows( rows ),
+  columns( columns ), rowIdx( rowIdx )
+{}
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Index >
-__cuda_callable__ auto
-LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >::
-getSize() const -> IndexType
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Index >
+__cuda_callable__
+auto
+LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >::getSize() const -> IndexType
 {
    return this->compressedRowLengthsLambda( this->rows, this->columns, this->rowIdx );
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Index >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Index >
 __cuda_callable__
 auto
-LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >::
-getRowIndex() const -> const IndexType&
+LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >::getRowIndex() const -> const IndexType&
 {
    return this->rowIdx;
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Index >
-__cuda_callable__ auto
-LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >::
-getColumnIndex( const IndexType localIdx ) const -> IndexType
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Index >
+__cuda_callable__
+auto
+LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >::getColumnIndex(
+   const IndexType localIdx ) const -> IndexType
 {
    TNL_ASSERT_LT( localIdx, this->getSize(), "Local index exceeds matrix row capacity." );
    RealType value;
@@ -69,13 +53,11 @@ getColumnIndex( const IndexType localIdx ) const -> IndexType
    return columnIdx;
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Index >
-__cuda_callable__ auto
-LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >::
-getValue( const IndexType localIdx ) const -> RealType
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Index >
+__cuda_callable__
+auto
+LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >::getValue( const IndexType localIdx ) const
+   -> RealType
 {
    TNL_ASSERT_LT( localIdx, this->getSize(), "Local index exceeds matrix row capacity." );
    RealType value;
@@ -84,18 +66,12 @@ getValue( const IndexType localIdx ) const -> RealType
    return value;
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Index >
-   template< typename MatrixElementsLambda_,
-             typename CompressedRowLengthsLambda_,
-             typename Real_,
-             typename Index_ >
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Index >
+template< typename MatrixElementsLambda_, typename CompressedRowLengthsLambda_, typename Real_, typename Index_ >
 __cuda_callable__
 bool
-LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >::
-operator==( const LambdaMatrixRowView< MatrixElementsLambda_, CompressedRowLengthsLambda_, Real_, Index_ >& other ) const
+LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >::operator==(
+   const LambdaMatrixRowView< MatrixElementsLambda_, CompressedRowLengthsLambda_, Real_, Index_ >& other ) const
 {
    IndexType i = 0;
    while( i < getSize() && i < other.getSize() ) {
@@ -114,61 +90,48 @@ operator==( const LambdaMatrixRowView< MatrixElementsLambda_, CompressedRowLengt
    return true;
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Index >
-__cuda_callable__ auto
-LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >::
-begin() const -> const IteratorType
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Index >
+__cuda_callable__
+auto
+LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >::begin() const -> const IteratorType
 {
    return IteratorType( *this, 0 );
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Index >
-__cuda_callable__ auto
-LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >::
-end() const -> const IteratorType
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Index >
+__cuda_callable__
+auto
+LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >::end() const -> const IteratorType
 {
    return IteratorType( *this, this->getSize() );
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Index >
-__cuda_callable__ auto
-LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >::
-cbegin() const -> const IteratorType
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Index >
+__cuda_callable__
+auto
+LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >::cbegin() const -> const IteratorType
 {
    return IteratorType( *this, 0 );
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Index >
-__cuda_callable__ auto
-LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >::
-cend() const -> const IteratorType
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Index >
+__cuda_callable__
+auto
+LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >::cend() const -> const IteratorType
 {
    return IteratorType( *this, this->getSize() );
 }
 
-template< typename MatrixElementsLambda,
-          typename CompressedRowLengthsLambda,
-          typename Real,
-          typename Index >
-std::ostream& operator<<( std::ostream& str, const LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >& row )
+template< typename MatrixElementsLambda, typename CompressedRowLengthsLambda, typename Real, typename Index >
+std::ostream&
+operator<<( std::ostream& str, const LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >& row )
 {
-   using NonConstIndex = std::remove_const_t< typename LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >::IndexType >;
+   using NonConstIndex = std::remove_const_t<
+      typename LambdaMatrixRowView< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Index >::IndexType >;
    for( NonConstIndex i = 0; i < row.getSize(); i++ )
-         str << " [ " << row.getColumnIndex( i ) << " ] = " << row.getValue( i ) << ", ";
+      str << " [ " << row.getColumnIndex( i ) << " ] = " << row.getValue( i ) << ", ";
    return str;
 }
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/LambdaMatrixRowViewIterator.h b/src/TNL/Matrices/LambdaMatrixRowViewIterator.h
index 36e68ce817ea08fd9f9b9130b6648f8773ba54e0..60367ace512ebf16c47efce24f7119ef49dee718 100644
--- a/src/TNL/Matrices/LambdaMatrixRowViewIterator.h
+++ b/src/TNL/Matrices/LambdaMatrixRowViewIterator.h
@@ -17,78 +17,83 @@ namespace Matrices {
 template< typename RowView >
 class LambdaMatrixRowViewIterator
 {
-
-   public:
-
-      /**
-       * \brief Type of LambdaMatrixRowView
-       */
-      using RowViewType = RowView;
-
-      /**
-       * \brief The type of matrix elements.
-       */
-      using RealType = typename RowViewType::RealType;
-
-      /**
-       * \brief The type used for matrix elements indexing.
-       */
-      using IndexType = typename RowViewType::IndexType;
-
-      /**
-       * \brief The type of related matrix element.
-       */
-      using MatrixElementType = typename RowView::MatrixElementType;
-
-      /**
-       * \brief Tells whether the parent matrix is a binary matrix.
-       * @return `true` if the matrix is binary.
-       */
-      static constexpr bool isBinary() { return RowViewType::isBinary(); };
-
-      __cuda_callable__
-      LambdaMatrixRowViewIterator( const RowViewType& rowView,
-                                   const IndexType& localIdx );
-
-      /**
-       * \brief Comparison of two matrix row iterators.
-       *
-       * \param other is another matrix row iterator.
-       * \return \e true if both iterators points at the same point of the same matrix, \e false otherwise.
-       */
-      __cuda_callable__
-      bool operator==( const LambdaMatrixRowViewIterator& other ) const;
-
-      /**
-       * \brief Comparison of two matrix row iterators.
-       *
-       * \param other is another matrix row iterator.
-       * \return \e false if both iterators points at the same point of the same matrix, \e true otherwise.
-       */
-      __cuda_callable__
-      bool operator!=( const LambdaMatrixRowViewIterator& other ) const;
-
-      __cuda_callable__
-      LambdaMatrixRowViewIterator& operator++();
-
-      __cuda_callable__
-      LambdaMatrixRowViewIterator& operator--();
-
-      __cuda_callable__
-      MatrixElementType operator*();
-
-      __cuda_callable__
-      const MatrixElementType operator*() const;
-
-   protected:
-
-      const RowViewType& rowView;
-
-      IndexType localIdx = 0;
+public:
+   /**
+    * \brief Type of LambdaMatrixRowView
+    */
+   using RowViewType = RowView;
+
+   /**
+    * \brief The type of matrix elements.
+    */
+   using RealType = typename RowViewType::RealType;
+
+   /**
+    * \brief The type used for matrix elements indexing.
+    */
+   using IndexType = typename RowViewType::IndexType;
+
+   /**
+    * \brief The type of related matrix element.
+    */
+   using MatrixElementType = typename RowView::MatrixElementType;
+
+   /**
+    * \brief Tells whether the parent matrix is a binary matrix.
+    * @return `true` if the matrix is binary.
+    */
+   static constexpr bool
+   isBinary()
+   {
+      return RowViewType::isBinary();
+   };
+
+   __cuda_callable__
+   LambdaMatrixRowViewIterator( const RowViewType& rowView, const IndexType& localIdx );
+
+   /**
+    * \brief Comparison of two matrix row iterators.
+    *
+    * \param other is another matrix row iterator.
+    * \return \e true if both iterators points at the same point of the same matrix, \e false otherwise.
+    */
+   __cuda_callable__
+   bool
+   operator==( const LambdaMatrixRowViewIterator& other ) const;
+
+   /**
+    * \brief Comparison of two matrix row iterators.
+    *
+    * \param other is another matrix row iterator.
+    * \return \e false if both iterators points at the same point of the same matrix, \e true otherwise.
+    */
+   __cuda_callable__
+   bool
+   operator!=( const LambdaMatrixRowViewIterator& other ) const;
+
+   __cuda_callable__
+   LambdaMatrixRowViewIterator&
+   operator++();
+
+   __cuda_callable__
+   LambdaMatrixRowViewIterator&
+   operator--();
+
+   __cuda_callable__
+   MatrixElementType
+   operator*();
+
+   __cuda_callable__
+   const MatrixElementType
+   operator*() const;
+
+protected:
+   const RowViewType& rowView;
+
+   IndexType localIdx = 0;
 };
 
-
-   } // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/LambdaMatrixRowViewIterator.hpp>
diff --git a/src/TNL/Matrices/LambdaMatrixRowViewIterator.hpp b/src/TNL/Matrices/LambdaMatrixRowViewIterator.hpp
index 764d6d106eb653fc62685738e61ddd78a89dbb44..30fda20a8fca36a481375bf632e5a19defffedf6 100644
--- a/src/TNL/Matrices/LambdaMatrixRowViewIterator.hpp
+++ b/src/TNL/Matrices/LambdaMatrixRowViewIterator.hpp
@@ -14,28 +14,24 @@ namespace Matrices {
 
 template< typename RowView >
 __cuda_callable__
-LambdaMatrixRowViewIterator< RowView >::
-LambdaMatrixRowViewIterator( const RowViewType& rowView,
-                             const IndexType& localIdx )
+LambdaMatrixRowViewIterator< RowView >::LambdaMatrixRowViewIterator( const RowViewType& rowView, const IndexType& localIdx )
 : rowView( rowView ), localIdx( localIdx )
-{
-}
+{}
 
 template< typename RowView >
-__cuda_callable__ bool
-LambdaMatrixRowViewIterator< RowView >::
-operator==( const LambdaMatrixRowViewIterator& other ) const
+__cuda_callable__
+bool
+LambdaMatrixRowViewIterator< RowView >::operator==( const LambdaMatrixRowViewIterator& other ) const
 {
-   if( &this->rowView == &other.rowView &&
-       localIdx == other.localIdx )
+   if( &this->rowView == &other.rowView && localIdx == other.localIdx )
       return true;
    return false;
 }
 
 template< typename RowView >
-__cuda_callable__ bool
-LambdaMatrixRowViewIterator< RowView >::
-operator!=( const LambdaMatrixRowViewIterator& other ) const
+__cuda_callable__
+bool
+LambdaMatrixRowViewIterator< RowView >::operator!=( const LambdaMatrixRowViewIterator& other ) const
 {
    return ! ( other == *this );
 }
@@ -43,49 +39,44 @@ operator!=( const LambdaMatrixRowViewIterator& other ) const
 template< typename RowView >
 __cuda_callable__
 LambdaMatrixRowViewIterator< RowView >&
-LambdaMatrixRowViewIterator< RowView >::
-operator++()
+LambdaMatrixRowViewIterator< RowView >::operator++()
 {
    if( localIdx < rowView.getSize() )
-      localIdx ++;
+      localIdx++;
    return *this;
 }
 
 template< typename RowView >
 __cuda_callable__
 LambdaMatrixRowViewIterator< RowView >&
-LambdaMatrixRowViewIterator< RowView >::
-operator--()
+LambdaMatrixRowViewIterator< RowView >::operator--()
 {
    if( localIdx > 0 )
-      localIdx --;
+      localIdx--;
    return *this;
 }
 
 template< typename RowView >
-__cuda_callable__ auto
-LambdaMatrixRowViewIterator< RowView >::
-operator*() -> MatrixElementType
+__cuda_callable__
+auto
+LambdaMatrixRowViewIterator< RowView >::operator*() -> MatrixElementType
 {
-   return MatrixElementType(
-      this->rowView.getValue( this->localIdx ),
-      this->rowView.getRowIndex(),
-      this->rowView.getColumnIndex( this->localIdx ),
-      this->localIdx );
+   return MatrixElementType( this->rowView.getValue( this->localIdx ),
+                             this->rowView.getRowIndex(),
+                             this->rowView.getColumnIndex( this->localIdx ),
+                             this->localIdx );
 }
 
 template< typename RowView >
-__cuda_callable__ auto
-LambdaMatrixRowViewIterator< RowView >::
-operator*() const -> const MatrixElementType
+__cuda_callable__
+auto
+LambdaMatrixRowViewIterator< RowView >::operator*() const -> const MatrixElementType
 {
-   return MatrixElementType(
-      this->rowView.getValue( this->localIdx ),
-      this->rowView.getRowIndex(),
-      this->rowView.getColumnIndex( this->localIdx ),
-      this->localIdx );
+   return MatrixElementType( this->rowView.getValue( this->localIdx ),
+                             this->rowView.getRowIndex(),
+                             this->rowView.getColumnIndex( this->localIdx ),
+                             this->localIdx );
 }
 
-
-   } // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/Matrix.h b/src/TNL/Matrices/Matrix.h
index d3af021d2cc348dc1918f07b93aceb1e68928117..1b6231e9ea9e439742ed70564810c2d82a63db47 100644
--- a/src/TNL/Matrices/Matrix.h
+++ b/src/TNL/Matrices/Matrix.h
@@ -36,206 +36,215 @@ template< typename Real = double,
           typename RealAllocator = typename Allocators::Default< Device >::template Allocator< std::remove_const_t< Real > > >
 class Matrix : public Object
 {
-   public:
-      using RealAllocatorType = RealAllocator;
-      using RowsCapacitiesType = Containers::Vector< Index, Device, Index >;
-      using RowsCapacitiesView = Containers::VectorView< Index, Device, Index >;
-      using ConstRowsCapacitiesView = typename RowsCapacitiesView::ConstViewType;
-
-      /**
-       * \brief The type of matrix elements.
-       */
-      using RealType = Real;
-
-      /**
-       * \brief The device where the matrix is allocated.
-       */
-      using DeviceType = Device;
-
-      /**
-       * \brief The type used for matrix elements indexing.
-       */
-      using IndexType = Index;
-
-      /**
-       * \brief Type of base matrix view.
-       *
-       */
-      using ViewType = MatrixView< Real, Device, Index >;
-
-      /**
-       * \brief Type of base matrix view for constant instances.
-       *
-       */
-      using ConstViewType = typename MatrixView< Real, Device, Index >::ConstViewType;
-
-      /**
-       * \brief Type of vector holding values of matrix elements.
-       */
-      using ValuesType = Containers::Vector< Real, Device, Index, RealAllocator >;
-
-      /**
-       * \brief Type of constant vector holding values of matrix elements.
-       */
-      using ConstValuesType = Containers::Vector< std::add_const_t< Real >, Device, Index, RealAllocator >;
-
-      /**
-       * \brief Type of vector view holding values of matrix elements.
-       */
-      using ValuesView = typename ViewType::ValuesView;
-
-      /**
-       * \brief Type of constant vector view holding values of matrix elements.
-       */
-      using ConstValuesView = typename ViewType::ConstValuesView;
-
-      /**
-       * \brief Construct a new Matrix object possibly with user defined allocator of the matrix values.
-       *
-       * \param allocator is is a user defined allocator of the matrix values.
-       */
-      Matrix( const RealAllocatorType& allocator = RealAllocatorType() );
-
-      /**
-       * \brief Construct a new Matrix object with given dimensions and possibly user defined allocator of the matrix values.
-       *
-       * \param rows is a number of matrix rows.
-       * \param columns is a number of matrix columns.
-       * \param allocator is a user defined allocator of the matrix values.
-       */
-      Matrix( const IndexType rows,
-            const IndexType columns,
-            const RealAllocatorType& allocator = RealAllocatorType() );
-
-      /**
-       * \brief Method for setting or changing of the matrix dimensions.
-       *
-       * \param rows is a number of matrix rows.
-       * \param columns is a number of matrix columns.
-       */
-      virtual void setDimensions( const IndexType rows,
-                                  const IndexType columns );
-
-      /**
-       * \brief Set the matrix dimensions to be equal to those of the input matrix.
-       *
-       * \tparam Matrix_ is a type if the input matrix.
-       * \param matrix is an instance of the matrix.
-       */
-      template< typename Matrix_ >
-      void setLike( const Matrix_& matrix );
-
-      /**
-       * \brief Tells the number of allocated matrix elements.
-       *
-       * In the case of dense matrices, this is just product of the number of rows and the number of columns.
-       * But for other matrix types like sparse matrices, this can be different.
-       *
-       * \return Number of allocated matrix elements.
-       */
-      IndexType getAllocatedElementsCount() const;
-
-      /**
-       * \brief Computes a current number of nonzero matrix elements.
-       *
-       * \return number of nonzero matrix elements.
-       */
-      IndexType getNonzeroElementsCount() const;
-
-      /**
-       * \brief Reset the matrix.
-       *
-       * The matrix dimensions are set to zero and all matrix elements are freed from the memrory.
-       */
-      void reset();
-
-      /**
-       * \brief Returns number of matrix rows.
-       *
-       * \return number of matrix row.
-       */
-      __cuda_callable__
-      IndexType getRows() const;
-
-      /**
-       * \brief Returns number of matrix columns.
-       *
-       * @return number of matrix columns.
-       */
-      __cuda_callable__
-      IndexType getColumns() const;
-
-      /**
-       * \brief Returns a constant reference to a vector with the matrix elements values.
-       *
-       * \return constant reference to a vector with the matrix elements values.
-       */
-      const ValuesType& getValues() const;
-
-      /**
-       * \brief Returns a reference to a vector with the matrix elements values.
-       *
-       * \return constant reference to a vector with the matrix elements values.
-       */
-      ValuesType& getValues();
-
-      /**
-       * \brief Comparison operator with another arbitrary matrix type.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return \e true if the RHS matrix is equal, \e false otherwise.
-       */
-      template< typename Matrix >
-      bool operator == ( const Matrix& matrix ) const;
-
-      /**
-       * \brief Comparison operator with another arbitrary matrix type.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return \e true if the RHS matrix is equal, \e false otherwise.
-       */
-      template< typename Matrix >
-      bool operator != ( const Matrix& matrix ) const;
-
-      /**
-       * \brief Method for saving the matrix to a file.
-       *
-       * \param file is the output file.
-       */
-      virtual void save( File& file ) const;
-
-      /**
-       * \brief Method for loading the matrix from a file.
-       *
-       * \param file is the input file.
-       */
-      virtual void load( File& file );
-
-      /**
-       * \brief Method for printing the matrix to output stream.
-       *
-       * \param str is the output stream.
-       */
-      virtual void print( std::ostream& str ) const;
-
-
-      // TODO: method for symmetric matrices, should not be in general Matrix interface
-      //[[deprecated]]
-      //__cuda_callable__
-      //const IndexType& getNumberOfColors() const;
-
-      // TODO: method for symmetric matrices, should not be in general Matrix interface
-      //[[deprecated]]
-      //void computeColorsVector(Containers::Vector<Index, Device, Index> &colorsVector);
-
-      protected:
-
-      IndexType rows, columns;
-
-      // TODO: remove
-      //IndexType numberOfColors;
-
-      ValuesType values;
+public:
+   using RealAllocatorType = RealAllocator;
+   using RowsCapacitiesType = Containers::Vector< Index, Device, Index >;
+   using RowsCapacitiesView = Containers::VectorView< Index, Device, Index >;
+   using ConstRowsCapacitiesView = typename RowsCapacitiesView::ConstViewType;
+
+   /**
+    * \brief The type of matrix elements.
+    */
+   using RealType = Real;
+
+   /**
+    * \brief The device where the matrix is allocated.
+    */
+   using DeviceType = Device;
+
+   /**
+    * \brief The type used for matrix elements indexing.
+    */
+   using IndexType = Index;
+
+   /**
+    * \brief Type of base matrix view.
+    *
+    */
+   using ViewType = MatrixView< Real, Device, Index >;
+
+   /**
+    * \brief Type of base matrix view for constant instances.
+    *
+    */
+   using ConstViewType = typename MatrixView< Real, Device, Index >::ConstViewType;
+
+   /**
+    * \brief Type of vector holding values of matrix elements.
+    */
+   using ValuesType = Containers::Vector< Real, Device, Index, RealAllocator >;
+
+   /**
+    * \brief Type of constant vector holding values of matrix elements.
+    */
+   using ConstValuesType = Containers::Vector< std::add_const_t< Real >, Device, Index, RealAllocator >;
+
+   /**
+    * \brief Type of vector view holding values of matrix elements.
+    */
+   using ValuesView = typename ViewType::ValuesView;
+
+   /**
+    * \brief Type of constant vector view holding values of matrix elements.
+    */
+   using ConstValuesView = typename ViewType::ConstValuesView;
+
+   /**
+    * \brief Construct a new Matrix object possibly with user defined allocator of the matrix values.
+    *
+    * \param allocator is is a user defined allocator of the matrix values.
+    */
+   Matrix( const RealAllocatorType& allocator = RealAllocatorType() );
+
+   /**
+    * \brief Construct a new Matrix object with given dimensions and possibly user defined allocator of the matrix values.
+    *
+    * \param rows is a number of matrix rows.
+    * \param columns is a number of matrix columns.
+    * \param allocator is a user defined allocator of the matrix values.
+    */
+   Matrix( IndexType rows, IndexType columns, const RealAllocatorType& allocator = RealAllocatorType() );
+
+   /**
+    * \brief Method for setting or changing of the matrix dimensions.
+    *
+    * \param rows is a number of matrix rows.
+    * \param columns is a number of matrix columns.
+    */
+   virtual void
+   setDimensions( IndexType rows, IndexType columns );
+
+   /**
+    * \brief Set the matrix dimensions to be equal to those of the input matrix.
+    *
+    * \tparam Matrix_ is a type if the input matrix.
+    * \param matrix is an instance of the matrix.
+    */
+   template< typename Matrix_ >
+   void
+   setLike( const Matrix_& matrix );
+
+   /**
+    * \brief Tells the number of allocated matrix elements.
+    *
+    * In the case of dense matrices, this is just product of the number of rows and the number of columns.
+    * But for other matrix types like sparse matrices, this can be different.
+    *
+    * \return Number of allocated matrix elements.
+    */
+   IndexType
+   getAllocatedElementsCount() const;
+
+   /**
+    * \brief Computes a current number of nonzero matrix elements.
+    *
+    * \return number of nonzero matrix elements.
+    */
+   virtual IndexType
+   getNonzeroElementsCount() const;
+
+   /**
+    * \brief Reset the matrix.
+    *
+    * The matrix dimensions are set to zero and all matrix elements are freed from the memrory.
+    */
+   void
+   reset();
+
+   /**
+    * \brief Returns number of matrix rows.
+    *
+    * \return number of matrix row.
+    */
+   __cuda_callable__
+   IndexType
+   getRows() const;
+
+   /**
+    * \brief Returns number of matrix columns.
+    *
+    * @return number of matrix columns.
+    */
+   __cuda_callable__
+   IndexType
+   getColumns() const;
+
+   /**
+    * \brief Returns a constant reference to a vector with the matrix elements values.
+    *
+    * \return constant reference to a vector with the matrix elements values.
+    */
+   const ValuesType&
+   getValues() const;
+
+   /**
+    * \brief Returns a reference to a vector with the matrix elements values.
+    *
+    * \return constant reference to a vector with the matrix elements values.
+    */
+   ValuesType&
+   getValues();
+
+   /**
+    * \brief Comparison operator with another arbitrary matrix type.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return \e true if the RHS matrix is equal, \e false otherwise.
+    */
+   template< typename Matrix >
+   bool
+   operator==( const Matrix& matrix ) const;
+
+   /**
+    * \brief Comparison operator with another arbitrary matrix type.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return \e true if the RHS matrix is equal, \e false otherwise.
+    */
+   template< typename Matrix >
+   bool
+   operator!=( const Matrix& matrix ) const;
+
+   /**
+    * \brief Method for saving the matrix to a file.
+    *
+    * \param file is the output file.
+    */
+   void
+   save( File& file ) const override;
+
+   /**
+    * \brief Method for loading the matrix from a file.
+    *
+    * \param file is the input file.
+    */
+   void
+   load( File& file ) override;
+
+   /**
+    * \brief Method for printing the matrix to output stream.
+    *
+    * \param str is the output stream.
+    */
+   virtual void
+   print( std::ostream& str ) const;
+
+   // TODO: method for symmetric matrices, should not be in general Matrix interface
+   //[[deprecated]]
+   //__cuda_callable__
+   // const IndexType& getNumberOfColors() const;
+
+   // TODO: method for symmetric matrices, should not be in general Matrix interface
+   //[[deprecated]]
+   // void computeColorsVector(Containers::Vector<Index, Device, Index> &colorsVector);
+
+protected:
+   IndexType rows, columns;
+
+   // TODO: remove
+   // IndexType numberOfColors;
+
+   ValuesType values;
 };
 
 /**
@@ -251,13 +260,14 @@ class Matrix : public Object
  * \return a reference on the output stream \ref std::ostream&.
  */
 template< typename Real, typename Device, typename Index >
-std::ostream& operator << ( std::ostream& str, const Matrix< Real, Device, Index >& matrix )
+std::ostream&
+operator<<( std::ostream& str, const Matrix< Real, Device, Index >& matrix )
 {
    matrix.print( str );
    return str;
 }
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/Matrix.hpp>
diff --git a/src/TNL/Matrices/Matrix.hpp b/src/TNL/Matrices/Matrix.hpp
index 9249d7b458293f37c6455a4e46b3619f5bc5281d..aac86f33316321b1671522872bd8500f173859e2 100644
--- a/src/TNL/Matrices/Matrix.hpp
+++ b/src/TNL/Matrices/Matrix.hpp
@@ -15,137 +15,99 @@
 namespace TNL {
 namespace Matrices {
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename RealAllocator >
-Matrix< Real, Device, Index, RealAllocator >::
-Matrix( const RealAllocatorType& allocator )
-: rows( 0 ),
-  columns( 0 ),
-  values( allocator )
-{
-}
-
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename RealAllocator >
-Matrix< Real, Device, Index, RealAllocator >::
-Matrix( const IndexType rows_, const IndexType columns_, const RealAllocatorType& allocator )
-: rows( rows_ ),
-  columns( columns_ ),
-  values( allocator )
-{
-}
-
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename RealAllocator >
-void Matrix< Real, Device, Index, RealAllocator >::setDimensions( const IndexType rows,
-                                                   const IndexType columns )
+template< typename Real, typename Device, typename Index, typename RealAllocator >
+Matrix< Real, Device, Index, RealAllocator >::Matrix( const RealAllocatorType& allocator )
+: rows( 0 ), columns( 0 ), values( allocator )
+{}
+
+template< typename Real, typename Device, typename Index, typename RealAllocator >
+Matrix< Real, Device, Index, RealAllocator >::Matrix( const IndexType rows_,
+                                                      const IndexType columns_,
+                                                      const RealAllocatorType& allocator )
+: rows( rows_ ), columns( columns_ ), values( allocator )
+{}
+
+template< typename Real, typename Device, typename Index, typename RealAllocator >
+void
+Matrix< Real, Device, Index, RealAllocator >::setDimensions( const IndexType rows, const IndexType columns )
 {
-   TNL_ASSERT( rows >= 0 && columns >= 0,
-               std::cerr << " rows = " << rows << " columns = " << columns );
+   TNL_ASSERT( rows >= 0 && columns >= 0, std::cerr << " rows = " << rows << " columns = " << columns );
    this->rows = rows;
    this->columns = columns;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename RealAllocator >
-   template< typename Matrix_ >
-void Matrix< Real, Device, Index, RealAllocator >::setLike( const Matrix_& matrix )
+template< typename Real, typename Device, typename Index, typename RealAllocator >
+template< typename Matrix_ >
+void
+Matrix< Real, Device, Index, RealAllocator >::setLike( const Matrix_& matrix )
 {
    setDimensions( matrix.getRows(), matrix.getColumns() );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename RealAllocator >
-Index Matrix< Real, Device, Index, RealAllocator >::getAllocatedElementsCount() const
+template< typename Real, typename Device, typename Index, typename RealAllocator >
+Index
+Matrix< Real, Device, Index, RealAllocator >::getAllocatedElementsCount() const
 {
    return this->values.getSize();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename RealAllocator >
-Index Matrix< Real, Device, Index, RealAllocator >::getNonzeroElementsCount() const
+template< typename Real, typename Device, typename Index, typename RealAllocator >
+Index
+Matrix< Real, Device, Index, RealAllocator >::getNonzeroElementsCount() const
 {
    const auto values_view = this->values.getConstView();
-   auto fetch = [=] __cuda_callable__ ( const IndexType i ) -> IndexType {
+   auto fetch = [ = ] __cuda_callable__( const IndexType i ) -> IndexType
+   {
       return ( values_view[ i ] != 0.0 );
    };
-   return Algorithms::reduce< DeviceType >( 0, this->values.getSize(), fetch, std::plus<>{}, 0 );
+   return Algorithms::reduce< DeviceType >( (IndexType) 0, this->values.getSize(), fetch, std::plus<>{}, 0 );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, typename RealAllocator >
 __cuda_callable__
-Index Matrix< Real, Device, Index, RealAllocator >::getRows() const
+Index
+Matrix< Real, Device, Index, RealAllocator >::getRows() const
 {
    return this->rows;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, typename RealAllocator >
 __cuda_callable__
-Index Matrix< Real, Device, Index, RealAllocator >::getColumns() const
+Index
+Matrix< Real, Device, Index, RealAllocator >::getColumns() const
 {
    return this->columns;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, typename RealAllocator >
 auto
-Matrix< Real, Device, Index, RealAllocator >::
-getValues() const -> const ValuesType&
+Matrix< Real, Device, Index, RealAllocator >::getValues() const -> const ValuesType&
 {
    return this->values;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, typename RealAllocator >
 auto
-Matrix< Real, Device, Index, RealAllocator >::
-getValues() -> ValuesType&
+Matrix< Real, Device, Index, RealAllocator >::getValues() -> ValuesType&
 {
    return this->values;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename RealAllocator >
-void Matrix< Real, Device, Index, RealAllocator >::reset()
+template< typename Real, typename Device, typename Index, typename RealAllocator >
+void
+Matrix< Real, Device, Index, RealAllocator >::reset()
 {
    this->rows = 0;
    this->columns = 0;
    this->values.reset();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename RealAllocator >
-   template< typename MatrixT >
-bool Matrix< Real, Device, Index, RealAllocator >::operator == ( const MatrixT& matrix ) const
+template< typename Real, typename Device, typename Index, typename RealAllocator >
+template< typename MatrixT >
+bool
+Matrix< Real, Device, Index, RealAllocator >::operator==( const MatrixT& matrix ) const
 {
-   if( this->getRows() != matrix.getRows() ||
-       this->getColumns() != matrix.getColumns() )
+   if( this->getRows() != matrix.getRows() || this->getColumns() != matrix.getColumns() )
       return false;
    for( IndexType row = 0; row < this->getRows(); row++ )
       for( IndexType column = 0; column < this->getColumns(); column++ )
@@ -154,21 +116,17 @@ bool Matrix< Real, Device, Index, RealAllocator >::operator == ( const MatrixT&
    return true;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename RealAllocator >
-   template< typename MatrixT >
-bool Matrix< Real, Device, Index, RealAllocator >::operator != ( const MatrixT& matrix ) const
+template< typename Real, typename Device, typename Index, typename RealAllocator >
+template< typename MatrixT >
+bool
+Matrix< Real, Device, Index, RealAllocator >::operator!=( const MatrixT& matrix ) const
 {
-   return ! operator == ( matrix );
+   return ! operator==( matrix );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename RealAllocator >
-void Matrix< Real, Device, Index, RealAllocator >::save( File& file ) const
+template< typename Real, typename Device, typename Index, typename RealAllocator >
+void
+Matrix< Real, Device, Index, RealAllocator >::save( File& file ) const
 {
    Object::save( file );
    file.save( &this->rows );
@@ -176,11 +134,9 @@ void Matrix< Real, Device, Index, RealAllocator >::save( File& file ) const
    file << this->values;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename RealAllocator >
-void Matrix< Real, Device, Index, RealAllocator >::load( File& file )
+template< typename Real, typename Device, typename Index, typename RealAllocator >
+void
+Matrix< Real, Device, Index, RealAllocator >::load( File& file )
 {
    Object::load( file );
    file.load( &this->rows );
@@ -188,13 +144,10 @@ void Matrix< Real, Device, Index, RealAllocator >::load( File& file )
    file >> this->values;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename RealAllocator >
-void Matrix< Real, Device, Index, RealAllocator >::print( std::ostream& str ) const
-{
-}
+template< typename Real, typename Device, typename Index, typename RealAllocator >
+void
+Matrix< Real, Device, Index, RealAllocator >::print( std::ostream& str ) const
+{}
 
 /*
 template< typename Real,
@@ -235,5 +188,5 @@ computeColorsVector(Containers::Vector<Index, Device, Index> &colorsVector)
     }
 }*/
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/MatrixInfo.h b/src/TNL/Matrices/MatrixInfo.h
index 9afc76f69eb10db01732f04720b14fc88710602d..f9d8f82b9b867371e0ba950a2087ab2e76359ad7 100644
--- a/src/TNL/Matrices/MatrixInfo.h
+++ b/src/TNL/Matrices/MatrixInfo.h
@@ -33,39 +33,40 @@ struct MatrixInfo
 
 /// This is to prevent from appearing in Doxygen documentation.
 /// \cond HIDDEN_CLASS
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 struct MatrixInfo< DenseMatrixView< Real, Device, Index, Organization > >
 {
-   static String getDensity() { return String( "dense" ); };
+   static String
+   getDensity()
+   {
+      return "dense";
+   };
 };
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 struct MatrixInfo< DenseMatrix< Real, Device, Index, Organization, RealAllocator > >
 : public MatrixInfo< typename DenseMatrix< Real, Device, Index, Organization, RealAllocator >::ViewType >
-{
-};
+{};
 
 template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename Device_, typename Index_ > class SegmentsView >
+          template< typename Device_, typename Index_ >
+          class SegmentsView >
 struct MatrixInfo< SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView > >
 {
-   static String getDensity() { return String( "sparse" ); };
+   static String
+   getDensity()
+   {
+      return "sparse";
+   };
 
-   static String getFormat()
+   static String
+   getFormat()
    {
       String prefix;
-      if( MatrixType::isSymmetric() )
-      {
+      if( MatrixType::isSymmetric() ) {
          if( std::is_same< Real, bool >::value )
             prefix = "Symmetric Binary ";
          else
@@ -81,164 +82,293 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename Device_, typename Index_, typename IndexAllocator_ > class Segments,
+          template< typename Device_, typename Index_, typename IndexAllocator_ >
+          class Segments,
           typename RealAllocator,
           typename IndexAllocator >
 struct MatrixInfo< SparseMatrix< Real, Device, Index, MatrixType, Segments, RealAllocator, IndexAllocator > >
-: public MatrixInfo< typename SparseMatrix< Real, Device, Index, MatrixType, Segments, RealAllocator, IndexAllocator >::ViewType >
-{
-};
+: public MatrixInfo<
+     typename SparseMatrix< Real, Device, Index, MatrixType, Segments, RealAllocator, IndexAllocator >::ViewType >
+{};
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
+template< typename Real, typename Device, typename Index, typename MatrixType >
 struct MatrixInfo< Sandbox::SparseSandboxMatrixView< Real, Device, Index, MatrixType > >
 {
-   static String getDensity() { return String( "sparse" ); };
+   static String
+   getDensity()
+   {
+      return "sparse";
+   };
 
-   static String getFormat()
+   static String
+   getFormat()
    {
       if( MatrixType::isSymmetric() )
-         return TNL::String( "Symmetric Sandbox" );
+         return "Symmetric Sandbox";
       else
-         return TNL::String( "Sandbox" );
+         return "Sandbox";
    };
 };
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
 struct MatrixInfo< Sandbox::SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator > >
-: public MatrixInfo< typename Sandbox::SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::ViewType >
-{
-};
+: public MatrixInfo<
+     typename Sandbox::SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::ViewType >
+{};
 
 /////
 // Legacy matrices
 template< typename Real, typename Device, typename Index >
 struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::BiEllpack< Real, Device, Index > >
 {
-   static String getDensity() { return String( "sparse" ); };
+   static String
+   getDensity()
+   {
+      return "sparse";
+   };
 
-   static String getFormat() { return "BiEllpack Legacy"; };
+   static String
+   getFormat()
+   {
+      return "BiEllpack Legacy";
+   };
 };
 
 template< typename Real, typename Device, typename Index >
-struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::CSR< Real, Device, Index, Benchmarks::SpMV::ReferenceFormats::Legacy::CSRScalar > >
+struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::
+                      CSR< Real, Device, Index, Benchmarks::SpMV::ReferenceFormats::Legacy::CSRScalar > >
 {
-   static String getDensity() { return String( "sparse" ); };
+   static String
+   getDensity()
+   {
+      return "sparse";
+   };
 
-   static String getFormat() { return "CSR Legacy Scalar"; };
+   static String
+   getFormat()
+   {
+      return "CSR Legacy Scalar";
+   };
 };
 
 template< typename Real, typename Device, typename Index >
-struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::CSR< Real, Device, Index, Benchmarks::SpMV::ReferenceFormats::Legacy::CSRVector> >
+struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::
+                      CSR< Real, Device, Index, Benchmarks::SpMV::ReferenceFormats::Legacy::CSRVector > >
 {
-   static String getDensity() { return String( "sparse" ); };
+   static String
+   getDensity()
+   {
+      return "sparse";
+   };
 
-   static String getFormat() { return "CSR Legacy Vector"; };
+   static String
+   getFormat()
+   {
+      return "CSR Legacy Vector";
+   };
 };
 
 template< typename Real, typename Device, typename Index >
-struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::CSR< Real, Device, Index, Benchmarks::SpMV::ReferenceFormats::Legacy::CSRLight > >
+struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::
+                      CSR< Real, Device, Index, Benchmarks::SpMV::ReferenceFormats::Legacy::CSRLight > >
 {
-   static String getDensity() { return String( "sparse" ); };
+   static String
+   getDensity()
+   {
+      return "sparse";
+   };
 
-   static String getFormat() { return "CSR Legacy Light"; };
+   static String
+   getFormat()
+   {
+      return "CSR Legacy Light";
+   };
 };
 
 template< typename Real, typename Device, typename Index >
-struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::CSR< Real, Device, Index, Benchmarks::SpMV::ReferenceFormats::Legacy::CSRLight2 > >
+struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::
+                      CSR< Real, Device, Index, Benchmarks::SpMV::ReferenceFormats::Legacy::CSRLight2 > >
 {
-   static String getDensity() { return String( "sparse" ); };
+   static String
+   getDensity()
+   {
+      return "sparse";
+   };
 
-   static String getFormat() { return "CSR Legacy Light2"; };
+   static String
+   getFormat()
+   {
+      return "CSR Legacy Light2";
+   };
 };
 
 template< typename Real, typename Device, typename Index >
-struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::CSR< Real, Device, Index, Benchmarks::SpMV::ReferenceFormats::Legacy::CSRLight3 > >
+struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::
+                      CSR< Real, Device, Index, Benchmarks::SpMV::ReferenceFormats::Legacy::CSRLight3 > >
 {
-   static String getDensity() { return String( "sparse" ); };
+   static String
+   getDensity()
+   {
+      return "sparse";
+   };
 
-   static String getFormat() { return "CSR Legacy Light3"; };
+   static String
+   getFormat()
+   {
+      return "CSR Legacy Light3";
+   };
 };
 
 template< typename Real, typename Device, typename Index >
-struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::CSR< Real, Device, Index, Benchmarks::SpMV::ReferenceFormats::Legacy::CSRLight4 > >
+struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::
+                      CSR< Real, Device, Index, Benchmarks::SpMV::ReferenceFormats::Legacy::CSRLight4 > >
 {
-   static String getDensity() { return String( "sparse" ); };
+   static String
+   getDensity()
+   {
+      return "sparse";
+   };
 
-   static String getFormat() { return "CSR Legacy Light4"; };
+   static String
+   getFormat()
+   {
+      return "CSR Legacy Light4";
+   };
 };
 
 template< typename Real, typename Device, typename Index >
-struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::CSR< Real, Device, Index, Benchmarks::SpMV::ReferenceFormats::Legacy::CSRLight5 > >
+struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::
+                      CSR< Real, Device, Index, Benchmarks::SpMV::ReferenceFormats::Legacy::CSRLight5 > >
 {
-   static String getDensity() { return String( "sparse" ); };
+   static String
+   getDensity()
+   {
+      return "sparse";
+   };
 
-   static String getFormat() { return "CSR Legacy Light5"; };
+   static String
+   getFormat()
+   {
+      return "CSR Legacy Light5";
+   };
 };
 
 template< typename Real, typename Device, typename Index >
-struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::CSR< Real, Device, Index, Benchmarks::SpMV::ReferenceFormats::Legacy::CSRLight6 > >
+struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::
+                      CSR< Real, Device, Index, Benchmarks::SpMV::ReferenceFormats::Legacy::CSRLight6 > >
 {
-   static String getDensity() { return String( "sparse" ); };
+   static String
+   getDensity()
+   {
+      return "sparse";
+   };
 
-   static String getFormat() { return "CSR Legacy Light6"; };
+   static String
+   getFormat()
+   {
+      return "CSR Legacy Light6";
+   };
 };
 
 template< typename Real, typename Device, typename Index >
-struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::CSR< Real, Device, Index, Benchmarks::SpMV::ReferenceFormats::Legacy::CSRAdaptive > >
+struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::
+                      CSR< Real, Device, Index, Benchmarks::SpMV::ReferenceFormats::Legacy::CSRAdaptive > >
 {
-   static String getDensity() { return String( "sparse" ); };
+   static String
+   getDensity()
+   {
+      return "sparse";
+   };
 
-   static String getFormat() { return "CSR Legacy Adaptive"; };
+   static String
+   getFormat()
+   {
+      return "CSR Legacy Adaptive";
+   };
 };
 
 template< typename Real, typename Device, typename Index >
-struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::CSR< Real, Device, Index, Benchmarks::SpMV::ReferenceFormats::Legacy::CSRMultiVector > >
+struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::
+                      CSR< Real, Device, Index, Benchmarks::SpMV::ReferenceFormats::Legacy::CSRMultiVector > >
 {
-   static String getDensity() { return String( "sparse" ); };
+   static String
+   getDensity()
+   {
+      return "sparse";
+   };
 
-   static String getFormat() { return "CSR Legacy MultiVector"; };
+   static String
+   getFormat()
+   {
+      return "CSR Legacy MultiVector";
+   };
 };
 
 template< typename Real, typename Device, typename Index >
-struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::CSR< Real, Device, Index, Benchmarks::SpMV::ReferenceFormats::Legacy::CSRLightWithoutAtomic > >
+struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::
+                      CSR< Real, Device, Index, Benchmarks::SpMV::ReferenceFormats::Legacy::CSRLightWithoutAtomic > >
 {
-   static String getDensity() { return String( "sparse" ); };
+   static String
+   getDensity()
+   {
+      return "sparse";
+   };
 
-   static String getFormat() { return "CSR Legacy LightWithoutAtomic"; };
+   static String
+   getFormat()
+   {
+      return "CSR Legacy LightWithoutAtomic";
+   };
 };
 
 template< typename Real, typename Device, typename Index >
 struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::ChunkedEllpack< Real, Device, Index > >
 {
-   static String getDensity() { return String( "sparse" ); };
+   static String
+   getDensity()
+   {
+      return "sparse";
+   };
 
-   static String getFormat() { return "ChunkedEllpack Legacy"; };
+   static String
+   getFormat()
+   {
+      return "ChunkedEllpack Legacy";
+   };
 };
 
 template< typename Real, typename Device, typename Index >
 struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::Ellpack< Real, Device, Index > >
 {
-   static String getDensity() { return String( "sparse" ); };
+   static String
+   getDensity()
+   {
+      return "sparse";
+   };
 
-   static String getFormat() { return "Ellpack Legacy"; };
+   static String
+   getFormat()
+   {
+      return "Ellpack Legacy";
+   };
 };
 
 template< typename Real, typename Device, typename Index, int SliceSize >
-struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::SlicedEllpack< Real, Device, Index, SliceSize> >
+struct MatrixInfo< Benchmarks::SpMV::ReferenceFormats::Legacy::SlicedEllpack< Real, Device, Index, SliceSize > >
 {
-   static String getDensity() { return String( "sparse" ); };
+   static String
+   getDensity()
+   {
+      return "sparse";
+   };
 
-   static String getFormat() { return "SlicedEllpack Legacy"; };
+   static String
+   getFormat()
+   {
+      return "SlicedEllpack Legacy";
+   };
 };
 
 /// \endcond
-} //namespace Matrices
-} //namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/MatrixOperations.h b/src/TNL/Matrices/MatrixOperations.h
index 4c1f1272d78a5f265492d30965ceb212afb1784b..e5548343e4cedaa099418fba4b15671d0b1c95ef 100644
--- a/src/TNL/Matrices/MatrixOperations.h
+++ b/src/TNL/Matrices/MatrixOperations.h
@@ -39,8 +39,7 @@ public:
     *
     * It is assumed that n is much smaller than m.
     */
-   template< typename RealType,
-             typename IndexType >
+   template< typename RealType, typename IndexType >
    static void
    gemv( const IndexType m,
          const IndexType n,
@@ -61,17 +60,17 @@ public:
 
       if( n == 1 ) {
          if( beta != 0.0 ) {
-            #ifdef HAVE_OPENMP
-            #pragma omp parallel for if( TNL::Devices::Host::isOMPEnabled() )
-            #endif
+#ifdef HAVE_OPENMP
+#pragma omp parallel for if( TNL::Devices::Host::isOMPEnabled() )
+#endif
             for( IndexType j = 0; j < m; j++ )
                y[ j ] = A[ j ] * alphax[ 0 ] + beta * y[ j ];
          }
          else {
-            // the vector y might be uninitialized, and 0.0 * NaN = NaN
-            #ifdef HAVE_OPENMP
-            #pragma omp parallel for if( TNL::Devices::Host::isOMPEnabled() )
-            #endif
+// the vector y might be uninitialized, and 0.0 * NaN = NaN
+#ifdef HAVE_OPENMP
+#pragma omp parallel for if( TNL::Devices::Host::isOMPEnabled() )
+#endif
             for( IndexType j = 0; j < m; j++ )
                y[ j ] = A[ j ] * alphax[ 0 ];
          }
@@ -82,15 +81,15 @@ public:
          constexpr IndexType block_size = 128;
          const IndexType blocks = m / block_size;
 
-         #ifdef HAVE_OPENMP
-         #pragma omp parallel if( TNL::Devices::Host::isOMPEnabled() && blocks >= 2 )
-         #endif
+#ifdef HAVE_OPENMP
+#pragma omp parallel if( TNL::Devices::Host::isOMPEnabled() && blocks >= 2 )
+#endif
          {
             RealType aux[ block_size ];
 
-            #ifdef HAVE_OPENMP
-            #pragma omp for nowait
-            #endif
+#ifdef HAVE_OPENMP
+#pragma omp for nowait
+#endif
             for( IndexType b = 0; b < blocks; b++ ) {
                const IndexType block_offset = b * block_size;
 
@@ -117,10 +116,10 @@ public:
                }
             }
 
-            // the first thread that reaches here processes the last, incomplete block
-            #ifdef HAVE_OPENMP
-            #pragma omp single nowait
-            #endif
+// the first thread that reaches here processes the last, incomplete block
+#ifdef HAVE_OPENMP
+#pragma omp single nowait
+#endif
             {
                // TODO: unlike the complete blocks, the tail is traversed row-wise
                if( beta != 0.0 ) {
@@ -143,7 +142,6 @@ public:
             }
          }
       }
-
    }
 
    /*
@@ -157,8 +155,7 @@ public:
     *
     * It is assumed that n is much smaller than m.
     */
-   template< typename RealType,
-             typename IndexType >
+   template< typename RealType, typename IndexType >
    static void
    geam( const IndexType m,
          const IndexType n,
@@ -178,9 +175,9 @@ public:
       TNL_ASSERT_GE( ldc, m, "lda must be at least m" );
 
       if( n == 1 ) {
-         #ifdef HAVE_OPENMP
-         #pragma omp parallel for if( TNL::Devices::Host::isOMPEnabled() )
-         #endif
+#ifdef HAVE_OPENMP
+#pragma omp parallel for if( TNL::Devices::Host::isOMPEnabled() )
+#endif
          for( IndexType j = 0; j < m; j++ )
             C[ j ] = alpha * A[ j ] + beta * B[ j ];
       }
@@ -190,13 +187,13 @@ public:
          constexpr IndexType block_size = 128;
          const IndexType blocks = m / block_size;
 
-         #ifdef HAVE_OPENMP
-         #pragma omp parallel if( TNL::Devices::Host::isOMPEnabled() && blocks >= 2 )
-         #endif
+#ifdef HAVE_OPENMP
+#pragma omp parallel if( TNL::Devices::Host::isOMPEnabled() && blocks >= 2 )
+#endif
          {
-            #ifdef HAVE_OPENMP
-            #pragma omp for nowait
-            #endif
+#ifdef HAVE_OPENMP
+#pragma omp for nowait
+#endif
             for( IndexType b = 0; b < blocks; b++ ) {
                const IndexType block_offset = b * block_size;
                for( IndexType j = 0; j < n; j++ ) {
@@ -208,10 +205,10 @@ public:
                }
             }
 
-            // the first thread that reaches here processes the last, incomplete block
-            #ifdef HAVE_OPENMP
-            #pragma omp single nowait
-            #endif
+// the first thread that reaches here processes the last, incomplete block
+#ifdef HAVE_OPENMP
+#pragma omp single nowait
+#endif
             {
                for( IndexType j = 0; j < n; j++ ) {
                   const IndexType offset_A = j * lda;
@@ -223,17 +220,15 @@ public:
             }
          }
       }
-
    }
 };
 
-
 // CUDA kernels
 #ifdef HAVE_CUDA
 
-template< typename RealType,
-          typename IndexType >
-__global__ void
+template< typename RealType, typename IndexType >
+__global__
+void
 GemvCudaKernel( const IndexType m,
                 const IndexType n,
                 const RealType alpha,
@@ -273,9 +268,9 @@ GemvCudaKernel( const IndexType m,
    }
 }
 
-template< typename RealType,
-          typename IndexType >
-__global__ void
+template< typename RealType, typename IndexType >
+__global__
+void
 GeamCudaKernel( const IndexType m,
                 const IndexType n,
                 const RealType alpha,
@@ -319,8 +314,7 @@ public:
     *
     * It is assumed that n is much smaller than m.
     */
-   template< typename RealType,
-             typename IndexType >
+   template< typename RealType, typename IndexType >
    static void
    gemv( const IndexType m,
          const IndexType n,
@@ -333,13 +327,14 @@ public:
    {
       TNL_ASSERT( m <= lda, );
       TNL_ASSERT( n <= 256,
-              std::cerr << "The gemv kernel is optimized only for small 'n' and assumes that n <= 256." << std::endl; );
+                  std::cerr << "The gemv kernel is optimized only for small 'n' and assumes that n <= 256." << std::endl; );
 
 #ifdef HAVE_CUDA
       // TODO: use static storage, e.g. from the CudaReductionBuffer, to avoid frequent reallocations
       Containers::Vector< RealType, Devices::Cuda, IndexType > xDevice;
       xDevice.setSize( n );
-      Algorithms::MultiDeviceMemoryOperations< Devices::Cuda, Devices::Host >::copy< RealType, RealType, IndexType >( xDevice.getData(), x, n );
+      Algorithms::MultiDeviceMemoryOperations< Devices::Cuda, Devices::Host >::copy< RealType, RealType, IndexType >(
+         xDevice.getData(), x, n );
 
       // desGridSize = blocksPerMultiprocessor * numberOfMultiprocessors
       const int desGridSize = 32 * Cuda::DeviceInfo::getCudaMultiprocessors( Cuda::DeviceInfo::getActiveDevice() );
@@ -347,10 +342,8 @@ public:
       blockSize.x = 256;
       gridSize.x = min( desGridSize, Cuda::getNumberOfBlocks( m, blockSize.x ) );
 
-      GemvCudaKernel<<< gridSize, blockSize, n * sizeof( RealType ) >>>(
-            m, n,
-            alpha, A, lda,
-            xDevice.getData(), beta, y );
+      GemvCudaKernel<<< gridSize, blockSize,
+         n * sizeof( RealType ) >>>( m, n, alpha, A, lda, xDevice.getData(), beta, y );
       TNL_CHECK_CUDA_DEVICE;
 #else
       throw Exceptions::CudaSupportMissing();
@@ -368,8 +361,7 @@ public:
     *
     * It is assumed that n is much smaller than m.
     */
-   template< typename RealType,
-             typename IndexType >
+   template< typename RealType, typename IndexType >
    static void
    geam( const IndexType m,
          const IndexType n,
@@ -403,11 +395,7 @@ public:
       gridSize.x = min( desGridSize, Cuda::getNumberOfBlocks( m, blockSize.x ) );
       gridSize.y = Cuda::getNumberOfBlocks( n, blockSize.y );
 
-      GeamCudaKernel<<< gridSize, blockSize >>>(
-            m, n,
-            alpha, A, lda,
-            beta, B, ldb,
-            C, ldc );
+      GeamCudaKernel<<< gridSize, blockSize >>>( m, n, alpha, A, lda, beta, B, ldb, C, ldc );
       TNL_CHECK_CUDA_DEVICE;
 #else
       throw Exceptions::CudaSupportMissing();
@@ -415,5 +403,5 @@ public:
    }
 };
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/MatrixPermutationApplier.h b/src/TNL/Matrices/MatrixPermutationApplier.h
index e1c08a7ec990355d29ec190af6864015ba5721ba..dec07baea5ae6b832e7c7969171642bc78ba8a43 100644
--- a/src/TNL/Matrices/MatrixPermutationApplier.h
+++ b/src/TNL/Matrices/MatrixPermutationApplier.h
@@ -13,9 +13,9 @@
 namespace TNL {
 namespace Matrices {
 
-template< typename Matrix,
-          typename PermutationArray >
-void permuteMatrixRows( Matrix& matrix, const PermutationArray& perm )
+template< typename Matrix, typename PermutationArray >
+void
+permuteMatrixRows( Matrix& matrix, const PermutationArray& perm )
 {
    static_assert( std::is_same< typename Matrix::DeviceType, typename PermutationArray::DeviceType >::value,
                   "The matrix and permutation vector must be stored on the same device." );
@@ -24,7 +24,7 @@ void permuteMatrixRows( Matrix& matrix, const PermutationArray& perm )
    TNL_ASSERT_EQ( matrix.getRows(), perm.getSize(), "permutation size does not match the matrix size" );
 
    // FIXME: getConstView does not work
-//   const auto matrix_view = matrix.getConstView();
+   //   const auto matrix_view = matrix.getConstView();
    const auto matrix_view = matrix.getView();
    const auto perm_view = perm.getConstView();
 
@@ -36,7 +36,7 @@ void permuteMatrixRows( Matrix& matrix, const PermutationArray& perm )
    typename Matrix::RowsCapacitiesType capacities( matrix.getRows() );
    auto capacities_view = capacities.getView();
 
-   auto kernel_capacities = [=] __cuda_callable__ ( IndexType i ) mutable
+   auto kernel_capacities = [ = ] __cuda_callable__( IndexType i ) mutable
    {
       capacities_view[ i ] = matrix_view.getRowCapacity( perm_view[ i ] );
    };
@@ -45,7 +45,7 @@ void permuteMatrixRows( Matrix& matrix, const PermutationArray& perm )
    matrixCopy.setRowCapacities( capacities );
    auto copy_view = matrixCopy.getView();
 
-   auto kernel = [=] __cuda_callable__ ( IndexType i ) mutable
+   auto kernel = [ = ] __cuda_callable__( IndexType i ) mutable
    {
       const auto srcRow = matrix_view.getRow( perm_view[ i ] );
       auto destRow = copy_view.getRow( i );
@@ -61,9 +61,9 @@ void permuteMatrixRows( Matrix& matrix, const PermutationArray& perm )
    matrix = matrixCopy;
 }
 
-template< typename Matrix,
-          typename PermutationArray >
-void permuteMatrixColumns( Matrix& matrix, const PermutationArray& iperm )
+template< typename Matrix, typename PermutationArray >
+void
+permuteMatrixColumns( Matrix& matrix, const PermutationArray& iperm )
 {
    static_assert( std::is_same< typename Matrix::DeviceType, typename PermutationArray::DeviceType >::value,
                   "The matrix and permutation vector must be stored on the same device." );
@@ -73,7 +73,7 @@ void permuteMatrixColumns( Matrix& matrix, const PermutationArray& iperm )
    auto matrix_view = matrix.getView();
    const auto iperm_view = iperm.getConstView();
 
-   auto kernel = [=] __cuda_callable__ ( IndexType i ) mutable
+   auto kernel = [ = ] __cuda_callable__( IndexType i ) mutable
    {
       auto row = matrix_view.getRow( i );
       for( IndexType c = 0; c < row.getSize(); c++ ) {
@@ -89,5 +89,5 @@ void permuteMatrixColumns( Matrix& matrix, const PermutationArray& iperm )
    Algorithms::ParallelFor< DeviceType >::exec( (IndexType) 0, matrix.getRows(), kernel );
 }
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/MatrixReader.h b/src/TNL/Matrices/MatrixReader.h
index 8794f7d5acbc1e5a3f8b9a17cfb5f9597c4bad45..78879111a9936b99c9205632ace6d83fc2fbce72 100644
--- a/src/TNL/Matrices/MatrixReader.h
+++ b/src/TNL/Matrices/MatrixReader.h
@@ -28,51 +28,47 @@ namespace Matrices {
  * \par Output
  * \include MatrixWriterReaderExample.out
  */
-template< typename Matrix,
-          typename Device = typename Matrix::DeviceType >
+template< typename Matrix, typename Device = typename Matrix::DeviceType >
 class MatrixReader
 {
-   public:
-
-      /**
-       * \brief Type of matrix elements values.
-       */
-      using RealType = typename Matrix::RealType;
-
-      /**
-       * \brief Device where the matrix is allocated.
-       */
-      using DeviceType = typename Matrix::RealType;
-
-      /**
-       * \brief Type used for indexing of matrix elements.
-       */
-      using IndexType = typename Matrix::IndexType;
-
-      /**
-       * \brief Method for importing matrix from file with given filename.
-       *
-       * \param fileName is the name of the source file.
-       * \param matrix is the target matrix.
-       * \param verbose controls verbosity of the matrix import.
-       */
-      static void readMtx( const String& fileName,
-                           Matrix& matrix,
-                           bool verbose = false );
-
-      /**
-       * \brief Method for importing matrix from STL input stream.
-       *
-       * \param file is the input stream.
-       * \param matrix is the target matrix.
-       * \param verbose controls verbosity of the matrix import.
-       */
-      static void readMtx( std::istream& file,
-                           Matrix& matrix,
-                           bool verbose = false );
-
-   protected:
-      using HostMatrix = typename Matrix::template Self< RealType, TNL::Devices::Host >;
+public:
+   /**
+    * \brief Type of matrix elements values.
+    */
+   using RealType = typename Matrix::RealType;
+
+   /**
+    * \brief Device where the matrix is allocated.
+    */
+   using DeviceType = typename Matrix::RealType;
+
+   /**
+    * \brief Type used for indexing of matrix elements.
+    */
+   using IndexType = typename Matrix::IndexType;
+
+   /**
+    * \brief Method for importing matrix from file with given filename.
+    *
+    * \param fileName is the name of the source file.
+    * \param matrix is the target matrix.
+    * \param verbose controls verbosity of the matrix import.
+    */
+   static void
+   readMtx( const String& fileName, Matrix& matrix, bool verbose = false );
+
+   /**
+    * \brief Method for importing matrix from STL input stream.
+    *
+    * \param file is the input stream.
+    * \param matrix is the target matrix.
+    * \param verbose controls verbosity of the matrix import.
+    */
+   static void
+   readMtx( std::istream& file, Matrix& matrix, bool verbose = false );
+
+protected:
+   using HostMatrix = typename Matrix::template Self< RealType, TNL::Devices::Host >;
 };
 
 /// This is to prevent from appearing in Doxygen documentation.
@@ -80,95 +76,79 @@ class MatrixReader
 template< typename Matrix >
 class MatrixReader< Matrix, TNL::Devices::Host >
 {
-   public:
-
-      /**
-       * \brief Type of matrix elements values.
-       */
-      typedef typename Matrix::RealType RealType;
-
-      /**
-       * \brief Device where the matrix is allocated.
-       */
-      typedef typename Matrix::DeviceType DeviceType;
-
-      /**
-       * \brief Type used for indexing of matrix elements.
-       */
-      typedef typename Matrix::IndexType IndexType;
-
-      /**
-       * \brief Method for importing matrix from file with given filename.
-       *
-       * \param fileName is the name of the source file.
-       * \param matrix is the target matrix.
-       * \param verbose controls verbosity of the matrix import.
-       *
-       * \par Example
-       * \include Matrices/MatrixWriterReaderExample.cpp
-       * \par Output
-       * \include Matrices/MatrixWriterReaderExample.out
-       *
-       */
-      static void readMtx( const String& fileName,
-                           Matrix& matrix,
-                           bool verbose = false );
-
-      /**
-       * \brief Method for importing matrix from STL input stream.
-       *
-       * \param file is the input stream.
-       * \param matrix is the target matrix.
-       * \param verbose controls verbosity of the matrix import.
-       */
-      static void readMtx( std::istream& file,
-                           Matrix& matrix,
-                           bool verbose = false );
-
-   protected:
-
-      static void verifyMtxFile( std::istream& file,
-                                 const Matrix& matrix,
-                                 bool verbose = false );
-
-      static bool findLineByElement( std::istream& file,
-                                    const IndexType& row,
-                                    const IndexType& column,
-                                    String& line,
-                                    IndexType& lineNumber );
-
-
-      static void checkMtxHeader( const String& header,
-                                  bool& symmetric );
-
-      static void readMtxHeader( std::istream& file,
-                                 IndexType& rows,
-                                 IndexType& columns,
-                                 bool& symmetricMatrix,
-                                 bool verbose );
-
-      static void computeCompressedRowLengthsFromMtxFile( std::istream& file,
-                                                Containers::Vector< int, DeviceType, int >& rowLengths,
-                                                const int columns,
-                                                const int rows,
-                                                bool symmetricSourceMatrix,
-                                                bool symmetricTargetMatrix,
-                                                bool verbose );
-
-      static void readMatrixElementsFromMtxFile( std::istream& file,
-                                                 Matrix& matrix,
-                                                 bool symmetricMatrix,
-                                                 bool verbose );
-
-      static void parseMtxLineWithElement( const String& line,
-                                           IndexType& row,
-                                           IndexType& column,
-                                           RealType& value );
+public:
+   /**
+    * \brief Type of matrix elements values.
+    */
+   using RealType = typename Matrix::RealType;
+
+   /**
+    * \brief Device where the matrix is allocated.
+    */
+   using DeviceType = typename Matrix::DeviceType;
+
+   /**
+    * \brief Type used for indexing of matrix elements.
+    */
+   using IndexType = typename Matrix::IndexType;
+
+   /**
+    * \brief Method for importing matrix from file with given filename.
+    *
+    * \param fileName is the name of the source file.
+    * \param matrix is the target matrix.
+    * \param verbose controls verbosity of the matrix import.
+    *
+    * \par Example
+    * \include Matrices/MatrixWriterReaderExample.cpp
+    * \par Output
+    * \include Matrices/MatrixWriterReaderExample.out
+    *
+    */
+   static void
+   readMtx( const String& fileName, Matrix& matrix, bool verbose = false );
+
+   /**
+    * \brief Method for importing matrix from STL input stream.
+    *
+    * \param file is the input stream.
+    * \param matrix is the target matrix.
+    * \param verbose controls verbosity of the matrix import.
+    */
+   static void
+   readMtx( std::istream& file, Matrix& matrix, bool verbose = false );
+
+protected:
+   static void
+   verifyMtxFile( std::istream& file, const Matrix& matrix, bool verbose = false );
+
+   static bool
+   findLineByElement( std::istream& file, const IndexType& row, const IndexType& column, String& line, IndexType& lineNumber );
+
+   static void
+   checkMtxHeader( const String& header, bool& symmetric );
+
+   static void
+   readMtxHeader( std::istream& file, IndexType& rows, IndexType& columns, bool& symmetricMatrix, bool verbose );
+
+   static void
+   computeCompressedRowLengthsFromMtxFile( std::istream& file,
+                                           Containers::Vector< int, DeviceType, int >& rowLengths,
+                                           int columns,
+                                           int rows,
+                                           bool symmetricSourceMatrix,
+                                           bool symmetricTargetMatrix,
+                                           bool verbose );
+
+   static void
+   readMatrixElementsFromMtxFile( std::istream& file, Matrix& matrix, bool symmetricMatrix, bool verbose );
+
+   static void
+   parseMtxLineWithElement( const String& line, IndexType& row, IndexType& column, RealType& value );
 };
 /// \endcond
 
-
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/MatrixReader.hpp>
diff --git a/src/TNL/Matrices/MatrixReader.hpp b/src/TNL/Matrices/MatrixReader.hpp
index 28229b607b754177c9b8e2aec565474d2bbb2b45..d05d1dd6b641b04a2e330863d9592b8588d38aab 100644
--- a/src/TNL/Matrices/MatrixReader.hpp
+++ b/src/TNL/Matrices/MatrixReader.hpp
@@ -16,13 +16,9 @@
 namespace TNL {
 namespace Matrices {
 
-
 template< typename Matrix, typename Device >
 void
-MatrixReader< Matrix, Device >::
-readMtx( const TNL::String& fileName,
-         Matrix& matrix,
-         bool verbose )
+MatrixReader< Matrix, Device >::readMtx( const TNL::String& fileName, Matrix& matrix, bool verbose )
 {
    HostMatrix hostMatrix;
    MatrixReader< HostMatrix >::readMtx( fileName, hostMatrix, verbose );
@@ -31,10 +27,7 @@ readMtx( const TNL::String& fileName,
 
 template< typename Matrix, typename Device >
 void
-MatrixReader< Matrix, Device >::
-readMtx( std::istream& str,
-         Matrix& matrix,
-         bool verbose )
+MatrixReader< Matrix, Device >::readMtx( std::istream& str, Matrix& matrix, bool verbose )
 {
    HostMatrix hostMatrix;
    MatrixReader< HostMatrix >::readMtx( str, hostMatrix, verbose );
@@ -47,10 +40,7 @@ readMtx( std::istream& str,
 
 template< typename Matrix >
 void
-MatrixReader< Matrix, TNL::Devices::Host >::
-readMtx( const String& fileName,
-         Matrix& matrix,
-         bool verbose )
+MatrixReader< Matrix, TNL::Devices::Host >::readMtx( const String& fileName, Matrix& matrix, bool verbose )
 {
    std::fstream file;
    file.open( fileName.getString(), std::ios::in );
@@ -61,17 +51,14 @@ readMtx( const String& fileName,
 
 template< typename Matrix >
 void
-MatrixReader< Matrix, TNL::Devices::Host >::
-readMtx( std::istream& file,
-         Matrix& matrix,
-         bool verbose )
+MatrixReader< Matrix, TNL::Devices::Host >::readMtx( std::istream& file, Matrix& matrix, bool verbose )
 {
    IndexType rows, columns;
    bool symmetricSourceMatrix( false );
 
    readMtxHeader( file, rows, columns, symmetricSourceMatrix, verbose );
 
-   if( Matrix::isSymmetric() && !symmetricSourceMatrix )
+   if( Matrix::isSymmetric() && ! symmetricSourceMatrix )
       throw std::runtime_error( "Matrix is not symmetric, but flag for symmetric matrix is given. Aborting." );
 
    if( verbose )
@@ -79,7 +66,8 @@ readMtx( std::istream& file,
    matrix.setDimensions( rows, columns );
    typename Matrix::RowsCapacitiesType rowLengths( rows );
 
-   computeCompressedRowLengthsFromMtxFile( file, rowLengths, columns, rows, symmetricSourceMatrix, Matrix::isSymmetric(), verbose );
+   computeCompressedRowLengthsFromMtxFile(
+      file, rowLengths, columns, rows, symmetricSourceMatrix, Matrix::isSymmetric(), verbose );
 
    matrix.setRowCapacities( rowLengths );
 
@@ -88,8 +76,7 @@ readMtx( std::istream& file,
 
 template< typename Matrix >
 void
-MatrixReader< Matrix, TNL::Devices::Host >::
-verifyMtxFile( std::istream& file, const Matrix& matrix, bool verbose )
+MatrixReader< Matrix, TNL::Devices::Host >::verifyMtxFile( std::istream& file, const Matrix& matrix, bool verbose )
 {
    bool symmetricSourceMatrix( false );
    IndexType rows, columns;
@@ -101,70 +88,68 @@ verifyMtxFile( std::istream& file, const Matrix& matrix, bool verbose )
    IndexType processedElements( 0 );
    Timer timer;
    timer.start();
-   while( std::getline( file, line ) )
-   {
-      if( line[ 0 ] == '%' ) continue;
-      if( ! dimensionsLine )
-      {
+   while( std::getline( file, line ) ) {
+      if( line[ 0 ] == '%' )
+         continue;
+      if( ! dimensionsLine ) {
          dimensionsLine = true;
          continue;
       }
       IndexType row( 1 ), column( 1 );
       RealType value;
       parseMtxLineWithElement( line, row, column, value );
-      if( value != matrix.getElement( row-1, column-1 ) ||
-          ( symmetricSourceMatrix && value != matrix.getElement( column-1, row-1 ) ) )
+      if( value != matrix.getElement( row - 1, column - 1 )
+          || ( symmetricSourceMatrix && value != matrix.getElement( column - 1, row - 1 ) ) )
       {
          std::stringstream str;
          str << "*** !!! VERIFICATION ERROR !!! *** " << std::endl
-             << "The elements differ at " << row-1 << " row " << column-1 << " column." << std::endl
-             << "The matrix value is " << matrix.getElement( row-1, column-1 )
-             << " while the file value is " << value << "." << std::endl;
+             << "The elements differ at " << row - 1 << " row " << column - 1 << " column." << std::endl
+             << "The matrix value is " << matrix.getElement( row - 1, column - 1 ) << " while the file value is " << value
+             << "." << std::endl;
          throw std::runtime_error( str.str() );
       }
       processedElements++;
       if( symmetricSourceMatrix && row != column )
          processedElements++;
       if( verbose )
-        std::cout << " Verifying the matrix elements ... " << processedElements << " / " << matrix.getNumberOfMatrixElements() << "                       \r" << std::flush;
+         std::cout << " Verifying the matrix elements ... " << processedElements << " / " << matrix.getNumberOfMatrixElements()
+                   << "                       \r" << std::flush;
    }
    file.clear();
    long int fileSize = file.tellg();
    timer.stop();
    if( verbose )
-     std::cout << " Verifying the matrix elements ... " << processedElements << " / " << matrix.getNumberOfMatrixElements()
-           << " -> " << timer.getRealTime()
-           << " sec. i.e. " << fileSize / ( timer.getRealTime() * ( 1 << 20 ))  << "MB/s." << std::endl;
+      std::cout << " Verifying the matrix elements ... " << processedElements << " / " << matrix.getNumberOfMatrixElements()
+                << " -> " << timer.getRealTime() << " sec. i.e. " << fileSize / ( timer.getRealTime() * ( 1 << 20 ) ) << "MB/s."
+                << std::endl;
 }
 
 template< typename Matrix >
 bool
-MatrixReader< Matrix, TNL::Devices::Host >::
-findLineByElement( std::istream& file,
-                   const IndexType& row,
-                   const IndexType& column,
-                   String& line,
-                   IndexType& lineNumber )
+MatrixReader< Matrix, TNL::Devices::Host >::findLineByElement( std::istream& file,
+                                                               const IndexType& row,
+                                                               const IndexType& column,
+                                                               String& line,
+                                                               IndexType& lineNumber )
 {
    file.clear();
    file.seekg( 0, std::ios::beg );
    bool symmetricSourceMatrix( false );
    bool dimensionsLine( false );
    lineNumber = 0;
-   while( std::getline( file, line ) )
-   {
+   while( std::getline( file, line ) ) {
       lineNumber++;
-      if( line[ 0 ] == '%' ) continue;
-      if( ! dimensionsLine )
-      {
+      if( line[ 0 ] == '%' )
+         continue;
+      if( ! dimensionsLine ) {
          dimensionsLine = true;
          continue;
       }
       IndexType currentRow( 1 ), currentColumn( 1 );
       RealType value;
       parseMtxLineWithElement( line, currentRow, currentColumn, value );
-      if( ( currentRow == row + 1 && currentColumn == column + 1 ) ||
-          ( symmetricSourceMatrix && currentRow == column + 1 && currentColumn == row + 1 ) )
+      if( ( currentRow == row + 1 && currentColumn == column + 1 )
+          || ( symmetricSourceMatrix && currentRow == column + 1 && currentColumn == row + 1 ) )
          return true;
    }
    return false;
@@ -176,48 +161,47 @@ MatrixReader< Matrix, TNL::Devices::Host >::checkMtxHeader( const String& header
 {
    std::vector< String > parsedLine = header.split( ' ', String::SplitSkip::SkipEmpty );
    if( (int) parsedLine.size() < 5 || parsedLine[ 0 ] != "%%MatrixMarket" )
-      throw std::runtime_error( "Unknown format of the source file. We expect line like this: %%MatrixMarket matrix coordinate real general" );
+      throw std::runtime_error(
+         "Unknown format of the source file. We expect line like this: %%MatrixMarket matrix coordinate real general" );
    if( parsedLine[ 1 ] != "matrix" )
       throw std::runtime_error( std::string( "Keyword 'matrix' is expected in the header line: " ) + header.getString() );
-   if( parsedLine[ 2 ] != "coordinates" &&
-       parsedLine[ 2 ] != "coordinate" )
-      throw std::runtime_error( std::string( "Error: Only 'coordinates' format is supported now, not " ) + parsedLine[ 2 ].getString() );
+   if( parsedLine[ 2 ] != "coordinates" && parsedLine[ 2 ] != "coordinate" )
+      throw std::runtime_error( std::string( "Error: Only 'coordinates' format is supported now, not " )
+                                + parsedLine[ 2 ].getString() );
    if( parsedLine[ 3 ] != "real" )
       throw std::runtime_error( std::string( "Only 'real' matrices are supported, not " ) + parsedLine[ 3 ].getString() );
-   if( parsedLine[ 4 ] != "general" )
-   {
+   if( parsedLine[ 4 ] != "general" ) {
       if( parsedLine[ 4 ] == "symmetric" )
          symmetric = true;
       else
-         throw std::runtime_error(  std::string( "Only 'general' matrices are supported, not "  ) + parsedLine[ 4 ].getString() );
+         throw std::runtime_error( std::string( "Only 'general' matrices are supported, not " ) + parsedLine[ 4 ].getString() );
    }
 }
 
 template< typename Matrix >
 void
 MatrixReader< Matrix, TNL::Devices::Host >::readMtxHeader( std::istream& file,
-                                       IndexType& rows,
-                                       IndexType& columns,
-                                       bool& symmetric,
-                                       bool verbose )
+                                                           IndexType& rows,
+                                                           IndexType& columns,
+                                                           bool& symmetric,
+                                                           bool verbose )
 {
    file.clear();
    file.seekg( 0, std::ios::beg );
    String line;
    bool headerParsed( false );
    std::vector< String > parsedLine;
-   while( true )
-   {
+   while( true ) {
       std::getline( file, line );
-      if( ! headerParsed )
-      {
+      if( ! headerParsed ) {
          checkMtxHeader( line, symmetric );
          headerParsed = true;
          if( verbose && symmetric )
-           std::cout << "The matrix is SYMMETRIC ... ";
+            std::cout << "The matrix is SYMMETRIC ... ";
          continue;
       }
-      if( line[ 0 ] == '%' ) continue;
+      if( line[ 0 ] == '%' )
+         continue;
 
       parsedLine = line.split( ' ', String::SplitSkip::SkipEmpty );
       if( (int) parsedLine.size() != 3 )
@@ -225,39 +209,37 @@ MatrixReader< Matrix, TNL::Devices::Host >::readMtxHeader( std::istream& file,
       rows = atoi( parsedLine[ 0 ].getString() );
       columns = atoi( parsedLine[ 1 ].getString() );
       if( verbose )
-        std::cout << " The matrix has " << rows
-              << " rows and " << columns << " columns. " << std::endl;
+         std::cout << " The matrix has " << rows << " rows and " << columns << " columns. " << std::endl;
 
       if( rows <= 0 || columns <= 0 )
-         throw std::runtime_error( "Row or column index is negative."  );
+         throw std::runtime_error( "Row or column index is negative." );
       break;
    }
 }
 
 template< typename Matrix >
 void
-MatrixReader< Matrix, TNL::Devices::Host >::
-computeCompressedRowLengthsFromMtxFile( std::istream& file,
-                                        Containers::Vector< int, DeviceType, int >& rowLengths,
-                                        const int columns,
-                                        const int rows,
-                                        bool symmetricSourceMatrix,
-                                        bool symmetricTargetMatrix,
-                                        bool verbose )
+MatrixReader< Matrix, TNL::Devices::Host >::computeCompressedRowLengthsFromMtxFile(
+   std::istream& file,
+   Containers::Vector< int, DeviceType, int >& rowLengths,
+   const int columns,
+   const int rows,
+   bool symmetricSourceMatrix,
+   bool symmetricTargetMatrix,
+   bool verbose )
 {
    file.clear();
-   file.seekg( 0,  std::ios::beg );
+   file.seekg( 0, std::ios::beg );
    rowLengths.setValue( 0 );
    String line;
    bool dimensionsLine( false );
    IndexType numberOfElements( 0 );
    Timer timer;
    timer.start();
-   while( std::getline( file, line ) )
-   {
-      if( ! line.getSize() || line[ 0 ] == '%' ) continue;
-      if( ! dimensionsLine )
-      {
+   while( std::getline( file, line ) ) {
+      if( ! line.getSize() || line[ 0 ] == '%' )
+         continue;
+      if( ! dimensionsLine ) {
          dimensionsLine = true;
          continue;
       }
@@ -265,71 +247,66 @@ computeCompressedRowLengthsFromMtxFile( std::istream& file,
       RealType value;
       parseMtxLineWithElement( line, row, column, value );
       numberOfElements++;
-      if( column > columns || row > rows )
-      {
+      if( column > columns || row > rows ) {
          std::stringstream str;
-         str << "There is an element at position " << row << ", " << column << " out of the matrix dimensions " << rows << " x " << columns << ".";
+         str << "There is an element at position " << row << ", " << column << " out of the matrix dimensions " << rows << " x "
+             << columns << ".";
          throw std::runtime_error( str.str() );
       }
       if( verbose )
          std::cout << " Counting the matrix elements ... " << numberOfElements / 1000 << " thousands      \r" << std::flush;
 
-      if( !symmetricTargetMatrix ||
-          ( symmetricTargetMatrix && row >= column ) )
+      if( ! symmetricTargetMatrix || ( symmetricTargetMatrix && row >= column ) )
          rowLengths[ row - 1 ]++;
       else if( symmetricTargetMatrix && row < column )
          rowLengths[ column - 1 ]++;
 
-      if( rowLengths[ row - 1 ] > columns )
-      {
+      if( rowLengths[ row - 1 ] > columns ) {
          std::stringstream str;
-         str << "There are more elements ( " << rowLengths[ row - 1 ] << " ) than the matrix columns ( " << columns << " ) at the row " << row << ".";
+         str << "There are more elements ( " << rowLengths[ row - 1 ] << " ) than the matrix columns ( " << columns
+             << " ) at the row " << row << ".";
          throw std::runtime_error( str.str() );
       }
-      if( symmetricSourceMatrix && row != column && symmetricTargetMatrix )
-      {
+      if( symmetricSourceMatrix && row != column && symmetricTargetMatrix ) {
          rowLengths[ column - 1 ]++;
-         if( rowLengths[ column - 1 ] > columns )
-         {
+         if( rowLengths[ column - 1 ] > columns ) {
             std::stringstream str;
-            str << "There are more elements ( " << rowLengths[ row - 1 ] << " ) than the matrix columns ( " << columns << " ) at the row " << column << " .";
+            str << "There are more elements ( " << rowLengths[ row - 1 ] << " ) than the matrix columns ( " << columns
+                << " ) at the row " << column << " .";
             throw std::runtime_error( str.str() );
          }
          continue;
       }
-      else if( symmetricSourceMatrix && row != column && !symmetricTargetMatrix )
-          rowLengths[ column - 1 ]++;
+      else if( symmetricSourceMatrix && row != column && ! symmetricTargetMatrix )
+         rowLengths[ column - 1 ]++;
    }
    file.clear();
    long int fileSize = file.tellg();
    timer.stop();
    if( verbose )
-     std::cout << " Counting the matrix elements ... " << numberOfElements / 1000
-           << " thousands  -> " << timer.getRealTime()
-           << " sec. i.e. " << fileSize / ( timer.getRealTime() * ( 1 << 20 ))  << "MB/s." << std::endl;
+      std::cout << " Counting the matrix elements ... " << numberOfElements / 1000 << " thousands  -> " << timer.getRealTime()
+                << " sec. i.e. " << fileSize / ( timer.getRealTime() * ( 1 << 20 ) ) << "MB/s." << std::endl;
 }
 
 template< typename Matrix >
 void
-MatrixReader< Matrix, TNL::Devices::Host >::
-readMatrixElementsFromMtxFile( std::istream& file,
-                               Matrix& matrix,
-                               bool symmetricSourceMatrix,
-                               bool verbose )
+MatrixReader< Matrix, TNL::Devices::Host >::readMatrixElementsFromMtxFile( std::istream& file,
+                                                                           Matrix& matrix,
+                                                                           bool symmetricSourceMatrix,
+                                                                           bool verbose )
 {
    file.clear();
-   file.seekg( 0,  std::ios::beg );
+   file.seekg( 0, std::ios::beg );
    String line;
    bool dimensionsLine( false );
    IndexType processedElements( 0 );
    Timer timer;
    timer.start();
 
-   while( std::getline( file, line ) )
-   {
-      if( ! line.getSize() || line[ 0 ] == '%' ) continue;
-      if( ! dimensionsLine )
-      {
+   while( std::getline( file, line ) ) {
+      if( ! line.getSize() || line[ 0 ] == '%' )
+         continue;
+      if( ! dimensionsLine ) {
          dimensionsLine = true;
          continue;
       }
@@ -344,11 +321,10 @@ readMatrixElementsFromMtxFile( std::istream& file,
 
       processedElements++;
       if( symmetricSourceMatrix && row != column && Matrix::isSymmetric() )
-          continue;
-      else if( symmetricSourceMatrix && row != column && ! Matrix::isSymmetric() )
-      {
-          matrix.setElement( column - 1, row - 1, value );
-          processedElements++;
+         continue;
+      else if( symmetricSourceMatrix && row != column && ! Matrix::isSymmetric() ) {
+         matrix.setElement( column - 1, row - 1, value );
+         processedElements++;
       }
    }
 
@@ -356,30 +332,28 @@ readMatrixElementsFromMtxFile( std::istream& file,
    long int fileSize = file.tellg();
    timer.stop();
    if( verbose )
-     std::cout << " Reading the matrix elements ... " << processedElements << " / " << matrix.getAllocatedElementsCount()
-              << " -> " << timer.getRealTime()
-              << " sec. i.e. " << fileSize / ( timer.getRealTime() * ( 1 << 20 ))  << "MB/s." << std::endl;
+      std::cout << " Reading the matrix elements ... " << processedElements << " / " << matrix.getAllocatedElementsCount()
+                << " -> " << timer.getRealTime() << " sec. i.e. " << fileSize / ( timer.getRealTime() * ( 1 << 20 ) ) << "MB/s."
+                << std::endl;
 }
 
 template< typename Matrix >
 void
-MatrixReader< Matrix, TNL::Devices::Host >::
-parseMtxLineWithElement( const String& line,
-                         IndexType& row,
-                         IndexType& column,
-                         RealType& value )
+MatrixReader< Matrix, TNL::Devices::Host >::parseMtxLineWithElement( const String& line,
+                                                                     IndexType& row,
+                                                                     IndexType& column,
+                                                                     RealType& value )
 {
    std::vector< String > parsedLine = line.split( ' ', String::SplitSkip::SkipEmpty );
-   if( (int) parsedLine.size() != 3 )
-   {
+   if( (int) parsedLine.size() != 3 ) {
       std::stringstream str;
       str << "Wrong number of parameters in the matrix row at line:" << line;
       throw std::runtime_error( str.str() );
    }
    row = atoi( parsedLine[ 0 ].getString() );
    column = atoi( parsedLine[ 1 ].getString() );
-   value = ( RealType ) atof( parsedLine[ 2 ].getString() );
+   value = (RealType) atof( parsedLine[ 2 ].getString() );
 }
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/MatrixRowViewIterator.h b/src/TNL/Matrices/MatrixRowViewIterator.h
index bbd9e29fa1a7f2c669d7398fa849c08b4d4594e2..6c833713fe90000afc63f9d2154ca87ac806ef2e 100644
--- a/src/TNL/Matrices/MatrixRowViewIterator.h
+++ b/src/TNL/Matrices/MatrixRowViewIterator.h
@@ -17,90 +17,95 @@ namespace Matrices {
 template< typename RowView >
 class MatrixRowViewIterator
 {
-
-   public:
-
-      /**
-       * \brief Type of SparseMatrixRowView
-       */
-      using RowViewType = RowView;
-
-      /**
-       * \brief The type of matrix elements.
-       */
-      using RealType = typename RowViewType::RealType;
-
-      /**
-       * \brief The type used for matrix elements indexing.
-       */
-      using IndexType = typename RowViewType::IndexType;
-
-      /**
-       * \brief The type of related matrix element.
-       */
-      using MatrixElementType = typename RowView::MatrixElementType;
-
-      /**
-       * \brief Tells whether the parent matrix is a binary matrix.
-       * @return `true` if the matrix is binary.
-       */
-      static constexpr bool isBinary() { return RowViewType::isBinary(); };
-
-      __cuda_callable__
-      MatrixRowViewIterator( RowViewType& rowView,
-                                   const IndexType& localIdx );
-
-      /**
-       * \brief Comparison of two matrix row iterators.
-       *
-       * \param other is another matrix row iterator.
-       * \return \e true if both iterators points at the same point of the same matrix, \e false otherwise.
-       */
-      __cuda_callable__
-      bool operator==( const MatrixRowViewIterator& other ) const;
-
-      /**
-       * \brief Comparison of two matrix row iterators.
-       *
-       * \param other is another matrix row iterator.
-       * \return \e false if both iterators points at the same point of the same matrix, \e true otherwise.
-       */
-      __cuda_callable__
-      bool operator!=( const MatrixRowViewIterator& other ) const;
-
-      /**
-       * \brief Increment operator.
-       */
-      __cuda_callable__
-      MatrixRowViewIterator& operator++();
-
-      /**
-       * \brief Decrement operetor.
-       */
-      __cuda_callable__
-      MatrixRowViewIterator& operator--();
-
-      /**
-       * \brief Dereference operator.
-       */
-      __cuda_callable__
-      MatrixElementType operator*();
-
-      /**
-       * \brief Dereference operator for constant instances.
-       */
-      __cuda_callable__
-      const MatrixElementType operator*() const;
-
-   protected:
-
-      RowViewType& rowView;
-
-      IndexType localIdx = 0;
+public:
+   /**
+    * \brief Type of SparseMatrixRowView
+    */
+   using RowViewType = RowView;
+
+   /**
+    * \brief The type of matrix elements.
+    */
+   using RealType = typename RowViewType::RealType;
+
+   /**
+    * \brief The type used for matrix elements indexing.
+    */
+   using IndexType = typename RowViewType::IndexType;
+
+   /**
+    * \brief The type of related matrix element.
+    */
+   using MatrixElementType = typename RowView::MatrixElementType;
+
+   /**
+    * \brief Tells whether the parent matrix is a binary matrix.
+    * @return `true` if the matrix is binary.
+    */
+   static constexpr bool
+   isBinary()
+   {
+      return RowViewType::isBinary();
+   };
+
+   __cuda_callable__
+   MatrixRowViewIterator( RowViewType& rowView, const IndexType& localIdx );
+
+   /**
+    * \brief Comparison of two matrix row iterators.
+    *
+    * \param other is another matrix row iterator.
+    * \return \e true if both iterators points at the same point of the same matrix, \e false otherwise.
+    */
+   __cuda_callable__
+   bool
+   operator==( const MatrixRowViewIterator& other ) const;
+
+   /**
+    * \brief Comparison of two matrix row iterators.
+    *
+    * \param other is another matrix row iterator.
+    * \return \e false if both iterators points at the same point of the same matrix, \e true otherwise.
+    */
+   __cuda_callable__
+   bool
+   operator!=( const MatrixRowViewIterator& other ) const;
+
+   /**
+    * \brief Increment operator.
+    */
+   __cuda_callable__
+   MatrixRowViewIterator&
+   operator++();
+
+   /**
+    * \brief Decrement operetor.
+    */
+   __cuda_callable__
+   MatrixRowViewIterator&
+   operator--();
+
+   /**
+    * \brief Dereference operator.
+    */
+   __cuda_callable__
+   MatrixElementType
+   operator*();
+
+   /**
+    * \brief Dereference operator for constant instances.
+    */
+   __cuda_callable__
+   const MatrixElementType
+   operator*() const;
+
+protected:
+   RowViewType& rowView;
+
+   IndexType localIdx = 0;
 };
 
-
-   } // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/MatrixRowViewIterator.hpp>
diff --git a/src/TNL/Matrices/MatrixRowViewIterator.hpp b/src/TNL/Matrices/MatrixRowViewIterator.hpp
index 050b47a5cda22184fb5ba9cda7085cb4ce5a4f5b..38ea8f69ee586beeddc7a819776f9b7ba223851c 100644
--- a/src/TNL/Matrices/MatrixRowViewIterator.hpp
+++ b/src/TNL/Matrices/MatrixRowViewIterator.hpp
@@ -14,28 +14,22 @@ namespace Matrices {
 
 template< typename RowView >
 __cuda_callable__
-MatrixRowViewIterator< RowView >::
-MatrixRowViewIterator( RowViewType& rowView,
-                             const IndexType& localIdx )
+MatrixRowViewIterator< RowView >::MatrixRowViewIterator( RowViewType& rowView, const IndexType& localIdx )
 : rowView( rowView ), localIdx( localIdx )
-{
-}
+{}
 
 template< typename RowView >
-__cuda_callable__ bool
-MatrixRowViewIterator< RowView >::
-operator==( const MatrixRowViewIterator& other ) const
+__cuda_callable__
+bool
+MatrixRowViewIterator< RowView >::operator==( const MatrixRowViewIterator& other ) const
 {
-   if( &this->rowView == &other.rowView &&
-       localIdx == other.localIdx )
-      return true;
-   return false;
+   return &this->rowView == &other.rowView && localIdx == other.localIdx;
 }
 
 template< typename RowView >
-__cuda_callable__ bool
-MatrixRowViewIterator< RowView >::
-operator!=( const MatrixRowViewIterator& other ) const
+__cuda_callable__
+bool
+MatrixRowViewIterator< RowView >::operator!=( const MatrixRowViewIterator& other ) const
 {
    return ! ( other == *this );
 }
@@ -43,49 +37,44 @@ operator!=( const MatrixRowViewIterator& other ) const
 template< typename RowView >
 __cuda_callable__
 MatrixRowViewIterator< RowView >&
-MatrixRowViewIterator< RowView >::
-operator++()
+MatrixRowViewIterator< RowView >::operator++()
 {
    if( localIdx < rowView.getSize() )
-      localIdx ++;
+      localIdx++;
    return *this;
 }
 
 template< typename RowView >
 __cuda_callable__
 MatrixRowViewIterator< RowView >&
-MatrixRowViewIterator< RowView >::
-operator--()
+MatrixRowViewIterator< RowView >::operator--()
 {
    if( localIdx > 0 )
-      localIdx --;
+      localIdx--;
    return *this;
 }
 
 template< typename RowView >
-__cuda_callable__ auto
-MatrixRowViewIterator< RowView >::
-operator*() -> MatrixElementType
+__cuda_callable__
+auto
+MatrixRowViewIterator< RowView >::operator*() -> MatrixElementType
 {
-   return MatrixElementType(
-      this->rowView.getValue( this->localIdx ),
-      this->rowView.getRowIndex(),
-      this->rowView.getColumnIndex( this->localIdx ),
-      this->localIdx );
+   return MatrixElementType( this->rowView.getValue( this->localIdx ),
+                             this->rowView.getRowIndex(),
+                             this->rowView.getColumnIndex( this->localIdx ),
+                             this->localIdx );
 }
 
 template< typename RowView >
-__cuda_callable__ auto
-MatrixRowViewIterator< RowView >::
-operator*() const -> const MatrixElementType
+__cuda_callable__
+auto
+MatrixRowViewIterator< RowView >::operator*() const -> const MatrixElementType
 {
-   return MatrixElementType(
-      this->rowView.getValue( this->localIdx ),
-      this->rowView.getRowIndex(),
-      this->rowView.getColumnIndex( this->localIdx ),
-      this->localIdx );
+   return MatrixElementType( this->rowView.getValue( this->localIdx ),
+                             this->rowView.getRowIndex(),
+                             this->rowView.getColumnIndex( this->localIdx ),
+                             this->localIdx );
 }
 
-
-   } // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/MatrixSetter.h b/src/TNL/Matrices/MatrixSetter.h
index fb53db11a2050daa1ed8354b950319fc4cf8a319..d21ffe220a7152033b3f5d0e2a1c66f6b11f0285 100644
--- a/src/TNL/Matrices/MatrixSetter.h
+++ b/src/TNL/Matrices/MatrixSetter.h
@@ -11,87 +11,70 @@
 namespace TNL {
 namespace Matrices {
 
-template< typename DifferentialOperator,
-          typename BoundaryConditions,
-          typename RowsCapacitiesType >
+template< typename DifferentialOperator, typename BoundaryConditions, typename RowsCapacitiesType >
 class MatrixSetterTraverserUserData
 {
-   public:
-
-      typedef typename RowsCapacitiesType::DeviceType DeviceType;
-
-      const DifferentialOperator* differentialOperator;
+public:
+   using DeviceType = typename RowsCapacitiesType::DeviceType;
 
-      const BoundaryConditions* boundaryConditions;
+   const DifferentialOperator* differentialOperator;
 
-      RowsCapacitiesType* rowLengths;
+   const BoundaryConditions* boundaryConditions;
 
-      MatrixSetterTraverserUserData( const DifferentialOperator* differentialOperator,
-                                     const BoundaryConditions* boundaryConditions,
-                                     RowsCapacitiesType* rowLengths )
-      : differentialOperator( differentialOperator ),
-        boundaryConditions( boundaryConditions ),
-        rowLengths( rowLengths )
-      {}
+   RowsCapacitiesType* rowLengths;
 
+   MatrixSetterTraverserUserData( const DifferentialOperator* differentialOperator,
+                                  const BoundaryConditions* boundaryConditions,
+                                  RowsCapacitiesType* rowLengths )
+   : differentialOperator( differentialOperator ), boundaryConditions( boundaryConditions ), rowLengths( rowLengths )
+   {}
 };
 
-template< typename Mesh,
-          typename DifferentialOperator,
-          typename BoundaryConditions,
-          typename RowsCapacitiesType >
+template< typename Mesh, typename DifferentialOperator, typename BoundaryConditions, typename RowsCapacitiesType >
 class MatrixSetter
 {
-   public:
-   typedef Mesh MeshType;
-   typedef Pointers::SharedPointer<  MeshType > MeshPointer;
-   typedef typename MeshType::DeviceType DeviceType;
-   typedef typename RowsCapacitiesType::RealType IndexType;
-   typedef MatrixSetterTraverserUserData< DifferentialOperator,
-                                          BoundaryConditions,
-                                          RowsCapacitiesType > TraverserUserData;
-   typedef Pointers::SharedPointer<  DifferentialOperator, DeviceType > DifferentialOperatorPointer;
-   typedef Pointers::SharedPointer<  BoundaryConditions, DeviceType > BoundaryConditionsPointer;
-   typedef Pointers::SharedPointer<  RowsCapacitiesType, DeviceType > RowsCapacitiesTypePointer;
+public:
+   using MeshType = Mesh;
+   using MeshPointer = Pointers::SharedPointer< MeshType >;
+   using DeviceType = typename MeshType::DeviceType;
+   using IndexType = typename RowsCapacitiesType::RealType;
+   using TraverserUserData = MatrixSetterTraverserUserData< DifferentialOperator, BoundaryConditions, RowsCapacitiesType >;
+   using DifferentialOperatorPointer = Pointers::SharedPointer< DifferentialOperator, DeviceType >;
+   using BoundaryConditionsPointer = Pointers::SharedPointer< BoundaryConditions, DeviceType >;
+   using RowsCapacitiesTypePointer = Pointers::SharedPointer< RowsCapacitiesType, DeviceType >;
 
    template< typename EntityType >
-   void getCompressedRowLengths( const MeshPointer& meshPointer,
-                                  const DifferentialOperatorPointer& differentialOperatorPointer,
-                                  const BoundaryConditionsPointer& boundaryConditionsPointer,
-                                  RowsCapacitiesTypePointer& rowLengthsPointer ) const;
+   void
+   getCompressedRowLengths( const MeshPointer& meshPointer,
+                            const DifferentialOperatorPointer& differentialOperatorPointer,
+                            const BoundaryConditionsPointer& boundaryConditionsPointer,
+                            RowsCapacitiesTypePointer& rowLengthsPointer ) const;
 
    class TraverserBoundaryEntitiesProcessor
    {
-      public:
-
-         template< typename EntityType >
-         __cuda_callable__
-         static void processEntity( const MeshType& mesh,
-                                    TraverserUserData& userData,
-                                    const EntityType& entity )
-         {
-            ( *userData.rowLengths )[ entity.getIndex() ] =
-               userData.boundaryConditions->getLinearSystemRowLength( mesh, entity.getIndex(), entity );
-         }
-
+   public:
+      template< typename EntityType >
+      __cuda_callable__
+      static void
+      processEntity( const MeshType& mesh, TraverserUserData& userData, const EntityType& entity )
+      {
+         ( *userData.rowLengths )[ entity.getIndex() ] =
+            userData.boundaryConditions->getLinearSystemRowLength( mesh, entity.getIndex(), entity );
+      }
    };
 
    class TraverserInteriorEntitiesProcessor
    {
-      public:
-
-         template< typename EntityType >
-         __cuda_callable__
-         static void processEntity( const MeshType& mesh,
-                                    TraverserUserData& userData,
-                                    const EntityType& entity )
-         {
-            ( *userData.rowLengths )[ entity.getIndex() ] =
-               userData.differentialOperator->getLinearSystemRowLength( mesh, entity.getIndex(), entity );
-         }
+   public:
+      template< typename EntityType >
+      __cuda_callable__
+      static void
+      processEntity( const MeshType& mesh, TraverserUserData& userData, const EntityType& entity )
+      {
+         ( *userData.rowLengths )[ entity.getIndex() ] =
+            userData.differentialOperator->getLinearSystemRowLength( mesh, entity.getIndex(), entity );
+      }
    };
-
-
 };
 
 /*
@@ -156,7 +139,7 @@ class MatrixSetter< Meshes::Grid< Dimension, Real, Device, Index >,
 };
 */
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/MatrixSetter_impl.h>
diff --git a/src/TNL/Matrices/MatrixSetter_impl.h b/src/TNL/Matrices/MatrixSetter_impl.h
index c7a08e375ec7fc734df47329a239fe1e16882fee..f24feaf1208509f6162b4f85918fb18782626dd5 100644
--- a/src/TNL/Matrices/MatrixSetter_impl.h
+++ b/src/TNL/Matrices/MatrixSetter_impl.h
@@ -9,34 +9,26 @@
 #include <TNL/Meshes/Traverser.h>
 
 namespace TNL {
-namespace Matrices {   
+namespace Matrices {
 
-template< typename Mesh,
-          typename DifferentialOperator,
-          typename BoundaryConditions,
-          typename RowsCapacitiesType >
-   template< typename EntityType >
+template< typename Mesh, typename DifferentialOperator, typename BoundaryConditions, typename RowsCapacitiesType >
+template< typename EntityType >
 void
-MatrixSetter< Mesh, DifferentialOperator, BoundaryConditions, RowsCapacitiesType >::
-getCompressedRowLengths( const MeshPointer& meshPointer,
-                          const DifferentialOperatorPointer& differentialOperatorPointer,
-                          const BoundaryConditionsPointer& boundaryConditionsPointer,
-                          RowsCapacitiesTypePointer& rowLengthsPointer ) const
+MatrixSetter< Mesh, DifferentialOperator, BoundaryConditions, RowsCapacitiesType >::getCompressedRowLengths(
+   const MeshPointer& meshPointer,
+   const DifferentialOperatorPointer& differentialOperatorPointer,
+   const BoundaryConditionsPointer& boundaryConditionsPointer,
+   RowsCapacitiesTypePointer& rowLengthsPointer ) const
 {
    {
-      TraverserUserData
-         userData( &differentialOperatorPointer.template getData< DeviceType >(),
-                   &boundaryConditionsPointer.template getData< DeviceType >(),
-                   &rowLengthsPointer.template modifyData< DeviceType >() );
+      TraverserUserData userData( &differentialOperatorPointer.template getData< DeviceType >(),
+                                  &boundaryConditionsPointer.template getData< DeviceType >(),
+                                  &rowLengthsPointer.template modifyData< DeviceType >() );
       Meshes::Traverser< MeshType, EntityType > meshTraverser;
-      meshTraverser.template processBoundaryEntities< TraverserBoundaryEntitiesProcessor >
-                                                    ( meshPointer,
-                                                      userData );
-      meshTraverser.template processInteriorEntities< TraverserInteriorEntitiesProcessor >
-                                                    ( meshPointer,
-                                                      userData );
+      meshTraverser.template processBoundaryEntities< TraverserBoundaryEntitiesProcessor >( meshPointer, userData );
+      meshTraverser.template processInteriorEntities< TraverserInteriorEntitiesProcessor >( meshPointer, userData );
    }
 }
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/MatrixType.h b/src/TNL/Matrices/MatrixType.h
index bea93270807e24a7f0cf5665f7b737cf1911dd2b..641f7042eb52f4036394d6ca4bd601be6ea99d2b 100644
--- a/src/TNL/Matrices/MatrixType.h
+++ b/src/TNL/Matrices/MatrixType.h
@@ -11,39 +11,44 @@ namespace Matrices {
 
 /**
  * \brief Structure for specifying type of sparse matrix.
- * 
+ *
  * It is used for specification of \ref SparseMatrix type.
  */
 template< bool Symmetric >
 struct MatrixType
 {
-   static constexpr bool isSymmetric() { return Symmetric; }
+   static constexpr bool
+   isSymmetric()
+   {
+      return Symmetric;
+   }
 
-   static String getSerializationType() {
-      String type;
-      if( ! isSymmetric() )
-         type = "General";
-      else
-         type = "Symmetric";
-      return type;
+   static std::string
+   getSerializationType()
+   {
+      if( isSymmetric() )
+         return "Symmetric";
+      return "General";
    }
 };
 
 /**
  * \brief General non-symmetric matrix type.
- * 
+ *
  * It is used for specification of \ref SparseMatrix type.
  */
-struct GeneralMatrix : MatrixType< false > {};
+struct GeneralMatrix : MatrixType< false >
+{};
 
 /**
  * \brief Symmetric matrix type.
- * 
+ *
  * Symmetric matrix stores only lower part of the matrix and its diagonal. The
  * upper part is reconstructed on the fly.
  * It is used for specification of \ref SparseMatrix type.
  */
-struct SymmetricMatrix : MatrixType< true > {};
+struct SymmetricMatrix : MatrixType< true >
+{};
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/MatrixView.h b/src/TNL/Matrices/MatrixView.h
index ca71211e1ad779eae1eaf4a8cbf1802408911421..87b1948056590b7d27992df73f0d7d6196b389cb 100644
--- a/src/TNL/Matrices/MatrixView.h
+++ b/src/TNL/Matrices/MatrixView.h
@@ -25,196 +25,200 @@ namespace Matrices {
  * \tparam Device is a device where the matrix is allocated.
  * \tparam Index is a type for indexing of the matrix elements.
  */
-template< typename Real = double,
-          typename Device = Devices::Host,
-          typename Index = int >
+template< typename Real = double, typename Device = Devices::Host, typename Index = int >
 class MatrixView : public Object
 {
-   public:
-      using RowsCapacitiesType = Containers::Vector< Index, Device, Index >;
-      using RowsCapacitiesTypeView = Containers::VectorView< Index, Device, Index >;
-      using ConstRowsCapacitiesTypeView = typename RowsCapacitiesTypeView::ConstViewType;
-
-      /**
-       * \brief The type of matrix elements.
-       */
-      using RealType = Real;
-
-      /**
-       * \brief The device where the matrix is allocated.
-       */
-      using DeviceType = Device;
-
-      /**
-       * \brief The type used for matrix elements indexing.
-       */
-      using IndexType = Index;
-
-      /**
-       * \brief Type of base matrix view.
-       *
-       */
-      using ViewType = MatrixView< Real, Device, Index >;
-
-      /**
-       * \brief Type of base matrix view for constant instances.
-       *
-       */
-      using ConstViewType = MatrixView< typename std::add_const_t< Real >, Device, Index >;
-
-      /**
-       * \brief Type of vector view holding values of matrix elements.
-       */
-      using ValuesView = Containers::VectorView< Real, Device, Index >;
-
-      /**
-       * \brief Type of constant vector view holding values of matrix elements.
-       */
-      using ConstValuesView = typename ValuesView::ConstViewType;
-
-
-      /**
-       * \brief Basic constructor with no parameters.
-       */
-      __cuda_callable__
-      MatrixView();
-
-      /**
-       * \brief Constructor with matrix dimensions and matrix elements values.
-       *
-       * The matrix elements values are passed in a form vector view.
-       *
-       * @param rows is a number of matrix rows.
-       * @param columns is a number of matrix columns.
-       * @param values is a vector view with matrix elements values.
-       */
-      __cuda_callable__
-      MatrixView( const IndexType rows,
-                  const IndexType columns,
-                  const ValuesView& values );
-
-      /**
-       * @brief Shallow copy constructor.
-       *
-       * @param view is an input matrix view.
-       */
-      __cuda_callable__
-      MatrixView( const MatrixView& view ) = default;
-
-      /**
-       * \brief Move constructor.
-       *
-       * @param view is an input matrix view.
-       */
-      __cuda_callable__
-      MatrixView( MatrixView&& view ) = default;
-
-      /**
-       * \brief Tells the number of allocated matrix elements.
-       *
-       * In the case of dense matrices, this is just product of the number of rows and the number of columns.
-       * But for other matrix types like sparse matrices, this can be different.
-       *
-       * \return Number of allocated matrix elements.
-       */
-      IndexType getAllocatedElementsCount() const;
-
-      /**
-       * \brief Computes a current number of nonzero matrix elements.
-       *
-       * \return number of nonzero matrix elements.
-       */
-      virtual IndexType getNonzeroElementsCount() const;
-
-      /**
-       * \brief Returns number of matrix rows.
-       *
-       * \return number of matrix row.
-       */
-      __cuda_callable__
-      IndexType getRows() const;
-
-      /**
-       * \brief Returns number of matrix columns.
-       *
-       * @return number of matrix columns.
-       */
-      __cuda_callable__
-      IndexType getColumns() const;
-
-      /**
-       * \brief Returns a constant reference to a vector with the matrix elements values.
-       *
-       * \return constant reference to a vector with the matrix elements values.
-       */
-      __cuda_callable__
-      const ValuesView& getValues() const;
-
-      /**
-       * \brief Returns a reference to a vector with the matrix elements values.
-       *
-       * \return constant reference to a vector with the matrix elements values.
-       */
-      __cuda_callable__
-      ValuesView& getValues();
-
-      /**
-       * \brief Shallow copy of the matrix view.
-       *
-       * \param view is an input matrix view.
-       * \return reference to this view.
-       */
-      __cuda_callable__
-      MatrixView& operator=( const MatrixView& view );
-
-      /**
-       * \brief Comparison operator with another arbitrary matrix view type.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return \e true if the RHS matrix is equal, \e false otherwise.
-       */
-      template< typename Matrix >
-      bool operator == ( const Matrix& matrix ) const;
-
-      /**
-       * \brief Comparison operator with another arbitrary matrix view type.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return \e true if the RHS matrix is equal, \e false otherwise.
-       */
-
-      template< typename Matrix >
-      bool operator != ( const Matrix& matrix ) const;
-
-      /**
-       * \brief Method for saving the matrix view to a file.
-       *
-       * \param file is the output file.
-       */
-      virtual void save( File& file ) const;
-
-      /**
-       * \brief Method for printing the matrix view to output stream.
-       *
-       * \param str is the output stream.
-       */
-      virtual void print( std::ostream& str ) const;
-
-
-      // TODO: method for symmetric matrices, should not be in general Matrix interface
-      //[[deprecated]]
-      //__cuda_callable__
-      //const IndexType& getNumberOfColors() const;
-
-      // TODO: method for symmetric matrices, should not be in general Matrix interface
-      //[[deprecated]]
-      //void computeColorsVector(Containers::Vector<Index, Device, Index> &colorsVector);
-
-      protected:
-
-      IndexType rows, columns;
-
-      ValuesView values;
+public:
+   using RowsCapacitiesType = Containers::Vector< Index, Device, Index >;
+   using RowsCapacitiesTypeView = Containers::VectorView< Index, Device, Index >;
+   using ConstRowsCapacitiesTypeView = typename RowsCapacitiesTypeView::ConstViewType;
+
+   /**
+    * \brief The type of matrix elements.
+    */
+   using RealType = Real;
+
+   /**
+    * \brief The device where the matrix is allocated.
+    */
+   using DeviceType = Device;
+
+   /**
+    * \brief The type used for matrix elements indexing.
+    */
+   using IndexType = Index;
+
+   /**
+    * \brief Type of base matrix view.
+    *
+    */
+   using ViewType = MatrixView< Real, Device, Index >;
+
+   /**
+    * \brief Type of base matrix view for constant instances.
+    *
+    */
+   using ConstViewType = MatrixView< typename std::add_const_t< Real >, Device, Index >;
+
+   /**
+    * \brief Type of vector view holding values of matrix elements.
+    */
+   using ValuesView = Containers::VectorView< Real, Device, Index >;
+
+   /**
+    * \brief Type of constant vector view holding values of matrix elements.
+    */
+   using ConstValuesView = typename ValuesView::ConstViewType;
+
+   /**
+    * \brief Basic constructor with no parameters.
+    */
+   __cuda_callable__
+   MatrixView();
+
+   /**
+    * \brief Constructor with matrix dimensions and matrix elements values.
+    *
+    * The matrix elements values are passed in a form vector view.
+    *
+    * @param rows is a number of matrix rows.
+    * @param columns is a number of matrix columns.
+    * @param values is a vector view with matrix elements values.
+    */
+   __cuda_callable__
+   MatrixView( IndexType rows, IndexType columns, ValuesView values );
+
+   /**
+    * @brief Shallow copy constructor.
+    *
+    * @param view is an input matrix view.
+    */
+   __cuda_callable__
+   MatrixView( const MatrixView& view ) = default;
+
+   /**
+    * \brief Move constructor.
+    *
+    * @param view is an input matrix view.
+    */
+   __cuda_callable__
+   MatrixView( MatrixView&& view ) noexcept = default;
+
+   /**
+    * \brief Tells the number of allocated matrix elements.
+    *
+    * In the case of dense matrices, this is just product of the number of rows and the number of columns.
+    * But for other matrix types like sparse matrices, this can be different.
+    *
+    * \return Number of allocated matrix elements.
+    */
+   IndexType
+   getAllocatedElementsCount() const;
+
+   /**
+    * \brief Computes a current number of nonzero matrix elements.
+    *
+    * \return number of nonzero matrix elements.
+    */
+   virtual IndexType
+   getNonzeroElementsCount() const;
+
+   /**
+    * \brief Returns number of matrix rows.
+    *
+    * \return number of matrix row.
+    */
+   __cuda_callable__
+   IndexType
+   getRows() const;
+
+   /**
+    * \brief Returns number of matrix columns.
+    *
+    * @return number of matrix columns.
+    */
+   __cuda_callable__
+   IndexType
+   getColumns() const;
+
+   /**
+    * \brief Returns a constant reference to a vector with the matrix elements values.
+    *
+    * \return constant reference to a vector with the matrix elements values.
+    */
+   __cuda_callable__
+   const ValuesView&
+   getValues() const;
+
+   /**
+    * \brief Returns a reference to a vector with the matrix elements values.
+    *
+    * \return constant reference to a vector with the matrix elements values.
+    */
+   __cuda_callable__
+   ValuesView&
+   getValues();
+
+   /**
+    * \brief Shallow copy of the matrix view.
+    *
+    * \param view is an input matrix view.
+    * \return reference to this view.
+    */
+   __cuda_callable__
+   MatrixView&
+   operator=( const MatrixView& view );
+
+   /**
+    * \brief Comparison operator with another arbitrary matrix view type.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return \e true if the RHS matrix is equal, \e false otherwise.
+    */
+   template< typename Matrix >
+   bool
+   operator==( const Matrix& matrix ) const;
+
+   /**
+    * \brief Comparison operator with another arbitrary matrix view type.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return \e true if the RHS matrix is equal, \e false otherwise.
+    */
+
+   template< typename Matrix >
+   bool
+   operator!=( const Matrix& matrix ) const;
+
+   /**
+    * \brief Method for saving the matrix view to a file.
+    *
+    * \param file is the output file.
+    */
+   void
+   save( File& file ) const override;
+
+   /**
+    * \brief Method for printing the matrix view to output stream.
+    *
+    * \param str is the output stream.
+    */
+   virtual void
+   print( std::ostream& str ) const;
+
+   // TODO: method for symmetric matrices, should not be in general Matrix interface
+   //[[deprecated]]
+   //__cuda_callable__
+   // const IndexType& getNumberOfColors() const;
+
+   // TODO: method for symmetric matrices, should not be in general Matrix interface
+   //[[deprecated]]
+   // void computeColorsVector(Containers::Vector<Index, Device, Index> &colorsVector);
+
+protected:
+   IndexType rows, columns;
+
+   ValuesView values;
 };
 
 /**
@@ -230,13 +234,14 @@ class MatrixView : public Object
  * \return a reference on the output stream \ref std::ostream&.
  */
 template< typename Real, typename Device, typename Index >
-std::ostream& operator << ( std::ostream& str, const MatrixView< Real, Device, Index >& m )
+std::ostream&
+operator<<( std::ostream& str, const MatrixView< Real, Device, Index >& m )
 {
    m.print( str );
    return str;
 }
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/MatrixView.hpp>
diff --git a/src/TNL/Matrices/MatrixView.hpp b/src/TNL/Matrices/MatrixView.hpp
index df9dd989bacc2fc8f780c1a9b93e6d91f69eb66b..e8c2c3b40c2402e1ed2af95554d84ff799600a07 100644
--- a/src/TNL/Matrices/MatrixView.hpp
+++ b/src/TNL/Matrices/MatrixView.hpp
@@ -12,102 +12,75 @@
 #include <TNL/Cuda/MemoryHelpers.h>
 #include <TNL/Cuda/SharedMemory.h>
 
+#include <utility>
+
 namespace TNL {
 namespace Matrices {
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
-MatrixView< Real, Device, Index >::
-MatrixView()
-: rows( 0 ),
-  columns( 0 )
-{
-}
+MatrixView< Real, Device, Index >::MatrixView() : rows( 0 ), columns( 0 ) {}
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
-MatrixView< Real, Device, Index >::
-MatrixView( const IndexType rows_,
-            const IndexType columns_,
-            const ValuesView& values_ )
- : rows( rows_ ), columns( columns_ ), values( values_ )
-{
-}
+MatrixView< Real, Device, Index >::MatrixView( const IndexType rows_, const IndexType columns_, ValuesView values_ )
+: rows( rows_ ), columns( columns_ ), values( std::move( values_ ) )
+{}
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 Index
-MatrixView< Real, Device, Index >::
-getAllocatedElementsCount() const
+MatrixView< Real, Device, Index >::getAllocatedElementsCount() const
 {
    return this->values.getSize();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 Index
-MatrixView< Real, Device, Index >::
-getNonzeroElementsCount() const
+MatrixView< Real, Device, Index >::getNonzeroElementsCount() const
 {
    const auto values_view = this->values.getConstView();
-   auto fetch = [=] __cuda_callable__ ( const IndexType i ) -> IndexType {
+   auto fetch = [ = ] __cuda_callable__( const IndexType i ) -> IndexType
+   {
       return ( values_view[ i ] != 0.0 );
    };
-   return Algorithms::reduce< DeviceType >( ( IndexType ) 0, this->values.getSize(), fetch, std::plus<>{}, 0 );
+   return Algorithms::reduce< DeviceType >( (IndexType) 0, this->values.getSize(), fetch, std::plus<>{}, 0 );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
-Index MatrixView< Real, Device, Index >::getRows() const
+Index
+MatrixView< Real, Device, Index >::getRows() const
 {
    return this->rows;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
-Index MatrixView< Real, Device, Index >::getColumns() const
+Index
+MatrixView< Real, Device, Index >::getColumns() const
 {
    return this->columns;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
 const typename MatrixView< Real, Device, Index >::ValuesView&
-MatrixView< Real, Device, Index >::
-getValues() const
+MatrixView< Real, Device, Index >::getValues() const
 {
    return this->values;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
 typename MatrixView< Real, Device, Index >::ValuesView&
-MatrixView< Real, Device, Index >::
-getValues()
+MatrixView< Real, Device, Index >::getValues()
 {
    return this->values;
 }
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
 MatrixView< Real, Device, Index >&
-MatrixView< Real, Device, Index >::
-operator=( const MatrixView& view )
+MatrixView< Real, Device, Index >::operator=( const MatrixView& view )
 {
    rows = view.rows;
    columns = view.columns;
@@ -115,14 +88,12 @@ operator=( const MatrixView& view )
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename MatrixT >
-bool MatrixView< Real, Device, Index >::operator == ( const MatrixT& matrix ) const
+template< typename Real, typename Device, typename Index >
+template< typename MatrixT >
+bool
+MatrixView< Real, Device, Index >::operator==( const MatrixT& matrix ) const
 {
-   if( this->getRows() != matrix.getRows() ||
-       this->getColumns() != matrix.getColumns() )
+   if( this->getRows() != matrix.getRows() || this->getColumns() != matrix.getColumns() )
       return false;
    for( IndexType row = 0; row < this->getRows(); row++ )
       for( IndexType column = 0; column < this->getColumns(); column++ )
@@ -131,19 +102,17 @@ bool MatrixView< Real, Device, Index >::operator == ( const MatrixT& matrix ) co
    return true;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename MatrixT >
-bool MatrixView< Real, Device, Index >::operator != ( const MatrixT& matrix ) const
+template< typename Real, typename Device, typename Index >
+template< typename MatrixT >
+bool
+MatrixView< Real, Device, Index >::operator!=( const MatrixT& matrix ) const
 {
-   return ! operator == ( matrix );
+   return ! operator==( matrix );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-void MatrixView< Real, Device, Index >::save( File& file ) const
+template< typename Real, typename Device, typename Index >
+void
+MatrixView< Real, Device, Index >::save( File& file ) const
 {
    Object::save( file );
    file.save( &this->rows );
@@ -151,12 +120,10 @@ void MatrixView< Real, Device, Index >::save( File& file ) const
    file << this->values;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-void MatrixView< Real, Device, Index >::print( std::ostream& str ) const
-{
-}
+template< typename Real, typename Device, typename Index >
+void
+MatrixView< Real, Device, Index >::print( std::ostream& str ) const
+{}
 
 /*void
 MatrixView< Real, Device, Index >::
@@ -192,5 +159,5 @@ computeColorsVector(Containers::Vector<Index, Device, Index> &colorsVector)
     }
 } */
 
-   } // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/MatrixWrapping.h b/src/TNL/Matrices/MatrixWrapping.h
index 125d93327970e88218194a5428801c226345d9b9..4fe47c6f368e48c86e1f85e71b316e012c6cac35 100644
--- a/src/TNL/Matrices/MatrixWrapping.h
+++ b/src/TNL/Matrices/MatrixWrapping.h
@@ -47,29 +47,32 @@ wrapDenseMatrix( const Index& rows, const Index& columns, Real* values )
 }
 
 /**
- * \brief Function for wrapping of arrays defining [CSR format](https://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_row_(CSR,_CRS_or_Yale_format)) into a sparse matrix view.
+ * \brief Function for wrapping of arrays defining [CSR
+ * format](https://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_row_(CSR,_CRS_or_Yale_format)) into a sparse matrix
+ * view.
  *
  * \tparam Device  is a device on which the arrays are allocated.
  * \tparam Real is a type of matrix elements values.
  * \tparam Index is a type for matrix elements indexing.
  * \param rows is a number of matrix rows.
  * \param columns is a number of matrix columns.
- * \param rowPointers is an array holding row pointers of the CSR format ( `ROW_INDEX` [here](https://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_row_(CSR,_CRS_or_Yale_format)))
- * \param values is an array with values of matrix elements ( `V` [here](https://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_row_(CSR,_CRS_or_Yale_format)))
- * \param columnIndexes is an array with column indexes of matrix elements  ( `COL_INDEX` [here](https://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_row_(CSR,_CRS_or_Yale_format)))
- * \return instance of SparseMatrixView with CSR format.
+ * \param rowPointers is an array holding row pointers of the CSR format ( `ROW_INDEX`
+ * [here](https://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_row_(CSR,_CRS_or_Yale_format))) \param values is an
+ * array with values of matrix elements ( `V`
+ * [here](https://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_row_(CSR,_CRS_or_Yale_format))) \param columnIndexes is
+ * an array with column indexes of matrix elements  ( `COL_INDEX`
+ * [here](https://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_row_(CSR,_CRS_or_Yale_format))) \return instance of
+ * SparseMatrixView with CSR format.
  *
- * The size of array \e rowPointers must be equal to number of `rows + 1`. The last element of the array equals to the number of all nonzero matrix elements. The sizes of arrays `values` and
- * `columnIndexes` must be equal to this number.
+ * The size of array \e rowPointers must be equal to number of `rows + 1`. The last element of the array equals to the number of
+ * all nonzero matrix elements. The sizes of arrays `values` and `columnIndexes` must be equal to this number.
  *
  * \par Example
  * \include Matrices/SparseMatrix/SparseMatrixViewExample_wrapCSR.cpp
  * \par Output
  * \include SparseMatrixViewExample_wrapCSR.out
  */
-template< typename Device,
-          typename Real,
-          typename Index >
+template< typename Device, typename Real, typename Index >
 SparseMatrixView< Real, Device, Index, GeneralMatrix, Algorithms::Segments::CSRViewDefault >
 wrapCSRMatrix( const Index& rows, const Index& columns, Index* rowPointers, Real* values, Index* columnIndexes )
 {
@@ -89,18 +92,15 @@ wrapCSRMatrix( const Index& rows, const Index& columns, Index* rowPointers, Real
 
 /// This is to prevent from appearing in Doxygen documentation.
 /// \cond HIDDEN_CLASS
-template< typename Device,
-          ElementsOrganization Organization,
-          typename Real,
-          typename Index,
-          int Alignment = 1 >
+template< typename Device, ElementsOrganization Organization, typename Real, typename Index, int Alignment = 1 >
 struct EllpackMatrixWrapper
 {
    template< typename Device_, typename Index_ >
    using EllpackSegments = Algorithms::Segments::EllpackView< Device_, Index_, Organization, Alignment >;
    using MatrixView = SparseMatrixView< Real, Device, Index, GeneralMatrix, EllpackSegments >;
 
-   static MatrixView wrap( const Index& rows, const Index& columns, const Index& nonzerosPerRow, Real* values, Index* columnIndexes )
+   static MatrixView
+   wrap( const Index& rows, const Index& columns, const Index& nonzerosPerRow, Real* values, Index* columnIndexes )
    {
       using ValuesViewType = typename MatrixView::ValuesViewType;
       using ColumnIndexesView = typename MatrixView::ColumnsIndexesViewType;
@@ -115,37 +115,37 @@ struct EllpackMatrixWrapper
 /// \endcond
 
 /**
- * \brief Function for wrapping of arrays defining [Ellpack format](https://people.math.sc.edu/Burkardt/data/sparse_ellpack/sparse_ellpack.html) into a sparse matrix view.
+ * \brief Function for wrapping of arrays defining [Ellpack
+ * format](https://people.math.sc.edu/Burkardt/data/sparse_ellpack/sparse_ellpack.html) into a sparse matrix view.
  *
  * \tparam Device  is a device on which the arrays are allocated.
  * \tparam Real is a type of matrix elements values.
  * \tparam Index is a type for matrix elements indexing.
- * \tparam Alignment defines alignment of data. The number of matrix rows is rounded to a multiple of this number. It it usefull mainly for GPUs.
- * \param rows is a number of matrix rows.
- * \param columns is a number of matrix columns.
- * \param nonzerosPerRow is number of nonzero matrix elements in each row.
- * \param values is an array with values of matrix elements.
- * \param columnIndexes is an array with column indexes of matrix elements.
- * \return instance of SparseMatrixView with CSR format.
+ * \tparam Alignment defines alignment of data. The number of matrix rows is rounded to a multiple of this number. It it usefull
+ * mainly for GPUs. \param rows is a number of matrix rows. \param columns is a number of matrix columns. \param nonzerosPerRow
+ * is number of nonzero matrix elements in each row. \param values is an array with values of matrix elements. \param
+ * columnIndexes is an array with column indexes of matrix elements. \return instance of SparseMatrixView with CSR format.
  *
- *  The sizes of arrays `values` and `columnIndexes` must be equal to `rows * nonzerosPerRow`. Use `-1` as a column index for padding zeros.
+ *  The sizes of arrays `values` and `columnIndexes` must be equal to `rows * nonzerosPerRow`. Use `-1` as a column index for
+ * padding zeros.
  *
  * \par Example
  * \include Matrices/SparseMatrix/SparseMatrixViewExample_wrapEllpack.cpp
  * \par Output
  * \include SparseMatrixViewExample_wrapEllpack.out
  */
-template< typename Device,
-          ElementsOrganization Organization,
-          typename Real,
-          typename Index,
-          int Alignment = 1 >
+template< typename Device, ElementsOrganization Organization, typename Real, typename Index, int Alignment = 1 >
 auto
 wrapEllpackMatrix( const Index rows, const Index columns, const Index nonzerosPerRow, Real* values, Index* columnIndexes )
--> decltype( EllpackMatrixWrapper< Device, Organization, Real, Index, Alignment >::wrap( rows, columns, nonzerosPerRow, values, columnIndexes ) )
+   -> decltype( EllpackMatrixWrapper< Device, Organization, Real, Index, Alignment >::wrap( rows,
+                                                                                            columns,
+                                                                                            nonzerosPerRow,
+                                                                                            values,
+                                                                                            columnIndexes ) )
 {
-   return EllpackMatrixWrapper< Device, Organization, Real, Index, Alignment >::wrap( rows, columns, nonzerosPerRow, values, columnIndexes );
+   return EllpackMatrixWrapper< Device, Organization, Real, Index, Alignment >::wrap(
+      rows, columns, nonzerosPerRow, values, columnIndexes );
 }
 
-   } //namespace Matrices
-} //namepsace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/MatrixWriter.h b/src/TNL/Matrices/MatrixWriter.h
index 7157f9779c167d9fd88fad0f11ac1c708b556064..6d9f7c7c1738a905391edee2d2019e089ca983ec 100644
--- a/src/TNL/Matrices/MatrixWriter.h
+++ b/src/TNL/Matrices/MatrixWriter.h
@@ -20,7 +20,8 @@ namespace Matrices {
  *
  * 1. [Coordinate MTX Format](https://math.nist.gov/MatrixMarket/formats.html#coord) is supported.
  * 2. Gnuplot format for matrix visualization in [Gnuplot](http://www.gnuplot.info).
- * 3. EPS format for matrix pattern visualization in [Encapsulated PostScript](https://en.wikipedia.org/wiki/Encapsulated_PostScript)
+ * 3. EPS format for matrix pattern visualization in [Encapsulated
+ * PostScript](https://en.wikipedia.org/wiki/Encapsulated_PostScript)
  *
  * \tparam Matrix is a type of matrix into which we want to import the MTX file.
  * \tparam Device is used only for the purpose of template specialization.
@@ -34,92 +35,85 @@ namespace Matrices {
 template< typename Matrix, typename Device = typename Matrix::DeviceType >
 class MatrixWriter
 {
-   public:
-
-      /**
-       * \brief Type of matrix elements values.
-       */
-      using RealType = typename Matrix::RealType;
-
-      /**
-       * \brief Device where the matrix is allocated.
-       */
-
-      using DeviceType = typename Matrix::RealType;
-
-      /**
-       * \brief Type used for indexing of matrix elements.
-       */
-      using IndexType = typename Matrix::IndexType;
-
-      /**
-       * \brief Method for exporting matrix to file with given filename using Gnuplot format.
-       *
-       * \param fileName is the name of the target file.
-       * \param matrix is the source matrix.
-       * \param verbose controls verbosity of the matrix export.
-       */
-      static void writeGnuplot( const TNL::String& fileName,
-                                const Matrix& matrix,
-                                bool verbose = false );
-
-      /**
-       * \brief Method for exporting matrix to STL output stream using Gnuplot format.
-       *
-       * \param file is the output stream.
-       * \param matrix is the source matrix.
-       * \param verbose controls verbosity of the matrix export.
-       */
-      static void writeGnuplot( std::ostream& str,
-                                const Matrix& matrix,
-                                bool verbose = false );
-
-      /**
-       * \brief Method for exporting matrix to file with given filename using EPS format.
-       *
-       * \param fileName is the name of the target file.
-       * \param matrix is the source matrix.
-       * \param verbose controls verbosity of the matrix export.
-       */
-      static void writeEps( const TNL::String& fileName,
-                            const Matrix& matrix,
-                            bool verbose = false );
-
-      /**
-       * \brief Method for exporting matrix to STL output stream using EPS format.
-       *
-       * \param file is the output stream.
-       * \param matrix is the source matrix.
-       * \param verbose controls verbosity of the matrix export.
-       */
-      static void writeEps( std::ostream& str,
-                            const Matrix& matrix,
-                            bool verbose = false );
-
-      /**
-       * \brief Method for exporting matrix to file with given filename using MTX format.
-       *
-       * \param fileName is the name of the target file.
-       * \param matrix is the source matrix.
-       * \param verbose controls verbosity of the matrix export.
-       */
-      static void writeMtx( const TNL::String& fileName,
-                            const Matrix& matrix,
-                            bool verbose = false );
-
-      /**
-       * \brief Method for exporting matrix to STL output stream using MTX format.
-       *
-       * \param file is the output stream.
-       * \param matrix is the source matrix.
-       * \param verbose controls verbosity of the matrix export.
-       */
-      static void writeMtx( std::ostream& str,
-                            const Matrix& matrix,
-                            bool verbose = false );
-
-   protected:
-      using HostMatrix = typename Matrix::template Self< RealType, TNL::Devices::Host >;
+public:
+   /**
+    * \brief Type of matrix elements values.
+    */
+   using RealType = typename Matrix::RealType;
+
+   /**
+    * \brief Device where the matrix is allocated.
+    */
+
+   using DeviceType = typename Matrix::RealType;
+
+   /**
+    * \brief Type used for indexing of matrix elements.
+    */
+   using IndexType = typename Matrix::IndexType;
+
+   /**
+    * \brief Method for exporting matrix to file with given filename using Gnuplot format.
+    *
+    * \param fileName is the name of the target file.
+    * \param matrix is the source matrix.
+    * \param verbose controls verbosity of the matrix export.
+    */
+   static void
+   writeGnuplot( const TNL::String& fileName, const Matrix& matrix, bool verbose = false );
+
+   /**
+    * \brief Method for exporting matrix to STL output stream using Gnuplot format.
+    *
+    * \param file is the output stream.
+    * \param matrix is the source matrix.
+    * \param verbose controls verbosity of the matrix export.
+    */
+   static void
+   writeGnuplot( std::ostream& str, const Matrix& matrix, bool verbose = false );
+
+   /**
+    * \brief Method for exporting matrix to file with given filename using EPS format.
+    *
+    * \param fileName is the name of the target file.
+    * \param matrix is the source matrix.
+    * \param verbose controls verbosity of the matrix export.
+    */
+   static void
+   writeEps( const TNL::String& fileName, const Matrix& matrix, bool verbose = false );
+
+   /**
+    * \brief Method for exporting matrix to STL output stream using EPS format.
+    *
+    * \param file is the output stream.
+    * \param matrix is the source matrix.
+    * \param verbose controls verbosity of the matrix export.
+    */
+   static void
+   writeEps( std::ostream& str, const Matrix& matrix, bool verbose = false );
+
+   /**
+    * \brief Method for exporting matrix to file with given filename using MTX format.
+    *
+    * \param fileName is the name of the target file.
+    * \param matrix is the source matrix.
+    * \param verbose controls verbosity of the matrix export.
+    */
+   static void
+   writeMtx( const TNL::String& fileName, const Matrix& matrix, bool verbose = false );
+
+   /**
+    * \brief Method for exporting matrix to STL output stream using MTX format.
+    *
+    * \param file is the output stream.
+    * \param matrix is the source matrix.
+    * \param verbose controls verbosity of the matrix export.
+    */
+   static void
+   writeMtx( std::ostream& str, const Matrix& matrix, bool verbose = false );
+
+protected:
+   using HostMatrix = typename Matrix::template Self< RealType, TNL::Devices::Host >;
 };
 
 /// This is to prevent from appearing in Doxygen documentation.
@@ -127,50 +121,38 @@ class MatrixWriter
 template< typename Matrix >
 class MatrixWriter< Matrix, TNL::Devices::Host >
 {
-   public:
-
+public:
    typedef typename Matrix::IndexType IndexType;
    typedef typename Matrix::RealType RealType;
 
-   static void writeGnuplot( const TNL::String& fileName,
-                             const Matrix& matrix,
-                             bool verbose = false );
-
-
-   static void writeGnuplot( std::ostream& str,
-                             const Matrix& matrix,
-                             bool verbose = false );
+   static void
+   writeGnuplot( const TNL::String& fileName, const Matrix& matrix, bool verbose = false );
 
-   static void writeEps( const TNL::String& fileName,
-                         const Matrix& matrix,
-                         bool verbose = false );
+   static void
+   writeGnuplot( std::ostream& str, const Matrix& matrix, bool verbose = false );
 
-   static void writeEps( std::ostream& str,
-                         const Matrix& matrix,
-                         bool verbose = false );
+   static void
+   writeEps( const TNL::String& fileName, const Matrix& matrix, bool verbose = false );
 
-   static void writeMtx( const TNL::String& fileName,
-                         const Matrix& matrix,
-                         bool verbose = false );
+   static void
+   writeEps( std::ostream& str, const Matrix& matrix, bool verbose = false );
 
-   static void writeMtx( std::ostream& str,
-                         const Matrix& matrix,
-                         bool verbose = false );
+   static void
+   writeMtx( const TNL::String& fileName, const Matrix& matrix, bool verbose = false );
 
-   protected:
+   static void
+   writeMtx( std::ostream& str, const Matrix& matrix, bool verbose = false );
 
-   static void writeEpsHeader( std::ostream& str,
-                               const Matrix& matrix,
-                               const int elementSize );
+protected:
+   static void
+   writeEpsHeader( std::ostream& str, const Matrix& matrix, const int elementSize );
 
-   static void writeEpsBody( std::ostream& str,
-                             const Matrix& matrix,
-                             const int elementSize,
-                             bool verbose );
+   static void
+   writeEpsBody( std::ostream& str, const Matrix& matrix, const int elementSize, bool verbose );
 };
 /// \endcond
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/MatrixWriter.hpp>
diff --git a/src/TNL/Matrices/MatrixWriter.hpp b/src/TNL/Matrices/MatrixWriter.hpp
index d508ca25f9755ed20f7577b500edb1d0dfe5a03e..c9b695cd843545f78300930a0221d424cb642f7c 100644
--- a/src/TNL/Matrices/MatrixWriter.hpp
+++ b/src/TNL/Matrices/MatrixWriter.hpp
@@ -14,10 +14,7 @@ namespace Matrices {
 
 template< typename Matrix, typename Device >
 void
-MatrixWriter< Matrix, Device >::
-writeGnuplot( const TNL::String& fileName,
-              const Matrix& matrix,
-              bool verbose )
+MatrixWriter< Matrix, Device >::writeGnuplot( const TNL::String& fileName, const Matrix& matrix, bool verbose )
 {
    HostMatrix hostMatrix;
    hostMatrix = matrix;
@@ -26,10 +23,7 @@ writeGnuplot( const TNL::String& fileName,
 
 template< typename Matrix, typename Device >
 void
-MatrixWriter< Matrix, Device >::
-writeGnuplot( std::ostream& str,
-              const Matrix& matrix,
-              bool verbose )
+MatrixWriter< Matrix, Device >::writeGnuplot( std::ostream& str, const Matrix& matrix, bool verbose )
 {
    HostMatrix hostMatrix;
    hostMatrix = matrix;
@@ -38,10 +32,7 @@ writeGnuplot( std::ostream& str,
 
 template< typename Matrix, typename Device >
 void
-MatrixWriter< Matrix, Device >::
-writeMtx( const TNL::String& fileName,
-          const Matrix& matrix,
-          bool verbose )
+MatrixWriter< Matrix, Device >::writeMtx( const TNL::String& fileName, const Matrix& matrix, bool verbose )
 {
    HostMatrix hostMatrix;
    hostMatrix = matrix;
@@ -50,10 +41,7 @@ writeMtx( const TNL::String& fileName,
 
 template< typename Matrix, typename Device >
 void
-MatrixWriter< Matrix, Device >::
-writeMtx( std::ostream& str,
-          const Matrix& matrix,
-          bool verbose )
+MatrixWriter< Matrix, Device >::writeMtx( std::ostream& str, const Matrix& matrix, bool verbose )
 {
    HostMatrix hostMatrix;
    hostMatrix = matrix;
@@ -62,10 +50,7 @@ writeMtx( std::ostream& str,
 
 template< typename Matrix, typename Device >
 void
-MatrixWriter< Matrix, Device >::
-writeEps( const TNL::String& fileName,
-          const Matrix& matrix,
-          bool verbose )
+MatrixWriter< Matrix, Device >::writeEps( const TNL::String& fileName, const Matrix& matrix, bool verbose )
 {
    HostMatrix hostMatrix;
    hostMatrix = matrix;
@@ -74,10 +59,7 @@ writeEps( const TNL::String& fileName,
 
 template< typename Matrix, typename Device >
 void
-MatrixWriter< Matrix, Device >::
-writeEps( std::ostream& str,
-          const Matrix& matrix,
-          bool verbose )
+MatrixWriter< Matrix, Device >::writeEps( std::ostream& str, const Matrix& matrix, bool verbose )
 {
    HostMatrix hostMatrix;
    hostMatrix = matrix;
@@ -89,10 +71,7 @@ writeEps( std::ostream& str,
  */
 template< typename Matrix >
 void
-MatrixWriter< Matrix, TNL::Devices::Host >::
-writeGnuplot( const TNL::String& fileName,
-              const Matrix& matrix,
-              bool verbose )
+MatrixWriter< Matrix, TNL::Devices::Host >::writeGnuplot( const TNL::String& fileName, const Matrix& matrix, bool verbose )
 {
    std::fstream str;
    str.open( fileName.getString(), std::ios::out );
@@ -101,33 +80,25 @@ writeGnuplot( const TNL::String& fileName,
 
 template< typename Matrix >
 void
-MatrixWriter< Matrix, TNL::Devices::Host >::
-writeGnuplot( std::ostream& str,
-              const Matrix& matrix,
-              bool verbose )
+MatrixWriter< Matrix, TNL::Devices::Host >::writeGnuplot( std::ostream& str, const Matrix& matrix, bool verbose )
 {
    str << "#  This file was generated by TNL (www.tnl-project.org)" << std::endl;
-   for( IndexType row = 0; row < matrix.getRows(); row ++ )
-   {
-      for( IndexType column = 0; column < matrix.getColumns(); column ++ )
-      {
+   for( IndexType row = 0; row < matrix.getRows(); row++ ) {
+      for( IndexType column = 0; column < matrix.getColumns(); column++ ) {
          RealType elementValue = matrix.getElement( row, column );
-         if(  elementValue != ( RealType ) 0.0 )
+         if( elementValue != (RealType) 0.0 )
             str << column << " " << row << " " << elementValue << "\n";
       }
       if( verbose )
-        std::cout << "Drawing the row " << row << "      \r" << std::flush;
+         std::cout << "Drawing the row " << row << "      \r" << std::flush;
    }
    if( verbose )
-     std::cout << std::endl;
+      std::cout << std::endl;
 }
 
 template< typename Matrix >
 void
-MatrixWriter< Matrix, TNL::Devices::Host >::
-writeMtx( const TNL::String& fileName,
-          const Matrix& matrix,
-          bool verbose )
+MatrixWriter< Matrix, TNL::Devices::Host >::writeMtx( const TNL::String& fileName, const Matrix& matrix, bool verbose )
 {
    std::fstream str;
    str.open( fileName.getString(), std::ios::out );
@@ -136,27 +107,25 @@ writeMtx( const TNL::String& fileName,
 
 template< typename Matrix >
 void
-MatrixWriter< Matrix, TNL::Devices::Host >::
-writeMtx( std::ostream& str,
-          const Matrix& matrix,
-          bool verbose )
+MatrixWriter< Matrix, TNL::Devices::Host >::writeMtx( std::ostream& str, const Matrix& matrix, bool verbose )
 {
    str << "%%MatrixMarket matrix coordinate real general" << std::endl;
    str << "%%" << std::endl;
    str << "%% This file was generated by TNL (www.tnl-project.org)" << std::endl;
    str << "%%" << std::setw( 9 ) << " ROWS " << std::setw( 9 ) << " COLUMNS " << std::setw( 12 ) << " ELEMENTS " << std::endl;
-   str << std::setw( 9 ) << matrix.getRows() << " " << std::setw( 9 ) << matrix.getColumns() << " " << std::setw( 12 ) << matrix.getNonzeroElementsCount() << std::endl;
+   str << std::setw( 9 ) << matrix.getRows() << " " << std::setw( 9 ) << matrix.getColumns() << " " << std::setw( 12 )
+       << matrix.getNonzeroElementsCount() << std::endl;
    std::ostream* str_ptr = &str;
    auto cout_ptr = &std::cout;
-   auto f = [=] __cuda_callable__ ( const typename Matrix::ConstRowView& row ) mutable {
+   auto f = [ = ] __cuda_callable__( const typename Matrix::ConstRowView& row ) mutable
+   {
       auto rowIdx = row.getRowIndex();
-      for( IndexType localIdx = 0; localIdx < row.getSize(); localIdx++ )
-      {
+      for( IndexType localIdx = 0; localIdx < row.getSize(); localIdx++ ) {
          IndexType columnIdx = row.getColumnIndex( localIdx );
          RealType value = row.getValue( localIdx );
-         if( value != 0 )
-         {
-            *str_ptr << std::setw( 9 ) << rowIdx + 1 << std::setw( 9 ) << columnIdx + 1 << std::setw( 12 ) << value << std::endl;
+         if( value != 0 ) {
+            *str_ptr << std::setw( 9 ) << rowIdx + 1 << std::setw( 9 ) << columnIdx + 1 << std::setw( 12 ) << value
+                     << std::endl;
             if( verbose )
                *cout_ptr << "Drawing the row " << rowIdx << "      \r" << std::flush;
          }
@@ -167,10 +136,7 @@ writeMtx( std::ostream& str,
 
 template< typename Matrix >
 void
-MatrixWriter< Matrix, TNL::Devices::Host >::
-writeEps( const TNL::String& fileName,
-            const Matrix& matrix,
-            bool verbose )
+MatrixWriter< Matrix, TNL::Devices::Host >::writeEps( const TNL::String& fileName, const Matrix& matrix, bool verbose )
 {
    std::fstream str;
    str.open( fileName.getString(), std::ios::out );
@@ -179,10 +145,7 @@ writeEps( const TNL::String& fileName,
 
 template< typename Matrix >
 void
-MatrixWriter< Matrix, TNL::Devices::Host >::
-writeEps( std::ostream& str,
-            const Matrix& matrix,
-            bool verbose )
+MatrixWriter< Matrix, TNL::Devices::Host >::writeEps( std::ostream& str, const Matrix& matrix, bool verbose )
 {
    const int elementSize = 10;
    writeEpsHeader( str, matrix, elementSize );
@@ -192,15 +155,12 @@ writeEps( std::ostream& str,
    str << "%%EOF" << std::endl;
 
    if( verbose )
-     std::cout << std::endl;
+      std::cout << std::endl;
 }
 
 template< typename Matrix >
 void
-MatrixWriter< Matrix, TNL::Devices::Host >::
-writeEpsHeader( std::ostream& str,
-                const Matrix& matrix,
-                const int elementSize )
+MatrixWriter< Matrix, TNL::Devices::Host >::writeEpsHeader( std::ostream& str, const Matrix& matrix, const int elementSize )
 {
    const double scale = elementSize * max( matrix.getRows(), matrix.getColumns() );
    str << "%!PS-Adobe-2.0 EPSF-2.0" << std::endl;
@@ -213,32 +173,26 @@ writeEpsHeader( std::ostream& str,
 
 template< typename Matrix >
 void
-MatrixWriter< Matrix, TNL::Devices::Host >::
-writeEpsBody( std::ostream& str,
-              const Matrix& matrix,
-              const int elementSize,
-              bool verbose )
+MatrixWriter< Matrix, TNL::Devices::Host >::writeEpsBody( std::ostream& str,
+                                                          const Matrix& matrix,
+                                                          const int elementSize,
+                                                          bool verbose )
 {
    IndexType lastRow( 0 ), lastColumn( 0 );
-   for( IndexType row = 0; row < matrix.getRows(); row ++ )
-   {
-      for( IndexType column = 0; column < matrix.getColumns(); column ++ )
-      {
+   for( IndexType row = 0; row < matrix.getRows(); row++ ) {
+      for( IndexType column = 0; column < matrix.getColumns(); column++ ) {
          RealType elementValue = matrix.getElement( row, column );
-         if( elementValue != ( RealType ) 0.0 )
-         {
-            str << ( column - lastColumn ) * elementSize
-                << " " << -( row - lastRow ) * elementSize
-                << " translate newpath 0 0 " << elementSize << " " << elementSize << " rectstroke\n";
+         if( elementValue != (RealType) 0.0 ) {
+            str << ( column - lastColumn ) * elementSize << " " << -( row - lastRow ) * elementSize << " translate newpath 0 0 "
+                << elementSize << " " << elementSize << " rectstroke\n";
             lastColumn = column;
             lastRow = row;
          }
       }
       if( verbose )
-        std::cout << "Drawing the row " << row << "      \r" << std::flush;
+         std::cout << "Drawing the row " << row << "      \r" << std::flush;
    }
 }
 
-
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/MultidiagonalMatrix.h b/src/TNL/Matrices/MultidiagonalMatrix.h
index 8159f59b8ed76ee3d4d48b5a50c2f2985946f04a..eb1eceae7a4a8a9ff276f3fbb5acbc376fa6f9df 100644
--- a/src/TNL/Matrices/MultidiagonalMatrix.h
+++ b/src/TNL/Matrices/MultidiagonalMatrix.h
@@ -69,1079 +69,1133 @@ template< typename Real = double,
           typename IndexAllocator = typename Allocators::Default< Device >::template Allocator< Index > >
 class MultidiagonalMatrix : public Matrix< Real, Device, Index, RealAllocator >
 {
-   public:
-
-      // Supporting types - they are not important for the user
-      using BaseType = Matrix< Real, Device, Index, RealAllocator >;
-      using ValuesType = typename BaseType::ValuesType;
-      using ValuesView = typename ValuesType::ViewType;
-      using IndexerType = details::MultidiagonalMatrixIndexer< Index, Organization >;
-      using DiagonalsOffsetsType = Containers::Vector< Index, Device, Index, IndexAllocator >;
-      using DiagonalsOffsetsView = typename DiagonalsOffsetsType::ViewType;
-      using HostDiagonalsOffsetsType = Containers::Vector< Index, Devices::Host, Index >;
-      using HostDiagonalsOffsetsView = typename HostDiagonalsOffsetsType::ViewType;
-
-      /**
-       * \brief The type of matrix elements.
-       */
-      using RealType = Real;
-
-      /**
-       * \brief The device where the matrix is allocated.
-       */
-      using DeviceType = Device;
-
-      /**
-       * \brief The type used for matrix elements indexing.
-       */
-      using IndexType = Index;
-
-      /**
-       * \brief This is only for compatibility with sparse matrices.
-       *
-       * \return \e  \e false.
-       */
-      static constexpr bool isSymmetric() { return false; };
-
-      /**
-       * \brief The allocator for matrix elements values.
-       */
-      using RealAllocatorType = RealAllocator;
-
-      /**
-       * \brief The allocator for matrix elements offsets from the diagonal.
-       */
-      using IndexAllocatorType = IndexAllocator;
-
-      /**
-       * \brief Type of related matrix view.
-       *
-       * See \ref MultidiagonalMatrixView.
-       */
-      using ViewType = MultidiagonalMatrixView< Real, Device, Index, Organization >;
-
-      /**
-       * \brief Matrix view type for constant instances.
-       *
-       * See \ref MultidiagonalMatrixView.
-       */
-      using ConstViewType = MultidiagonalMatrixView< typename std::add_const< Real >::type, Device, Index, Organization >;
-
-      /**
-       * \brief Type for accessing matrix rows.
-       */
-      using RowView = typename ViewType::RowView;
-
-      /**
-       * \brief Type for accessing constant matrix rows.
-       */
-      using ConstRowView = typename ViewType::ConstViewType;
-
-      /**
-       * \brief Helper type for getting self type or its modifications.
-       */
-      template< typename _Real = Real,
-                typename _Device = Device,
-                typename _Index = Index,
-                ElementsOrganization _Organization = Organization,
-                typename _RealAllocator = typename Allocators::Default< _Device >::template Allocator< _Real >,
-                typename _IndexAllocator = typename Allocators::Default< _Device >::template Allocator< _Index > >
-      using Self = MultidiagonalMatrix< _Real, _Device, _Index, _Organization, _RealAllocator, _IndexAllocator >;
-
-      /**
-       * \brief Elements organization getter.
-       */
-      static constexpr ElementsOrganization getOrganization() { return Organization; };
-
-      /**
-       * \brief Constructor with no parameters.
-       */
-      MultidiagonalMatrix();
-
-      /**
-       * \brief Constructor with matrix dimensions.
-       *
-       * \param rows is number of matrix rows.
-       * \param columns is number of matrix columns.
-       */
-      MultidiagonalMatrix( const IndexType rows,
-                           const IndexType columns );
-
-      /**
-       * \brief Constructor with matrix dimensions and matrix elements offsets.
-       *
-       * \param rows is number of matrix rows.
-       * \param columns is number of matrix columns.
-       * \param diagonalsOffsets are offsets of subdiagonals from the main diagonal.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_Constructor.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_Constructor.out
-       */
-      template< typename Vector >
-      MultidiagonalMatrix( const IndexType rows,
-                           const IndexType columns,
-                           const Vector& diagonalsOffsets );
-
-      /**
-       * \brief Constructor with matrix dimensions and diagonals offsets.
-       *
-       * \param rows is number of matrix rows.
-       * \param columns is number of matrix columns.
-       * \param diagonalsOffsets are offsets of sub-diagonals from the main diagonal.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_Constructor_init_list_1.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_Constructor_init_list_1.out
-       */
-      template< typename ListIndex >
-      MultidiagonalMatrix( const IndexType rows,
-                           const IndexType columns,
-                           const std::initializer_list< ListIndex > diagonalsOffsets );
-
-      /**
-       * \brief Constructor with matrix dimensions, diagonals offsets and matrix elements.
-       *
-       * The number of matrix rows is deduced from the size of the initializer list \e data.
-       *
-       * \tparam ListIndex is type used in the initializer list defining matrix diagonals offsets.
-       * \tparam ListReal is type used in the initializer list defining matrix elements values.
-       *
-       * \param columns is number of matrix columns.
-       * \param diagonalOffsets are offsets of sub-diagonals from the main diagonal.
-       * \param data is initializer list holding matrix elements. The size of the outer list
-       *    defines the number of matrix rows. Each inner list defines values of each sub-diagonal
-       *    and so its size should be lower or equal to the size of \e diagonalsOffsets. Values
-       *    of sub-diagonals which do not fit to given row are omitted.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_Constructor_init_list_2.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_Constructor_init_list_2.out
-       */
-      template< typename ListIndex, typename ListReal >
-      MultidiagonalMatrix( const IndexType columns,
-                           const std::initializer_list< ListIndex > diagonalsOffsets,
-                           const std::initializer_list< std::initializer_list< ListReal > >& data );
-
-      /**
-       * \brief Copy constructor.
-       *
-       * \param matrix is an input matrix.
-       */
-      MultidiagonalMatrix( const MultidiagonalMatrix& matrix ) = default;
-
-      /**
-       * \brief Move constructor.
-       *
-       * \param matrix is an input matrix.
-       */
-      MultidiagonalMatrix( MultidiagonalMatrix&& matrix ) = default;
-
-      /**
-       * \brief Returns a modifiable view of the multidiagonal matrix.
-       *
-       * See \ref MultidiagonalMatrixView.
-       *
-       * \return multidiagonal matrix view.
-       */
-      ViewType getView() const; // TODO: remove const
-
-      /**
-       * \brief Returns a non-modifiable view of the multidiagonal matrix.
-       *
-       * See \ref MultidiagonalMatrixView.
-       *
-       * \return multidiagonal matrix view.
-       */
-      ConstViewType getConstView() const;
-
-      /**
-       * \brief Returns string with serialization type.
-       *
-       * The string has a form `Matrices::MultidiagonalMatrix< RealType,  [any_device], IndexType, ElementsOrganization, [any_allocator], [any_allocator] >`.
-       *
-       * \return \ref String with the serialization type.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_getSerializationType.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_getSerializationType.out
-       */
-      static String getSerializationType();
-
-      /**
-       * \brief Returns string with serialization type.
-       *
-       * See \ref MultidiagonalMatrix::getSerializationType.
-       *
-       * \return \e String with the serialization type.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_getSerializationType.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_getSerializationType.out
-       */
-      virtual String getSerializationTypeVirtual() const;
-
-      /**
-       * \brief Set matrix dimensions and diagonals offsets.
-       *
-       * \tparam Vector is type of vector like container holding the diagonals offsets.
-       *
-       * \param rows is number of matrix rows.
-       * \param columns is number of matrix columns.
-       * \param diagonalsOffsets is vector with diagonals offsets.
-       */
-      template< typename Vector >
-      void setDimensions( const IndexType rows,
-                          const IndexType columns,
-                          const Vector& diagonalsOffsets );
-
-      /**
-       * @brief Set the diagonals offsets by means of vector-like container.
-       *
-       * This method deletes current matrix elements.
-       *
-       * @tparam Vector is a type of vector-like container holding the subdiagonals offsets.
-       * @param diagonalsOffsets  is a vector-like container holding the subdiagonals offsets.
-       */
-      template< typename Vector >
-      void setDiagonalsOffsets( const Vector& diagonalsOffsets );
-
-      /**
-       * @brief Set the diagonals offsets by means of initializer list.
-       *
-       * This method deletes current matrix elements.
-       *
-       * @tparam ListIndex is type of indexes used for the subdiagonals offsets definition.
-       * @param diagonalsOffsets is a initializer list with subdiagonals offsets.
-       */
-      template< typename ListIndex >
-      void setDiagonalsOffsets( const std::initializer_list< ListIndex > diagonalsOffsets );
-
-      /**
-       * \brief This method is for compatibility with \ref SparseMatrix.
-       *
-       * It checks if the number of matrix diagonals is compatible with
-       * required number of non-zero matrix elements in each row. If not
-       * exception is thrown.
-       *
-       * \tparam RowCapacitiesVector is vector-like container type for holding required
-       *    row capacities.
-       *
-       * \param rowCapacities is vector-like container holding required row capacities.
-       */
-      template< typename RowCapacitiesVector >
-      void setRowCapacities( const RowCapacitiesVector& rowCapacities );
-
-      /**
-       * \brief Returns number of diagonals.
-       *
-       * \return Number of diagonals.
-       */
-      const IndexType getDiagonalsCount() const;
-
-      /**
-       * \brief Returns vector with diagonals offsets.
-       *
-       * \return vector with diagonals offsets.
-       */
-      const DiagonalsOffsetsType& getDiagonalsOffsets() const;
-
-      /**
-       * \brief Set matrix elements from an initializer list.
-       *
-       * \tparam ListReal is data type of the initializer list.
-       *
-       * \param data is initializer list holding matrix elements. The size of the outer list
-       *    defines the number of matrix rows. Each inner list defines values of each sub-diagonal
-       *    and so its size should be lower or equal to the size of \e diagonalsOffsets. Values
-       *    of sub-diagonals which do not fit to given row are omitted.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_setElements.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_setElements.out
-       */
-      template< typename ListReal >
-      void setElements( const std::initializer_list< std::initializer_list< ListReal > >& data );
-
-      /**
-       * \brief Compute capacities of all rows.
-       *
-       * The row capacities are not stored explicitly and must be computed.
-       *
-       * \param rowCapacities is a vector where the row capacities will be stored.
-       */
-      template< typename Vector >
-      void getRowCapacities( Vector& rowCapacities ) const;
-
-      /**
-       * \brief Computes number of non-zeros in each row.
-       *
-       * \param rowLengths is a vector into which the number of non-zeros in each row
-       * will be stored.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_getCompressedRowLengths.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_getCompressedRowLengths.out
-       */
-      template< typename Vector >
-      void getCompressedRowLengths( Vector& rowLengths ) const;
-
-      [[deprecated]]
-      IndexType getRowLength( const IndexType row ) const;
-
-      /**
-       * \brief Setup the matrix dimensions and diagonals offsets based on another multidiagonal matrix.
-       *
-       * \tparam Real_ is \e Real type of the source matrix.
-       * \tparam Device_ is \e Device type of the source matrix.
-       * \tparam Index_ is \e Index type of the source matrix.
-       * \tparam Organization_ is \e Organization of the source matrix.
-       * \tparam RealAllocator_ is \e RealAllocator of the source matrix.
-       * \tparam IndexAllocator_ is \e IndexAllocator of the source matrix.
-       *
-       * \param matrix is the source matrix.
-       */
-      template< typename Real_,
-                typename Device_,
-                typename Index_,
-                ElementsOrganization Organization_,
-                typename RealAllocator_,
-                typename IndexAllocator_ >
-      void setLike( const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_, IndexAllocator_ >& matrix );
-
-      /**
-       * \brief Returns number of non-zero matrix elements.
-       *
-       * This method really counts the non-zero matrix elements and so
-       * it returns zero for matrix having all allocated elements set to zero.
-       *
-       * \return number of non-zero matrix elements.
-       */
-      IndexType getNonzeroElementsCount() const;
-
-      /**
-       * \brief Resets the matrix to zero dimensions.
-       */
-      void reset();
-
-      /**
-       * \brief Comparison operator with another multidiagonal matrix.
-       *
-       * \tparam Real_ is \e Real type of the source matrix.
-       * \tparam Device_ is \e Device type of the source matrix.
-       * \tparam Index_ is \e Index type of the source matrix.
-       * \tparam Organization_ is \e Organization of the source matrix.
-       * \tparam RealAllocator_ is \e RealAllocator of the source matrix.
-       * \tparam IndexAllocator_ is \e IndexAllocator of the source matrix.
-       *
-       * \return \e true if both matrices are identical and \e false otherwise.
-       */
-      template< typename Real_,
-                typename Device_,
-                typename Index_,
-                ElementsOrganization Organization_,
-                typename RealAllocator_,
-                typename IndexAllocator_ >
-      bool operator == ( const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_, IndexAllocator_ >& matrix ) const;
-
-      /**
-       * \brief Comparison operator with another multidiagonal matrix.
-       *
-       * \tparam Real_ is \e Real type of the source matrix.
-       * \tparam Device_ is \e Device type of the source matrix.
-       * \tparam Index_ is \e Index type of the source matrix.
-       * \tparam Organization_ is \e Organization of the source matrix.
-       * \tparam RealAllocator_ is \e RealAllocator of the source matrix.
-       * \tparam IndexAllocator_ is \e IndexAllocator of the source matrix.
-       *
-       * \param matrix is the source matrix.
-       *
-       * \return \e true if both matrices are NOT identical and \e false otherwise.
-       */
-      template< typename Real_,
-                typename Device_,
-                typename Index_,
-                ElementsOrganization Organization_,
-                typename RealAllocator_,
-                typename IndexAllocator_ >
-      bool operator != ( const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_, IndexAllocator_ >& matrix ) const;
-
-      /**
-       * \brief Non-constant getter of simple structure for accessing given matrix row.
-       *
-       * \param rowIdx is matrix row index.
-       *
-       * \return RowView for accessing given matrix row.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_getRow.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_getRow.out
-       *
-       * See \ref MultidiagonalMatrixRowView.
-       */
-      __cuda_callable__
-      RowView getRow( const IndexType& rowIdx );
-
-      /**
-       * \brief Constant getter of simple structure for accessing given matrix row.
-       *
-       * \param rowIdx is matrix row index.
-       *
-       * \return RowView for accessing given matrix row.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_getConstRow.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_getConstRow.out
-       *
-       * See \ref MultidiagonalMatrixRowView.
-       */
-      __cuda_callable__
-      const ConstRowView getRow( const IndexType& rowIdx ) const;
-
-      /**
-       * \brief Set all matrix elements to given value.
-       *
-       * \param value is the new value of all matrix elements.
-       */
-      void setValue( const RealType& value );
-
-      /**
-       * \brief Sets element at given \e row and \e column to given \e value.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref MultidiagonalMatrix::getRow
-       * or \ref MultidiagonalMatrix::forElements and \ref MultidiagonalMatrix::forAllElements.
-       * The call may fail if the matrix row capacity is exhausted.
-       *
-       * \param row is row index of the element.
-       * \param column is columns index of the element.
-       * \param value is the value the element will be set to.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_setElement.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_setElement.out
-       */
-      __cuda_callable__
-      void setElement( const IndexType row,
-                       const IndexType column,
-                       const RealType& value );
-
-      /**
-       * \brief Add element at given \e row and \e column to given \e value.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref MultidiagonalMatrix::getRow
-       * or \ref MultidiagonalMatrix::forElements and \ref MultidiagonalMatrix::forAllElements.
-       * The call may fail if the matrix row capacity is exhausted.
-       *
-       * \param row is row index of the element.
-       * \param column is columns index of the element.
-       * \param value is the value the element will be set to.
-       * \param thisElementMultiplicator is multiplicator the original matrix element
-       *   value is multiplied by before addition of given \e value.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_addElement.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_addElement.out
-       *
-       */
-      __cuda_callable__
-      void addElement( const IndexType row,
-                       const IndexType column,
-                       const RealType& value,
-                       const RealType& thisElementMultiplicator = 1.0 );
-
-      /**
-       * \brief Returns value of matrix element at position given by its row and column index.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref MultidiagonalMatrix::getRow
-       * or \ref MultidiagonalMatrix::forElements and \ref MultidiagonalMatrix::forAllElements.
-       *
-       * \param row is a row index of the matrix element.
-       * \param column i a column index of the matrix element.
-       *
-       * \return value of given matrix element.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_getElement.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_getElement.out
-       *
-       */
-      __cuda_callable__
-      RealType getElement( const IndexType row,
-                           const IndexType column ) const;
-
-      /**
-       * \brief Method for performing general reduction on matrix rows.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       * The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_reduceRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_reduceRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceRows( IndexType begin, IndexType end, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& zero );
-
-      /**
-       * \brief Method for performing general reduction on matrix rows for constant instances.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       * The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callbale__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
-       *
-       * ```
-       * auto keep =[=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param begin defines beginning of the range [\e begin,\e end) of rows to be processed.
-       * \param end defines ending of the range [\e begin,\e end) of rows to be processed.
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_reduceRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_reduceRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceRows( IndexType begin, IndexType end, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& zero ) const;
-
-      /**
-       * \brief Method for performing general reduction on all matrix rows.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       * The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_reduceAllRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_reduceAllRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity );
-
-      /**
-       * \brief Method for performing general reduction on all matrix rows for constant instances.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       * The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
-       *
-       *  ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_reduceAllRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_reduceAllRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity ) const;
-
-      /**
-       * \brief Method for iteration over matrix rows for constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [=] __cuda_callble__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value ) { ... };
-       * ```
-       *
-       * where
-       *
-       * \e rowIdx is an index of the matrix row.
-       *
-       * \e localIdx parameter is a rank of the non-zero element in given row. It is also, in fact,
-       *  index of the matrix subdiagonal.
-       *
-       * \e columnIdx is a column index of the matrix element.
-       *
-       * \e value is the matrix element value.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function& function ) const;
-
-      /**
-       * \brief Method for iteration over matrix rows for non-constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value ) { ... };
-       * ```
-       *
-       * where
-       *
-       * \e rowIdx is an index of the matrix row.
-       *
-       * \e localIdx parameter is a rank of the non-zero element in given row. It is also, in fact,
-       *  index of the matrix subdiagonal.
-       *
-       * \e columnIdx is a column index of the matrix element.
-       *
-       * \e value is a reference to the matrix element value. It can be used even for changing the matrix element value.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function& function );
-
-      /**
-       * \brief This method calls \e forElements for all matrix rows (for constant instances).
-       *
-       * See \ref MultidiagonalMatrix::forElements.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forAllRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_forAllRows.out
-       */
-      template< typename Function >
-      void forAllElements( Function& function ) const;
-
-      /**
-       * \brief This method calls \e forElements for all matrix rows.
-       *
-       * See \ref MultidiagonalMatrix::forElements.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forAllRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_forAllRows.out
-       */
-      template< typename Function >
-      void forAllElements( Function& function );
-
-      /**
-       * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end).
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref MultidiagonalMatrix::forElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::MultidiagonalMatrix::RowView.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forRows( IndexType begin, IndexType end, Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end) for constant instances.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref MultidiagonalMatrix::forElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::MultidiagonalMatrix::RowView.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forRows( IndexType begin, IndexType end, Function&& function ) const;
-
-      /**
-       * \brief Method for parallel iteration over all matrix rows.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref MultidiagonalMatrix::forAllElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::MultidiagonalMatrix::RowView.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forAllRows( Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over all matrix rows for constant instances.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref MultidiagonalMatrix::forAllElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::MultidiagonalMatrix::RowView.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forAllRows( Function&& function ) const;
-
-      /**
-       * \brief Method for sequential iteration over all matrix rows for constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [=] ( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value ) { ... };
-       * ```
-       *
-       *  The column index repeats twice only for compatibility with sparse matrices.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForRows( IndexType begin, IndexType end, Function& function ) const;
-
-      /**
-       * \brief Method for sequential iteration over all matrix rows for non-constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value ) { ... };
-       * ```
-       *
-       *  The column index repeats twice only for compatibility with sparse matrices.
-       *
-       * \param begin defines beginning of the range [\e begin,\e end) of rows to be processed.
-       * \param end defines ending of the range [\e begin,\e end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForRows( IndexType begin, IndexType end, Function& function );
-
-      /**
-       * \brief This method calls \e sequentialForRows for all matrix rows (for constant instances).
-       *
-       * See \ref MultidiagonalMatrix::sequentialForRows.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForAllRows( Function& function ) const;
-
-      /**
-       * \brief This method calls \e sequentialForRows for all matrix rows.
-       *
-       * See \ref MultidiagonalMatrix::sequentialForAllRows.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForAllRows( Function& function );
-
-      /**
-       * \brief Computes product of matrix and vector.
-       *
-       * More precisely, it computes:
-       *
-       * ```
-       * outVector = matrixMultiplicator * ( * this ) * inVector + outVectorMultiplicator * outVector
-       * ```
-       *
-       * \tparam InVector is type of input vector.  It can be \ref Vector,
-       *     \ref VectorView, \ref Array, \ref ArraView or similar container.
-       * \tparam OutVector is type of output vector. It can be \ref Vector,
-       *     \ref VectorView, \ref Array, \ref ArraView or similar container.
-       *
-       * \param inVector is input vector.
-       * \param outVector is output vector.
-       * \param matrixMultiplicator is a factor by which the matrix is multiplied. It is one by default.
-       * \param outVectorMultiplicator is a factor by which the outVector is multiplied before added
-       *    to the result of matrix-vector product. It is zero by default.
-       * \param begin is the beginning of the rows range for which the vector product
-       *    is computed. It is zero by default.
-       * \param end is the end of the rows range for which the vector product
-       *    is computed. It is number if the matrix rows by default.
-       */
-      template< typename InVector,
-                typename OutVector >
-      void vectorProduct( const InVector& inVector,
-                          OutVector& outVector,
-                          const RealType matrixMultiplicator = 1.0,
-                          const RealType outVectorMultiplicator = 0.0,
-                          const IndexType begin = 0,
-                          IndexType end = 0 ) const;
-
-      template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_ >
-      void addMatrix( const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& matrix,
-                      const RealType& matrixMultiplicator = 1.0,
-                      const RealType& thisMatrixMultiplicator = 1.0 );
-
-      template< typename Real2, typename Index2 >
-      void getTransposition( const MultidiagonalMatrix< Real2, Device, Index2 >& matrix,
-                             const RealType& matrixMultiplicator = 1.0 );
-
-      /**
-       * \brief Assignment of exactly the same matrix type.
-       *
-       * \param matrix is input matrix for the assignment.
-       * \return reference to this matrix.
-       */
-      MultidiagonalMatrix& operator=( const MultidiagonalMatrix& matrix );
-
-      /**
-       * \brief Assignment of another multidiagonal matrix
-       *
-       * \param matrix is input matrix for the assignment.
-       * \return reference to this matrix.
-       */
-      template< typename Real_,
-                typename Device_,
-                typename Index_,
-                ElementsOrganization Organization_,
-                typename RealAllocator_,
-                typename IndexAllocator_ >
-      MultidiagonalMatrix& operator=( const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_, IndexAllocator_ >& matrix );
-
-      /**
-       * \brief Method for saving the matrix to a file.
-       *
-       * \param file is the output file.
-       */
-      void save( File& file ) const;
-
-      /**
-       * \brief Method for loading the matrix from a file.
-       *
-       * \param file is the input file.
-       */
-      void load( File& file );
-
-      /**
-       * \brief Method for saving the matrix to the file with given filename.
-       *
-       * \param fileName is name of the file.
-       */
-      void save( const String& fileName ) const;
-
-      /**
-       * \brief Method for loading the matrix from the file with given filename.
-       *
-       * \param fileName is name of the file.
-       */
-      void load( const String& fileName );
-
-      /**
-       * \brief Method for printing the matrix to output stream.
-       *
-       * \param str is the output stream.
-       */
-      void print( std::ostream& str ) const;
-
-      /**
-       * \brief This method returns matrix elements indexer used by this matrix.
-       *
-       * \return constant reference to the indexer.
-       */
-      const IndexerType& getIndexer() const;
-
-      /**
-       * \brief This method returns matrix elements indexer used by this matrix.
-       *
-       * \return non-constant reference to the indexer.
-       */
-      IndexerType& getIndexer();
-
-      /**
-       * \brief Returns padding index denoting padding zero elements.
-       *
-       * These elements are used for efficient data alignment in memory.
-       *
-       * \return value of the padding index.
-       */
-      __cuda_callable__
-      IndexType getPaddingIndex() const;
-
-   protected:
-
-      DiagonalsOffsetsType diagonalsOffsets;
-
-      HostDiagonalsOffsetsType hostDiagonalsOffsets;
-
-      IndexerType indexer;
-
-      ViewType view;
+public:
+   // Supporting types - they are not important for the user
+   using BaseType = Matrix< Real, Device, Index, RealAllocator >;
+   using ValuesType = typename BaseType::ValuesType;
+   using ValuesView = typename ValuesType::ViewType;
+   using IndexerType = details::MultidiagonalMatrixIndexer< Index, Organization >;
+   using DiagonalsOffsetsType = Containers::Vector< Index, Device, Index, IndexAllocator >;
+   using DiagonalsOffsetsView = typename DiagonalsOffsetsType::ViewType;
+   using HostDiagonalsOffsetsType = Containers::Vector< Index, Devices::Host, Index >;
+   using HostDiagonalsOffsetsView = typename HostDiagonalsOffsetsType::ViewType;
+
+   /**
+    * \brief The type of matrix elements.
+    */
+   using RealType = Real;
+
+   /**
+    * \brief The device where the matrix is allocated.
+    */
+   using DeviceType = Device;
+
+   /**
+    * \brief The type used for matrix elements indexing.
+    */
+   using IndexType = Index;
+
+   /**
+    * \brief This is only for compatibility with sparse matrices.
+    *
+    * \return \e  \e false.
+    */
+   static constexpr bool
+   isSymmetric()
+   {
+      return false;
+   };
+
+   /**
+    * \brief The allocator for matrix elements values.
+    */
+   using RealAllocatorType = RealAllocator;
+
+   /**
+    * \brief The allocator for matrix elements offsets from the diagonal.
+    */
+   using IndexAllocatorType = IndexAllocator;
+
+   /**
+    * \brief Type of related matrix view.
+    *
+    * See \ref MultidiagonalMatrixView.
+    */
+   using ViewType = MultidiagonalMatrixView< Real, Device, Index, Organization >;
+
+   /**
+    * \brief Matrix view type for constant instances.
+    *
+    * See \ref MultidiagonalMatrixView.
+    */
+   using ConstViewType = MultidiagonalMatrixView< typename std::add_const< Real >::type, Device, Index, Organization >;
+
+   /**
+    * \brief Type for accessing matrix rows.
+    */
+   using RowView = typename ViewType::RowView;
+
+   /**
+    * \brief Type for accessing constant matrix rows.
+    */
+   using ConstRowView = typename ViewType::ConstViewType;
+
+   /**
+    * \brief Helper type for getting self type or its modifications.
+    */
+   template< typename _Real = Real,
+             typename _Device = Device,
+             typename _Index = Index,
+             ElementsOrganization _Organization = Organization,
+             typename _RealAllocator = typename Allocators::Default< _Device >::template Allocator< _Real >,
+             typename _IndexAllocator = typename Allocators::Default< _Device >::template Allocator< _Index > >
+   using Self = MultidiagonalMatrix< _Real, _Device, _Index, _Organization, _RealAllocator, _IndexAllocator >;
+
+   /**
+    * \brief Elements organization getter.
+    */
+   static constexpr ElementsOrganization
+   getOrganization()
+   {
+      return Organization;
+   };
+
+   /**
+    * \brief Constructor with no parameters.
+    */
+   MultidiagonalMatrix();
+
+   /**
+    * \brief Constructor with matrix dimensions.
+    *
+    * \param rows is number of matrix rows.
+    * \param columns is number of matrix columns.
+    */
+   MultidiagonalMatrix( IndexType rows, IndexType columns );
+
+   /**
+    * \brief Constructor with matrix dimensions and matrix elements offsets.
+    *
+    * \param rows is number of matrix rows.
+    * \param columns is number of matrix columns.
+    * \param diagonalsOffsets are offsets of subdiagonals from the main diagonal.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_Constructor.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_Constructor.out
+    */
+   template< typename Vector >
+   MultidiagonalMatrix( IndexType rows, IndexType columns, const Vector& diagonalsOffsets );
+
+   /**
+    * \brief Constructor with matrix dimensions and diagonals offsets.
+    *
+    * \param rows is number of matrix rows.
+    * \param columns is number of matrix columns.
+    * \param diagonalsOffsets are offsets of sub-diagonals from the main diagonal.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_Constructor_init_list_1.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_Constructor_init_list_1.out
+    */
+   template< typename ListIndex >
+   MultidiagonalMatrix( IndexType rows, IndexType columns, std::initializer_list< ListIndex > diagonalsOffsets );
+
+   /**
+    * \brief Constructor with matrix dimensions, diagonals offsets and matrix elements.
+    *
+    * The number of matrix rows is deduced from the size of the initializer list \e data.
+    *
+    * \tparam ListIndex is type used in the initializer list defining matrix diagonals offsets.
+    * \tparam ListReal is type used in the initializer list defining matrix elements values.
+    *
+    * \param columns is number of matrix columns.
+    * \param diagonalOffsets are offsets of sub-diagonals from the main diagonal.
+    * \param data is initializer list holding matrix elements. The size of the outer list
+    *    defines the number of matrix rows. Each inner list defines values of each sub-diagonal
+    *    and so its size should be lower or equal to the size of \e diagonalsOffsets. Values
+    *    of sub-diagonals which do not fit to given row are omitted.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_Constructor_init_list_2.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_Constructor_init_list_2.out
+    */
+   template< typename ListIndex, typename ListReal >
+   MultidiagonalMatrix( IndexType columns,
+                        std::initializer_list< ListIndex > diagonalsOffsets,
+                        const std::initializer_list< std::initializer_list< ListReal > >& data );
+
+   /**
+    * \brief Copy constructor.
+    *
+    * \param matrix is an input matrix.
+    */
+   MultidiagonalMatrix( const MultidiagonalMatrix& matrix ) = default;
+
+   /**
+    * \brief Move constructor.
+    *
+    * \param matrix is an input matrix.
+    */
+   MultidiagonalMatrix( MultidiagonalMatrix&& matrix ) noexcept = default;
+
+   /**
+    * \brief Returns a modifiable view of the multidiagonal matrix.
+    *
+    * See \ref MultidiagonalMatrixView.
+    *
+    * \return multidiagonal matrix view.
+    */
+   ViewType
+   getView() const;  // TODO: remove const
+
+   /**
+    * \brief Returns a non-modifiable view of the multidiagonal matrix.
+    *
+    * See \ref MultidiagonalMatrixView.
+    *
+    * \return multidiagonal matrix view.
+    */
+   ConstViewType
+   getConstView() const;
+
+   /**
+    * \brief Returns string with serialization type.
+    *
+    * The string has a form `Matrices::MultidiagonalMatrix< RealType,  [any_device], IndexType, ElementsOrganization,
+    * [any_allocator], [any_allocator] >`.
+    *
+    * \return \ref String with the serialization type.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_getSerializationType.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_getSerializationType.out
+    */
+   static std::string
+   getSerializationType();
+
+   /**
+    * \brief Returns string with serialization type.
+    *
+    * See \ref MultidiagonalMatrix::getSerializationType.
+    *
+    * \return \e String with the serialization type.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_getSerializationType.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_getSerializationType.out
+    */
+   std::string
+   getSerializationTypeVirtual() const override;
+
+   /**
+    * \brief Set matrix dimensions and diagonals offsets.
+    *
+    * \tparam Vector is type of vector like container holding the diagonals offsets.
+    *
+    * \param rows is number of matrix rows.
+    * \param columns is number of matrix columns.
+    * \param diagonalsOffsets is vector with diagonals offsets.
+    */
+   template< typename Vector >
+   void
+   setDimensions( IndexType rows, IndexType columns, const Vector& diagonalsOffsets );
+
+   /**
+    * @brief Set the diagonals offsets by means of vector-like container.
+    *
+    * This method deletes current matrix elements.
+    *
+    * @tparam Vector is a type of vector-like container holding the subdiagonals offsets.
+    * @param diagonalsOffsets  is a vector-like container holding the subdiagonals offsets.
+    */
+   template< typename Vector >
+   void
+   setDiagonalsOffsets( const Vector& diagonalsOffsets );
+
+   /**
+    * @brief Set the diagonals offsets by means of initializer list.
+    *
+    * This method deletes current matrix elements.
+    *
+    * @tparam ListIndex is type of indexes used for the subdiagonals offsets definition.
+    * @param diagonalsOffsets is a initializer list with subdiagonals offsets.
+    */
+   template< typename ListIndex >
+   void
+   setDiagonalsOffsets( std::initializer_list< ListIndex > diagonalsOffsets );
+
+   /**
+    * \brief This method is for compatibility with \ref SparseMatrix.
+    *
+    * It checks if the number of matrix diagonals is compatible with
+    * required number of non-zero matrix elements in each row. If not
+    * exception is thrown.
+    *
+    * \tparam RowCapacitiesVector is vector-like container type for holding required
+    *    row capacities.
+    *
+    * \param rowCapacities is vector-like container holding required row capacities.
+    */
+   template< typename RowCapacitiesVector >
+   void
+   setRowCapacities( const RowCapacitiesVector& rowCapacities );
+
+   /**
+    * \brief Returns number of diagonals.
+    *
+    * \return Number of diagonals.
+    */
+   const IndexType
+   getDiagonalsCount() const;
+
+   /**
+    * \brief Returns vector with diagonals offsets.
+    *
+    * \return vector with diagonals offsets.
+    */
+   const DiagonalsOffsetsType&
+   getDiagonalsOffsets() const;
+
+   /**
+    * \brief Set matrix elements from an initializer list.
+    *
+    * \tparam ListReal is data type of the initializer list.
+    *
+    * \param data is initializer list holding matrix elements. The size of the outer list
+    *    defines the number of matrix rows. Each inner list defines values of each sub-diagonal
+    *    and so its size should be lower or equal to the size of \e diagonalsOffsets. Values
+    *    of sub-diagonals which do not fit to given row are omitted.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_setElements.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_setElements.out
+    */
+   template< typename ListReal >
+   void
+   setElements( const std::initializer_list< std::initializer_list< ListReal > >& data );
+
+   /**
+    * \brief Compute capacities of all rows.
+    *
+    * The row capacities are not stored explicitly and must be computed.
+    *
+    * \param rowCapacities is a vector where the row capacities will be stored.
+    */
+   template< typename Vector >
+   void
+   getRowCapacities( Vector& rowCapacities ) const;
+
+   /**
+    * \brief Computes number of non-zeros in each row.
+    *
+    * \param rowLengths is a vector into which the number of non-zeros in each row
+    * will be stored.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_getCompressedRowLengths.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_getCompressedRowLengths.out
+    */
+   template< typename Vector >
+   void
+   getCompressedRowLengths( Vector& rowLengths ) const;
+
+   [[deprecated]] IndexType
+   getRowLength( IndexType row ) const;
+
+   /**
+    * \brief Setup the matrix dimensions and diagonals offsets based on another multidiagonal matrix.
+    *
+    * \tparam Real_ is \e Real type of the source matrix.
+    * \tparam Device_ is \e Device type of the source matrix.
+    * \tparam Index_ is \e Index type of the source matrix.
+    * \tparam Organization_ is \e Organization of the source matrix.
+    * \tparam RealAllocator_ is \e RealAllocator of the source matrix.
+    * \tparam IndexAllocator_ is \e IndexAllocator of the source matrix.
+    *
+    * \param matrix is the source matrix.
+    */
+   template< typename Real_,
+             typename Device_,
+             typename Index_,
+             ElementsOrganization Organization_,
+             typename RealAllocator_,
+             typename IndexAllocator_ >
+   void
+   setLike( const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_, IndexAllocator_ >& matrix );
+
+   /**
+    * \brief Returns number of non-zero matrix elements.
+    *
+    * This method really counts the non-zero matrix elements and so
+    * it returns zero for matrix having all allocated elements set to zero.
+    *
+    * \return number of non-zero matrix elements.
+    */
+   IndexType
+   getNonzeroElementsCount() const override;
+
+   /**
+    * \brief Resets the matrix to zero dimensions.
+    */
+   void
+   reset();
+
+   /**
+    * \brief Comparison operator with another multidiagonal matrix.
+    *
+    * \tparam Real_ is \e Real type of the source matrix.
+    * \tparam Device_ is \e Device type of the source matrix.
+    * \tparam Index_ is \e Index type of the source matrix.
+    * \tparam Organization_ is \e Organization of the source matrix.
+    * \tparam RealAllocator_ is \e RealAllocator of the source matrix.
+    * \tparam IndexAllocator_ is \e IndexAllocator of the source matrix.
+    *
+    * \return \e true if both matrices are identical and \e false otherwise.
+    */
+   template< typename Real_,
+             typename Device_,
+             typename Index_,
+             ElementsOrganization Organization_,
+             typename RealAllocator_,
+             typename IndexAllocator_ >
+   bool
+   operator==(
+      const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_, IndexAllocator_ >& matrix ) const;
+
+   /**
+    * \brief Comparison operator with another multidiagonal matrix.
+    *
+    * \tparam Real_ is \e Real type of the source matrix.
+    * \tparam Device_ is \e Device type of the source matrix.
+    * \tparam Index_ is \e Index type of the source matrix.
+    * \tparam Organization_ is \e Organization of the source matrix.
+    * \tparam RealAllocator_ is \e RealAllocator of the source matrix.
+    * \tparam IndexAllocator_ is \e IndexAllocator of the source matrix.
+    *
+    * \param matrix is the source matrix.
+    *
+    * \return \e true if both matrices are NOT identical and \e false otherwise.
+    */
+   template< typename Real_,
+             typename Device_,
+             typename Index_,
+             ElementsOrganization Organization_,
+             typename RealAllocator_,
+             typename IndexAllocator_ >
+   bool
+   operator!=(
+      const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_, IndexAllocator_ >& matrix ) const;
+
+   /**
+    * \brief Non-constant getter of simple structure for accessing given matrix row.
+    *
+    * \param rowIdx is matrix row index.
+    *
+    * \return RowView for accessing given matrix row.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_getRow.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_getRow.out
+    *
+    * See \ref MultidiagonalMatrixRowView.
+    */
+   __cuda_callable__
+   RowView
+   getRow( const IndexType& rowIdx );
+
+   /**
+    * \brief Constant getter of simple structure for accessing given matrix row.
+    *
+    * \param rowIdx is matrix row index.
+    *
+    * \return RowView for accessing given matrix row.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_getConstRow.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_getConstRow.out
+    *
+    * See \ref MultidiagonalMatrixRowView.
+    */
+   __cuda_callable__
+   const ConstRowView
+   getRow( const IndexType& rowIdx ) const;
+
+   /**
+    * \brief Set all matrix elements to given value.
+    *
+    * \param value is the new value of all matrix elements.
+    */
+   void
+   setValue( const RealType& value );
+
+   /**
+    * \brief Sets element at given \e row and \e column to given \e value.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref MultidiagonalMatrix::getRow
+    * or \ref MultidiagonalMatrix::forElements and \ref MultidiagonalMatrix::forAllElements.
+    * The call may fail if the matrix row capacity is exhausted.
+    *
+    * \param row is row index of the element.
+    * \param column is columns index of the element.
+    * \param value is the value the element will be set to.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_setElement.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_setElement.out
+    */
+   __cuda_callable__
+   void
+   setElement( IndexType row, IndexType column, const RealType& value );
+
+   /**
+    * \brief Add element at given \e row and \e column to given \e value.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref MultidiagonalMatrix::getRow
+    * or \ref MultidiagonalMatrix::forElements and \ref MultidiagonalMatrix::forAllElements.
+    * The call may fail if the matrix row capacity is exhausted.
+    *
+    * \param row is row index of the element.
+    * \param column is columns index of the element.
+    * \param value is the value the element will be set to.
+    * \param thisElementMultiplicator is multiplicator the original matrix element
+    *   value is multiplied by before addition of given \e value.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_addElement.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_addElement.out
+    *
+    */
+   __cuda_callable__
+   void
+   addElement( IndexType row, IndexType column, const RealType& value, const RealType& thisElementMultiplicator = 1.0 );
+
+   /**
+    * \brief Returns value of matrix element at position given by its row and column index.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref MultidiagonalMatrix::getRow
+    * or \ref MultidiagonalMatrix::forElements and \ref MultidiagonalMatrix::forAllElements.
+    *
+    * \param row is a row index of the matrix element.
+    * \param column i a column index of the matrix element.
+    *
+    * \return value of given matrix element.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_getElement.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_getElement.out
+    *
+    */
+   __cuda_callable__
+   RealType
+   getElement( IndexType row, IndexType column ) const;
+
+   /**
+    * \brief Method for performing general reduction on matrix rows.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ...
+    * };
+    * ```
+    *
+    * The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_reduceRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_reduceRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceRows( IndexType begin, IndexType end, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& zero );
+
+   /**
+    * \brief Method for performing general reduction on matrix rows for constant instances.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ...
+    * };
+    * ```
+    *
+    * The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callbale__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
+    *
+    * ```
+    * auto keep =[=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param begin defines beginning of the range [\e begin,\e end) of rows to be processed.
+    * \param end defines ending of the range [\e begin,\e end) of rows to be processed.
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_reduceRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_reduceRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceRows( IndexType begin, IndexType end, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& zero ) const;
+
+   /**
+    * \brief Method for performing general reduction on all matrix rows.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ...
+    * };
+    * ```
+    *
+    * The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_reduceAllRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_reduceAllRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity );
+
+   /**
+    * \brief Method for performing general reduction on all matrix rows for constant instances.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ...
+    * };
+    * ```
+    *
+    * The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
+    *
+    *  ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_reduceAllRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_reduceAllRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity ) const;
+
+   /**
+    * \brief Method for iteration over matrix rows for constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [=] __cuda_callble__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )
+    * { ... };
+    * ```
+    *
+    * where
+    *
+    * \e rowIdx is an index of the matrix row.
+    *
+    * \e localIdx parameter is a rank of the non-zero element in given row. It is also, in fact,
+    *  index of the matrix subdiagonal.
+    *
+    * \e columnIdx is a column index of the matrix element.
+    *
+    * \e value is the matrix element value.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function& function ) const;
+
+   /**
+    * \brief Method for iteration over matrix rows for non-constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )
+    * { ... };
+    * ```
+    *
+    * where
+    *
+    * \e rowIdx is an index of the matrix row.
+    *
+    * \e localIdx parameter is a rank of the non-zero element in given row. It is also, in fact,
+    *  index of the matrix subdiagonal.
+    *
+    * \e columnIdx is a column index of the matrix element.
+    *
+    * \e value is a reference to the matrix element value. It can be used even for changing the matrix element value.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function& function );
+
+   /**
+    * \brief This method calls \e forElements for all matrix rows (for constant instances).
+    *
+    * See \ref MultidiagonalMatrix::forElements.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forAllRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_forAllRows.out
+    */
+   template< typename Function >
+   void
+   forAllElements( Function& function ) const;
+
+   /**
+    * \brief This method calls \e forElements for all matrix rows.
+    *
+    * See \ref MultidiagonalMatrix::forElements.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forAllRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_forAllRows.out
+    */
+   template< typename Function >
+   void
+   forAllElements( Function& function );
+
+   /**
+    * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end).
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref MultidiagonalMatrix::forElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::MultidiagonalMatrix::RowView.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forRows( IndexType begin, IndexType end, Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end) for constant instances.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref MultidiagonalMatrix::forElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::MultidiagonalMatrix::RowView.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forRows( IndexType begin, IndexType end, Function&& function ) const;
+
+   /**
+    * \brief Method for parallel iteration over all matrix rows.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref MultidiagonalMatrix::forAllElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::MultidiagonalMatrix::RowView.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forAllRows( Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over all matrix rows for constant instances.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref MultidiagonalMatrix::forAllElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::MultidiagonalMatrix::RowView.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_forRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forAllRows( Function&& function ) const;
+
+   /**
+    * \brief Method for sequential iteration over all matrix rows for constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [=] ( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value ) { ... };
+    * ```
+    *
+    *  The column index repeats twice only for compatibility with sparse matrices.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForRows( IndexType begin, IndexType end, Function& function ) const;
+
+   /**
+    * \brief Method for sequential iteration over all matrix rows for non-constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value ) {
+    * ... };
+    * ```
+    *
+    *  The column index repeats twice only for compatibility with sparse matrices.
+    *
+    * \param begin defines beginning of the range [\e begin,\e end) of rows to be processed.
+    * \param end defines ending of the range [\e begin,\e end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForRows( IndexType begin, IndexType end, Function& function );
+
+   /**
+    * \brief This method calls \e sequentialForRows for all matrix rows (for constant instances).
+    *
+    * See \ref MultidiagonalMatrix::sequentialForRows.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForAllRows( Function& function ) const;
+
+   /**
+    * \brief This method calls \e sequentialForRows for all matrix rows.
+    *
+    * See \ref MultidiagonalMatrix::sequentialForAllRows.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForAllRows( Function& function );
+
+   /**
+    * \brief Computes product of matrix and vector.
+    *
+    * More precisely, it computes:
+    *
+    * ```
+    * outVector = matrixMultiplicator * ( * this ) * inVector + outVectorMultiplicator * outVector
+    * ```
+    *
+    * \tparam InVector is type of input vector.  It can be \ref Vector,
+    *     \ref VectorView, \ref Array, \ref ArraView or similar container.
+    * \tparam OutVector is type of output vector. It can be \ref Vector,
+    *     \ref VectorView, \ref Array, \ref ArraView or similar container.
+    *
+    * \param inVector is input vector.
+    * \param outVector is output vector.
+    * \param matrixMultiplicator is a factor by which the matrix is multiplied. It is one by default.
+    * \param outVectorMultiplicator is a factor by which the outVector is multiplied before added
+    *    to the result of matrix-vector product. It is zero by default.
+    * \param begin is the beginning of the rows range for which the vector product
+    *    is computed. It is zero by default.
+    * \param end is the end of the rows range for which the vector product
+    *    is computed. It is number if the matrix rows by default.
+    */
+   template< typename InVector, typename OutVector >
+   void
+   vectorProduct( const InVector& inVector,
+                  OutVector& outVector,
+                  RealType matrixMultiplicator = 1.0,
+                  RealType outVectorMultiplicator = 0.0,
+                  IndexType begin = 0,
+                  IndexType end = 0 ) const;
+
+   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_ >
+   void
+   addMatrix( const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& matrix,
+              const RealType& matrixMultiplicator = 1.0,
+              const RealType& thisMatrixMultiplicator = 1.0 );
+
+   template< typename Real2, typename Index2 >
+   void
+   getTransposition( const MultidiagonalMatrix< Real2, Device, Index2 >& matrix, const RealType& matrixMultiplicator = 1.0 );
+
+   /**
+    * \brief Assignment of exactly the same matrix type.
+    *
+    * \param matrix is input matrix for the assignment.
+    * \return reference to this matrix.
+    */
+   MultidiagonalMatrix&
+   operator=( const MultidiagonalMatrix& matrix );
+
+   /**
+    * \brief Assignment of another multidiagonal matrix
+    *
+    * \param matrix is input matrix for the assignment.
+    * \return reference to this matrix.
+    */
+   template< typename Real_,
+             typename Device_,
+             typename Index_,
+             ElementsOrganization Organization_,
+             typename RealAllocator_,
+             typename IndexAllocator_ >
+   MultidiagonalMatrix&
+   operator=( const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_, IndexAllocator_ >& matrix );
+
+   /**
+    * \brief Method for saving the matrix to a file.
+    *
+    * \param file is the output file.
+    */
+   void
+   save( File& file ) const override;
+
+   /**
+    * \brief Method for loading the matrix from a file.
+    *
+    * \param file is the input file.
+    */
+   void
+   load( File& file ) override;
+
+   /**
+    * \brief Method for saving the matrix to the file with given filename.
+    *
+    * \param fileName is name of the file.
+    */
+   void
+   save( const String& fileName ) const;
+
+   /**
+    * \brief Method for loading the matrix from the file with given filename.
+    *
+    * \param fileName is name of the file.
+    */
+   void
+   load( const String& fileName );
+
+   /**
+    * \brief Method for printing the matrix to output stream.
+    *
+    * \param str is the output stream.
+    */
+   void
+   print( std::ostream& str ) const override;
+
+   /**
+    * \brief This method returns matrix elements indexer used by this matrix.
+    *
+    * \return constant reference to the indexer.
+    */
+   const IndexerType&
+   getIndexer() const;
+
+   /**
+    * \brief This method returns matrix elements indexer used by this matrix.
+    *
+    * \return non-constant reference to the indexer.
+    */
+   IndexerType&
+   getIndexer();
+
+   /**
+    * \brief Returns padding index denoting padding zero elements.
+    *
+    * These elements are used for efficient data alignment in memory.
+    *
+    * \return value of the padding index.
+    */
+   __cuda_callable__
+   IndexType
+   getPaddingIndex() const;
+
+protected:
+   DiagonalsOffsetsType diagonalsOffsets;
+
+   HostDiagonalsOffsetsType hostDiagonalsOffsets;
+
+   IndexerType indexer;
+
+   ViewType view;
 };
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/MultidiagonalMatrix.hpp>
diff --git a/src/TNL/Matrices/MultidiagonalMatrix.hpp b/src/TNL/Matrices/MultidiagonalMatrix.hpp
index 1d42e1ed8e61bd23b1b1ec31f682f44986c9378b..29342767a612d18f5a7023af6b36d0a40d0c98f6 100644
--- a/src/TNL/Matrices/MultidiagonalMatrix.hpp
+++ b/src/TNL/Matrices/MultidiagonalMatrix.hpp
@@ -20,10 +20,7 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-MultidiagonalMatrix()
-{
-}
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::MultidiagonalMatrix() = default;
 
 template< typename Real,
           typename Device,
@@ -31,11 +28,11 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Vector >
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-MultidiagonalMatrix( const IndexType rows,
-               const IndexType columns,
-               const Vector& diagonalsOffsets )
+template< typename Vector >
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::MultidiagonalMatrix(
+   const IndexType rows,
+   const IndexType columns,
+   const Vector& diagonalsOffsets )
 {
    TNL_ASSERT_GT( diagonalsOffsets.getSize(), 0, "Cannot construct multidiagonal matrix with no diagonals offsets." );
    this->setDimensions( rows, columns, diagonalsOffsets );
@@ -47,11 +44,11 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-      template< typename ListIndex >
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-MultidiagonalMatrix( const IndexType rows,
-                     const IndexType columns,
-                     const std::initializer_list< ListIndex > diagonalsOffsets )
+template< typename ListIndex >
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::MultidiagonalMatrix(
+   const IndexType rows,
+   const IndexType columns,
+   const std::initializer_list< ListIndex > diagonalsOffsets )
 {
    Containers::Vector< IndexType, DeviceType, IndexType > offsets( diagonalsOffsets );
    TNL_ASSERT_GT( offsets.getSize(), 0, "Cannot construct multidiagonal matrix with no diagonals offsets." );
@@ -64,11 +61,11 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename ListIndex, typename ListReal >
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-MultidiagonalMatrix( const IndexType columns,
-                     const std::initializer_list< ListIndex > diagonalsOffsets,
-                     const std::initializer_list< std::initializer_list< ListReal > >& data )
+template< typename ListIndex, typename ListReal >
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::MultidiagonalMatrix(
+   const IndexType columns,
+   const std::initializer_list< ListIndex > diagonalsOffsets,
+   const std::initializer_list< std::initializer_list< ListReal > >& data )
 {
    Containers::Vector< IndexType, DeviceType, IndexType > offsets( diagonalsOffsets );
    TNL_ASSERT_GT( offsets.getSize(), 0, "Cannot construct multidiagonal matrix with no diagonals offsets." );
@@ -83,8 +80,7 @@ template< typename Real,
           typename RealAllocator,
           typename IndexAllocator >
 auto
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-getView() const -> ViewType
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::getView() const -> ViewType
 {
    // TODO: fix when getConstView works
    return ViewType( const_cast< MultidiagonalMatrix* >( this )->values.getView(),
@@ -99,9 +95,8 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-String
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-getSerializationType()
+std::string
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::getSerializationType()
 {
    return ViewType::getSerializationType();
 }
@@ -112,9 +107,8 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-String
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-getSerializationTypeVirtual() const
+std::string
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::getSerializationTypeVirtual() const
 {
    return this->getSerializationType();
 }
@@ -125,12 +119,12 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Vector >
+template< typename Vector >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-setDimensions( const IndexType rows,
-               const IndexType columns,
-               const Vector& diagonalsOffsets )
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::setDimensions(
+   const IndexType rows,
+   const IndexType columns,
+   const Vector& diagonalsOffsets )
 {
    Matrix< Real, Device, Index >::setDimensions( rows, columns );
    this->diagonalsOffsets = diagonalsOffsets;
@@ -151,10 +145,10 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Vector >
+template< typename Vector >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-setDiagonalsOffsets( const Vector& diagonalsOffsets )
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::setDiagonalsOffsets(
+   const Vector& diagonalsOffsets )
 {
    TNL_ASSERT_GT( diagonalsOffsets.getSize(), 0, "Cannot construct multidiagonal matrix with no diagonals offsets." );
    this->setDimensions( this->getRows(), this->getColumns(), diagonalsOffsets );
@@ -166,10 +160,10 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename ListIndex >
+template< typename ListIndex >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-setDiagonalsOffsets( const std::initializer_list< ListIndex > diagonalsOffsets )
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::setDiagonalsOffsets(
+   const std::initializer_list< ListIndex > diagonalsOffsets )
 {
    Containers::Vector< IndexType, DeviceType, IndexType > offsets( diagonalsOffsets );
    TNL_ASSERT_GT( offsets.getSize(), 0, "Cannot construct multidiagonal matrix with no diagonals offsets." );
@@ -182,10 +176,10 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-  template< typename RowCapacitiesVector >
+template< typename RowCapacitiesVector >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-setRowCapacities( const RowCapacitiesVector& rowLengths )
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::setRowCapacities(
+   const RowCapacitiesVector& rowLengths )
 {
    if( max( rowLengths ) > 3 )
       throw std::logic_error( "Too many non-zero elements per row in a tri-diagonal matrix." );
@@ -193,13 +187,13 @@ setRowCapacities( const RowCapacitiesVector& rowLengths )
       throw std::logic_error( "Too many non-zero elements per row in a tri-diagonal matrix." );
    const IndexType diagonalLength = min( this->getRows(), this->getColumns() );
    if( this->getRows() > this->getColumns() )
-      if( rowLengths.getElement( this->getRows()-1 ) > 1 )
+      if( rowLengths.getElement( this->getRows() - 1 ) > 1 )
          throw std::logic_error( "Too many non-zero elements per row in a tri-diagonal matrix." );
    if( this->getRows() == this->getColumns() )
-      if( rowLengths.getElement( this->getRows()-1 ) > 2 )
+      if( rowLengths.getElement( this->getRows() - 1 ) > 2 )
          throw std::logic_error( "Too many non-zero elements per row in a tri-diagonal matrix." );
    if( this->getRows() < this->getColumns() )
-      if( rowLengths.getElement( this->getRows()-1 ) > 3 )
+      if( rowLengths.getElement( this->getRows() - 1 ) > 3 )
          throw std::logic_error( "Too many non-zero elements per row in a tri-diagonal matrix." );
 }
 
@@ -209,10 +203,10 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Vector >
+template< typename Vector >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-getRowCapacities( Vector& rowCapacities ) const
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::getRowCapacities(
+   Vector& rowCapacities ) const
 {
    return this->view.getRowCapacities( rowCapacities );
 }
@@ -223,30 +217,25 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename ListReal >
+template< typename ListReal >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-setElements( const std::initializer_list< std::initializer_list< ListReal > >& data )
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::setElements(
+   const std::initializer_list< std::initializer_list< ListReal > >& data )
 {
-   if( std::is_same< DeviceType, Devices::Host >::value )
-   {
+   if( std::is_same< DeviceType, Devices::Host >::value ) {
       this->getValues() = 0.0;
       auto row_it = data.begin();
-      for( size_t rowIdx = 0; rowIdx < data.size(); rowIdx++ )
-      {
+      for( size_t rowIdx = 0; rowIdx < data.size(); rowIdx++ ) {
          auto data_it = row_it->begin();
          IndexType i = 0;
          while( data_it != row_it->end() )
             this->getRow( rowIdx ).setElement( i++, *data_it++ );
-         row_it ++;
+         row_it++;
       }
    }
-   else
-   {
+   else {
       MultidiagonalMatrix< Real, Devices::Host, Index, Organization > hostMatrix(
-         this->getRows(),
-         this->getColumns(),
-         this->getDiagonalsOffsets() );
+         this->getRows(), this->getColumns(), this->getDiagonalsOffsets() );
       hostMatrix.setElements( data );
       *this = hostMatrix;
    }
@@ -259,8 +248,7 @@ template< typename Real,
           typename RealAllocator,
           typename IndexAllocator >
 const Index
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-getDiagonalsCount() const
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::getDiagonalsCount() const
 {
    return this->view.getDiagonalsCount();
 }
@@ -272,8 +260,8 @@ template< typename Real,
           typename RealAllocator,
           typename IndexAllocator >
 auto
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-getDiagonalsOffsets() const -> const DiagonalsOffsetsType&
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::getDiagonalsOffsets() const
+   -> const DiagonalsOffsetsType&
 {
    return this->diagonalsOffsets;
 }
@@ -284,10 +272,10 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Vector >
+template< typename Vector >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-getCompressedRowLengths( Vector& rowLengths ) const
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::getCompressedRowLengths(
+   Vector& rowLengths ) const
 {
    return this->view.getCompressedRowLengths( rowLengths );
 }
@@ -299,8 +287,8 @@ template< typename Real,
           typename RealAllocator,
           typename IndexAllocator >
 Index
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-getRowLength( const IndexType row ) const
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::getRowLength(
+   const IndexType row ) const
 {
    return this->view.getRowLength( row );
 }
@@ -311,10 +299,15 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_, typename IndexAllocator_ >
+template< typename Real_,
+          typename Device_,
+          typename Index_,
+          ElementsOrganization Organization_,
+          typename RealAllocator_,
+          typename IndexAllocator_ >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-setLike( const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_, IndexAllocator_ >& matrix )
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::setLike(
+   const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_, IndexAllocator_ >& matrix )
 {
    this->setDimensions( matrix.getRows(), matrix.getColumns(), matrix.getDiagonalsOffsets() );
 }
@@ -326,8 +319,7 @@ template< typename Real,
           typename RealAllocator,
           typename IndexAllocator >
 Index
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-getNonzeroElementsCount() const
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::getNonzeroElementsCount() const
 {
    return this->view.getNonzeroElementsCount();
 }
@@ -339,8 +331,7 @@ template< typename Real,
           typename RealAllocator,
           typename IndexAllocator >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-reset()
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::reset()
 {
    Matrix< Real, Device, Index >::reset();
 }
@@ -351,15 +342,19 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_, typename IndexAllocator_ >
+template< typename Real_,
+          typename Device_,
+          typename Index_,
+          ElementsOrganization Organization_,
+          typename RealAllocator_,
+          typename IndexAllocator_ >
 bool
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-operator == ( const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_, IndexAllocator_ >& matrix ) const
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::operator==(
+   const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_, IndexAllocator_ >& matrix ) const
 {
    if( Organization == Organization_ )
       return this->values == matrix.values;
-   else
-   {
+   else {
       TNL_ASSERT_TRUE( false, "TODO" );
    }
 }
@@ -370,10 +365,15 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_, typename IndexAllocator_ >
+template< typename Real_,
+          typename Device_,
+          typename Index_,
+          ElementsOrganization Organization_,
+          typename RealAllocator_,
+          typename IndexAllocator_ >
 bool
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-operator != ( const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_, IndexAllocator_ >& matrix ) const
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::operator!=(
+   const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_, IndexAllocator_ >& matrix ) const
 {
    return ! this->operator==( matrix );
 }
@@ -385,8 +385,7 @@ template< typename Real,
           typename RealAllocator,
           typename IndexAllocator >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-setValue( const RealType& v )
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::setValue( const RealType& v )
 {
    this->view.setValue( v );
 }
@@ -399,8 +398,8 @@ template< typename Real,
           typename IndexAllocator >
 __cuda_callable__
 auto
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-getRow( const IndexType& rowIdx ) const -> const ConstRowView
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::getRow( const IndexType& rowIdx ) const
+   -> const ConstRowView
 {
    return this->view.getRow( rowIdx );
 }
@@ -413,8 +412,8 @@ template< typename Real,
           typename IndexAllocator >
 __cuda_callable__
 auto
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-getRow( const IndexType& rowIdx ) -> RowView
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::getRow( const IndexType& rowIdx )
+   -> RowView
 {
    return this->view.getRow( rowIdx );
 }
@@ -427,8 +426,9 @@ template< typename Real,
           typename IndexAllocator >
 __cuda_callable__
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-setElement( const IndexType row, const IndexType column, const RealType& value )
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::setElement( const IndexType row,
+                                                                                                     const IndexType column,
+                                                                                                     const RealType& value )
 {
    this->view.setElement( row, column, value );
 }
@@ -441,11 +441,11 @@ template< typename Real,
           typename IndexAllocator >
 __cuda_callable__
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-addElement( const IndexType row,
-            const IndexType column,
-            const RealType& value,
-            const RealType& thisElementMultiplicator )
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::addElement(
+   const IndexType row,
+   const IndexType column,
+   const RealType& value,
+   const RealType& thisElementMultiplicator )
 {
    this->view.addElement( row, column, value, thisElementMultiplicator );
 }
@@ -458,8 +458,9 @@ template< typename Real,
           typename IndexAllocator >
 __cuda_callable__
 Real
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-getElement( const IndexType row, const IndexType column ) const
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::getElement(
+   const IndexType row,
+   const IndexType column ) const
 {
    return this->view.getElement( row, column );
 }
@@ -470,10 +471,15 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-reduceRows( IndexType first, IndexType last, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity ) const
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::reduceRows(
+   IndexType first,
+   IndexType last,
+   Fetch& fetch,
+   Reduce& reduce,
+   Keep& keep,
+   const FetchReal& identity ) const
 {
    this->view.reduceRows( first, last, fetch, reduce, keep, identity );
 }
@@ -484,10 +490,14 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-reduceRows( IndexType first, IndexType last, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity )
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::reduceRows( IndexType first,
+                                                                                                     IndexType last,
+                                                                                                     Fetch& fetch,
+                                                                                                     Reduce& reduce,
+                                                                                                     Keep& keep,
+                                                                                                     const FetchReal& identity )
 {
    this->view.reduceRows( first, last, fetch, reduce, keep, identity );
 }
@@ -498,10 +508,13 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity ) const
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::reduceAllRows(
+   Fetch& fetch,
+   Reduce& reduce,
+   Keep& keep,
+   const FetchReal& identity ) const
 {
    this->view.reduceRows( (IndexType) 0, this->getRows(), fetch, reduce, keep, identity );
 }
@@ -512,10 +525,13 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity )
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::reduceAllRows(
+   Fetch& fetch,
+   Reduce& reduce,
+   Keep& keep,
+   const FetchReal& identity )
 {
    this->view.reduceRows( (IndexType) 0, this->getRows(), fetch, reduce, keep, identity );
 }
@@ -526,10 +542,11 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Function >
+template< typename Function >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-forElements( IndexType first, IndexType last, Function& function ) const
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::forElements( IndexType first,
+                                                                                                      IndexType last,
+                                                                                                      Function& function ) const
 {
    this->view.forElements( first, last, function );
 }
@@ -540,10 +557,11 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-  template< typename Function >
+template< typename Function >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-forElements( IndexType first, IndexType last, Function& function )
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::forElements( IndexType first,
+                                                                                                      IndexType last,
+                                                                                                      Function& function )
 {
    this->view.forElements( first, last, function );
 }
@@ -554,10 +572,10 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Function >
+template< typename Function >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-forAllElements( Function& function ) const
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::forAllElements(
+   Function& function ) const
 {
    this->view.forElements( (IndexType) 0, this->getRows(), function );
 }
@@ -568,10 +586,9 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Function >
+template< typename Function >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-forAllElements( Function& function )
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::forAllElements( Function& function )
 {
    this->view.forElements( (IndexType) 0, this->getRows(), function );
 }
@@ -582,10 +599,11 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Function >
+template< typename Function >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-forRows( IndexType begin, IndexType end, Function&& function )
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::forRows( IndexType begin,
+                                                                                                  IndexType end,
+                                                                                                  Function&& function )
 {
    this->getView().forRows( begin, end, function );
 }
@@ -596,10 +614,11 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Function >
+template< typename Function >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-forRows( IndexType begin, IndexType end, Function&& function ) const
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::forRows( IndexType begin,
+                                                                                                  IndexType end,
+                                                                                                  Function&& function ) const
 {
    this->getConstView().forRows( begin, end, function );
 }
@@ -610,10 +629,9 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Function >
+template< typename Function >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-forAllRows( Function&& function )
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::forAllRows( Function&& function )
 {
    this->getView().forAllRows( function );
 }
@@ -624,10 +642,9 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Function >
+template< typename Function >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-forAllRows( Function&& function ) const
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::forAllRows( Function&& function ) const
 {
    this->getConsView().forAllRows( function );
 }
@@ -638,10 +655,12 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Function >
+template< typename Function >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-sequentialForRows( IndexType begin, IndexType end, Function& function ) const
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::sequentialForRows(
+   IndexType begin,
+   IndexType end,
+   Function& function ) const
 {
    this->view.sequentialForRows( begin, end, function );
 }
@@ -652,10 +671,11 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Function >
+template< typename Function >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-sequentialForRows( IndexType first, IndexType last, Function& function )
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::sequentialForRows( IndexType first,
+                                                                                                            IndexType last,
+                                                                                                            Function& function )
 {
    this->view.sequentialForRows( first, last, function );
 }
@@ -666,10 +686,10 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Function >
+template< typename Function >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-sequentialForAllRows( Function& function ) const
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::sequentialForAllRows(
+   Function& function ) const
 {
    this->sequentialForRows( (IndexType) 0, this->getRows(), function );
 }
@@ -680,10 +700,10 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Function >
+template< typename Function >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-sequentialForAllRows( Function& function )
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::sequentialForAllRows(
+   Function& function )
 {
    this->sequentialForRows( (IndexType) 0, this->getRows(), function );
 }
@@ -694,19 +714,17 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename InVector,
-             typename OutVector >
+template< typename InVector, typename OutVector >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-vectorProduct( const InVector& inVector,
-               OutVector& outVector,
-               const RealType matrixMultiplicator,
-               const RealType outVectorMultiplicator,
-               const IndexType firstRow,
-               IndexType lastRow ) const
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::vectorProduct(
+   const InVector& inVector,
+   OutVector& outVector,
+   RealType matrixMultiplicator,
+   RealType outVectorMultiplicator,
+   IndexType firstRow,
+   IndexType lastRow ) const
 {
-   this->view.vectorProduct( inVector, outVector, matrixMultiplicator,
-                              outVectorMultiplicator, firstRow, lastRow );
+   this->view.vectorProduct( inVector, outVector, matrixMultiplicator, outVectorMultiplicator, firstRow, lastRow );
 }
 
 template< typename Real,
@@ -715,40 +733,32 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_ >
+template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_ >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-addMatrix( const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& matrix,
-           const RealType& matrixMultiplicator,
-           const RealType& thisMatrixMultiplicator )
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::addMatrix(
+   const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& matrix,
+   const RealType& matrixMultiplicator,
+   const RealType& thisMatrixMultiplicator )
 {
    this->view.addMatrix( matrix.getView(), matrixMultiplicator, thisMatrixMultiplicator );
 }
 
 #ifdef HAVE_CUDA
-template< typename Real,
-          typename Real2,
-          typename Index,
-          typename Index2 >
-__global__ void MultidiagonalMatrixTranspositionCudaKernel( const MultidiagonalMatrix< Real2, Devices::Cuda, Index2 >* inMatrix,
-                                                             MultidiagonalMatrix< Real, Devices::Cuda, Index >* outMatrix,
-                                                             const Real matrixMultiplicator,
-                                                             const Index gridIdx )
+template< typename Real, typename Real2, typename Index, typename Index2 >
+__global__
+void
+MultidiagonalMatrixTranspositionCudaKernel( const MultidiagonalMatrix< Real2, Devices::Cuda, Index2 >* inMatrix,
+                                            MultidiagonalMatrix< Real, Devices::Cuda, Index >* outMatrix,
+                                            const Real matrixMultiplicator,
+                                            const Index gridIdx )
 {
    const Index rowIdx = ( gridIdx * Cuda::getMaxGridSize() + blockIdx.x ) * blockDim.x + threadIdx.x;
-   if( rowIdx < inMatrix->getRows() )
-   {
+   if( rowIdx < inMatrix->getRows() ) {
       if( rowIdx > 0 )
-        outMatrix->setElementFast( rowIdx-1,
-                                   rowIdx,
-                                   matrixMultiplicator * inMatrix->getElementFast( rowIdx, rowIdx-1 ) );
-      outMatrix->setElementFast( rowIdx,
-                                 rowIdx,
-                                 matrixMultiplicator * inMatrix->getElementFast( rowIdx, rowIdx ) );
-      if( rowIdx < inMatrix->getRows()-1 )
-         outMatrix->setElementFast( rowIdx+1,
-                                    rowIdx,
-                                    matrixMultiplicator * inMatrix->getElementFast( rowIdx, rowIdx+1 ) );
+         outMatrix->setElementFast( rowIdx - 1, rowIdx, matrixMultiplicator * inMatrix->getElementFast( rowIdx, rowIdx - 1 ) );
+      outMatrix->setElementFast( rowIdx, rowIdx, matrixMultiplicator * inMatrix->getElementFast( rowIdx, rowIdx ) );
+      if( rowIdx < inMatrix->getRows() - 1 )
+         outMatrix->setElementFast( rowIdx + 1, rowIdx, matrixMultiplicator * inMatrix->getElementFast( rowIdx, rowIdx + 1 ) );
    }
 }
 #endif
@@ -759,43 +769,37 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Real2, typename Index2 >
-void MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-getTransposition( const MultidiagonalMatrix< Real2, Device, Index2 >& matrix,
-                  const RealType& matrixMultiplicator )
+template< typename Real2, typename Index2 >
+void
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::getTransposition(
+   const MultidiagonalMatrix< Real2, Device, Index2 >& matrix,
+   const RealType& matrixMultiplicator )
 {
    TNL_ASSERT( this->getRows() == matrix.getRows(),
                std::cerr << "This matrix rows: " << this->getRows() << std::endl
-                    << "That matrix rows: " << matrix.getRows() << std::endl );
-   if( std::is_same< Device, Devices::Host >::value )
-   {
+                         << "That matrix rows: " << matrix.getRows() << std::endl );
+   if( std::is_same< Device, Devices::Host >::value ) {
       const IndexType& rows = matrix.getRows();
-      for( IndexType i = 1; i < rows; i++ )
-      {
-         RealType aux = matrix. getElement( i, i - 1 );
+      for( IndexType i = 1; i < rows; i++ ) {
+         RealType aux = matrix.getElement( i, i - 1 );
          this->setElement( i, i - 1, matrix.getElement( i - 1, i ) );
          this->setElement( i, i, matrix.getElement( i, i ) );
          this->setElement( i - 1, i, aux );
       }
    }
-   if( std::is_same< Device, Devices::Cuda >::value )
-   {
+   if( std::is_same< Device, Devices::Cuda >::value ) {
 #ifdef HAVE_CUDA
       MultidiagonalMatrix* kernel_this = Cuda::passToDevice( *this );
-      typedef  MultidiagonalMatrix< Real2, Device, Index2 > InMatrixType;
+      typedef MultidiagonalMatrix< Real2, Device, Index2 > InMatrixType;
       InMatrixType* kernel_inMatrix = Cuda::passToDevice( matrix );
       dim3 cudaBlockSize( 256 ), cudaGridSize( Cuda::getMaxGridSize() );
       const IndexType cudaBlocks = roundUpDivision( matrix.getRows(), cudaBlockSize.x );
       const IndexType cudaGrids = roundUpDivision( cudaBlocks, Cuda::getMaxGridSize() );
-      for( IndexType gridIdx = 0; gridIdx < cudaGrids; gridIdx++ )
-      {
+      for( IndexType gridIdx = 0; gridIdx < cudaGrids; gridIdx++ ) {
          if( gridIdx == cudaGrids - 1 )
             cudaGridSize.x = cudaBlocks % Cuda::getMaxGridSize();
-         MultidiagonalMatrixTranspositionCudaKernel<<< cudaGridSize, cudaBlockSize >>>
-                                                    ( kernel_inMatrix,
-                                                      kernel_this,
-                                                      matrixMultiplicator,
-                                                      gridIdx );
+         MultidiagonalMatrixTranspositionCudaKernel<<< cudaGridSize,
+            cudaBlockSize >>>( kernel_inMatrix, kernel_this, matrixMultiplicator, gridIdx );
       }
       Cuda::freeFromDevice( kernel_this );
       Cuda::freeFromDevice( kernel_inMatrix );
@@ -812,7 +816,8 @@ template< typename Real,
           typename RealAllocator,
           typename IndexAllocator >
 MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >&
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::operator=( const MultidiagonalMatrix& matrix )
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::operator=(
+   const MultidiagonalMatrix& matrix )
 {
    this->setLike( matrix );
    this->values = matrix.values;
@@ -826,10 +831,15 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_, typename IndexAllocator_ >
+template< typename Real_,
+          typename Device_,
+          typename Index_,
+          ElementsOrganization Organization_,
+          typename RealAllocator_,
+          typename IndexAllocator_ >
 MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >&
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-operator=( const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_, IndexAllocator_ >& matrix )
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::operator=(
+   const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_, IndexAllocator_ >& matrix )
 {
    using RHSMatrix = MultidiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_, IndexAllocator_ >;
    using RHSIndexType = typename RHSMatrix::IndexType;
@@ -841,23 +851,23 @@ operator=( const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, Rea
    this->setLike( matrix );
    if( Organization == Organization_ )
       this->values = matrix.getValues();
-   else
-   {
-      if( std::is_same< Device, Device_ >::value )
-      {
+   else {
+      if( std::is_same< Device, Device_ >::value ) {
          const auto matrix_view = matrix.getView();
-         auto f = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value ) mutable {
+         auto f = [ = ] __cuda_callable__(
+                     const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value ) mutable
+         {
             value = matrix_view.getValues()[ matrix_view.getIndexer().getGlobalIndex( rowIdx, localIdx ) ];
          };
          this->forAllElements( f );
       }
-      else
-      {
+      else {
          const IndexType maxRowLength = this->diagonalsOffsets.getSize();
          const IndexType bufferRowsCount( 128 );
          const size_t bufferSize = bufferRowsCount * maxRowLength;
          Containers::Vector< RHSRealType, RHSDeviceType, RHSIndexType, RHSRealAllocatorType > matrixValuesBuffer( bufferSize );
-         Containers::Vector< RHSIndexType, RHSDeviceType, RHSIndexType, RHSIndexAllocatorType > matrixColumnsBuffer( bufferSize );
+         Containers::Vector< RHSIndexType, RHSDeviceType, RHSIndexType, RHSIndexAllocatorType > matrixColumnsBuffer(
+            bufferSize );
          Containers::Vector< RealType, DeviceType, IndexType, RealAllocatorType > thisValuesBuffer( bufferSize );
          Containers::Vector< IndexType, DeviceType, IndexType, IndexAllocatorType > thisColumnsBuffer( bufferSize );
          auto matrixValuesBuffer_view = matrixValuesBuffer.getView();
@@ -865,15 +875,17 @@ operator=( const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, Rea
 
          IndexType baseRow( 0 );
          const IndexType rowsCount = this->getRows();
-         while( baseRow < rowsCount )
-         {
+         while( baseRow < rowsCount ) {
             const IndexType lastRow = min( baseRow + bufferRowsCount, rowsCount );
 
             ////
             // Copy matrix elements into buffer
-            auto f1 = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIndex, const RHSRealType& value ) mutable {
-                  const IndexType bufferIdx = ( rowIdx - baseRow ) * maxRowLength + localIdx;
-                  matrixValuesBuffer_view[ bufferIdx ] = value;
+            auto f1 =
+               [ = ] __cuda_callable__(
+                  RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIndex, const RHSRealType& value ) mutable
+            {
+               const IndexType bufferIdx = ( rowIdx - baseRow ) * maxRowLength + localIdx;
+               matrixValuesBuffer_view[ bufferIdx ] = value;
             };
             matrix.forElements( baseRow, lastRow, f1 );
 
@@ -883,9 +895,12 @@ operator=( const MultidiagonalMatrix< Real_, Device_, Index_, Organization_, Rea
 
             ////
             // Copy matrix elements from the buffer to the matrix
-            auto f2 = [=] __cuda_callable__ ( const IndexType rowIdx, const IndexType localIdx, const IndexType columnIndex, RealType& value ) mutable {
+            auto f2 =
+               [ = ] __cuda_callable__(
+                  const IndexType rowIdx, const IndexType localIdx, const IndexType columnIndex, RealType& value ) mutable
+            {
                const IndexType bufferIdx = ( rowIdx - baseRow ) * maxRowLength + localIdx;
-                  value = thisValuesBuffer_view[ bufferIdx ];
+               value = thisValuesBuffer_view[ bufferIdx ];
             };
             this->forElements( baseRow, lastRow, f2 );
             baseRow += bufferRowsCount;
@@ -901,7 +916,8 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-void MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::save( File& file ) const
+void
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::save( File& file ) const
 {
    Matrix< Real, Device, Index >::save( file );
    file << diagonalsOffsets;
@@ -913,7 +929,8 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-void MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::load( File& file )
+void
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::load( File& file )
 {
    Matrix< Real, Device, Index >::load( file );
    file >> this->diagonalsOffsets;
@@ -932,7 +949,8 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-void MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::save( const String& fileName ) const
+void
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::save( const String& fileName ) const
 {
    Object::save( fileName );
 }
@@ -943,7 +961,8 @@ template< typename Real,
           ElementsOrganization Organization,
           typename RealAllocator,
           typename IndexAllocator >
-void MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::load( const String& fileName )
+void
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::load( const String& fileName )
 {
    Object::load( fileName );
 }
@@ -955,8 +974,7 @@ template< typename Real,
           typename RealAllocator,
           typename IndexAllocator >
 void
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-print( std::ostream& str ) const
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::print( std::ostream& str ) const
 {
    this->view.print( str );
 }
@@ -968,8 +986,8 @@ template< typename Real,
           typename RealAllocator,
           typename IndexAllocator >
 auto
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-getIndexer() const -> const IndexerType&
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::getIndexer() const
+   -> const IndexerType&
 {
    return this->indexer;
 }
@@ -981,8 +999,7 @@ template< typename Real,
           typename RealAllocator,
           typename IndexAllocator >
 auto
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-getIndexer() -> IndexerType&
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::getIndexer() -> IndexerType&
 {
    return this->indexer;
 }
@@ -995,11 +1012,10 @@ template< typename Real,
           typename IndexAllocator >
 __cuda_callable__
 Index
-MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
-getPaddingIndex() const
+MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::getPaddingIndex() const
 {
    return this->view.getPaddingIndex();
 }
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/MultidiagonalMatrixElement.h b/src/TNL/Matrices/MultidiagonalMatrixElement.h
index 86e0e7919a3442723e0238a7addc64d58222419f..3c2cd06952bfe1574ca14c93555972de924b6c78 100644
--- a/src/TNL/Matrices/MultidiagonalMatrixElement.h
+++ b/src/TNL/Matrices/MultidiagonalMatrixElement.h
@@ -13,102 +13,119 @@
 namespace TNL {
 namespace Matrices {
 
-
 /**
  * \brief Accessor for multidiagonal matrix elements.
  *
  * \tparam Real is a type of matrix elements values.
  * \tparam Index is a type of matrix elements column indexes.
  */
-template< typename Real,
-          typename Index >
+template< typename Real, typename Index >
 class MultidiagonalMatrixElement
 {
-   public:
-
-      /**
-       * \brief Type of matrix elements values.
-       */
-      using RealType = Real;
-
-      /**
-       * \brief Type of matrix elements column indexes.
-       */
-      using IndexType = Index;
-
-      /**
-       * \brief Constructor.
-       *
-       * \param value is matrix element value.
-       * \param rowIdx is row index of the matrix element.
-       * \param columnIdx is a column index of the matrix element.
-       * \param localIdx is the rank of the non-zero elements in the matrix row.
-       */
-      __cuda_callable__
-      MultidiagonalMatrixElement( RealType& value,
-                                  const IndexType& rowIdx,
-                                  const IndexType& columnIdx,
-                                  const IndexType& localIdx )
-      : value_( value ), rowIdx( rowIdx ), columnIdx( columnIdx ), localIdx( localIdx ) {};
-
-      /**
-       * \brief Returns reference on matrix element value.
-       *
-       * \return reference on matrix element value.
-       */
-      __cuda_callable__
-      RealType& value() { return value_; };
-
-      /**
-       * \brief Returns constant reference on matrix element value.
-       *
-       * \return constant reference on matrix element value.
-       */
-      __cuda_callable__
-      const RealType& value() const { return value_; };
-
-      /**
-       * \brief Returns constant reference on matrix element column index.
-       *
-       * \return constant reference on matrix element column index.
-       */
-      __cuda_callable__
-      const IndexType& rowIndex() const { return rowIdx; };
-
-      /**
-       * \brief Returns reference on matrix element column index.
-       *
-       * \return reference on matrix element column index.
-       */
-      __cuda_callable__
-      IndexType& columnIndex() { return columnIdx; };
-
-      /**
-       * \brief Returns constant reference on matrix element column index.
-       *
-       * \return constant reference on matrix element column index.
-       */
-      __cuda_callable__
-      const IndexType& columnIndex() const { return columnIdx; };
-
-      /**
-       * \brief Returns constant reference on the rank of the non-zero matrix element in the row.
-       *
-       * \return constant reference on the rank of the non-zero matrix element in the row.
-       */
-      __cuda_callable__
-      const IndexType& localIndex() const { return localIdx; };
-
-   protected:
-
-      RealType& value_;
-
-      const IndexType& rowIdx;
-
-      IndexType columnIdx;
-
-      const IndexType& localIdx;
+public:
+   /**
+    * \brief Type of matrix elements values.
+    */
+   using RealType = Real;
+
+   /**
+    * \brief Type of matrix elements column indexes.
+    */
+   using IndexType = Index;
+
+   /**
+    * \brief Constructor.
+    *
+    * \param value is matrix element value.
+    * \param rowIdx is row index of the matrix element.
+    * \param columnIdx is a column index of the matrix element.
+    * \param localIdx is the rank of the non-zero elements in the matrix row.
+    */
+   __cuda_callable__
+   MultidiagonalMatrixElement( RealType& value, const IndexType& rowIdx, const IndexType& columnIdx, const IndexType& localIdx )
+   : value_( value ), rowIdx( rowIdx ), columnIdx( columnIdx ), localIdx( localIdx ){};
+
+   /**
+    * \brief Returns reference on matrix element value.
+    *
+    * \return reference on matrix element value.
+    */
+   __cuda_callable__
+   RealType&
+   value()
+   {
+      return value_;
+   };
+
+   /**
+    * \brief Returns constant reference on matrix element value.
+    *
+    * \return constant reference on matrix element value.
+    */
+   __cuda_callable__
+   const RealType&
+   value() const
+   {
+      return value_;
+   };
+
+   /**
+    * \brief Returns constant reference on matrix element column index.
+    *
+    * \return constant reference on matrix element column index.
+    */
+   __cuda_callable__
+   const IndexType&
+   rowIndex() const
+   {
+      return rowIdx;
+   };
+
+   /**
+    * \brief Returns reference on matrix element column index.
+    *
+    * \return reference on matrix element column index.
+    */
+   __cuda_callable__
+   IndexType&
+   columnIndex()
+   {
+      return columnIdx;
+   };
+
+   /**
+    * \brief Returns constant reference on matrix element column index.
+    *
+    * \return constant reference on matrix element column index.
+    */
+   __cuda_callable__
+   const IndexType&
+   columnIndex() const
+   {
+      return columnIdx;
+   };
+
+   /**
+    * \brief Returns constant reference on the rank of the non-zero matrix element in the row.
+    *
+    * \return constant reference on the rank of the non-zero matrix element in the row.
+    */
+   __cuda_callable__
+   const IndexType&
+   localIndex() const
+   {
+      return localIdx;
+   };
+
+protected:
+   RealType& value_;
+
+   const IndexType& rowIdx;
+
+   IndexType columnIdx;
+
+   const IndexType& localIdx;
 };
 
-   } // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/MultidiagonalMatrixRowView.h b/src/TNL/Matrices/MultidiagonalMatrixRowView.h
index 5e09d7585410845d8a83eb87e5b41dc470012003..bb0fa35fcd268603e54a63f83fda9095454b2372 100644
--- a/src/TNL/Matrices/MultidiagonalMatrixRowView.h
+++ b/src/TNL/Matrices/MultidiagonalMatrixRowView.h
@@ -33,189 +33,194 @@ namespace Matrices {
  * \par Output
  * \include MultidiagonalMatrixViewExample_getRow.out
  */
-template< typename ValuesView,
-          typename Indexer,
-          typename DiagonalsOffsetsView_ >
+template< typename ValuesView, typename Indexer, typename DiagonalsOffsetsView_ >
 class MultidiagonalMatrixRowView
 {
-   public:
-
-      /**
-       * \brief The type of matrix elements.
-       */
-      using RealType = typename ValuesView::RealType;
-
-      /**
-       * \brief The type used for matrix elements indexing.
-       */
-      using IndexType = typename ValuesView::IndexType;
-
-      /**
-       * \brief Type of container view used for storing the matrix elements values.
-       */
-      using ValuesViewType = ValuesView;
-
-      /**
-       * \brief Type of object responsible for indexing and organization of
-       * matrix elements.
-       */
-      using IndexerType = Indexer;
-
-      /**
-       * \brief Type of a container view holding offsets of
-       * diagonals of multidiagonal matrix.
-       */
-      using DiagonalsOffsetsView = DiagonalsOffsetsView_;
-
-      /**
-       * \brief Type of constant container view used for storing the matrix elements values.
-       */
-      using ConstValuesViewType = typename ValuesViewType::ConstViewType;
-
-      /**
-       * \brief Type of constant container view used for storing the column indexes of the matrix elements.
-       */
-      using ConstDiagonalsOffsetsView = typename DiagonalsOffsetsView::ConstViewType;
-
-      /**
-       * \brief Type of constant indexer view.
-       */
-      using ConstIndexerViewType = typename IndexerType::ConstType;
-
-      /**
-       * \brief Type of constant sparse matrix row view.
-       */
-      using RowView = MultidiagonalMatrixRowView< ValuesViewType, IndexerType, DiagonalsOffsetsView >;
-
-      /**
-       * \brief Type of constant sparse matrix row view.
-       */
-      using ConstRowView = MultidiagonalMatrixRowView< ConstValuesViewType, ConstIndexerViewType, ConstDiagonalsOffsetsView >;
-
-      /**
-       * \brief The type of related matrix element.
-       */
-      using MatrixElementType = MultidiagonalMatrixElement< RealType, IndexType >;
-
-      /**
-       * \brief Type of iterator for the matrix row.
-       */
-      using IteratorType = MatrixRowViewIterator< RowView >;
-
-      /**
-       * \brief Constructor with all necessary data.
-       *
-       * \param rowIdx is index of the matrix row this RowView refer to.
-       * \param diagonalsOffsets is a vector view holding offsets of matrix diagonals,
-       * \param values is a vector view holding values of matrix elements.
-       * \param indexer is object responsible for indexing and organization of matrix elements
-       */
-      __cuda_callable__
-      MultidiagonalMatrixRowView( const IndexType rowIdx,
-                                  const DiagonalsOffsetsView& diagonalsOffsets,
-                                  const ValuesViewType& values,
-                                  const IndexerType& indexer );
-
-      /**
-       * \brief Returns number of diagonals of the multidiagonal matrix.
-       *
-       * \return number of diagonals of the multidiagonal matrix.
-       */
-      __cuda_callable__
-      IndexType getSize() const;
-
-      /**
-       * \brief Returns the matrix row index.
-       *
-       * \return matrix row index.
-       */
-      __cuda_callable__
-      const IndexType& getRowIndex() const;
-
-      /**
-       * \brief Computes column index of matrix element on given subdiagonal.
-       *
-       * \param localIdx is an index of the subdiagonal.
-       *
-       * \return column index of matrix element on given subdiagonal.
-       */
-      __cuda_callable__
-      const IndexType getColumnIndex( const IndexType localIdx ) const;
-
-      /**
-       * \brief Returns value of matrix element on given subdiagonal.
-       *
-       * \param localIdx is an index of the subdiagonal.
-       *
-       * \return constant reference to matrix element value.
-       */
-      __cuda_callable__
-      const RealType& getValue( const IndexType localIdx ) const;
-
-      /**
-       * \brief Returns value of matrix element on given subdiagonal.
-       *
-       * \param localIdx is an index of the subdiagonal.
-       *
-       * \return non-constant reference to matrix element value.
-       */
-      __cuda_callable__
-      RealType& getValue( const IndexType localIdx );
-
-      /**
-       * \brief Changes value of matrix element on given subdiagonal.
-       *
-       * \param localIdx is an index of the matrix subdiagonal.
-       * \param value is the new value of the matrix element.
-       */
-      __cuda_callable__
-      void setElement( const IndexType localIdx,
-                       const RealType& value );
-
-      /**
-       * \brief Returns iterator pointing at the beginning of the matrix row.
-       *
-       * \return iterator pointing at the beginning.
-       */
-      __cuda_callable__
-      IteratorType begin();
-
-      /**
-       * \brief Returns iterator pointing at the end of the matrix row.
-       *
-       * \return iterator pointing at the end.
-       */
-      __cuda_callable__
-      IteratorType end();
-
-      /**
-       * \brief Returns constant iterator pointing at the beginning of the matrix row.
-       *
-       * \return iterator pointing at the beginning.
-       */
-      __cuda_callable__
-      const IteratorType cbegin() const;
-
-      /**
-       * \brief Returns constant iterator pointing at the end of the matrix row.
-       *
-       * \return iterator pointing at the end.
-       */
-      __cuda_callable__
-      const IteratorType cend() const;
-
-   protected:
-
-      IndexType rowIdx;
-
-      DiagonalsOffsetsView diagonalsOffsets;
-
-      ValuesViewType values;
-
-      Indexer indexer;
+public:
+   /**
+    * \brief The type of matrix elements.
+    */
+   using RealType = typename ValuesView::RealType;
+
+   /**
+    * \brief The type used for matrix elements indexing.
+    */
+   using IndexType = typename ValuesView::IndexType;
+
+   /**
+    * \brief Type of container view used for storing the matrix elements values.
+    */
+   using ValuesViewType = ValuesView;
+
+   /**
+    * \brief Type of object responsible for indexing and organization of
+    * matrix elements.
+    */
+   using IndexerType = Indexer;
+
+   /**
+    * \brief Type of a container view holding offsets of
+    * diagonals of multidiagonal matrix.
+    */
+   using DiagonalsOffsetsView = DiagonalsOffsetsView_;
+
+   /**
+    * \brief Type of constant container view used for storing the matrix elements values.
+    */
+   using ConstValuesViewType = typename ValuesViewType::ConstViewType;
+
+   /**
+    * \brief Type of constant container view used for storing the column indexes of the matrix elements.
+    */
+   using ConstDiagonalsOffsetsView = typename DiagonalsOffsetsView::ConstViewType;
+
+   /**
+    * \brief Type of constant indexer view.
+    */
+   using ConstIndexerViewType = typename IndexerType::ConstType;
+
+   /**
+    * \brief Type of constant sparse matrix row view.
+    */
+   using RowView = MultidiagonalMatrixRowView< ValuesViewType, IndexerType, DiagonalsOffsetsView >;
+
+   /**
+    * \brief Type of constant sparse matrix row view.
+    */
+   using ConstRowView = MultidiagonalMatrixRowView< ConstValuesViewType, ConstIndexerViewType, ConstDiagonalsOffsetsView >;
+
+   /**
+    * \brief The type of related matrix element.
+    */
+   using MatrixElementType = MultidiagonalMatrixElement< RealType, IndexType >;
+
+   /**
+    * \brief Type of iterator for the matrix row.
+    */
+   using IteratorType = MatrixRowViewIterator< RowView >;
+
+   /**
+    * \brief Constructor with all necessary data.
+    *
+    * \param rowIdx is index of the matrix row this RowView refer to.
+    * \param diagonalsOffsets is a vector view holding offsets of matrix diagonals,
+    * \param values is a vector view holding values of matrix elements.
+    * \param indexer is object responsible for indexing and organization of matrix elements
+    */
+   __cuda_callable__
+   MultidiagonalMatrixRowView( IndexType rowIdx,
+                               const DiagonalsOffsetsView& diagonalsOffsets,
+                               const ValuesViewType& values,
+                               const IndexerType& indexer );
+
+   /**
+    * \brief Returns number of diagonals of the multidiagonal matrix.
+    *
+    * \return number of diagonals of the multidiagonal matrix.
+    */
+   __cuda_callable__
+   IndexType
+   getSize() const;
+
+   /**
+    * \brief Returns the matrix row index.
+    *
+    * \return matrix row index.
+    */
+   __cuda_callable__
+   const IndexType&
+   getRowIndex() const;
+
+   /**
+    * \brief Computes column index of matrix element on given subdiagonal.
+    *
+    * \param localIdx is an index of the subdiagonal.
+    *
+    * \return column index of matrix element on given subdiagonal.
+    */
+   __cuda_callable__
+   const IndexType
+   getColumnIndex( IndexType localIdx ) const;
+
+   /**
+    * \brief Returns value of matrix element on given subdiagonal.
+    *
+    * \param localIdx is an index of the subdiagonal.
+    *
+    * \return constant reference to matrix element value.
+    */
+   __cuda_callable__
+   const RealType&
+   getValue( IndexType localIdx ) const;
+
+   /**
+    * \brief Returns value of matrix element on given subdiagonal.
+    *
+    * \param localIdx is an index of the subdiagonal.
+    *
+    * \return non-constant reference to matrix element value.
+    */
+   __cuda_callable__
+   RealType&
+   getValue( IndexType localIdx );
+
+   /**
+    * \brief Changes value of matrix element on given subdiagonal.
+    *
+    * \param localIdx is an index of the matrix subdiagonal.
+    * \param value is the new value of the matrix element.
+    */
+   __cuda_callable__
+   void
+   setElement( IndexType localIdx, const RealType& value );
+
+   /**
+    * \brief Returns iterator pointing at the beginning of the matrix row.
+    *
+    * \return iterator pointing at the beginning.
+    */
+   __cuda_callable__
+   IteratorType
+   begin();
+
+   /**
+    * \brief Returns iterator pointing at the end of the matrix row.
+    *
+    * \return iterator pointing at the end.
+    */
+   __cuda_callable__
+   IteratorType
+   end();
+
+   /**
+    * \brief Returns constant iterator pointing at the beginning of the matrix row.
+    *
+    * \return iterator pointing at the beginning.
+    */
+   __cuda_callable__
+   const IteratorType
+   cbegin() const;
+
+   /**
+    * \brief Returns constant iterator pointing at the end of the matrix row.
+    *
+    * \return iterator pointing at the end.
+    */
+   __cuda_callable__
+   const IteratorType
+   cend() const;
+
+protected:
+   IndexType rowIdx;
+
+   DiagonalsOffsetsView diagonalsOffsets;
+
+   ValuesViewType values;
+
+   Indexer indexer;
 };
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/MultidiagonalMatrixRowView.hpp>
diff --git a/src/TNL/Matrices/MultidiagonalMatrixRowView.hpp b/src/TNL/Matrices/MultidiagonalMatrixRowView.hpp
index ceb01ea7bbfef79d81fb9580c073d242898c10f6..6167c2c850822835b4a7273401aa5c61810eac25 100644
--- a/src/TNL/Matrices/MultidiagonalMatrixRowView.hpp
+++ b/src/TNL/Matrices/MultidiagonalMatrixRowView.hpp
@@ -11,30 +11,26 @@ namespace Matrices {
 
 template< typename ValuesView, typename Indexer, typename DiagonalsOffsetsView >
 __cuda_callable__
-MultidiagonalMatrixRowView< ValuesView, Indexer, DiagonalsOffsetsView >::
-MultidiagonalMatrixRowView( const IndexType rowIdx,
-                            const DiagonalsOffsetsView& diagonalsOffsets,
-                            const ValuesViewType& values,
-                            const IndexerType& indexer )
+MultidiagonalMatrixRowView< ValuesView, Indexer, DiagonalsOffsetsView >::MultidiagonalMatrixRowView(
+   const IndexType rowIdx,
+   const DiagonalsOffsetsView& diagonalsOffsets,
+   const ValuesViewType& values,
+   const IndexerType& indexer )
 : rowIdx( rowIdx ), diagonalsOffsets( diagonalsOffsets ), values( values ), indexer( indexer )
-{
-}
+{}
 
 template< typename ValuesView, typename Indexer, typename DiagonalsOffsetsView >
 __cuda_callable__
 auto
-MultidiagonalMatrixRowView< ValuesView, Indexer, DiagonalsOffsetsView >::
-getSize() const -> IndexType
+MultidiagonalMatrixRowView< ValuesView, Indexer, DiagonalsOffsetsView >::getSize() const -> IndexType
 {
-   return diagonalsOffsets.getSize();//indexer.getRowSize( rowIdx );
+   return diagonalsOffsets.getSize();  // indexer.getRowSize( rowIdx );
 }
 
-
 template< typename ValuesView, typename Indexer, typename DiagonalsOffsetsView >
 __cuda_callable__
 auto
-MultidiagonalMatrixRowView< ValuesView, Indexer, DiagonalsOffsetsView >::
-getRowIndex() const -> const IndexType&
+MultidiagonalMatrixRowView< ValuesView, Indexer, DiagonalsOffsetsView >::getRowIndex() const -> const IndexType&
 {
    return this->rowIdx;
 }
@@ -42,8 +38,8 @@ getRowIndex() const -> const IndexType&
 template< typename ValuesView, typename Indexer, typename DiagonalsOffsetsView >
 __cuda_callable__
 auto
-MultidiagonalMatrixRowView< ValuesView, Indexer, DiagonalsOffsetsView >::
-getColumnIndex( const IndexType localIdx ) const -> const IndexType
+MultidiagonalMatrixRowView< ValuesView, Indexer, DiagonalsOffsetsView >::getColumnIndex( const IndexType localIdx ) const
+   -> const IndexType
 {
    TNL_ASSERT_GE( localIdx, 0, "" );
    TNL_ASSERT_LT( localIdx, indexer.getDiagonals(), "" );
@@ -53,8 +49,8 @@ getColumnIndex( const IndexType localIdx ) const -> const IndexType
 template< typename ValuesView, typename Indexer, typename DiagonalsOffsetsView >
 __cuda_callable__
 auto
-MultidiagonalMatrixRowView< ValuesView, Indexer, DiagonalsOffsetsView >::
-getValue( const IndexType localIdx ) const -> const RealType&
+MultidiagonalMatrixRowView< ValuesView, Indexer, DiagonalsOffsetsView >::getValue( const IndexType localIdx ) const
+   -> const RealType&
 {
    return this->values[ this->indexer.getGlobalIndex( rowIdx, localIdx ) ];
 }
@@ -62,8 +58,7 @@ getValue( const IndexType localIdx ) const -> const RealType&
 template< typename ValuesView, typename Indexer, typename DiagonalsOffsetsView >
 __cuda_callable__
 auto
-MultidiagonalMatrixRowView< ValuesView, Indexer, DiagonalsOffsetsView >::
-getValue( const IndexType localIdx ) -> RealType&
+MultidiagonalMatrixRowView< ValuesView, Indexer, DiagonalsOffsetsView >::getValue( const IndexType localIdx ) -> RealType&
 {
    return this->values[ this->indexer.getGlobalIndex( rowIdx, localIdx ) ];
 }
@@ -71,9 +66,8 @@ getValue( const IndexType localIdx ) -> RealType&
 template< typename ValuesView, typename Indexer, typename DiagonalsOffsetsView >
 __cuda_callable__
 void
-MultidiagonalMatrixRowView< ValuesView, Indexer, DiagonalsOffsetsView >::
-setElement( const IndexType localIdx,
-            const RealType& value )
+MultidiagonalMatrixRowView< ValuesView, Indexer, DiagonalsOffsetsView >::setElement( const IndexType localIdx,
+                                                                                     const RealType& value )
 {
    this->values[ indexer.getGlobalIndex( rowIdx, localIdx ) ] = value;
 }
@@ -81,8 +75,7 @@ setElement( const IndexType localIdx,
 template< typename ValuesView, typename Indexer, typename DiagonalsOffsetsView >
 __cuda_callable__
 auto
-MultidiagonalMatrixRowView< ValuesView, Indexer, DiagonalsOffsetsView >::
-begin() -> IteratorType
+MultidiagonalMatrixRowView< ValuesView, Indexer, DiagonalsOffsetsView >::begin() -> IteratorType
 {
    return IteratorType( *this, 0 );
 }
@@ -90,8 +83,7 @@ begin() -> IteratorType
 template< typename ValuesView, typename Indexer, typename DiagonalsOffsetsView >
 __cuda_callable__
 auto
-MultidiagonalMatrixRowView< ValuesView, Indexer, DiagonalsOffsetsView >::
-end() -> IteratorType
+MultidiagonalMatrixRowView< ValuesView, Indexer, DiagonalsOffsetsView >::end() -> IteratorType
 {
    return IteratorType( *this, this->getSize() );
 }
@@ -99,8 +91,7 @@ end() -> IteratorType
 template< typename ValuesView, typename Indexer, typename DiagonalsOffsetsView >
 __cuda_callable__
 auto
-MultidiagonalMatrixRowView< ValuesView, Indexer, DiagonalsOffsetsView >::
-cbegin() const -> const IteratorType
+MultidiagonalMatrixRowView< ValuesView, Indexer, DiagonalsOffsetsView >::cbegin() const -> const IteratorType
 {
    return IteratorType( *this, 0 );
 }
@@ -108,11 +99,10 @@ cbegin() const -> const IteratorType
 template< typename ValuesView, typename Indexer, typename DiagonalsOffsetsView >
 __cuda_callable__
 auto
-MultidiagonalMatrixRowView< ValuesView, Indexer, DiagonalsOffsetsView >::
-cend() const -> const IteratorType
+MultidiagonalMatrixRowView< ValuesView, Indexer, DiagonalsOffsetsView >::cend() const -> const IteratorType
 {
    return IteratorType( *this, this->getSize() );
 }
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/MultidiagonalMatrixView.h b/src/TNL/Matrices/MultidiagonalMatrixView.h
index 3ea429b99a8f57d82475f7e06377eea5f186cc19..c075211fe2f058ff7b5341d3d01d769b40a8eb98 100644
--- a/src/TNL/Matrices/MultidiagonalMatrixView.h
+++ b/src/TNL/Matrices/MultidiagonalMatrixView.h
@@ -35,843 +35,878 @@ template< typename Real = double,
           ElementsOrganization Organization = Algorithms::Segments::DefaultElementsOrganization< Device >::getOrganization() >
 class MultidiagonalMatrixView : public MatrixView< Real, Device, Index >
 {
-   public:
-
-      // Supporting types - they are not important for the user
-      using BaseType = MatrixView< Real, Device, Index >;
-      using ValuesViewType = typename BaseType::ValuesView;
-      using IndexerType = details::MultidiagonalMatrixIndexer< Index, Organization >;
-      using DiagonalsOffsetsView = Containers::VectorView< Index, Device, Index >;
-      using HostDiagonalsOffsetsView = Containers::VectorView< Index, Devices::Host, Index >;
-
-      /**
-       * \brief The type of matrix elements.
-       */
-      using RealType = Real;
-
-      /**
-       * \brief The device where the matrix is allocated.
-       */
-      using DeviceType = Device;
-
-      /**
-       * \brief The type used for matrix elements indexing.
-       */
-      using IndexType = Index;
-
-      /**
-       * \brief Type of related matrix view.
-       */
-      using ViewType = MultidiagonalMatrixView< Real, Device, Index, Organization >;
-
-      /**
-       * \brief Matrix view type for constant instances.
-       */
-      using ConstViewType = MultidiagonalMatrixView< typename std::add_const< Real >::type, Device, Index, Organization >;
-
-      /**
-       * \brief Type for accessing matrix rows.
-       */
-      using RowView = MultidiagonalMatrixRowView< ValuesViewType, IndexerType, DiagonalsOffsetsView >;
-
-      /**
-       * \brief Type for accessing constant matrix rows.
-       */
-      using ConstRowView = typename RowView::ConstRowView;
-
-      /**
-       * \brief Helper type for getting self type or its modifications.
-       */
-      template< typename _Real = Real,
-                typename _Device = Device,
-                typename _Index = Index,
-                ElementsOrganization Organization_ = Algorithms::Segments::DefaultElementsOrganization< Device >::getOrganization() >
-      using Self = MultidiagonalMatrixView< _Real, _Device, _Index, Organization_ >;
-
-      /**
-       * \brief Constructor with no parameters.
-       */
-      __cuda_callable__
-      MultidiagonalMatrixView();
-
-      /**
-       * \brief Constructor with all necessary data and views.
-       *
-       * \param values is a vector view with matrix elements values
-       * \param diagonalsOffsets is a vector view with diagonals offsets
-       * \param hostDiagonalsOffsets is a vector view with a copy of diagonals offsets on the host
-       * \param indexer is an indexer of matrix elements
-       */
-      __cuda_callable__
-      MultidiagonalMatrixView( const ValuesViewType& values,
-                               const DiagonalsOffsetsView& diagonalsOffsets,
-                               const HostDiagonalsOffsetsView& hostDiagonalsOffsets,
-                               const IndexerType& indexer );
-
-      /**
-       * \brief Copy constructor.
-       *
-       * \param matrix is an input multidiagonal matrix view.
-       */
-      __cuda_callable__
-      MultidiagonalMatrixView( const MultidiagonalMatrixView& view ) = default;
-
-      /**
-       * \brief Move constructor.
-       *
-       * \param matrix is an input multidiagonal matrix view.
-       */
-      __cuda_callable__
-      MultidiagonalMatrixView( MultidiagonalMatrixView&& view ) = default;
-
-      /**
-       * \brief Returns a modifiable view of the multidiagonal matrix.
-       *
-       * \return multidiagonal matrix view.
-       */
-      ViewType getView();
-
-      /**
-       * \brief Returns a non-modifiable view of the multidiagonal matrix.
-       *
-       * \return multidiagonal matrix view.
-       */
-      ConstViewType getConstView() const;
-
-      /**
-       * \brief Returns string with serialization type.
-       *
-       * The string has a form `Matrices::MultidiagonalMatrix< RealType,  [any_device], IndexType, Organization, [any_allocator], [any_allocator] >`.
-       *
-       * See \ref MultidiagonalMatrix::getSerializationType.
-       *
-       * \return \ref String with the serialization type.
-       */
-      static String getSerializationType();
-
-      /**
-       * \brief Returns string with serialization type.
-       *
-       * See \ref MultidiagonalMatrix::getSerializationType.
-       *
-       * \return \ref String with the serialization type.
-       */
-      virtual String getSerializationTypeVirtual() const;
-
-      /**
-       * \brief Returns number of diagonals.
-       *
-       * \return Number of diagonals.
-       */
-      __cuda_callable__
-      const IndexType getDiagonalsCount() const;
-
-      /**
-       * \brief Compute capacities of all rows.
-       *
-       * The row capacities are not stored explicitly and must be computed.
-       *
-       * \param rowCapacities is a vector where the row capacities will be stored.
-       */
-      template< typename Vector >
-      void getRowCapacities( Vector& rowCapacities ) const;
-
-      /**
-       * \brief Computes number of non-zeros in each row.
-       *
-       * \param rowLengths is a vector into which the number of non-zeros in each row
-       * will be stored.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_getCompressedRowLengths.cpp
-       * \par Output
-       * \include MultidiagonalMatrixViewExample_getCompressedRowLengths.out
-       */
-      template< typename Vector >
-      void getCompressedRowLengths( Vector& rowLengths ) const;
-
-      [[deprecated]]
-      IndexType getRowLength( const IndexType row ) const;
-
-      /**
-       * \brief Returns number of non-zero matrix elements.
-       *
-       * This method really counts the non-zero matrix elements and so
-       * it returns zero for matrix having all allocated elements set to zero.
-       *
-       * \return number of non-zero matrix elements.
-       */
-      IndexType getNonzeroElementsCount() const;
-
-      /**
-       * \brief Comparison operator with another multidiagonal matrix.
-       *
-       * \tparam Real_ is \e Real type of the source matrix.
-       * \tparam Device_ is \e Device type of the source matrix.
-       * \tparam Index_ is \e Index type of the source matrix.
-       * \tparam Organization_ is \e Organization of the source matrix.
-       *
-       * \return \e true if both matrices are identical and \e false otherwise.
-       */
-      template< typename Real_,
-                typename Device_,
-                typename Index_,
-                ElementsOrganization Organization_ >
-      bool operator == ( const MultidiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix ) const;
-
-      /**
-       * \brief Comparison operator with another multidiagonal matrix.
-       *
-       * \tparam Real_ is \e Real type of the source matrix.
-       * \tparam Device_ is \e Device type of the source matrix.
-       * \tparam Index_ is \e Index type of the source matrix.
-       * \tparam Organization_ is \e Organization of the source matrix.
-       *
-       * \param matrix is the source matrix.
-       *
-       * \return \e true if both matrices are NOT identical and \e false otherwise.
-       */
-      template< typename Real_,
-                typename Device_,
-                typename Index_,
-                ElementsOrganization Organization_ >
-      bool operator != ( const MultidiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix ) const;
-
-      /**
-       * \brief Non-constant getter of simple structure for accessing given matrix row.
-       *
-       * \param rowIdx is matrix row index.
-       *
-       * \return RowView for accessing given matrix row.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_getRow.cpp
-       * \par Output
-       * \include MultidiagonalMatrixViewExample_getRow.out
-       *
-       * See \ref MultidiagonalMatrixRowView.
-       */
-      __cuda_callable__
-      RowView getRow( const IndexType& rowIdx );
-
-      /**
-       * \brief Constant getter of simple structure for accessing given matrix row.
-       *
-       * \param rowIdx is matrix row index.
-       *
-       * \return RowView for accessing given matrix row.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_getConstRow.cpp
-       * \par Output
-       * \include MultidiagonalMatrixViewExample_getConstRow.out
-       *
-       * See \ref MultidiagonalMatrixRowView.
-       */
-      __cuda_callable__
-      const ConstRowView getRow( const IndexType& rowIdx ) const;
-
-      /**
-       * \brief Set all matrix elements to given value.
-       *
-       * \param value is the new value of all matrix elements.
-       */
-      void setValue( const RealType& v );
-
-      /**
-       * \brief Sets element at given \e row and \e column to given \e value.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref MultidiagonalMatrix::getRow
-       * or \ref MultidiagonalMatrix::forElements and \ref MultidiagonalMatrix::forAllElements.
-       * The call may fail if the matrix row capacity is exhausted.
-       *
-       * \param row is row index of the element.
-       * \param column is columns index of the element.
-       * \param value is the value the element will be set to.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_setElement.cpp
-       * \par Output
-       * \include MultidiagonalMatrixViewExample_setElement.out
-       */
-      __cuda_callable__
-      void setElement( const IndexType row,
-                       const IndexType column,
-                       const RealType& value );
-
-      /**
-       * \brief Add element at given \e row and \e column to given \e value.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref MultidiagonalMatrix::getRow
-       * or \ref MultidiagonalMatrix::forElements and \ref MultidiagonalMatrix::forAllElements.
-       * The call may fail if the matrix row capacity is exhausted.
-       *
-       * \param row is row index of the element.
-       * \param column is columns index of the element.
-       * \param value is the value the element will be set to.
-       * \param thisElementMultiplicator is multiplicator the original matrix element
-       *   value is multiplied by before addition of given \e value.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_addElement.cpp
-       * \par Output
-       * \include MultidiagonalMatrixViewExample_addElement.out
-       */
-      __cuda_callable__
-      void addElement( const IndexType row,
-                       const IndexType column,
-                       const RealType& value,
-                       const RealType& thisElementMultiplicator = 1.0 );
-
-      /**
-       * \brief Returns value of matrix element at position given by its row and column index.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref MultidiagonalMatrix::getRow
-       * or \ref MultidiagonalMatrix::forElements and \ref MultidiagonalMatrix::forAllElements.
-       *
-       * \param row is a row index of the matrix element.
-       * \param column i a column index of the matrix element.
-       *
-       * \return value of given matrix element.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_getElement.cpp
-       * \par Output
-       * \include MultidiagonalMatrixViewExample_getElement.out
-       */
-      __cuda_callable__
-      RealType getElement( const IndexType row,
-                           const IndexType column ) const;
-
-      /**
-       * \brief Method for performing general reduction on matrix rows for constant instances.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       *  The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_reduceRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixViewExample_reduceRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceRows( IndexType begin, IndexType end, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& zero ) const;
-
-      /**
-       * \brief Method for performing general reduction on matrix rows.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       * The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_reduceRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixViewExample_reduceRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceRows( IndexType begin, IndexType end, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& zero );
-
-      /**
-       * \brief Method for performing general reduction on all matrix rows for constant instances.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       * The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_reduceAllRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixViewExample_reduceAllRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity ) const;
-
-      /**
-       * \brief Method for performing general reduction on all matrix rows.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       * The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row.
-       *          It is declared as `keep( const IndexType rowIdx, const double& value )`.
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_reduceAllRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixViewExample_reduceAllRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity );
-
-      /**
-       * \brief Method for iteration over all matrix rows for constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value ) { ... };
-       * ```
-       *
-       * where
-       *
-       * \e rowIdx is an index of the matrix row.
-       *
-       * \e localIdx parameter is a rank of the non-zero element in given row. It is also, in fact,
-       *  index of the matrix subdiagonal.
-       *
-       * \e columnIdx is a column index of the matrix element.
-       *
-       * \e value is the matrix element value.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function& function ) const;
-
-      /**
-       * \brief Method for iteration over all matrix rows for non-constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value ) { ... };
-       * ```
-       *
-       * where
-       *
-       * \e rowIdx is an index of the matrix row.
-       *
-       * \e localIdx parameter is a rank of the non-zero element in given row. It is also, in fact,
-       *  index of the matrix subdiagonal.
-       *
-       * \e columnIdx is a column index of the matrix element.
-       *
-       * \e value is a reference to the matrix element value. It can be used even for changing the matrix element value.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function& function );
-
-      /**
-       * \brief This method calls \e forElements for all matrix rows (for constant instances).
-       *
-       * See \ref MultidiagonalMatrix::forElements.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forAllRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixViewExample_forAllRows.out
-       */
-      template< typename Function >
-      void forAllElements( Function& function ) const;
-
-      /**
-       * \brief This method calls \e forElements for all matrix rows.
-       *
-       * See \ref MultidiagonalMatrix::forElements.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forAllRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixViewExample_forAllRows.out
-       */
-      template< typename Function >
-      void forAllElements( Function& function );
-
-      /**
-       * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end).
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref MultidiagonalMatrixView::forElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::MultidiagonalMatrixView::RowView.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forRows( IndexType begin, IndexType end, Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end) for constant instances.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref MultidiagonalMatrixView::forElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::MultidiagonalMatrixView::RowView.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forRows( IndexType begin, IndexType end, Function&& function ) const;
-
-      /**
-       * \brief Method for parallel iteration over all matrix rows.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref MultidiagonalMatrixView::forAllElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::MultidiagonalMatrixView::RowView.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forAllRows( Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over all matrix rows for constant instances.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref MultidiagonalMatrixView::forAllElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::MultidiagonalMatrixView::RowView.
-       *
-       * \par Example
-       * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include MultidiagonalMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forAllRows( Function&& function ) const;
-
-      /**
-       * \brief Method for sequential iteration over all matrix rows for constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( const RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::MultidiagonalMatrixView::RowView.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForRows( IndexType begin, IndexType end, Function& function ) const;
-
-      /**
-       * \brief Method for sequential iteration over all matrix rows for non-constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::MultidiagonalMatrixView::RowView.
-       *
-       * \param begin defines beginning of the range [ \e  begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForRows( IndexType begin, IndexType end, Function& function );
-
-      /**
-       * \brief This method calls \e sequentialForRows for all matrix rows (for constant instances).
-       *
-       * See \ref MultidiagonalMatrixView::sequentialForRows.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForAllRows( Function& function ) const;
-
-      /**
-       * \brief This method calls \e sequentialForRows for all matrix rows.
-       *
-       * See \ref MultidiagonalMatrixView::sequentialForAllRows.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForAllRows( Function& function );
-
-      /**
-       * \brief Computes product of matrix and vector.
-       *
-       * More precisely, it computes:
-       *
-       * ```
-       * outVector = matrixMultiplicator * ( * this ) * inVector + outVectorMultiplicator * outVector
-       * ```
-       *
-       * \tparam InVector is type of input vector.  It can be \ref Vector,
-       *     \ref VectorView, \ref Array, \ref ArraView or similar container.
-       * \tparam OutVector is type of output vector. It can be \ref Vector,
-       *     \ref VectorView, \ref Array, \ref ArraView or similar container.
-       *
-       * \param inVector is input vector.
-       * \param outVector is output vector.
-       * \param matrixMultiplicator is a factor by which the matrix is multiplied. It is one by default.
-       * \param outVectorMultiplicator is a factor by which the outVector is multiplied before added
-       *    to the result of matrix-vector product. It is zero by default.
-       * \param begin is the beginning of the rows range for which the vector product
-       *    is computed. It is zero by default.
-       * \param end is the end of the rows range for which the vector product
-       *    is computed. It is number if the matrix rows by default.
-       */
-      template< typename InVector,
-                typename OutVector >
-      void vectorProduct( const InVector& inVector,
-                          OutVector& outVector,
-                          const RealType matrixMultiplicator = 1.0,
-                          const RealType outVectorMultiplicator = 0.0,
-                          const IndexType begin = 0,
-                          IndexType end = 0 ) const;
-
-      template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_ >
-      void addMatrix( const MultidiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix,
-                      const RealType& matrixMultiplicator = 1.0,
-                      const RealType& thisMatrixMultiplicator = 1.0 );
-
-      template< typename Real2, typename Index2 >
-      void getTransposition( const MultidiagonalMatrixView< Real2, Device, Index2 >& matrix,
-                             const RealType& matrixMultiplicator = 1.0 );
-
-      /**
-       * \brief Assignment of exactly the same matrix type.
-       *
-       * \param matrix is input matrix for the assignment.
-       * \return reference to this matrix.
-       */
-      MultidiagonalMatrixView& operator=( const MultidiagonalMatrixView& view );
-
-      /**
-       * \brief Method for saving the matrix to a file.
-       *
-       * \param file is the output file.
-       */
-      void save( File& file ) const;
-
-      /**
-       * \brief Method for saving the matrix to the file with given filename.
-       *
-       * \param fileName is name of the file.
-       */
-      void save( const String& fileName ) const;
-
-      /**
-       * \brief Method for printing the matrix to output stream.
-       *
-       * \param str is the output stream.
-       */
-      void print( std::ostream& str ) const;
-
-      /**
-       * \brief This method returns matrix elements indexer used by this matrix.
-       *
-       * \return constant reference to the indexer.
-       */
-      __cuda_callable__
-      const IndexerType& getIndexer() const;
-
-      /**
-       * \brief This method returns matrix elements indexer used by this matrix.
-       *
-       * \return non-constant reference to the indexer.
-       */
-      __cuda_callable__
-      IndexerType& getIndexer();
-
-      /**
-       * \brief Returns padding index denoting padding zero elements.
-       *
-       * These elements are used for efficient data alignment in memory.
-       *
-       * \return value of the padding index.
-       */
-      __cuda_callable__
-      IndexType getPaddingIndex() const;
-
-   protected:
-
-      DiagonalsOffsetsView diagonalsOffsets;
-
-      HostDiagonalsOffsetsView hostDiagonalsOffsets;
-
-      IndexerType indexer;
+public:
+   // Supporting types - they are not important for the user
+   using BaseType = MatrixView< Real, Device, Index >;
+   using ValuesViewType = typename BaseType::ValuesView;
+   using IndexerType = details::MultidiagonalMatrixIndexer< Index, Organization >;
+   using DiagonalsOffsetsView = Containers::VectorView< Index, Device, Index >;
+   using HostDiagonalsOffsetsView = Containers::VectorView< Index, Devices::Host, Index >;
+
+   /**
+    * \brief The type of matrix elements.
+    */
+   using RealType = Real;
+
+   /**
+    * \brief The device where the matrix is allocated.
+    */
+   using DeviceType = Device;
+
+   /**
+    * \brief The type used for matrix elements indexing.
+    */
+   using IndexType = Index;
+
+   /**
+    * \brief Type of related matrix view.
+    */
+   using ViewType = MultidiagonalMatrixView< Real, Device, Index, Organization >;
+
+   /**
+    * \brief Matrix view type for constant instances.
+    */
+   using ConstViewType = MultidiagonalMatrixView< typename std::add_const< Real >::type, Device, Index, Organization >;
+
+   /**
+    * \brief Type for accessing matrix rows.
+    */
+   using RowView = MultidiagonalMatrixRowView< ValuesViewType, IndexerType, DiagonalsOffsetsView >;
+
+   /**
+    * \brief Type for accessing constant matrix rows.
+    */
+   using ConstRowView = typename RowView::ConstRowView;
+
+   /**
+    * \brief Helper type for getting self type or its modifications.
+    */
+   template< typename _Real = Real,
+             typename _Device = Device,
+             typename _Index = Index,
+             ElementsOrganization Organization_ =
+                Algorithms::Segments::DefaultElementsOrganization< Device >::getOrganization() >
+   using Self = MultidiagonalMatrixView< _Real, _Device, _Index, Organization_ >;
+
+   /**
+    * \brief Constructor with no parameters.
+    */
+   __cuda_callable__
+   MultidiagonalMatrixView();
+
+   /**
+    * \brief Constructor with all necessary data and views.
+    *
+    * \param values is a vector view with matrix elements values
+    * \param diagonalsOffsets is a vector view with diagonals offsets
+    * \param hostDiagonalsOffsets is a vector view with a copy of diagonals offsets on the host
+    * \param indexer is an indexer of matrix elements
+    */
+   __cuda_callable__
+   MultidiagonalMatrixView( const ValuesViewType& values,
+                            const DiagonalsOffsetsView& diagonalsOffsets,
+                            const HostDiagonalsOffsetsView& hostDiagonalsOffsets,
+                            const IndexerType& indexer );
+
+   /**
+    * \brief Copy constructor.
+    *
+    * \param matrix is an input multidiagonal matrix view.
+    */
+   __cuda_callable__
+   MultidiagonalMatrixView( const MultidiagonalMatrixView& view ) = default;
+
+   /**
+    * \brief Move constructor.
+    *
+    * \param matrix is an input multidiagonal matrix view.
+    */
+   __cuda_callable__
+   MultidiagonalMatrixView( MultidiagonalMatrixView&& view ) noexcept = default;
+
+   /**
+    * \brief Returns a modifiable view of the multidiagonal matrix.
+    *
+    * \return multidiagonal matrix view.
+    */
+   ViewType
+   getView();
+
+   /**
+    * \brief Returns a non-modifiable view of the multidiagonal matrix.
+    *
+    * \return multidiagonal matrix view.
+    */
+   ConstViewType
+   getConstView() const;
+
+   /**
+    * \brief Returns string with serialization type.
+    *
+    * The string has a form `Matrices::MultidiagonalMatrix< RealType,  [any_device], IndexType, Organization, [any_allocator],
+    * [any_allocator] >`.
+    *
+    * See \ref MultidiagonalMatrix::getSerializationType.
+    *
+    * \return \ref String with the serialization type.
+    */
+   static std::string
+   getSerializationType();
+
+   /**
+    * \brief Returns string with serialization type.
+    *
+    * See \ref MultidiagonalMatrix::getSerializationType.
+    *
+    * \return \ref String with the serialization type.
+    */
+   std::string
+   getSerializationTypeVirtual() const override;
+
+   /**
+    * \brief Returns number of diagonals.
+    *
+    * \return Number of diagonals.
+    */
+   __cuda_callable__
+   const IndexType
+   getDiagonalsCount() const;
+
+   /**
+    * \brief Compute capacities of all rows.
+    *
+    * The row capacities are not stored explicitly and must be computed.
+    *
+    * \param rowCapacities is a vector where the row capacities will be stored.
+    */
+   template< typename Vector >
+   void
+   getRowCapacities( Vector& rowCapacities ) const;
+
+   /**
+    * \brief Computes number of non-zeros in each row.
+    *
+    * \param rowLengths is a vector into which the number of non-zeros in each row
+    * will be stored.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_getCompressedRowLengths.cpp
+    * \par Output
+    * \include MultidiagonalMatrixViewExample_getCompressedRowLengths.out
+    */
+   template< typename Vector >
+   void
+   getCompressedRowLengths( Vector& rowLengths ) const;
+
+   [[deprecated]] IndexType
+   getRowLength( IndexType row ) const;
+
+   /**
+    * \brief Returns number of non-zero matrix elements.
+    *
+    * This method really counts the non-zero matrix elements and so
+    * it returns zero for matrix having all allocated elements set to zero.
+    *
+    * \return number of non-zero matrix elements.
+    */
+   IndexType
+   getNonzeroElementsCount() const override;
+
+   /**
+    * \brief Comparison operator with another multidiagonal matrix.
+    *
+    * \tparam Real_ is \e Real type of the source matrix.
+    * \tparam Device_ is \e Device type of the source matrix.
+    * \tparam Index_ is \e Index type of the source matrix.
+    * \tparam Organization_ is \e Organization of the source matrix.
+    *
+    * \return \e true if both matrices are identical and \e false otherwise.
+    */
+   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_ >
+   bool
+   operator==( const MultidiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix ) const;
+
+   /**
+    * \brief Comparison operator with another multidiagonal matrix.
+    *
+    * \tparam Real_ is \e Real type of the source matrix.
+    * \tparam Device_ is \e Device type of the source matrix.
+    * \tparam Index_ is \e Index type of the source matrix.
+    * \tparam Organization_ is \e Organization of the source matrix.
+    *
+    * \param matrix is the source matrix.
+    *
+    * \return \e true if both matrices are NOT identical and \e false otherwise.
+    */
+   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_ >
+   bool
+   operator!=( const MultidiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix ) const;
+
+   /**
+    * \brief Non-constant getter of simple structure for accessing given matrix row.
+    *
+    * \param rowIdx is matrix row index.
+    *
+    * \return RowView for accessing given matrix row.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_getRow.cpp
+    * \par Output
+    * \include MultidiagonalMatrixViewExample_getRow.out
+    *
+    * See \ref MultidiagonalMatrixRowView.
+    */
+   __cuda_callable__
+   RowView
+   getRow( const IndexType& rowIdx );
+
+   /**
+    * \brief Constant getter of simple structure for accessing given matrix row.
+    *
+    * \param rowIdx is matrix row index.
+    *
+    * \return RowView for accessing given matrix row.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_getConstRow.cpp
+    * \par Output
+    * \include MultidiagonalMatrixViewExample_getConstRow.out
+    *
+    * See \ref MultidiagonalMatrixRowView.
+    */
+   __cuda_callable__
+   const ConstRowView
+   getRow( const IndexType& rowIdx ) const;
+
+   /**
+    * \brief Set all matrix elements to given value.
+    *
+    * \param value is the new value of all matrix elements.
+    */
+   void
+   setValue( const RealType& v );
+
+   /**
+    * \brief Sets element at given \e row and \e column to given \e value.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref MultidiagonalMatrix::getRow
+    * or \ref MultidiagonalMatrix::forElements and \ref MultidiagonalMatrix::forAllElements.
+    * The call may fail if the matrix row capacity is exhausted.
+    *
+    * \param row is row index of the element.
+    * \param column is columns index of the element.
+    * \param value is the value the element will be set to.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_setElement.cpp
+    * \par Output
+    * \include MultidiagonalMatrixViewExample_setElement.out
+    */
+   __cuda_callable__
+   void
+   setElement( IndexType row, IndexType column, const RealType& value );
+
+   /**
+    * \brief Add element at given \e row and \e column to given \e value.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref MultidiagonalMatrix::getRow
+    * or \ref MultidiagonalMatrix::forElements and \ref MultidiagonalMatrix::forAllElements.
+    * The call may fail if the matrix row capacity is exhausted.
+    *
+    * \param row is row index of the element.
+    * \param column is columns index of the element.
+    * \param value is the value the element will be set to.
+    * \param thisElementMultiplicator is multiplicator the original matrix element
+    *   value is multiplied by before addition of given \e value.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_addElement.cpp
+    * \par Output
+    * \include MultidiagonalMatrixViewExample_addElement.out
+    */
+   __cuda_callable__
+   void
+   addElement( IndexType row, IndexType column, const RealType& value, const RealType& thisElementMultiplicator = 1.0 );
+
+   /**
+    * \brief Returns value of matrix element at position given by its row and column index.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref MultidiagonalMatrix::getRow
+    * or \ref MultidiagonalMatrix::forElements and \ref MultidiagonalMatrix::forAllElements.
+    *
+    * \param row is a row index of the matrix element.
+    * \param column i a column index of the matrix element.
+    *
+    * \return value of given matrix element.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_getElement.cpp
+    * \par Output
+    * \include MultidiagonalMatrixViewExample_getElement.out
+    */
+   __cuda_callable__
+   RealType
+   getElement( IndexType row, IndexType column ) const;
+
+   /**
+    * \brief Method for performing general reduction on matrix rows for constant instances.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ...
+    * };
+    * ```
+    *
+    *  The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_reduceRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixViewExample_reduceRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceRows( IndexType begin, IndexType end, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& zero ) const;
+
+   /**
+    * \brief Method for performing general reduction on matrix rows.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ...
+    * };
+    * ```
+    *
+    * The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_reduceRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixViewExample_reduceRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceRows( IndexType begin, IndexType end, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& zero );
+
+   /**
+    * \brief Method for performing general reduction on all matrix rows for constant instances.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ...
+    * };
+    * ```
+    *
+    * The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_reduceAllRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixViewExample_reduceAllRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity ) const;
+
+   /**
+    * \brief Method for performing general reduction on all matrix rows.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ...
+    * };
+    * ```
+    *
+    * The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row.
+    *          It is declared as `keep( const IndexType rowIdx, const double& value )`.
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_reduceAllRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixViewExample_reduceAllRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity );
+
+   /**
+    * \brief Method for iteration over all matrix rows for constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )
+    * { ... };
+    * ```
+    *
+    * where
+    *
+    * \e rowIdx is an index of the matrix row.
+    *
+    * \e localIdx parameter is a rank of the non-zero element in given row. It is also, in fact,
+    *  index of the matrix subdiagonal.
+    *
+    * \e columnIdx is a column index of the matrix element.
+    *
+    * \e value is the matrix element value.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function& function ) const;
+
+   /**
+    * \brief Method for iteration over all matrix rows for non-constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )
+    * { ... };
+    * ```
+    *
+    * where
+    *
+    * \e rowIdx is an index of the matrix row.
+    *
+    * \e localIdx parameter is a rank of the non-zero element in given row. It is also, in fact,
+    *  index of the matrix subdiagonal.
+    *
+    * \e columnIdx is a column index of the matrix element.
+    *
+    * \e value is a reference to the matrix element value. It can be used even for changing the matrix element value.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function& function );
+
+   /**
+    * \brief This method calls \e forElements for all matrix rows (for constant instances).
+    *
+    * See \ref MultidiagonalMatrix::forElements.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forAllRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixViewExample_forAllRows.out
+    */
+   template< typename Function >
+   void
+   forAllElements( Function& function ) const;
+
+   /**
+    * \brief This method calls \e forElements for all matrix rows.
+    *
+    * See \ref MultidiagonalMatrix::forElements.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forAllRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixViewExample_forAllRows.out
+    */
+   template< typename Function >
+   void
+   forAllElements( Function& function );
+
+   /**
+    * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end).
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref MultidiagonalMatrixView::forElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::MultidiagonalMatrixView::RowView.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forRows( IndexType begin, IndexType end, Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end) for constant instances.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref MultidiagonalMatrixView::forElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::MultidiagonalMatrixView::RowView.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forRows( IndexType begin, IndexType end, Function&& function ) const;
+
+   /**
+    * \brief Method for parallel iteration over all matrix rows.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref MultidiagonalMatrixView::forAllElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::MultidiagonalMatrixView::RowView.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forAllRows( Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over all matrix rows for constant instances.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref MultidiagonalMatrixView::forAllElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::MultidiagonalMatrixView::RowView.
+    *
+    * \par Example
+    * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include MultidiagonalMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forAllRows( Function&& function ) const;
+
+   /**
+    * \brief Method for sequential iteration over all matrix rows for constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( const RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::MultidiagonalMatrixView::RowView.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForRows( IndexType begin, IndexType end, Function& function ) const;
+
+   /**
+    * \brief Method for sequential iteration over all matrix rows for non-constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::MultidiagonalMatrixView::RowView.
+    *
+    * \param begin defines beginning of the range [ \e  begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForRows( IndexType begin, IndexType end, Function& function );
+
+   /**
+    * \brief This method calls \e sequentialForRows for all matrix rows (for constant instances).
+    *
+    * See \ref MultidiagonalMatrixView::sequentialForRows.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForAllRows( Function& function ) const;
+
+   /**
+    * \brief This method calls \e sequentialForRows for all matrix rows.
+    *
+    * See \ref MultidiagonalMatrixView::sequentialForAllRows.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForAllRows( Function& function );
+
+   /**
+    * \brief Computes product of matrix and vector.
+    *
+    * More precisely, it computes:
+    *
+    * ```
+    * outVector = matrixMultiplicator * ( * this ) * inVector + outVectorMultiplicator * outVector
+    * ```
+    *
+    * \tparam InVector is type of input vector.  It can be \ref Vector,
+    *     \ref VectorView, \ref Array, \ref ArraView or similar container.
+    * \tparam OutVector is type of output vector. It can be \ref Vector,
+    *     \ref VectorView, \ref Array, \ref ArraView or similar container.
+    *
+    * \param inVector is input vector.
+    * \param outVector is output vector.
+    * \param matrixMultiplicator is a factor by which the matrix is multiplied. It is one by default.
+    * \param outVectorMultiplicator is a factor by which the outVector is multiplied before added
+    *    to the result of matrix-vector product. It is zero by default.
+    * \param begin is the beginning of the rows range for which the vector product
+    *    is computed. It is zero by default.
+    * \param end is the end of the rows range for which the vector product
+    *    is computed. It is number if the matrix rows by default.
+    */
+   template< typename InVector, typename OutVector >
+   void
+   vectorProduct( const InVector& inVector,
+                  OutVector& outVector,
+                  RealType matrixMultiplicator = 1.0,
+                  RealType outVectorMultiplicator = 0.0,
+                  IndexType begin = 0,
+                  IndexType end = 0 ) const;
+
+   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_ >
+   void
+   addMatrix( const MultidiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix,
+              const RealType& matrixMultiplicator = 1.0,
+              const RealType& thisMatrixMultiplicator = 1.0 );
+
+   template< typename Real2, typename Index2 >
+   void
+   getTransposition( const MultidiagonalMatrixView< Real2, Device, Index2 >& matrix,
+                     const RealType& matrixMultiplicator = 1.0 );
+
+   /**
+    * \brief Assignment of exactly the same matrix type.
+    *
+    * \param matrix is input matrix for the assignment.
+    * \return reference to this matrix.
+    */
+   MultidiagonalMatrixView&
+   operator=( const MultidiagonalMatrixView& view );
+
+   /**
+    * \brief Method for saving the matrix to a file.
+    *
+    * \param file is the output file.
+    */
+   void
+   save( File& file ) const override;
+
+   /**
+    * \brief Method for saving the matrix to the file with given filename.
+    *
+    * \param fileName is name of the file.
+    */
+   void
+   save( const String& fileName ) const;
+
+   /**
+    * \brief Method for printing the matrix to output stream.
+    *
+    * \param str is the output stream.
+    */
+   void
+   print( std::ostream& str ) const override;
+
+   /**
+    * \brief This method returns matrix elements indexer used by this matrix.
+    *
+    * \return constant reference to the indexer.
+    */
+   __cuda_callable__
+   const IndexerType&
+   getIndexer() const;
+
+   /**
+    * \brief This method returns matrix elements indexer used by this matrix.
+    *
+    * \return non-constant reference to the indexer.
+    */
+   __cuda_callable__
+   IndexerType&
+   getIndexer();
+
+   /**
+    * \brief Returns padding index denoting padding zero elements.
+    *
+    * These elements are used for efficient data alignment in memory.
+    *
+    * \return value of the padding index.
+    */
+   __cuda_callable__
+   IndexType
+   getPaddingIndex() const;
+
+protected:
+   DiagonalsOffsetsView diagonalsOffsets;
+
+   HostDiagonalsOffsetsView hostDiagonalsOffsets;
+
+   IndexerType indexer;
 };
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/MultidiagonalMatrixView.hpp>
diff --git a/src/TNL/Matrices/MultidiagonalMatrixView.hpp b/src/TNL/Matrices/MultidiagonalMatrixView.hpp
index 8cee12b6f2ba57d98075d16cd583ab8309e1c77c..3e3c59f2da7197a43d9f948ef029e2bfcf0d7696 100644
--- a/src/TNL/Matrices/MultidiagonalMatrixView.hpp
+++ b/src/TNL/Matrices/MultidiagonalMatrixView.hpp
@@ -14,38 +14,22 @@
 namespace TNL {
 namespace Matrices {
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-MultidiagonalMatrixView()
-{
-}
-
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-MultidiagonalMatrixView( const ValuesViewType& values,
-                         const DiagonalsOffsetsView& diagonalsOffsets,
-                         const HostDiagonalsOffsetsView& hostDiagonalsOffsets,
-                         const IndexerType& indexer )
-: MatrixView< Real, Device, Index >( indexer.getRows(), indexer.getColumns(), values ),
-  diagonalsOffsets( diagonalsOffsets ),
-  hostDiagonalsOffsets( hostDiagonalsOffsets ),
-  indexer( indexer )
-{
-}
-
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+MultidiagonalMatrixView< Real, Device, Index, Organization >::MultidiagonalMatrixView() = default;
+
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+MultidiagonalMatrixView< Real, Device, Index, Organization >::MultidiagonalMatrixView(
+   const ValuesViewType& values,
+   const DiagonalsOffsetsView& diagonalsOffsets,
+   const HostDiagonalsOffsetsView& hostDiagonalsOffsets,
+   const IndexerType& indexer )
+: MatrixView< Real, Device, Index >( indexer.getRows(), indexer.getColumns(), values ), diagonalsOffsets( diagonalsOffsets ),
+  hostDiagonalsOffsets( hostDiagonalsOffsets ), indexer( indexer )
+{}
+
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 auto
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-getView() -> ViewType
+MultidiagonalMatrixView< Real, Device, Index, Organization >::getView() -> ViewType
 {
    return ViewType( const_cast< MultidiagonalMatrixView* >( this )->values.getView(),
                     const_cast< MultidiagonalMatrixView* >( this )->diagonalsOffsets.getView(),
@@ -53,53 +37,34 @@ getView() -> ViewType
                     indexer );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 auto
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-getConstView() const -> ConstViewType
+MultidiagonalMatrixView< Real, Device, Index, Organization >::getConstView() const -> ConstViewType
 {
-   return ConstViewType( this->values.getConstView(),
-                         this->diagonalsOffsets.getConstView(),
-                         this->hostDiagonalsOffsets.getConstView(),
-                         indexer );
+   return ConstViewType(
+      this->values.getConstView(), this->diagonalsOffsets.getConstView(), this->hostDiagonalsOffsets.getConstView(), indexer );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-String
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-getSerializationType()
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+std::string
+MultidiagonalMatrixView< Real, Device, Index, Organization >::getSerializationType()
 {
-   return String( "Matrices::MultidiagonalMatrix< " ) +
-          TNL::getSerializationType< RealType >() + ", [any_device], " +
-          TNL::getSerializationType< IndexType >() + ", " +
-          TNL::getSerializationType( Organization ) + ", [any_allocator], [any_allocator] >";
+   return "Matrices::MultidiagonalMatrix< " + TNL::getSerializationType< RealType >() + ", [any_device], "
+        + TNL::getSerializationType< IndexType >() + ", " + TNL::getSerializationType( Organization )
+        + ", [any_allocator], [any_allocator] >";
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-String
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-getSerializationTypeVirtual() const
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+std::string
+MultidiagonalMatrixView< Real, Device, Index, Organization >::getSerializationTypeVirtual() const
 {
    return this->getSerializationType();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
 const Index
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-getDiagonalsCount() const
+MultidiagonalMatrixView< Real, Device, Index, Organization >::getDiagonalsCount() const
 {
 #ifdef __CUDA_ARCH__
    return this->diagonalsOffsets.getSize();
@@ -108,148 +73,117 @@ getDiagonalsCount() const
 #endif
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Vector >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Vector >
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-getRowCapacities( Vector& rowCapacities ) const
+MultidiagonalMatrixView< Real, Device, Index, Organization >::getRowCapacities( Vector& rowCapacities ) const
 {
    rowCapacities.setSize( this->getRows() );
    auto aux = this->getDiagonalsCount();
    rowCapacities = aux;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Vector >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Vector >
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-getCompressedRowLengths( Vector& rowLengths ) const
+MultidiagonalMatrixView< Real, Device, Index, Organization >::getCompressedRowLengths( Vector& rowLengths ) const
 {
    rowLengths.setSize( this->getRows() );
    rowLengths = 0;
    auto rowLengths_view = rowLengths.getView();
-   auto fetch = [] __cuda_callable__ ( IndexType row, IndexType column, const RealType& value ) -> IndexType {
+   auto fetch = [] __cuda_callable__( IndexType row, IndexType column, const RealType& value ) -> IndexType
+   {
       return ( value != 0.0 );
    };
-   auto reduce = [] __cuda_callable__ ( IndexType& aux, const IndexType a ) {
+   auto reduce = [] __cuda_callable__( IndexType & aux, const IndexType a )
+   {
       aux += a;
    };
-   auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const IndexType value ) mutable {
+   auto keep = [ = ] __cuda_callable__( const IndexType rowIdx, const IndexType value ) mutable
+   {
       rowLengths_view[ rowIdx ] = value;
    };
    this->reduceAllRows( fetch, reduce, keep, 0 );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 Index
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-getRowLength( const IndexType row ) const
+MultidiagonalMatrixView< Real, Device, Index, Organization >::getRowLength( const IndexType row ) const
 {
    return this->diagonalsOffsets.getSize();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 Index
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-getNonzeroElementsCount() const
+MultidiagonalMatrixView< Real, Device, Index, Organization >::getNonzeroElementsCount() const
 {
    const auto values_view = this->values.getConstView();
-   auto fetch = [=] __cuda_callable__ ( const IndexType i ) -> IndexType {
+   auto fetch = [ = ] __cuda_callable__( const IndexType i ) -> IndexType
+   {
       return ( values_view[ i ] != 0.0 );
    };
    return Algorithms::reduce< DeviceType >( (IndexType) 0, this->values.getSize(), fetch, std::plus<>{}, 0 );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_ >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_ >
 bool
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-operator == ( const MultidiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix ) const
+MultidiagonalMatrixView< Real, Device, Index, Organization >::operator==(
+   const MultidiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix ) const
 {
    if( Organization == Organization_ )
       return this->values == matrix.values;
-   else
-   {
+   else {
       TNL_ASSERT_TRUE( false, "TODO" );
    }
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_ >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_ >
 bool
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-operator != ( const MultidiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix ) const
+MultidiagonalMatrixView< Real, Device, Index, Organization >::operator!=(
+   const MultidiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix ) const
 {
    return ! this->operator==( matrix );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-setValue( const RealType& v )
+MultidiagonalMatrixView< Real, Device, Index, Organization >::setValue( const RealType& v )
 {
    // we dont do this->values = v here because it would set even elements 'outside' the matrix
    // method getNumberOfNonzeroElements would not work well then
    const RealType newValue = v;
-   auto f = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType columnIdx, RealType& value ) mutable {
+   auto f = [ = ] __cuda_callable__(
+               const IndexType& rowIdx, const IndexType& localIdx, const IndexType columnIdx, RealType& value ) mutable
+   {
       value = newValue;
    };
    this->forAllElements( f );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
 auto
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-getRow( const IndexType& rowIdx ) const -> const ConstRowView
+MultidiagonalMatrixView< Real, Device, Index, Organization >::getRow( const IndexType& rowIdx ) const -> const ConstRowView
 {
    return ConstRowView( rowIdx, this->diagonalsOffsets.getView(), this->values.getView(), this->indexer );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
 auto
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-getRow( const IndexType& rowIdx ) -> RowView
+MultidiagonalMatrixView< Real, Device, Index, Organization >::getRow( const IndexType& rowIdx ) -> RowView
 {
    return RowView( rowIdx, this->diagonalsOffsets.getView(), this->values.getView(), this->indexer );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-setElement( const IndexType row, const IndexType column, const RealType& value )
+MultidiagonalMatrixView< Real, Device, Index, Organization >::setElement( const IndexType row,
+                                                                          const IndexType column,
+                                                                          const RealType& value )
 {
    TNL_ASSERT_GE( row, 0, "" );
    TNL_ASSERT_LT( row, this->getRows(), "" );
@@ -257,34 +191,28 @@ setElement( const IndexType row, const IndexType column, const RealType& value )
    TNL_ASSERT_LT( column, this->getColumns(), "" );
 
    for( IndexType i = 0; i < diagonalsOffsets.getSize(); i++ )
-      if( row + diagonalsOffsets.getElement( i ) == column )
-      {
+      if( row + diagonalsOffsets.getElement( i ) == column ) {
          this->values.setElement( this->indexer.getGlobalIndex( row, i ), value );
          return;
       }
-   if( value != 0.0 )
-   {
+   if( value != 0.0 ) {
 #ifdef __CUDA_ARCH__
       TNL_ASSERT_TRUE( false, "" );
 #else
       std::stringstream msg;
-      msg << "Wrong matrix element coordinates ( "  << row << ", " << column << " ) in multidiagonal matrix.";
+      msg << "Wrong matrix element coordinates ( " << row << ", " << column << " ) in multidiagonal matrix.";
       throw std::logic_error( msg.str() );
 #endif
    }
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-addElement( const IndexType row,
-            const IndexType column,
-            const RealType& value,
-            const RealType& thisElementMultiplicator )
+MultidiagonalMatrixView< Real, Device, Index, Organization >::addElement( const IndexType row,
+                                                                          const IndexType column,
+                                                                          const RealType& value,
+                                                                          const RealType& thisElementMultiplicator )
 {
    TNL_ASSERT_GE( row, 0, "" );
    TNL_ASSERT_LT( row, this->getRows(), "" );
@@ -292,32 +220,26 @@ addElement( const IndexType row,
    TNL_ASSERT_LT( column, this->getColumns(), "" );
 
    for( IndexType i = 0; i < diagonalsOffsets.getSize(); i++ )
-      if( row + diagonalsOffsets.getElement( i ) == column )
-      {
+      if( row + diagonalsOffsets.getElement( i ) == column ) {
          const Index idx = this->indexer.getGlobalIndex( row, i );
          this->values.setElement( idx, thisElementMultiplicator * this->values.getElement( idx ) + value );
          return;
       }
-   if( value != 0.0 )
-   {
+   if( value != 0.0 ) {
 #ifdef __CUDA_ARCH__
       TNL_ASSERT_TRUE( false, "" );
 #else
       std::stringstream msg;
-      msg << "Wrong matrix element coordinates ( "  << row << ", " << column << " ) in multidiagonal matrix.";
+      msg << "Wrong matrix element coordinates ( " << row << ", " << column << " ) in multidiagonal matrix.";
       throw std::logic_error( msg.str() );
 #endif
    }
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
 Real
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-getElement( const IndexType row, const IndexType column ) const
+MultidiagonalMatrixView< Real, Device, Index, Organization >::getElement( const IndexType row, const IndexType column ) const
 {
    TNL_ASSERT_GE( row, 0, "" );
    TNL_ASSERT_LT( row, this->getRows(), "" );
@@ -330,13 +252,9 @@ getElement( const IndexType row, const IndexType column ) const
    return 0.0;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 MultidiagonalMatrixView< Real, Device, Index, Organization >&
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-operator=( const MultidiagonalMatrixView& view )
+MultidiagonalMatrixView< Real, Device, Index, Organization >::operator=( const MultidiagonalMatrixView& view )
 {
    MatrixView< Real, Device, Index >::operator=( view );
    this->diagonalsOffsets.bind( view.diagonalsOffsets );
@@ -345,14 +263,15 @@ operator=( const MultidiagonalMatrixView& view )
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-reduceRows( IndexType first, IndexType last, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity ) const
+MultidiagonalMatrixView< Real, Device, Index, Organization >::reduceRows( IndexType first,
+                                                                          IndexType last,
+                                                                          Fetch& fetch,
+                                                                          Reduce& reduce,
+                                                                          Keep& keep,
+                                                                          const FetchReal& identity ) const
 {
    using Real_ = decltype( fetch( IndexType(), IndexType(), RealType() ) );
    const auto values_view = this->values.getConstView();
@@ -360,10 +279,10 @@ reduceRows( IndexType first, IndexType last, Fetch& fetch, Reduce& reduce, Keep&
    const IndexType diagonalsCount = this->diagonalsOffsets.getSize();
    const IndexType columns = this->getColumns();
    const auto indexer = this->indexer;
-   auto f = [=] __cuda_callable__ ( IndexType rowIdx ) mutable {
+   auto f = [ = ] __cuda_callable__( IndexType rowIdx ) mutable
+   {
       Real_ sum = identity;
-      for( IndexType localIdx = 0; localIdx < diagonalsCount; localIdx++ )
-      {
+      for( IndexType localIdx = 0; localIdx < diagonalsCount; localIdx++ ) {
          const IndexType columnIdx = rowIdx + diagonalsOffsets_view[ localIdx ];
          if( columnIdx >= 0 && columnIdx < columns )
             reduce( sum, fetch( rowIdx, columnIdx, values_view[ indexer.getGlobalIndex( rowIdx, localIdx ) ] ) );
@@ -373,14 +292,15 @@ reduceRows( IndexType first, IndexType last, Fetch& fetch, Reduce& reduce, Keep&
    Algorithms::ParallelFor< DeviceType >::exec( first, last, f );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-reduceRows( IndexType first, IndexType last, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity )
+MultidiagonalMatrixView< Real, Device, Index, Organization >::reduceRows( IndexType first,
+                                                                          IndexType last,
+                                                                          Fetch& fetch,
+                                                                          Reduce& reduce,
+                                                                          Keep& keep,
+                                                                          const FetchReal& identity )
 {
    using Real_ = decltype( fetch( IndexType(), IndexType(), RealType() ) );
    const auto values_view = this->values.getConstView();
@@ -388,10 +308,10 @@ reduceRows( IndexType first, IndexType last, Fetch& fetch, Reduce& reduce, Keep&
    const IndexType diagonalsCount = this->diagonalsOffsets.getSize();
    const IndexType columns = this->getColumns();
    const auto indexer = this->indexer;
-   auto f = [=] __cuda_callable__ ( IndexType rowIdx ) mutable {
+   auto f = [ = ] __cuda_callable__( IndexType rowIdx ) mutable
+   {
       Real_ sum = identity;
-      for( IndexType localIdx = 0; localIdx < diagonalsCount; localIdx++ )
-      {
+      for( IndexType localIdx = 0; localIdx < diagonalsCount; localIdx++ ) {
          const IndexType columnIdx = rowIdx + diagonalsOffsets_view[ localIdx ];
          if( columnIdx >= 0 && columnIdx < columns )
             sum = reduce( sum, fetch( rowIdx, columnIdx, values_view[ indexer.getGlobalIndex( rowIdx, localIdx ) ] ) );
@@ -401,47 +321,43 @@ reduceRows( IndexType first, IndexType last, Fetch& fetch, Reduce& reduce, Keep&
    Algorithms::ParallelFor< DeviceType >::exec( first, last, f );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity ) const
+MultidiagonalMatrixView< Real, Device, Index, Organization >::reduceAllRows( Fetch& fetch,
+                                                                             Reduce& reduce,
+                                                                             Keep& keep,
+                                                                             const FetchReal& identity ) const
 {
    this->reduceRows( (IndexType) 0, this->indexer.getNonemptyRowsCount(), fetch, reduce, keep, identity );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity )
+MultidiagonalMatrixView< Real, Device, Index, Organization >::reduceAllRows( Fetch& fetch,
+                                                                             Reduce& reduce,
+                                                                             Keep& keep,
+                                                                             const FetchReal& identity )
 {
    this->reduceRows( (IndexType) 0, this->indexer.getNonemptyRowsCount(), fetch, reduce, keep, identity );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-forElements( IndexType first, IndexType last, Function& function ) const
+MultidiagonalMatrixView< Real, Device, Index, Organization >::forElements( IndexType first,
+                                                                           IndexType last,
+                                                                           Function& function ) const
 {
    const auto values_view = this->values.getConstView();
    const auto diagonalsOffsets_view = this->diagonalsOffsets.getConstView();
    const IndexType diagonalsCount = this->diagonalsOffsets.getSize();
    const IndexType columns = this->getColumns();
    const auto indexer = this->indexer;
-   auto f = [=] __cuda_callable__ ( IndexType rowIdx ) mutable {
-      for( IndexType localIdx = 0; localIdx < diagonalsCount; localIdx++ )
-      {
+   auto f = [ = ] __cuda_callable__( IndexType rowIdx ) mutable
+   {
+      for( IndexType localIdx = 0; localIdx < diagonalsCount; localIdx++ ) {
          const IndexType columnIdx = rowIdx + diagonalsOffsets_view[ localIdx ];
          if( columnIdx >= 0 && columnIdx < columns )
             function( rowIdx, localIdx, columnIdx, values_view[ indexer.getGlobalIndex( rowIdx, localIdx ) ] );
@@ -450,23 +366,19 @@ forElements( IndexType first, IndexType last, Function& function ) const
    Algorithms::ParallelFor< DeviceType >::exec( first, last, f );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-  template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-forElements( IndexType first, IndexType last, Function& function )
+MultidiagonalMatrixView< Real, Device, Index, Organization >::forElements( IndexType first, IndexType last, Function& function )
 {
    auto values_view = this->values.getView();
    const auto diagonalsOffsets_view = this->diagonalsOffsets.getConstView();
    const IndexType diagonalsCount = this->diagonalsOffsets.getSize();
    const IndexType columns = this->getColumns();
    const auto indexer = this->indexer;
-   auto f = [=] __cuda_callable__ ( IndexType rowIdx ) mutable {
-      for( IndexType localIdx = 0; localIdx < diagonalsCount; localIdx++ )
-      {
+   auto f = [ = ] __cuda_callable__( IndexType rowIdx ) mutable
+   {
+      for( IndexType localIdx = 0; localIdx < diagonalsCount; localIdx++ ) {
          const IndexType columnIdx = rowIdx + diagonalsOffsets_view[ localIdx ];
          if( columnIdx >= 0 && columnIdx < columns )
             function( rowIdx, localIdx, columnIdx, values_view[ indexer.getGlobalIndex( rowIdx, localIdx ) ] );
@@ -475,189 +387,153 @@ forElements( IndexType first, IndexType last, Function& function )
    Algorithms::ParallelFor< DeviceType >::exec( first, last, f );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-forAllElements( Function& function ) const
+MultidiagonalMatrixView< Real, Device, Index, Organization >::forAllElements( Function& function ) const
 {
    this->forElements( (IndexType) 0, this->indxer.getNonEmptyRowsCount(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-forAllElements( Function& function )
+MultidiagonalMatrixView< Real, Device, Index, Organization >::forAllElements( Function& function )
 {
    this->forElements( (IndexType) 0, this->indexer.getNonemptyRowsCount(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-forRows( IndexType begin, IndexType end, Function&& function )
+MultidiagonalMatrixView< Real, Device, Index, Organization >::forRows( IndexType begin, IndexType end, Function&& function )
 {
    auto view = *this;
-   auto f = [=] __cuda_callable__ ( const IndexType rowIdx ) mutable {
+   auto f = [ = ] __cuda_callable__( const IndexType rowIdx ) mutable
+   {
       auto rowView = view.getRow( rowIdx );
       function( rowView );
    };
    TNL::Algorithms::ParallelFor< DeviceType >::exec( begin, end, f );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-forRows( IndexType begin, IndexType end, Function&& function ) const
+MultidiagonalMatrixView< Real, Device, Index, Organization >::forRows( IndexType begin,
+                                                                       IndexType end,
+                                                                       Function&& function ) const
 {
    auto view = *this;
-   auto f = [=] __cuda_callable__ ( const IndexType rowIdx ) mutable {
+   auto f = [ = ] __cuda_callable__( const IndexType rowIdx ) mutable
+   {
       auto rowView = view.getRow( rowIdx );
       function( rowView );
    };
    TNL::Algorithms::ParallelFor< DeviceType >::exec( begin, end, f );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-forAllRows( Function&& function )
+MultidiagonalMatrixView< Real, Device, Index, Organization >::forAllRows( Function&& function )
 {
    this->forRows( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-forAllRows( Function&& function ) const
+MultidiagonalMatrixView< Real, Device, Index, Organization >::forAllRows( Function&& function ) const
 {
    this->forRows( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-sequentialForRows( IndexType begin, IndexType end, Function& function ) const
+MultidiagonalMatrixView< Real, Device, Index, Organization >::sequentialForRows( IndexType begin,
+                                                                                 IndexType end,
+                                                                                 Function& function ) const
 {
-   for( IndexType row = begin; row < end; row ++ )
+   for( IndexType row = begin; row < end; row++ )
       this->forRows( row, row + 1, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-sequentialForRows( IndexType begin, IndexType end, Function& function )
+MultidiagonalMatrixView< Real, Device, Index, Organization >::sequentialForRows( IndexType begin,
+                                                                                 IndexType end,
+                                                                                 Function& function )
 {
-   for( IndexType row = begin; row < end; row ++ )
+   for( IndexType row = begin; row < end; row++ )
       this->forRows( row, row + 1, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-sequentialForAllRows( Function& function ) const
+MultidiagonalMatrixView< Real, Device, Index, Organization >::sequentialForAllRows( Function& function ) const
 {
    this->sequentialForRows( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-sequentialForAllRows( Function& function )
+MultidiagonalMatrixView< Real, Device, Index, Organization >::sequentialForAllRows( Function& function )
 {
    this->sequentialForRows( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename InVector,
-             typename OutVector >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename InVector, typename OutVector >
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-vectorProduct( const InVector& inVector,
-               OutVector& outVector,
-               const RealType matrixMultiplicator,
-               const RealType outVectorMultiplicator,
-               const IndexType begin,
-               IndexType end ) const
+MultidiagonalMatrixView< Real, Device, Index, Organization >::vectorProduct( const InVector& inVector,
+                                                                             OutVector& outVector,
+                                                                             RealType matrixMultiplicator,
+                                                                             RealType outVectorMultiplicator,
+                                                                             IndexType begin,
+                                                                             IndexType end ) const
 {
    TNL_ASSERT_EQ( this->getColumns(), inVector.getSize(), "Matrix columns do not fit with input vector." );
    TNL_ASSERT_EQ( this->getRows(), outVector.getSize(), "Matrix rows do not fit with output vector." );
 
    const auto inVectorView = inVector.getConstView();
    auto outVectorView = outVector.getView();
-   auto fetch = [=] __cuda_callable__ ( const IndexType& row, const IndexType& column, const RealType& value ) -> RealType {
+   auto fetch = [ = ] __cuda_callable__( const IndexType& row, const IndexType& column, const RealType& value ) -> RealType
+   {
       return value * inVectorView[ column ];
    };
-   auto reduction = [] __cuda_callable__ ( RealType& sum, const RealType& value ) {
+   auto reduction = [] __cuda_callable__( RealType & sum, const RealType& value )
+   {
       sum += value;
    };
-   auto keeper1 = [=] __cuda_callable__ ( IndexType row, const RealType& value ) mutable {
+   auto keeper1 = [ = ] __cuda_callable__( IndexType row, const RealType& value ) mutable
+   {
       outVectorView[ row ] = matrixMultiplicator * value;
    };
-   auto keeper2 = [=] __cuda_callable__ ( IndexType row, const RealType& value ) mutable {
+   auto keeper2 = [ = ] __cuda_callable__( IndexType row, const RealType& value ) mutable
+   {
       outVectorView[ row ] = outVectorMultiplicator * outVectorView[ row ] + matrixMultiplicator * value;
    };
 
    if( end == 0 )
       end = this->getRows();
-   if( outVectorMultiplicator == ( RealType ) 0.0 )
-      this->reduceRows( begin, end, fetch, reduction, keeper1, ( RealType ) 0.0 );
+   if( outVectorMultiplicator == (RealType) 0.0 )
+      this->reduceRows( begin, end, fetch, reduction, keeper1, (RealType) 0.0 );
    else
-      this->reduceRows( begin, end, fetch, reduction, keeper2, ( RealType ) 0.0 );
+      this->reduceRows( begin, end, fetch, reduction, keeper2, (RealType) 0.0 );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_ >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_ >
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-addMatrix( const MultidiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix,
-           const RealType& matrixMultiplicator,
-           const RealType& thisMatrixMultiplicator )
+MultidiagonalMatrixView< Real, Device, Index, Organization >::addMatrix(
+   const MultidiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix,
+   const RealType& matrixMultiplicator,
+   const RealType& thisMatrixMultiplicator )
 {
    TNL_ASSERT_EQ( this->getRows(), matrix.getRows(), "Matrices rows are not equal." );
    TNL_ASSERT_EQ( this->getColumns(), matrix.getColumns(), "Matrices columns are not equal." );
@@ -674,14 +550,15 @@ addMatrix( const MultidiagonalMatrixView< Real_, Device_, Index_, Organization_
       const auto matrix_view = matrix;
       const auto matrixMult = matrixMultiplicator;
       const auto thisMult = thisMatrixMultiplicator;
-      auto add0 = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value ) mutable {
-         value = matrixMult * matrix.getValues()[ matrix.getIndexer().getGlobalIndex( rowIdx, localIdx ) ];
+      auto add0 = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real&
+   value ) mutable { value = matrixMult * matrix.getValues()[ matrix.getIndexer().getGlobalIndex( rowIdx, localIdx ) ];
       };
-      auto add1 = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value ) mutable {
-         value += matrixMult * matrix.getValues()[ matrix.getIndexer().getGlobalIndex( rowIdx, localIdx ) ];
+      auto add1 = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real&
+   value ) mutable { value += matrixMult * matrix.getValues()[ matrix.getIndexer().getGlobalIndex( rowIdx, localIdx ) ];
       };
-      auto addGen = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value ) mutable {
-         value = thisMult * value + matrixMult * matrix.getValues()[ matrix.getIndexer().getGlobalIndex( rowIdx, localIdx ) ];
+      auto addGen = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real&
+   value ) mutable { value = thisMult * value + matrixMult * matrix.getValues()[ matrix.getIndexer().getGlobalIndex( rowIdx,
+   localIdx ) ];
       };
       if( thisMult == 0.0 )
          this->forAllElements( add0 );
@@ -720,32 +597,26 @@ __global__ void MultidiagonalTranspositionCudaKernel( const Multidiagonal< Real2
 }*/
 #endif
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Real2, typename Index2 >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Real2, typename Index2 >
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-getTransposition( const MultidiagonalMatrixView< Real2, Device, Index2 >& matrix,
-                  const RealType& matrixMultiplicator )
+MultidiagonalMatrixView< Real, Device, Index, Organization >::getTransposition(
+   const MultidiagonalMatrixView< Real2, Device, Index2 >& matrix,
+   const RealType& matrixMultiplicator )
 {
    TNL_ASSERT( this->getRows() == matrix.getRows(),
                std::cerr << "This matrix rows: " << this->getRows() << std::endl
-                    << "That matrix rows: " << matrix.getRows() << std::endl );
-   if( std::is_same< Device, Devices::Host >::value )
-   {
+                         << "That matrix rows: " << matrix.getRows() << std::endl );
+   if( std::is_same< Device, Devices::Host >::value ) {
       const IndexType& rows = matrix.getRows();
-      for( IndexType i = 1; i < rows; i++ )
-      {
-         RealType aux = matrix. getElement( i, i - 1 );
+      for( IndexType i = 1; i < rows; i++ ) {
+         RealType aux = matrix.getElement( i, i - 1 );
          this->setElement( i, i - 1, matrix.getElement( i - 1, i ) );
          this->setElement( i, i, matrix.getElement( i, i ) );
          this->setElement( i - 1, i, aux );
       }
    }
-   if( std::is_same< Device, Devices::Cuda >::value )
-   {
+   if( std::is_same< Device, Devices::Cuda >::value ) {
 #ifdef HAVE_CUDA
       /*Multidiagonal* kernel_this = Cuda::passToDevice( *this );
       typedef  Multidiagonal< Real2, Device, Index2 > InMatrixType;
@@ -770,43 +641,31 @@ getTransposition( const MultidiagonalMatrixView< Real2, Device, Index2 >& matrix
    }
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-void MultidiagonalMatrixView< Real, Device, Index, Organization >::save( File& file ) const
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+void
+MultidiagonalMatrixView< Real, Device, Index, Organization >::save( File& file ) const
 {
    MatrixView< Real, Device, Index >::save( file );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 void
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-save( const String& fileName ) const
+MultidiagonalMatrixView< Real, Device, Index, Organization >::save( const String& fileName ) const
 {
    Object::save( fileName );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-void MultidiagonalMatrixView< Real, Device, Index, Organization >::print( std::ostream& str ) const
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+void
+MultidiagonalMatrixView< Real, Device, Index, Organization >::print( std::ostream& str ) const
 {
-   for( IndexType rowIdx = 0; rowIdx < this->getRows(); rowIdx++ )
-   {
-      str <<"Row: " << rowIdx << " -> ";
-      for( IndexType localIdx = 0; localIdx < this->hostDiagonalsOffsets.getSize(); localIdx++ )
-      {
+   for( IndexType rowIdx = 0; rowIdx < this->getRows(); rowIdx++ ) {
+      str << "Row: " << rowIdx << " -> ";
+      for( IndexType localIdx = 0; localIdx < this->hostDiagonalsOffsets.getSize(); localIdx++ ) {
          const IndexType columnIdx = rowIdx + this->hostDiagonalsOffsets[ localIdx ];
-         if( columnIdx >= 0 && columnIdx < this->columns )
-         {
+         if( columnIdx >= 0 && columnIdx < this->columns ) {
             auto value = this->values.getElement( this->indexer.getGlobalIndex( rowIdx, localIdx ) );
-            if( value )
-            {
+            if( value ) {
                std::stringstream str_;
                str_ << std::setw( 4 ) << std::right << columnIdx << ":" << std::setw( 4 ) << std::left << value;
                str << std::setw( 10 ) << str_.str();
@@ -817,42 +676,29 @@ void MultidiagonalMatrixView< Real, Device, Index, Organization >::print( std::o
    }
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
 auto
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-getIndexer() const -> const IndexerType&
+MultidiagonalMatrixView< Real, Device, Index, Organization >::getIndexer() const -> const IndexerType&
 {
    return this->indexer;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
 auto
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-getIndexer() -> IndexerType&
+MultidiagonalMatrixView< Real, Device, Index, Organization >::getIndexer() -> IndexerType&
 {
    return this->indexer;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
 Index
-MultidiagonalMatrixView< Real, Device, Index, Organization >::
-getPaddingIndex() const
+MultidiagonalMatrixView< Real, Device, Index, Organization >::getPaddingIndex() const
 {
    return -1;
 }
 
-
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/Sandbox/SparseSandboxMatrix.h b/src/TNL/Matrices/Sandbox/SparseSandboxMatrix.h
index 3c9c77ddd22aa718deec08e2a059a4c151edb5fd..27a9dfaa83fb06c2539269e8f21b1f61fa5585ca 100644
--- a/src/TNL/Matrices/Sandbox/SparseSandboxMatrix.h
+++ b/src/TNL/Matrices/Sandbox/SparseSandboxMatrix.h
@@ -16,11 +16,11 @@
 #include <TNL/Matrices/DenseMatrix.h>
 
 namespace TNL {
-   namespace Matrices {
-      /**
-       * \brief Namespace for sandbox matrices.
-       */
-      namespace Sandbox {
+namespace Matrices {
+/**
+ * \brief Namespace for sandbox matrices.
+ */
+namespace Sandbox {
 
 /**
  * \brief Template of a sparse matrix that can be used for testing of new sparse-matrix formats.
@@ -51,48 +51,62 @@ namespace TNL {
  *
  * In the core of this class there is:
  *
- * 1. Vector 'values` (\ref TNL::Matrices::Matrix::values) which is inheritted from \ref TNL::Matrices::Matrix. This vector is used for storing
- *    of matrix elements values.
- * 2. Vector `columnIndexes` (\ref TNL::Matrices::SendboxMatrix::columnIndexes). This vector is used for storing of matrix elements column indexes.
+ * 1. Vector 'values` (\ref TNL::Matrices::Matrix::values) which is inheritted from \ref TNL::Matrices::Matrix. This vector is
+ * used for storing of matrix elements values.
+ * 2. Vector `columnIndexes` (\ref TNL::Matrices::SendboxMatrix::columnIndexes). This vector is used for storing of matrix
+ * elements column indexes.
  *
- * This class contains fully functional implementation of CSR format and so the user have to replace just what he needs to. Once you have
- * successfully implemented the sparse matrix format in this form, you may consider to extract it into a form of segments to make it accessible
- * even for other algorithms then SpMV.
+ * This class contains fully functional implementation of CSR format and so the user have to replace just what he needs to. Once
+ * you have successfully implemented the sparse matrix format in this form, you may consider to extract it into a form of
+ * segments to make it accessible even for other algorithms then SpMV.
  *
- * Parts of the code, that need to be modified are marked by SANDBOX_TODO tag. The whole implementation consits of the following classes:
+ * Parts of the code, that need to be modified are marked by SANDBOX_TODO tag. The whole implementation consits of the following
+ * classes:
  *
- * 1. \ref TNL::Matrices::Sandbox::SparseSandboxMatrix - this class, it serves for matrix setup and performing of the main operations.
- * 2. \ref TNL::Matrices::Sandbox::SparseSandboxMatrixView - view class which is necessary mainly for passing the matrix to GPU kernels. Most methods of `SparseSandboxMatrix` are common
- *    with `SparseSandboxMatrixView` and in this case they are implemented in the view class (and there is just redirection from this class). For this reason, `SparseSandboxMatrix` contains instance of the view class
- *    (\ref TNL::Matrices::Sandbox::SparseSandboxMatrix::view) which needs to be regularly updated each time when metadata are changed. This is usually done by the means of
- *    method \ref TNL::Matrices::Sandbox::SparseSandboxMatrix::getView.
- * 3. \ref TNL::Matrices::Sandbox::SparseSandboxMatrixRowView - is a class for accessing particular matrix rows. It will, likely, require some changes as well.
+ * 1. \ref TNL::Matrices::Sandbox::SparseSandboxMatrix - this class, it serves for matrix setup and performing of the main
+ * operations.
+ * 2. \ref TNL::Matrices::Sandbox::SparseSandboxMatrixView - view class which is necessary mainly for passing the matrix to GPU
+ * kernels. Most methods of `SparseSandboxMatrix` are common with `SparseSandboxMatrixView` and in this case they are
+ * implemented in the view class (and there is just redirection from this class). For this reason, `SparseSandboxMatrix`
+ * contains instance of the view class
+ *    (\ref TNL::Matrices::Sandbox::SparseSandboxMatrix::view) which needs to be regularly updated each time when metadata are
+ * changed. This is usually done by the means of method \ref TNL::Matrices::Sandbox::SparseSandboxMatrix::getView.
+ * 3. \ref TNL::Matrices::Sandbox::SparseSandboxMatrixRowView - is a class for accessing particular matrix rows. It will,
+ * likely, require some changes as well.
  *
  * We suggest the following way of implementation of the new sparse matrix format:
  *
- * 1. Add metadata required by your format next to \ref TNL::Matrices::Sandbox::SparseSandboxMatrix::rowPointers but do not replace the row pointers. It will allow you
- *    to implement your new format next to the original CSR and to check/compare with the valid CSR implementation any time you get into troubles. The adventage is that all
- *    unit tests are working properly and you may just focus on modifying one method after another. The unit tests are called from
- *    `src/UnitTests/Matrices/SparseMatrixTests_SandboxMatrix.h` and `src/UnitTests/Matrices/SparseMatrixVectorProductTests_SandboxMatrix.h`
- * 2. Modify first the method \ref TNL::Matrices::Sandbox::SparseSandboxMatrix::setRowCapacities which is responsible for the setup of the format metadata.
- * 3. Continue with modification of constructors, view class, \ref TNL::Matrices::Sandbox::SparseSandoxMatrix::getView and \ref TNL::Matrices::Sandbox::SparseSandoxMatrix::getConstView.
- * 4. Next you need to modify \ref TNL::Matrices::Sandbox::SparseSandboxMatrix::setElement and \ref TNL::Matrices::Sandbox::SparseSandboxMatrix::getElement methods and assignment operator
- *    at least for copying the matrix across different devices (i.e. from CPU to GPU). It will allow you to use \ref TNL::Matrices::MatrixReader. We recommend to have the same data layout
- *    on both CPU and GPU so that the transfer of the matrix from CPU to GPU is trivial.
- * 5. Finally proceed to \ref TNL::Matrices::Sandbox::SparseSandboxMatrix::vectorProduct to implement SpMV operation. We recommend to implement first the CPU version which is easier to
- *     debug. Next proceed to GPU version.
+ * 1. Add metadata required by your format next to \ref TNL::Matrices::Sandbox::SparseSandboxMatrix::rowPointers but do not
+ * replace the row pointers. It will allow you to implement your new format next to the original CSR and to check/compare with
+ * the valid CSR implementation any time you get into troubles. The adventage is that all unit tests are working properly and
+ * you may just focus on modifying one method after another. The unit tests are called from
+ *    `src/UnitTests/Matrices/SparseMatrixTests_SandboxMatrix.h` and
+ * `src/UnitTests/Matrices/SparseMatrixVectorProductTests_SandboxMatrix.h`
+ * 2. Modify first the method \ref TNL::Matrices::Sandbox::SparseSandboxMatrix::setRowCapacities which is responsible for the
+ * setup of the format metadata.
+ * 3. Continue with modification of constructors, view class, \ref TNL::Matrices::Sandbox::SparseSandoxMatrix::getView and \ref
+ * TNL::Matrices::Sandbox::SparseSandoxMatrix::getConstView.
+ * 4. Next you need to modify \ref TNL::Matrices::Sandbox::SparseSandboxMatrix::setElement and \ref
+ * TNL::Matrices::Sandbox::SparseSandboxMatrix::getElement methods and assignment operator at least for copying the matrix
+ * across different devices (i.e. from CPU to GPU). It will allow you to use \ref TNL::Matrices::MatrixReader. We recommend to
+ * have the same data layout on both CPU and GPU so that the transfer of the matrix from CPU to GPU is trivial.
+ * 5. Finally proceed to \ref TNL::Matrices::Sandbox::SparseSandboxMatrix::vectorProduct to implement SpMV operation. We
+ * recommend to implement first the CPU version which is easier to debug. Next proceed to GPU version.
  * 6. When SpMV works it is time to delete the original CSR implementation, i.e. everything around `rowPointers`.
- * 7. Optimize your implementation to the best performance and test with `tnl-benchmark-spmv` - you need to include your new matrix to `src/Benchmarks/SpMV/spmv.h` and modify this file
- *    accordingly.
+ * 7. Optimize your implementation to the best performance and test with `tnl-benchmark-spmv` - you need to include your new
+ * matrix to `src/Benchmarks/SpMV/spmv.h` and modify this file accordingly.
  * 8. If you want, you may now generalize SpMV to \ref TNL::Matrices::Sandbox::SparseSandboxMatrix::reduceRows method.
- * 9. If you have `reduceRows` implemented, you may use the original implementation of SpMV based just on the `reduceRows` method.
- * 10. You may implement \ref TNL::Matrices::Sandbox::SparseSandboxMatrix::forRows and \ref TNL::Matrices::Sandbox::SparseSandboxMatrix::forElements.
- * 11. Now you have complete implementation of new sparse matrix format. You may turn it into new type of segments (\ref TNL::Algorithms::Segments).
+ * 9. If you have `reduceRows` implemented, you may use the original implementation of SpMV based just on the `reduceRows`
+ * method.
+ * 10. You may implement \ref TNL::Matrices::Sandbox::SparseSandboxMatrix::forRows and \ref
+ * TNL::Matrices::Sandbox::SparseSandboxMatrix::forElements.
+ * 11. Now you have complete implementation of new sparse matrix format. You may turn it into new type of segments (\ref
+ * TNL::Algorithms::Segments).
  *
  * During the implementation some unit tests may crash. If you do not need them at the moment, you may comment them in files
  * `src/UnitTests/Matrices/SparseMatrixTests.h` and `src/UnitTests/Matrices/SparseMatrixVectorProductTests.h`
  */
-template< typename Real =  double,
+template< typename Real = double,
           typename Device = Devices::Host,
           typename Index = int,
           typename MatrixType = GeneralMatrix,
@@ -101,1075 +115,1123 @@ template< typename Real =  double,
 class SparseSandboxMatrix : public Matrix< Real, Device, Index, RealAllocator >
 {
    static_assert(
-         ! MatrixType::isSymmetric() ||
-         ! std::is_same< Device, Devices::Cuda >::value ||
-         ( std::is_same< Real, float >::value || std::is_same< Real, double >::value || std::is_same< Real, int >::value || std::is_same< Real, long long int >::value ),
-         "Given Real type is not supported by atomic operations on GPU which are necessary for symmetric operations." );
-
-   public:
-
-      // Supporting types - they are not important for the user
-      using BaseType = Matrix< Real, Device, Index, RealAllocator >;
-      using ValuesVectorType = typename Matrix< Real, Device, Index, RealAllocator >::ValuesType;
-      using ValuesViewType = typename ValuesVectorType::ViewType;
-      using ConstValuesViewType = typename ValuesViewType::ConstViewType;
-      using ColumnsIndexesVectorType = Containers::Vector< typename TNL::copy_const< Index >::template from< Real >::type, Device, Index, IndexAllocator >;
-      using ColumnsIndexesViewType = typename ColumnsIndexesVectorType::ViewType;
-      using ConstColumnsIndexesViewType = typename ColumnsIndexesViewType::ConstViewType;
-      using RowsCapacitiesType = Containers::Vector< std::remove_const_t< Index >, Device, Index, IndexAllocator >;
-      using RowsCapacitiesView = Containers::VectorView< std::remove_const_t< Index >, Device, Index >;
-      using ConstRowsCapacitiesView = typename RowsCapacitiesView::ConstViewType;
-
-      /**
-       * \brief Test of symmetric matrix type.
-       *
-       * \return \e true if the matrix is stored as symmetric and \e false otherwise.
-       */
-      static constexpr bool isSymmetric() { return MatrixType::isSymmetric(); };
-
-      /**
-       * \brief Test of binary matrix type.
-       *
-       * \return \e true if the matrix is stored as binary and \e false otherwise.
-       */
-      static constexpr bool isBinary() { return std::is_same< Real, bool >::value; };
-
-      /**
-       * \brief The type of matrix elements.
-       */
-      using RealType = std::remove_const_t< Real >;
-
-      /**
-       * \brief The device where the matrix is allocated.
-       */
-      using DeviceType = Device;
-
-      /**
-       * \brief The type used for matrix elements indexing.
-       */
-      using IndexType = Index;
-
-      /**
-       * \brief The allocator for matrix elements values.
-       */
-      using RealAllocatorType = RealAllocator;
-
-      /**
-       * \brief The allocator for matrix elements column indexes.
-       */
-      using IndexAllocatorType = IndexAllocator;
-
-      /**
-       * \brief Type of related matrix view.
-       *
-       * See \ref SparseSandboxMatrixView.
-       */
-      using ViewType = SparseSandboxMatrixView< Real, Device, Index, MatrixType >;
-
-      /**
-       * \brief Matrix view type for constant instances.
-       *
-       * See \ref SparseSandboxMatrixView.
-       */
-      using ConstViewType = SparseSandboxMatrixView< std::add_const_t< Real >, Device, Index, MatrixType >;
-
-      /**
-       * \brief Type for accessing matrix rows.
-       */
-      using RowView = SparseSandboxMatrixRowView< ValuesViewType, ColumnsIndexesViewType, isBinary() >;
-
-      /**
-       * \brief Type for accessing constant matrix rows.
-       */
-      using ConstRowView = SparseSandboxMatrixRowView< ConstValuesViewType, ConstColumnsIndexesViewType, isBinary() >;;
-
-      /**
-       * \brief Helper type for getting self type or its modifications.
-       */
-      template< typename _Real = Real,
-                typename _Device = Device,
-                typename _Index = Index,
-                typename _MatrixType = MatrixType,
-                typename _RealAllocator = typename Allocators::Default< _Device >::template Allocator< _Real >,
-                typename _IndexAllocator = typename Allocators::Default< _Device >::template Allocator< _Index > >
-      using Self = SparseSandboxMatrix< _Real, _Device, _Index, _MatrixType, _RealAllocator, _IndexAllocator >;
-
-      /**
-       * \brief Type of container for CSR row pointers.
-       *
-       * SANDBOX_TODO: You may replace it with containers for metadata of your format.
-       */
-      using RowPointers = TNL::Containers::Vector< IndexType, DeviceType, IndexType >;
-
-      /**
-       * \brief Constructor only with values and column indexes allocators.
-       *
-       * \param realAllocator is used for allocation of matrix elements values.
-       * \param indexAllocator is used for allocation of matrix elements column indexes.
-       */
-      SparseSandboxMatrix( const RealAllocatorType& realAllocator = RealAllocatorType(),
-                           const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
-
-      /**
-       * \brief Copy constructor.
-       *
-       * \param matrix is the source matrix
-       */
-      SparseSandboxMatrix( const SparseSandboxMatrix& matrix1 ) = default;
-
-      /**
-       * \brief Move constructor.
-       *
-       * \param matrix is the source matrix
-       */
-      SparseSandboxMatrix( SparseSandboxMatrix&& matrix ) = default;
-
-      /**
-       * \brief Constructor with matrix dimensions.
-       *
-       * \param rows is number of matrix rows.
-       * \param columns is number of matrix columns.
-       * \param realAllocator is used for allocation of matrix elements values.
-       * \param indexAllocator is used for allocation of matrix elements column indexes.
-       */
-      template< typename Index_t, std::enable_if_t< std::is_integral< Index_t >::value, int > = 0 >
-      SparseSandboxMatrix( const Index_t rows,
-                           const Index_t columns,
-                           const RealAllocatorType& realAllocator = RealAllocatorType(),
-                           const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
-
-      /**
-       * \brief Constructor with matrix rows capacities and number of columns.
-       *
-       * The number of matrix rows is given by the size of \e rowCapacities list.
-       *
-       * \tparam ListIndex is the initializer list values type.
-       * \param rowCapacities is a list telling how many matrix elements must be
-       *    allocated in each row.
-       * \param columns is the number of matrix columns.
-       * \param realAllocator is used for allocation of matrix elements values.
-       * \param indexAllocator is used for allocation of matrix elements column indexes.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_Constructor_init_list_1.cpp
-       * \par Output
-       * \include SparseMatrixExample_Constructor_init_list_1.out
-       */
-      template< typename ListIndex >
-      explicit SparseSandboxMatrix( const std::initializer_list< ListIndex >& rowCapacities,
-                                    const IndexType columns,
-                                    const RealAllocatorType& realAllocator = RealAllocatorType(),
-                                    const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
-
-      /**
-       * \brief Constructor with matrix rows capacities given as a vector and number of columns.
-       *
-       * The number of matrix rows is given by the size of \e rowCapacities vector.
-       *
-       * \tparam RowCapacitiesVector is the row capacities vector type. Usually it is some of
-       *    \ref TNL::Containers::Array, \ref TNL::Containers::ArrayView, \ref TNL::Containers::Vector or
-       *    \ref TNL::Containers::VectorView.
-       * \param rowCapacities is a vector telling how many matrix elements must be
-       *    allocated in each row.
-       * \param columns is the number of matrix columns.
-       * \param realAllocator is used for allocation of matrix elements values.
-       * \param indexAllocator is used for allocation of matrix elements column indexes.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_Constructor_rowCapacities_vector.cpp
-       * \par Output
-       * \include SparseMatrixExample_Constructor_rowCapacities_vector.out
-       */
-      template< typename RowCapacitiesVector, std::enable_if_t< TNL::IsArrayType< RowCapacitiesVector >::value, int > = 0 >
-      explicit SparseSandboxMatrix( const RowCapacitiesVector& rowCapacities,
-                                    const IndexType columns,
-                                    const RealAllocatorType& realAllocator = RealAllocatorType(),
-                                    const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
-
-      /**
-       * \brief Constructor with matrix dimensions and data in initializer list.
-       *
-       * The matrix elements values are given as a list \e data of triples:
-       * { { row1, column1, value1 },
-       *   { row2, column2, value2 },
-       * ... }.
-       *
-       * \param rows is number of matrix rows.
-       * \param columns is number of matrix columns.
-       * \param data is a list of matrix elements values.
-       * \param realAllocator is used for allocation of matrix elements values.
-       * \param indexAllocator is used for allocation of matrix elements column indexes.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_Constructor_init_list_2.cpp
-       * \par Output
-       * \include SparseMatrixExample_Constructor_init_list_2.out
-       */
-      explicit SparseSandboxMatrix( const IndexType rows,
-                                    const IndexType columns,
-                                    const std::initializer_list< std::tuple< IndexType, IndexType, RealType > >& data,
-                                    const RealAllocatorType& realAllocator = RealAllocatorType(),
-                                    const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
-
-      /**
-       * \brief Constructor with matrix dimensions and data in std::map.
-       *
-       * The matrix elements values are given as a map \e data where keys are
-       * std::pair of matrix coordinates ( {row, column} ) and value is the
-       * matrix element value.
-       *
-       * \tparam MapIndex is a type for indexing rows and columns.
-       * \tparam MapValue is a type for matrix elements values in the map.
-       *
-       * \param rows is number of matrix rows.
-       * \param columns is number of matrix columns.
-       * \param map is std::map containing matrix elements.
-       * \param realAllocator is used for allocation of matrix elements values.
-       * \param indexAllocator is used for allocation of matrix elements column indexes.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_Constructor_std_map.cpp
-       * \par Output
-       * \include SparseMatrixExample_Constructor_std_map.out
-       */
-      template< typename MapIndex,
-                typename MapValue >
-      explicit SparseSandboxMatrix( const IndexType rows,
-                                    const IndexType columns,
-                                    const std::map< std::pair< MapIndex, MapIndex >, MapValue >& map,
-                                    const RealAllocatorType& realAllocator = RealAllocatorType(),
-                                    const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
-
-      /**
-       * \brief Returns a modifiable view of the sparse matrix.
-       *
-       * See \ref SparseSandboxMatrixView.
-       *
-       * \return sparse matrix view.
-       */
-      ViewType getView() const; // TODO: remove const
-
-      /**
-       * \brief Returns a non-modifiable view of the sparse matrix.
-       *
-       * See \ref SparseSandboxMatrixView.
-       *
-       * \return sparse matrix view.
-       */
-      ConstViewType getConstView() const;
-
-      /**
-       * \brief Returns string with serialization type.
-       *
-       * The string has a form `Matrices::SparseSandboxMatrix< RealType,  [any_device], IndexType, General/Symmetric, Format, [any_allocator] >`.
-       *
-       * \return \ref String with the serialization type.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_getSerializationType.cpp
-       * \par Output
-       * \include SparseMatrixExample_getSerializationType.out
-       */
-      static String getSerializationType();
-
-      /**
-       * \brief Returns string with serialization type.
-       *
-       * See \ref SparseSandboxMatrix::getSerializationType.
-       *
-       * \return \e String with the serialization type.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_getSerializationType.cpp
-       * \par Output
-       * \include SparseMatrixExample_getSerializationType.out
-       */
-      virtual String getSerializationTypeVirtual() const override;
-
-      /**
-       * \brief Set number of rows and columns of this matrix.
-       *
-       * \param rows is the number of matrix rows.
-       * \param columns is the number of matrix columns.
-       */
-      virtual void setDimensions( const IndexType rows,
-                                  const IndexType columns ) override;
-
-      /**
-       * \brief Set the number of matrix rows and columns by the given matrix.
-       *
-       * \tparam Matrix is matrix type. This can be any matrix having methods
-       *  \ref getRows and \ref getColumns.
-       *
-       * \param matrix in the input matrix dimensions of which are to be adopted.
-       */
-      template< typename Matrix >
-      void setLike( const Matrix& matrix );
-
-      /**
-       * \brief Allocates memory for non-zero matrix elements.
-       *
-       * The size of the input vector must be equal to the number of matrix rows.
-       * The number of allocated matrix elements for each matrix row depends on
-       * the sparse matrix format. Some formats may allocate more elements than
-       * required.
-       *
-       * \tparam RowsCapacitiesVector is a type of vector/array used for row
-       *    capacities setting.
-       *
-       * \param rowCapacities is a vector telling the number of required non-zero
-       *    matrix elements in each row.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_setRowCapacities.cpp
-       * \par Output
-       * \include SparseMatrixExample_setRowCapacities.out
-       */
-      template< typename RowsCapacitiesVector >
-      void setRowCapacities( const RowsCapacitiesVector& rowCapacities );
-
-      /**
-       * \brief Compute capacities of all rows.
-       *
-       * The row capacities are not stored explicitly and must be computed.
-       *
-       * \param rowCapacities is a vector where the row capacities will be stored.
-       */
-      template< typename Vector >
-      void getRowCapacities( Vector& rowCapacities ) const;
-
-      /**
-       * \brief This method sets the sparse matrix elements from initializer list.
-       *
-       * The number of matrix rows and columns must be set already.
-       * The matrix elements values are given as a list \e data of triples:
-       * { { row1, column1, value1 },
-       *   { row2, column2, value2 },
-       * ... }.
-       *
-       * \param data is a initializer list of initializer lists representing
-       * list of matrix rows.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_setElements.cpp
-       * \par Output
-       * \include SparseMatrixExample_setElements.out
-       */
-      void setElements( const std::initializer_list< std::tuple< IndexType, IndexType, RealType > >& data );
-
-      /**
-       * \brief This method sets the sparse matrix elements from std::map.
-       *
-       * The matrix elements values are given as a map \e data where keys are
-       * std::pair of matrix coordinates ( {row, column} ) and value is the
-       * matrix element value.
-       *
-       * \tparam MapIndex is a type for indexing rows and columns.
-       * \tparam MapValue is a type for matrix elements values in the map.
-       *
-       * \param map is std::map containing matrix elements.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_setElements_map.cpp
-       * \par Output
-       * \include SparseMatrixExample_setElements_map.out
-       */
-      template< typename MapIndex,
-                typename MapValue >
-      void setElements( const std::map< std::pair< MapIndex, MapIndex > , MapValue >& map );
-
-      /**
-       * \brief Computes number of non-zeros in each row.
-       *
-       * \param rowLengths is a vector into which the number of non-zeros in each row
-       * will be stored.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_getCompressedRowLengths.cpp
-       * \par Output
-       * \include SparseMatrixExample_getCompressedRowLengths.out
-       */
-      template< typename Vector >
-      void getCompressedRowLengths( Vector& rowLengths ) const;
-
-
-      /**
-       * \brief Returns capacity of given matrix row.
-       *
-       * \param row index of matrix row.
-       * \return number of matrix elements allocated for the row.
-       */
-      __cuda_callable__
-      IndexType getRowCapacity( const IndexType row ) const;
-
-      /**
-       * \brief Returns number of non-zero matrix elements.
-       *
-       * This method really counts the non-zero matrix elements and so
-       * it returns zero for matrix having all allocated elements set to zero.
-       *
-       * \return number of non-zero matrix elements.
-       */
-      IndexType getNonzeroElementsCount() const;
-
-      /**
-       * \brief Resets the matrix to zero dimensions.
-       */
-      void reset();
-
-      /**
-       * \brief Constant getter of simple structure for accessing given matrix row.
-       *
-       * \param rowIdx is matrix row index.
-       *
-       * \return RowView for accessing given matrix row.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_getConstRow.cpp
-       * \par Output
-       * \include SparseMatrixExample_getConstRow.out
-       *
-       * See \ref SparseMatrixRowView.
-       */
-      __cuda_callable__
-      const ConstRowView getRow( const IndexType& rowIdx ) const;
-
-      /**
-       * \brief Non-constant getter of simple structure for accessing given matrix row.
-       *
-       * \param rowIdx is matrix row index.
-       *
-       * \return RowView for accessing given matrix row.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_getRow.cpp
-       * \par Output
-       * \include SparseMatrixExample_getRow.out
-       *
-       * See \ref SparseMatrixRowView.
-       */
-      __cuda_callable__
-      RowView getRow( const IndexType& rowIdx );
-
-      /**
-       * \brief Sets element at given \e row and \e column to given \e value.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref SparseMatrix::getRow
-       * or \ref SparseMatrix::forElements and \ref SparseMatrix::forAllElements.
-       * The call may fail if the matrix row capacity is exhausted.
-       *
-       * \param row is row index of the element.
-       * \param column is columns index of the element.
-       * \param value is the value the element will be set to.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_setElement.cpp
-       * \par Output
-       * \include SparseMatrixExample_setElement.out
-       */
-      __cuda_callable__
-      void setElement( const IndexType row,
-                       const IndexType column,
-                       const RealType& value );
-
-      /**
-       * \brief Add element at given \e row and \e column to given \e value.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref SparseMatrix::getRow
-       * or \ref SparseMatrix::forElements and \ref SparseMatrix::forAllElements.
-       * The call may fail if the matrix row capacity is exhausted.
-       *
-       * \param row is row index of the element.
-       * \param column is columns index of the element.
-       * \param value is the value the element will be set to.
-       * \param thisElementMultiplicator is multiplicator the original matrix element
-       *   value is multiplied by before addition of given \e value.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_addElement.cpp
-       * \par Output
-       * \include SparseMatrixExample_addElement.out
-       *
-       */
-      __cuda_callable__
-      void addElement( const IndexType row,
-                       const IndexType column,
-                       const RealType& value,
-                       const RealType& thisElementMultiplicator );
-
-      /**
-       * \brief Returns value of matrix element at position given by its row and column index.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref SparseMatrix::getRow
-       * or \ref SparseMatrix::forElements and \ref SparseMatrix::forAllElements.
-       *
-       * \param row is a row index of the matrix element.
-       * \param column i a column index of the matrix element.
-       *
-       * \return value of given matrix element.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_getElement.cpp
-       * \par Output
-       * \include SparseMatrixExample_getElement.out
-       *
-       */
-      __cuda_callable__
-      RealType getElement( const IndexType row,
-                           const IndexType column ) const;
-
-      /**
-       * \brief Method for performing general reduction on matrix rows.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *          `fetch( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue`.
-       *          The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *          `reduce( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue`.
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row.
-       *          It is declared as `keep( const IndexType rowIdx, const double& value )`.
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param zero is zero of given reduction operation also known as idempotent element.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_reduceRows.cpp
-       * \par Output
-       * \include SparseMatrixExample_reduceRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& zero );
-
-      /**
-       * \brief Method for performing general reduction on matrix rows for constant instances.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *          `fetch( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue`.
-       *          The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *          `reduce( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue`.
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row.
-       *          It is declared as `keep( const IndexType rowIdx, const double& value )`.
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param zero is zero of given reduction operation also known as idempotent element.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_reduceRows.cpp
-       * \par Output
-       * \include SparseMatrixExample_reduceRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& zero ) const;
-
-      /**
-       * \brief Method for performing general reduction on all matrix rows.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *          `fetch( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue`.
-       *          The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *          `reduce( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue`.
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row.
-       *          It is declared as `keep( const IndexType rowIdx, const double& value )`.
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param zero is zero of given reduction operation also known as idempotent element.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_reduceAllRows.cpp
-       * \par Output
-       * \include SparseMatrixExample_reduceAllRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceAllRows( Fetch&& fetch, const Reduce&& reduce, Keep&& keep, const FetchReal& zero );
-
-      /**
-       * \brief Method for performing general reduction on all matrix rows for constant instances.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *          `fetch( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue`.
-       *          The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *          `reduce( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue`.
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row.
-       *          It is declared as `keep( const IndexType rowIdx, const double& value )`.
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param zero is zero of given reduction operation also known as idempotent element.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_reduceAllRows.cpp
-       * \par Output
-       * \include SparseMatrixExample_reduceAllRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& zero ) const;
-
-      /**
-       * \brief Method for parallel iteration over matrix elements of given rows for constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for element of given rows.
-       *
-       * The lambda function `function` should be declared like follows:
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value ) { ... };
-       * ```
-       *
-       *  The \e localIdx parameter is a rank of the non-zero element in given row.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_forElements.cpp
-       * \par Output
-       * \include SparseMatrixExample_forElements.out
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function&& function ) const;
-
-      /**
-       * \brief Method for parallel iteration over all matrix elements of given rows for non-constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for each element of given rows.
-       *
-       * The lambda function `function` should be declared like follows:
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value ) mutable { ... }
-       * ```
-       *
-       *  The \e localIdx parameter is a rank of the non-zero element in given row.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_forElements.cpp
-       * \par Output
-       * \include SparseMatrixExample_forElements.out
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over all matrix elements for constant instances.
-       *
-       * See \ref SparseMatrix::forElements.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called for each matrix element.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_forElements.cpp
-       * \par Output
-       * \include SparseMatrixExample_forElements.out
-       */
-      template< typename Function >
-      void forAllElements( Function&& function ) const;
-
-      /**
-       * \brief Method for parallel iteration over all matrix elements for non-constant instances.
-       *
-       * See \ref SparseMatrix::forElements.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called for each matrix element.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_forElements.cpp
-       * \par Output
-       * \include SparseMatrixExample_forElements.out
-       */
-      template< typename Function >
-      void forAllElements( Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end).
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref SparseMatrix::forElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrix::RowView.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_forRows.cpp
-       * \par Output
-       * \include SparseMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forRows( IndexType begin, IndexType end, Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end) for constant instances.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref SparseMatrix::forElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrix::RowView.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_forRows.cpp
-       * \par Output
-       * \include SparseMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forRows( IndexType begin, IndexType end, Function&& function ) const;
-
-      /**
-       * \brief Method for parallel iteration over all matrix rows.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref SparseMatrix::forAllElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrix::RowView.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_forRows.cpp
-       * \par Output
-       * \include SparseMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forAllRows( Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over all matrix rows for constant instances.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref SparseMatrix::forAllElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrix::RowView.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_forRows.cpp
-       * \par Output
-       * \include SparseMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forAllRows( Function&& function ) const;
-
-      /**
-       * \brief Method for sequential iteration over all matrix rows for constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements.
-       *    It is should have form like
-       *  `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value )`.
-       *  The column index repeats twice only for compatibility with sparse matrices.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForRows( IndexType begin, IndexType end, Function& function ) const;
-
-      /**
-       * \brief Method for sequential iteration over all matrix rows for non-constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements.
-       *    It is should have form like
-       *  `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value )`.
-       *  The column index repeats twice only for compatibility with sparse matrices.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForRows( IndexType begin, IndexType end, Function& function );
-
-      /**
-       * \brief This method calls \e sequentialForRows for all matrix rows (for constant instances).
-       *
-       * See \ref SparseMatrix::sequentialForRows.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForAllRows( Function& function ) const;
-
-      /**
-       * \brief This method calls \e sequentialForRows for all matrix rows.
-       *
-       * See \ref SparseMatrix::sequentialForAllRows.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForAllRows( Function& function );
-
-      /**
-       * \brief Computes product of matrix and vector.
-       *
-       * More precisely, it computes:
-       *
-       * `outVector = matrixMultiplicator * ( * this ) * inVector + outVectorMultiplicator * outVector`
-       *
-       * \tparam InVector is type of input vector.  It can be \ref Vector,
-       *     \ref VectorView, \ref Array, \ref ArraView or similar container.
-       * \tparam OutVector is type of output vector. It can be \ref Vector,
-       *     \ref VectorView, \ref Array, \ref ArraView or similar container.
-       *
-       * \param inVector is input vector.
-       * \param outVector is output vector.
-       * \param matrixMultiplicator is a factor by which the matrix is multiplied. It is one by default.
-       * \param outVectorMultiplicator is a factor by which the outVector is multiplied before added
-       *    to the result of matrix-vector product. It is zero by default.
-       * \param begin is the beginning of the rows range for which the vector product
-       *    is computed. It is zero by default.
-       * \param end is the end of the rows range for which the vector product
-       *    is computed. It is number if the matrix rows by default.
-       */
-      template< typename InVector,
-                typename OutVector >
-      void vectorProduct( const InVector& inVector,
-                          OutVector& outVector,
-                          const RealType& matrixMultiplicator = 1.0,
-                          const RealType& outVectorMultiplicator = 0.0,
-                          const IndexType firstRow = 0,
-                          const IndexType lastRow = 0 ) const;
-
-      /*template< typename Real2, typename Index2 >
-      void addMatrix( const SparseMatrix< Real2, Segments, Device, Index2 >& matrix,
-                      const RealType& matrixMultiplicator = 1.0,
-                      const RealType& thisMatrixMultiplicator = 1.0 );
-
-      template< typename Real2, typename Index2 >
-      void getTransposition( const SparseMatrix< Real2, Segments, Device, Index2 >& matrix,
-                             const RealType& matrixMultiplicator = 1.0 );
-       */
-
-      template< typename Vector1, typename Vector2 >
-      bool performSORIteration( const Vector1& b,
-                                const IndexType row,
-                                Vector2& x,
-                                const RealType& omega = 1.0 ) const;
-
-      /**
-       * \brief Assignment of exactly the same matrix type.
-       *
-       * \param matrix is input matrix for the assignment.
-       * \return reference to this matrix.
-       */
-      SparseSandboxMatrix& operator=( const SparseSandboxMatrix& matrix );
-
-      /**
-       * \brief Assignment of exactly the same matrix type but different device.
-       *
-       * \param matrix is input matrix for the assignment.
-       * \return reference to this matrix.
-       */
-      template< typename Device_ >
-      SparseSandboxMatrix& operator=( const SparseSandboxMatrix< RealType, Device_, IndexType, MatrixType, RealAllocator, IndexAllocator >& matrix );
-
-      /**
-       * \brief Assignment of dense matrix
-       *
-       * \param matrix is input matrix for the assignment.
-       * \return reference to this matrix.
-       */
-      template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization, typename RealAllocator_ >
-      SparseSandboxMatrix& operator=( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator_ >& matrix );
-
-
-      /**
-       * \brief Assignment of any matrix type other then this and dense.
-       *
-       * **Warning: Assignment of symmetric sparse matrix to general sparse matrix does not give correct result, currently. Only the diagonal and the lower part of the matrix is assigned.**
-       *
-       * \param matrix is input matrix for the assignment.
-       * \return reference to this matrix.
-       */
-      template< typename RHSMatrix >
-      SparseSandboxMatrix& operator=( const RHSMatrix& matrix );
-
-      /**
-       * \brief Comparison operator with another arbitrary matrix type.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return \e true if the RHS matrix is equal, \e false otherwise.
-       */
-      template< typename Matrix >
-      bool operator==( const Matrix& m ) const;
-
-      /**
-       * \brief Comparison operator with another arbitrary matrix type.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return \e true if the RHS matrix is equal, \e false otherwise.
-       */
-      template< typename Matrix >
-      bool operator!=( const Matrix& m ) const;
-
-      /**
-       * \brief Method for saving the matrix to the file with given filename.
-       *
-       * \param fileName is name of the file.
-       */
-      void save( const String& fileName ) const;
-
-      /**
-       * \brief Method for loading the matrix from the file with given filename.
-       *
-       * \param fileName is name of the file.
-       */
-      void load( const String& fileName );
-
-      /**
-       * \brief Method for saving the matrix to a file.
-       *
-       * \param file is the output file.
-       */
-      virtual void save( File& file ) const override;
-
-      /**
-       * \brief Method for loading the matrix from a file.
-       *
-       * \param file is the input file.
-       */
-      virtual void load( File& file ) override;
-
-      /**
-       * \brief Method for printing the matrix to output stream.
-       *
-       * \param str is the output stream.
-       */
-      virtual void print( std::ostream& str ) const override;
-
-      /**
-       * \brief Returns a padding index value.
-       *
-       * Padding index is used for column indexes of padding zeros. Padding zeros
-       * are used in some sparse matrix formats for better data alignment in memory.
-       *
-       * \return value of the padding index.
-       */
-      __cuda_callable__
-      IndexType getPaddingIndex() const;
-
-      /**
-       * \brief Getter of segments for non-constant instances.
-       *
-       * \e Segments are a structure for addressing the matrix elements columns and values.
-       * In fact, \e Segments represent the sparse matrix format.
-       *
-       * \return Non-constant reference to segments.
-       */
-      //SegmentsType& getSegments();
-
-      /**
-       * \brief Getter of segments for constant instances.
-       *
-       * \e Segments are a structure for addressing the matrix elements columns and values.
-       * In fact, \e Segments represent the sparse matrix format.
-       *
-       * \return Constant reference to segments.
-       */
-      //const SegmentsType& getSegments() const;
-
-      /**
-       * \brief Getter of column indexes for constant instances.
-       *
-       * \return Constant reference to a vector with matrix elements column indexes.
-       */
-      const ColumnsIndexesVectorType& getColumnIndexes() const;
-
-      /**
-       * \brief Getter of column indexes for nonconstant instances.
-       *
-       * \return Reference to a vector with matrix elements column indexes.
-       */
-      ColumnsIndexesVectorType& getColumnIndexes();
-
-   protected:
-
-      ColumnsIndexesVectorType columnIndexes;
-
-      IndexAllocator indexAllocator;
-
-      ViewType view;
-
-      /**
-       * \brief Container for CSR row pointers.
-       *
-       * SANDBOX_TODO: You may replace it with containers and metadata required by you format.
-       */
-
-      RowPointers rowPointers;
+      ! MatrixType::isSymmetric() || ! std::is_same< Device, Devices::Cuda >::value
+         || ( std::is_same< Real, float >::value || std::is_same< Real, double >::value || std::is_same< Real, int >::value
+              || std::is_same< Real, long long int >::value ),
+      "Given Real type is not supported by atomic operations on GPU which are necessary for symmetric operations." );
+
+public:
+   // Supporting types - they are not important for the user
+   using BaseType = Matrix< Real, Device, Index, RealAllocator >;
+   using ValuesVectorType = typename Matrix< Real, Device, Index, RealAllocator >::ValuesType;
+   using ValuesViewType = typename ValuesVectorType::ViewType;
+   using ConstValuesViewType = typename ValuesViewType::ConstViewType;
+   using ColumnsIndexesVectorType =
+      Containers::Vector< typename TNL::copy_const< Index >::template from< Real >::type, Device, Index, IndexAllocator >;
+   using ColumnsIndexesViewType = typename ColumnsIndexesVectorType::ViewType;
+   using ConstColumnsIndexesViewType = typename ColumnsIndexesViewType::ConstViewType;
+   using RowsCapacitiesType = Containers::Vector< std::remove_const_t< Index >, Device, Index, IndexAllocator >;
+   using RowsCapacitiesView = Containers::VectorView< std::remove_const_t< Index >, Device, Index >;
+   using ConstRowsCapacitiesView = typename RowsCapacitiesView::ConstViewType;
+
+   /**
+    * \brief Test of symmetric matrix type.
+    *
+    * \return \e true if the matrix is stored as symmetric and \e false otherwise.
+    */
+   static constexpr bool
+   isSymmetric()
+   {
+      return MatrixType::isSymmetric();
+   };
+
+   /**
+    * \brief Test of binary matrix type.
+    *
+    * \return \e true if the matrix is stored as binary and \e false otherwise.
+    */
+   static constexpr bool
+   isBinary()
+   {
+      return std::is_same< Real, bool >::value;
+   };
+
+   /**
+    * \brief The type of matrix elements.
+    */
+   using RealType = std::remove_const_t< Real >;
+
+   /**
+    * \brief The device where the matrix is allocated.
+    */
+   using DeviceType = Device;
+
+   /**
+    * \brief The type used for matrix elements indexing.
+    */
+   using IndexType = Index;
+
+   /**
+    * \brief The allocator for matrix elements values.
+    */
+   using RealAllocatorType = RealAllocator;
+
+   /**
+    * \brief The allocator for matrix elements column indexes.
+    */
+   using IndexAllocatorType = IndexAllocator;
+
+   /**
+    * \brief Type of related matrix view.
+    *
+    * See \ref SparseSandboxMatrixView.
+    */
+   using ViewType = SparseSandboxMatrixView< Real, Device, Index, MatrixType >;
+
+   /**
+    * \brief Matrix view type for constant instances.
+    *
+    * See \ref SparseSandboxMatrixView.
+    */
+   using ConstViewType = SparseSandboxMatrixView< std::add_const_t< Real >, Device, Index, MatrixType >;
+
+   /**
+    * \brief Type for accessing matrix rows.
+    */
+   using RowView = SparseSandboxMatrixRowView< ValuesViewType, ColumnsIndexesViewType, isBinary() >;
+
+   /**
+    * \brief Type for accessing constant matrix rows.
+    */
+   using ConstRowView = SparseSandboxMatrixRowView< ConstValuesViewType, ConstColumnsIndexesViewType, isBinary() >;
+   ;
+
+   /**
+    * \brief Helper type for getting self type or its modifications.
+    */
+   template< typename _Real = Real,
+             typename _Device = Device,
+             typename _Index = Index,
+             typename _MatrixType = MatrixType,
+             typename _RealAllocator = typename Allocators::Default< _Device >::template Allocator< _Real >,
+             typename _IndexAllocator = typename Allocators::Default< _Device >::template Allocator< _Index > >
+   using Self = SparseSandboxMatrix< _Real, _Device, _Index, _MatrixType, _RealAllocator, _IndexAllocator >;
+
+   /**
+    * \brief Type of container for CSR row pointers.
+    *
+    * SANDBOX_TODO: You may replace it with containers for metadata of your format.
+    */
+   using RowPointers = TNL::Containers::Vector< IndexType, DeviceType, IndexType >;
+
+   /**
+    * \brief Constructor only with values and column indexes allocators.
+    *
+    * \param realAllocator is used for allocation of matrix elements values.
+    * \param indexAllocator is used for allocation of matrix elements column indexes.
+    */
+   SparseSandboxMatrix( const RealAllocatorType& realAllocator = RealAllocatorType(),
+                        const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
+
+   /**
+    * \brief Copy constructor.
+    *
+    * \param matrix is the source matrix
+    */
+   SparseSandboxMatrix( const SparseSandboxMatrix& matrix1 ) = default;
+
+   /**
+    * \brief Move constructor.
+    *
+    * \param matrix is the source matrix
+    */
+   SparseSandboxMatrix( SparseSandboxMatrix&& matrix ) noexcept = default;
+
+   /**
+    * \brief Constructor with matrix dimensions.
+    *
+    * \param rows is number of matrix rows.
+    * \param columns is number of matrix columns.
+    * \param realAllocator is used for allocation of matrix elements values.
+    * \param indexAllocator is used for allocation of matrix elements column indexes.
+    */
+   template< typename Index_t, std::enable_if_t< std::is_integral< Index_t >::value, int > = 0 >
+   SparseSandboxMatrix( Index_t rows,
+                        Index_t columns,
+                        const RealAllocatorType& realAllocator = RealAllocatorType(),
+                        const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
+
+   /**
+    * \brief Constructor with matrix rows capacities and number of columns.
+    *
+    * The number of matrix rows is given by the size of \e rowCapacities list.
+    *
+    * \tparam ListIndex is the initializer list values type.
+    * \param rowCapacities is a list telling how many matrix elements must be
+    *    allocated in each row.
+    * \param columns is the number of matrix columns.
+    * \param realAllocator is used for allocation of matrix elements values.
+    * \param indexAllocator is used for allocation of matrix elements column indexes.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_Constructor_init_list_1.cpp
+    * \par Output
+    * \include SparseMatrixExample_Constructor_init_list_1.out
+    */
+   template< typename ListIndex >
+   explicit SparseSandboxMatrix( const std::initializer_list< ListIndex >& rowCapacities,
+                                 IndexType columns,
+                                 const RealAllocatorType& realAllocator = RealAllocatorType(),
+                                 const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
+
+   /**
+    * \brief Constructor with matrix rows capacities given as a vector and number of columns.
+    *
+    * The number of matrix rows is given by the size of \e rowCapacities vector.
+    *
+    * \tparam RowCapacitiesVector is the row capacities vector type. Usually it is some of
+    *    \ref TNL::Containers::Array, \ref TNL::Containers::ArrayView, \ref TNL::Containers::Vector or
+    *    \ref TNL::Containers::VectorView.
+    * \param rowCapacities is a vector telling how many matrix elements must be
+    *    allocated in each row.
+    * \param columns is the number of matrix columns.
+    * \param realAllocator is used for allocation of matrix elements values.
+    * \param indexAllocator is used for allocation of matrix elements column indexes.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_Constructor_rowCapacities_vector.cpp
+    * \par Output
+    * \include SparseMatrixExample_Constructor_rowCapacities_vector.out
+    */
+   template< typename RowCapacitiesVector, std::enable_if_t< TNL::IsArrayType< RowCapacitiesVector >::value, int > = 0 >
+   explicit SparseSandboxMatrix( const RowCapacitiesVector& rowCapacities,
+                                 IndexType columns,
+                                 const RealAllocatorType& realAllocator = RealAllocatorType(),
+                                 const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
+
+   /**
+    * \brief Constructor with matrix dimensions and data in initializer list.
+    *
+    * The matrix elements values are given as a list \e data of triples:
+    * { { row1, column1, value1 },
+    *   { row2, column2, value2 },
+    * ... }.
+    *
+    * \param rows is number of matrix rows.
+    * \param columns is number of matrix columns.
+    * \param data is a list of matrix elements values.
+    * \param realAllocator is used for allocation of matrix elements values.
+    * \param indexAllocator is used for allocation of matrix elements column indexes.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_Constructor_init_list_2.cpp
+    * \par Output
+    * \include SparseMatrixExample_Constructor_init_list_2.out
+    */
+   explicit SparseSandboxMatrix( IndexType rows,
+                                 IndexType columns,
+                                 const std::initializer_list< std::tuple< IndexType, IndexType, RealType > >& data,
+                                 const RealAllocatorType& realAllocator = RealAllocatorType(),
+                                 const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
+
+   /**
+    * \brief Constructor with matrix dimensions and data in std::map.
+    *
+    * The matrix elements values are given as a map \e data where keys are
+    * std::pair of matrix coordinates ( {row, column} ) and value is the
+    * matrix element value.
+    *
+    * \tparam MapIndex is a type for indexing rows and columns.
+    * \tparam MapValue is a type for matrix elements values in the map.
+    *
+    * \param rows is number of matrix rows.
+    * \param columns is number of matrix columns.
+    * \param map is std::map containing matrix elements.
+    * \param realAllocator is used for allocation of matrix elements values.
+    * \param indexAllocator is used for allocation of matrix elements column indexes.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_Constructor_std_map.cpp
+    * \par Output
+    * \include SparseMatrixExample_Constructor_std_map.out
+    */
+   template< typename MapIndex, typename MapValue >
+   explicit SparseSandboxMatrix( IndexType rows,
+                                 IndexType columns,
+                                 const std::map< std::pair< MapIndex, MapIndex >, MapValue >& map,
+                                 const RealAllocatorType& realAllocator = RealAllocatorType(),
+                                 const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
+
+   /**
+    * \brief Returns a modifiable view of the sparse matrix.
+    *
+    * See \ref SparseSandboxMatrixView.
+    *
+    * \return sparse matrix view.
+    */
+   ViewType
+   getView() const;  // TODO: remove const
+
+   /**
+    * \brief Returns a non-modifiable view of the sparse matrix.
+    *
+    * See \ref SparseSandboxMatrixView.
+    *
+    * \return sparse matrix view.
+    */
+   ConstViewType
+   getConstView() const;
+
+   /**
+    * \brief Returns string with serialization type.
+    *
+    * The string has a form `Matrices::SparseSandboxMatrix< RealType,  [any_device], IndexType, General/Symmetric, Format,
+    * [any_allocator] >`.
+    *
+    * \return \ref String with the serialization type.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_getSerializationType.cpp
+    * \par Output
+    * \include SparseMatrixExample_getSerializationType.out
+    */
+   static std::string
+   getSerializationType();
+
+   /**
+    * \brief Returns string with serialization type.
+    *
+    * See \ref SparseSandboxMatrix::getSerializationType.
+    *
+    * \return \e String with the serialization type.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_getSerializationType.cpp
+    * \par Output
+    * \include SparseMatrixExample_getSerializationType.out
+    */
+   std::string
+   getSerializationTypeVirtual() const override;
+
+   /**
+    * \brief Set number of rows and columns of this matrix.
+    *
+    * \param rows is the number of matrix rows.
+    * \param columns is the number of matrix columns.
+    */
+   void
+   setDimensions( IndexType rows, IndexType columns ) override;
+
+   /**
+    * \brief Set the number of matrix rows and columns by the given matrix.
+    *
+    * \tparam Matrix is matrix type. This can be any matrix having methods
+    *  \ref getRows and \ref getColumns.
+    *
+    * \param matrix in the input matrix dimensions of which are to be adopted.
+    */
+   template< typename Matrix >
+   void
+   setLike( const Matrix& matrix );
+
+   /**
+    * \brief Allocates memory for non-zero matrix elements.
+    *
+    * The size of the input vector must be equal to the number of matrix rows.
+    * The number of allocated matrix elements for each matrix row depends on
+    * the sparse matrix format. Some formats may allocate more elements than
+    * required.
+    *
+    * \tparam RowsCapacitiesVector is a type of vector/array used for row
+    *    capacities setting.
+    *
+    * \param rowCapacities is a vector telling the number of required non-zero
+    *    matrix elements in each row.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_setRowCapacities.cpp
+    * \par Output
+    * \include SparseMatrixExample_setRowCapacities.out
+    */
+   template< typename RowsCapacitiesVector >
+   void
+   setRowCapacities( const RowsCapacitiesVector& rowCapacities );
+
+   /**
+    * \brief Compute capacities of all rows.
+    *
+    * The row capacities are not stored explicitly and must be computed.
+    *
+    * \param rowCapacities is a vector where the row capacities will be stored.
+    */
+   template< typename Vector >
+   void
+   getRowCapacities( Vector& rowCapacities ) const;
+
+   /**
+    * \brief This method sets the sparse matrix elements from initializer list.
+    *
+    * The number of matrix rows and columns must be set already.
+    * The matrix elements values are given as a list \e data of triples:
+    * { { row1, column1, value1 },
+    *   { row2, column2, value2 },
+    * ... }.
+    *
+    * \param data is a initializer list of initializer lists representing
+    * list of matrix rows.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_setElements.cpp
+    * \par Output
+    * \include SparseMatrixExample_setElements.out
+    */
+   void
+   setElements( const std::initializer_list< std::tuple< IndexType, IndexType, RealType > >& data );
+
+   /**
+    * \brief This method sets the sparse matrix elements from std::map.
+    *
+    * The matrix elements values are given as a map \e data where keys are
+    * std::pair of matrix coordinates ( {row, column} ) and value is the
+    * matrix element value.
+    *
+    * \tparam MapIndex is a type for indexing rows and columns.
+    * \tparam MapValue is a type for matrix elements values in the map.
+    *
+    * \param map is std::map containing matrix elements.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_setElements_map.cpp
+    * \par Output
+    * \include SparseMatrixExample_setElements_map.out
+    */
+   template< typename MapIndex, typename MapValue >
+   void
+   setElements( const std::map< std::pair< MapIndex, MapIndex >, MapValue >& map );
+
+   /**
+    * \brief Computes number of non-zeros in each row.
+    *
+    * \param rowLengths is a vector into which the number of non-zeros in each row
+    * will be stored.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_getCompressedRowLengths.cpp
+    * \par Output
+    * \include SparseMatrixExample_getCompressedRowLengths.out
+    */
+   template< typename Vector >
+   void
+   getCompressedRowLengths( Vector& rowLengths ) const;
+
+   /**
+    * \brief Returns capacity of given matrix row.
+    *
+    * \param row index of matrix row.
+    * \return number of matrix elements allocated for the row.
+    */
+   __cuda_callable__
+   IndexType
+   getRowCapacity( IndexType row ) const;
+
+   /**
+    * \brief Returns number of non-zero matrix elements.
+    *
+    * This method really counts the non-zero matrix elements and so
+    * it returns zero for matrix having all allocated elements set to zero.
+    *
+    * \return number of non-zero matrix elements.
+    */
+   IndexType
+   getNonzeroElementsCount() const override;
+
+   /**
+    * \brief Resets the matrix to zero dimensions.
+    */
+   void
+   reset();
+
+   /**
+    * \brief Constant getter of simple structure for accessing given matrix row.
+    *
+    * \param rowIdx is matrix row index.
+    *
+    * \return RowView for accessing given matrix row.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_getConstRow.cpp
+    * \par Output
+    * \include SparseMatrixExample_getConstRow.out
+    *
+    * See \ref SparseMatrixRowView.
+    */
+   __cuda_callable__
+   const ConstRowView
+   getRow( const IndexType& rowIdx ) const;
+
+   /**
+    * \brief Non-constant getter of simple structure for accessing given matrix row.
+    *
+    * \param rowIdx is matrix row index.
+    *
+    * \return RowView for accessing given matrix row.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_getRow.cpp
+    * \par Output
+    * \include SparseMatrixExample_getRow.out
+    *
+    * See \ref SparseMatrixRowView.
+    */
+   __cuda_callable__
+   RowView
+   getRow( const IndexType& rowIdx );
+
+   /**
+    * \brief Sets element at given \e row and \e column to given \e value.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref SparseMatrix::getRow
+    * or \ref SparseMatrix::forElements and \ref SparseMatrix::forAllElements.
+    * The call may fail if the matrix row capacity is exhausted.
+    *
+    * \param row is row index of the element.
+    * \param column is columns index of the element.
+    * \param value is the value the element will be set to.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_setElement.cpp
+    * \par Output
+    * \include SparseMatrixExample_setElement.out
+    */
+   __cuda_callable__
+   void
+   setElement( IndexType row, IndexType column, const RealType& value );
+
+   /**
+    * \brief Add element at given \e row and \e column to given \e value.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref SparseMatrix::getRow
+    * or \ref SparseMatrix::forElements and \ref SparseMatrix::forAllElements.
+    * The call may fail if the matrix row capacity is exhausted.
+    *
+    * \param row is row index of the element.
+    * \param column is columns index of the element.
+    * \param value is the value the element will be set to.
+    * \param thisElementMultiplicator is multiplicator the original matrix element
+    *   value is multiplied by before addition of given \e value.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_addElement.cpp
+    * \par Output
+    * \include SparseMatrixExample_addElement.out
+    *
+    */
+   __cuda_callable__
+   void
+   addElement( IndexType row, IndexType column, const RealType& value, const RealType& thisElementMultiplicator );
+
+   /**
+    * \brief Returns value of matrix element at position given by its row and column index.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref SparseMatrix::getRow
+    * or \ref SparseMatrix::forElements and \ref SparseMatrix::forAllElements.
+    *
+    * \param row is a row index of the matrix element.
+    * \param column i a column index of the matrix element.
+    *
+    * \return value of given matrix element.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_getElement.cpp
+    * \par Output
+    * \include SparseMatrixExample_getElement.out
+    *
+    */
+   __cuda_callable__
+   RealType
+   getElement( IndexType row, IndexType column ) const;
+
+   /**
+    * \brief Method for performing general reduction on matrix rows.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *          `fetch( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue`.
+    *          The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *          `reduce( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue`.
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row.
+    *          It is declared as `keep( const IndexType rowIdx, const double& value )`.
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param zero is zero of given reduction operation also known as idempotent element.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_reduceRows.cpp
+    * \par Output
+    * \include SparseMatrixExample_reduceRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& zero );
+
+   /**
+    * \brief Method for performing general reduction on matrix rows for constant instances.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *          `fetch( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue`.
+    *          The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *          `reduce( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue`.
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row.
+    *          It is declared as `keep( const IndexType rowIdx, const double& value )`.
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param zero is zero of given reduction operation also known as idempotent element.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_reduceRows.cpp
+    * \par Output
+    * \include SparseMatrixExample_reduceRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& zero ) const;
+
+   /**
+    * \brief Method for performing general reduction on all matrix rows.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *          `fetch( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue`.
+    *          The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *          `reduce( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue`.
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row.
+    *          It is declared as `keep( const IndexType rowIdx, const double& value )`.
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param zero is zero of given reduction operation also known as idempotent element.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_reduceAllRows.cpp
+    * \par Output
+    * \include SparseMatrixExample_reduceAllRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceAllRows( Fetch&& fetch, const Reduce&& reduce, Keep&& keep, const FetchReal& zero );
+
+   /**
+    * \brief Method for performing general reduction on all matrix rows for constant instances.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *          `fetch( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue`.
+    *          The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *          `reduce( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue`.
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row.
+    *          It is declared as `keep( const IndexType rowIdx, const double& value )`.
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param zero is zero of given reduction operation also known as idempotent element.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_reduceAllRows.cpp
+    * \par Output
+    * \include SparseMatrixExample_reduceAllRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& zero ) const;
+
+   /**
+    * \brief Method for parallel iteration over matrix elements of given rows for constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for element of given rows.
+    *
+    * The lambda function `function` should be declared like follows:
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )
+    * { ... };
+    * ```
+    *
+    *  The \e localIdx parameter is a rank of the non-zero element in given row.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_forElements.cpp
+    * \par Output
+    * \include SparseMatrixExample_forElements.out
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function&& function ) const;
+
+   /**
+    * \brief Method for parallel iteration over all matrix elements of given rows for non-constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for each element of given rows.
+    *
+    * The lambda function `function` should be declared like follows:
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )
+    * mutable { ... }
+    * ```
+    *
+    *  The \e localIdx parameter is a rank of the non-zero element in given row.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_forElements.cpp
+    * \par Output
+    * \include SparseMatrixExample_forElements.out
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over all matrix elements for constant instances.
+    *
+    * See \ref SparseMatrix::forElements.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called for each matrix element.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_forElements.cpp
+    * \par Output
+    * \include SparseMatrixExample_forElements.out
+    */
+   template< typename Function >
+   void
+   forAllElements( Function&& function ) const;
+
+   /**
+    * \brief Method for parallel iteration over all matrix elements for non-constant instances.
+    *
+    * See \ref SparseMatrix::forElements.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called for each matrix element.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_forElements.cpp
+    * \par Output
+    * \include SparseMatrixExample_forElements.out
+    */
+   template< typename Function >
+   void
+   forAllElements( Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end).
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref SparseMatrix::forElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrix::RowView.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_forRows.cpp
+    * \par Output
+    * \include SparseMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forRows( IndexType begin, IndexType end, Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end) for constant instances.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref SparseMatrix::forElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrix::RowView.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_forRows.cpp
+    * \par Output
+    * \include SparseMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forRows( IndexType begin, IndexType end, Function&& function ) const;
+
+   /**
+    * \brief Method for parallel iteration over all matrix rows.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref SparseMatrix::forAllElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrix::RowView.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_forRows.cpp
+    * \par Output
+    * \include SparseMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forAllRows( Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over all matrix rows for constant instances.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref SparseMatrix::forAllElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrix::RowView.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_forRows.cpp
+    * \par Output
+    * \include SparseMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forAllRows( Function&& function ) const;
+
+   /**
+    * \brief Method for sequential iteration over all matrix rows for constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements.
+    *    It is should have form like
+    *  `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value )`.
+    *  The column index repeats twice only for compatibility with sparse matrices.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForRows( IndexType begin, IndexType end, Function& function ) const;
+
+   /**
+    * \brief Method for sequential iteration over all matrix rows for non-constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements.
+    *    It is should have form like
+    *  `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value )`.
+    *  The column index repeats twice only for compatibility with sparse matrices.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForRows( IndexType begin, IndexType end, Function& function );
+
+   /**
+    * \brief This method calls \e sequentialForRows for all matrix rows (for constant instances).
+    *
+    * See \ref SparseMatrix::sequentialForRows.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForAllRows( Function& function ) const;
+
+   /**
+    * \brief This method calls \e sequentialForRows for all matrix rows.
+    *
+    * See \ref SparseMatrix::sequentialForAllRows.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForAllRows( Function& function );
+
+   /**
+    * \brief Computes product of matrix and vector.
+    *
+    * More precisely, it computes:
+    *
+    * `outVector = matrixMultiplicator * ( * this ) * inVector + outVectorMultiplicator * outVector`
+    *
+    * \tparam InVector is type of input vector.  It can be \ref Vector,
+    *     \ref VectorView, \ref Array, \ref ArraView or similar container.
+    * \tparam OutVector is type of output vector. It can be \ref Vector,
+    *     \ref VectorView, \ref Array, \ref ArraView or similar container.
+    *
+    * \param inVector is input vector.
+    * \param outVector is output vector.
+    * \param matrixMultiplicator is a factor by which the matrix is multiplied. It is one by default.
+    * \param outVectorMultiplicator is a factor by which the outVector is multiplied before added
+    *    to the result of matrix-vector product. It is zero by default.
+    * \param begin is the beginning of the rows range for which the vector product
+    *    is computed. It is zero by default.
+    * \param end is the end of the rows range for which the vector product
+    *    is computed. It is number if the matrix rows by default.
+    */
+   template< typename InVector, typename OutVector >
+   void
+   vectorProduct( const InVector& inVector,
+                  OutVector& outVector,
+                  RealType matrixMultiplicator = 1.0,
+                  RealType outVectorMultiplicator = 0.0,
+                  IndexType firstRow = 0,
+                  IndexType lastRow = 0 ) const;
+
+   /*template< typename Real2, typename Index2 >
+   void addMatrix( const SparseMatrix< Real2, Segments, Device, Index2 >& matrix,
+                   const RealType& matrixMultiplicator = 1.0,
+                   const RealType& thisMatrixMultiplicator = 1.0 );
+
+   template< typename Real2, typename Index2 >
+   void getTransposition( const SparseMatrix< Real2, Segments, Device, Index2 >& matrix,
+                          const RealType& matrixMultiplicator = 1.0 );
+    */
+
+   template< typename Vector1, typename Vector2 >
+   bool
+   performSORIteration( const Vector1& b, IndexType row, Vector2& x, const RealType& omega = 1.0 ) const;
+
+   /**
+    * \brief Assignment of exactly the same matrix type.
+    *
+    * \param matrix is input matrix for the assignment.
+    * \return reference to this matrix.
+    */
+   SparseSandboxMatrix&
+   operator=( const SparseSandboxMatrix& matrix );
+
+   /**
+    * \brief Assignment of exactly the same matrix type but different device.
+    *
+    * \param matrix is input matrix for the assignment.
+    * \return reference to this matrix.
+    */
+   template< typename Device_ >
+   SparseSandboxMatrix&
+   operator=( const SparseSandboxMatrix< RealType, Device_, IndexType, MatrixType, RealAllocator, IndexAllocator >& matrix );
+
+   /**
+    * \brief Assignment of dense matrix
+    *
+    * \param matrix is input matrix for the assignment.
+    * \return reference to this matrix.
+    */
+   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization, typename RealAllocator_ >
+   SparseSandboxMatrix&
+   operator=( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator_ >& matrix );
+
+   /**
+    * \brief Assignment of any matrix type other then this and dense.
+    *
+    * **Warning: Assignment of symmetric sparse matrix to general sparse matrix does not give correct result, currently. Only
+    * the diagonal and the lower part of the matrix is assigned.**
+    *
+    * \param matrix is input matrix for the assignment.
+    * \return reference to this matrix.
+    */
+   template< typename RHSMatrix >
+   SparseSandboxMatrix&
+   operator=( const RHSMatrix& matrix );
+
+   /**
+    * \brief Comparison operator with another arbitrary matrix type.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return \e true if the RHS matrix is equal, \e false otherwise.
+    */
+   template< typename Matrix >
+   bool
+   operator==( const Matrix& m ) const;
+
+   /**
+    * \brief Comparison operator with another arbitrary matrix type.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return \e true if the RHS matrix is equal, \e false otherwise.
+    */
+   template< typename Matrix >
+   bool
+   operator!=( const Matrix& m ) const;
+
+   /**
+    * \brief Method for saving the matrix to the file with given filename.
+    *
+    * \param fileName is name of the file.
+    */
+   void
+   save( const String& fileName ) const;
+
+   /**
+    * \brief Method for loading the matrix from the file with given filename.
+    *
+    * \param fileName is name of the file.
+    */
+   void
+   load( const String& fileName );
+
+   /**
+    * \brief Method for saving the matrix to a file.
+    *
+    * \param file is the output file.
+    */
+   void
+   save( File& file ) const override;
+
+   /**
+    * \brief Method for loading the matrix from a file.
+    *
+    * \param file is the input file.
+    */
+   void
+   load( File& file ) override;
+
+   /**
+    * \brief Method for printing the matrix to output stream.
+    *
+    * \param str is the output stream.
+    */
+   void
+   print( std::ostream& str ) const override;
+
+   /**
+    * \brief Returns a padding index value.
+    *
+    * Padding index is used for column indexes of padding zeros. Padding zeros
+    * are used in some sparse matrix formats for better data alignment in memory.
+    *
+    * \return value of the padding index.
+    */
+   __cuda_callable__
+   IndexType
+   getPaddingIndex() const;
+
+   /**
+    * \brief Getter of segments for non-constant instances.
+    *
+    * \e Segments are a structure for addressing the matrix elements columns and values.
+    * In fact, \e Segments represent the sparse matrix format.
+    *
+    * \return Non-constant reference to segments.
+    */
+   // SegmentsType& getSegments();
+
+   /**
+    * \brief Getter of segments for constant instances.
+    *
+    * \e Segments are a structure for addressing the matrix elements columns and values.
+    * In fact, \e Segments represent the sparse matrix format.
+    *
+    * \return Constant reference to segments.
+    */
+   // const SegmentsType& getSegments() const;
+
+   /**
+    * \brief Getter of column indexes for constant instances.
+    *
+    * \return Constant reference to a vector with matrix elements column indexes.
+    */
+   const ColumnsIndexesVectorType&
+   getColumnIndexes() const;
+
+   /**
+    * \brief Getter of column indexes for nonconstant instances.
+    *
+    * \return Reference to a vector with matrix elements column indexes.
+    */
+   ColumnsIndexesVectorType&
+   getColumnIndexes();
+
+protected:
+   ColumnsIndexesVectorType columnIndexes;
+
+   IndexAllocator indexAllocator;
+
+   ViewType view;
+
+   /**
+    * \brief Container for CSR row pointers.
+    *
+    * SANDBOX_TODO: You may replace it with containers and metadata required by you format.
+    */
+
+   RowPointers rowPointers;
 };
 
-      } // namespace Sandbox
-   } // namespace Matrices
-} // namespace TNL
+}  // namespace Sandbox
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/Sandbox/SparseSandboxMatrix.hpp>
diff --git a/src/TNL/Matrices/Sandbox/SparseSandboxMatrix.hpp b/src/TNL/Matrices/Sandbox/SparseSandboxMatrix.hpp
index 6f434fb7002ae5fbca328bcad83c4bf0af63e369..abb963b984984877a25d6b29ed4f53203fe5f794 100644
--- a/src/TNL/Matrices/Sandbox/SparseSandboxMatrix.hpp
+++ b/src/TNL/Matrices/Sandbox/SparseSandboxMatrix.hpp
@@ -12,122 +12,90 @@
 #include <TNL/Matrices/Sandbox/SparseSandboxMatrix.h>
 
 namespace TNL {
-   namespace Matrices {
-      namespace Sandbox {
+namespace Matrices {
+namespace Sandbox {
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-SparseSandboxMatrix( const RealAllocatorType& realAllocator,
-                     const IndexAllocatorType& indexAllocator )
-: BaseType( realAllocator ), columnIndexes( indexAllocator ), rowPointers( ( IndexType ) 1, ( IndexType ) 0, indexAllocator )
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::SparseSandboxMatrix(
+   const RealAllocatorType& realAllocator,
+   const IndexAllocatorType& indexAllocator )
+: BaseType( realAllocator ), columnIndexes( indexAllocator ), rowPointers( (IndexType) 1, (IndexType) 0, indexAllocator )
 {
    this->view = this->getView();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Index_t, std::enable_if_t< std::is_integral< Index_t >::value, int > >
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-SparseSandboxMatrix( const Index_t rows,
-                     const Index_t columns,
-                     const RealAllocatorType& realAllocator,
-                     const IndexAllocatorType& indexAllocator )
-: BaseType( rows, columns, realAllocator ), columnIndexes( indexAllocator ), rowPointers( rows + 1, ( IndexType ) 0, indexAllocator )
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Index_t, std::enable_if_t< std::is_integral< Index_t >::value, int > >
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::SparseSandboxMatrix(
+   const Index_t rows,
+   const Index_t columns,
+   const RealAllocatorType& realAllocator,
+   const IndexAllocatorType& indexAllocator )
+: BaseType( rows, columns, realAllocator ), columnIndexes( indexAllocator ),
+  rowPointers( rows + 1, (IndexType) 0, indexAllocator )
 {
    this->view = this->getView();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename ListIndex >
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-SparseSandboxMatrix( const std::initializer_list< ListIndex >& rowCapacities,
-                     const IndexType columns,
-                     const RealAllocatorType& realAllocator,
-                     const IndexAllocatorType& indexAllocator )
-: BaseType( rowCapacities.size(), columns, realAllocator ), columnIndexes( indexAllocator ), rowPointers( rowCapacities.size() + 1, ( IndexType ) 0, indexAllocator )
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename ListIndex >
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::SparseSandboxMatrix(
+   const std::initializer_list< ListIndex >& rowCapacities,
+   const IndexType columns,
+   const RealAllocatorType& realAllocator,
+   const IndexAllocatorType& indexAllocator )
+: BaseType( rowCapacities.size(), columns, realAllocator ), columnIndexes( indexAllocator ),
+  rowPointers( rowCapacities.size() + 1, (IndexType) 0, indexAllocator )
 {
    this->setRowCapacities( RowsCapacitiesType( rowCapacities ) );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename RowCapacitiesVector, std::enable_if_t< TNL::IsArrayType< RowCapacitiesVector >::value, int > >
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-SparseSandboxMatrix( const RowCapacitiesVector& rowCapacities,
-                     const IndexType columns,
-                     const RealAllocatorType& realAllocator,
-                     const IndexAllocatorType& indexAllocator )
-: BaseType( rowCapacities.getSize(), columns, realAllocator ), columnIndexes( indexAllocator ), rowPointers( rowCapacities.getSize() + 1, ( IndexType ) 0, indexAllocator )
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename RowCapacitiesVector, std::enable_if_t< TNL::IsArrayType< RowCapacitiesVector >::value, int > >
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::SparseSandboxMatrix(
+   const RowCapacitiesVector& rowCapacities,
+   const IndexType columns,
+   const RealAllocatorType& realAllocator,
+   const IndexAllocatorType& indexAllocator )
+: BaseType( rowCapacities.getSize(), columns, realAllocator ), columnIndexes( indexAllocator ),
+  rowPointers( rowCapacities.getSize() + 1, (IndexType) 0, indexAllocator )
 {
    this->setRowCapacities( rowCapacities );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-SparseSandboxMatrix( const IndexType rows,
-                     const IndexType columns,
-                     const std::initializer_list< std::tuple< IndexType, IndexType, RealType > >& data,
-                     const RealAllocatorType& realAllocator,
-                     const IndexAllocatorType& indexAllocator )
-: BaseType( rows, columns, realAllocator ), columnIndexes( indexAllocator ), rowPointers( rows + 1, ( IndexType ) 0, indexAllocator )
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::SparseSandboxMatrix(
+   const IndexType rows,
+   const IndexType columns,
+   const std::initializer_list< std::tuple< IndexType, IndexType, RealType > >& data,
+   const RealAllocatorType& realAllocator,
+   const IndexAllocatorType& indexAllocator )
+: BaseType( rows, columns, realAllocator ), columnIndexes( indexAllocator ),
+  rowPointers( rows + 1, (IndexType) 0, indexAllocator )
 {
    this->setElements( data );
    this->view = this->getView();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename MapIndex,
-             typename MapValue >
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-SparseSandboxMatrix( const IndexType rows,
-              const IndexType columns,
-              const std::map< std::pair< MapIndex, MapIndex > , MapValue >& map,
-              const RealAllocatorType& realAllocator,
-              const IndexAllocatorType& indexAllocator )
-: BaseType( rows, columns, realAllocator ), columnIndexes( indexAllocator ), rowPointers( rows + 1, ( IndexType ) 0, indexAllocator )
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename MapIndex, typename MapValue >
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::SparseSandboxMatrix(
+   const IndexType rows,
+   const IndexType columns,
+   const std::map< std::pair< MapIndex, MapIndex >, MapValue >& map,
+   const RealAllocatorType& realAllocator,
+   const IndexAllocatorType& indexAllocator )
+: BaseType( rows, columns, realAllocator ), columnIndexes( indexAllocator ),
+  rowPointers( rows + 1, (IndexType) 0, indexAllocator )
 {
    this->setDimensions( rows, columns );
    this->setElements( map );
    this->view = this->getView();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
 auto
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-getView() const -> ViewType
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::getView() const -> ViewType
 {
    return ViewType( this->getRows(),
                     this->getColumns(),
@@ -136,15 +104,9 @@ getView() const -> ViewType
                     const_cast< SparseSandboxMatrix* >( this )->rowPointers.getView() );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
 auto
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-getConstView() const -> ConstViewType
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::getConstView() const -> ConstViewType
 {
    return ConstViewType( this->getRows(),
                          this->getColumns(),
@@ -153,77 +115,49 @@ getConstView() const -> ConstViewType
                          this->segments.getConstView() );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-String
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-getSerializationType()
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+std::string
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::getSerializationType()
 {
    return ViewType::getSerializationType();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-String
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-getSerializationTypeVirtual() const
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+std::string
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::getSerializationTypeVirtual() const
 {
    return this->getSerializationType();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-setDimensions( const IndexType rows,
-               const IndexType columns )
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::setDimensions( const IndexType rows,
+                                                                                                      const IndexType columns )
 {
    BaseType::setDimensions( rows, columns );
    this->view = this->getView();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Matrix_ >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Matrix_ >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-setLike( const Matrix_& matrix )
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::setLike( const Matrix_& matrix )
 {
    BaseType::setLike( matrix );
-   // SANDBOX_TODO: Replace the following line with assignment of metadata required by your format. 
+   // SANDBOX_TODO: Replace the following line with assignment of metadata required by your format.
    //               Do not assign matrix elements here.
    this->rowPointers = matrix.rowPointers;
    this->view = this->getView();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename RowsCapacitiesVector >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename RowsCapacitiesVector >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-setRowCapacities( const RowsCapacitiesVector& rowsCapacities )
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::setRowCapacities(
+   const RowsCapacitiesVector& rowsCapacities )
 {
-   TNL_ASSERT_EQ( rowsCapacities.getSize(), this->getRows(), "Number of matrix rows does not fit with rowCapacities vector size." );
+   TNL_ASSERT_EQ(
+      rowsCapacities.getSize(), this->getRows(), "Number of matrix rows does not fit with rowCapacities vector size." );
    using RowsCapacitiesVectorDevice = typename RowsCapacitiesVector::DeviceType;
 
    // SANDBOX_TODO: Replace the following lines with the setup of your sparse matrix format based on
@@ -231,16 +165,14 @@ setRowCapacities( const RowsCapacitiesVector& rowsCapacities )
    //               rows of this matrix. Each element says how many nonzero elements the user needs to have
    //               in each row. This number can be increased if the sparse matrix format uses padding zeros.
    this->rowPointers.setSize( this->getRows() + 1 );
-   if( std::is_same< DeviceType, RowsCapacitiesVectorDevice >::value )
-   {
+   if( std::is_same< DeviceType, RowsCapacitiesVectorDevice >::value ) {
       // GOTCHA: when this->getRows() == 0, getView returns a full view with size == 1
       if( this->getRows() > 0 ) {
          auto view = this->rowPointers.getView( 0, this->getRows() );
          view = rowsCapacities;
       }
    }
-   else
-   {
+   else {
       RowsCapacitiesType thisRowsCapacities;
       thisRowsCapacities = rowsCapacities;
       if( this->getRows() > 0 ) {
@@ -250,54 +182,41 @@ setRowCapacities( const RowsCapacitiesVector& rowsCapacities )
    }
    this->rowPointers.setElement( this->getRows(), 0 );
    Algorithms::inplaceExclusiveScan( this->rowPointers );
-   //this->rowPointers.template scan< Algorithms::ScanType::Exclusive >();
-   // End of sparse matrix format initiation.
+   // this->rowPointers.template scan< Algorithms::ScanType::Exclusive >();
+   //  End of sparse matrix format initiation.
 
    // SANDBOX_TODO: Compute number of all elements that need to be allocated by your format.
    const auto storageSize = rowPointers.getElement( this->getRows() );
 
    // The rest of this methods needs no changes.
-   if( ! isBinary() )
-   {
+   if( ! isBinary() ) {
       this->values.setSize( storageSize );
-      this->values = ( RealType ) 0;
+      this->values = (RealType) 0;
    }
    this->columnIndexes.setSize( storageSize );
    this->columnIndexes = this->getPaddingIndex();
    this->view = this->getView();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Vector >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Vector >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-getRowCapacities( Vector& rowCapacities ) const
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::getRowCapacities(
+   Vector& rowCapacities ) const
 {
    this->view.getRowCapacities( rowCapacities );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-setElements( const std::initializer_list< std::tuple< IndexType, IndexType, RealType > >& data )
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::setElements(
+   const std::initializer_list< std::tuple< IndexType, IndexType, RealType > >& data )
 {
    const auto& rows = this->getRows();
    const auto& columns = this->getColumns();
    Containers::Vector< IndexType, Devices::Host, IndexType > rowCapacities( rows, 0 );
-   for( const auto& i : data )
-   {
-      if( std::get< 0 >( i ) >= rows )
-      {
+   for( const auto& i : data ) {
+      if( std::get< 0 >( i ) >= rows ) {
          std::stringstream s;
          s << "Wrong row index " << std::get< 0 >( i ) << " in an initializer list";
          throw std::logic_error( s.str() );
@@ -306,10 +225,8 @@ setElements( const std::initializer_list< std::tuple< IndexType, IndexType, Real
    }
    SparseSandboxMatrix< Real, Devices::Host, Index, MatrixType > hostMatrix( rows, columns );
    hostMatrix.setRowCapacities( rowCapacities );
-   for( const auto& i : data )
-   {
-      if( std::get< 1 >( i ) >= columns )
-      {
+   for( const auto& i : data ) {
+      if( std::get< 1 >( i ) >= columns ) {
          std::stringstream s;
          s << "Wrong column index " << std::get< 1 >( i ) << " in an initializer list";
          throw std::logic_error( s.str() );
@@ -319,87 +236,57 @@ setElements( const std::initializer_list< std::tuple< IndexType, IndexType, Real
    ( *this ) = hostMatrix;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename MapIndex,
-             typename MapValue >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename MapIndex, typename MapValue >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-setElements( const std::map< std::pair< MapIndex, MapIndex > , MapValue >& map )
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::setElements(
+   const std::map< std::pair< MapIndex, MapIndex >, MapValue >& map )
 {
    Containers::Vector< IndexType, Devices::Host, IndexType > rowsCapacities( this->getRows(), 0 );
    for( auto element : map )
       rowsCapacities[ element.first.first ]++;
-   if( !std::is_same< DeviceType, Devices::Host >::value )
-   {
+   if( ! std::is_same< DeviceType, Devices::Host >::value ) {
       SparseSandboxMatrix< Real, Devices::Host, Index, MatrixType > hostMatrix( this->getRows(), this->getColumns() );
       hostMatrix.setRowCapacities( rowsCapacities );
       for( auto element : map )
          hostMatrix.setElement( element.first.first, element.first.second, element.second );
       *this = hostMatrix;
    }
-   else
-   {
+   else {
       this->setRowCapacities( rowsCapacities );
       for( auto element : map )
          this->setElement( element.first.first, element.first.second, element.second );
    }
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Vector >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Vector >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-getCompressedRowLengths( Vector& rowLengths ) const
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::getCompressedRowLengths(
+   Vector& rowLengths ) const
 {
    this->view.getCompressedRowLengths( rowLengths );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
 __cuda_callable__
 Index
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-getRowCapacity( const IndexType row ) const
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::getRowCapacity(
+   const IndexType row ) const
 {
    return this->view.getRowCapacity( row );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
 Index
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-getNonzeroElementsCount() const
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::getNonzeroElementsCount() const
 {
    return this->view.getNonzeroElementsCount();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-reset()
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::reset()
 {
    BaseType::reset();
    this->columnIndexes.reset();
@@ -408,335 +295,242 @@ reset()
    this->view = this->getView();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-__cuda_callable__ auto
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-getRow( const IndexType& rowIdx ) const -> const ConstRowView
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+__cuda_callable__
+auto
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::getRow( const IndexType& rowIdx ) const
+   -> const ConstRowView
 {
    return this->view.getRow( rowIdx );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-__cuda_callable__ auto
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-getRow( const IndexType& rowIdx ) -> RowView
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+__cuda_callable__
+auto
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::getRow( const IndexType& rowIdx )
+   -> RowView
 {
    return this->view.getRow( rowIdx );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-__cuda_callable__ void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-setElement( const IndexType row,
-            const IndexType column,
-            const RealType& value )
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+__cuda_callable__
+void
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::setElement( const IndexType row,
+                                                                                                   const IndexType column,
+                                                                                                   const RealType& value )
 {
    this->view.setElement( row, column, value );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-__cuda_callable__ void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-addElement( const IndexType row,
-            const IndexType column,
-            const RealType& value,
-            const RealType& thisElementMultiplicator )
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+__cuda_callable__
+void
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::addElement(
+   const IndexType row,
+   const IndexType column,
+   const RealType& value,
+   const RealType& thisElementMultiplicator )
 {
    this->view.addElement( row, column, value, thisElementMultiplicator );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
 __cuda_callable__
 auto
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-getElement( const IndexType row,
-            const IndexType column ) const -> RealType
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::getElement(
+   const IndexType row,
+   const IndexType column ) const -> RealType
 {
    return this->view.getElement( row, column );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-template< typename InVector,
-       typename OutVector >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename InVector, typename OutVector >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-vectorProduct( const InVector& inVector,
-               OutVector& outVector,
-               const RealType& matrixMultiplicator,
-               const RealType& outVectorMultiplicator,
-               const IndexType firstRow,
-               const IndexType lastRow ) const
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::vectorProduct(
+   const InVector& inVector,
+   OutVector& outVector,
+   RealType matrixMultiplicator,
+   RealType outVectorMultiplicator,
+   IndexType firstRow,
+   IndexType lastRow ) const
 {
    this->view.vectorProduct( inVector, outVector, matrixMultiplicator, outVectorMultiplicator, firstRow, lastRow );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchValue& zero )
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::reduceRows( IndexType begin,
+                                                                                                   IndexType end,
+                                                                                                   Fetch& fetch,
+                                                                                                   const Reduce& reduce,
+                                                                                                   Keep& keep,
+                                                                                                   const FetchValue& zero )
 {
    this->view.reduceRows( begin, end, fetch, reduce, keep, zero );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchValue& zero ) const
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::reduceRows(
+   IndexType begin,
+   IndexType end,
+   Fetch& fetch,
+   const Reduce& reduce,
+   Keep& keep,
+   const FetchValue& zero ) const
 {
    this->view.reduceRows( begin, end, fetch, reduce, keep, zero );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-reduceAllRows( Fetch&& fetch, const Reduce&& reduce, Keep&& keep, const FetchReal& zero )
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::reduceAllRows( Fetch&& fetch,
+                                                                                                      const Reduce&& reduce,
+                                                                                                      Keep&& keep,
+                                                                                                      const FetchReal& zero )
 {
    this->reduceRows( 0, this->getRows(), fetch, reduce, keep, zero );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& zero ) const
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::reduceAllRows(
+   Fetch& fetch,
+   const Reduce& reduce,
+   Keep& keep,
+   const FetchReal& zero ) const
 {
    this->reduceRows( 0, this->getRows(), fetch, reduce, keep, zero );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Function >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-forElements( IndexType begin, IndexType end, Function&& function ) const
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::forElements( IndexType begin,
+                                                                                                    IndexType end,
+                                                                                                    Function&& function ) const
 {
    this->view.forElements( begin, end, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Function >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-forElements( IndexType begin, IndexType end, Function&& function )
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::forElements( IndexType begin,
+                                                                                                    IndexType end,
+                                                                                                    Function&& function )
 {
    this->view.forElements( begin, end, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Function >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-forAllElements( Function&& function ) const
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::forAllElements(
+   Function&& function ) const
 {
    this->forElements( 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Function >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-forAllElements( Function&& function )
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::forAllElements( Function&& function )
 {
    this->forElements( 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Function >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-forRows( IndexType begin, IndexType end, Function&& function )
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::forRows( IndexType begin,
+                                                                                                IndexType end,
+                                                                                                Function&& function )
 {
    this->getView().forRows( begin, end, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Function >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-forRows( IndexType begin, IndexType end, Function&& function ) const
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::forRows( IndexType begin,
+                                                                                                IndexType end,
+                                                                                                Function&& function ) const
 {
    this->getConstView().forRows( begin, end, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Function >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-forAllRows( Function&& function )
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::forAllRows( Function&& function )
 {
    this->getView().forAllRows( function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Function >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-forAllRows( Function&& function ) const
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::forAllRows( Function&& function ) const
 {
    this->getConsView().forAllRows( function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Function >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-sequentialForRows( IndexType begin, IndexType end, Function& function ) const
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::sequentialForRows(
+   IndexType begin,
+   IndexType end,
+   Function& function ) const
 {
    this->view.sequentialForRows( begin, end, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Function >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-sequentialForRows( IndexType first, IndexType last, Function& function )
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::sequentialForRows( IndexType first,
+                                                                                                          IndexType last,
+                                                                                                          Function& function )
 {
    this->view.sequentialForRows( first, last, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Function >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-sequentialForAllRows( Function& function ) const
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::sequentialForAllRows(
+   Function& function ) const
 {
    this->sequentialForRows( 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Function >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-sequentialForAllRows( Function& function )
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::sequentialForAllRows(
+   Function& function )
 {
    this->sequentialForRows( 0, this->getRows(), function );
 }
 
-
 /*template< typename Real,
           template< typename, typename, typename > class Segments,
           typename Device,
           typename Index,
           typename RealAllocator,
           typename IndexAllocator >
-template< typename Real2, template< typename, typename > class Segments2, typename Index2, typename RealAllocator2, typename IndexAllocator2 >
-void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-addMatrix( const SparseSandboxMatrix< Real2, Segments2, Device, Index2, RealAllocator2, IndexAllocator2 >& matrix,
-           const RealType& matrixMultiplicator,
-           const RealType& thisMatrixMultiplicator )
+template< typename Real2, template< typename, typename > class Segments2, typename Index2, typename RealAllocator2, typename
+IndexAllocator2 > void SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >:: addMatrix( const
+SparseSandboxMatrix< Real2, Segments2, Device, Index2, RealAllocator2, IndexAllocator2 >& matrix, const RealType&
+matrixMultiplicator, const RealType& thisMatrixMultiplicator )
 {
 
 }
@@ -756,33 +550,23 @@ getTransposition( const SparseSandboxMatrix< Real2, Device, Index2 >& matrix,
 
 }*/
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
 template< typename Vector1, typename Vector2 >
 bool
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-performSORIteration( const Vector1& b,
-                     const IndexType row,
-                     Vector2& x,
-                     const RealType& omega ) const
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::performSORIteration(
+   const Vector1& b,
+   const IndexType row,
+   Vector2& x,
+   const RealType& omega ) const
 {
    return false;
 }
 
 // copy assignment
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
 SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >&
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-operator=( const SparseSandboxMatrix& matrix )
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::operator=(
+   const SparseSandboxMatrix& matrix )
 {
    Matrix< Real, Device, Index >::operator=( matrix );
    this->columnIndexes = matrix.columnIndexes;
@@ -792,16 +576,11 @@ operator=( const SparseSandboxMatrix& matrix )
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Device_ >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Device_ >
 SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >&
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-operator=( const SparseSandboxMatrix< RealType, Device_, IndexType, MatrixType, RealAllocator, IndexAllocator >& matrix )
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::operator=(
+   const SparseSandboxMatrix< RealType, Device_, IndexType, MatrixType, RealAllocator, IndexAllocator >& matrix )
 {
    Matrix< Real, Device, Index >::operator=( matrix );
    this->columnIndexes = matrix.columnIndexes;
@@ -811,16 +590,11 @@ operator=( const SparseSandboxMatrix< RealType, Device_, IndexType, MatrixType,
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization, typename RealAllocator_ >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization, typename RealAllocator_ >
 SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >&
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-operator=( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator_ >& matrix )
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::operator=(
+   const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator_ >& matrix )
 {
    using RHSMatrix = DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator_ >;
    using RHSIndexType = typename RHSMatrix::IndexType;
@@ -843,12 +617,12 @@ operator=( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocato
    auto rowLocalIndexes_view = rowLocalIndexes.getView();
    columns_view = paddingIndex;
 
-   if( std::is_same< DeviceType, RHSDeviceType >::value )
-   {
+   if( std::is_same< DeviceType, RHSDeviceType >::value ) {
       const auto segments_view = this->segments.getView();
-      auto f = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIdx, const RHSRealType& value ) mutable {
-         if( value != 0.0 )
-         {
+      auto f = [ = ] __cuda_callable__(
+                  RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIdx, const RHSRealType& value ) mutable
+      {
+         if( value != 0.0 ) {
             IndexType thisGlobalIdx = segments_view.getGlobalIndex( rowIdx, rowLocalIndexes_view[ rowIdx ]++ );
             columns_view[ thisGlobalIdx ] = columnIdx;
             if( ! isBinary() )
@@ -857,8 +631,7 @@ operator=( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocato
       };
       matrix.forAllElements( f );
    }
-   else
-   {
+   else {
       const IndexType maxRowLength = matrix.getColumns();
       const IndexType bufferRowsCount( 128 );
       const size_t bufferSize = bufferRowsCount * maxRowLength;
@@ -870,14 +643,15 @@ operator=( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocato
 
       IndexType baseRow( 0 );
       const IndexType rowsCount = this->getRows();
-      while( baseRow < rowsCount )
-      {
+      while( baseRow < rowsCount ) {
          const IndexType lastRow = min( baseRow + bufferRowsCount, rowsCount );
          thisColumnsBuffer = paddingIndex;
 
          ////
          // Copy matrix elements into buffer
-         auto f1 = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIndex, const RHSRealType& value ) mutable {
+         auto f1 = [ = ] __cuda_callable__(
+                      RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIndex, const RHSRealType& value ) mutable
+         {
             const IndexType bufferIdx = ( rowIdx - baseRow ) * maxRowLength + localIdx;
             matrixValuesBuffer_view[ bufferIdx ] = value;
          };
@@ -891,22 +665,21 @@ operator=( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocato
          // Copy matrix elements from the buffer to the matrix and ignoring
          // zero matrix elements.
          const IndexType matrix_columns = this->getColumns();
-         auto f2 = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType& columnIndex, RealType& value ) mutable {
+         auto f2 =
+            [ = ] __cuda_callable__( IndexType rowIdx, IndexType localIdx, IndexType & columnIndex, RealType & value ) mutable
+         {
             RealType inValue( 0.0 );
             IndexType bufferIdx, column( rowLocalIndexes_view[ rowIdx ] );
-            while( inValue == 0.0 && column < matrix_columns )
-            {
+            while( inValue == 0.0 && column < matrix_columns ) {
                bufferIdx = ( rowIdx - baseRow ) * maxRowLength + column++;
                inValue = thisValuesBuffer_view[ bufferIdx ];
             }
             rowLocalIndexes_view[ rowIdx ] = column;
-            if( inValue == 0.0 )
-            {
+            if( inValue == 0.0 ) {
                columnIndex = paddingIndex;
                value = 0.0;
             }
-            else
-            {
+            else {
                columnIndex = column - 1;
                value = inValue;
             }
@@ -914,23 +687,16 @@ operator=( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocato
          this->forElements( baseRow, lastRow, f2 );
          baseRow += bufferRowsCount;
       }
-      //std::cerr << "This matrix = " << std::endl << *this << std::endl;
+      // std::cerr << "This matrix = " << std::endl << *this << std::endl;
    }
    this->view = this->getView();
    return *this;
-
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename RHSMatrix >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename RHSMatrix >
 SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >&
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-operator=( const RHSMatrix& matrix )
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::operator=( const RHSMatrix& matrix )
 {
    using RHSIndexType = typename RHSMatrix::IndexType;
    using RHSRealType = typename RHSMatrix::RealType;
@@ -954,13 +720,13 @@ operator=( const RHSMatrix& matrix )
 
    // SANDBOX_TODO: Modify the follwoing accoring to your format
    auto row_pointers_view = this->rowPointers.getView();
-   if( std::is_same< DeviceType, RHSDeviceType >::value )
-   {
-      auto f = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx_, RHSIndexType columnIndex, const RHSRealType& value ) mutable {
+   if( std::is_same< DeviceType, RHSDeviceType >::value ) {
+      auto f = [ = ] __cuda_callable__(
+                  RHSIndexType rowIdx, RHSIndexType localIdx_, RHSIndexType columnIndex, const RHSRealType& value ) mutable
+      {
          IndexType localIdx( rowLocalIndexes_view[ rowIdx ] );
          IndexType thisRowBegin = row_pointers_view[ rowIdx ];
-         if( value != 0.0 && columnIndex != paddingIndex )
-         {
+         if( value != 0.0 && columnIndex != paddingIndex ) {
             IndexType thisGlobalIdx = thisRowBegin + localIdx++;
             columns_view[ thisGlobalIdx ] = columnIndex;
             if( ! isBinary() )
@@ -970,8 +736,7 @@ operator=( const RHSMatrix& matrix )
       };
       matrix.forAllElements( f );
    }
-   else
-   {
+   else {
       const IndexType maxRowLength = max( rowCapacities );
       const IndexType bufferRowsCount( 128 );
       const size_t bufferSize = bufferRowsCount * maxRowLength;
@@ -982,7 +747,7 @@ operator=( const RHSMatrix& matrix )
       Containers::Vector< IndexType, DeviceType, IndexType > thisRowLengths;
       Containers::Vector< RHSIndexType, RHSDeviceType, RHSIndexType > rhsRowLengths;
       matrix.getCompressedRowLengths( rhsRowLengths );
-      thisRowLengths= rhsRowLengths;
+      thisRowLengths = rhsRowLengths;
       auto matrixValuesBuffer_view = matrixValuesBuffer.getView();
       auto matrixColumnsBuffer_view = matrixColumnsBuffer.getView();
       auto thisValuesBuffer_view = thisValuesBuffer.getView();
@@ -991,21 +756,21 @@ operator=( const RHSMatrix& matrix )
 
       IndexType baseRow( 0 );
       const IndexType rowsCount = this->getRows();
-      while( baseRow < rowsCount )
-      {
+      while( baseRow < rowsCount ) {
          const IndexType lastRow = min( baseRow + bufferRowsCount, rowsCount );
          thisColumnsBuffer = paddingIndex;
          matrixColumnsBuffer_view = paddingIndex;
 
          ////
          // Copy matrix elements into buffer
-         auto f1 = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIndex, const RHSRealType& value ) mutable {
-            if( columnIndex != paddingIndex )
-            {
+         auto f1 = [ = ] __cuda_callable__(
+                      RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIndex, const RHSRealType& value ) mutable
+         {
+            if( columnIndex != paddingIndex ) {
                TNL_ASSERT_LT( rowIdx - baseRow, bufferRowsCount, "" );
                TNL_ASSERT_LT( localIdx, maxRowLength, "" );
                const IndexType bufferIdx = ( rowIdx - baseRow ) * maxRowLength + localIdx;
-               TNL_ASSERT_LT( bufferIdx, ( IndexType ) bufferSize, "" );
+               TNL_ASSERT_LT( bufferIdx, (IndexType) bufferSize, "" );
                matrixColumnsBuffer_view[ bufferIdx ] = columnIndex;
                matrixValuesBuffer_view[ bufferIdx ] = value;
             }
@@ -1020,27 +785,26 @@ operator=( const RHSMatrix& matrix )
          ////
          // Copy matrix elements from the buffer to the matrix and ignoring
          // zero matrix elements
-         //const IndexType matrix_columns = this->getColumns();
+         // const IndexType matrix_columns = this->getColumns();
          const auto thisRowLengths_view = thisRowLengths.getConstView();
-         auto f2 = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType& columnIndex, RealType& value ) mutable {
+         auto f2 =
+            [ = ] __cuda_callable__( IndexType rowIdx, IndexType localIdx, IndexType & columnIndex, RealType & value ) mutable
+         {
             RealType inValue( 0.0 );
             size_t bufferIdx;
             IndexType bufferLocalIdx( rowLocalIndexes_view[ rowIdx ] );
-            while( inValue == 0.0 && localIdx < thisRowLengths_view[ rowIdx ] )
-            {
+            while( inValue == 0.0 && localIdx < thisRowLengths_view[ rowIdx ] ) {
                bufferIdx = ( rowIdx - baseRow ) * maxRowLength + bufferLocalIdx++;
                TNL_ASSERT_LT( bufferIdx, bufferSize, "" );
                inValue = thisValuesBuffer_view[ bufferIdx ];
             }
             rowLocalIndexes_view[ rowIdx ] = bufferLocalIdx;
-            if( inValue == 0.0 )
-            {
+            if( inValue == 0.0 ) {
                columnIndex = paddingIndex;
                value = 0.0;
             }
-            else
-            {
-               columnIndex = thisColumnsBuffer_view[ bufferIdx ];//column - 1;
+            else {
+               columnIndex = thisColumnsBuffer_view[ bufferIdx ];  // column - 1;
                value = inValue;
             }
          };
@@ -1052,56 +816,32 @@ operator=( const RHSMatrix& matrix )
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Matrix >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Matrix >
 bool
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-operator==( const Matrix& m ) const
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::operator==( const Matrix& m ) const
 {
    return view == m;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
-   template< typename Matrix >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
+template< typename Matrix >
 bool
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-operator!=( const Matrix& m ) const
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::operator!=( const Matrix& m ) const
 {
    return view != m;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-save( File& file ) const
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::save( File& file ) const
 {
    this->view.save( file );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-load( File& file )
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::load( File& file )
 {
    Matrix< RealType, DeviceType, IndexType >::load( file );
    file >> this->columnIndexes;
@@ -1110,85 +850,51 @@ load( File& file )
    this->view = this->getView();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-save( const String& fileName ) const
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::save( const String& fileName ) const
 {
    Object::save( fileName );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-load( const String& fileName )
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::load( const String& fileName )
 {
    Object::load( fileName );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
 void
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-print( std::ostream& str ) const
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::print( std::ostream& str ) const
 {
    this->view.print( str );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
 __cuda_callable__
 Index
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-getPaddingIndex() const
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::getPaddingIndex() const
 {
    return -1;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
 auto
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-getColumnIndexes() const -> const ColumnsIndexesVectorType&
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::getColumnIndexes() const
+   -> const ColumnsIndexesVectorType&
 {
    return this->columnIndexes;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType,
-          typename RealAllocator,
-          typename IndexAllocator >
+template< typename Real, typename Device, typename Index, typename MatrixType, typename RealAllocator, typename IndexAllocator >
 auto
-SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::
-getColumnIndexes() -> ColumnsIndexesVectorType&
+SparseSandboxMatrix< Real, Device, Index, MatrixType, RealAllocator, IndexAllocator >::getColumnIndexes()
+   -> ColumnsIndexesVectorType&
 {
    return this->columnIndexes;
 }
 
-      } // namespace Sandbox
-   } // namespace Matrices
-} // namespace TNL
+}  // namespace Sandbox
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/Sandbox/SparseSandboxMatrixRowView.h b/src/TNL/Matrices/Sandbox/SparseSandboxMatrixRowView.h
index f0392351ba6ad3dfed88e3c4e0debb22126574cc..54fbc077104984a16bea5e9e8db3ff8b7b14487e 100644
--- a/src/TNL/Matrices/Sandbox/SparseSandboxMatrixRowView.h
+++ b/src/TNL/Matrices/Sandbox/SparseSandboxMatrixRowView.h
@@ -12,8 +12,8 @@
 #include <TNL/Matrices/MatrixRowViewIterator.h>
 
 namespace TNL {
-   namespace Matrices {
-      namespace Sandbox {
+namespace Matrices {
+namespace Sandbox {
 
 /**
  * \brief RowView is a simple structure for accessing rows of sparse matrix.
@@ -34,229 +34,237 @@ namespace TNL {
  * \par Output
  * \include SparseMatrixViewExample_getRow.out
  */
-template< typename ValuesView,
-          typename ColumnsIndexesView,
-          bool isBinary_ >
+template< typename ValuesView, typename ColumnsIndexesView, bool isBinary_ >
 class SparseSandboxMatrixRowView
 {
-   public:
-
-      /**
-       * \brief The type of matrix elements.
-       */
-      using RealType = typename ValuesView::RealType;
-
-      /**
-       * \brief The type used for matrix elements indexing.
-       */
-      using IndexType = typename ColumnsIndexesView::IndexType;
-
-      /**
-       * \brief Type of container view used for storing the matrix elements values.
-       */
-      using ValuesViewType = ValuesView;
-
-      /**
-       * \brief Type of container view used for storing the column indexes of the matrix elements.
-       */
-      using ColumnsIndexesViewType = ColumnsIndexesView;
-
-      /**
-       * \brief Type of constant container view used for storing the matrix elements values.
-       */
-      using ConstValuesViewType = typename ValuesViewType::ConstViewType;
-
-      /**
-       * \brief Type of constant container view used for storing the column indexes of the matrix elements.
-       */
-      using ConstColumnsIndexesViewType = typename ColumnsIndexesViewType::ConstViewType;
-
-      /**
-       * \brief Type of sparse matrix row view.
-       */
-      using RowView = SparseSandboxMatrixRowView< ValuesViewType, ColumnsIndexesViewType, isBinary_ >;
-
-      /**
-       * \brief Type of constant sparse matrix row view.
-       */
-      using ConstView = SparseSandboxMatrixRowView< ConstValuesViewType, ConstColumnsIndexesViewType, isBinary_ >;
-
-      /**
-       * \brief The type of related matrix element.
-       */
-      using MatrixElementType = SparseMatrixElement< RealType, IndexType >;
-
-      /**
-       * \brief Type of iterator for the matrix row.
-       */
-      using IteratorType = MatrixRowViewIterator< RowView >;
-
-      /**
-       * \brief Tells whether the parent matrix is a binary matrix.
-       * @return `true` if the matrix is binary.
-       */
-      static constexpr bool isBinary() { return isBinary_; };
-
-      /**
-       * \brief Constructor with \e segmentView, \e values and \e columnIndexes.
-       *
-       * \param rowIdx is row index.
-       * \param offset is the begining of the matrix row in arrays with values and column indexes of matrix elements.
-       * \param size is row size, i.e. number of nonzero matrix elements in the row.
-       * \param values is a container view for storing the matrix elements values.
-       * \param columnIndexes is a container view for storing the column indexes of the matrix elements.
-       */
-      __cuda_callable__
-      SparseSandboxMatrixRowView( IndexType rowIdx,
-                                  IndexType offset,
-                                  IndexType size,
-                                  const ValuesViewType& values,
-                                  const ColumnsIndexesViewType& columnIndexes );
-
-      /**
-       * \brief Returns size of the matrix row, i.e. number of matrix elements in this row.
-       *
-       * \return Size of the matrix row.
-       */
-      __cuda_callable__
-      IndexType getSize() const;
-
-      /**
-       * \brief Returns the matrix row index.
-       *
-       * \return matrix row index.
-       */
-      __cuda_callable__
-      const IndexType& getRowIndex() const;
-
-      /**
-       * \brief Returns constants reference to a column index of an element with given rank in the row.
-       *
-       * \param localIdx is the rank of the non-zero element in given row.
-       *
-       * \return constant reference to the matrix element column index.
-       */
-      __cuda_callable__
-      const IndexType& getColumnIndex( const IndexType localIdx ) const;
-
-      /**
-       * \brief Returns non-constants reference to a column index of an element with given rank in the row.
-       *
-       * \param localIdx is the rank of the non-zero element in given row.
-       *
-       * \return non-constant reference to the matrix element column index.
-       */
-      __cuda_callable__
-      IndexType& getColumnIndex( const IndexType localIdx );
-
-      /**
-       * \brief Returns constants reference to value of an element with given rank in the row.
-       *
-       * \param localIdx is the rank of the non-zero element in given row.
-       *
-       * \return constant reference to the matrix element value.
-       */
-      __cuda_callable__
-      const RealType& getValue( const IndexType localIdx ) const;
-
-      /**
-       * \brief Returns non-constants reference to value of an element with given rank in the row.
-       *
-       * \param localIdx is the rank of the non-zero element in given row.
-       *
-       * \return non-constant reference to the matrix element value.
-       */
-      __cuda_callable__
-      RealType& getValue( const IndexType localIdx );
-
-      /**
-       * \brief Sets a value of matrix element with given rank in the matrix row.
-       *
-       * \param localIdx is the rank of the matrix element in the row.
-       * \param value is the new value of the matrix element.
-       */
-      __cuda_callable__
-      void setValue( const IndexType localIdx,
-                     const RealType& value );
-
-      /**
-       * \brief Sets a column index of matrix element with given rank in the matrix row.
-       *
-       * \param localIdx is the rank of the matrix element in the row.
-       * \param columnIndex is the new column index of the matrix element.
-       */
-      __cuda_callable__
-      void setColumnIndex( const IndexType localIdx,
-                           const IndexType& columnIndex );
-
-      /**
-       * \brief Sets both a value and a column index of matrix element with given rank in the matrix row.
-       *
-       * \param localIdx is the rank of the matrix element in the row.
-       * \param columnIndex is the new column index of the matrix element.
-       * \param value is the new value of the matrix element.
-       */
-      __cuda_callable__
-      void setElement( const IndexType localIdx,
-                       const IndexType columnIndex,
-                       const RealType& value );
-
-      /**
-       * \brief Comparison of two matrix rows.
-       *
-       * The other matrix row can be from any other matrix.
-       *
-       * \param other is another matrix row.
-       * \return \e true if both rows are the same, \e false otherwise.
-       */
-      template< typename _ValuesView,
-                typename _ColumnsIndexesView,
-                bool _isBinary >
-      __cuda_callable__
-      bool operator==( const SparseSandboxMatrixRowView< _ValuesView, _ColumnsIndexesView, _isBinary >& other ) const;
-
-      /**
-       * \brief Returns iterator pointing at the beginning of the matrix row.
-       *
-       * \return iterator pointing at the beginning.
-       */
-      __cuda_callable__
-      IteratorType begin();
-
-      /**
-       * \brief Returns iterator pointing at the end of the matrix row.
-       *
-       * \return iterator pointing at the end.
-       */
-      __cuda_callable__
-      IteratorType end();
-
-      /**
-       * \brief Returns constant iterator pointing at the beginning of the matrix row.
-       *
-       * \return iterator pointing at the beginning.
-       */
-      __cuda_callable__
-      const IteratorType cbegin() const;
-
-      /**
-       * \brief Returns constant iterator pointing at the end of the matrix row.
-       *
-       * \return iterator pointing at the end.
-       */
-      __cuda_callable__
-      const IteratorType cend() const;
-
-   protected:
-
-      IndexType rowIdx, size;
-
-      // SANDBOX_TODO: Replace the following line with data required by your format.
-      IndexType offset;
-
-      ValuesViewType values;
-
-      ColumnsIndexesViewType columnIndexes;
+public:
+   /**
+    * \brief The type of matrix elements.
+    */
+   using RealType = typename ValuesView::RealType;
+
+   /**
+    * \brief The type used for matrix elements indexing.
+    */
+   using IndexType = typename ColumnsIndexesView::IndexType;
+
+   /**
+    * \brief Type of container view used for storing the matrix elements values.
+    */
+   using ValuesViewType = ValuesView;
+
+   /**
+    * \brief Type of container view used for storing the column indexes of the matrix elements.
+    */
+   using ColumnsIndexesViewType = ColumnsIndexesView;
+
+   /**
+    * \brief Type of constant container view used for storing the matrix elements values.
+    */
+   using ConstValuesViewType = typename ValuesViewType::ConstViewType;
+
+   /**
+    * \brief Type of constant container view used for storing the column indexes of the matrix elements.
+    */
+   using ConstColumnsIndexesViewType = typename ColumnsIndexesViewType::ConstViewType;
+
+   /**
+    * \brief Type of sparse matrix row view.
+    */
+   using RowView = SparseSandboxMatrixRowView< ValuesViewType, ColumnsIndexesViewType, isBinary_ >;
+
+   /**
+    * \brief Type of constant sparse matrix row view.
+    */
+   using ConstView = SparseSandboxMatrixRowView< ConstValuesViewType, ConstColumnsIndexesViewType, isBinary_ >;
+
+   /**
+    * \brief The type of related matrix element.
+    */
+   using MatrixElementType = SparseMatrixElement< RealType, IndexType >;
+
+   /**
+    * \brief Type of iterator for the matrix row.
+    */
+   using IteratorType = MatrixRowViewIterator< RowView >;
+
+   /**
+    * \brief Tells whether the parent matrix is a binary matrix.
+    * @return `true` if the matrix is binary.
+    */
+   static constexpr bool
+   isBinary()
+   {
+      return isBinary_;
+   };
+
+   /**
+    * \brief Constructor with \e segmentView, \e values and \e columnIndexes.
+    *
+    * \param rowIdx is row index.
+    * \param offset is the begining of the matrix row in arrays with values and column indexes of matrix elements.
+    * \param size is row size, i.e. number of nonzero matrix elements in the row.
+    * \param values is a container view for storing the matrix elements values.
+    * \param columnIndexes is a container view for storing the column indexes of the matrix elements.
+    */
+   __cuda_callable__
+   SparseSandboxMatrixRowView( IndexType rowIdx,
+                               IndexType offset,
+                               IndexType size,
+                               const ValuesViewType& values,
+                               const ColumnsIndexesViewType& columnIndexes );
+
+   /**
+    * \brief Returns size of the matrix row, i.e. number of matrix elements in this row.
+    *
+    * \return Size of the matrix row.
+    */
+   __cuda_callable__
+   IndexType
+   getSize() const;
+
+   /**
+    * \brief Returns the matrix row index.
+    *
+    * \return matrix row index.
+    */
+   __cuda_callable__
+   const IndexType&
+   getRowIndex() const;
+
+   /**
+    * \brief Returns constants reference to a column index of an element with given rank in the row.
+    *
+    * \param localIdx is the rank of the non-zero element in given row.
+    *
+    * \return constant reference to the matrix element column index.
+    */
+   __cuda_callable__
+   const IndexType&
+   getColumnIndex( IndexType localIdx ) const;
+
+   /**
+    * \brief Returns non-constants reference to a column index of an element with given rank in the row.
+    *
+    * \param localIdx is the rank of the non-zero element in given row.
+    *
+    * \return non-constant reference to the matrix element column index.
+    */
+   __cuda_callable__
+   IndexType&
+   getColumnIndex( IndexType localIdx );
+
+   /**
+    * \brief Returns constants reference to value of an element with given rank in the row.
+    *
+    * \param localIdx is the rank of the non-zero element in given row.
+    *
+    * \return constant reference to the matrix element value.
+    */
+   __cuda_callable__
+   const RealType&
+   getValue( IndexType localIdx ) const;
+
+   /**
+    * \brief Returns non-constants reference to value of an element with given rank in the row.
+    *
+    * \param localIdx is the rank of the non-zero element in given row.
+    *
+    * \return non-constant reference to the matrix element value.
+    */
+   __cuda_callable__
+   RealType&
+   getValue( IndexType localIdx );
+
+   /**
+    * \brief Sets a value of matrix element with given rank in the matrix row.
+    *
+    * \param localIdx is the rank of the matrix element in the row.
+    * \param value is the new value of the matrix element.
+    */
+   __cuda_callable__
+   void
+   setValue( IndexType localIdx, const RealType& value );
+
+   /**
+    * \brief Sets a column index of matrix element with given rank in the matrix row.
+    *
+    * \param localIdx is the rank of the matrix element in the row.
+    * \param columnIndex is the new column index of the matrix element.
+    */
+   __cuda_callable__
+   void
+   setColumnIndex( IndexType localIdx, const IndexType& columnIndex );
+
+   /**
+    * \brief Sets both a value and a column index of matrix element with given rank in the matrix row.
+    *
+    * \param localIdx is the rank of the matrix element in the row.
+    * \param columnIndex is the new column index of the matrix element.
+    * \param value is the new value of the matrix element.
+    */
+   __cuda_callable__
+   void
+   setElement( IndexType localIdx, IndexType columnIndex, const RealType& value );
+
+   /**
+    * \brief Comparison of two matrix rows.
+    *
+    * The other matrix row can be from any other matrix.
+    *
+    * \param other is another matrix row.
+    * \return \e true if both rows are the same, \e false otherwise.
+    */
+   template< typename _ValuesView, typename _ColumnsIndexesView, bool _isBinary >
+   __cuda_callable__
+   bool
+   operator==( const SparseSandboxMatrixRowView< _ValuesView, _ColumnsIndexesView, _isBinary >& other ) const;
+
+   /**
+    * \brief Returns iterator pointing at the beginning of the matrix row.
+    *
+    * \return iterator pointing at the beginning.
+    */
+   __cuda_callable__
+   IteratorType
+   begin();
+
+   /**
+    * \brief Returns iterator pointing at the end of the matrix row.
+    *
+    * \return iterator pointing at the end.
+    */
+   __cuda_callable__
+   IteratorType
+   end();
+
+   /**
+    * \brief Returns constant iterator pointing at the beginning of the matrix row.
+    *
+    * \return iterator pointing at the beginning.
+    */
+   __cuda_callable__
+   const IteratorType
+   cbegin() const;
+
+   /**
+    * \brief Returns constant iterator pointing at the end of the matrix row.
+    *
+    * \return iterator pointing at the end.
+    */
+   __cuda_callable__
+   const IteratorType
+   cend() const;
+
+protected:
+   IndexType rowIdx, size;
+
+   // SANDBOX_TODO: Replace the following line with data required by your format.
+   IndexType offset;
+
+   ValuesViewType values;
+
+   ColumnsIndexesViewType columnIndexes;
 };
 
 /**
@@ -266,13 +274,12 @@ class SparseSandboxMatrixRowView
  * \param row is an input sparse matrix row.
  * \return  reference to the output stream.
  */
-template< typename ValuesView,
-          typename ColumnsIndexesView,
-          bool isBinary_ >
-std::ostream& operator<<( std::ostream& str, const SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >& row );
-
-      } // namespace Sandbox
-   } // namespace Matrices
-} // namespace TNL
+template< typename ValuesView, typename ColumnsIndexesView, bool isBinary_ >
+std::ostream&
+operator<<( std::ostream& str, const SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >& row );
+
+}  // namespace Sandbox
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/Sandbox/SparseSandboxMatrixRowView.hpp>
diff --git a/src/TNL/Matrices/Sandbox/SparseSandboxMatrixRowView.hpp b/src/TNL/Matrices/Sandbox/SparseSandboxMatrixRowView.hpp
index de6bd9b672b2cd48d08219e4ae72ab176f749332..76a40b6ba5c30f37e5702e69a3bb445cdb5a5a8a 100644
--- a/src/TNL/Matrices/Sandbox/SparseSandboxMatrixRowView.hpp
+++ b/src/TNL/Matrices/Sandbox/SparseSandboxMatrixRowView.hpp
@@ -10,75 +10,64 @@
 #include <TNL/Assert.h>
 
 namespace TNL {
-   namespace Matrices {
-      namespace Sandbox {
+namespace Matrices {
+namespace Sandbox {
 
 // SANDBOX_TODO: Modify the follwing constructor by your needs
-template< typename ValuesView,
-          typename ColumnsIndexesView,
-          bool isBinary_ >
+template< typename ValuesView, typename ColumnsIndexesView, bool isBinary_ >
 __cuda_callable__
-SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::
-SparseSandboxMatrixRowView( IndexType rowIdx,
-                            IndexType offset,
-                            IndexType size,
-                            const ValuesViewType& values,
-                            const ColumnsIndexesViewType& columnIndexes )
- : rowIdx( rowIdx ), size( size ), offset( offset ), values( values ), columnIndexes( columnIndexes )
-{
-}
-
-template< typename ValuesView,
-          typename ColumnsIndexesView,
-          bool isBinary_ >
-__cuda_callable__ auto
-SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::
-getSize() const -> IndexType
+SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::SparseSandboxMatrixRowView(
+   IndexType rowIdx,
+   IndexType offset,
+   IndexType size,
+   const ValuesViewType& values,
+   const ColumnsIndexesViewType& columnIndexes )
+: rowIdx( rowIdx ), size( size ), offset( offset ), values( values ), columnIndexes( columnIndexes )
+{}
+
+template< typename ValuesView, typename ColumnsIndexesView, bool isBinary_ >
+__cuda_callable__
+auto
+SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::getSize() const -> IndexType
 {
    return this->size;
 }
 
-template< typename ValuesView,
-          typename ColumnsIndexesView,
-          bool isBinary_ >
+template< typename ValuesView, typename ColumnsIndexesView, bool isBinary_ >
 __cuda_callable__
 auto
-SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::
-getRowIndex() const -> const IndexType&
+SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::getRowIndex() const -> const IndexType&
 {
    return this->rowIdx;
 }
 
-template< typename ValuesView,
-          typename ColumnsIndexesView,
-          bool isBinary_ >
-__cuda_callable__ auto
-SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::
-getColumnIndex( const IndexType localIdx ) const -> const IndexType&
+template< typename ValuesView, typename ColumnsIndexesView, bool isBinary_ >
+__cuda_callable__
+auto
+SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::getColumnIndex( const IndexType localIdx ) const
+   -> const IndexType&
 {
    TNL_ASSERT_LT( localIdx, this->getSize(), "Local index exceeds matrix row capacity." );
    // SANDBOX_TODO: Modify the following line to match with your sparse format.
    return columnIndexes[ offset + localIdx ];
 }
 
-template< typename ValuesView,
-          typename ColumnsIndexesView,
-          bool isBinary_ >
-__cuda_callable__ auto
-SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::
-getColumnIndex( const IndexType localIdx ) -> IndexType&
+template< typename ValuesView, typename ColumnsIndexesView, bool isBinary_ >
+__cuda_callable__
+auto
+SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::getColumnIndex( const IndexType localIdx )
+   -> IndexType&
 {
    TNL_ASSERT_LT( localIdx, this->getSize(), "Local index exceeds matrix row capacity." );
    // SANDBOX_TODO: Modify the following line to match with your sparse format.
    return columnIndexes[ offset + localIdx ];
 }
 
-template< typename ValuesView,
-          typename ColumnsIndexesView,
-          bool isBinary_ >
-__cuda_callable__ auto
-SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::
-getValue( const IndexType localIdx ) const -> const RealType&
+template< typename ValuesView, typename ColumnsIndexesView, bool isBinary_ >
+__cuda_callable__
+auto
+SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::getValue( const IndexType localIdx ) const
+   -> const RealType&
 {
    TNL_ASSERT_LT( localIdx, this->getSize(), "Local index exceeds matrix row capacity." );
    TNL_ASSERT_FALSE( isBinary(), "Cannot call this method for binary matrix row." );
@@ -86,12 +75,10 @@ getValue( const IndexType localIdx ) const -> const RealType&
    return values[ offset + localIdx ];
 }
 
-template< typename ValuesView,
-          typename ColumnsIndexesView,
-          bool isBinary_ >
-__cuda_callable__ auto
-SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::
-getValue( const IndexType localIdx ) -> RealType&
+template< typename ValuesView, typename ColumnsIndexesView, bool isBinary_ >
+__cuda_callable__
+auto
+SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::getValue( const IndexType localIdx ) -> RealType&
 {
    TNL_ASSERT_LT( localIdx, this->getSize(), "Local index exceeds matrix row capacity." );
    TNL_ASSERT_FALSE( isBinary(), "Cannot call this method for binary matrix row." );
@@ -99,13 +86,11 @@ getValue( const IndexType localIdx ) -> RealType&
    return values[ offset + localIdx ];
 }
 
-template< typename ValuesView,
-          typename ColumnsIndexesView,
-          bool isBinary_ >
-__cuda_callable__ void
-SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::
-setValue( const IndexType localIdx,
-          const RealType& value )
+template< typename ValuesView, typename ColumnsIndexesView, bool isBinary_ >
+__cuda_callable__
+void
+SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::setValue( const IndexType localIdx,
+                                                                                   const RealType& value )
 {
    TNL_ASSERT_LT( localIdx, this->getSize(), "Local index exceeds matrix row capacity." );
    if( ! isBinary() ) {
@@ -115,13 +100,11 @@ setValue( const IndexType localIdx,
    }
 }
 
-template< typename ValuesView,
-          typename ColumnsIndexesView,
-          bool isBinary_ >
-__cuda_callable__ void
-SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::
-setColumnIndex( const IndexType localIdx,
-                const IndexType& columnIndex )
+template< typename ValuesView, typename ColumnsIndexesView, bool isBinary_ >
+__cuda_callable__
+void
+SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::setColumnIndex( const IndexType localIdx,
+                                                                                         const IndexType& columnIndex )
 {
    TNL_ASSERT_LT( localIdx, this->getSize(), "Local index exceeds matrix row capacity." );
    // SANDBOX_TODO: Modify the following line to match with your sparse format.
@@ -129,14 +112,12 @@ setColumnIndex( const IndexType localIdx,
    this->columnIndexes[ globalIdx ] = columnIndex;
 }
 
-template< typename ValuesView,
-          typename ColumnsIndexesView,
-          bool isBinary_ >
-__cuda_callable__ void
-SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::
-setElement( const IndexType localIdx,
-            const IndexType column,
-            const RealType& value )
+template< typename ValuesView, typename ColumnsIndexesView, bool isBinary_ >
+__cuda_callable__
+void
+SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::setElement( const IndexType localIdx,
+                                                                                     const IndexType column,
+                                                                                     const RealType& value )
 {
    TNL_ASSERT_LT( localIdx, this->getSize(), "Local index exceeds matrix row capacity." );
    // SANDBOX_TODO: Modify the following line to match with your sparse format.
@@ -146,16 +127,12 @@ setElement( const IndexType localIdx,
       values[ globalIdx ] = value;
 }
 
-template< typename ValuesView,
-          typename ColumnsIndexesView,
-          bool isBinary_ >
-   template< typename _ValuesView,
-             typename _ColumnsIndexesView,
-             bool _isBinary >
+template< typename ValuesView, typename ColumnsIndexesView, bool isBinary_ >
+template< typename _ValuesView, typename _ColumnsIndexesView, bool _isBinary >
 __cuda_callable__
 bool
-SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::
-operator==( const SparseSandboxMatrixRowView< _ValuesView, _ColumnsIndexesView, _isBinary >& other ) const
+SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::operator==(
+   const SparseSandboxMatrixRowView< _ValuesView, _ColumnsIndexesView, _isBinary >& other ) const
 {
    IndexType i = 0;
    while( i < getSize() && i < other.getSize() ) {
@@ -176,61 +153,53 @@ operator==( const SparseSandboxMatrixRowView< _ValuesView, _ColumnsIndexesView,
    return true;
 }
 
-template< typename ValuesView,
-          typename ColumnsIndexesView,
-          bool isBinary_ >
-__cuda_callable__ auto
-SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::
-begin() -> IteratorType
+template< typename ValuesView, typename ColumnsIndexesView, bool isBinary_ >
+__cuda_callable__
+auto
+SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::begin() -> IteratorType
 {
    return IteratorType( *this, 0 );
 }
 
-template< typename ValuesView,
-          typename ColumnsIndexesView,
-          bool isBinary_ >
-__cuda_callable__ auto
-SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::
-end() -> IteratorType
+template< typename ValuesView, typename ColumnsIndexesView, bool isBinary_ >
+__cuda_callable__
+auto
+SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::end() -> IteratorType
 {
    return IteratorType( *this, this->getSize() );
 }
 
-template< typename ValuesView,
-          typename ColumnsIndexesView,
-          bool isBinary_ >
-__cuda_callable__ auto
-SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::
-cbegin() const -> const IteratorType
+template< typename ValuesView, typename ColumnsIndexesView, bool isBinary_ >
+__cuda_callable__
+auto
+SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::cbegin() const -> const IteratorType
 {
    return IteratorType( *this, 0 );
 }
 
-template< typename ValuesView,
-          typename ColumnsIndexesView,
-          bool isBinary_ >
-__cuda_callable__ auto
-SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::
-cend() const -> const IteratorType
+template< typename ValuesView, typename ColumnsIndexesView, bool isBinary_ >
+__cuda_callable__
+auto
+SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::cend() const -> const IteratorType
 {
    return IteratorType( *this, this->getSize() );
 }
 
-template< typename ValuesView,
-          typename ColumnsIndexesView,
-          bool isBinary_ >
-std::ostream& operator<<( std::ostream& str, const SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >& row )
+template< typename ValuesView, typename ColumnsIndexesView, bool isBinary_ >
+std::ostream&
+operator<<( std::ostream& str, const SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >& row )
 {
-   using NonConstIndex = std::remove_const_t< typename SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::IndexType >;
+   using NonConstIndex =
+      std::remove_const_t< typename SparseSandboxMatrixRowView< ValuesView, ColumnsIndexesView, isBinary_ >::IndexType >;
    for( NonConstIndex i = 0; i < row.getSize(); i++ )
       if( isBinary_ )
          // TODO: check getPaddingIndex(), print only the column indices of non-zeros but not the values
-         str << " [ " << row.getColumnIndex( i ) << " ] = " << (row.getColumnIndex( i ) >= 0) << ", ";
+         str << " [ " << row.getColumnIndex( i ) << " ] = " << ( row.getColumnIndex( i ) >= 0 ) << ", ";
       else
          str << " [ " << row.getColumnIndex( i ) << " ] = " << row.getValue( i ) << ", ";
    return str;
 }
 
-      } // namespace Sandbox
-   } // namespace Matrices
-} // namespace TNL
+}  // namespace Sandbox
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/Sandbox/SparseSandboxMatrixView.h b/src/TNL/Matrices/Sandbox/SparseSandboxMatrixView.h
index e6fd7dffe88c644a73f905686f944c2dec9de686..58e4b77dc87c8bf078bb3180afe1ea494b17bff8 100644
--- a/src/TNL/Matrices/Sandbox/SparseSandboxMatrixView.h
+++ b/src/TNL/Matrices/Sandbox/SparseSandboxMatrixView.h
@@ -14,8 +14,8 @@
 #include <TNL/TypeTraits.h>
 
 namespace TNL {
-   namespace Matrices {
-      namespace Sandbox {
+namespace Matrices {
+namespace Sandbox {
 
 /**
  * \brief Implementation of sparse sandbox matrix view.
@@ -38,830 +38,863 @@ namespace TNL {
  *    bu the user, of course.
  *
  */
-template< typename Real,
-          typename Device = Devices::Host,
-          typename Index = int,
-          typename MatrixType = GeneralMatrix >
+template< typename Real, typename Device = Devices::Host, typename Index = int, typename MatrixType = GeneralMatrix >
 class SparseSandboxMatrixView : public MatrixView< Real, Device, Index >
 {
    static_assert(
-      ! MatrixType::isSymmetric() ||
-      ! std::is_same< Device, Devices::Cuda >::value ||
-      ( std::is_same< Real, float >::value || std::is_same< Real, double >::value || std::is_same< Real, int >::value || std::is_same< Real, long long int >::value ),
+      ! MatrixType::isSymmetric() || ! std::is_same< Device, Devices::Cuda >::value
+         || ( std::is_same< Real, float >::value || std::is_same< Real, double >::value || std::is_same< Real, int >::value
+              || std::is_same< Real, long long int >::value ),
       "Given Real type is not supported by atomic operations on GPU which are necessary for symmetric operations." );
 
-   public:
-
-      // Supporting types - they are not important for the user
-      using BaseType = MatrixView< Real, Device, Index >;
-      using ValuesViewType = typename BaseType::ValuesView;
-      using ConstValuesViewType = typename ValuesViewType::ConstViewType;
-      using ColumnsIndexesViewType = Containers::VectorView< typename TNL::copy_const< Index >::template from< Real >::type, Device, Index >;
-      using ConstColumnsIndexesViewType = typename ColumnsIndexesViewType::ConstViewType;
-      using RowsCapacitiesView = Containers::VectorView< Index, Device, Index >;
-      using ConstRowsCapacitiesView = typename RowsCapacitiesView::ConstViewType;
-
-      /**
-       * \brief Test of symmetric matrix type.
-       *
-       * \return \e true if the matrix is stored as symmetric and \e false otherwise.
-       */
-      static constexpr bool isSymmetric() { return MatrixType::isSymmetric(); };
-
-      /**
-       * \brief Test of binary matrix type.
-       *
-       * \return \e true if the matrix is stored as binary and \e false otherwise.
-       */
-      static constexpr bool isBinary() { return std::is_same< Real, bool >::value; };
-
-      /**
-       * \brief The type of matrix elements.
-       */
-      using RealType = Real;
-
-      //using ComputeRealType = ComputeReal;
-
-      /**
-       * \brief The device where the matrix is allocated.
-       */
-      using DeviceType = Device;
-
-      /**
-       * \brief The type used for matrix elements indexing.
-       */
-      using IndexType = Index;
-
-      /**
-       * \brief Templated type of segments view, i.e. sparse matrix format.
-       */
-      //template< typename Device_, typename Index_ >
-      //using SegmentsViewTemplate = SegmentsView< Device_, Index_ >;
-
-      /**
-       * \brief Type of segments view used by this matrix. It represents the sparse matrix format.
-       */
-      //using SegmentsViewType = SegmentsView< Device, Index >;
-
-      /**
-       * \brief Type of related matrix view.
-       */
-      using ViewType = SparseSandboxMatrixView< Real, Device, Index, MatrixType >;
-
-      /**
-       * \brief Matrix view type for constant instances.
-       */
-      using ConstViewType = SparseSandboxMatrixView< std::add_const_t< Real >, Device, Index, MatrixType >;
-
-      /**
-       * \brief Type for accessing matrix rows.
-       */
-      using RowView = SparseSandboxMatrixRowView< ValuesViewType, ColumnsIndexesViewType, isBinary() >;
-
-      /**
-       * \brief Type for accessing constant matrix rows.
-       */
-      using ConstRowView = SparseSandboxMatrixRowView< ConstValuesViewType, ConstColumnsIndexesViewType, isBinary() >;;
-
-      /**
-       * \brief Helper type for getting self type or its modifications.
-       */
-      template< typename _Real = Real,
-                typename _Device = Device,
-                typename _Index = Index,
-                typename _MatrixType = MatrixType >
-      using Self = SparseSandboxMatrixView< _Real, _Device, _Index, _MatrixType >;
-
-      /**
-       * \brief Type of container view for CSR row pointers.
-       *
-       * SANDBOX_TODO: You may replace it with containers views for metadata of your format.
-       */
-      using RowPointersView = TNL::Containers::VectorView< IndexType, DeviceType, IndexType >;
-
-      /**
-       * \brief Constructor with no parameters.
-       */
-      __cuda_callable__
-      SparseSandboxMatrixView();
-
-      /**
-       * \brief Constructor with all necessary data and views.
-       *
-       * \param rows is a number of matrix rows.
-       * \param columns is a number of matrix columns.
-       * \param values is a vector view with matrix elements values.
-       * \param columnIndexes is a vector view with matrix elements column indexes.
-       * \param rowPointers is a container view with row pointers.
-       *
-       * SANDBOX_TODO: Replace `rowPointers` with metadata by your needs.
-       */
-      __cuda_callable__
-      SparseSandboxMatrixView( const IndexType rows,
-                               const IndexType columns,
-                               const ValuesViewType& values,
-                               const ColumnsIndexesViewType& columnIndexes,
-                               const RowPointersView& rowPointers );
-
-      /**
-       * \brief Copy constructor.
-       *
-       * \param matrix is an input sparse matrix view.
-       */
-      __cuda_callable__
-      SparseSandboxMatrixView( const SparseSandboxMatrixView& matrix ) = default;
-
-      /**
-       * \brief Move constructor.
-       *
-       * \param matrix is an input sparse matrix view.
-       */
-      __cuda_callable__
-      SparseSandboxMatrixView( SparseSandboxMatrixView&& matrix ) = default;
-
-      /**
-       * \brief Returns a modifiable view of the sparse matrix.
-       *
-       * \return sparse matrix view.
-       */
-      __cuda_callable__
-      ViewType getView();
-
-      /**
-       * \brief Returns a non-modifiable view of the sparse matrix.
-       *
-       * \return sparse matrix view.
-       */
-      __cuda_callable__
-      ConstViewType getConstView() const;
-
-      /**
-       * \brief Returns string with serialization type.
-       *
-       * The string has a form `Matrices::SparseSandboxMatrix< RealType,  [any_device], IndexType, General/Symmetric, Format, [any_allocator] >`.
-       *
-       * \return \ref String with the serialization type.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_getSerializationType.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_getSerializationType.out
-       */
-      static String getSerializationType();
-
-      /**
-       * \brief Returns string with serialization type.
-       *
-       * See \ref SparseSandboxMatrix::getSerializationType.
-       *
-       * \return \e String with the serialization type.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_getSerializationType.cpp
-       * \par Output
-       * \include SparseMatrixExample_getSerializationType.out
-       */
-      virtual String getSerializationTypeVirtual() const;
-
-      /**
-       * \brief Computes number of non-zeros in each row.
-       *
-       * \param rowLengths is a vector into which the number of non-zeros in each row
-       * will be stored.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_getCompressedRowLengths.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_getCompressedRowLengths.out
-       */
-      template< typename Vector >
-      void getCompressedRowLengths( Vector& rowLengths ) const;
-
-      /**
-       * \brief Compute capacities of all rows.
-       *
-       * The row capacities are not stored explicitly and must be computed.
-       *
-       * \param rowCapacities is a vector where the row capacities will be stored.
-       */
-      template< typename Vector >
-      void getRowCapacities( Vector& rowCapacities ) const;
-
-      /**
-       * \brief Returns capacity of given matrix row.
-       *
-       * \param row index of matrix row.
-       * \return number of matrix elements allocated for the row.
-       */
-      __cuda_callable__
-      IndexType getRowCapacity( const IndexType row ) const;
-
-      /**
-       * \brief Returns number of non-zero matrix elements.
-       *
-       * This method really counts the non-zero matrix elements and so
-       * it returns zero for matrix having all allocated elements set to zero.
-       *
-       * \return number of non-zero matrix elements.
-       */
-      IndexType getNonzeroElementsCount() const;
-
-      /**
-       * \brief Constant getter of simple structure for accessing given matrix row.
-       *
-       * \param rowIdx is matrix row index.
-       *
-       * \return RowView for accessing given matrix row.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_getConstRow.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_getConstRow.out
-       *
-       * See \ref SparseSandboxMatrixRowView.
-       */
-      __cuda_callable__
-      ConstRowView getRow( const IndexType& rowIdx ) const;
-
-      /**
-       * \brief Non-constant getter of simple structure for accessing given matrix row.
-       *
-       * \param rowIdx is matrix row index.
-       *
-       * \return RowView for accessing given matrix row.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_getRow.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_getRow.out
-       *
-       * See \ref SparseSandboxMatrixRowView.
-       */
-      __cuda_callable__
-      RowView getRow( const IndexType& rowIdx );
-
-      /**
-       * \brief Sets element at given \e row and \e column to given \e value.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref SparseSandboxMatrix::getRow
-       * or \ref SparseSandboxMatrix::forElements and \ref SparseSandboxMatrix::forAllElements.
-       * The call may fail if the matrix row capacity is exhausted.
-       *
-       * \param row is row index of the element.
-       * \param column is columns index of the element.
-       * \param value is the value the element will be set to.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_setElement.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_setElement.out
-       */
-      __cuda_callable__
-      void setElement( const IndexType row,
-                       const IndexType column,
-                       const RealType& value );
-
-      /**
-       * \brief Add element at given \e row and \e column to given \e value.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref SparseSandboxMatrix::getRow
-       * or \ref SparseSandboxMatrix::forElements and \ref SparseSandboxMatrix::forAllElements.
-       * The call may fail if the matrix row capacity is exhausted.
-       *
-       * \param row is row index of the element.
-       * \param column is columns index of the element.
-       * \param value is the value the element will be set to.
-       * \param thisElementMultiplicator is multiplicator the original matrix element
-       *   value is multiplied by before addition of given \e value.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_addElement.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_addElement.out
-       */
-      __cuda_callable__
-      void addElement( IndexType row,
-                       IndexType column,
-                       const RealType& value,
-                       const RealType& thisElementMultiplicator = 1.0 );
-
-      /**
-       * \brief Returns value of matrix element at position given by its row and column index.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref SparseSandboxMatrix::getRow
-       * or \ref SparseSandboxMatrix::forElements and \ref SparseSandboxMatrix::forAllElements.
-       *
-       * \param row is a row index of the matrix element.
-       * \param column i a column index of the matrix element.
-       *
-       * \return value of given matrix element.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_getElement.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_getElement.out
-       *
-       */
-      __cuda_callable__
-      RealType getElement( IndexType row,
-                           IndexType column ) const;
-
-      /**
-       * \brief Method for performing general reduction on matrix rows.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *          `fetch( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue`.
-       *          The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *          `reduce( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue`.
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row.
-       *          It is declared as `keep( const IndexType rowIdx, const double& value )`.
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param zero is zero of given reduction operation also known as idempotent element.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_reduceRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_reduceRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& zero );
-
-      /**
-       * \brief Method for performing general reduction on matrix rows for constant instances.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *          `fetch( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue`.
-       *          The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *          `reduce( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue`.
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row.
-       *          It is declared as `keep( const IndexType rowIdx, const double& value )`.
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param zero is zero of given reduction operation also known as idempotent element.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_reduceRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_reduceRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& zero ) const;
-
-      /**
-       * \brief Method for performing general reduction on all matrix rows.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *          `fetch( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue`.
-       *          The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *          `reduce( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue`.
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row.
-       *          It is declared as `keep( const IndexType rowIdx, const double& value )`.
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param zero is zero of given reduction operation also known as idempotent element.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_reduceAllRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_reduceAllRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& zero );
-
-      /**
-       * \brief Method for performing general reduction on all matrix rows for constant instances.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *          `fetch( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue`.
-       *          The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *          `reduce( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue`.
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row.
-       *          It is declared as `keep( const IndexType rowIdx, const double& value )`.
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param zero is zero of given reduction operation also known as idempotent element.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_reduceAllRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_reduceAllRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& zero ) const;
-
-      /**
-       * \brief Method for iteration over all matrix rows for constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements.
-       *    It is should have form like
-       *  `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )`.
-       *  The \e localIdx parameter is a rank of the non-zero element in given row.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function& function ) const;
-
-      /**
-       * \brief Method for iteration over all matrix rows for non-constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements.
-       *    It is should have form like
-       *  `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )`.
-       *  The \e localIdx parameter is a rank of the non-zero element in given row.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function& function );
-
-      /**
-       * \brief This method calls \e forElements for all matrix rows (for constant instances).
-       *
-       * See \ref SparseSandboxMatrix::forElements.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_forAllRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_forAllRows.out
-       */
-      template< typename Function >
-      void forAllElements( Function& function ) const;
-
-      /**
-       * \brief This method calls \e forElements for all matrix rows.
-       *
-       * See \ref SparseSandboxMatrix::forElements.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_forAllRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_forAllRows.out
-       */
-      template< typename Function >
-      void forAllElements( Function& function );
-
-      /**
-       * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end).
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref SparseSandboxMatrixView::forElements where more than one thread can be mapped to each row.
-
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::SparseSandboxMatrixView::RowView.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forRows( IndexType begin, IndexType end, Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end) for constant instances.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref SparseSandboxMatrixView::forElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::SparseSandboxMatrixView::RowView.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forRows( IndexType begin, IndexType end, Function&& function ) const;
-
-      /**
-       * \brief Method for parallel iteration over all matrix rows.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref SparseSandboxMatrixView::forAllElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::SparseSandboxMatrixView::RowView.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forAllRows( Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over all matrix rows for constant instances.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref SparseSandboxMatrixView::forAllElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::SparseSandboxMatrixView::RowView.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forAllRows( Function&& function ) const;
-
-      /**
-       * \brief Method for sequential iteration over all matrix rows for constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements.
-       *    It is should have form like
-       *  `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value )`.
-       *  The column index repeats twice only for compatibility with sparse matrices.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForRows( IndexType begin, IndexType end, Function& function ) const;
-
-      /**
-       * \brief Method for sequential iteration over all matrix rows for non-constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements.
-       *    It is should have form like
-       *  `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value )`.
-       *  The column index repeats twice only for compatibility with sparse matrices.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForRows( IndexType begin, IndexType end, Function& function );
-
-      /**
-       * \brief This method calls \e sequentialForRows for all matrix rows (for constant instances).
-       *
-       * See \ref SparseSandboxMatrixView::sequentialForRows.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForAllRows( Function& function ) const;
-
-      /**
-       * \brief This method calls \e sequentialForRows for all matrix rows.
-       *
-       * See \ref SparseSandboxMatrixView::sequentialForAllRows.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForAllRows( Function& function );
-
-      /**
-       * \brief Computes product of matrix and vector.
-       *
-       * More precisely, it computes:
-       *
-       * `outVector = matrixMultiplicator * ( * this ) * inVector + outVectorMultiplicator * outVector`
-       *
-       * \tparam InVector is type of input vector.  It can be \ref Vector,
-       *     \ref VectorView, \ref Array, \ref ArraView or similar container.
-       * \tparam OutVector is type of output vector. It can be \ref Vector,
-       *     \ref VectorView, \ref Array, \ref ArraView or similar container.
-       *
-       * \param inVector is input vector.
-       * \param outVector is output vector.
-       * \param matrixMultiplicator is a factor by which the matrix is multiplied. It is one by default.
-       * \param outVectorMultiplicator is a factor by which the outVector is multiplied before added
-       *    to the result of matrix-vector product. It is zero by default.
-       * \param begin is the beginning of the rows range for which the vector product
-       *    is computed. It is zero by default.
-       * \param end is the end of the rows range for which the vector product
-       *    is computed. It is number if the matrix rows by default.
-       */
-      template< typename InVector,
-                typename OutVector >
-      void vectorProduct( const InVector& inVector,
-                          OutVector& outVector,
-                          const RealType matrixMultiplicator = 1.0,
-                          const RealType outVectorMultiplicator = 0.0,
-                          const IndexType begin = 0,
-                          IndexType end = 0 ) const;
-
-      template< typename Vector1, typename Vector2 >
-      bool performSORIteration( const Vector1& b,
-                                const IndexType row,
-                                Vector2& x,
-                                const RealType& omega = 1.0 ) const;
-
-      /**
-       * \brief Assignment of any matrix type.
-       * .
-       * \param matrix is input matrix for the assignment.
-       * \return reference to this matrix.
-       */
-      SparseSandboxMatrixView& operator=( const SparseSandboxMatrixView& matrix );
-
-      /**
-       * \brief Comparison operator with another arbitrary matrix type.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return \e true if the RHS matrix is equal, \e false otherwise.
-       */
-      template< typename Matrix >
-      bool operator==( const Matrix& m ) const;
-
-      /**
-       * \brief Comparison operator with another arbitrary matrix type.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return \e true if the RHS matrix is equal, \e false otherwise.
-       */
-      template< typename Matrix >
-      bool operator!=( const Matrix& m ) const;
-
-      /**
-       * \brief Method for saving the matrix to the file with given filename.
-       *
-       * \param fileName is name of the file.
-       */
-      void save( const String& fileName ) const;
-
-      /**
-       * \brief Method for saving the matrix to a file.
-       *
-       * \param file is the output file.
-       */
-      void save( File& file ) const;
-
-      /**
-       * \brief Method for printing the matrix to output stream.
-       *
-       * \param str is the output stream.
-       */
-      void print( std::ostream& str ) const;
-
-      /**
-       * \brief Getter of segments for non-constant instances.
-       *
-       * \e Segments are a structure for addressing the matrix elements columns and values.
-       * In fact, \e Segments represent the sparse matrix format.
-       *
-       * \return Non-constant reference to segments.
-       */
-      //SegmentsViewType& getSegments();
-
-      /**
-       * \brief Getter of segments for constant instances.
-       *
-       * \e Segments are a structure for addressing the matrix elements columns and values.
-       * In fact, \e Segments represent the sparse matrix format.
-       *
-       * \return Constant reference to segments.
-       */
-      //const SegmentsViewType& getSegments() const;
-
-      /**
-       * \brief Getter of column indexes for constant instances.
-       *
-       * \return Constant reference to a vector with matrix elements column indexes.
-       */
-      const ColumnsIndexesViewType& getColumnIndexes() const;
-
-      /**
-       * \brief Getter of column indexes for nonconstant instances.
-       *
-       * \return Reference to a vector with matrix elements column indexes.
-       */
-      ColumnsIndexesViewType& getColumnIndexes();
-
-      /**
-       * \brief Returns a padding index value.
-       *
-       * Padding index is used for column indexes of padding zeros. Padding zeros
-       * are used in some sparse matrix formats for better data alignment in memory.
-       *
-       * \return value of the padding index.
-       */
-      __cuda_callable__
-      IndexType getPaddingIndex() const;
-
-   protected:
-
-      ColumnsIndexesViewType columnIndexes;
-
-      RowPointersView rowPointers;
-      //SegmentsViewType segments;
-
-   private:
-      // TODO: this should be probably moved into a detail namespace
-      template< typename VectorOrView,
-                std::enable_if_t< HasSetSizeMethod< VectorOrView >::value, bool > = true >
-      static void set_size_if_resizable( VectorOrView& v, IndexType size )
-      {
-         v.setSize( size );
-      }
-
-      template< typename VectorOrView,
-                std::enable_if_t< ! HasSetSizeMethod< VectorOrView >::value, bool > = true >
-      static void set_size_if_resizable( VectorOrView& v, IndexType size )
-      {
-         TNL_ASSERT_EQ( v.getSize(), size, "view has wrong size" );
-      }
+public:
+   // Supporting types - they are not important for the user
+   using BaseType = MatrixView< Real, Device, Index >;
+   using ValuesViewType = typename BaseType::ValuesView;
+   using ConstValuesViewType = typename ValuesViewType::ConstViewType;
+   using ColumnsIndexesViewType =
+      Containers::VectorView< typename TNL::copy_const< Index >::template from< Real >::type, Device, Index >;
+   using ConstColumnsIndexesViewType = typename ColumnsIndexesViewType::ConstViewType;
+   using RowsCapacitiesView = Containers::VectorView< Index, Device, Index >;
+   using ConstRowsCapacitiesView = typename RowsCapacitiesView::ConstViewType;
+
+   /**
+    * \brief Test of symmetric matrix type.
+    *
+    * \return \e true if the matrix is stored as symmetric and \e false otherwise.
+    */
+   static constexpr bool
+   isSymmetric()
+   {
+      return MatrixType::isSymmetric();
+   };
+
+   /**
+    * \brief Test of binary matrix type.
+    *
+    * \return \e true if the matrix is stored as binary and \e false otherwise.
+    */
+   static constexpr bool
+   isBinary()
+   {
+      return std::is_same< Real, bool >::value;
+   };
+
+   /**
+    * \brief The type of matrix elements.
+    */
+   using RealType = Real;
+
+   // using ComputeRealType = ComputeReal;
+
+   /**
+    * \brief The device where the matrix is allocated.
+    */
+   using DeviceType = Device;
+
+   /**
+    * \brief The type used for matrix elements indexing.
+    */
+   using IndexType = Index;
+
+   /**
+    * \brief Templated type of segments view, i.e. sparse matrix format.
+    */
+   // template< typename Device_, typename Index_ >
+   // using SegmentsViewTemplate = SegmentsView< Device_, Index_ >;
+
+   /**
+    * \brief Type of segments view used by this matrix. It represents the sparse matrix format.
+    */
+   // using SegmentsViewType = SegmentsView< Device, Index >;
+
+   /**
+    * \brief Type of related matrix view.
+    */
+   using ViewType = SparseSandboxMatrixView< Real, Device, Index, MatrixType >;
+
+   /**
+    * \brief Matrix view type for constant instances.
+    */
+   using ConstViewType = SparseSandboxMatrixView< std::add_const_t< Real >, Device, Index, MatrixType >;
+
+   /**
+    * \brief Type for accessing matrix rows.
+    */
+   using RowView = SparseSandboxMatrixRowView< ValuesViewType, ColumnsIndexesViewType, isBinary() >;
+
+   /**
+    * \brief Type for accessing constant matrix rows.
+    */
+   using ConstRowView = SparseSandboxMatrixRowView< ConstValuesViewType, ConstColumnsIndexesViewType, isBinary() >;
+   ;
+
+   /**
+    * \brief Helper type for getting self type or its modifications.
+    */
+   template< typename _Real = Real, typename _Device = Device, typename _Index = Index, typename _MatrixType = MatrixType >
+   using Self = SparseSandboxMatrixView< _Real, _Device, _Index, _MatrixType >;
+
+   /**
+    * \brief Type of container view for CSR row pointers.
+    *
+    * SANDBOX_TODO: You may replace it with containers views for metadata of your format.
+    */
+   using RowPointersView = TNL::Containers::VectorView< IndexType, DeviceType, IndexType >;
+
+   /**
+    * \brief Constructor with no parameters.
+    */
+   __cuda_callable__
+   SparseSandboxMatrixView();
+
+   /**
+    * \brief Constructor with all necessary data and views.
+    *
+    * \param rows is a number of matrix rows.
+    * \param columns is a number of matrix columns.
+    * \param values is a vector view with matrix elements values.
+    * \param columnIndexes is a vector view with matrix elements column indexes.
+    * \param rowPointers is a container view with row pointers.
+    *
+    * SANDBOX_TODO: Replace `rowPointers` with metadata by your needs.
+    */
+   __cuda_callable__
+   SparseSandboxMatrixView( IndexType rows,
+                            IndexType columns,
+                            const ValuesViewType& values,
+                            const ColumnsIndexesViewType& columnIndexes,
+                            const RowPointersView& rowPointers );
+
+   /**
+    * \brief Copy constructor.
+    *
+    * \param matrix is an input sparse matrix view.
+    */
+   __cuda_callable__
+   SparseSandboxMatrixView( const SparseSandboxMatrixView& matrix ) = default;
+
+   /**
+    * \brief Move constructor.
+    *
+    * \param matrix is an input sparse matrix view.
+    */
+   __cuda_callable__
+   SparseSandboxMatrixView( SparseSandboxMatrixView&& matrix ) noexcept = default;
+
+   /**
+    * \brief Returns a modifiable view of the sparse matrix.
+    *
+    * \return sparse matrix view.
+    */
+   __cuda_callable__
+   ViewType
+   getView();
+
+   /**
+    * \brief Returns a non-modifiable view of the sparse matrix.
+    *
+    * \return sparse matrix view.
+    */
+   __cuda_callable__
+   ConstViewType
+   getConstView() const;
+
+   /**
+    * \brief Returns string with serialization type.
+    *
+    * The string has a form `Matrices::SparseSandboxMatrix< RealType,  [any_device], IndexType, General/Symmetric, Format,
+    * [any_allocator] >`.
+    *
+    * \return \ref String with the serialization type.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_getSerializationType.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_getSerializationType.out
+    */
+   static std::string
+   getSerializationType();
+
+   /**
+    * \brief Returns string with serialization type.
+    *
+    * See \ref SparseSandboxMatrix::getSerializationType.
+    *
+    * \return \e String with the serialization type.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_getSerializationType.cpp
+    * \par Output
+    * \include SparseMatrixExample_getSerializationType.out
+    */
+   std::string
+   getSerializationTypeVirtual() const override;
+
+   /**
+    * \brief Computes number of non-zeros in each row.
+    *
+    * \param rowLengths is a vector into which the number of non-zeros in each row
+    * will be stored.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_getCompressedRowLengths.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_getCompressedRowLengths.out
+    */
+   template< typename Vector >
+   void
+   getCompressedRowLengths( Vector& rowLengths ) const;
+
+   /**
+    * \brief Compute capacities of all rows.
+    *
+    * The row capacities are not stored explicitly and must be computed.
+    *
+    * \param rowCapacities is a vector where the row capacities will be stored.
+    */
+   template< typename Vector >
+   void
+   getRowCapacities( Vector& rowCapacities ) const;
+
+   /**
+    * \brief Returns capacity of given matrix row.
+    *
+    * \param row index of matrix row.
+    * \return number of matrix elements allocated for the row.
+    */
+   __cuda_callable__
+   IndexType
+   getRowCapacity( IndexType row ) const;
+
+   /**
+    * \brief Returns number of non-zero matrix elements.
+    *
+    * This method really counts the non-zero matrix elements and so
+    * it returns zero for matrix having all allocated elements set to zero.
+    *
+    * \return number of non-zero matrix elements.
+    */
+   IndexType
+   getNonzeroElementsCount() const override;
+
+   /**
+    * \brief Constant getter of simple structure for accessing given matrix row.
+    *
+    * \param rowIdx is matrix row index.
+    *
+    * \return RowView for accessing given matrix row.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_getConstRow.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_getConstRow.out
+    *
+    * See \ref SparseSandboxMatrixRowView.
+    */
+   __cuda_callable__
+   ConstRowView
+   getRow( const IndexType& rowIdx ) const;
+
+   /**
+    * \brief Non-constant getter of simple structure for accessing given matrix row.
+    *
+    * \param rowIdx is matrix row index.
+    *
+    * \return RowView for accessing given matrix row.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_getRow.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_getRow.out
+    *
+    * See \ref SparseSandboxMatrixRowView.
+    */
+   __cuda_callable__
+   RowView
+   getRow( const IndexType& rowIdx );
+
+   /**
+    * \brief Sets element at given \e row and \e column to given \e value.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref SparseSandboxMatrix::getRow
+    * or \ref SparseSandboxMatrix::forElements and \ref SparseSandboxMatrix::forAllElements.
+    * The call may fail if the matrix row capacity is exhausted.
+    *
+    * \param row is row index of the element.
+    * \param column is columns index of the element.
+    * \param value is the value the element will be set to.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_setElement.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_setElement.out
+    */
+   __cuda_callable__
+   void
+   setElement( IndexType row, IndexType column, const RealType& value );
+
+   /**
+    * \brief Add element at given \e row and \e column to given \e value.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref SparseSandboxMatrix::getRow
+    * or \ref SparseSandboxMatrix::forElements and \ref SparseSandboxMatrix::forAllElements.
+    * The call may fail if the matrix row capacity is exhausted.
+    *
+    * \param row is row index of the element.
+    * \param column is columns index of the element.
+    * \param value is the value the element will be set to.
+    * \param thisElementMultiplicator is multiplicator the original matrix element
+    *   value is multiplied by before addition of given \e value.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_addElement.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_addElement.out
+    */
+   __cuda_callable__
+   void
+   addElement( IndexType row, IndexType column, const RealType& value, const RealType& thisElementMultiplicator = 1.0 );
+
+   /**
+    * \brief Returns value of matrix element at position given by its row and column index.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref SparseSandboxMatrix::getRow
+    * or \ref SparseSandboxMatrix::forElements and \ref SparseSandboxMatrix::forAllElements.
+    *
+    * \param row is a row index of the matrix element.
+    * \param column i a column index of the matrix element.
+    *
+    * \return value of given matrix element.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_getElement.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_getElement.out
+    *
+    */
+   __cuda_callable__
+   RealType
+   getElement( IndexType row, IndexType column ) const;
+
+   /**
+    * \brief Method for performing general reduction on matrix rows.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *          `fetch( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue`.
+    *          The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *          `reduce( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue`.
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row.
+    *          It is declared as `keep( const IndexType rowIdx, const double& value )`.
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param zero is zero of given reduction operation also known as idempotent element.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_reduceRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_reduceRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& zero );
+
+   /**
+    * \brief Method for performing general reduction on matrix rows for constant instances.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *          `fetch( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue`.
+    *          The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *          `reduce( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue`.
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row.
+    *          It is declared as `keep( const IndexType rowIdx, const double& value )`.
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param zero is zero of given reduction operation also known as idempotent element.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_reduceRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_reduceRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& zero ) const;
+
+   /**
+    * \brief Method for performing general reduction on all matrix rows.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *          `fetch( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue`.
+    *          The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *          `reduce( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue`.
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row.
+    *          It is declared as `keep( const IndexType rowIdx, const double& value )`.
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param zero is zero of given reduction operation also known as idempotent element.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_reduceAllRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_reduceAllRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& zero );
+
+   /**
+    * \brief Method for performing general reduction on all matrix rows for constant instances.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *          `fetch( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue`.
+    *          The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *          `reduce( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue`.
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row.
+    *          It is declared as `keep( const IndexType rowIdx, const double& value )`.
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param zero is zero of given reduction operation also known as idempotent element.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_reduceAllRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_reduceAllRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& zero ) const;
+
+   /**
+    * \brief Method for iteration over all matrix rows for constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements.
+    *    It is should have form like
+    *  `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )`.
+    *  The \e localIdx parameter is a rank of the non-zero element in given row.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function& function ) const;
+
+   /**
+    * \brief Method for iteration over all matrix rows for non-constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements.
+    *    It is should have form like
+    *  `function( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )`.
+    *  The \e localIdx parameter is a rank of the non-zero element in given row.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function& function );
+
+   /**
+    * \brief This method calls \e forElements for all matrix rows (for constant instances).
+    *
+    * See \ref SparseSandboxMatrix::forElements.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_forAllRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_forAllRows.out
+    */
+   template< typename Function >
+   void
+   forAllElements( Function& function ) const;
+
+   /**
+    * \brief This method calls \e forElements for all matrix rows.
+    *
+    * See \ref SparseSandboxMatrix::forElements.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_forAllRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_forAllRows.out
+    */
+   template< typename Function >
+   void
+   forAllElements( Function& function );
+
+   /**
+    * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end).
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref SparseSandboxMatrixView::forElements where more than one thread can be mapped to each row.
+
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::SparseSandboxMatrixView::RowView.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forRows( IndexType begin, IndexType end, Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end) for constant instances.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref SparseSandboxMatrixView::forElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::SparseSandboxMatrixView::RowView.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forRows( IndexType begin, IndexType end, Function&& function ) const;
+
+   /**
+    * \brief Method for parallel iteration over all matrix rows.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref SparseSandboxMatrixView::forAllElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::SparseSandboxMatrixView::RowView.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forAllRows( Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over all matrix rows for constant instances.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref SparseSandboxMatrixView::forAllElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::SparseSandboxMatrixView::RowView.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forAllRows( Function&& function ) const;
+
+   /**
+    * \brief Method for sequential iteration over all matrix rows for constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements.
+    *    It is should have form like
+    *  `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, const RealType& value )`.
+    *  The column index repeats twice only for compatibility with sparse matrices.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForRows( IndexType begin, IndexType end, Function& function ) const;
+
+   /**
+    * \brief Method for sequential iteration over all matrix rows for non-constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements.
+    *    It is should have form like
+    *  `function( IndexType rowIdx, IndexType columnIdx, IndexType columnIdx_, RealType& value )`.
+    *  The column index repeats twice only for compatibility with sparse matrices.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForRows( IndexType begin, IndexType end, Function& function );
+
+   /**
+    * \brief This method calls \e sequentialForRows for all matrix rows (for constant instances).
+    *
+    * See \ref SparseSandboxMatrixView::sequentialForRows.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForAllRows( Function& function ) const;
+
+   /**
+    * \brief This method calls \e sequentialForRows for all matrix rows.
+    *
+    * See \ref SparseSandboxMatrixView::sequentialForAllRows.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForAllRows( Function& function );
+
+   /**
+    * \brief Computes product of matrix and vector.
+    *
+    * More precisely, it computes:
+    *
+    * `outVector = matrixMultiplicator * ( * this ) * inVector + outVectorMultiplicator * outVector`
+    *
+    * \tparam InVector is type of input vector.  It can be \ref Vector,
+    *     \ref VectorView, \ref Array, \ref ArraView or similar container.
+    * \tparam OutVector is type of output vector. It can be \ref Vector,
+    *     \ref VectorView, \ref Array, \ref ArraView or similar container.
+    *
+    * \param inVector is input vector.
+    * \param outVector is output vector.
+    * \param matrixMultiplicator is a factor by which the matrix is multiplied. It is one by default.
+    * \param outVectorMultiplicator is a factor by which the outVector is multiplied before added
+    *    to the result of matrix-vector product. It is zero by default.
+    * \param begin is the beginning of the rows range for which the vector product
+    *    is computed. It is zero by default.
+    * \param end is the end of the rows range for which the vector product
+    *    is computed. It is number if the matrix rows by default.
+    */
+   template< typename InVector, typename OutVector >
+   void
+   vectorProduct( const InVector& inVector,
+                  OutVector& outVector,
+                  RealType matrixMultiplicator = 1.0,
+                  RealType outVectorMultiplicator = 0.0,
+                  IndexType begin = 0,
+                  IndexType end = 0 ) const;
+
+   template< typename Vector1, typename Vector2 >
+   bool
+   performSORIteration( const Vector1& b, IndexType row, Vector2& x, const RealType& omega = 1.0 ) const;
+
+   /**
+    * \brief Assignment of any matrix type.
+    * .
+    * \param matrix is input matrix for the assignment.
+    * \return reference to this matrix.
+    */
+   SparseSandboxMatrixView&
+   operator=( const SparseSandboxMatrixView& matrix );
+
+   /**
+    * \brief Comparison operator with another arbitrary matrix type.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return \e true if the RHS matrix is equal, \e false otherwise.
+    */
+   template< typename Matrix >
+   bool
+   operator==( const Matrix& m ) const;
+
+   /**
+    * \brief Comparison operator with another arbitrary matrix type.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return \e true if the RHS matrix is equal, \e false otherwise.
+    */
+   template< typename Matrix >
+   bool
+   operator!=( const Matrix& m ) const;
+
+   /**
+    * \brief Method for saving the matrix to the file with given filename.
+    *
+    * \param fileName is name of the file.
+    */
+   void
+   save( const String& fileName ) const;
+
+   /**
+    * \brief Method for saving the matrix to a file.
+    *
+    * \param file is the output file.
+    */
+   void
+   save( File& file ) const override;
+
+   /**
+    * \brief Method for printing the matrix to output stream.
+    *
+    * \param str is the output stream.
+    */
+   void
+   print( std::ostream& str ) const override;
+
+   /**
+    * \brief Getter of segments for non-constant instances.
+    *
+    * \e Segments are a structure for addressing the matrix elements columns and values.
+    * In fact, \e Segments represent the sparse matrix format.
+    *
+    * \return Non-constant reference to segments.
+    */
+   // SegmentsViewType& getSegments();
+
+   /**
+    * \brief Getter of segments for constant instances.
+    *
+    * \e Segments are a structure for addressing the matrix elements columns and values.
+    * In fact, \e Segments represent the sparse matrix format.
+    *
+    * \return Constant reference to segments.
+    */
+   // const SegmentsViewType& getSegments() const;
+
+   /**
+    * \brief Getter of column indexes for constant instances.
+    *
+    * \return Constant reference to a vector with matrix elements column indexes.
+    */
+   const ColumnsIndexesViewType&
+   getColumnIndexes() const;
+
+   /**
+    * \brief Getter of column indexes for nonconstant instances.
+    *
+    * \return Reference to a vector with matrix elements column indexes.
+    */
+   ColumnsIndexesViewType&
+   getColumnIndexes();
+
+   /**
+    * \brief Returns a padding index value.
+    *
+    * Padding index is used for column indexes of padding zeros. Padding zeros
+    * are used in some sparse matrix formats for better data alignment in memory.
+    *
+    * \return value of the padding index.
+    */
+   __cuda_callable__
+   IndexType
+   getPaddingIndex() const;
+
+protected:
+   ColumnsIndexesViewType columnIndexes;
+
+   RowPointersView rowPointers;
+   // SegmentsViewType segments;
+
+private:
+   // TODO: this should be probably moved into a detail namespace
+   template< typename VectorOrView, std::enable_if_t< HasSetSizeMethod< VectorOrView >::value, bool > = true >
+   static void
+   set_size_if_resizable( VectorOrView& v, IndexType size )
+   {
+      v.setSize( size );
+   }
+
+   template< typename VectorOrView, std::enable_if_t< ! HasSetSizeMethod< VectorOrView >::value, bool > = true >
+   static void
+   set_size_if_resizable( VectorOrView& v, IndexType size )
+   {
+      TNL_ASSERT_EQ( v.getSize(), size, "view has wrong size" );
+   }
 };
 
-      } // namespace Sandbox
-   } // namespace Matrices
-} // namespace TNL
+}  // namespace Sandbox
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/Sandbox/SparseSandboxMatrixView.hpp>
diff --git a/src/TNL/Matrices/Sandbox/SparseSandboxMatrixView.hpp b/src/TNL/Matrices/Sandbox/SparseSandboxMatrixView.hpp
index 8a74ee91ef7c84725695176ec315bb147e69cef7..a80f766d4ea9078828cc36cadbf2cfc4a49fce6e 100644
--- a/src/TNL/Matrices/Sandbox/SparseSandboxMatrixView.hpp
+++ b/src/TNL/Matrices/Sandbox/SparseSandboxMatrixView.hpp
@@ -14,42 +14,28 @@
 #include <TNL/Matrices/details/SparseMatrix.h>
 
 namespace TNL {
-   namespace Matrices {
-      namespace Sandbox {
+namespace Matrices {
+namespace Sandbox {
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
+template< typename Real, typename Device, typename Index, typename MatrixType >
 __cuda_callable__
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-SparseSandboxMatrixView()
-{
-}
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::SparseSandboxMatrixView() {}
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
+template< typename Real, typename Device, typename Index, typename MatrixType >
 __cuda_callable__
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-SparseSandboxMatrixView( const IndexType rows,
-                         const IndexType columns,
-                         const ValuesViewType& values,
-                         const ColumnsIndexesViewType& columnIndexes,
-                         const RowPointersView& rowPointers )
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::SparseSandboxMatrixView(
+   const IndexType rows,
+   const IndexType columns,
+   const ValuesViewType& values,
+   const ColumnsIndexesViewType& columnIndexes,
+   const RowPointersView& rowPointers )
 : MatrixView< Real, Device, Index >( rows, columns, values ), columnIndexes( columnIndexes ), rowPointers( rowPointers )
-{
-}
+{}
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
+template< typename Real, typename Device, typename Index, typename MatrixType >
 __cuda_callable__
 auto
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-getView() -> ViewType
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::getView() -> ViewType
 {
    return ViewType( this->getRows(),
                     this->getColumns(),
@@ -58,14 +44,10 @@ getView() -> ViewType
                     this->segments.getView() );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
+template< typename Real, typename Device, typename Index, typename MatrixType >
 __cuda_callable__
 auto
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-getConstView() const -> ConstViewType
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::getConstView() const -> ConstViewType
 {
    return ConstViewType( this->getRows(),
                          this->getColumns(),
@@ -74,104 +56,82 @@ getConstView() const -> ConstViewType
                          this->segments.getConstView() );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-String
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-getSerializationType()
+template< typename Real, typename Device, typename Index, typename MatrixType >
+std::string
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::getSerializationType()
 {
-   return String( "Matrices::Sandbox::SparseMatrix< " ) +
-             TNL::getSerializationType< RealType >() + ", " +
-             TNL::getSerializationType< IndexType >() + ", " +
-             MatrixType::getSerializationType() + ", [any_allocator], [any_allocator] >";
+   return "Matrices::Sandbox::SparseMatrix< " + TNL::getSerializationType< RealType >() + ", "
+        + TNL::getSerializationType< IndexType >() + ", " + MatrixType::getSerializationType()
+        + ", [any_allocator], [any_allocator] >";
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-String
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-getSerializationTypeVirtual() const
+template< typename Real, typename Device, typename Index, typename MatrixType >
+std::string
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::getSerializationTypeVirtual() const
 {
    return this->getSerializationType();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-   template< typename Vector >
+template< typename Real, typename Device, typename Index, typename MatrixType >
+template< typename Vector >
 void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-getCompressedRowLengths( Vector& rowLengths ) const
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::getCompressedRowLengths( Vector& rowLengths ) const
 {
    details::set_size_if_resizable( rowLengths, this->getRows() );
    rowLengths = 0;
    auto rowLengths_view = rowLengths.getView();
-   auto fetch = [] __cuda_callable__ ( IndexType row, IndexType column, const RealType& value ) -> IndexType {
+   auto fetch = [] __cuda_callable__( IndexType row, IndexType column, const RealType& value ) -> IndexType
+   {
       return ( value != 0.0 );
    };
-   auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const IndexType value ) mutable {
+   auto keep = [ = ] __cuda_callable__( const IndexType rowIdx, const IndexType value ) mutable
+   {
       rowLengths_view[ rowIdx ] = value;
    };
    this->reduceAllRows( fetch, std::plus<>{}, keep, 0 );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-   template< typename Vector >
+template< typename Real, typename Device, typename Index, typename MatrixType >
+template< typename Vector >
 void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-getRowCapacities( Vector& rowLengths ) const
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::getRowCapacities( Vector& rowLengths ) const
 {
    details::set_size_if_resizable( rowLengths, this->getRows() );
    rowLengths = 0;
    auto rowLengths_view = rowLengths.getView();
-   auto fetch = [] __cuda_callable__ ( IndexType row, IndexType column, const RealType& value ) -> IndexType {
+   auto fetch = [] __cuda_callable__( IndexType row, IndexType column, const RealType& value ) -> IndexType
+   {
       return 1;
    };
-   auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const IndexType value ) mutable {
+   auto keep = [ = ] __cuda_callable__( const IndexType rowIdx, const IndexType value ) mutable
+   {
       rowLengths_view[ rowIdx ] = value;
    };
    this->reduceAllRows( fetch, std::plus<>{}, keep, 0 );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
+template< typename Real, typename Device, typename Index, typename MatrixType >
 __cuda_callable__
 Index
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-getRowCapacity( const IndexType row ) const
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::getRowCapacity( const IndexType row ) const
 {
    return this->segments.getSegmentSize( row );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
+template< typename Real, typename Device, typename Index, typename MatrixType >
 Index
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-getNonzeroElementsCount() const
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::getNonzeroElementsCount() const
 {
    const auto columns_view = this->columnIndexes.getConstView();
    const IndexType paddingIndex = this->getPaddingIndex();
-   if( ! isSymmetric() )
-   {
-      auto fetch = [=] __cuda_callable__ ( const IndexType i ) -> IndexType {
+   if( ! isSymmetric() ) {
+      auto fetch = [ = ] __cuda_callable__( const IndexType i ) -> IndexType
+      {
          return ( columns_view[ i ] != paddingIndex );
       };
-      return Algorithms::reduce< DeviceType >( ( IndexType ) 0, this->columnIndexes.getSize(), fetch, std::plus<>{}, 0 );
+      return Algorithms::reduce< DeviceType >( (IndexType) 0, this->columnIndexes.getSize(), fetch, std::plus<>{}, 0 );
    }
-   else
-   {
+   else {
       const auto rows = this->getRows();
       const auto columns = this->getColumns();
       Containers::Vector< IndexType, DeviceType, IndexType > row_sums( this->getRows(), 0 );
@@ -179,93 +139,82 @@ getNonzeroElementsCount() const
       auto row_pointers_view = this->rowPointers.getConstView();
       const auto columnIndexesView = this->columnIndexes.getConstView();
       // SANDBOX_TODO: Replace the following lambda function (or more) with code compute number of nonzero matrix elements
-      //               of symmetric matrix. Note, that this is required only by symmetric matrices and that the highest performance
-      //               is not a priority here.
-      auto f = [=] __cuda_callable__ ( IndexType rowIdx ) mutable {
+      //               of symmetric matrix. Note, that this is required only by symmetric matrices and that the highest
+      //               performance is not a priority here.
+      auto f = [ = ] __cuda_callable__( IndexType rowIdx ) mutable
+      {
          auto begin = row_pointers_view[ rowIdx ];
          auto end = row_pointers_view[ rowIdx + 1 ];
          IndexType sum( 0 );
-         for( IndexType globalIdx = begin; globalIdx < end; globalIdx++ )
-         {
+         for( IndexType globalIdx = begin; globalIdx < end; globalIdx++ ) {
             const IndexType column = columnIndexesView[ globalIdx ];
             if( column != paddingIndex )
                sum += 1 + ( column != rowIdx && column < rows && rowIdx < columns );
          }
          row_sums_view[ rowIdx ] = sum;
       };
-      TNL::Algorithms::ParallelFor< DeviceType >::exec( ( IndexType ) 0, this->getRows(), f );
+      TNL::Algorithms::ParallelFor< DeviceType >::exec( (IndexType) 0, this->getRows(), f );
       return sum( row_sums );
    }
    return 0;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-__cuda_callable__ auto
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-getRow( const IndexType& rowIdx ) const -> ConstRowView
+template< typename Real, typename Device, typename Index, typename MatrixType >
+__cuda_callable__
+auto
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::getRow( const IndexType& rowIdx ) const -> ConstRowView
 {
    TNL_ASSERT_LT( rowIdx, this->getRows(), "Row index is larger than number of matrix rows." );
    // SANDBOX_TODO: Replace the following with creation of RowView corresponding with your sparse matrix format.
-   return ConstRowView( rowIdx,                                                         // row index
-                        this->rowPointers[ rowIdx ],                                    // row begining
-                        this->rowPointers[ rowIdx + 1 ] - this->rowPointers[ rowIdx ],  // number of elemnts allocated for given row
-                        this->values, this->columnIndexes );
+   return ConstRowView( rowIdx,                       // row index
+                        this->rowPointers[ rowIdx ],  // row begining
+                        this->rowPointers[ rowIdx + 1 ]
+                           - this->rowPointers[ rowIdx ],  // number of elemnts allocated for given row
+                        this->values,
+                        this->columnIndexes );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-__cuda_callable__ auto
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-getRow( const IndexType& rowIdx ) -> RowView
+template< typename Real, typename Device, typename Index, typename MatrixType >
+__cuda_callable__
+auto
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::getRow( const IndexType& rowIdx ) -> RowView
 {
    TNL_ASSERT_LT( rowIdx, this->getRows(), "Row index is larger than number of matrix rows." );
    // SANDBOX_TODO: Replace this with RowView constructor by your needs.
-   return RowView( rowIdx,                                               // row index
-                   rowPointers[ rowIdx ],                                // index of the first nonzero element in the row
-                   rowPointers[ rowIdx + 1 ] - rowPointers[ rowIdx ],    // number of nonzero elements in the row
+   return RowView( rowIdx,                                             // row index
+                   rowPointers[ rowIdx ],                              // index of the first nonzero element in the row
+                   rowPointers[ rowIdx + 1 ] - rowPointers[ rowIdx ],  // number of nonzero elements in the row
                    this->values,
                    this->columnIndexes );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-__cuda_callable__ void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-setElement( const IndexType row,
-            const IndexType column,
-            const RealType& value )
+template< typename Real, typename Device, typename Index, typename MatrixType >
+__cuda_callable__
+void
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::setElement( const IndexType row,
+                                                                        const IndexType column,
+                                                                        const RealType& value )
 {
    this->addElement( row, column, value, 0.0 );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-__cuda_callable__ void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-addElement( IndexType row,
-            IndexType column,
-            const RealType& value,
-            const RealType& thisElementMultiplicator )
+template< typename Real, typename Device, typename Index, typename MatrixType >
+__cuda_callable__
+void
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::addElement( IndexType row,
+                                                                        IndexType column,
+                                                                        const RealType& value,
+                                                                        const RealType& thisElementMultiplicator )
 {
    TNL_ASSERT_GE( row, 0, "Sparse matrix row index cannot be negative." );
    TNL_ASSERT_LT( row, this->getRows(), "Sparse matrix row index is larger than number of matrix rows." );
    TNL_ASSERT_GE( column, 0, "Sparse matrix column index cannot be negative." );
    TNL_ASSERT_LT( column, this->getColumns(), "Sparse matrix column index is larger than number of matrix columns." );
 
-   if( isSymmetric() && row < column )
-   {
+   if( isSymmetric() && row < column ) {
       swap( row, column );
       TNL_ASSERT_LT( row, this->getRows(), "Column index is out of the symmetric part of the matrix after transposition." );
-      TNL_ASSERT_LT( column,this->getColumns(), "Row index is out of the symmetric part of the matrix after transposition." );
+      TNL_ASSERT_LT( column, this->getColumns(), "Row index is out of the symmetric part of the matrix after transposition." );
    }
 
    // SANDBOX_TODO: Replace the following line with a code that computes number of matrix elements allocated for
@@ -275,16 +224,14 @@ addElement( IndexType row,
    IndexType col( this->getPaddingIndex() );
    IndexType i;
    IndexType globalIdx;
-   for( i = 0; i < rowSize; i++ )
-   {
+   for( i = 0; i < rowSize; i++ ) {
       // SANDBOX_TODO: Replace the following line with a code that computes a global index of `i`-th nonzero matrix element
       //               in the `row`-th matrix row. The global index is a pointer to arrays `values` and `columnIndexes` storing
       //               the matrix elements values and column indexes respectively.
       globalIdx = this->rowPointers.getElement( row ) + i;
       TNL_ASSERT_LT( globalIdx, this->columnIndexes.getSize(), "" );
       col = this->columnIndexes.getElement( globalIdx );
-      if( col == column )
-      {
+      if( col == column ) {
          if( ! isBinary() )
             this->values.setElement( globalIdx, thisElementMultiplicator * this->values.getElement( globalIdx ) + value );
          return;
@@ -292,32 +239,29 @@ addElement( IndexType row,
       if( col == this->getPaddingIndex() || col > column )
          break;
    }
-   if( i == rowSize )
-   {
+   if( i == rowSize ) {
 #ifndef __CUDA_ARCH__
       std::stringstream msg;
-      msg << "The capacity of the sparse matrix row number "  << row << " was exceeded.";
+      msg << "The capacity of the sparse matrix row number " << row << " was exceeded.";
       throw std::logic_error( msg.str() );
 #else
-      TNL_ASSERT_TRUE( false, "");
+      TNL_ASSERT_TRUE( false, "" );
       return;
 #endif
    }
-   if( col == this->getPaddingIndex() )
-   {
+   if( col == this->getPaddingIndex() ) {
       this->columnIndexes.setElement( globalIdx, column );
       if( ! isBinary() )
          this->values.setElement( globalIdx, value );
       return;
    }
-   else
-   {
+   else {
       IndexType j = rowSize - 1;
-      while( j > i )
-      {
-         // SANDBOX_TODO: Replace the following two lines with a code that computes a global indexes of `j`-th and `j-1`-th nonzero matrix elements
-         //               in the `row`-th matrix row. The global index is a pointer to arrays `values` and `columnIndexes` storing
-         //               the matrix elements values and column indexes respectively.
+      while( j > i ) {
+         // SANDBOX_TODO: Replace the following two lines with a code that computes a global indexes of `j`-th and `j-1`-th
+         // nonzero matrix elements
+         //               in the `row`-th matrix row. The global index is a pointer to arrays `values` and `columnIndexes`
+         //               storing the matrix elements values and column indexes respectively.
          const IndexType globalIdx1 = this->rowPointers.getElement( row ) + j;
          const IndexType globalIdx2 = globalIdx1 - 1;
          // End of code replacement.
@@ -336,23 +280,17 @@ addElement( IndexType row,
    }
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
+template< typename Real, typename Device, typename Index, typename MatrixType >
 __cuda_callable__
 auto
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-getElement( IndexType row,
-            IndexType column ) const -> RealType
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::getElement( IndexType row, IndexType column ) const -> RealType
 {
    TNL_ASSERT_GE( row, 0, "Sparse matrix row index cannot be negative." );
    TNL_ASSERT_LT( row, this->getRows(), "Sparse matrix row index is larger than number of matrix rows." );
    TNL_ASSERT_GE( column, 0, "Sparse matrix column index cannot be negative." );
    TNL_ASSERT_LT( column, this->getColumns(), "Sparse matrix column index is larger than number of matrix columns." );
 
-   if( isSymmetric() && row < column )
-   {
+   if( isSymmetric() && row < column ) {
       swap( row, column );
       if( row >= this->getRows() || column >= this->getColumns() )
          return 0.0;
@@ -360,14 +298,13 @@ getElement( IndexType row,
 
    // SANDBOX_TODO: Replace the following lines with a code for getting number of elements allocated for given row.
    const IndexType rowSize = this->rowPointers.getElement( row + 1 ) - this->rowPointers.getElement( row );
-   for( IndexType i = 0; i < rowSize; i++ )
-   {
-      // SANDBOX_TODO: Replace the following line with a code for getting index of the matrix element in arrays `values` and `columnIdexes`.
+   for( IndexType i = 0; i < rowSize; i++ ) {
+      // SANDBOX_TODO: Replace the following line with a code for getting index of the matrix element in arrays `values` and
+      // `columnIdexes`.
       const IndexType globalIdx = this->rowPointers.getElement( row ) + i;
       TNL_ASSERT_LT( globalIdx, this->columnIndexes.getSize(), "" );
       const IndexType col = this->columnIndexes.getElement( globalIdx );
-      if( col == column )
-      {
+      if( col == column ) {
          if( isBinary() )
             return 1;
          else
@@ -377,33 +314,25 @@ getElement( IndexType row,
    return 0.0;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-template< typename InVector,
-       typename OutVector >
+template< typename Real, typename Device, typename Index, typename MatrixType >
+template< typename InVector, typename OutVector >
 void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-vectorProduct( const InVector& inVector,
-               OutVector& outVector,
-               const RealType matrixMultiplicator,
-               const RealType outVectorMultiplicator,
-               const IndexType firstRow,
-               IndexType lastRow ) const
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::vectorProduct( const InVector& inVector,
+                                                                           OutVector& outVector,
+                                                                           RealType matrixMultiplicator,
+                                                                           RealType outVectorMultiplicator,
+                                                                           IndexType firstRow,
+                                                                           IndexType lastRow ) const
 {
    TNL_ASSERT_EQ( this->getColumns(), inVector.getSize(), "Matrix columns do not fit with input vector." );
    TNL_ASSERT_EQ( this->getRows(), outVector.getSize(), "Matrix rows do not fit with output vector." );
 
    using OutVectorReal = typename OutVector::RealType;
    static_assert(
-         ! MatrixType::isSymmetric() ||
-         ! std::is_same< Device, Devices::Cuda >::value ||
-         ( std::is_same< OutVectorReal, float >::value ||
-           std::is_same< OutVectorReal, double >::value ||
-           std::is_same< OutVectorReal, int >::value ||
-           std::is_same< OutVectorReal, long long int >::value ),
-         "Given Real type is not supported by atomic operations on GPU which are necessary for symmetric operations." );
+      ! MatrixType::isSymmetric() || ! std::is_same< Device, Devices::Cuda >::value
+         || ( std::is_same< OutVectorReal, float >::value || std::is_same< OutVectorReal, double >::value
+              || std::is_same< OutVectorReal, int >::value || std::is_same< OutVectorReal, long long int >::value ),
+      "Given Real type is not supported by atomic operations on GPU which are necessary for symmetric operations." );
 
    const auto inVectorView = inVector.getConstView();
    auto outVectorView = outVector.getView();
@@ -414,16 +343,14 @@ vectorProduct( const InVector& inVector,
 #define HAVE_SANDBOX_SIMPLE_SPMV
    // SANDBOX_TODO: The following is simple direct implementation of SpMV operation with CSR format. We recommend to start by
    //               replacing this part with SpMV based on your sparse format.
-   if( std::is_same< DeviceType, TNL::Devices::Host >::value )          // this way you may easily specialize for different device types
+   if( std::is_same< DeviceType, TNL::Devices::Host >::value )  // this way you may easily specialize for different device types
    {
       // SANDBOX_TODO: This simple and naive implementation for CPU.
-      for( IndexType rowIdx = firstRow; rowIdx < lastRow; rowIdx++ )
-      {
+      for( IndexType rowIdx = firstRow; rowIdx < lastRow; rowIdx++ ) {
          const auto begin = rowPointers[ rowIdx ];
          const auto end = rowPointers[ rowIdx + 1 ];
          RealType sum( 0.0 );
-         for( IndexType globalIdx = begin; globalIdx < end; globalIdx++ )
-         {
+         for( IndexType globalIdx = begin; globalIdx < end; globalIdx++ ) {
             const auto columnIdx = this->columnIndexes[ globalIdx ];
             if( columnIdx != paddingIndex )
                sum += this->values[ globalIdx ] * inVector[ columnIdx ];
@@ -433,10 +360,11 @@ vectorProduct( const InVector& inVector,
          outVector[ rowIdx ] = outVector[ rowIdx ] * outVectorMultiplicator + matrixMultiplicator * sum;
       }
    }
-   else
-   {
-      //SANDBOX_TODO: The following is general implementation based on ParallelFor and lambda function. It would work even on CPU.
-      auto f = [=] __cuda_callable__ ( IndexType rowIdx ) mutable {
+   else {
+      // SANDBOX_TODO: The following is general implementation based on ParallelFor and lambda function. It would work even on
+      // CPU.
+      auto f = [ = ] __cuda_callable__( IndexType rowIdx ) mutable
+      {
          const auto begin = rowPointersView[ rowIdx ];
          const auto end = rowPointersView[ rowIdx + 1 ];
          RealType sum( 0.0 );
@@ -451,85 +379,89 @@ vectorProduct( const InVector& inVector,
    // SANDBOX_TODO: The following is fully functional implementation based on method `reduceRows`.
    if( isSymmetric() )
       outVector *= outVectorMultiplicator;
-   auto symmetricFetch = [=] __cuda_callable__ ( IndexType row, IndexType localIdx, IndexType globalIdx, bool& compute ) mutable -> RealType {
+   auto symmetricFetch =
+      [ = ] __cuda_callable__( IndexType row, IndexType localIdx, IndexType globalIdx, bool& compute ) mutable -> RealType
+   {
       const IndexType column = columnIndexesView[ globalIdx ];
       compute = ( column != paddingIndex );
       if( ! compute )
          return 0.0;
-      if( isSymmetric() && column < row )
-      {
+      if( isSymmetric() && column < row ) {
          if( isBinary() )
-            Algorithms::AtomicOperations< DeviceType >::add( outVectorView[ column ], ( OutVectorReal ) matrixMultiplicator * inVectorView[ row ] );
+            Algorithms::AtomicOperations< DeviceType >::add( outVectorView[ column ],
+                                                             (OutVectorReal) matrixMultiplicator * inVectorView[ row ] );
          else
-            Algorithms::AtomicOperations< DeviceType >::add( outVectorView[ column ], ( OutVectorReal ) matrixMultiplicator * valuesView[ globalIdx ] * inVectorView[ row ] );
+            Algorithms::AtomicOperations< DeviceType >::add(
+               outVectorView[ column ], (OutVectorReal) matrixMultiplicator * valuesView[ globalIdx ] * inVectorView[ row ] );
       }
       if( isBinary() )
          return inVectorView[ column ];
       return valuesView[ globalIdx ] * inVectorView[ column ];
    };
-   auto fetch = [=] __cuda_callable__ ( IndexType globalIdx, bool& compute ) mutable -> RealType {
+   auto fetch = [ = ] __cuda_callable__( IndexType globalIdx, bool& compute ) mutable -> RealType
+   {
       const IndexType column = columnIndexesView[ globalIdx ];
       if( isBinary() )
          return inVectorView[ column ];
       return valuesView[ globalIdx ] * inVectorView[ column ];
    };
 
-   auto keeperGeneral = [=] __cuda_callable__ ( IndexType row, const RealType& value ) mutable {
-      if( isSymmetric() )
-      {
+   auto keeperGeneral = [ = ] __cuda_callable__( IndexType row, const RealType& value ) mutable
+   {
+      if( isSymmetric() ) {
          typename OutVector::RealType aux = matrixMultiplicator * value;
          Algorithms::AtomicOperations< DeviceType >::add( outVectorView[ row ], aux );
       }
-      else
-      {
+      else {
          if( outVectorMultiplicator == 0.0 )
             outVectorView[ row ] = matrixMultiplicator * value;
          else
             outVectorView[ row ] = outVectorMultiplicator * outVectorView[ row ] + matrixMultiplicator * value;
       }
    };
-   auto keeperDirect = [=] __cuda_callable__ ( IndexType row, const RealType& value ) mutable {
+   auto keeperDirect = [ = ] __cuda_callable__( IndexType row, const RealType& value ) mutable
+   {
       outVectorView[ row ] = value;
    };
-   auto keeperMatrixMult = [=] __cuda_callable__ ( IndexType row, const RealType& value ) mutable {
+   auto keeperMatrixMult = [ = ] __cuda_callable__( IndexType row, const RealType& value ) mutable
+   {
       outVectorView[ row ] = matrixMultiplicator * value;
    };
-   auto keeperVectorMult = [=] __cuda_callable__ ( IndexType row, const RealType& value ) mutable {
+   auto keeperVectorMult = [ = ] __cuda_callable__( IndexType row, const RealType& value ) mutable
+   {
       outVectorView[ row ] = outVectorMultiplicator * outVectorView[ row ] + value;
    };
 
    if( lastRow == 0 )
       lastRow = this->getRows();
    if( isSymmetric() )
-      this->reduceRows( firstRow, lastRow, symmetricFetch, std::plus<>{}, keeperGeneral, ( RealType ) 0.0 );
-   else
-   {
-      if( outVectorMultiplicator == 0.0 )
-      {
+      this->reduceRows( firstRow, lastRow, symmetricFetch, std::plus<>{}, keeperGeneral, (RealType) 0.0 );
+   else {
+      if( outVectorMultiplicator == 0.0 ) {
          if( matrixMultiplicator == 1.0 )
-            this->reduceRows( firstRow, lastRow, fetch, std::plus<>{}, keeperDirect, ( RealType ) 0.0 );
+            this->reduceRows( firstRow, lastRow, fetch, std::plus<>{}, keeperDirect, (RealType) 0.0 );
          else
-            this->reduceRows( firstRow, lastRow, fetch, std::plus<>{}, keeperMatrixMult, ( RealType ) 0.0 );
+            this->reduceRows( firstRow, lastRow, fetch, std::plus<>{}, keeperMatrixMult, (RealType) 0.0 );
       }
-      else
-      {
+      else {
          if( matrixMultiplicator == 1.0 )
-            this->reduceRows( firstRow, lastRow, fetch, std::plus<>{}, keeperVectorMult, ( RealType ) 0.0 );
+            this->reduceRows( firstRow, lastRow, fetch, std::plus<>{}, keeperVectorMult, (RealType) 0.0 );
          else
-            this->reduceRows( firstRow, lastRow, fetch, std::plus<>{}, keeperGeneral, ( RealType ) 0.0 );
+            this->reduceRows( firstRow, lastRow, fetch, std::plus<>{}, keeperGeneral, (RealType) 0.0 );
       }
    }
 #endif
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
+template< typename Real, typename Device, typename Index, typename MatrixType >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
 void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchValue& zero )
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::reduceRows( IndexType begin,
+                                                                        IndexType end,
+                                                                        Fetch& fetch,
+                                                                        const Reduce& reduce,
+                                                                        Keep& keep,
+                                                                        const FetchValue& zero )
 {
    auto columns_view = this->columnIndexes.getView();
    auto values_view = this->values.getView();
@@ -537,15 +469,14 @@ reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce,
    const IndexType paddingIndex_ = this->getPaddingIndex();
    // SANDBOX_TODO: Replace the following code with the one for computing reduction in rows by your format.
    //               Note, that this method can be used for implementation of SpMV.
-   auto f = [=] __cuda_callable__ ( IndexType rowIdx ) mutable {
+   auto f = [ = ] __cuda_callable__( IndexType rowIdx ) mutable
+   {
       const auto begin = row_pointers_view[ rowIdx ];
       const auto end = row_pointers_view[ rowIdx + 1 ];
       FetchValue sum = zero;
-      for( IndexType globalIdx = begin; globalIdx < end; globalIdx++ )
-      {
+      for( IndexType globalIdx = begin; globalIdx < end; globalIdx++ ) {
          IndexType& columnIdx = columns_view[ globalIdx ];
-         if( columnIdx != paddingIndex_ )
-         {
+         if( columnIdx != paddingIndex_ ) {
             if( isBinary() )
                sum = reduce( sum, fetch( rowIdx, columnIdx, 1 ) );
             else
@@ -557,14 +488,15 @@ reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce,
    TNL::Algorithms::ParallelFor< DeviceType >::exec( begin, end, f );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
+template< typename Real, typename Device, typename Index, typename MatrixType >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
 void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchValue& zero ) const
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::reduceRows( IndexType begin,
+                                                                        IndexType end,
+                                                                        Fetch& fetch,
+                                                                        const Reduce& reduce,
+                                                                        Keep& keep,
+                                                                        const FetchValue& zero ) const
 {
    auto columns_view = this->columnIndexes.getConstView();
    auto values_view = this->values.getConstView();
@@ -572,15 +504,14 @@ reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce,
    // SANDBOX_TODO: Replace the following code with the one for computing reduction in rows by your format.
    //               Note, that this method can be used for implementation of SpMV.
    auto row_pointers_view = this->rowPointers.getConstView();
-   auto f = [=] __cuda_callable__ ( IndexType rowIdx ) mutable {
+   auto f = [ = ] __cuda_callable__( IndexType rowIdx ) mutable
+   {
       const auto begin = row_pointers_view[ rowIdx ];
       const auto end = row_pointers_view[ rowIdx + 1 ];
       FetchValue sum = zero;
-      for( IndexType globalIdx = begin; globalIdx < end; globalIdx++ )
-      {
+      for( IndexType globalIdx = begin; globalIdx < end; globalIdx++ ) {
          const IndexType& columnIdx = columns_view[ globalIdx ];
-         if( columnIdx != paddingIndex_ )
-         {
+         if( columnIdx != paddingIndex_ ) {
             if( isBinary() )
                sum = reduce( sum, fetch( rowIdx, columnIdx, 1 ) );
             else
@@ -592,51 +523,47 @@ reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce,
    TNL::Algorithms::ParallelFor< DeviceType >::exec( begin, end, f );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Real, typename Device, typename Index, typename MatrixType >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& zero )
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::reduceAllRows( Fetch& fetch,
+                                                                           const Reduce& reduce,
+                                                                           Keep& keep,
+                                                                           const FetchReal& zero )
 {
    this->reduceRows( 0, this->getRows(), fetch, reduce, keep, zero );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Real, typename Device, typename Index, typename MatrixType >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& zero ) const
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::reduceAllRows( Fetch& fetch,
+                                                                           const Reduce& reduce,
+                                                                           Keep& keep,
+                                                                           const FetchReal& zero ) const
 {
    this->reduceRows( 0, this->getRows(), fetch, reduce, keep, zero );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType >
+template< typename Function >
 void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-forElements( IndexType begin, IndexType end, Function& function ) const
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::forElements( IndexType begin,
+                                                                         IndexType end,
+                                                                         Function& function ) const
 {
    const auto columns_view = this->columnIndexes.getConstView();
    const auto values_view = this->values.getConstView();
    // SANDBOX_TODO: Replace the following code with the one for iterating over all allocated matrix elements.
    auto row_pointers_view = this->rowPointers.getConstView();
-   auto f = [=] __cuda_callable__ ( IndexType rowIdx ) mutable {
+   auto f = [ = ] __cuda_callable__( IndexType rowIdx ) mutable
+   {
       const auto begin = row_pointers_view[ rowIdx ];
       const auto end = row_pointers_view[ rowIdx + 1 ];
       IndexType localIdx( 0 );
-      for( IndexType globalIdx = begin; globalIdx < end; globalIdx++ )
-      {
+      for( IndexType globalIdx = begin; globalIdx < end; globalIdx++ ) {
          if( isBinary() )
-            function( rowIdx, localIdx, columns_view[ globalIdx ], ( RealType ) 1 );
+            function( rowIdx, localIdx, columns_view[ globalIdx ], (RealType) 1 );
          else
             function( rowIdx, localIdx, columns_view[ globalIdx ], values_view[ globalIdx ] );
          localIdx++;
@@ -645,28 +572,24 @@ forElements( IndexType begin, IndexType end, Function& function ) const
    TNL::Algorithms::ParallelFor< DeviceType >::exec( begin, end, f );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType >
+template< typename Function >
 void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-forElements( IndexType begin, IndexType end, Function& function )
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::forElements( IndexType begin, IndexType end, Function& function )
 {
    auto columns_view = this->columnIndexes.getView();
    auto values_view = this->values.getView();
    // SANDBOX_TODO: Replace the following code with the one for iterating over all allocated matrix elements.
    auto row_pointers_view = this->rowPointers.getConstView();
-   auto f = [=] __cuda_callable__ ( IndexType rowIdx ) mutable {
+   auto f = [ = ] __cuda_callable__( IndexType rowIdx ) mutable
+   {
       const auto begin = row_pointers_view[ rowIdx ];
       const auto end = row_pointers_view[ rowIdx + 1 ];
       IndexType localIdx( 0 );
       RealType one( 1.0 );
-      for( IndexType globalIdx = begin; globalIdx < end; globalIdx++ )
-      {
+      for( IndexType globalIdx = begin; globalIdx < end; globalIdx++ ) {
          if( isBinary() )
-            function( rowIdx, localIdx, columns_view[ globalIdx ], one ); // TODO: Fix this without using `one`.
+            function( rowIdx, localIdx, columns_view[ globalIdx ], one );  // TODO: Fix this without using `one`.
          else
             function( rowIdx, localIdx, columns_view[ globalIdx ], values_view[ globalIdx ] );
          localIdx++;
@@ -675,146 +598,116 @@ forElements( IndexType begin, IndexType end, Function& function )
    TNL::Algorithms::ParallelFor< DeviceType >::exec( begin, end, f );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType >
+template< typename Function >
 void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-forAllElements( Function& function ) const
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::forAllElements( Function& function ) const
 {
    this->forElements( 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType >
+template< typename Function >
 void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-forAllElements( Function& function )
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::forAllElements( Function& function )
 {
    this->forElements( 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType >
+template< typename Function >
 void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-forRows( IndexType begin, IndexType end, Function&& function )
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::forRows( IndexType begin, IndexType end, Function&& function )
 {
    auto columns_view = this->columnIndexes.getView();
    auto values_view = this->values.getView();
    // SANDBOX_TODO: Replace the following code with the one for iteration over matrix rows.
    auto row_pointers_view = this->rowPointers.getConstView();
-   auto f = [=] __cuda_callable__ ( IndexType rowIdx ) mutable {
-      auto rowView = RowView( rowIdx,                                                       // row index
-                              row_pointers_view[ rowIdx ],                                  // row begining
-                              row_pointers_view[ rowIdx + 1 ] -row_pointers_view[ rowIdx ], // number of elemnts allocated for given matrix row
-                              values_view, columns_view );
+   auto f = [ = ] __cuda_callable__( IndexType rowIdx ) mutable
+   {
+      auto rowView = RowView( rowIdx,                       // row index
+                              row_pointers_view[ rowIdx ],  // row begining
+                              row_pointers_view[ rowIdx + 1 ]
+                                 - row_pointers_view[ rowIdx ],  // number of elemnts allocated for given matrix row
+                              values_view,
+                              columns_view );
       function( rowView );
    };
    TNL::Algorithms::ParallelFor< DeviceType >::exec( begin, end, f );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType >
+template< typename Function >
 void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-forRows( IndexType begin, IndexType end, Function&& function ) const
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::forRows( IndexType begin, IndexType end, Function&& function ) const
 {
    const auto columns_view = this->columnIndexes.getConstView();
    const auto values_view = this->values.getConstView();
    // SANDBOX_TODO: Replace the following code with the one for iteration over matrix rows.
    auto row_pointers_view = this->rowPointers.getConstView();
-   auto f = [=] __cuda_callable__ ( IndexType rowIdx ) {
-      auto rowView = ConstRowView( rowIdx,                                                       // row index
-                                   row_pointers_view[ rowIdx ],                                  // row begining
-                                   row_pointers_view[ rowIdx + 1 ] -row_pointers_view[ rowIdx ], // number of elemnts allocated for given matrix row
-                                   values_view, columns_view );
+   auto f = [ = ] __cuda_callable__( IndexType rowIdx )
+   {
+      auto rowView = ConstRowView( rowIdx,                       // row index
+                                   row_pointers_view[ rowIdx ],  // row begining
+                                   row_pointers_view[ rowIdx + 1 ]
+                                      - row_pointers_view[ rowIdx ],  // number of elemnts allocated for given matrix row
+                                   values_view,
+                                   columns_view );
       function( rowView );
    };
    TNL::Algorithms::ParallelFor< DeviceType >::exec( begin, end, f );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType >
+template< typename Function >
 void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-forAllRows( Function&& function )
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::forAllRows( Function&& function )
 {
    this->forRows( 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType >
+template< typename Function >
 void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-forAllRows( Function&& function ) const
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::forAllRows( Function&& function ) const
 {
    this->forRows( 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType >
+template< typename Function >
 void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-sequentialForRows( IndexType begin, IndexType end, Function& function ) const
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::sequentialForRows( IndexType begin,
+                                                                               IndexType end,
+                                                                               Function& function ) const
 {
-   for( IndexType row = begin; row < end; row ++ )
+   for( IndexType row = begin; row < end; row++ )
       this->forRows( row, row + 1, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType >
+template< typename Function >
 void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-sequentialForRows( IndexType begin, IndexType end, Function& function )
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::sequentialForRows( IndexType begin,
+                                                                               IndexType end,
+                                                                               Function& function )
 {
-   for( IndexType row = begin; row < end; row ++ )
+   for( IndexType row = begin; row < end; row++ )
       this->forRows( row, row + 1, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType >
+template< typename Function >
 void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-sequentialForAllRows( Function& function ) const
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::sequentialForAllRows( Function& function ) const
 {
    this->sequentialForRows( 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, typename MatrixType >
+template< typename Function >
 void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-sequentialForAllRows( Function& function )
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::sequentialForAllRows( Function& function )
 {
    this->sequentialForRows( 0, this->getRows(), function );
 }
@@ -825,12 +718,10 @@ sequentialForAllRows( Function& function )
           typename Index,
           typename RealAllocator,
           typename IndexAllocator >
-template< typename Real2, template< typename, typename > class Segments2, typename Index2, typename RealAllocator2, typename IndexAllocator2 >
-void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-addMatrix( const SparseSandboxMatrixView< Real2, Segments2, Device, Index2, RealAllocator2, IndexAllocator2 >& matrix,
-           const RealType& matrixMultiplicator,
-           const RealType& thisMatrixMultiplicator )
+template< typename Real2, template< typename, typename > class Segments2, typename Index2, typename RealAllocator2, typename
+IndexAllocator2 > void SparseSandboxMatrixView< Real, Device, Index, MatrixType >:: addMatrix( const SparseSandboxMatrixView<
+Real2, Segments2, Device, Index2, RealAllocator2, IndexAllocator2 >& matrix, const RealType& matrixMultiplicator, const
+RealType& thisMatrixMultiplicator )
 {
 
 }
@@ -850,28 +741,21 @@ getTransposition( const SparseSandboxMatrixView< Real2, Device, Index2 >& matrix
 
 }*/
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
+template< typename Real, typename Device, typename Index, typename MatrixType >
 template< typename Vector1, typename Vector2 >
 bool
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-performSORIteration( const Vector1& b,
-                     const IndexType row,
-                     Vector2& x,
-                     const RealType& omega ) const
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::performSORIteration( const Vector1& b,
+                                                                                 const IndexType row,
+                                                                                 Vector2& x,
+                                                                                 const RealType& omega ) const
 {
    return false;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
+template< typename Real, typename Device, typename Index, typename MatrixType >
 SparseSandboxMatrixView< Real, Device, Index, MatrixType >&
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-operator=( const SparseSandboxMatrixView< Real, Device, Index, MatrixType >& matrix )
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::operator=(
+   const SparseSandboxMatrixView< Real, Device, Index, MatrixType >& matrix )
 {
    MatrixView< Real, Device, Index >::operator=( matrix );
    this->columnIndexes.bind( matrix.columnIndexes );
@@ -881,104 +765,79 @@ operator=( const SparseSandboxMatrixView< Real, Device, Index, MatrixType >& mat
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-   template< typename Matrix >
+template< typename Real, typename Device, typename Index, typename MatrixType >
+template< typename Matrix >
 bool
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-operator==( const Matrix& m ) const
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::operator==( const Matrix& m ) const
 {
    const auto& view1 = *this;
    // FIXME: getConstView does not work
-   //const auto view2 = m.getConstView();
+   // const auto view2 = m.getConstView();
    const auto view2 = m.getView();
-   auto fetch = [=] __cuda_callable__ ( const IndexType i ) -> bool
+   auto fetch = [ = ] __cuda_callable__( const IndexType i ) -> bool
    {
       return view1.getRow( i ) == view2.getRow( i );
    };
    return Algorithms::reduce< DeviceType >( 0, this->getRows(), fetch, std::logical_and<>{}, true );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
-   template< typename Matrix >
+template< typename Real, typename Device, typename Index, typename MatrixType >
+template< typename Matrix >
 bool
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-operator!=( const Matrix& m ) const
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::operator!=( const Matrix& m ) const
 {
    return ! operator==( m );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
+template< typename Real, typename Device, typename Index, typename MatrixType >
 void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-save( File& file ) const
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::save( File& file ) const
 {
    MatrixView< RealType, DeviceType, IndexType >::save( file );
-   file << this->columnIndexes
-        << this->rowPointers;  // SANDBOX_TODO: Replace this with medata required by your format
+   file << this->columnIndexes << this->rowPointers;  // SANDBOX_TODO: Replace this with medata required by your format
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
+template< typename Real, typename Device, typename Index, typename MatrixType >
 void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-save( const String& fileName ) const
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::save( const String& fileName ) const
 {
    Object::save( fileName );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
+template< typename Real, typename Device, typename Index, typename MatrixType >
 void
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-print( std::ostream& str ) const
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::print( std::ostream& str ) const
 {
-   if( isSymmetric() )
-   {
-      for( IndexType row = 0; row < this->getRows(); row++ )
-      {
-         str <<"Row: " << row << " -> ";
-         for( IndexType column = 0; column < this->getColumns(); column++ )
-         {
+   if( isSymmetric() ) {
+      for( IndexType row = 0; row < this->getRows(); row++ ) {
+         str << "Row: " << row << " -> ";
+         for( IndexType column = 0; column < this->getColumns(); column++ ) {
             auto value = this->getElement( row, column );
-            if( value != ( RealType ) 0 )
+            if( value != (RealType) 0 )
                str << " Col:" << column << "->" << value << "\t";
          }
          str << std::endl;
       }
    }
    else
-      for( IndexType row = 0; row < this->getRows(); row++ )
-      {
-         str <<"Row: " << row << " -> ";
-         // SANDBOX_TODO: Replace the followinf line with a code for computing number of elements allocated for given matrix row.
+      for( IndexType row = 0; row < this->getRows(); row++ ) {
+         str << "Row: " << row << " -> ";
+         // SANDBOX_TODO: Replace the followinf line with a code for computing number of elements allocated for given matrix
+         // row.
          const auto rowLength = this->rowPointers.getElement( row + 1 ) - this->rowPointers.getElement( row );
-         for( IndexType i = 0; i < rowLength; i++ )
-         {
-            // SANDBOX_TODO: Replace the following line with a code for getting index of the matrix element in arrays `values` and `columnIdexes`.
+         for( IndexType i = 0; i < rowLength; i++ ) {
+            // SANDBOX_TODO: Replace the following line with a code for getting index of the matrix element in arrays `values`
+            // and `columnIdexes`.
             const IndexType globalIdx = this->rowPointers.getElement( row ) + i;
             const IndexType column = this->columnIndexes.getElement( globalIdx );
             if( column == this->getPaddingIndex() )
                break;
             RealType value;
             if( isBinary() )
-               value = ( RealType ) 1.0;
+               value = (RealType) 1.0;
             else
                value = this->values.getElement( globalIdx );
-            if( value )
-            {
+            if( value ) {
                std::stringstream str_;
                str_ << std::setw( 4 ) << std::right << column << ":" << std::setw( 4 ) << std::left << value;
                str << std::setw( 10 ) << str_.str();
@@ -988,40 +847,28 @@ print( std::ostream& str ) const
       }
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
+template< typename Real, typename Device, typename Index, typename MatrixType >
 __cuda_callable__
 Index
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-getPaddingIndex() const
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::getPaddingIndex() const
 {
    return -1;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
+template< typename Real, typename Device, typename Index, typename MatrixType >
 auto
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-getColumnIndexes() const -> const ColumnsIndexesViewType&
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::getColumnIndexes() const -> const ColumnsIndexesViewType&
 {
    return this->columnIndexes;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename MatrixType >
+template< typename Real, typename Device, typename Index, typename MatrixType >
 auto
-SparseSandboxMatrixView< Real, Device, Index, MatrixType >::
-getColumnIndexes() -> ColumnsIndexesViewType&
+SparseSandboxMatrixView< Real, Device, Index, MatrixType >::getColumnIndexes() -> ColumnsIndexesViewType&
 {
    return this->columnIndexes;
 }
 
-      } // namespace Sandbox
-   } //namespace Matrices
-} // namespace  TNL
+}  // namespace Sandbox
+}  // namespace Matrices
+}  // namespace  TNL
diff --git a/src/TNL/Matrices/SparseMatrix.h b/src/TNL/Matrices/SparseMatrix.h
index c8d8eff28fe2bdd829f1290cd10e98c8f5e124e2..76aee6dfb4498c782f9d99c6281e9c264749b5b8 100644
--- a/src/TNL/Matrices/SparseMatrix.h
+++ b/src/TNL/Matrices/SparseMatrix.h
@@ -37,1166 +37,1225 @@ namespace Matrices {
  * \tparam RealAllocator is allocator for the matrix elements values.
  * \tparam IndexAllocator is allocator for the matrix elements column indexes.
  */
-template< typename Real =  double,
+template< typename Real = double,
           typename Device = Devices::Host,
           typename Index = int,
           typename MatrixType = GeneralMatrix,
-          template< typename Device_, typename Index_, typename IndexAllocator_ > class Segments = Algorithms::Segments::CSRDefault,
+          template< typename Device_, typename Index_, typename IndexAllocator_ > class Segments =
+             Algorithms::Segments::CSRDefault,
           typename ComputeReal = typename ChooseSparseMatrixComputeReal< Real, Index >::type,
           typename RealAllocator = typename Allocators::Default< Device >::template Allocator< Real >,
           typename IndexAllocator = typename Allocators::Default< Device >::template Allocator< Index > >
 class SparseMatrix : public Matrix< Real, Device, Index, RealAllocator >
 {
    static_assert(
-         ! MatrixType::isSymmetric() ||
-         ! std::is_same< Device, Devices::Cuda >::value ||
-         ( std::is_same< Real, float >::value || std::is_same< Real, double >::value || std::is_same< Real, int >::value || std::is_same< Real, long long int >::value || std::is_same< Real, bool >::value ),
-         "Given Real type is not supported by atomic operations on GPU which are necessary for symmetric operations." );
-
-   public:
-
-      // Supporting types - they are not important for the user
-      using BaseType = Matrix< Real, Device, Index, RealAllocator >;
-      using ValuesVectorType = typename Matrix< Real, Device, Index, RealAllocator >::ValuesType;
-      using ValuesViewType = typename ValuesVectorType::ViewType;
-      using ConstValuesViewType = typename ValuesViewType::ConstViewType;
-      using ColumnsIndexesVectorType = Containers::Vector< typename TNL::copy_const< Index >::template from< Real >::type, Device, Index, IndexAllocator >;
-      using ColumnsIndexesViewType = typename ColumnsIndexesVectorType::ViewType;
-      using ConstColumnsIndexesViewType = typename ColumnsIndexesViewType::ConstViewType;
-      using RowsCapacitiesType = Containers::Vector< std::remove_const_t< Index >, Device, Index, IndexAllocator >;
-      using RowsCapacitiesView = Containers::VectorView< std::remove_const_t< Index >, Device, Index >;
-      using ConstRowsCapacitiesView = typename RowsCapacitiesView::ConstViewType;
-
-      /**
-       * \brief Test of symmetric matrix type.
-       *
-       * \return \e true if the matrix is stored as symmetric and \e false otherwise.
-       */
-      static constexpr bool isSymmetric() { return MatrixType::isSymmetric(); };
-
-      /**
-       * \brief Test of binary matrix type.
-       *
-       * \return \e true if the matrix is stored as binary and \e false otherwise.
-       */
-      static constexpr bool isBinary() { return std::is_same< Real, bool >::value; };
-
-      /**
-       * \brief The type of matrix elements.
-       */
-      using RealType = std::remove_const_t< Real >;
-
-      using ComputeRealType = ComputeReal;
-
-      /**
-       * \brief The device where the matrix is allocated.
-       */
-      using DeviceType = Device;
-
-      /**
-       * \brief The type used for matrix elements indexing.
-       */
-      using IndexType = Index;
-
-      /**
-       * \brief Templated type of segments, i.e. sparse matrix format.
-       */
-      template< typename Device_, typename Index_, typename IndexAllocator_ >
-      using SegmentsTemplate = Segments< Device_, Index_, IndexAllocator_ >;
-
-      /**
-       * \brief Type of segments used by this matrix. It represents the sparse matrix format.
-       */
-      using SegmentsType = Segments< Device, Index, IndexAllocator >;
-
-      /**
-       * \brief Templated view type of segments, i.e. sparse matrix format.
-       */
-      template< typename Device_, typename Index_ >
-      using SegmentsViewTemplate = typename SegmentsType::template ViewTemplate< Device_, Index >;
-
-      /**
-       * \brief Type of segments view used by the related matrix view. It represents the sparse matrix format.
-       */
-      using SegmentsViewType = typename SegmentsType::ViewType;
-
-      /**
-       * \brief The allocator for matrix elements values.
-       */
-      using RealAllocatorType = RealAllocator;
-
-      /**
-       * \brief The allocator for matrix elements column indexes.
-       */
-      using IndexAllocatorType = IndexAllocator;
-
-      /**
-       * \brief Type of related matrix view.
-       *
-       * See \ref SparseMatrixView.
-       */
-      using ViewType = SparseMatrixView< Real, Device, Index, MatrixType, SegmentsViewTemplate, ComputeRealType >;
-
-      /**
-       * \brief Matrix view type for constant instances.
-       *
-       * See \ref SparseMatrixView.
-       */
-      using ConstViewType = SparseMatrixView< std::add_const_t< Real >, Device, Index, MatrixType, SegmentsViewTemplate, ComputeRealType >;
-
-      /**
-       * \brief Type for accessing matrix rows.
-       */
-      using RowView = typename ViewType::RowView;
-
-      /**
-       * \brief Type for accessing constant matrix rows.
-       */
-      using ConstRowView = typename ViewType::ConstRowView;
-
-      /**
-       * \brief Helper type for getting self type or its modifications.
-       */
-      template< typename _Real = Real,
-                typename _Device = Device,
-                typename _Index = Index,
-                typename _MatrixType = MatrixType,
-                template< typename, typename, typename > class _Segments = Segments,
-                typename _ComputeReal = ComputeReal,
-                typename _RealAllocator = typename Allocators::Default< _Device >::template Allocator< _Real >,
-                typename _IndexAllocator = typename Allocators::Default< _Device >::template Allocator< _Index > >
-      using Self = SparseMatrix< _Real, _Device, _Index, _MatrixType, _Segments, _ComputeReal, _RealAllocator, _IndexAllocator >;
-
-      /**
-       * \brief Constructor only with values and column indexes allocators.
-       *
-       * \param realAllocator is used for allocation of matrix elements values.
-       * \param indexAllocator is used for allocation of matrix elements column indexes.
-       */
-      SparseMatrix( const RealAllocatorType& realAllocator = RealAllocatorType(),
-                    const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
-
-      /**
-       * \brief Copy constructor.
-       *
-       * \param matrix is the source matrix
-       */
-      explicit SparseMatrix( const SparseMatrix& matrix );
-
-      /**
-       * \brief Move constructor.
-       *
-       * \param matrix is the source matrix
-       */
-      SparseMatrix( SparseMatrix&& matrix ) = default;
-
-      /**
-       * \brief Constructor with matrix dimensions.
-       *
-       * \param rows is number of matrix rows.
-       * \param columns is number of matrix columns.
-       * \param realAllocator is used for allocation of matrix elements values.
-       * \param indexAllocator is used for allocation of matrix elements column indexes.
-       */
-      template< typename Index_t, std::enable_if_t< std::is_integral< Index_t >::value, int > = 0 >
-      SparseMatrix( const Index_t rows,
-                    const Index_t columns,
-                    const RealAllocatorType& realAllocator = RealAllocatorType(),
-                    const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
-
-      /**
-       * \brief Constructor with matrix rows capacities and number of columns.
-       *
-       * The number of matrix rows is given by the size of \e rowCapacities list.
-       *
-       * \tparam ListIndex is the initializer list values type.
-       * \param rowCapacities is a list telling how many matrix elements must be
-       *    allocated in each row.
-       * \param columns is the number of matrix columns.
-       * \param realAllocator is used for allocation of matrix elements values.
-       * \param indexAllocator is used for allocation of matrix elements column indexes.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_Constructor_init_list_1.cpp
-       * \par Output
-       * \include SparseMatrixExample_Constructor_init_list_1.out
-       */
-      template< typename ListIndex >
-      explicit SparseMatrix( const std::initializer_list< ListIndex >& rowCapacities,
-                             const IndexType columns,
-                             const RealAllocatorType& realAllocator = RealAllocatorType(),
-                             const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
-
-      /**
-       * \brief Constructor with matrix rows capacities given as a vector and number of columns.
-       *
-       * The number of matrix rows is given by the size of \e rowCapacities vector.
-       *
-       * \tparam RowCapacitiesVector is the row capacities vector type. Usually it is some of
-       *    \ref TNL::Containers::Array, \ref TNL::Containers::ArrayView, \ref TNL::Containers::Vector or
-       *    \ref TNL::Containers::VectorView.
-       * \param rowCapacities is a vector telling how many matrix elements must be
-       *    allocated in each row.
-       * \param columns is the number of matrix columns.
-       * \param realAllocator is used for allocation of matrix elements values.
-       * \param indexAllocator is used for allocation of matrix elements column indexes.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_Constructor_rowCapacities_vector.cpp
-       * \par Output
-       * \include SparseMatrixExample_Constructor_rowCapacities_vector.out
-       */
-      template< typename RowCapacitiesVector, std::enable_if_t< TNL::IsArrayType< RowCapacitiesVector >::value, int > = 0 >
-      explicit SparseMatrix( const RowCapacitiesVector& rowCapacities,
-                             const IndexType columns,
-                             const RealAllocatorType& realAllocator = RealAllocatorType(),
-                             const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
-
-      /**
-       * \brief Constructor with matrix dimensions and data in initializer list.
-       *
-       * The matrix elements values are given as a list \e data of triples:
-       * { { row1, column1, value1 },
-       *   { row2, column2, value2 },
-       * ... }.
-       *
-       * \param rows is number of matrix rows.
-       * \param columns is number of matrix columns.
-       * \param data is a list of matrix elements values.
-       * \param realAllocator is used for allocation of matrix elements values.
-       * \param indexAllocator is used for allocation of matrix elements column indexes.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_Constructor_init_list_2.cpp
-       * \par Output
-       * \include SparseMatrixExample_Constructor_init_list_2.out
-       */
-      explicit SparseMatrix( const IndexType rows,
-                             const IndexType columns,
-                             const std::initializer_list< std::tuple< IndexType, IndexType, RealType > >& data,
-                             const RealAllocatorType& realAllocator = RealAllocatorType(),
-                             const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
-
-      /**
-       * \brief Constructor with matrix dimensions and data in std::map.
-       *
-       * The matrix elements values are given as a map \e data where keys are
-       * std::pair of matrix coordinates ( {row, column} ) and value is the
-       * matrix element value.
-       *
-       * \tparam MapIndex is a type for indexing rows and columns.
-       * \tparam MapValue is a type for matrix elements values in the map.
-       *
-       * \param rows is number of matrix rows.
-       * \param columns is number of matrix columns.
-       * \param map is std::map containing matrix elements.
-       * \param realAllocator is used for allocation of matrix elements values.
-       * \param indexAllocator is used for allocation of matrix elements column indexes.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_Constructor_std_map.cpp
-       * \par Output
-       * \include SparseMatrixExample_Constructor_std_map.out
-       */
-      template< typename MapIndex,
-                typename MapValue >
-      explicit SparseMatrix( const IndexType rows,
-                             const IndexType columns,
-                             const std::map< std::pair< MapIndex, MapIndex >, MapValue >& map,
-                             const RealAllocatorType& realAllocator = RealAllocatorType(),
-                             const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
-
-      /**
-       * \brief Returns a modifiable view of the sparse matrix.
-       *
-       * See \ref SparseMatrixView.
-       *
-       * \return sparse matrix view.
-       */
-      ViewType getView() const; // TODO: remove const
-
-      /**
-       * \brief Returns a non-modifiable view of the sparse matrix.
-       *
-       * See \ref SparseMatrixView.
-       *
-       * \return sparse matrix view.
-       */
-      ConstViewType getConstView() const;
-
-      /**
-       * \brief Returns string with serialization type.
-       *
-       * The string has a form `Matrices::SparseMatrix< RealType,  [any_device], IndexType, General/Symmetric, Format, [any_allocator] >`.
-       *
-       * \return \ref String with the serialization type.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_getSerializationType.cpp
-       * \par Output
-       * \include SparseMatrixExample_getSerializationType.out
-       */
-      static String getSerializationType();
-
-      /**
-       * \brief Returns string with serialization type.
-       *
-       * See \ref SparseMatrix::getSerializationType.
-       *
-       * \return \e String with the serialization type.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_getSerializationType.cpp
-       * \par Output
-       * \include SparseMatrixExample_getSerializationType.out
-       */
-      virtual String getSerializationTypeVirtual() const override;
-
-      /**
-       * \brief Set number of rows and columns of this matrix.
-       *
-       * \param rows is the number of matrix rows.
-       * \param columns is the number of matrix columns.
-       */
-      virtual void setDimensions( const IndexType rows,
-                                  const IndexType columns ) override;
-
-      /**
-       * \brief Set number of columns of this matrix.
-       *
-       * Unlike \ref setDimensions, the storage is not reset in this operation.
-       * It is the user's responsibility to update the column indices stored in
-       * the matrix to be consistent with the new number of columns.
-       *
-       * \param columns is the number of matrix columns.
-       */
-      virtual void setColumnsWithoutReset( const IndexType columns );
-
-      /**
-       * \brief Set the number of matrix rows and columns by the given matrix.
-       *
-       * \tparam Matrix is matrix type. This can be any matrix having methods
-       *  \ref getRows and \ref getColumns.
-       *
-       * \param matrix in the input matrix dimensions of which are to be adopted.
-       */
-      template< typename Matrix >
-      void setLike( const Matrix& matrix );
-
-      /**
-       * \brief Allocates memory for non-zero matrix elements.
-       *
-       * The size of the input vector must be equal to the number of matrix rows.
-       * The number of allocated matrix elements for each matrix row depends on
-       * the sparse matrix format. Some formats may allocate more elements than
-       * required.
-       *
-       * \tparam RowsCapacitiesVector is a type of vector/array used for row
-       *    capacities setting.
-       *
-       * \param rowCapacities is a vector telling the number of required non-zero
-       *    matrix elements in each row.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_setRowCapacities.cpp
-       * \par Output
-       * \include SparseMatrixExample_setRowCapacities.out
-       */
-      template< typename RowsCapacitiesVector >
-      void setRowCapacities( const RowsCapacitiesVector& rowCapacities );
-
-      /**
-       * \brief Compute capacities of all rows.
-       *
-       * The row capacities are not stored explicitly and must be computed.
-       *
-       * \param rowCapacities is a vector where the row capacities will be stored.
-       */
-      template< typename Vector >
-      void getRowCapacities( Vector& rowCapacities ) const;
-
-      /**
-       * \brief This method sets the sparse matrix elements from initializer list.
-       *
-       * The number of matrix rows and columns must be set already.
-       * The matrix elements values are given as a list \e data of triples:
-       * { { row1, column1, value1 },
-       *   { row2, column2, value2 },
-       * ... }.
-       *
-       * \param data is a initializer list of initializer lists representing
-       * list of matrix rows.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_setElements.cpp
-       * \par Output
-       * \include SparseMatrixExample_setElements.out
-       */
-      void setElements( const std::initializer_list< std::tuple< IndexType, IndexType, RealType > >& data );
-
-      /**
-       * \brief This method sets the sparse matrix elements from std::map.
-       *
-       * The matrix elements values are given as a map \e data where keys are
-       * std::pair of matrix coordinates ( {row, column} ) and value is the
-       * matrix element value.
-       *
-       * \tparam MapIndex is a type for indexing rows and columns.
-       * \tparam MapValue is a type for matrix elements values in the map.
-       *
-       * \param map is std::map containing matrix elements.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_setElements_map.cpp
-       * \par Output
-       * \include SparseMatrixExample_setElements_map.out
-       */
-      template< typename MapIndex,
-                typename MapValue >
-      void setElements( const std::map< std::pair< MapIndex, MapIndex > , MapValue >& map );
-
-      /**
-       * \brief Computes number of non-zeros in each row.
-       *
-       * \param rowLengths is a vector into which the number of non-zeros in each row
-       * will be stored.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_getCompressedRowLengths.cpp
-       * \par Output
-       * \include SparseMatrixExample_getCompressedRowLengths.out
-       */
-      template< typename Vector >
-      void getCompressedRowLengths( Vector& rowLengths ) const;
-
-
-      /**
-       * \brief Returns capacity of given matrix row.
-       *
-       * \param row index of matrix row.
-       * \return number of matrix elements allocated for the row.
-       */
-      __cuda_callable__
-      IndexType getRowCapacity( const IndexType row ) const;
-
-      /**
-       * \brief Returns number of non-zero matrix elements.
-       *
-       * This method really counts the non-zero matrix elements and so
-       * it returns zero for matrix having all allocated elements set to zero.
-       *
-       * \return number of non-zero matrix elements.
-       */
-      IndexType getNonzeroElementsCount() const;
-
-      /**
-       * \brief Resets the matrix to zero dimensions.
-       */
-      void reset();
-
-      /**
-       * \brief Constant getter of simple structure for accessing given matrix row.
-       *
-       * \param rowIdx is matrix row index.
-       *
-       * \return RowView for accessing given matrix row.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_getConstRow.cpp
-       * \par Output
-       * \include SparseMatrixExample_getConstRow.out
-       *
-       * See \ref SparseMatrixRowView.
-       */
-      __cuda_callable__
-      const ConstRowView getRow( const IndexType& rowIdx ) const;
-
-      /**
-       * \brief Non-constant getter of simple structure for accessing given matrix row.
-       *
-       * \param rowIdx is matrix row index.
-       *
-       * \return RowView for accessing given matrix row.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_getRow.cpp
-       * \par Output
-       * \include SparseMatrixExample_getRow.out
-       *
-       * See \ref SparseMatrixRowView.
-       */
-      __cuda_callable__
-      RowView getRow( const IndexType& rowIdx );
-
-      /**
-       * \brief Sets element at given \e row and \e column to given \e value.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref SparseMatrix::getRow
-       * or \ref SparseMatrix::forElements and \ref SparseMatrix::forAllElements.
-       * The call may fail if the matrix row capacity is exhausted.
-       *
-       * \param row is row index of the element.
-       * \param column is columns index of the element.
-       * \param value is the value the element will be set to.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_setElement.cpp
-       * \par Output
-       * \include SparseMatrixExample_setElement.out
-       */
-      __cuda_callable__
-      void setElement( const IndexType row,
-                       const IndexType column,
-                       const RealType& value );
-
-      /**
-       * \brief Add element at given \e row and \e column to given \e value.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref SparseMatrix::getRow
-       * or \ref SparseMatrix::forElements and \ref SparseMatrix::forAllElements.
-       * The call may fail if the matrix row capacity is exhausted.
-       *
-       * \param row is row index of the element.
-       * \param column is columns index of the element.
-       * \param value is the value the element will be set to.
-       * \param thisElementMultiplicator is multiplicator the original matrix element
-       *   value is multiplied by before addition of given \e value.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_addElement.cpp
-       * \par Output
-       * \include SparseMatrixExample_addElement.out
-       *
-       */
-      __cuda_callable__
-      void addElement( const IndexType row,
-                       const IndexType column,
-                       const RealType& value,
-                       const RealType& thisElementMultiplicator );
-
-      /**
-       * \brief Returns value of matrix element at position given by its row and column index.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref SparseMatrix::getRow
-       * or \ref SparseMatrix::forElements and \ref SparseMatrix::forAllElements.
-       *
-       * \param row is a row index of the matrix element.
-       * \param column i a column index of the matrix element.
-       *
-       * \return value of given matrix element.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_getElement.cpp
-       * \par Output
-       * \include SparseMatrixExample_getElement.out
-       *
-       */
-      __cuda_callable__
-      RealType getElement( const IndexType row,
-                           const IndexType column ) const;
-
-      /**
-       * \brief Method for performing general reduction on matrix rows.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       *  The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_reduceRows.cpp
-       * \par Output
-       * \include SparseMatrixExample_reduceRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity );
-
-      /**
-       * \brief Method for performing general reduction on matrix rows for constant instances.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       *  The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... }
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_reduceRows.cpp
-       * \par Output
-       * \include SparseMatrixExample_reduceRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const;
-
-      /**
-       * \brief Method for performing general reduction on all matrix rows.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       *  The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValu { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_reduceAllRows.cpp
-       * \par Output
-       * \include SparseMatrixExample_reduceAllRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity );
-
-      /**
-       * \brief Method for performing general reduction on all matrix rows for constant instances.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       *  The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value )
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_reduceAllRows.cpp
-       * \par Output
-       * \include SparseMatrixExample_reduceAllRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const;
-
-      /**
-       * \brief Method for parallel iteration over matrix elements of given rows for constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for element of given rows.
-       *
-       * The lambda function `function` should be declared like follows:
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value ) { ... };
-       * ```
-       *
-       *  The \e localIdx parameter is a rank of the non-zero element in given row.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_forElements.cpp
-       * \par Output
-       * \include SparseMatrixExample_forElements.out
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function&& function ) const;
-
-      /**
-       * \brief Method for parallel iteration over all matrix elements of given rows for non-constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for each element of given rows.
-       *
-       * The lambda function `function` should be declared like follows:
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType& columnIdx, const RealType& value ) mutable { ... }
-       * ```
-       *
-       *  The \e localIdx parameter is a rank of the non-zero element in given row.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_forElements.cpp
-       * \par Output
-       * \include SparseMatrixExample_forElements.out
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over all matrix elements for constant instances.
-       *
-       * See \ref SparseMatrix::forElements.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called for each matrix element.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_forElements.cpp
-       * \par Output
-       * \include SparseMatrixExample_forElements.out
-       */
-      template< typename Function >
-      void forAllElements( Function&& function ) const;
-
-      /**
-       * \brief Method for parallel iteration over all matrix elements for non-constant instances.
-       *
-       * See \ref SparseMatrix::forElements.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called for each matrix element.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_forElements.cpp
-       * \par Output
-       * \include SparseMatrixExample_forElements.out
-       */
-      template< typename Function >
-      void forAllElements( Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end).
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref SparseMatrix::forElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrix::RowView.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_forRows.cpp
-       * \par Output
-       * \include SparseMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forRows( IndexType begin, IndexType end, Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end) for constant instances.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref SparseMatrix::forElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrix::RowView.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_forRows.cpp
-       * \par Output
-       * \include SparseMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forRows( IndexType begin, IndexType end, Function&& function ) const;
-
-      /**
-       * \brief Method for parallel iteration over all matrix rows.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref SparseMatrix::forAllElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrix::RowView.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_forRows.cpp
-       * \par Output
-       * \include SparseMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forAllRows( Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over all matrix rows for constant instances.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref SparseMatrix::forAllElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrix::RowView.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_forRows.cpp
-       * \par Output
-       * \include SparseMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forAllRows( Function&& function ) const;
-
-      /**
-       * \brief Method for sequential iteration over all matrix rows for constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrix::RowView.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForRows( IndexType begin, IndexType end, Function& function ) const;
-
-      /**
-       * \brief Method for sequential iteration over all matrix rows for non-constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrix::RowView.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForRows( IndexType begin, IndexType end, Function& function );
-
-      /**
-       * \brief This method calls \e sequentialForRows for all matrix rows (for constant instances).
-       *
-       * See \ref SparseMatrix::sequentialForRows.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForAllRows( Function& function ) const;
-
-      /**
-       * \brief This method calls \e sequentialForRows for all matrix rows.
-       *
-       * See \ref SparseMatrix::sequentialForAllRows.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForAllRows( Function& function );
-
-      /**
-       * \brief Computes product of matrix and vector.
-       *
-       * More precisely, it computes:
-       *
-       * ```
-       * outVector = matrixMultiplicator * ( * this ) * inVector + outVectorMultiplicator * outVector
-       * ```
-       *
-       * \tparam InVector is type of input vector.  It can be \ref Vector,
-       *     \ref VectorView, \ref Array, \ref ArraView or similar container.
-       * \tparam OutVector is type of output vector. It can be \ref Vector,
-       *     \ref VectorView, \ref Array, \ref ArraView or similar container.
-       *
-       * \param inVector is input vector.
-       * \param outVector is output vector.
-       * \param matrixMultiplicator is a factor by which the matrix is multiplied. It is one by default.
-       * \param outVectorMultiplicator is a factor by which the outVector is multiplied before added
-       *    to the result of matrix-vector product. It is zero by default.
-       * \param begin is the beginning of the rows range for which the vector product
-       *    is computed. It is zero by default.
-       * \param end is the end of the rows range for which the vector product
-       *    is computed. It is number if the matrix rows by default.
-       */
-      template< typename InVector,
-                typename OutVector >
-      void vectorProduct( const InVector& inVector,
-                          OutVector& outVector,
-                          const ComputeRealType& matrixMultiplicator = 1.0,
-                          const ComputeRealType& outVectorMultiplicator = 0.0,
-                          const IndexType begin = 0,
-                          const IndexType end = 0 ) const;
-
-      /*template< typename Real2, typename Index2 >
-      void addMatrix( const SparseMatrix< Real2, Segments, Device, Index2 >& matrix,
-                      const RealType& matrixMultiplicator = 1.0,
-                      const RealType& thisMatrixMultiplicator = 1.0 );
-
-      template< typename Real2, typename Index2 >
-      void getTransposition( const SparseMatrix< Real2, Segments, Device, Index2 >& matrix,
-                             const RealType& matrixMultiplicator = 1.0 );
-       */
-
-      /**
-       * \brief Copy-assignment of exactly the same matrix type.
-       *
-       * \param matrix is input matrix for the assignment.
-       * \return reference to this matrix.
-       */
-      SparseMatrix& operator=( const SparseMatrix& matrix );
-
-      /**
-       * \brief Move-assignment of exactly the same matrix type.
-       *
-       * \param matrix is input matrix for the assignment.
-       * \return reference to this matrix.
-       */
-      SparseMatrix& operator=( SparseMatrix&& matrix );
-
-      /**
-       * \brief Assignment of dense matrix
-       *
-       * \param matrix is input matrix for the assignment.
-       * \return reference to this matrix.
-       */
-      template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization, typename RealAllocator_ >
-      SparseMatrix& operator=( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator_ >& matrix );
-
-
-      /**
-       * \brief Assignment of any matrix type other then this and dense.
-       *
-       * **Warning: Assignment of symmetric sparse matrix to general sparse matrix does not give correct result, currently. Only the diagonal and the lower part of the matrix is assigned.**
-       *
-       * \param matrix is input matrix for the assignment.
-       * \return reference to this matrix.
-       */
-      template< typename RHSMatrix >
-      SparseMatrix& operator=( const RHSMatrix& matrix );
-
-      /**
-       * \brief Comparison operator with another arbitrary matrix type.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return \e true if the RHS matrix is equal, \e false otherwise.
-       */
-      template< typename Matrix >
-      bool operator==( const Matrix& m ) const;
-
-      /**
-       * \brief Comparison operator with another arbitrary matrix type.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return \e true if the RHS matrix is equal, \e false otherwise.
-       */
-      template< typename Matrix >
-      bool operator!=( const Matrix& m ) const;
-
-      /**
-       * \brief Method for saving the matrix to the file with given filename.
-       *
-       * \param fileName is name of the file.
-       */
-      void save( const String& fileName ) const;
-
-      /**
-       * \brief Method for loading the matrix from the file with given filename.
-       *
-       * \param fileName is name of the file.
-       */
-      void load( const String& fileName );
-
-      /**
-       * \brief Method for saving the matrix to a file.
-       *
-       * \param file is the output file.
-       */
-      virtual void save( File& file ) const override;
-
-      /**
-       * \brief Method for loading the matrix from a file.
-       *
-       * \param file is the input file.
-       */
-      virtual void load( File& file ) override;
-
-      /**
-       * \brief Method for printing the matrix to output stream.
-       *
-       * \param str is the output stream.
-       */
-      virtual void print( std::ostream& str ) const override;
-
-      /**
-       * \brief Returns a padding index value.
-       *
-       * Padding index is used for column indexes of padding zeros. Padding zeros
-       * are used in some sparse matrix formats for better data alignment in memory.
-       *
-       * \return value of the padding index.
-       */
-      __cuda_callable__
-      IndexType getPaddingIndex() const;
-
-      /**
-       * \brief Getter of segments for non-constant instances.
-       *
-       * \e Segments are a structure for addressing the matrix elements columns and values.
-       * In fact, \e Segments represent the sparse matrix format.
-       *
-       * \return Non-constant reference to segments.
-       */
-      SegmentsType& getSegments();
-
-      /**
-       * \brief Getter of segments for constant instances.
-       *
-       * \e Segments are a structure for addressing the matrix elements columns and values.
-       * In fact, \e Segments represent the sparse matrix format.
-       *
-       * \return Constant reference to segments.
-       */
-      const SegmentsType& getSegments() const;
-
-      /**
-       * \brief Getter of column indexes for constant instances.
-       *
-       * \return Constant reference to a vector with matrix elements column indexes.
-       */
-      const ColumnsIndexesVectorType& getColumnIndexes() const;
-
-      /**
-       * \brief Getter of column indexes for nonconstant instances.
-       *
-       * \return Reference to a vector with matrix elements column indexes.
-       */
-      ColumnsIndexesVectorType& getColumnIndexes();
-
-   protected:
-
-      ColumnsIndexesVectorType columnIndexes;
-
-      SegmentsType segments;
-
-      IndexAllocator indexAllocator;
-
-      ViewType view;
+      ! MatrixType::isSymmetric() || ! std::is_same< Device, Devices::Cuda >::value
+         || ( std::is_same< Real, float >::value || std::is_same< Real, double >::value || std::is_same< Real, int >::value
+              || std::is_same< Real, long long int >::value || std::is_same< Real, bool >::value ),
+      "Given Real type is not supported by atomic operations on GPU which are necessary for symmetric operations." );
+
+public:
+   // Supporting types - they are not important for the user
+   using BaseType = Matrix< Real, Device, Index, RealAllocator >;
+   using ValuesVectorType = typename Matrix< Real, Device, Index, RealAllocator >::ValuesType;
+   using ValuesViewType = typename ValuesVectorType::ViewType;
+   using ConstValuesViewType = typename ValuesViewType::ConstViewType;
+   using ColumnsIndexesVectorType =
+      Containers::Vector< typename TNL::copy_const< Index >::template from< Real >::type, Device, Index, IndexAllocator >;
+   using ColumnsIndexesViewType = typename ColumnsIndexesVectorType::ViewType;
+   using ConstColumnsIndexesViewType = typename ColumnsIndexesViewType::ConstViewType;
+   using RowsCapacitiesType = Containers::Vector< std::remove_const_t< Index >, Device, Index, IndexAllocator >;
+   using RowsCapacitiesView = Containers::VectorView< std::remove_const_t< Index >, Device, Index >;
+   using ConstRowsCapacitiesView = typename RowsCapacitiesView::ConstViewType;
+
+   /**
+    * \brief Test of symmetric matrix type.
+    *
+    * \return \e true if the matrix is stored as symmetric and \e false otherwise.
+    */
+   static constexpr bool
+   isSymmetric()
+   {
+      return MatrixType::isSymmetric();
+   };
+
+   /**
+    * \brief Test of binary matrix type.
+    *
+    * \return \e true if the matrix is stored as binary and \e false otherwise.
+    */
+   static constexpr bool
+   isBinary()
+   {
+      return std::is_same< Real, bool >::value;
+   };
+
+   /**
+    * \brief The type of matrix elements.
+    */
+   using RealType = std::remove_const_t< Real >;
+
+   using ComputeRealType = ComputeReal;
+
+   /**
+    * \brief The device where the matrix is allocated.
+    */
+   using DeviceType = Device;
+
+   /**
+    * \brief The type used for matrix elements indexing.
+    */
+   using IndexType = Index;
+
+   /**
+    * \brief Templated type of segments, i.e. sparse matrix format.
+    */
+   template< typename Device_, typename Index_, typename IndexAllocator_ >
+   using SegmentsTemplate = Segments< Device_, Index_, IndexAllocator_ >;
+
+   /**
+    * \brief Type of segments used by this matrix. It represents the sparse matrix format.
+    */
+   using SegmentsType = Segments< Device, Index, IndexAllocator >;
+
+   /**
+    * \brief Templated view type of segments, i.e. sparse matrix format.
+    */
+   template< typename Device_, typename Index_ >
+   using SegmentsViewTemplate = typename SegmentsType::template ViewTemplate< Device_, Index >;
+
+   /**
+    * \brief Type of segments view used by the related matrix view. It represents the sparse matrix format.
+    */
+   using SegmentsViewType = typename SegmentsType::ViewType;
+
+   /**
+    * \brief The allocator for matrix elements values.
+    */
+   using RealAllocatorType = RealAllocator;
+
+   /**
+    * \brief The allocator for matrix elements column indexes.
+    */
+   using IndexAllocatorType = IndexAllocator;
+
+   /**
+    * \brief Type of related matrix view.
+    *
+    * See \ref SparseMatrixView.
+    */
+   using ViewType = SparseMatrixView< Real, Device, Index, MatrixType, SegmentsViewTemplate, ComputeRealType >;
+
+   /**
+    * \brief Matrix view type for constant instances.
+    *
+    * See \ref SparseMatrixView.
+    */
+   using ConstViewType =
+      SparseMatrixView< std::add_const_t< Real >, Device, Index, MatrixType, SegmentsViewTemplate, ComputeRealType >;
+
+   /**
+    * \brief Type for accessing matrix rows.
+    */
+   using RowView = typename ViewType::RowView;
+
+   /**
+    * \brief Type for accessing constant matrix rows.
+    */
+   using ConstRowView = typename ViewType::ConstRowView;
+
+   /**
+    * \brief Helper type for getting self type or its modifications.
+    */
+   template< typename _Real = Real,
+             typename _Device = Device,
+             typename _Index = Index,
+             typename _MatrixType = MatrixType,
+             template< typename, typename, typename > class _Segments = Segments,
+             typename _ComputeReal = ComputeReal,
+             typename _RealAllocator = typename Allocators::Default< _Device >::template Allocator< _Real >,
+             typename _IndexAllocator = typename Allocators::Default< _Device >::template Allocator< _Index > >
+   using Self = SparseMatrix< _Real, _Device, _Index, _MatrixType, _Segments, _ComputeReal, _RealAllocator, _IndexAllocator >;
+
+   /**
+    * \brief Constructor only with values and column indexes allocators.
+    *
+    * \param realAllocator is used for allocation of matrix elements values.
+    * \param indexAllocator is used for allocation of matrix elements column indexes.
+    */
+   SparseMatrix( const RealAllocatorType& realAllocator = RealAllocatorType(),
+                 const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
+
+   /**
+    * \brief Copy constructor.
+    *
+    * \param matrix is the source matrix
+    */
+   explicit SparseMatrix( const SparseMatrix& matrix );
+
+   /**
+    * \brief Move constructor.
+    *
+    * \param matrix is the source matrix
+    */
+   SparseMatrix( SparseMatrix&& matrix ) noexcept = default;
+
+   /**
+    * \brief Constructor with matrix dimensions.
+    *
+    * \param rows is number of matrix rows.
+    * \param columns is number of matrix columns.
+    * \param realAllocator is used for allocation of matrix elements values.
+    * \param indexAllocator is used for allocation of matrix elements column indexes.
+    */
+   template< typename Index_t, std::enable_if_t< std::is_integral< Index_t >::value, int > = 0 >
+   SparseMatrix( Index_t rows,
+                 Index_t columns,
+                 const RealAllocatorType& realAllocator = RealAllocatorType(),
+                 const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
+
+   /**
+    * \brief Constructor with matrix rows capacities and number of columns.
+    *
+    * The number of matrix rows is given by the size of \e rowCapacities list.
+    *
+    * \tparam ListIndex is the initializer list values type.
+    * \param rowCapacities is a list telling how many matrix elements must be
+    *    allocated in each row.
+    * \param columns is the number of matrix columns.
+    * \param realAllocator is used for allocation of matrix elements values.
+    * \param indexAllocator is used for allocation of matrix elements column indexes.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_Constructor_init_list_1.cpp
+    * \par Output
+    * \include SparseMatrixExample_Constructor_init_list_1.out
+    */
+   template< typename ListIndex >
+   explicit SparseMatrix( const std::initializer_list< ListIndex >& rowCapacities,
+                          IndexType columns,
+                          const RealAllocatorType& realAllocator = RealAllocatorType(),
+                          const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
+
+   /**
+    * \brief Constructor with matrix rows capacities given as a vector and number of columns.
+    *
+    * The number of matrix rows is given by the size of \e rowCapacities vector.
+    *
+    * \tparam RowCapacitiesVector is the row capacities vector type. Usually it is some of
+    *    \ref TNL::Containers::Array, \ref TNL::Containers::ArrayView, \ref TNL::Containers::Vector or
+    *    \ref TNL::Containers::VectorView.
+    * \param rowCapacities is a vector telling how many matrix elements must be
+    *    allocated in each row.
+    * \param columns is the number of matrix columns.
+    * \param realAllocator is used for allocation of matrix elements values.
+    * \param indexAllocator is used for allocation of matrix elements column indexes.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_Constructor_rowCapacities_vector.cpp
+    * \par Output
+    * \include SparseMatrixExample_Constructor_rowCapacities_vector.out
+    */
+   template< typename RowCapacitiesVector, std::enable_if_t< TNL::IsArrayType< RowCapacitiesVector >::value, int > = 0 >
+   explicit SparseMatrix( const RowCapacitiesVector& rowCapacities,
+                          IndexType columns,
+                          const RealAllocatorType& realAllocator = RealAllocatorType(),
+                          const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
+
+   /**
+    * \brief Constructor with matrix dimensions and data in initializer list.
+    *
+    * The matrix elements values are given as a list \e data of triples:
+    * { { row1, column1, value1 },
+    *   { row2, column2, value2 },
+    * ... }.
+    *
+    * \param rows is number of matrix rows.
+    * \param columns is number of matrix columns.
+    * \param data is a list of matrix elements values.
+    * \param realAllocator is used for allocation of matrix elements values.
+    * \param indexAllocator is used for allocation of matrix elements column indexes.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_Constructor_init_list_2.cpp
+    * \par Output
+    * \include SparseMatrixExample_Constructor_init_list_2.out
+    */
+   explicit SparseMatrix( IndexType rows,
+                          IndexType columns,
+                          const std::initializer_list< std::tuple< IndexType, IndexType, RealType > >& data,
+                          const RealAllocatorType& realAllocator = RealAllocatorType(),
+                          const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
+
+   /**
+    * \brief Constructor with matrix dimensions and data in std::map.
+    *
+    * The matrix elements values are given as a map \e data where keys are
+    * std::pair of matrix coordinates ( {row, column} ) and value is the
+    * matrix element value.
+    *
+    * \tparam MapIndex is a type for indexing rows and columns.
+    * \tparam MapValue is a type for matrix elements values in the map.
+    *
+    * \param rows is number of matrix rows.
+    * \param columns is number of matrix columns.
+    * \param map is std::map containing matrix elements.
+    * \param realAllocator is used for allocation of matrix elements values.
+    * \param indexAllocator is used for allocation of matrix elements column indexes.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_Constructor_std_map.cpp
+    * \par Output
+    * \include SparseMatrixExample_Constructor_std_map.out
+    */
+   template< typename MapIndex, typename MapValue >
+   explicit SparseMatrix( IndexType rows,
+                          IndexType columns,
+                          const std::map< std::pair< MapIndex, MapIndex >, MapValue >& map,
+                          const RealAllocatorType& realAllocator = RealAllocatorType(),
+                          const IndexAllocatorType& indexAllocator = IndexAllocatorType() );
+
+   /**
+    * \brief Returns a modifiable view of the sparse matrix.
+    *
+    * See \ref SparseMatrixView.
+    *
+    * \return sparse matrix view.
+    */
+   ViewType
+   getView() const;  // TODO: remove const
+
+   /**
+    * \brief Returns a non-modifiable view of the sparse matrix.
+    *
+    * See \ref SparseMatrixView.
+    *
+    * \return sparse matrix view.
+    */
+   ConstViewType
+   getConstView() const;
+
+   /**
+    * \brief Returns string with serialization type.
+    *
+    * The string has a form `Matrices::SparseMatrix< RealType,  [any_device], IndexType, General/Symmetric, Format,
+    * [any_allocator] >`.
+    *
+    * \return \ref String with the serialization type.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_getSerializationType.cpp
+    * \par Output
+    * \include SparseMatrixExample_getSerializationType.out
+    */
+   static std::string
+   getSerializationType();
+
+   /**
+    * \brief Returns string with serialization type.
+    *
+    * See \ref SparseMatrix::getSerializationType.
+    *
+    * \return \e String with the serialization type.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_getSerializationType.cpp
+    * \par Output
+    * \include SparseMatrixExample_getSerializationType.out
+    */
+   std::string
+   getSerializationTypeVirtual() const override;
+
+   /**
+    * \brief Set number of rows and columns of this matrix.
+    *
+    * \param rows is the number of matrix rows.
+    * \param columns is the number of matrix columns.
+    */
+   void
+   setDimensions( IndexType rows, IndexType columns ) override;
+
+   /**
+    * \brief Set number of columns of this matrix.
+    *
+    * Unlike \ref setDimensions, the storage is not reset in this operation.
+    * It is the user's responsibility to update the column indices stored in
+    * the matrix to be consistent with the new number of columns.
+    *
+    * \param columns is the number of matrix columns.
+    */
+   virtual void
+   setColumnsWithoutReset( const IndexType columns );
+
+   /**
+    * \brief Set the number of matrix rows and columns by the given matrix.
+    *
+    * \tparam Matrix is matrix type. This can be any matrix having methods
+    *  \ref getRows and \ref getColumns.
+    *
+    * \param matrix in the input matrix dimensions of which are to be adopted.
+    */
+   template< typename Matrix >
+   void
+   setLike( const Matrix& matrix );
+
+   /**
+    * \brief Allocates memory for non-zero matrix elements.
+    *
+    * The size of the input vector must be equal to the number of matrix rows.
+    * The number of allocated matrix elements for each matrix row depends on
+    * the sparse matrix format. Some formats may allocate more elements than
+    * required.
+    *
+    * \tparam RowsCapacitiesVector is a type of vector/array used for row
+    *    capacities setting.
+    *
+    * \param rowCapacities is a vector telling the number of required non-zero
+    *    matrix elements in each row.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_setRowCapacities.cpp
+    * \par Output
+    * \include SparseMatrixExample_setRowCapacities.out
+    */
+   template< typename RowsCapacitiesVector >
+   void
+   setRowCapacities( const RowsCapacitiesVector& rowCapacities );
+
+   /**
+    * \brief Compute capacities of all rows.
+    *
+    * The row capacities are not stored explicitly and must be computed.
+    *
+    * \param rowCapacities is a vector where the row capacities will be stored.
+    */
+   template< typename Vector >
+   void
+   getRowCapacities( Vector& rowCapacities ) const;
+
+   /**
+    * \brief This method sets the sparse matrix elements from initializer list.
+    *
+    * The number of matrix rows and columns must be set already.
+    * The matrix elements values are given as a list \e data of triples:
+    * { { row1, column1, value1 },
+    *   { row2, column2, value2 },
+    * ... }.
+    *
+    * \param data is a initializer list of initializer lists representing
+    * list of matrix rows.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_setElements.cpp
+    * \par Output
+    * \include SparseMatrixExample_setElements.out
+    */
+   void
+   setElements( const std::initializer_list< std::tuple< IndexType, IndexType, RealType > >& data );
+
+   /**
+    * \brief This method sets the sparse matrix elements from std::map.
+    *
+    * The matrix elements values are given as a map \e data where keys are
+    * std::pair of matrix coordinates ( {row, column} ) and value is the
+    * matrix element value.
+    *
+    * \tparam MapIndex is a type for indexing rows and columns.
+    * \tparam MapValue is a type for matrix elements values in the map.
+    *
+    * \param map is std::map containing matrix elements.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_setElements_map.cpp
+    * \par Output
+    * \include SparseMatrixExample_setElements_map.out
+    */
+   template< typename MapIndex, typename MapValue >
+   void
+   setElements( const std::map< std::pair< MapIndex, MapIndex >, MapValue >& map );
+
+   /**
+    * \brief Computes number of non-zeros in each row.
+    *
+    * \param rowLengths is a vector into which the number of non-zeros in each row
+    * will be stored.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_getCompressedRowLengths.cpp
+    * \par Output
+    * \include SparseMatrixExample_getCompressedRowLengths.out
+    */
+   template< typename Vector >
+   void
+   getCompressedRowLengths( Vector& rowLengths ) const;
+
+   /**
+    * \brief Returns capacity of given matrix row.
+    *
+    * \param row index of matrix row.
+    * \return number of matrix elements allocated for the row.
+    */
+   __cuda_callable__
+   IndexType
+   getRowCapacity( IndexType row ) const;
+
+   /**
+    * \brief Returns number of non-zero matrix elements.
+    *
+    * This method really counts the non-zero matrix elements and so
+    * it returns zero for matrix having all allocated elements set to zero.
+    *
+    * \return number of non-zero matrix elements.
+    */
+   IndexType
+   getNonzeroElementsCount() const override;
+
+   /**
+    * \brief Resets the matrix to zero dimensions.
+    */
+   void
+   reset();
+
+   /**
+    * \brief Constant getter of simple structure for accessing given matrix row.
+    *
+    * \param rowIdx is matrix row index.
+    *
+    * \return RowView for accessing given matrix row.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_getConstRow.cpp
+    * \par Output
+    * \include SparseMatrixExample_getConstRow.out
+    *
+    * See \ref SparseMatrixRowView.
+    */
+   __cuda_callable__
+   const ConstRowView
+   getRow( const IndexType& rowIdx ) const;
+
+   /**
+    * \brief Non-constant getter of simple structure for accessing given matrix row.
+    *
+    * \param rowIdx is matrix row index.
+    *
+    * \return RowView for accessing given matrix row.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_getRow.cpp
+    * \par Output
+    * \include SparseMatrixExample_getRow.out
+    *
+    * See \ref SparseMatrixRowView.
+    */
+   __cuda_callable__
+   RowView
+   getRow( const IndexType& rowIdx );
+
+   /**
+    * \brief Sets element at given \e row and \e column to given \e value.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref SparseMatrix::getRow
+    * or \ref SparseMatrix::forElements and \ref SparseMatrix::forAllElements.
+    * The call may fail if the matrix row capacity is exhausted.
+    *
+    * \param row is row index of the element.
+    * \param column is columns index of the element.
+    * \param value is the value the element will be set to.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_setElement.cpp
+    * \par Output
+    * \include SparseMatrixExample_setElement.out
+    */
+   __cuda_callable__
+   void
+   setElement( IndexType row, IndexType column, const RealType& value );
+
+   /**
+    * \brief Add element at given \e row and \e column to given \e value.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref SparseMatrix::getRow
+    * or \ref SparseMatrix::forElements and \ref SparseMatrix::forAllElements.
+    * The call may fail if the matrix row capacity is exhausted.
+    *
+    * \param row is row index of the element.
+    * \param column is columns index of the element.
+    * \param value is the value the element will be set to.
+    * \param thisElementMultiplicator is multiplicator the original matrix element
+    *   value is multiplied by before addition of given \e value.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_addElement.cpp
+    * \par Output
+    * \include SparseMatrixExample_addElement.out
+    *
+    */
+   __cuda_callable__
+   void
+   addElement( IndexType row, IndexType column, const RealType& value, const RealType& thisElementMultiplicator );
+
+   /**
+    * \brief Returns value of matrix element at position given by its row and column index.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref SparseMatrix::getRow
+    * or \ref SparseMatrix::forElements and \ref SparseMatrix::forAllElements.
+    *
+    * \param row is a row index of the matrix element.
+    * \param column i a column index of the matrix element.
+    *
+    * \return value of given matrix element.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_getElement.cpp
+    * \par Output
+    * \include SparseMatrixExample_getElement.out
+    *
+    */
+   __cuda_callable__
+   RealType
+   getElement( IndexType row, IndexType column ) const;
+
+   /**
+    * \brief Method for performing general reduction on matrix rows.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ...
+    * };
+    * ```
+    *
+    *  The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_reduceRows.cpp
+    * \par Output
+    * \include SparseMatrixExample_reduceRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity );
+
+   /**
+    * \brief Method for performing general reduction on matrix rows for constant instances.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ...
+    * };
+    * ```
+    *
+    *  The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... }
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_reduceRows.cpp
+    * \par Output
+    * \include SparseMatrixExample_reduceRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity )
+      const;
+
+   /**
+    * \brief Method for performing general reduction on all matrix rows.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ...
+    * };
+    * ```
+    *
+    *  The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValu { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_reduceAllRows.cpp
+    * \par Output
+    * \include SparseMatrixExample_reduceAllRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity );
+
+   /**
+    * \brief Method for performing general reduction on all matrix rows for constant instances.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ...
+    * };
+    * ```
+    *
+    *  The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value )
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_reduceAllRows.cpp
+    * \par Output
+    * \include SparseMatrixExample_reduceAllRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const;
+
+   /**
+    * \brief Method for parallel iteration over matrix elements of given rows for constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for element of given rows.
+    *
+    * The lambda function `function` should be declared like follows:
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )
+    * { ... };
+    * ```
+    *
+    *  The \e localIdx parameter is a rank of the non-zero element in given row.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_forElements.cpp
+    * \par Output
+    * \include SparseMatrixExample_forElements.out
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function&& function ) const;
+
+   /**
+    * \brief Method for parallel iteration over all matrix elements of given rows for non-constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for each element of given rows.
+    *
+    * The lambda function `function` should be declared like follows:
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType& columnIdx, const RealType& value )
+    * mutable { ... }
+    * ```
+    *
+    *  The \e localIdx parameter is a rank of the non-zero element in given row.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_forElements.cpp
+    * \par Output
+    * \include SparseMatrixExample_forElements.out
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over all matrix elements for constant instances.
+    *
+    * See \ref SparseMatrix::forElements.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called for each matrix element.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_forElements.cpp
+    * \par Output
+    * \include SparseMatrixExample_forElements.out
+    */
+   template< typename Function >
+   void
+   forAllElements( Function&& function ) const;
+
+   /**
+    * \brief Method for parallel iteration over all matrix elements for non-constant instances.
+    *
+    * See \ref SparseMatrix::forElements.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called for each matrix element.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_forElements.cpp
+    * \par Output
+    * \include SparseMatrixExample_forElements.out
+    */
+   template< typename Function >
+   void
+   forAllElements( Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end).
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref SparseMatrix::forElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrix::RowView.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_forRows.cpp
+    * \par Output
+    * \include SparseMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forRows( IndexType begin, IndexType end, Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end) for constant instances.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref SparseMatrix::forElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrix::RowView.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_forRows.cpp
+    * \par Output
+    * \include SparseMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forRows( IndexType begin, IndexType end, Function&& function ) const;
+
+   /**
+    * \brief Method for parallel iteration over all matrix rows.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref SparseMatrix::forAllElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrix::RowView.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_forRows.cpp
+    * \par Output
+    * \include SparseMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forAllRows( Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over all matrix rows for constant instances.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref SparseMatrix::forAllElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrix::RowView.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_forRows.cpp
+    * \par Output
+    * \include SparseMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forAllRows( Function&& function ) const;
+
+   /**
+    * \brief Method for sequential iteration over all matrix rows for constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrix::RowView.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForRows( IndexType begin, IndexType end, Function& function ) const;
+
+   /**
+    * \brief Method for sequential iteration over all matrix rows for non-constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrix::RowView.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForRows( IndexType begin, IndexType end, Function& function );
+
+   /**
+    * \brief This method calls \e sequentialForRows for all matrix rows (for constant instances).
+    *
+    * See \ref SparseMatrix::sequentialForRows.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForAllRows( Function& function ) const;
+
+   /**
+    * \brief This method calls \e sequentialForRows for all matrix rows.
+    *
+    * See \ref SparseMatrix::sequentialForAllRows.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForAllRows( Function& function );
+
+   /**
+    * \brief Computes product of matrix and vector.
+    *
+    * More precisely, it computes:
+    *
+    * ```
+    * outVector = matrixMultiplicator * ( * this ) * inVector + outVectorMultiplicator * outVector
+    * ```
+    *
+    * \tparam InVector is type of input vector.  It can be \ref Vector,
+    *     \ref VectorView, \ref Array, \ref ArraView or similar container.
+    * \tparam OutVector is type of output vector. It can be \ref Vector,
+    *     \ref VectorView, \ref Array, \ref ArraView or similar container.
+    *
+    * \param inVector is input vector.
+    * \param outVector is output vector.
+    * \param matrixMultiplicator is a factor by which the matrix is multiplied. It is one by default.
+    * \param outVectorMultiplicator is a factor by which the outVector is multiplied before added
+    *    to the result of matrix-vector product. It is zero by default.
+    * \param begin is the beginning of the rows range for which the vector product
+    *    is computed. It is zero by default.
+    * \param end is the end of the rows range for which the vector product
+    *    is computed. It is number if the matrix rows by default.
+    */
+   template< typename InVector, typename OutVector >
+   void
+   vectorProduct( const InVector& inVector,
+                  OutVector& outVector,
+                  ComputeRealType matrixMultiplicator = 1.0,
+                  ComputeRealType outVectorMultiplicator = 0.0,
+                  IndexType begin = 0,
+                  IndexType end = 0 ) const;
+
+   /*template< typename Real2, typename Index2 >
+   void addMatrix( const SparseMatrix< Real2, Segments, Device, Index2 >& matrix,
+                   const RealType& matrixMultiplicator = 1.0,
+                   const RealType& thisMatrixMultiplicator = 1.0 );
+
+   template< typename Real2, typename Index2 >
+   void getTransposition( const SparseMatrix< Real2, Segments, Device, Index2 >& matrix,
+                          const RealType& matrixMultiplicator = 1.0 );
+    */
+
+   /**
+    * \brief Copy-assignment of exactly the same matrix type.
+    *
+    * \param matrix is input matrix for the assignment.
+    * \return reference to this matrix.
+    */
+   SparseMatrix&
+   operator=( const SparseMatrix& matrix );
+
+   /**
+    * \brief Move-assignment of exactly the same matrix type.
+    *
+    * \param matrix is input matrix for the assignment.
+    * \return reference to this matrix.
+    */
+   SparseMatrix&
+   operator=( SparseMatrix&& matrix );
+
+   /**
+    * \brief Assignment of dense matrix
+    *
+    * \param matrix is input matrix for the assignment.
+    * \return reference to this matrix.
+    */
+   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization, typename RealAllocator_ >
+   SparseMatrix&
+   operator=( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator_ >& matrix );
+
+   /**
+    * \brief Assignment of any matrix type other then this and dense.
+    *
+    * **Warning: Assignment of symmetric sparse matrix to general sparse matrix does not give correct result, currently. Only
+    * the diagonal and the lower part of the matrix is assigned.**
+    *
+    * \param matrix is input matrix for the assignment.
+    * \return reference to this matrix.
+    */
+   template< typename RHSMatrix >
+   SparseMatrix&
+   operator=( const RHSMatrix& matrix );
+
+   /**
+    * \brief Comparison operator with another arbitrary matrix type.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return \e true if the RHS matrix is equal, \e false otherwise.
+    */
+   template< typename Matrix >
+   bool
+   operator==( const Matrix& m ) const;
+
+   /**
+    * \brief Comparison operator with another arbitrary matrix type.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return \e true if the RHS matrix is equal, \e false otherwise.
+    */
+   template< typename Matrix >
+   bool
+   operator!=( const Matrix& m ) const;
+
+   /**
+    * \brief Method for saving the matrix to the file with given filename.
+    *
+    * \param fileName is name of the file.
+    */
+   void
+   save( const String& fileName ) const;
+
+   /**
+    * \brief Method for loading the matrix from the file with given filename.
+    *
+    * \param fileName is name of the file.
+    */
+   void
+   load( const String& fileName );
+
+   /**
+    * \brief Method for saving the matrix to a file.
+    *
+    * \param file is the output file.
+    */
+   void
+   save( File& file ) const override;
+
+   /**
+    * \brief Method for loading the matrix from a file.
+    *
+    * \param file is the input file.
+    */
+   void
+   load( File& file ) override;
+
+   /**
+    * \brief Method for printing the matrix to output stream.
+    *
+    * \param str is the output stream.
+    */
+   void
+   print( std::ostream& str ) const override;
+
+   /**
+    * \brief Returns a padding index value.
+    *
+    * Padding index is used for column indexes of padding zeros. Padding zeros
+    * are used in some sparse matrix formats for better data alignment in memory.
+    *
+    * \return value of the padding index.
+    */
+   __cuda_callable__
+   IndexType
+   getPaddingIndex() const;
+
+   /**
+    * \brief Getter of segments for non-constant instances.
+    *
+    * \e Segments are a structure for addressing the matrix elements columns and values.
+    * In fact, \e Segments represent the sparse matrix format.
+    *
+    * \return Non-constant reference to segments.
+    */
+   SegmentsType&
+   getSegments();
+
+   /**
+    * \brief Getter of segments for constant instances.
+    *
+    * \e Segments are a structure for addressing the matrix elements columns and values.
+    * In fact, \e Segments represent the sparse matrix format.
+    *
+    * \return Constant reference to segments.
+    */
+   const SegmentsType&
+   getSegments() const;
+
+   /**
+    * \brief Getter of column indexes for constant instances.
+    *
+    * \return Constant reference to a vector with matrix elements column indexes.
+    */
+   const ColumnsIndexesVectorType&
+   getColumnIndexes() const;
+
+   /**
+    * \brief Getter of column indexes for nonconstant instances.
+    *
+    * \return Reference to a vector with matrix elements column indexes.
+    */
+   ColumnsIndexesVectorType&
+   getColumnIndexes();
+
+protected:
+   ColumnsIndexesVectorType columnIndexes;
+
+   SegmentsType segments;
+
+   IndexAllocator indexAllocator;
+
+   ViewType view;
 };
 
-   } // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/SparseMatrix.hpp>
diff --git a/src/TNL/Matrices/SparseMatrix.hpp b/src/TNL/Matrices/SparseMatrix.hpp
index 48269db058e0c16fde07a4b3029758d53fbcd2b6..f53e8c3cbe11e850f43365afcd1d5d5c11868757 100644
--- a/src/TNL/Matrices/SparseMatrix.hpp
+++ b/src/TNL/Matrices/SparseMatrix.hpp
@@ -16,69 +16,66 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-SparseMatrix( const RealAllocatorType& realAllocator,
-              const IndexAllocatorType& indexAllocator )
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::SparseMatrix(
+   const RealAllocatorType& realAllocator,
+   const IndexAllocatorType& indexAllocator )
 : BaseType( realAllocator ), columnIndexes( indexAllocator ), view( this->getView() )
-{
-}
+{}
 
 template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-SparseMatrix( const SparseMatrix& matrix )
-: BaseType( matrix ),
-  columnIndexes( matrix.columnIndexes ),
-  segments( matrix.segments ),
-  indexAllocator( matrix.indexAllocator ),
-  view( this->getView() )
-{
-}
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::SparseMatrix(
+   const SparseMatrix& matrix )
+: BaseType( matrix ), columnIndexes( matrix.columnIndexes ), segments( matrix.segments ),
+  indexAllocator( matrix.indexAllocator ), view( this->getView() )
+{}
 
 template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Index_t, std::enable_if_t< std::is_integral< Index_t >::value, int > >
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-SparseMatrix( const Index_t rows,
-              const Index_t columns,
-              const RealAllocatorType& realAllocator,
-              const IndexAllocatorType& indexAllocator )
+template< typename Index_t, std::enable_if_t< std::is_integral< Index_t >::value, int > >
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::SparseMatrix(
+   const Index_t rows,
+   const Index_t columns,
+   const RealAllocatorType& realAllocator,
+   const IndexAllocatorType& indexAllocator )
 : BaseType( rows, columns, realAllocator ), columnIndexes( indexAllocator ),
-  segments( Containers::Vector< IndexType, DeviceType, IndexType >( rows, 0 ) ),
-  view( this->getView() )
-{
-}
+  segments( Containers::Vector< IndexType, DeviceType, IndexType >( rows, 0 ) ), view( this->getView() )
+{}
 
 template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename ListIndex >
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-SparseMatrix( const std::initializer_list< ListIndex >& rowCapacities,
-              const IndexType columns,
-              const RealAllocatorType& realAllocator,
-              const IndexAllocatorType& indexAllocator )
+template< typename ListIndex >
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::SparseMatrix(
+   const std::initializer_list< ListIndex >& rowCapacities,
+   const IndexType columns,
+   const RealAllocatorType& realAllocator,
+   const IndexAllocatorType& indexAllocator )
 : BaseType( rowCapacities.size(), columns, realAllocator ), columnIndexes( indexAllocator )
 {
    this->setRowCapacities( RowsCapacitiesType( rowCapacities ) );
@@ -88,16 +85,17 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename RowCapacitiesVector, std::enable_if_t< TNL::IsArrayType< RowCapacitiesVector >::value, int > >
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-SparseMatrix( const RowCapacitiesVector& rowCapacities,
-              const IndexType columns,
-              const RealAllocatorType& realAllocator,
-              const IndexAllocatorType& indexAllocator )
+template< typename RowCapacitiesVector, std::enable_if_t< TNL::IsArrayType< RowCapacitiesVector >::value, int > >
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::SparseMatrix(
+   const RowCapacitiesVector& rowCapacities,
+   const IndexType columns,
+   const RealAllocatorType& realAllocator,
+   const IndexAllocatorType& indexAllocator )
 : BaseType( rowCapacities.getSize(), columns, realAllocator ), columnIndexes( indexAllocator )
 {
    this->setRowCapacities( rowCapacities );
@@ -107,16 +105,17 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-SparseMatrix( const IndexType rows,
-              const IndexType columns,
-              const std::initializer_list< std::tuple< IndexType, IndexType, RealType > >& data,
-              const RealAllocatorType& realAllocator,
-              const IndexAllocatorType& indexAllocator )
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::SparseMatrix(
+   const IndexType rows,
+   const IndexType columns,
+   const std::initializer_list< std::tuple< IndexType, IndexType, RealType > >& data,
+   const RealAllocatorType& realAllocator,
+   const IndexAllocatorType& indexAllocator )
 : BaseType( rows, columns, realAllocator ), columnIndexes( indexAllocator )
 {
    this->setElements( data );
@@ -126,18 +125,18 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename MapIndex,
-             typename MapValue >
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-SparseMatrix( const IndexType rows,
-              const IndexType columns,
-              const std::map< std::pair< MapIndex, MapIndex > , MapValue >& map,
-              const RealAllocatorType& realAllocator,
-              const IndexAllocatorType& indexAllocator )
+template< typename MapIndex, typename MapValue >
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::SparseMatrix(
+   const IndexType rows,
+   const IndexType columns,
+   const std::map< std::pair< MapIndex, MapIndex >, MapValue >& map,
+   const RealAllocatorType& realAllocator,
+   const IndexAllocatorType& indexAllocator )
 : BaseType( rows, columns, realAllocator ), columnIndexes( indexAllocator )
 {
    this->setDimensions( rows, columns );
@@ -148,13 +147,14 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
 auto
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-getView() const -> ViewType
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::getView() const
+   -> ViewType
 {
    return ViewType( this->getRows(),
                     this->getColumns(),
@@ -167,13 +167,14 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
 auto
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-getConstView() const -> ConstViewType
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::getConstView() const
+   -> ConstViewType
 {
    return ConstViewType( this->getRows(),
                          this->getColumns(),
@@ -186,13 +187,13 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-String
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-getSerializationType()
+std::string
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::getSerializationType()
 {
    return ViewType::getSerializationType();
 }
@@ -201,13 +202,14 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-String
+std::string
 SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-getSerializationTypeVirtual() const
+   getSerializationTypeVirtual() const
 {
    return this->getSerializationType();
 }
@@ -216,14 +218,15 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-setDimensions( const IndexType rows,
-               const IndexType columns )
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::setDimensions(
+   const IndexType rows,
+   const IndexType columns )
 {
    BaseType::setDimensions( rows, columns );
    segments.setSegmentsSizes( Containers::Vector< IndexType, DeviceType, IndexType >( rows, 0 ) );
@@ -234,13 +237,14 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-setColumnsWithoutReset( const IndexType columns )
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::setColumnsWithoutReset(
+   const IndexType columns )
 {
    BaseType::setDimensions( this->getRows(), columns );
    this->view = this->getView();
@@ -250,18 +254,19 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Matrix_ >
+template< typename Matrix_ >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-setLike( const Matrix_& matrix )
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::setLike(
+   const Matrix_& matrix )
 {
    BaseType::setLike( matrix );
    this->segments.setSegmentsSizes( Containers::Vector< IndexType, DeviceType, IndexType >( matrix.getRows(), 0 ) ),
-   this->view = this->getView();
+      this->view = this->getView();
    TNL_ASSERT_EQ( this->getRows(), segments.getSegmentsCount(), "mismatched segments count" );
 }
 
@@ -269,29 +274,29 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename RowsCapacitiesVector >
+template< typename RowsCapacitiesVector >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-setRowCapacities( const RowsCapacitiesVector& rowsCapacities )
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::setRowCapacities(
+   const RowsCapacitiesVector& rowsCapacities )
 {
-   TNL_ASSERT_EQ( rowsCapacities.getSize(), this->getRows(), "Number of matrix rows does not fit with rowCapacities vector size." );
+   TNL_ASSERT_EQ(
+      rowsCapacities.getSize(), this->getRows(), "Number of matrix rows does not fit with rowCapacities vector size." );
    using RowsCapacitiesVectorDevice = typename RowsCapacitiesVector::DeviceType;
    if( std::is_same< DeviceType, RowsCapacitiesVectorDevice >::value )
       this->segments.setSegmentsSizes( rowsCapacities );
-   else
-   {
+   else {
       RowsCapacitiesType thisRowsCapacities;
       thisRowsCapacities = rowsCapacities;
       this->segments.setSegmentsSizes( thisRowsCapacities );
    }
-   if( ! isBinary() )
-   {
+   if( ! isBinary() ) {
       this->values.setSize( this->segments.getStorageSize() );
-      this->values = ( RealType ) 0;
+      this->values = (RealType) 0;
    }
    this->columnIndexes.setSize( this->segments.getStorageSize() );
    this->columnIndexes = this->getPaddingIndex();
@@ -302,14 +307,15 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Vector >
+template< typename Vector >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-getRowCapacities( Vector& rowCapacities ) const
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::getRowCapacities(
+   Vector& rowCapacities ) const
 {
    this->view.getRowCapacities( rowCapacities );
 }
@@ -318,21 +324,20 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-setElements( const std::initializer_list< std::tuple< IndexType, IndexType, RealType > >& data )
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::setElements(
+   const std::initializer_list< std::tuple< IndexType, IndexType, RealType > >& data )
 {
    const auto& rows = this->getRows();
    const auto& columns = this->getColumns();
    Containers::Vector< IndexType, Devices::Host, IndexType > rowCapacities( rows, 0 );
-   for( const auto& i : data )
-   {
-      if( std::get< 0 >( i ) >= rows )
-      {
+   for( const auto& i : data ) {
+      if( std::get< 0 >( i ) >= rows ) {
          std::stringstream s;
          s << "Wrong row index " << std::get< 0 >( i ) << " in an initializer list";
          throw std::logic_error( s.str() );
@@ -341,10 +346,8 @@ setElements( const std::initializer_list< std::tuple< IndexType, IndexType, Real
    }
    SparseMatrix< Real, Devices::Host, Index, MatrixType, Segments > hostMatrix( rows, columns );
    hostMatrix.setRowCapacities( rowCapacities );
-   for( const auto& i : data )
-   {
-      if( std::get< 1 >( i ) >= columns )
-      {
+   for( const auto& i : data ) {
+      if( std::get< 1 >( i ) >= columns ) {
          std::stringstream s;
          s << "Wrong column index " << std::get< 1 >( i ) << " in an initializer list";
          throw std::logic_error( s.str() );
@@ -358,29 +361,27 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename MapIndex,
-             typename MapValue >
+template< typename MapIndex, typename MapValue >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-setElements( const std::map< std::pair< MapIndex, MapIndex > , MapValue >& map )
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::setElements(
+   const std::map< std::pair< MapIndex, MapIndex >, MapValue >& map )
 {
    Containers::Vector< IndexType, Devices::Host, IndexType > rowsCapacities( this->getRows(), 0 );
    for( auto element : map )
       rowsCapacities[ element.first.first ]++;
-   if( !std::is_same< DeviceType, Devices::Host >::value )
-   {
+   if( ! std::is_same< DeviceType, Devices::Host >::value ) {
       SparseMatrix< Real, Devices::Host, Index, MatrixType, Segments > hostMatrix( this->getRows(), this->getColumns() );
       hostMatrix.setRowCapacities( rowsCapacities );
       for( auto element : map )
          hostMatrix.setElement( element.first.first, element.first.second, element.second );
       *this = hostMatrix;
    }
-   else
-   {
+   else {
       this->setRowCapacities( rowsCapacities );
       for( auto element : map )
          this->setElement( element.first.first, element.first.second, element.second );
@@ -391,14 +392,15 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Vector >
+template< typename Vector >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-getCompressedRowLengths( Vector& rowLengths ) const
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::getCompressedRowLengths(
+   Vector& rowLengths ) const
 {
    this->view.getCompressedRowLengths( rowLengths );
 }
@@ -407,14 +409,15 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
 __cuda_callable__
 Index
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-getRowCapacity( const IndexType row ) const
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::getRowCapacity(
+   const IndexType row ) const
 {
    return this->view.getRowCapacity( row );
 }
@@ -423,13 +426,14 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
 Index
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-getNonzeroElementsCount() const
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::getNonzeroElementsCount()
+   const
 {
    return this->view.getNonzeroElementsCount();
 }
@@ -438,13 +442,13 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-reset()
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::reset()
 {
    BaseType::reset();
    this->columnIndexes.reset();
@@ -457,13 +461,15 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-__cuda_callable__ auto
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-getRow( const IndexType& rowIdx ) const -> const ConstRowView
+__cuda_callable__
+auto
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::getRow(
+   const IndexType& rowIdx ) const -> const ConstRowView
 {
    return this->view.getRow( rowIdx );
 }
@@ -472,13 +478,15 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-__cuda_callable__ auto
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-getRow( const IndexType& rowIdx ) -> RowView
+__cuda_callable__
+auto
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::getRow(
+   const IndexType& rowIdx ) -> RowView
 {
    return this->view.getRow( rowIdx );
 }
@@ -487,15 +495,17 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-__cuda_callable__ void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-setElement( const IndexType row,
-            const IndexType column,
-            const RealType& value )
+__cuda_callable__
+void
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::setElement(
+   const IndexType row,
+   const IndexType column,
+   const RealType& value )
 {
    this->view.setElement( row, column, value );
 }
@@ -504,16 +514,18 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-__cuda_callable__ void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-addElement( const IndexType row,
-            const IndexType column,
-            const RealType& value,
-            const RealType& thisElementMultiplicator )
+__cuda_callable__
+void
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::addElement(
+   const IndexType row,
+   const IndexType column,
+   const RealType& value,
+   const RealType& thisElementMultiplicator )
 {
    this->view.addElement( row, column, value, thisElementMultiplicator );
 }
@@ -522,15 +534,16 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
 __cuda_callable__
 auto
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-getElement( const IndexType row,
-            const IndexType column ) const -> RealType
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::getElement(
+   const IndexType row,
+   const IndexType column ) const -> RealType
 {
    return this->view.getElement( row, column );
 }
@@ -539,20 +552,20 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-template< typename InVector,
-       typename OutVector >
+template< typename InVector, typename OutVector >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-vectorProduct( const InVector& inVector,
-               OutVector& outVector,
-               const ComputeRealType& matrixMultiplicator,
-               const ComputeRealType& outVectorMultiplicator,
-               const IndexType firstRow,
-               const IndexType lastRow ) const
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::vectorProduct(
+   const InVector& inVector,
+   OutVector& outVector,
+   ComputeRealType matrixMultiplicator,
+   ComputeRealType outVectorMultiplicator,
+   IndexType firstRow,
+   IndexType lastRow ) const
 {
    this->getView().vectorProduct( inVector, outVector, matrixMultiplicator, outVectorMultiplicator, firstRow, lastRow );
 }
@@ -561,14 +574,20 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchValue& identity )
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::reduceRows(
+   IndexType begin,
+   IndexType end,
+   Fetch& fetch,
+   const Reduce& reduce,
+   Keep& keep,
+   const FetchValue& identity )
 {
    this->view.reduceRows( begin, end, fetch, reduce, keep, identity );
 }
@@ -577,14 +596,20 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchValue& identity ) const
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::reduceRows(
+   IndexType begin,
+   IndexType end,
+   Fetch& fetch,
+   const Reduce& reduce,
+   Keep& keep,
+   const FetchValue& identity ) const
 {
    this->view.reduceRows( begin, end, fetch, reduce, keep, identity );
 }
@@ -593,14 +618,18 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity )
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::reduceAllRows(
+   Fetch& fetch,
+   const Reduce& reduce,
+   Keep& keep,
+   const FetchReal& identity )
 {
    this->reduceRows( (IndexType) 0, this->getRows(), fetch, reduce, keep, identity );
 }
@@ -609,14 +638,18 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::reduceAllRows(
+   Fetch& fetch,
+   const Reduce& reduce,
+   Keep& keep,
+   const FetchReal& identity ) const
 {
    this->reduceRows( (IndexType) 0, this->getRows(), fetch, reduce, keep, identity );
 }
@@ -625,14 +658,17 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-forElements( IndexType begin, IndexType end, Function&& function ) const
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::forElements(
+   IndexType begin,
+   IndexType end,
+   Function&& function ) const
 {
    this->view.forElements( begin, end, function );
 }
@@ -641,14 +677,17 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-forElements( IndexType begin, IndexType end, Function&& function )
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::forElements(
+   IndexType begin,
+   IndexType end,
+   Function&& function )
 {
    this->view.forElements( begin, end, function );
 }
@@ -657,14 +696,15 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-forAllElements( Function&& function ) const
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::forAllElements(
+   Function&& function ) const
 {
    this->forElements( (IndexType) 0, this->getRows(), function );
 }
@@ -673,14 +713,15 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-forAllElements( Function&& function )
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::forAllElements(
+   Function&& function )
 {
    this->forElements( (IndexType) 0, this->getRows(), function );
 }
@@ -689,14 +730,17 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-forRows( IndexType begin, IndexType end, Function&& function )
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::forRows(
+   IndexType begin,
+   IndexType end,
+   Function&& function )
 {
    this->getView().forRows( begin, end, function );
 }
@@ -705,14 +749,17 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-forRows( IndexType begin, IndexType end, Function&& function ) const
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::forRows(
+   IndexType begin,
+   IndexType end,
+   Function&& function ) const
 {
    this->getConstView().forRows( begin, end, function );
 }
@@ -721,14 +768,15 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-forAllRows( Function&& function )
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::forAllRows(
+   Function&& function )
 {
    this->getView().forAllRows( function );
 }
@@ -737,14 +785,15 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-forAllRows( Function&& function ) const
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::forAllRows(
+   Function&& function ) const
 {
    this->getConsView().forAllRows( function );
 }
@@ -753,14 +802,17 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-sequentialForRows( IndexType begin, IndexType end, Function& function ) const
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::sequentialForRows(
+   IndexType begin,
+   IndexType end,
+   Function& function ) const
 {
    this->view.sequentialForRows( begin, end, function );
 }
@@ -769,14 +821,17 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-sequentialForRows( IndexType first, IndexType last, Function& function )
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::sequentialForRows(
+   IndexType first,
+   IndexType last,
+   Function& function )
 {
    this->view.sequentialForRows( first, last, function );
 }
@@ -785,14 +840,15 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-sequentialForAllRows( Function& function ) const
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::sequentialForAllRows(
+   Function& function ) const
 {
    this->sequentialForRows( (IndexType) 0, this->getRows(), function );
 }
@@ -801,28 +857,27 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-sequentialForAllRows( Function& function )
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::sequentialForAllRows(
+   Function& function )
 {
    this->sequentialForRows( (IndexType) 0, this->getRows(), function );
 }
 
-
 /*template< typename Real,
           template< typename, typename, typename > class Segments,
           typename Device,
           typename Index,
           typename RealAllocator,
           typename IndexAllocator >
-template< typename Real2, template< typename, typename > class Segments2, typename Index2, typename RealAllocator2, typename IndexAllocator2 >
-void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
+template< typename Real2, template< typename, typename > class Segments2, typename Index2, typename RealAllocator2, typename
+IndexAllocator2 > void SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
 addMatrix( const SparseMatrix< Real2, Segments2, Device, Index2, RealAllocator2, IndexAllocator2 >& matrix,
            const RealType& matrixMultiplicator,
            const RealType& thisMatrixMultiplicator )
@@ -850,13 +905,14 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
 SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >&
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-operator=( const SparseMatrix& matrix )
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::operator=(
+   const SparseMatrix& matrix )
 {
    Matrix< Real, Device, Index >::operator=( matrix );
    this->columnIndexes = matrix.columnIndexes;
@@ -871,13 +927,14 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
 SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >&
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-operator=( SparseMatrix&& matrix )
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::operator=(
+   SparseMatrix&& matrix )
 {
    this->columnIndexes = std::move( matrix.columnIndexes );
    this->segments = std::move( matrix.segments );
@@ -891,14 +948,15 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization, typename RealAllocator_ >
+template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization, typename RealAllocator_ >
 SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >&
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-operator=( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator_ >& matrix )
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::operator=(
+   const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator_ >& matrix )
 {
    using RHSMatrix = DenseMatrix< Real_, Device_, Index_, Organization, RealAllocator_ >;
    using RHSIndexType = typename RHSMatrix::IndexType;
@@ -921,12 +979,12 @@ operator=( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocato
    auto rowLocalIndexes_view = rowLocalIndexes.getView();
    columns_view = paddingIndex;
 
-   if( std::is_same< DeviceType, RHSDeviceType >::value )
-   {
+   if( std::is_same< DeviceType, RHSDeviceType >::value ) {
       const auto segments_view = this->segments.getView();
-      auto f = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIdx, const RHSRealType& value ) mutable {
-         if( value != 0.0 )
-         {
+      auto f = [ = ] __cuda_callable__(
+                  RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIdx, const RHSRealType& value ) mutable
+      {
+         if( value != 0.0 ) {
             IndexType thisGlobalIdx = segments_view.getGlobalIndex( rowIdx, rowLocalIndexes_view[ rowIdx ]++ );
             columns_view[ thisGlobalIdx ] = columnIdx;
             if( ! isBinary() )
@@ -935,8 +993,7 @@ operator=( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocato
       };
       matrix.forAllElements( f );
    }
-   else
-   {
+   else {
       const IndexType maxRowLength = matrix.getColumns();
       const IndexType bufferRowsCount( 4096 );
       const size_t bufferSize = bufferRowsCount * maxRowLength;
@@ -948,14 +1005,15 @@ operator=( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocato
 
       IndexType baseRow( 0 );
       const IndexType rowsCount = this->getRows();
-      while( baseRow < rowsCount )
-      {
+      while( baseRow < rowsCount ) {
          const IndexType lastRow = min( baseRow + bufferRowsCount, rowsCount );
          thisColumnsBuffer = paddingIndex;
 
          ////
          // Copy matrix elements into buffer
-         auto f1 = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIndex, const RHSRealType& value ) mutable {
+         auto f1 = [ = ] __cuda_callable__(
+                      RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIndex, const RHSRealType& value ) mutable
+         {
             const IndexType bufferIdx = ( rowIdx - baseRow ) * maxRowLength + localIdx;
             matrixValuesBuffer_view[ bufferIdx ] = value;
          };
@@ -969,22 +1027,22 @@ operator=( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocato
          // Copy matrix elements from the buffer to the matrix and ignoring
          // zero matrix elements.
          const IndexType matrix_columns = this->getColumns();
-         auto f2 = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType& columnIndex, RealType& value ) mutable {
+         auto f2 =
+            [ = ] __cuda_callable__( IndexType rowIdx, IndexType localIdx, IndexType & columnIndex, RealType & value ) mutable
+         {
             RealType inValue( 0.0 );
-            IndexType bufferIdx, column( rowLocalIndexes_view[ rowIdx ] );
-            while( inValue == 0.0 && column < matrix_columns )
-            {
+            IndexType bufferIdx;
+            IndexType column( rowLocalIndexes_view[ rowIdx ] );
+            while( inValue == 0.0 && column < matrix_columns ) {
                bufferIdx = ( rowIdx - baseRow ) * maxRowLength + column++;
                inValue = thisValuesBuffer_view[ bufferIdx ];
             }
             rowLocalIndexes_view[ rowIdx ] = column;
-            if( inValue == 0.0 )
-            {
+            if( inValue == 0.0 ) {
                columnIndex = paddingIndex;
                value = 0.0;
             }
-            else
-            {
+            else {
                columnIndex = column - 1;
                value = inValue;
             }
@@ -992,25 +1050,25 @@ operator=( const DenseMatrix< Real_, Device_, Index_, Organization, RealAllocato
          this->forElements( baseRow, lastRow, f2 );
          baseRow += bufferRowsCount;
       }
-      //std::cerr << "This matrix = " << std::endl << *this << std::endl;
+      // std::cerr << "This matrix = " << std::endl << *this << std::endl;
    }
    this->view = this->getView();
    return *this;
-
 }
 
 template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename RHSMatrix >
+template< typename RHSMatrix >
 SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >&
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-operator=( const RHSMatrix& matrix )
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::operator=(
+   const RHSMatrix& matrix )
 {
    using RHSIndexType = typename RHSMatrix::IndexType;
    using RHSRealType = typename RHSMatrix::RealType;
@@ -1032,13 +1090,13 @@ operator=( const RHSMatrix& matrix )
    auto rowLocalIndexes_view = rowLocalIndexes.getView();
    columns_view = paddingIndex;
 
-   if( std::is_same< DeviceType, RHSDeviceType >::value )
-   {
+   if( std::is_same< DeviceType, RHSDeviceType >::value ) {
       const auto segments_view = this->segments.getView();
-      auto f = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx_, RHSIndexType columnIndex, const RHSRealType& value ) mutable {
+      auto f = [ = ] __cuda_callable__(
+                  RHSIndexType rowIdx, RHSIndexType localIdx_, RHSIndexType columnIndex, const RHSRealType& value ) mutable
+      {
          IndexType localIdx( rowLocalIndexes_view[ rowIdx ] );
-         if( value != 0.0 && columnIndex != paddingIndex )
-         {
+         if( value != 0.0 && columnIndex != paddingIndex ) {
             IndexType thisGlobalIdx = segments_view.getGlobalIndex( rowIdx, localIdx++ );
             columns_view[ thisGlobalIdx ] = columnIndex;
             if( ! isBinary() )
@@ -1048,8 +1106,7 @@ operator=( const RHSMatrix& matrix )
       };
       matrix.forAllElements( f );
    }
-   else
-   {
+   else {
       const IndexType maxRowLength = max( rowCapacities );
       const IndexType bufferRowsCount( 4096 );
       const size_t bufferSize = bufferRowsCount * maxRowLength;
@@ -1060,7 +1117,7 @@ operator=( const RHSMatrix& matrix )
       Containers::Vector< IndexType, DeviceType, IndexType > thisRowLengths;
       Containers::Vector< RHSIndexType, RHSDeviceType, RHSIndexType > rhsRowLengths;
       matrix.getCompressedRowLengths( rhsRowLengths );
-      thisRowLengths= rhsRowLengths;
+      thisRowLengths = rhsRowLengths;
       auto matrixValuesBuffer_view = matrixValuesBuffer.getView();
       auto matrixColumnsBuffer_view = matrixColumnsBuffer.getView();
       auto thisValuesBuffer_view = thisValuesBuffer.getView();
@@ -1069,21 +1126,21 @@ operator=( const RHSMatrix& matrix )
 
       IndexType baseRow( 0 );
       const IndexType rowsCount = this->getRows();
-      while( baseRow < rowsCount )
-      {
+      while( baseRow < rowsCount ) {
          const IndexType lastRow = min( baseRow + bufferRowsCount, rowsCount );
          thisColumnsBuffer = paddingIndex;
          matrixColumnsBuffer_view = paddingIndex;
 
          ////
          // Copy matrix elements into buffer
-         auto f1 = [=] __cuda_callable__ ( RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIndex, const RHSRealType& value ) mutable {
-            if( columnIndex != paddingIndex )
-            {
+         auto f1 = [ = ] __cuda_callable__(
+                      RHSIndexType rowIdx, RHSIndexType localIdx, RHSIndexType columnIndex, const RHSRealType& value ) mutable
+         {
+            if( columnIndex != paddingIndex ) {
                TNL_ASSERT_LT( rowIdx - baseRow, bufferRowsCount, "" );
                TNL_ASSERT_LT( localIdx, maxRowLength, "" );
                const IndexType bufferIdx = ( rowIdx - baseRow ) * maxRowLength + localIdx;
-               TNL_ASSERT_LT( bufferIdx, ( IndexType ) bufferSize, "" );
+               TNL_ASSERT_LT( bufferIdx, (IndexType) bufferSize, "" );
                matrixColumnsBuffer_view[ bufferIdx ] = columnIndex;
                matrixValuesBuffer_view[ bufferIdx ] = value;
             }
@@ -1098,27 +1155,26 @@ operator=( const RHSMatrix& matrix )
          ////
          // Copy matrix elements from the buffer to the matrix and ignoring
          // zero matrix elements
-         //const IndexType matrix_columns = this->getColumns();
+         // const IndexType matrix_columns = this->getColumns();
          const auto thisRowLengths_view = thisRowLengths.getConstView();
-         auto f2 = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType& columnIndex, RealType& value ) mutable {
+         auto f2 =
+            [ = ] __cuda_callable__( IndexType rowIdx, IndexType localIdx, IndexType & columnIndex, RealType & value ) mutable
+         {
             RealType inValue( 0.0 );
             size_t bufferIdx;
             IndexType bufferLocalIdx( rowLocalIndexes_view[ rowIdx ] );
-            while( inValue == 0.0 && localIdx < thisRowLengths_view[ rowIdx ] )
-            {
+            while( inValue == 0.0 && localIdx < thisRowLengths_view[ rowIdx ] ) {
                bufferIdx = ( rowIdx - baseRow ) * maxRowLength + bufferLocalIdx++;
                TNL_ASSERT_LT( bufferIdx, bufferSize, "" );
                inValue = thisValuesBuffer_view[ bufferIdx ];
             }
             rowLocalIndexes_view[ rowIdx ] = bufferLocalIdx;
-            if( inValue == 0.0 )
-            {
+            if( inValue == 0.0 ) {
                columnIndex = paddingIndex;
                value = 0.0;
             }
-            else
-            {
-               columnIndex = thisColumnsBuffer_view[ bufferIdx ];//column - 1;
+            else {
+               columnIndex = thisColumnsBuffer_view[ bufferIdx ];  // column - 1;
                value = inValue;
             }
          };
@@ -1134,14 +1190,15 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Matrix >
+template< typename Matrix >
 bool
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-operator==( const Matrix& m ) const
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::operator==(
+   const Matrix& m ) const
 {
    return view == m;
 }
@@ -1150,14 +1207,15 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
-   template< typename Matrix >
+template< typename Matrix >
 bool
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-operator!=( const Matrix& m ) const
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::operator!=(
+   const Matrix& m ) const
 {
    return view != m;
 }
@@ -1166,13 +1224,13 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-save( File& file ) const
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::save( File& file ) const
 {
    this->view.save( file );
 }
@@ -1181,13 +1239,13 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-load( File& file )
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::load( File& file )
 {
    Matrix< RealType, DeviceType, IndexType >::load( file );
    file >> this->columnIndexes;
@@ -1199,13 +1257,14 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-save( const String& fileName ) const
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::save(
+   const String& fileName ) const
 {
    Object::save( fileName );
 }
@@ -1214,13 +1273,14 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-load( const String& fileName )
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::load(
+   const String& fileName )
 {
    Object::load( fileName );
 }
@@ -1229,13 +1289,14 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
 void
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-print( std::ostream& str ) const
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::print(
+   std::ostream& str ) const
 {
    this->view.print( str );
 }
@@ -1244,14 +1305,14 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
 __cuda_callable__
 Index
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-getPaddingIndex() const
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::getPaddingIndex() const
 {
    return -1;
 }
@@ -1260,13 +1321,14 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
 auto
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-getSegments() -> SegmentsType&
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::getSegments()
+   -> SegmentsType&
 {
    return this->segments;
 }
@@ -1275,13 +1337,14 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
 auto
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-getSegments() const -> const SegmentsType&
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::getSegments() const
+   -> const SegmentsType&
 {
    return this->segments;
 }
@@ -1290,13 +1353,14 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
 auto
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-getColumnIndexes() const -> const ColumnsIndexesVectorType&
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::getColumnIndexes() const
+   -> const ColumnsIndexesVectorType&
 {
    return this->columnIndexes;
 }
@@ -1305,17 +1369,17 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename, typename > class Segments,
+          template< typename, typename, typename >
+          class Segments,
           typename ComputeReal,
           typename RealAllocator,
           typename IndexAllocator >
 auto
-SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::
-getColumnIndexes() -> ColumnsIndexesVectorType&
+SparseMatrix< Real, Device, Index, MatrixType, Segments, ComputeReal, RealAllocator, IndexAllocator >::getColumnIndexes()
+   -> ColumnsIndexesVectorType&
 {
    return this->columnIndexes;
 }
 
-
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/SparseMatrixElement.h b/src/TNL/Matrices/SparseMatrixElement.h
index 513f35688f494f99beb27cf9f29d791f874e0ef1..43be8f8e8ab48c628ea83a6bbef864ff56d31479 100644
--- a/src/TNL/Matrices/SparseMatrixElement.h
+++ b/src/TNL/Matrices/SparseMatrixElement.h
@@ -13,109 +13,130 @@
 namespace TNL {
 namespace Matrices {
 
-
 /**
  * \brief Accessor for sparse matrix elements.
  *
  * \tparam Real is a type of matrix elements values.
  * \tparam Index is a type of matrix elements column indexes.
  */
-template< typename Real,
-          typename Index >
+template< typename Real, typename Index >
 class SparseMatrixElement
 {
-   public:
-
-      /**
-       * \brief Test of binary matrix type.
-       *
-       * \return \e true if the matrix is stored as binary and \e false otherwise.
-       */
-      static constexpr bool isBinary() { return std::is_same< std::remove_const_t< Real >, bool >::value; };
-
-      /**
-       * \brief Type of matrix elements values.
-       */
-      using RealType = Real;
-
-      /**
-       * \brief Type of matrix elements column indexes.
-       */
-      using IndexType = Index;
-
-      /**
-       * \brief Constructor.
-       *
-       * \param value is matrix element value.
-       * \param rowIdx is row index of the matrix element.
-       * \param columnIdx is a column index of the matrix element.
-       * \param localIdx is the rank of the non-zero elements in the matrix row.
-       */
-      __cuda_callable__
-      SparseMatrixElement( RealType& value,
-                           const IndexType& rowIdx,
-                           IndexType& columnIdx,
-                           const IndexType& localIdx )
-      : value_( value ), rowIdx( rowIdx ), columnIdx( columnIdx ), localIdx( localIdx ) {};
-
-      /**
-       * \brief Returns reference on matrix element value.
-       *
-       * \return reference on matrix element value.
-       */
-      __cuda_callable__
-      RealType& value() { return value_; };
-
-      /**
-       * \brief Returns constant reference on matrix element value.
-       *
-       * \return constant reference on matrix element value.
-       */
-      __cuda_callable__
-      const RealType& value() const { return value_; };
-
-      /**
-       * \brief Returns constant reference on matrix element column index.
-       *
-       * \return constant reference on matrix element column index.
-       */
-      __cuda_callable__
-      const IndexType& rowIndex() const { return rowIdx; };
-
-      /**
-       * \brief Returns reference on matrix element column index.
-       *
-       * \return reference on matrix element column index.
-       */
-      __cuda_callable__
-      IndexType& columnIndex() { return columnIdx; };
-
-      /**
-       * \brief Returns constant reference on matrix element column index.
-       *
-       * \return constant reference on matrix element column index.
-       */
-      __cuda_callable__
-      const IndexType& columnIndex() const { return columnIdx; };
-
-      /**
-       * \brief Returns constant reference on the rank of the non-zero matrix element in the row.
-       *
-       * \return constant reference on the rank of the non-zero matrix element in the row.
-       */
-      __cuda_callable__
-      const IndexType& localIndex() const { return localIdx; };
-
-   protected:
-
-      RealType& value_;
-
-      const IndexType& rowIdx;
-
-      IndexType& columnIdx;
-
-      const IndexType& localIdx;
+public:
+   /**
+    * \brief Test of binary matrix type.
+    *
+    * \return \e true if the matrix is stored as binary and \e false otherwise.
+    */
+   static constexpr bool
+   isBinary()
+   {
+      return std::is_same< std::remove_const_t< Real >, bool >::value;
+   };
+
+   /**
+    * \brief Type of matrix elements values.
+    */
+   using RealType = Real;
+
+   /**
+    * \brief Type of matrix elements column indexes.
+    */
+   using IndexType = Index;
+
+   /**
+    * \brief Constructor.
+    *
+    * \param value is matrix element value.
+    * \param rowIdx is row index of the matrix element.
+    * \param columnIdx is a column index of the matrix element.
+    * \param localIdx is the rank of the non-zero elements in the matrix row.
+    */
+   __cuda_callable__
+   SparseMatrixElement( RealType& value, const IndexType& rowIdx, IndexType& columnIdx, const IndexType& localIdx )
+   : value_( value ), rowIdx( rowIdx ), columnIdx( columnIdx ), localIdx( localIdx ){};
+
+   /**
+    * \brief Returns reference on matrix element value.
+    *
+    * \return reference on matrix element value.
+    */
+   __cuda_callable__
+   RealType&
+   value()
+   {
+      return value_;
+   };
+
+   /**
+    * \brief Returns constant reference on matrix element value.
+    *
+    * \return constant reference on matrix element value.
+    */
+   __cuda_callable__
+   const RealType&
+   value() const
+   {
+      return value_;
+   };
+
+   /**
+    * \brief Returns constant reference on matrix element column index.
+    *
+    * \return constant reference on matrix element column index.
+    */
+   __cuda_callable__
+   const IndexType&
+   rowIndex() const
+   {
+      return rowIdx;
+   };
+
+   /**
+    * \brief Returns reference on matrix element column index.
+    *
+    * \return reference on matrix element column index.
+    */
+   __cuda_callable__
+   IndexType&
+   columnIndex()
+   {
+      return columnIdx;
+   };
+
+   /**
+    * \brief Returns constant reference on matrix element column index.
+    *
+    * \return constant reference on matrix element column index.
+    */
+   __cuda_callable__
+   const IndexType&
+   columnIndex() const
+   {
+      return columnIdx;
+   };
+
+   /**
+    * \brief Returns constant reference on the rank of the non-zero matrix element in the row.
+    *
+    * \return constant reference on the rank of the non-zero matrix element in the row.
+    */
+   __cuda_callable__
+   const IndexType&
+   localIndex() const
+   {
+      return localIdx;
+   };
+
+protected:
+   RealType& value_;
+
+   const IndexType& rowIdx;
+
+   IndexType& columnIdx;
+
+   const IndexType& localIdx;
 };
 
-   } // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/SparseMatrixRowView.h b/src/TNL/Matrices/SparseMatrixRowView.h
index 64e91ca2c69bba706ad278905f622c70538eff7d..468486f4e8657ca29f47a3a8629da66a94403151 100644
--- a/src/TNL/Matrices/SparseMatrixRowView.h
+++ b/src/TNL/Matrices/SparseMatrixRowView.h
@@ -34,232 +34,244 @@ namespace Matrices {
  * \par Output
  * \include SparseMatrixViewExample_getRow.out
  */
-template< typename SegmentView,
-          typename ValuesView,
-          typename ColumnsIndexesView >
+template< typename SegmentView, typename ValuesView, typename ColumnsIndexesView >
 class SparseMatrixRowView
 {
-   public:
-
-      /**
-       * \brief Tells whether the parent matrix is a binary matrix.
-       * @return `true` if the matrix is binary.
-       */
-      static constexpr bool isBinary() { return std::is_same< std::remove_const_t< RealType >, bool >::value; };
-
-      /**
-       * \brief The type of matrix elements.
-       */
-      using RealType = typename ValuesView::RealType;
-
-      /**
-       * \brief The type used for matrix elements indexing.
-       */
-      using IndexType = typename ColumnsIndexesView::IndexType;
-
-      /**
-       * \brief Type representing matrix row format.
-       */
-      using SegmentViewType = SegmentView;
-
-      /**
-       * \brief Type of container view used for storing the matrix elements values.
-       */
-      using ValuesViewType = ValuesView;
-
-      /**
-       * \brief Type of container view used for storing the column indexes of the matrix elements.
-       */
-      using ColumnsIndexesViewType = ColumnsIndexesView;
-
-      /**
-       * \brief Type of constant container view used for storing the matrix elements values.
-       */
-      using ConstValuesViewType = typename ValuesViewType::ConstViewType;
-
-      /**
-       * \brief Type of constant container view used for storing the column indexes of the matrix elements.
-       */
-      using ConstColumnsIndexesViewType = typename ColumnsIndexesViewType::ConstViewType;
-
-      /**
-       * \brief Type of sparse matrix row view.
-       */
-      using RowView = SparseMatrixRowView< SegmentView, ValuesViewType, ColumnsIndexesViewType >;
-
-      /**
-       * \brief Type of constant sparse matrix row view.
-       */
-      using ConstView = SparseMatrixRowView< SegmentView, ConstValuesViewType, ConstColumnsIndexesViewType >;
-
-      /**
-       * \brief The type of related matrix element.
-       */
-      using MatrixElementType = SparseMatrixElement< RealType, IndexType >;
-
-      /**
-       * \brief Type of iterator for the matrix row.
-       */
-      using IteratorType = MatrixRowViewIterator< RowView >;
-
-      using ValueGetterType = details::SparseMatrixRowViewValueGetter< SegmentView, ValuesView, ColumnsIndexesView >;
-
-      /**
-       * \brief Constructor with \e segmentView, \e values and \e columnIndexes.
-       *
-       * \param segmentView instance of SegmentViewType representing matrix row.
-       * \param values is a container view for storing the matrix elements values.
-       * \param columnIndexes is a container view for storing the column indexes of the matrix elements.
-       */
-      __cuda_callable__
-      SparseMatrixRowView( const SegmentViewType& segmentView,
-                           const ValuesViewType& values,
-                           const ColumnsIndexesViewType& columnIndexes );
-
-      /**
-       * \brief Returns size of the matrix row, i.e. number of matrix elements in this row.
-       *
-       * \return Size of the matrix row.
-       */
-      __cuda_callable__
-      IndexType getSize() const;
-
-      /**
-       * \brief Returns the matrix row index.
-       *
-       * \return matrix row index.
-       */
-      __cuda_callable__
-      const IndexType& getRowIndex() const;
-
-      /**
-       * \brief Returns constants reference to a column index of an element with given rank in the row.
-       *
-       * \param localIdx is the rank of the non-zero element in given row.
-       *
-       * \return constant reference to the matrix element column index.
-       */
-      __cuda_callable__
-      const IndexType& getColumnIndex( const IndexType localIdx ) const;
-
-      /**
-       * \brief Returns non-constants reference to a column index of an element with given rank in the row.
-       *
-       * \param localIdx is the rank of the non-zero element in given row.
-       *
-       * \return non-constant reference to the matrix element column index.
-       */
-      __cuda_callable__
-      IndexType& getColumnIndex( const IndexType localIdx );
-
-      /**
-       * \brief Returns constants reference to value of an element with given rank in the row.
-       *
-       * \param localIdx is the rank of the non-zero element in given row.
-       *
-       * \return constant reference to the matrix element value.
-       */
-      __cuda_callable__
-      auto getValue( const IndexType localIdx ) const -> typename ValueGetterType::ConstResultType;
-
-      /**
-       * \brief Returns non-constants reference to value of an element with given rank in the row.
-       *
-       * \param localIdx is the rank of the non-zero element in given row.
-       *
-       * \return non-constant reference to the matrix element value.
-       */
-      __cuda_callable__
-      auto getValue( const IndexType localIdx ) -> typename ValueGetterType::ResultType;
-
-      /**
-       * \brief Sets a value of matrix element with given rank in the matrix row.
-       *
-       * \param localIdx is the rank of the matrix element in the row.
-       * \param value is the new value of the matrix element.
-       */
-      __cuda_callable__
-      void setValue( const IndexType localIdx,
-                     const RealType& value );
-
-      /**
-       * \brief Sets a column index of matrix element with given rank in the matrix row.
-       *
-       * \param localIdx is the rank of the matrix element in the row.
-       * \param columnIndex is the new column index of the matrix element.
-       */
-      __cuda_callable__
-      void setColumnIndex( const IndexType localIdx,
-                           const IndexType& columnIndex );
-
-      /**
-       * \brief Sets both a value and a column index of matrix element with given rank in the matrix row.
-       *
-       * \param localIdx is the rank of the matrix element in the row.
-       * \param columnIndex is the new column index of the matrix element.
-       * \param value is the new value of the matrix element.
-       */
-      __cuda_callable__
-      void setElement( const IndexType localIdx,
-                       const IndexType columnIndex,
-                       const RealType& value );
-
-      /**
-       * \brief Comparison of two matrix rows.
-       *
-       * The other matrix row can be from any other matrix.
-       *
-       * \param other is another matrix row.
-       * \return \e true if both rows are the same, \e false otherwise.
-       */
-      template< typename _SegmentView,
-                typename _ValuesView,
-                typename _ColumnsIndexesView >
-      __cuda_callable__
-      bool operator==( const SparseMatrixRowView< _SegmentView, _ValuesView, _ColumnsIndexesView >& other ) const;
-
-      /**
-       * \brief Returns iterator pointing at the beginning of the matrix row.
-       *
-       * \return iterator pointing at the beginning.
-       */
-      __cuda_callable__
-      IteratorType begin();
-
-      /**
-       * \brief Returns iterator pointing at the end of the matrix row.
-       *
-       * \return iterator pointing at the end.
-       */
-      __cuda_callable__
-      IteratorType end();
-
-      /**
-       * \brief Returns constant iterator pointing at the beginning of the matrix row.
-       *
-       * \return iterator pointing at the beginning.
-       */
-      __cuda_callable__
-      const IteratorType cbegin() const;
-
-      /**
-       * \brief Returns constant iterator pointing at the end of the matrix row.
-       *
-       * \return iterator pointing at the end.
-       */
-      __cuda_callable__
-      const IteratorType cend() const;
-
-      __cuda_callable__
-      IndexType getPaddingIndex() const { return -1; };
-
-   protected:
-
-      SegmentViewType segmentView;
-
-      ValuesViewType values;
-
-      ColumnsIndexesViewType columnIndexes;
+public:
+   /**
+    * \brief Tells whether the parent matrix is a binary matrix.
+    * @return `true` if the matrix is binary.
+    */
+   static constexpr bool
+   isBinary()
+   {
+      return std::is_same< std::remove_const_t< RealType >, bool >::value;
+   };
+
+   /**
+    * \brief The type of matrix elements.
+    */
+   using RealType = typename ValuesView::RealType;
+
+   /**
+    * \brief The type used for matrix elements indexing.
+    */
+   using IndexType = typename ColumnsIndexesView::IndexType;
+
+   /**
+    * \brief Type representing matrix row format.
+    */
+   using SegmentViewType = SegmentView;
+
+   /**
+    * \brief Type of container view used for storing the matrix elements values.
+    */
+   using ValuesViewType = ValuesView;
+
+   /**
+    * \brief Type of container view used for storing the column indexes of the matrix elements.
+    */
+   using ColumnsIndexesViewType = ColumnsIndexesView;
+
+   /**
+    * \brief Type of constant container view used for storing the matrix elements values.
+    */
+   using ConstValuesViewType = typename ValuesViewType::ConstViewType;
+
+   /**
+    * \brief Type of constant container view used for storing the column indexes of the matrix elements.
+    */
+   using ConstColumnsIndexesViewType = typename ColumnsIndexesViewType::ConstViewType;
+
+   /**
+    * \brief Type of sparse matrix row view.
+    */
+   using RowView = SparseMatrixRowView< SegmentView, ValuesViewType, ColumnsIndexesViewType >;
+
+   /**
+    * \brief Type of constant sparse matrix row view.
+    */
+   using ConstView = SparseMatrixRowView< SegmentView, ConstValuesViewType, ConstColumnsIndexesViewType >;
+
+   /**
+    * \brief The type of related matrix element.
+    */
+   using MatrixElementType = SparseMatrixElement< RealType, IndexType >;
+
+   /**
+    * \brief Type of iterator for the matrix row.
+    */
+   using IteratorType = MatrixRowViewIterator< RowView >;
+
+   using ValueGetterType = details::SparseMatrixRowViewValueGetter< SegmentView, ValuesView, ColumnsIndexesView >;
+
+   /**
+    * \brief Constructor with \e segmentView, \e values and \e columnIndexes.
+    *
+    * \param segmentView instance of SegmentViewType representing matrix row.
+    * \param values is a container view for storing the matrix elements values.
+    * \param columnIndexes is a container view for storing the column indexes of the matrix elements.
+    */
+   __cuda_callable__
+   SparseMatrixRowView( const SegmentViewType& segmentView,
+                        const ValuesViewType& values,
+                        const ColumnsIndexesViewType& columnIndexes );
+
+   /**
+    * \brief Returns size of the matrix row, i.e. number of matrix elements in this row.
+    *
+    * \return Size of the matrix row.
+    */
+   __cuda_callable__
+   IndexType
+   getSize() const;
+
+   /**
+    * \brief Returns the matrix row index.
+    *
+    * \return matrix row index.
+    */
+   __cuda_callable__
+   const IndexType&
+   getRowIndex() const;
+
+   /**
+    * \brief Returns constants reference to a column index of an element with given rank in the row.
+    *
+    * \param localIdx is the rank of the non-zero element in given row.
+    *
+    * \return constant reference to the matrix element column index.
+    */
+   __cuda_callable__
+   const IndexType&
+   getColumnIndex( IndexType localIdx ) const;
+
+   /**
+    * \brief Returns non-constants reference to a column index of an element with given rank in the row.
+    *
+    * \param localIdx is the rank of the non-zero element in given row.
+    *
+    * \return non-constant reference to the matrix element column index.
+    */
+   __cuda_callable__
+   IndexType&
+   getColumnIndex( IndexType localIdx );
+
+   /**
+    * \brief Returns constants reference to value of an element with given rank in the row.
+    *
+    * \param localIdx is the rank of the non-zero element in given row.
+    *
+    * \return constant reference to the matrix element value.
+    */
+   __cuda_callable__
+   auto
+   getValue( IndexType localIdx ) const -> typename ValueGetterType::ConstResultType;
+
+   /**
+    * \brief Returns non-constants reference to value of an element with given rank in the row.
+    *
+    * \param localIdx is the rank of the non-zero element in given row.
+    *
+    * \return non-constant reference to the matrix element value.
+    */
+   __cuda_callable__
+   auto
+   getValue( IndexType localIdx ) -> typename ValueGetterType::ResultType;
+
+   /**
+    * \brief Sets a value of matrix element with given rank in the matrix row.
+    *
+    * \param localIdx is the rank of the matrix element in the row.
+    * \param value is the new value of the matrix element.
+    */
+   __cuda_callable__
+   void
+   setValue( IndexType localIdx, const RealType& value );
+
+   /**
+    * \brief Sets a column index of matrix element with given rank in the matrix row.
+    *
+    * \param localIdx is the rank of the matrix element in the row.
+    * \param columnIndex is the new column index of the matrix element.
+    */
+   __cuda_callable__
+   void
+   setColumnIndex( IndexType localIdx, const IndexType& columnIndex );
+
+   /**
+    * \brief Sets both a value and a column index of matrix element with given rank in the matrix row.
+    *
+    * \param localIdx is the rank of the matrix element in the row.
+    * \param columnIndex is the new column index of the matrix element.
+    * \param value is the new value of the matrix element.
+    */
+   __cuda_callable__
+   void
+   setElement( IndexType localIdx, IndexType columnIndex, const RealType& value );
+
+   /**
+    * \brief Comparison of two matrix rows.
+    *
+    * The other matrix row can be from any other matrix.
+    *
+    * \param other is another matrix row.
+    * \return \e true if both rows are the same, \e false otherwise.
+    */
+   template< typename _SegmentView, typename _ValuesView, typename _ColumnsIndexesView >
+   __cuda_callable__
+   bool
+   operator==( const SparseMatrixRowView< _SegmentView, _ValuesView, _ColumnsIndexesView >& other ) const;
+
+   /**
+    * \brief Returns iterator pointing at the beginning of the matrix row.
+    *
+    * \return iterator pointing at the beginning.
+    */
+   __cuda_callable__
+   IteratorType
+   begin();
+
+   /**
+    * \brief Returns iterator pointing at the end of the matrix row.
+    *
+    * \return iterator pointing at the end.
+    */
+   __cuda_callable__
+   IteratorType
+   end();
+
+   /**
+    * \brief Returns constant iterator pointing at the beginning of the matrix row.
+    *
+    * \return iterator pointing at the beginning.
+    */
+   __cuda_callable__
+   const IteratorType
+   cbegin() const;
+
+   /**
+    * \brief Returns constant iterator pointing at the end of the matrix row.
+    *
+    * \return iterator pointing at the end.
+    */
+   __cuda_callable__
+   const IteratorType
+   cend() const;
+
+   __cuda_callable__
+   IndexType
+   getPaddingIndex() const
+   {
+      return -1;
+   };
+
+protected:
+   SegmentViewType segmentView;
+
+   ValuesViewType values;
+
+   ColumnsIndexesViewType columnIndexes;
 };
 
 /**
@@ -269,12 +281,11 @@ class SparseMatrixRowView
  * \param row is an input sparse matrix row.
  * \return  reference to the output stream.
  */
-template< typename SegmentView,
-          typename ValuesView,
-          typename ColumnsIndexesView >
-std::ostream& operator<<( std::ostream& str, const SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >& row );
+template< typename SegmentView, typename ValuesView, typename ColumnsIndexesView >
+std::ostream&
+operator<<( std::ostream& str, const SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >& row );
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/SparseMatrixRowView.hpp>
diff --git a/src/TNL/Matrices/SparseMatrixRowView.hpp b/src/TNL/Matrices/SparseMatrixRowView.hpp
index e39af30f228f07ed3239e72a1d0174fa6662e63b..fe583c2ecb98056f237f01280583b3cd3ce89d18 100644
--- a/src/TNL/Matrices/SparseMatrixRowView.hpp
+++ b/src/TNL/Matrices/SparseMatrixRowView.hpp
@@ -12,96 +12,74 @@
 namespace TNL {
 namespace Matrices {
 
-template< typename SegmentView,
-          typename ValuesView,
-          typename ColumnsIndexesView >
+template< typename SegmentView, typename ValuesView, typename ColumnsIndexesView >
 __cuda_callable__
-SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::
-SparseMatrixRowView( const SegmentViewType& segmentView,
-                     const ValuesViewType& values,
-                     const ColumnsIndexesViewType& columnIndexes )
- : segmentView( segmentView ), values( values ), columnIndexes( columnIndexes )
-{
-}
-
-template< typename SegmentView,
-          typename ValuesView,
-          typename ColumnsIndexesView >
-__cuda_callable__ auto
-SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::
-getSize() const -> IndexType
+SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::SparseMatrixRowView(
+   const SegmentViewType& segmentView,
+   const ValuesViewType& values,
+   const ColumnsIndexesViewType& columnIndexes )
+: segmentView( segmentView ), values( values ), columnIndexes( columnIndexes )
+{}
+
+template< typename SegmentView, typename ValuesView, typename ColumnsIndexesView >
+__cuda_callable__
+auto
+SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::getSize() const -> IndexType
 {
    return segmentView.getSize();
 }
 
-template< typename SegmentView,
-          typename ValuesView,
-          typename ColumnsIndexesView >
+template< typename SegmentView, typename ValuesView, typename ColumnsIndexesView >
 __cuda_callable__
 auto
-SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::
-getRowIndex() const -> const IndexType&
+SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::getRowIndex() const -> const IndexType&
 {
    return segmentView.getSegmentIndex();
 }
 
-template< typename SegmentView,
-          typename ValuesView,
-          typename ColumnsIndexesView >
-__cuda_callable__ auto
-SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::
-getColumnIndex( const IndexType localIdx ) const -> const IndexType&
+template< typename SegmentView, typename ValuesView, typename ColumnsIndexesView >
+__cuda_callable__
+auto
+SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::getColumnIndex( const IndexType localIdx ) const
+   -> const IndexType&
 {
    TNL_ASSERT_LT( localIdx, this->getSize(), "Local index exceeds matrix row capacity." );
    return columnIndexes[ segmentView.getGlobalIndex( localIdx ) ];
 }
 
-template< typename SegmentView,
-          typename ValuesView,
-          typename ColumnsIndexesView >
-__cuda_callable__ auto
-SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::
-getColumnIndex( const IndexType localIdx ) -> IndexType&
+template< typename SegmentView, typename ValuesView, typename ColumnsIndexesView >
+__cuda_callable__
+auto
+SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::getColumnIndex( const IndexType localIdx ) -> IndexType&
 {
    TNL_ASSERT_LT( localIdx, this->getSize(), "Local index exceeds matrix row capacity." );
    return columnIndexes[ segmentView.getGlobalIndex( localIdx ) ];
 }
 
-template< typename SegmentView,
-          typename ValuesView,
-          typename ColumnsIndexesView >
-__cuda_callable__ auto
-SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::
-getValue( const IndexType localIdx ) const -> typename ValueGetterType::ConstResultType
+template< typename SegmentView, typename ValuesView, typename ColumnsIndexesView >
+__cuda_callable__
+auto
+SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::getValue( const IndexType localIdx ) const ->
+   typename ValueGetterType::ConstResultType
 {
    TNL_ASSERT_LT( localIdx, this->getSize(), "Local index exceeds matrix row capacity." );
-   return ValueGetterType::getValue( segmentView.getGlobalIndex( localIdx ),
-                                     values,
-                                     columnIndexes,
-                                     this->getPaddingIndex() );
+   return ValueGetterType::getValue( segmentView.getGlobalIndex( localIdx ), values, columnIndexes, this->getPaddingIndex() );
 }
 
-template< typename SegmentView,
-          typename ValuesView,
-          typename ColumnsIndexesView >
-__cuda_callable__ auto
-SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::
-getValue( const IndexType localIdx ) -> typename ValueGetterType::ResultType
+template< typename SegmentView, typename ValuesView, typename ColumnsIndexesView >
+__cuda_callable__
+auto
+SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::getValue( const IndexType localIdx ) ->
+   typename ValueGetterType::ResultType
 {
    TNL_ASSERT_LT( localIdx, this->getSize(), "Local index exceeds matrix row capacity." );
-   return ValueGetterType::getValue( segmentView.getGlobalIndex( localIdx ),
-                                     values,
-                                     columnIndexes,
-                                     this->getPaddingIndex() );
+   return ValueGetterType::getValue( segmentView.getGlobalIndex( localIdx ), values, columnIndexes, this->getPaddingIndex() );
 }
 
-template< typename SegmentView,
-          typename ValuesView,
-          typename ColumnsIndexesView >
-__cuda_callable__ void
-SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::
-setValue( const IndexType localIdx,
-          const RealType& value )
+template< typename SegmentView, typename ValuesView, typename ColumnsIndexesView >
+__cuda_callable__
+void
+SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::setValue( const IndexType localIdx, const RealType& value )
 {
    TNL_ASSERT_LT( localIdx, this->getSize(), "Local index exceeds matrix row capacity." );
    if( ! isBinary() ) {
@@ -110,27 +88,23 @@ setValue( const IndexType localIdx,
    }
 }
 
-template< typename SegmentView,
-          typename ValuesView,
-          typename ColumnsIndexesView >
-__cuda_callable__ void
-SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::
-setColumnIndex( const IndexType localIdx,
-                const IndexType& columnIndex )
+template< typename SegmentView, typename ValuesView, typename ColumnsIndexesView >
+__cuda_callable__
+void
+SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::setColumnIndex( const IndexType localIdx,
+                                                                                    const IndexType& columnIndex )
 {
    TNL_ASSERT_LT( localIdx, this->getSize(), "Local index exceeds matrix row capacity." );
    const IndexType globalIdx = segmentView.getGlobalIndex( localIdx );
    this->columnIndexes[ globalIdx ] = columnIndex;
 }
 
-template< typename SegmentView,
-          typename ValuesView,
-          typename ColumnsIndexesView >
-__cuda_callable__ void
-SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::
-setElement( const IndexType localIdx,
-            const IndexType column,
-            const RealType& value )
+template< typename SegmentView, typename ValuesView, typename ColumnsIndexesView >
+__cuda_callable__
+void
+SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::setElement( const IndexType localIdx,
+                                                                                const IndexType column,
+                                                                                const RealType& value )
 {
    TNL_ASSERT_LT( localIdx, this->getSize(), "Local index exceeds matrix row capacity." );
    const IndexType globalIdx = segmentView.getGlobalIndex( localIdx );
@@ -139,16 +113,12 @@ setElement( const IndexType localIdx,
       values[ globalIdx ] = value;
 }
 
-template< typename SegmentView,
-          typename ValuesView,
-          typename ColumnsIndexesView >
-   template< typename _SegmentView,
-             typename _ValuesView,
-             typename _ColumnsIndexesView >
+template< typename SegmentView, typename ValuesView, typename ColumnsIndexesView >
+template< typename _SegmentView, typename _ValuesView, typename _ColumnsIndexesView >
 __cuda_callable__
 bool
-SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::
-operator==( const SparseMatrixRowView< _SegmentView, _ValuesView, _ColumnsIndexesView >& other ) const
+SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::operator==(
+   const SparseMatrixRowView< _SegmentView, _ValuesView, _ColumnsIndexesView >& other ) const
 {
    IndexType i = 0;
    while( i < getSize() && i < other.getSize() ) {
@@ -169,61 +139,52 @@ operator==( const SparseMatrixRowView< _SegmentView, _ValuesView, _ColumnsIndexe
    return true;
 }
 
-template< typename SegmentView,
-          typename ValuesView,
-          typename ColumnsIndexesView >
-__cuda_callable__ auto
-SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::
-begin() -> IteratorType
+template< typename SegmentView, typename ValuesView, typename ColumnsIndexesView >
+__cuda_callable__
+auto
+SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::begin() -> IteratorType
 {
    return IteratorType( *this, 0 );
 }
 
-template< typename SegmentView,
-          typename ValuesView,
-          typename ColumnsIndexesView >
-__cuda_callable__ auto
-SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::
-end() -> IteratorType
+template< typename SegmentView, typename ValuesView, typename ColumnsIndexesView >
+__cuda_callable__
+auto
+SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::end() -> IteratorType
 {
    return IteratorType( *this, this->getSize() );
 }
 
-template< typename SegmentView,
-          typename ValuesView,
-          typename ColumnsIndexesView >
-__cuda_callable__ auto
-SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::
-cbegin() const -> const IteratorType
+template< typename SegmentView, typename ValuesView, typename ColumnsIndexesView >
+__cuda_callable__
+auto
+SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::cbegin() const -> const IteratorType
 {
    return IteratorType( *this, 0 );
 }
 
-template< typename SegmentView,
-          typename ValuesView,
-          typename ColumnsIndexesView >
-__cuda_callable__ auto
-SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::
-cend() const -> const IteratorType
+template< typename SegmentView, typename ValuesView, typename ColumnsIndexesView >
+__cuda_callable__
+auto
+SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::cend() const -> const IteratorType
 {
    return IteratorType( *this, this->getSize() );
 }
 
-template< typename SegmentView,
-          typename ValuesView,
-          typename ColumnsIndexesView >
-std::ostream& operator<<( std::ostream& str, const SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >& row )
+template< typename SegmentView, typename ValuesView, typename ColumnsIndexesView >
+std::ostream&
+operator<<( std::ostream& str, const SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >& row )
 {
-   using NonConstIndex = std::remove_const_t< typename SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::IndexType >;
+   using NonConstIndex =
+      std::remove_const_t< typename SparseMatrixRowView< SegmentView, ValuesView, ColumnsIndexesView >::IndexType >;
    for( NonConstIndex i = 0; i < row.getSize(); i++ )
       if( row.isBinary() )
          // TODO: check getPaddingIndex(), print only the column indices of non-zeros but not the values
-         str << " [ " << row.getColumnIndex( i ) << " ] = " << (row.getColumnIndex( i ) >= 0) << ", ";
+         str << " [ " << row.getColumnIndex( i ) << " ] = " << ( row.getColumnIndex( i ) >= 0 ) << ", ";
       else
          str << " [ " << row.getColumnIndex( i ) << " ] = " << row.getValue( i ) << ", ";
    return str;
 }
 
-
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/SparseMatrixView.h b/src/TNL/Matrices/SparseMatrixView.h
index f5de3f64d99117760e8e6d42120563c80ea27ad0..f0ba3496d4061b4d1cc207266c6149bb7d4eef8f 100644
--- a/src/TNL/Matrices/SparseMatrixView.h
+++ b/src/TNL/Matrices/SparseMatrixView.h
@@ -24,7 +24,7 @@ struct ChooseSparseMatrixComputeReal
    using type = Real;
 };
 
-template< typename Index>
+template< typename Index >
 struct ChooseSparseMatrixComputeReal< bool, Index >
 {
    using type = Index;
@@ -61,878 +61,927 @@ template< typename Real,
 class SparseMatrixView : public MatrixView< Real, Device, Index >
 {
    static_assert(
-      ! MatrixType::isSymmetric() ||
-      ! std::is_same< Device, Devices::Cuda >::value ||
-      ( std::is_same< Real, float >::value || std::is_same< Real, double >::value || std::is_same< Real, int >::value || std::is_same< Real, long long int >::value || std::is_same< Real, bool >::value ),
+      ! MatrixType::isSymmetric() || ! std::is_same< Device, Devices::Cuda >::value
+         || ( std::is_same< Real, float >::value || std::is_same< Real, double >::value || std::is_same< Real, int >::value
+              || std::is_same< Real, long long int >::value || std::is_same< Real, bool >::value ),
       "Given Real type is not supported by atomic operations on GPU which are necessary for symmetric operations." );
 
-   public:
-
-      // Supporting types - they are not important for the user
-      using BaseType = MatrixView< Real, Device, Index >;
-      using ValuesViewType = typename BaseType::ValuesView;
-      using ConstValuesViewType = typename ValuesViewType::ConstViewType;
-      using ColumnsIndexesViewType = Containers::VectorView< typename TNL::copy_const< Index >::template from< Real >::type, Device, Index >;
-      using ConstColumnsIndexesViewType = typename ColumnsIndexesViewType::ConstViewType;
-      using RowsCapacitiesView = Containers::VectorView< Index, Device, Index >;
-      using ConstRowsCapacitiesView = typename RowsCapacitiesView::ConstViewType;
-
-      /**
-       * \brief Test of symmetric matrix type.
-       *
-       * \return \e true if the matrix is stored as symmetric and \e false otherwise.
-       */
-      static constexpr bool isSymmetric() { return MatrixType::isSymmetric(); };
-
-      /**
-       * \brief Test of binary matrix type.
-       *
-       * \return \e true if the matrix is stored as binary and \e false otherwise.
-       */
-      static constexpr bool isBinary() { return std::is_same< Real, bool >::value; };
-
-      /**
-       * \brief The type of matrix elements.
-       */
-      using RealType = std::remove_const_t< Real >;
-
-      using ComputeRealType = ComputeReal;
-
-      /**
-       * \brief The device where the matrix is allocated.
-       */
-      using DeviceType = Device;
-
-      /**
-       * \brief The type used for matrix elements indexing.
-       */
-      using IndexType = Index;
-
-      /**
-       * \brief Templated type of segments view, i.e. sparse matrix format.
-       */
-      template< typename Device_, typename Index_ >
-      using SegmentsViewTemplate = SegmentsView< Device_, Index_ >;
-
-      /**
-       * \brief Type of segments view used by this matrix. It represents the sparse matrix format.
-       */
-      using SegmentsViewType = SegmentsView< Device, Index >;
-
-      /**
-       * \brief Type of related matrix view.
-       */
-      using ViewType = SparseMatrixView< Real, Device, Index, MatrixType, SegmentsViewTemplate >;
-
-      /**
-       * \brief Matrix view type for constant instances.
-       */
-      using ConstViewType = SparseMatrixView< std::add_const_t< Real >, Device, Index, MatrixType, SegmentsViewTemplate >;
-
-      /**
-       * \brief Type for accessing matrix rows.
-       */
-      using RowView = SparseMatrixRowView< typename SegmentsViewType::SegmentViewType, ValuesViewType, ColumnsIndexesViewType >;
-
-      /**
-       * \brief Type for accessing constant matrix rows.
-       */
-      using ConstRowView = SparseMatrixRowView< typename SegmentsViewType::SegmentViewType, ConstValuesViewType, ConstColumnsIndexesViewType >;;
-
-      /**
-       * \brief Helper type for getting self type or its modifications.
-       */
-      template< typename _Real = Real,
-                typename _Device = Device,
-                typename _Index = Index,
-                typename _MatrixType = MatrixType,
-                template< typename, typename > class _SegmentsView = SegmentsView,
-                typename _ComputeReal = ComputeReal >
-      using Self = SparseMatrixView< _Real, _Device, _Index, _MatrixType, _SegmentsView, _ComputeReal >;
-
-      /**
-       * \brief Constructor with no parameters.
-       */
-      __cuda_callable__
-      SparseMatrixView();
-
-      /**
-       * \brief Constructor with all necessary data and views.
-       *
-       * \param rows is a number of matrix rows.
-       * \param columns is a number of matrix columns.
-       * \param values is a vector view with matrix elements values.
-       * \param columnIndexes is a vector view with matrix elements column indexes.
-       * \param segments is a segments view representing the sparse matrix format.
-       */
-      __cuda_callable__
-      SparseMatrixView( const IndexType rows,
-                        const IndexType columns,
-                        const ValuesViewType& values,
-                        const ColumnsIndexesViewType& columnIndexes,
-                        const SegmentsViewType& segments );
-
-      /**
-       * \brief Copy constructor.
-       *
-       * \param matrix is an input sparse matrix view.
-       */
-      __cuda_callable__
-      SparseMatrixView( const SparseMatrixView& matrix ) = default;
-
-      /**
-       * \brief Move constructor.
-       *
-       * \param matrix is an input sparse matrix view.
-       */
-      __cuda_callable__
-      SparseMatrixView( SparseMatrixView&& matrix ) = default;
-
-      /**
-       * \brief Returns a modifiable view of the sparse matrix.
-       *
-       * \return sparse matrix view.
-       */
-      __cuda_callable__
-      ViewType getView();
-
-      /**
-       * \brief Returns a non-modifiable view of the sparse matrix.
-       *
-       * \return sparse matrix view.
-       */
-      __cuda_callable__
-      ConstViewType getConstView() const;
-
-      /**
-       * \brief Returns string with serialization type.
-       *
-       * The string has a form `Matrices::SparseMatrix< RealType,  [any_device], IndexType, General/Symmetric, Format, [any_allocator] >`.
-       *
-       * \return \ref String with the serialization type.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_getSerializationType.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_getSerializationType.out
-       */
-      static String getSerializationType();
-
-      /**
-       * \brief Returns string with serialization type.
-       *
-       * See \ref SparseMatrix::getSerializationType.
-       *
-       * \return \e String with the serialization type.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixExample_getSerializationType.cpp
-       * \par Output
-       * \include SparseMatrixExample_getSerializationType.out
-       */
-      virtual String getSerializationTypeVirtual() const;
-
-      /**
-       * \brief Computes number of non-zeros in each row.
-       *
-       * \param rowLengths is a vector into which the number of non-zeros in each row
-       * will be stored.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_getCompressedRowLengths.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_getCompressedRowLengths.out
-       */
-      template< typename Vector >
-      void getCompressedRowLengths( Vector& rowLengths ) const;
-
-      /**
-       * \brief Compute capacities of all rows.
-       *
-       * The row capacities are not stored explicitly and must be computed.
-       *
-       * \param rowCapacities is a vector where the row capacities will be stored.
-       */
-      template< typename Vector >
-      void getRowCapacities( Vector& rowCapacities ) const;
-
-      /**
-       * \brief Returns capacity of given matrix row.
-       *
-       * \param row index of matrix row.
-       * \return number of matrix elements allocated for the row.
-       */
-      __cuda_callable__
-      IndexType getRowCapacity( const IndexType row ) const;
-
-      /**
-       * \brief Returns number of non-zero matrix elements.
-       *
-       * This method really counts the non-zero matrix elements and so
-       * it returns zero for matrix having all allocated elements set to zero.
-       *
-       * \return number of non-zero matrix elements.
-       */
-      IndexType getNonzeroElementsCount() const;
-
-      /**
-       * \brief Constant getter of simple structure for accessing given matrix row.
-       *
-       * \param rowIdx is matrix row index.
-       *
-       * \return RowView for accessing given matrix row.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_getConstRow.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_getConstRow.out
-       *
-       * See \ref SparseMatrixRowView.
-       */
-      __cuda_callable__
-      ConstRowView getRow( const IndexType& rowIdx ) const;
-
-      /**
-       * \brief Non-constant getter of simple structure for accessing given matrix row.
-       *
-       * \param rowIdx is matrix row index.
-       *
-       * \return RowView for accessing given matrix row.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_getRow.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_getRow.out
-       *
-       * See \ref SparseMatrixRowView.
-       */
-      __cuda_callable__
-      RowView getRow( const IndexType& rowIdx );
-
-      /**
-       * \brief Sets element at given \e row and \e column to given \e value.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref SparseMatrix::getRow
-       * or \ref SparseMatrix::forElements and \ref SparseMatrix::forAllElements.
-       * The call may fail if the matrix row capacity is exhausted.
-       *
-       * \param row is row index of the element.
-       * \param column is columns index of the element.
-       * \param value is the value the element will be set to.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_setElement.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_setElement.out
-       */
-      __cuda_callable__
-      void setElement( const IndexType row,
-                       const IndexType column,
-                       const RealType& value );
-
-      /**
-       * \brief Add element at given \e row and \e column to given \e value.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref SparseMatrix::getRow
-       * or \ref SparseMatrix::forElements and \ref SparseMatrix::forAllElements.
-       * The call may fail if the matrix row capacity is exhausted.
-       *
-       * \param row is row index of the element.
-       * \param column is columns index of the element.
-       * \param value is the value the element will be set to.
-       * \param thisElementMultiplicator is multiplicator the original matrix element
-       *   value is multiplied by before addition of given \e value.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_addElement.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_addElement.out
-       */
-      __cuda_callable__
-      void addElement( IndexType row,
-                       IndexType column,
-                       const RealType& value,
-                       const RealType& thisElementMultiplicator = 1.0 );
-
-      /**
-       * \brief Returns value of matrix element at position given by its row and column index.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref SparseMatrix::getRow
-       * or \ref SparseMatrix::forElements and \ref SparseMatrix::forAllElements.
-       *
-       * \param row is a row index of the matrix element.
-       * \param column i a column index of the matrix element.
-       *
-       * \return value of given matrix element.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_getElement.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_getElement.out
-       *
-       */
-      __cuda_callable__
-      RealType getElement( IndexType row,
-                           IndexType column ) const;
-
-      /**
-       * \brief Method for performing general reduction on matrix rows.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue
-       * ```
-       *
-       *  The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_reduceRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_reduceRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity );
-
-      /**
-       * \brief Method for performing general reduction on matrix rows for constant instances.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue
-       * ```
-       *
-       * The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const RealType& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_reduceRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_reduceRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const;
-
-      /**
-       * \brief Method for performing general reduction on all matrix rows.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       * The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_reduceAllRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_reduceAllRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity );
-
-      /**
-       * \brief Method for performing general reduction on all matrix rows for constant instances.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       * The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_reduceAllRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_reduceAllRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const;
-
-      /**
-       * \brief Method for iteration over all matrix rows for constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value ) { ... };
-       * ```
-       *
-       *  The \e localIdx parameter is a rank of the non-zero element in given row.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin,\e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function& function ) const;
-
-      /**
-       * \brief Method for iteration over all matrix rows for non-constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value ) { ... };
-       * ```
-       *
-       *  The \e localIdx parameter is a rank of the non-zero element in given row.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function& function );
-
-      /**
-       * \brief This method calls \e forElements for all matrix rows (for constant instances).
-       *
-       * See \ref SparseMatrix::forElements.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_forAllRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_forAllRows.out
-       */
-      template< typename Function >
-      void forAllElements( Function& function ) const;
-
-      /**
-       * \brief This method calls \e forElements for all matrix rows.
-       *
-       * See \ref SparseMatrix::forElements.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_forAllRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_forAllRows.out
-       */
-      template< typename Function >
-      void forAllElements( Function& function );
-
-      /**
-       * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end).
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref SparseMatrixView::forElements where more than one thread can be mapped to each row.
-
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrixView::RowView.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forRows( IndexType begin, IndexType end, Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end) for constant instances.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref SparseMatrixView::forElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrixView::RowView.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forRows( IndexType begin, IndexType end, Function&& function ) const;
-
-      /**
-       * \brief Method for parallel iteration over all matrix rows.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref SparseMatrixView::forAllElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrixView::RowView.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forAllRows( Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over all matrix rows for constant instances.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref SparseMatrixView::forAllElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrixView::RowView.
-       *
-       * \par Example
-       * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include SparseMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forAllRows( Function&& function ) const;
-
-      /**
-       * \brief Method for sequential iteration over all matrix rows for constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrixView::RowView.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForRows( IndexType begin, IndexType end, Function& function ) const;
-
-      /**
-       * \brief Method for sequential iteration over all matrix rows for non-constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrixView::RowView.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForRows( IndexType begin, IndexType end, Function& function );
-
-      /**
-       * \brief This method calls \e sequentialForRows for all matrix rows (for constant instances).
-       *
-       * See \ref SparseMatrixView::sequentialForRows.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForAllRows( Function& function ) const;
-
-      /**
-       * \brief This method calls \e sequentialForRows for all matrix rows.
-       *
-       * See \ref SparseMatrixView::sequentialForAllRows.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForAllRows( Function& function );
-
-      /**
-       * \brief Computes product of matrix and vector.
-       *
-       * More precisely, it computes:
-       *
-       * ```
-       * outVector = matrixMultiplicator * ( * this ) * inVector + outVectorMultiplicator * outVector
-       * ```
-       *
-       * \tparam InVector is type of input vector.  It can be \ref Vector,
-       *     \ref VectorView, \ref Array, \ref ArraView or similar container.
-       * \tparam OutVector is type of output vector. It can be \ref Vector,
-       *     \ref VectorView, \ref Array, \ref ArraView or similar container.
-       *
-       * \param inVector is input vector.
-       * \param outVector is output vector.
-       * \param matrixMultiplicator is a factor by which the matrix is multiplied. It is one by default.
-       * \param outVectorMultiplicator is a factor by which the outVector is multiplied before added
-       *    to the result of matrix-vector product. It is zero by default.
-       * \param begin is the beginning of the rows range for which the vector product
-       *    is computed. It is zero by default.
-       * \param end is the end of the rows range for which the vector product
-       *    is computed. It is number if the matrix rows by default.
-       */
-      template< typename InVector,
-                typename OutVector >
-      void vectorProduct( const InVector& inVector,
-                          OutVector& outVector,
-                          const ComputeRealType matrixMultiplicator = 1.0,
-                          const ComputeRealType outVectorMultiplicator = 0.0,
-                          const IndexType begin = 0,
-                          IndexType end = 0 ) const;
-
-      /**
-       * \brief Assignment of any matrix type.
-       * .
-       * \param matrix is input matrix for the assignment.
-       * \return reference to this matrix.
-       */
-      SparseMatrixView& operator=( const SparseMatrixView& matrix );
-
-      /**
-       * \brief Comparison operator with another arbitrary matrix type.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return \e true if the RHS matrix is equal, \e false otherwise.
-       */
-      template< typename Matrix >
-      bool operator==( const Matrix& m ) const;
-
-      /**
-       * \brief Comparison operator with another arbitrary matrix type.
-       *
-       * \param matrix is the right-hand side matrix.
-       * \return \e true if the RHS matrix is equal, \e false otherwise.
-       */
-      template< typename Matrix >
-      bool operator!=( const Matrix& m ) const;
-
-      /**
-       * \brief Method for saving the matrix to the file with given filename.
-       *
-       * \param fileName is name of the file.
-       */
-      void save( const String& fileName ) const;
-
-      /**
-       * \brief Method for saving the matrix to a file.
-       *
-       * \param file is the output file.
-       */
-      void save( File& file ) const;
-
-      /**
-       * \brief Method for printing the matrix to output stream.
-       *
-       * \param str is the output stream.
-       */
-      void print( std::ostream& str ) const;
-
-      /**
-       * \brief Getter of segments for non-constant instances.
-       *
-       * \e Segments are a structure for addressing the matrix elements columns and values.
-       * In fact, \e Segments represent the sparse matrix format.
-       *
-       * \return Non-constant reference to segments.
-       */
-      SegmentsViewType& getSegments();
-
-      /**
-       * \brief Getter of segments for constant instances.
-       *
-       * \e Segments are a structure for addressing the matrix elements columns and values.
-       * In fact, \e Segments represent the sparse matrix format.
-       *
-       * \return Constant reference to segments.
-       */
-      const SegmentsViewType& getSegments() const;
-
-      /**
-       * \brief Getter of column indexes for constant instances.
-       *
-       * \return Constant reference to a vector with matrix elements column indexes.
-       */
-      const ColumnsIndexesViewType& getColumnIndexes() const;
-
-      /**
-       * \brief Getter of column indexes for nonconstant instances.
-       *
-       * \return Reference to a vector with matrix elements column indexes.
-       */
-      ColumnsIndexesViewType& getColumnIndexes();
-
-      /**
-       * \brief Returns a padding index value.
-       *
-       * Padding index is used for column indexes of padding zeros. Padding zeros
-       * are used in some sparse matrix formats for better data alignment in memory.
-       *
-       * \return value of the padding index.
-       */
-      __cuda_callable__
-      IndexType getPaddingIndex() const;
-
-   protected:
-
-      ColumnsIndexesViewType columnIndexes;
-
-      SegmentsViewType segments;
-
-   private:
-      // TODO: this should be probably moved into a detail namespace
-      template< typename VectorOrView,
-                std::enable_if_t< HasSetSizeMethod< VectorOrView >::value, bool > = true >
-      static void set_size_if_resizable( VectorOrView& v, IndexType size )
-      {
-         v.setSize( size );
-      }
-
-      template< typename VectorOrView,
-                std::enable_if_t< ! HasSetSizeMethod< VectorOrView >::value, bool > = true >
-      static void set_size_if_resizable( VectorOrView& v, IndexType size )
-      {
-         TNL_ASSERT_EQ( v.getSize(), size, "view has wrong size" );
-      }
+public:
+   // Supporting types - they are not important for the user
+   using BaseType = MatrixView< Real, Device, Index >;
+   using ValuesViewType = typename BaseType::ValuesView;
+   using ConstValuesViewType = typename ValuesViewType::ConstViewType;
+   using ColumnsIndexesViewType =
+      Containers::VectorView< typename TNL::copy_const< Index >::template from< Real >::type, Device, Index >;
+   using ConstColumnsIndexesViewType = typename ColumnsIndexesViewType::ConstViewType;
+   using RowsCapacitiesView = Containers::VectorView< Index, Device, Index >;
+   using ConstRowsCapacitiesView = typename RowsCapacitiesView::ConstViewType;
+
+   /**
+    * \brief Test of symmetric matrix type.
+    *
+    * \return \e true if the matrix is stored as symmetric and \e false otherwise.
+    */
+   static constexpr bool
+   isSymmetric()
+   {
+      return MatrixType::isSymmetric();
+   };
+
+   /**
+    * \brief Test of binary matrix type.
+    *
+    * \return \e true if the matrix is stored as binary and \e false otherwise.
+    */
+   static constexpr bool
+   isBinary()
+   {
+      return std::is_same< Real, bool >::value;
+   };
+
+   /**
+    * \brief The type of matrix elements.
+    */
+   using RealType = std::remove_const_t< Real >;
+
+   using ComputeRealType = ComputeReal;
+
+   /**
+    * \brief The device where the matrix is allocated.
+    */
+   using DeviceType = Device;
+
+   /**
+    * \brief The type used for matrix elements indexing.
+    */
+   using IndexType = Index;
+
+   /**
+    * \brief Templated type of segments view, i.e. sparse matrix format.
+    */
+   template< typename Device_, typename Index_ >
+   using SegmentsViewTemplate = SegmentsView< Device_, Index_ >;
+
+   /**
+    * \brief Type of segments view used by this matrix. It represents the sparse matrix format.
+    */
+   using SegmentsViewType = SegmentsView< Device, Index >;
+
+   /**
+    * \brief Type of related matrix view.
+    */
+   using ViewType = SparseMatrixView< Real, Device, Index, MatrixType, SegmentsViewTemplate >;
+
+   /**
+    * \brief Matrix view type for constant instances.
+    */
+   using ConstViewType = SparseMatrixView< std::add_const_t< Real >, Device, Index, MatrixType, SegmentsViewTemplate >;
+
+   /**
+    * \brief Type for accessing matrix rows.
+    */
+   using RowView = SparseMatrixRowView< typename SegmentsViewType::SegmentViewType, ValuesViewType, ColumnsIndexesViewType >;
+
+   /**
+    * \brief Type for accessing constant matrix rows.
+    */
+   using ConstRowView =
+      SparseMatrixRowView< typename SegmentsViewType::SegmentViewType, ConstValuesViewType, ConstColumnsIndexesViewType >;
+   ;
+
+   /**
+    * \brief Helper type for getting self type or its modifications.
+    */
+   template< typename _Real = Real,
+             typename _Device = Device,
+             typename _Index = Index,
+             typename _MatrixType = MatrixType,
+             template< typename, typename > class _SegmentsView = SegmentsView,
+             typename _ComputeReal = ComputeReal >
+   using Self = SparseMatrixView< _Real, _Device, _Index, _MatrixType, _SegmentsView, _ComputeReal >;
+
+   /**
+    * \brief Constructor with no parameters.
+    */
+   __cuda_callable__
+   SparseMatrixView();
+
+   /**
+    * \brief Constructor with all necessary data and views.
+    *
+    * \param rows is a number of matrix rows.
+    * \param columns is a number of matrix columns.
+    * \param values is a vector view with matrix elements values.
+    * \param columnIndexes is a vector view with matrix elements column indexes.
+    * \param segments is a segments view representing the sparse matrix format.
+    */
+   __cuda_callable__
+   SparseMatrixView( IndexType rows,
+                     IndexType columns,
+                     const ValuesViewType& values,
+                     const ColumnsIndexesViewType& columnIndexes,
+                     const SegmentsViewType& segments );
+
+   /**
+    * \brief Copy constructor.
+    *
+    * \param matrix is an input sparse matrix view.
+    */
+   __cuda_callable__
+   SparseMatrixView( const SparseMatrixView& matrix ) = default;
+
+   /**
+    * \brief Move constructor.
+    *
+    * \param matrix is an input sparse matrix view.
+    */
+   __cuda_callable__
+   SparseMatrixView( SparseMatrixView&& matrix ) noexcept = default;
+
+   /**
+    * \brief Returns a modifiable view of the sparse matrix.
+    *
+    * \return sparse matrix view.
+    */
+   __cuda_callable__
+   ViewType
+   getView();
+
+   /**
+    * \brief Returns a non-modifiable view of the sparse matrix.
+    *
+    * \return sparse matrix view.
+    */
+   __cuda_callable__
+   ConstViewType
+   getConstView() const;
+
+   /**
+    * \brief Returns string with serialization type.
+    *
+    * The string has a form `Matrices::SparseMatrix< RealType,  [any_device], IndexType, General/Symmetric, Format,
+    * [any_allocator] >`.
+    *
+    * \return \ref String with the serialization type.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_getSerializationType.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_getSerializationType.out
+    */
+   static std::string
+   getSerializationType();
+
+   /**
+    * \brief Returns string with serialization type.
+    *
+    * See \ref SparseMatrix::getSerializationType.
+    *
+    * \return \e String with the serialization type.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixExample_getSerializationType.cpp
+    * \par Output
+    * \include SparseMatrixExample_getSerializationType.out
+    */
+   std::string
+   getSerializationTypeVirtual() const override;
+
+   /**
+    * \brief Computes number of non-zeros in each row.
+    *
+    * \param rowLengths is a vector into which the number of non-zeros in each row
+    * will be stored.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_getCompressedRowLengths.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_getCompressedRowLengths.out
+    */
+   template< typename Vector >
+   void
+   getCompressedRowLengths( Vector& rowLengths ) const;
+
+   /**
+    * \brief Compute capacities of all rows.
+    *
+    * The row capacities are not stored explicitly and must be computed.
+    *
+    * \param rowCapacities is a vector where the row capacities will be stored.
+    */
+   template< typename Vector >
+   void
+   getRowCapacities( Vector& rowCapacities ) const;
+
+   /**
+    * \brief Returns capacity of given matrix row.
+    *
+    * \param row index of matrix row.
+    * \return number of matrix elements allocated for the row.
+    */
+   __cuda_callable__
+   IndexType
+   getRowCapacity( IndexType row ) const;
+
+   /**
+    * \brief Returns number of non-zero matrix elements.
+    *
+    * This method really counts the non-zero matrix elements and so
+    * it returns zero for matrix having all allocated elements set to zero.
+    *
+    * \return number of non-zero matrix elements.
+    */
+   IndexType
+   getNonzeroElementsCount() const override;
+
+   /**
+    * \brief Constant getter of simple structure for accessing given matrix row.
+    *
+    * \param rowIdx is matrix row index.
+    *
+    * \return RowView for accessing given matrix row.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_getConstRow.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_getConstRow.out
+    *
+    * See \ref SparseMatrixRowView.
+    */
+   __cuda_callable__
+   ConstRowView
+   getRow( const IndexType& rowIdx ) const;
+
+   /**
+    * \brief Non-constant getter of simple structure for accessing given matrix row.
+    *
+    * \param rowIdx is matrix row index.
+    *
+    * \return RowView for accessing given matrix row.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_getRow.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_getRow.out
+    *
+    * See \ref SparseMatrixRowView.
+    */
+   __cuda_callable__
+   RowView
+   getRow( const IndexType& rowIdx );
+
+   /**
+    * \brief Sets element at given \e row and \e column to given \e value.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref SparseMatrix::getRow
+    * or \ref SparseMatrix::forElements and \ref SparseMatrix::forAllElements.
+    * The call may fail if the matrix row capacity is exhausted.
+    *
+    * \param row is row index of the element.
+    * \param column is columns index of the element.
+    * \param value is the value the element will be set to.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_setElement.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_setElement.out
+    */
+   __cuda_callable__
+   void
+   setElement( IndexType row, IndexType column, const RealType& value );
+
+   /**
+    * \brief Add element at given \e row and \e column to given \e value.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref SparseMatrix::getRow
+    * or \ref SparseMatrix::forElements and \ref SparseMatrix::forAllElements.
+    * The call may fail if the matrix row capacity is exhausted.
+    *
+    * \param row is row index of the element.
+    * \param column is columns index of the element.
+    * \param value is the value the element will be set to.
+    * \param thisElementMultiplicator is multiplicator the original matrix element
+    *   value is multiplied by before addition of given \e value.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_addElement.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_addElement.out
+    */
+   __cuda_callable__
+   void
+   addElement( IndexType row, IndexType column, const RealType& value, const RealType& thisElementMultiplicator = 1.0 );
+
+   /**
+    * \brief Returns value of matrix element at position given by its row and column index.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref SparseMatrix::getRow
+    * or \ref SparseMatrix::forElements and \ref SparseMatrix::forAllElements.
+    *
+    * \param row is a row index of the matrix element.
+    * \param column i a column index of the matrix element.
+    *
+    * \return value of given matrix element.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_getElement.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_getElement.out
+    *
+    */
+   __cuda_callable__
+   RealType
+   getElement( IndexType row, IndexType column ) const;
+
+   /**
+    * \brief Method for performing general reduction on matrix rows.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue
+    * ```
+    *
+    *  The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_reduceRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_reduceRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity );
+
+   /**
+    * \brief Method for performing general reduction on matrix rows for constant instances.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue
+    * ```
+    *
+    * The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const RealType& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_reduceRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_reduceRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity )
+      const;
+
+   /**
+    * \brief Method for performing general reduction on all matrix rows.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ...
+    * };
+    * ```
+    *
+    * The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_reduceAllRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_reduceAllRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity );
+
+   /**
+    * \brief Method for performing general reduction on all matrix rows for constant instances.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ...
+    * };
+    * ```
+    *
+    * The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_reduceAllRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_reduceAllRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const;
+
+   /**
+    * \brief Method for iteration over all matrix rows for constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )
+    * { ... };
+    * ```
+    *
+    *  The \e localIdx parameter is a rank of the non-zero element in given row.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin,\e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function& function ) const;
+
+   /**
+    * \brief Method for iteration over all matrix rows for non-constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )
+    * { ... };
+    * ```
+    *
+    *  The \e localIdx parameter is a rank of the non-zero element in given row.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function& function );
+
+   /**
+    * \brief This method calls \e forElements for all matrix rows (for constant instances).
+    *
+    * See \ref SparseMatrix::forElements.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_forAllRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_forAllRows.out
+    */
+   template< typename Function >
+   void
+   forAllElements( Function& function ) const;
+
+   /**
+    * \brief This method calls \e forElements for all matrix rows.
+    *
+    * See \ref SparseMatrix::forElements.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_forAllRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_forAllRows.out
+    */
+   template< typename Function >
+   void
+   forAllElements( Function& function );
+
+   /**
+    * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end).
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref SparseMatrixView::forElements where more than one thread can be mapped to each row.
+
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrixView::RowView.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forRows( IndexType begin, IndexType end, Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end) for constant instances.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref SparseMatrixView::forElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrixView::RowView.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forRows( IndexType begin, IndexType end, Function&& function ) const;
+
+   /**
+    * \brief Method for parallel iteration over all matrix rows.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref SparseMatrixView::forAllElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrixView::RowView.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forAllRows( Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over all matrix rows for constant instances.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref SparseMatrixView::forAllElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrixView::RowView.
+    *
+    * \par Example
+    * \include Matrices/SparseMatrix/SparseMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include SparseMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forAllRows( Function&& function ) const;
+
+   /**
+    * \brief Method for sequential iteration over all matrix rows for constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrixView::RowView.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForRows( IndexType begin, IndexType end, Function& function ) const;
+
+   /**
+    * \brief Method for sequential iteration over all matrix rows for non-constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::SparseMatrixView::RowView.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForRows( IndexType begin, IndexType end, Function& function );
+
+   /**
+    * \brief This method calls \e sequentialForRows for all matrix rows (for constant instances).
+    *
+    * See \ref SparseMatrixView::sequentialForRows.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForAllRows( Function& function ) const;
+
+   /**
+    * \brief This method calls \e sequentialForRows for all matrix rows.
+    *
+    * See \ref SparseMatrixView::sequentialForAllRows.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForAllRows( Function& function );
+
+   /**
+    * \brief Computes product of matrix and vector.
+    *
+    * More precisely, it computes:
+    *
+    * ```
+    * outVector = matrixMultiplicator * ( * this ) * inVector + outVectorMultiplicator * outVector
+    * ```
+    *
+    * \tparam InVector is type of input vector.  It can be \ref Vector,
+    *     \ref VectorView, \ref Array, \ref ArraView or similar container.
+    * \tparam OutVector is type of output vector. It can be \ref Vector,
+    *     \ref VectorView, \ref Array, \ref ArraView or similar container.
+    *
+    * \param inVector is input vector.
+    * \param outVector is output vector.
+    * \param matrixMultiplicator is a factor by which the matrix is multiplied. It is one by default.
+    * \param outVectorMultiplicator is a factor by which the outVector is multiplied before added
+    *    to the result of matrix-vector product. It is zero by default.
+    * \param begin is the beginning of the rows range for which the vector product
+    *    is computed. It is zero by default.
+    * \param end is the end of the rows range for which the vector product
+    *    is computed. It is number if the matrix rows by default.
+    */
+   template< typename InVector, typename OutVector >
+   void
+   vectorProduct( const InVector& inVector,
+                  OutVector& outVector,
+                  ComputeRealType matrixMultiplicator = 1.0,
+                  ComputeRealType outVectorMultiplicator = 0.0,
+                  IndexType begin = 0,
+                  IndexType end = 0 ) const;
+
+   /**
+    * \brief Assignment of any matrix type.
+    * .
+    * \param matrix is input matrix for the assignment.
+    * \return reference to this matrix.
+    */
+   SparseMatrixView&
+   operator=( const SparseMatrixView& matrix );
+
+   /**
+    * \brief Comparison operator with another arbitrary matrix type.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return \e true if the RHS matrix is equal, \e false otherwise.
+    */
+   template< typename Matrix >
+   bool
+   operator==( const Matrix& m ) const;
+
+   /**
+    * \brief Comparison operator with another arbitrary matrix type.
+    *
+    * \param matrix is the right-hand side matrix.
+    * \return \e true if the RHS matrix is equal, \e false otherwise.
+    */
+   template< typename Matrix >
+   bool
+   operator!=( const Matrix& m ) const;
+
+   /**
+    * \brief Method for saving the matrix to the file with given filename.
+    *
+    * \param fileName is name of the file.
+    */
+   void
+   save( const String& fileName ) const;
+
+   /**
+    * \brief Method for saving the matrix to a file.
+    *
+    * \param file is the output file.
+    */
+   void
+   save( File& file ) const override;
+
+   /**
+    * \brief Method for printing the matrix to output stream.
+    *
+    * \param str is the output stream.
+    */
+   void
+   print( std::ostream& str ) const override;
+
+   /**
+    * \brief Getter of segments for non-constant instances.
+    *
+    * \e Segments are a structure for addressing the matrix elements columns and values.
+    * In fact, \e Segments represent the sparse matrix format.
+    *
+    * \return Non-constant reference to segments.
+    */
+   SegmentsViewType&
+   getSegments();
+
+   /**
+    * \brief Getter of segments for constant instances.
+    *
+    * \e Segments are a structure for addressing the matrix elements columns and values.
+    * In fact, \e Segments represent the sparse matrix format.
+    *
+    * \return Constant reference to segments.
+    */
+   const SegmentsViewType&
+   getSegments() const;
+
+   /**
+    * \brief Getter of column indexes for constant instances.
+    *
+    * \return Constant reference to a vector with matrix elements column indexes.
+    */
+   const ColumnsIndexesViewType&
+   getColumnIndexes() const;
+
+   /**
+    * \brief Getter of column indexes for nonconstant instances.
+    *
+    * \return Reference to a vector with matrix elements column indexes.
+    */
+   ColumnsIndexesViewType&
+   getColumnIndexes();
+
+   /**
+    * \brief Returns a padding index value.
+    *
+    * Padding index is used for column indexes of padding zeros. Padding zeros
+    * are used in some sparse matrix formats for better data alignment in memory.
+    *
+    * \return value of the padding index.
+    */
+   __cuda_callable__
+   IndexType
+   getPaddingIndex() const;
+
+protected:
+   ColumnsIndexesViewType columnIndexes;
+
+   SegmentsViewType segments;
+
+private:
+   // TODO: this should be probably moved into a detail namespace
+   template< typename VectorOrView, std::enable_if_t< HasSetSizeMethod< VectorOrView >::value, bool > = true >
+   static void
+   set_size_if_resizable( VectorOrView& v, IndexType size )
+   {
+      v.setSize( size );
+   }
+
+   template< typename VectorOrView, std::enable_if_t< ! HasSetSizeMethod< VectorOrView >::value, bool > = true >
+   static void
+   set_size_if_resizable( VectorOrView& v, IndexType size )
+   {
+      TNL_ASSERT_EQ( v.getSize(), size, "view has wrong size" );
+   }
 };
 
-   } // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/SparseMatrixView.hpp>
diff --git a/src/TNL/Matrices/SparseMatrixView.hpp b/src/TNL/Matrices/SparseMatrixView.hpp
index fbef94a9f711f3a2e638dff39d6ad22811c463f5..9420363b82be57eee4995bffa783ce02fac09114 100644
--- a/src/TNL/Matrices/SparseMatrixView.hpp
+++ b/src/TNL/Matrices/SparseMatrixView.hpp
@@ -21,41 +21,39 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
 __cuda_callable__
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-SparseMatrixView()
-{
-}
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::SparseMatrixView() = default;
 
 template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
 __cuda_callable__
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-SparseMatrixView( const IndexType rows,
-                  const IndexType columns,
-                  const ValuesViewType& values,
-                  const ColumnsIndexesViewType& columnIndexes,
-                  const SegmentsViewType& segments )
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::SparseMatrixView(
+   const IndexType rows,
+   const IndexType columns,
+   const ValuesViewType& values,
+   const ColumnsIndexesViewType& columnIndexes,
+   const SegmentsViewType& segments )
 : MatrixView< Real, Device, Index >( rows, columns, values ), columnIndexes( columnIndexes ), segments( segments )
-{
-}
+{}
 
 template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
 __cuda_callable__
 auto
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-getView() -> ViewType
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::getView() -> ViewType
 {
    return ViewType( this->getRows(),
                     this->getColumns(),
@@ -68,12 +66,12 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
 __cuda_callable__
 auto
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-getConstView() const -> ConstViewType
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::getConstView() const -> ConstViewType
 {
    return ConstViewType( this->getRows(),
                          this->getColumns(),
@@ -86,28 +84,26 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-String
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-getSerializationType()
+std::string
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::getSerializationType()
 {
-   return String( "Matrices::SparseMatrix< " ) +
-             TNL::getSerializationType< RealType >() + ", " +
-             TNL::getSerializationType< SegmentsViewType >() + ", [any_device], " +
-             TNL::getSerializationType< IndexType >() + ", " +
-             MatrixType::getSerializationType() + ", [any_allocator], [any_allocator] >";
+   return "Matrices::SparseMatrix< " + TNL::getSerializationType< RealType >() + ", "
+        + TNL::getSerializationType< SegmentsViewType >() + ", [any_device], " + TNL::getSerializationType< IndexType >() + ", "
+        + MatrixType::getSerializationType() + ", [any_allocator], [any_allocator] >";
 }
 
 template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-String
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-getSerializationTypeVirtual() const
+std::string
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::getSerializationTypeVirtual() const
 {
    return this->getSerializationType();
 }
@@ -116,20 +112,23 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-   template< typename Vector >
+template< typename Vector >
 void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-getCompressedRowLengths( Vector& rowLengths ) const
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::getCompressedRowLengths(
+   Vector& rowLengths ) const
 {
    details::set_size_if_resizable( rowLengths, this->getRows() );
    rowLengths = 0;
    auto rowLengths_view = rowLengths.getView();
-   auto fetch = [] __cuda_callable__ ( IndexType row, IndexType column, const RealType& value ) -> IndexType {
+   auto fetch = [] __cuda_callable__( IndexType row, IndexType column, const RealType& value ) -> IndexType
+   {
       return ( value != 0.0 );
    };
-   auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const IndexType value ) mutable {
+   auto keep = [ = ] __cuda_callable__( const IndexType rowIdx, const IndexType value ) mutable
+   {
       rowLengths_view[ rowIdx ] = value;
    };
    this->reduceAllRows( fetch, std::plus<>{}, keep, 0 );
@@ -139,20 +138,22 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-   template< typename Vector >
+template< typename Vector >
 void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-getRowCapacities( Vector& rowLengths ) const
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::getRowCapacities( Vector& rowLengths ) const
 {
    details::set_size_if_resizable( rowLengths, this->getRows() );
    rowLengths = 0;
    auto rowLengths_view = rowLengths.getView();
-   auto fetch = [] __cuda_callable__ ( IndexType row, IndexType column, const RealType& value ) -> IndexType {
+   auto fetch = [] __cuda_callable__( IndexType row, IndexType column, const RealType& value ) -> IndexType
+   {
       return 1;
    };
-   auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const IndexType value ) mutable {
+   auto keep = [ = ] __cuda_callable__( const IndexType rowIdx, const IndexType value ) mutable
+   {
       rowLengths_view[ rowIdx ] = value;
    };
    this->reduceAllRows( fetch, std::plus<>{}, keep, 0 );
@@ -162,12 +163,12 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
 __cuda_callable__
 Index
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-getRowCapacity( const IndexType row ) const
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::getRowCapacity( const IndexType row ) const
 {
    return this->segments.getSegmentSize( row );
 }
@@ -176,39 +177,40 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
 Index
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-getNonzeroElementsCount() const
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::getNonzeroElementsCount() const
 {
    const auto columns_view = this->columnIndexes.getConstView();
    const IndexType paddingIndex = this->getPaddingIndex();
-   if( ! isSymmetric() )
-   {
-      auto fetch = [=] __cuda_callable__ ( const IndexType i ) -> IndexType {
+   if( ! isSymmetric() ) {
+      auto fetch = [ = ] __cuda_callable__( const IndexType i ) -> IndexType
+      {
          return ( columns_view[ i ] != paddingIndex );
       };
       return Algorithms::reduce< DeviceType >( (IndexType) 0, this->columnIndexes.getSize(), fetch, std::plus<>{}, 0 );
    }
-   else
-   {
+   else {
       const auto rows = this->getRows();
       const auto columns = this->getColumns();
       Containers::Vector< IndexType, DeviceType, IndexType > row_sums( this->getRows(), 0 );
       auto row_sums_view = row_sums.getView();
       const auto columnIndexesView = this->columnIndexes.getConstView();
-      auto fetch = [=] __cuda_callable__ ( IndexType row, IndexType localIdx, IndexType globalIdx, bool& compute ) -> IndexType {
+      auto fetch = [ = ] __cuda_callable__( IndexType row, IndexType localIdx, IndexType globalIdx, bool& compute ) -> IndexType
+      {
          const IndexType column = columnIndexesView[ globalIdx ];
          compute = ( column != paddingIndex );
          if( ! compute )
             return 0.0;
-         return 1 + ( column != row && column < rows && row < columns ); // the addition is for non-diagonal elements
+         return 1 + ( column != row && column < rows && row < columns );  // the addition is for non-diagonal elements
       };
-      auto keeper = [=] __cuda_callable__ ( IndexType row, const IndexType& value ) mutable {
+      auto keeper = [ = ] __cuda_callable__( IndexType row, const IndexType& value ) mutable
+      {
          row_sums_view[ row ] = value;
       };
-      this->segments.reduceSegments( 0, this->getRows(), fetch, std::plus<>{}, keeper, ( IndexType ) 0 );
+      this->segments.reduceSegments( 0, this->getRows(), fetch, std::plus<>{}, keeper, (IndexType) 0 );
       return sum( row_sums );
    }
 }
@@ -217,11 +219,13 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-__cuda_callable__ auto
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-getRow( const IndexType& rowIdx ) const -> ConstRowView
+__cuda_callable__
+auto
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::getRow( const IndexType& rowIdx ) const
+   -> ConstRowView
 {
    TNL_ASSERT_LT( rowIdx, this->getRows(), "Row index is larger than number of matrix rows." );
    return ConstRowView( this->segments.getSegmentView( rowIdx ), this->values, this->columnIndexes );
@@ -231,11 +235,12 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-__cuda_callable__ auto
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-getRow( const IndexType& rowIdx ) -> RowView
+__cuda_callable__
+auto
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::getRow( const IndexType& rowIdx ) -> RowView
 {
    TNL_ASSERT_LT( rowIdx, this->getRows(), "Row index is larger than number of matrix rows." );
    return RowView( this->segments.getSegmentView( rowIdx ), this->values, this->columnIndexes );
@@ -245,13 +250,14 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-__cuda_callable__ void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-setElement( const IndexType row,
-            const IndexType column,
-            const RealType& value )
+__cuda_callable__
+void
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::setElement( const IndexType row,
+                                                                                            const IndexType column,
+                                                                                            const RealType& value )
 {
    this->addElement( row, column, value, 0.0 );
 }
@@ -260,38 +266,37 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-__cuda_callable__ void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-addElement( IndexType row,
-            IndexType column,
-            const RealType& value,
-            const RealType& thisElementMultiplicator )
+__cuda_callable__
+void
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::addElement(
+   IndexType row,
+   IndexType column,
+   const RealType& value,
+   const RealType& thisElementMultiplicator )
 {
    TNL_ASSERT_GE( row, 0, "Sparse matrix row index cannot be negative." );
    TNL_ASSERT_LT( row, this->getRows(), "Sparse matrix row index is larger than number of matrix rows." );
    TNL_ASSERT_GE( column, 0, "Sparse matrix column index cannot be negative." );
    TNL_ASSERT_LT( column, this->getColumns(), "Sparse matrix column index is larger than number of matrix columns." );
 
-   if( isSymmetric() && row < column )
-   {
+   if( isSymmetric() && row < column ) {
       swap( row, column );
       TNL_ASSERT_LT( row, this->getRows(), "Column index is out of the symmetric part of the matrix after transposition." );
-      TNL_ASSERT_LT( column,this->getColumns(), "Row index is out of the symmetric part of the matrix after transposition." );
+      TNL_ASSERT_LT( column, this->getColumns(), "Row index is out of the symmetric part of the matrix after transposition." );
    }
 
    const IndexType rowSize = this->segments.getSegmentSize( row );
    IndexType col( this->getPaddingIndex() );
    IndexType i;
    IndexType globalIdx;
-   for( i = 0; i < rowSize; i++ )
-   {
+   for( i = 0; i < rowSize; i++ ) {
       globalIdx = this->segments.getGlobalIndex( row, i );
       TNL_ASSERT_LT( globalIdx, this->columnIndexes.getSize(), "" );
       col = this->columnIndexes.getElement( globalIdx );
-      if( col == column )
-      {
+      if( col == column ) {
          if( ! isBinary() )
             this->values.setElement( globalIdx, thisElementMultiplicator * this->values.getElement( globalIdx ) + value );
          return;
@@ -299,29 +304,25 @@ addElement( IndexType row,
       if( col == this->getPaddingIndex() || col > column )
          break;
    }
-   if( i == rowSize )
-   {
+   if( i == rowSize ) {
 #ifndef __CUDA_ARCH__
       std::stringstream msg;
-      msg << "The capacity of the sparse matrix row number "  << row << " was exceeded.";
+      msg << "The capacity of the sparse matrix row number " << row << " was exceeded.";
       throw std::logic_error( msg.str() );
 #else
-      TNL_ASSERT_TRUE( false, "");
+      TNL_ASSERT_TRUE( false, "" );
       return;
 #endif
    }
-   if( col == this->getPaddingIndex() )
-   {
+   if( col == this->getPaddingIndex() ) {
       this->columnIndexes.setElement( globalIdx, column );
       if( ! isBinary() )
          this->values.setElement( globalIdx, value );
       return;
    }
-   else
-   {
+   else {
       IndexType j = rowSize - 1;
-      while( j > i )
-      {
+      while( j > i ) {
          const IndexType globalIdx1 = this->segments.getGlobalIndex( row, j );
          const IndexType globalIdx2 = this->segments.getGlobalIndex( row, j - 1 );
          TNL_ASSERT_LT( globalIdx1, this->columnIndexes.getSize(), "" );
@@ -343,34 +344,31 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
 __cuda_callable__
 auto
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-getElement( IndexType row,
-            IndexType column ) const -> RealType
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::getElement( IndexType row,
+                                                                                            IndexType column ) const -> RealType
 {
    TNL_ASSERT_GE( row, 0, "Sparse matrix row index cannot be negative." );
    TNL_ASSERT_LT( row, this->getRows(), "Sparse matrix row index is larger than number of matrix rows." );
    TNL_ASSERT_GE( column, 0, "Sparse matrix column index cannot be negative." );
    TNL_ASSERT_LT( column, this->getColumns(), "Sparse matrix column index is larger than number of matrix columns." );
 
-   if( isSymmetric() && row < column )
-   {
+   if( isSymmetric() && row < column ) {
       swap( row, column );
       if( row >= this->getRows() || column >= this->getColumns() )
          return 0.0;
    }
 
    const IndexType rowSize = this->segments.getSegmentSize( row );
-   for( IndexType i = 0; i < rowSize; i++ )
-   {
+   for( IndexType i = 0; i < rowSize; i++ ) {
       const IndexType globalIdx = this->segments.getGlobalIndex( row, i );
       TNL_ASSERT_LT( globalIdx, this->columnIndexes.getSize(), "" );
       const IndexType col = this->columnIndexes.getElement( globalIdx );
-      if( col == column )
-      {
+      if( col == column ) {
          if( isBinary() )
             return 1;
          else
@@ -384,31 +382,28 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-template< typename InVector,
-       typename OutVector >
+template< typename InVector, typename OutVector >
 void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-vectorProduct( const InVector& inVector,
-               OutVector& outVector,
-               const ComputeRealType matrixMultiplicator,
-               const ComputeRealType outVectorMultiplicator,
-               const IndexType firstRow,
-               IndexType lastRow ) const
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::vectorProduct(
+   const InVector& inVector,
+   OutVector& outVector,
+   ComputeRealType matrixMultiplicator,
+   ComputeRealType outVectorMultiplicator,
+   IndexType firstRow,
+   IndexType lastRow ) const
 {
    TNL_ASSERT_EQ( this->getColumns(), inVector.getSize(), "Matrix columns do not fit with input vector." );
    TNL_ASSERT_EQ( this->getRows(), outVector.getSize(), "Matrix rows do not fit with output vector." );
 
    using OutVectorReal = typename OutVector::RealType;
    static_assert(
-         ! MatrixType::isSymmetric() ||
-         ! std::is_same< Device, Devices::Cuda >::value ||
-         ( std::is_same< OutVectorReal, float >::value ||
-           std::is_same< OutVectorReal, double >::value ||
-           std::is_same< OutVectorReal, int >::value ||
-           std::is_same< OutVectorReal, long long int >::value ),
-         "Given Real type is not supported by atomic operations on GPU which are necessary for symmetric operations." );
+      ! MatrixType::isSymmetric() || ! std::is_same< Device, Devices::Cuda >::value
+         || ( std::is_same< OutVectorReal, float >::value || std::is_same< OutVectorReal, double >::value
+              || std::is_same< OutVectorReal, int >::value || std::is_same< OutVectorReal, long long int >::value ),
+      "Given Real type is not supported by atomic operations on GPU which are necessary for symmetric operations." );
 
    const auto inVectorView = inVector.getConstView();
    auto outVectorView = outVector.getView();
@@ -417,26 +412,29 @@ vectorProduct( const InVector& inVector,
    const IndexType paddingIndex = this->getPaddingIndex();
    if( isSymmetric() && outVectorMultiplicator != 1.0 )
       outVector *= outVectorMultiplicator;
-   auto symmetricFetch = [=] __cuda_callable__ ( IndexType row, IndexType localIdx, IndexType globalIdx, bool& compute ) mutable -> ComputeRealType {
+   auto symmetricFetch = [ = ] __cuda_callable__(
+                            IndexType row, IndexType localIdx, IndexType globalIdx, bool& compute ) mutable -> ComputeRealType
+   {
       const IndexType column = columnIndexesView[ globalIdx ];
       compute = ( column != paddingIndex );
       if( ! compute )
          return 0.0;
-      if( isSymmetric() && column < row )
-      {
+      if( isSymmetric() && column < row ) {
          if( isBinary() )
-            Algorithms::AtomicOperations< DeviceType >::add( outVectorView[ column ], ( OutVectorReal ) matrixMultiplicator * inVectorView[ row ] );
+            Algorithms::AtomicOperations< DeviceType >::add( outVectorView[ column ],
+                                                             (OutVectorReal) matrixMultiplicator * inVectorView[ row ] );
          else
-            Algorithms::AtomicOperations< DeviceType >::add( outVectorView[ column ], ( OutVectorReal ) matrixMultiplicator * valuesView[ globalIdx ] * inVectorView[ row ] );
+            Algorithms::AtomicOperations< DeviceType >::add(
+               outVectorView[ column ], (OutVectorReal) matrixMultiplicator * valuesView[ globalIdx ] * inVectorView[ row ] );
       }
       if( isBinary() )
          return inVectorView[ column ];
       return valuesView[ globalIdx ] * inVectorView[ column ];
    };
-   auto fetch = [=] __cuda_callable__ ( IndexType globalIdx, bool& compute ) mutable -> ComputeRealType {
+   auto fetch = [ = ] __cuda_callable__( IndexType globalIdx, bool& compute ) mutable -> ComputeRealType
+   {
       const IndexType column = columnIndexesView[ globalIdx ];
-      if( SegmentsViewType::havePadding() )
-      {
+      if( SegmentsViewType::havePadding() ) {
          compute = ( column != paddingIndex );
          if( ! compute )
             return 0.0;
@@ -446,49 +444,48 @@ vectorProduct( const InVector& inVector,
       return valuesView[ globalIdx ] * inVectorView[ column ];
    };
 
-   auto keeperGeneral = [=] __cuda_callable__ ( IndexType row, const ComputeRealType& value ) mutable {
-      if( isSymmetric() )
-      {
+   auto keeperGeneral = [ = ] __cuda_callable__( IndexType row, const ComputeRealType& value ) mutable
+   {
+      if( isSymmetric() ) {
          typename OutVector::RealType aux = matrixMultiplicator * value;
          Algorithms::AtomicOperations< DeviceType >::add( outVectorView[ row ], aux );
       }
-      else
-      {
+      else {
          if( outVectorMultiplicator == 0.0 )
             outVectorView[ row ] = matrixMultiplicator * value;
          else
             outVectorView[ row ] = outVectorMultiplicator * outVectorView[ row ] + matrixMultiplicator * value;
       }
    };
-   auto keeperDirect = [=] __cuda_callable__ ( IndexType row, const ComputeRealType& value ) mutable {
+   auto keeperDirect = [ = ] __cuda_callable__( IndexType row, const ComputeRealType& value ) mutable
+   {
       outVectorView[ row ] = value;
    };
-   auto keeperMatrixMult = [=] __cuda_callable__ ( IndexType row, const ComputeRealType& value ) mutable {
+   auto keeperMatrixMult = [ = ] __cuda_callable__( IndexType row, const ComputeRealType& value ) mutable
+   {
       outVectorView[ row ] = matrixMultiplicator * value;
    };
-   auto keeperVectorMult = [=] __cuda_callable__ ( IndexType row, const ComputeRealType& value ) mutable {
+   auto keeperVectorMult = [ = ] __cuda_callable__( IndexType row, const ComputeRealType& value ) mutable
+   {
       outVectorView[ row ] = outVectorMultiplicator * outVectorView[ row ] + value;
    };
 
    if( lastRow == 0 )
       lastRow = this->getRows();
    if( isSymmetric() )
-      this->segments.reduceSegments( firstRow, lastRow, symmetricFetch, std::plus<>{}, keeperGeneral, ( ComputeRealType ) 0.0 );
-   else
-   {
-      if( outVectorMultiplicator == 0.0 )
-      {
+      this->segments.reduceSegments( firstRow, lastRow, symmetricFetch, std::plus<>{}, keeperGeneral, (ComputeRealType) 0.0 );
+   else {
+      if( outVectorMultiplicator == 0.0 ) {
          if( matrixMultiplicator == 1.0 )
-            this->segments.reduceSegments( firstRow, lastRow, fetch, std::plus<>{}, keeperDirect, ( ComputeRealType ) 0.0 );
+            this->segments.reduceSegments( firstRow, lastRow, fetch, std::plus<>{}, keeperDirect, (ComputeRealType) 0.0 );
          else
-            this->segments.reduceSegments( firstRow, lastRow, fetch, std::plus<>{}, keeperMatrixMult, ( ComputeRealType ) 0.0 );
+            this->segments.reduceSegments( firstRow, lastRow, fetch, std::plus<>{}, keeperMatrixMult, (ComputeRealType) 0.0 );
       }
-      else
-      {
+      else {
          if( matrixMultiplicator == 1.0 )
-            this->segments.reduceSegments( firstRow, lastRow, fetch, std::plus<>{}, keeperVectorMult, ( ComputeRealType ) 0.0 );
+            this->segments.reduceSegments( firstRow, lastRow, fetch, std::plus<>{}, keeperVectorMult, (ComputeRealType) 0.0 );
          else
-            this->segments.reduceSegments( firstRow, lastRow, fetch, std::plus<>{}, keeperGeneral, ( ComputeRealType ) 0.0 );
+            this->segments.reduceSegments( firstRow, lastRow, fetch, std::plus<>{}, keeperGeneral, (ComputeRealType) 0.0 );
       }
    }
 }
@@ -497,20 +494,26 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
 void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchValue& identity )
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::reduceRows( IndexType begin,
+                                                                                            IndexType end,
+                                                                                            Fetch& fetch,
+                                                                                            const Reduce& reduce,
+                                                                                            Keep& keep,
+                                                                                            const FetchValue& identity )
 {
    auto columns_view = this->columnIndexes.getView();
    auto values_view = this->values.getView();
    const IndexType paddingIndex_ = this->getPaddingIndex();
-   auto fetch_ = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType globalIdx, bool& compute ) mutable -> decltype( fetch( IndexType(), IndexType(), RealType() ) ) {
+   auto fetch_ = [ = ] __cuda_callable__( IndexType rowIdx, IndexType localIdx, IndexType globalIdx, bool& compute ) mutable
+      -> decltype( fetch( IndexType(), IndexType(), RealType() ) )
+   {
       IndexType& columnIdx = columns_view[ globalIdx ];
-      if( columnIdx != paddingIndex_ )
-      {
+      if( columnIdx != paddingIndex_ ) {
          if( isBinary() )
             return fetch( rowIdx, columnIdx, 1 );
          else
@@ -525,21 +528,27 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchValue >
 void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-reduceRows( IndexType begin, IndexType end, Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchValue& identity ) const
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::reduceRows( IndexType begin,
+                                                                                            IndexType end,
+                                                                                            Fetch& fetch,
+                                                                                            const Reduce& reduce,
+                                                                                            Keep& keep,
+                                                                                            const FetchValue& identity ) const
 {
    const auto columns_view = this->columnIndexes.getConstView();
    const auto values_view = this->values.getConstView();
    const IndexType paddingIndex_ = this->getPaddingIndex();
-   auto fetch_ = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType globalIdx, bool& compute ) mutable -> decltype( fetch( IndexType(), IndexType(), RealType() ) ) {
-      TNL_ASSERT_LT( globalIdx, ( IndexType ) columns_view.getSize(), "" );
+   auto fetch_ = [ = ] __cuda_callable__( IndexType rowIdx, IndexType localIdx, IndexType globalIdx, bool& compute ) mutable
+      -> decltype( fetch( IndexType(), IndexType(), RealType() ) )
+   {
+      TNL_ASSERT_LT( globalIdx, (IndexType) columns_view.getSize(), "" );
       IndexType columnIdx = columns_view[ globalIdx ];
-      if( columnIdx != paddingIndex_ )
-      {
+      if( columnIdx != paddingIndex_ ) {
          if( isBinary() )
             return fetch( rowIdx, columnIdx, 1 );
          else
@@ -554,12 +563,15 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity )
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::reduceAllRows( Fetch& fetch,
+                                                                                               const Reduce& reduce,
+                                                                                               Keep& keep,
+                                                                                               const FetchReal& identity )
 {
    this->reduceRows( (IndexType) 0, this->getRows(), fetch, reduce, keep, identity );
 }
@@ -568,12 +580,15 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::reduceAllRows( Fetch& fetch,
+                                                                                               const Reduce& reduce,
+                                                                                               Keep& keep,
+                                                                                               const FetchReal& identity ) const
 {
    this->reduceRows( (IndexType) 0, this->getRows(), fetch, reduce, keep, identity );
 }
@@ -582,26 +597,28 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-forElements( IndexType begin, IndexType end, Function& function ) const
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::forElements( IndexType begin,
+                                                                                             IndexType end,
+                                                                                             Function& function ) const
 {
    const auto columns_view = this->columnIndexes.getConstView();
    const auto values_view = this->values.getConstView();
-   //const IndexType paddingIndex_ = this->getPaddingIndex();
+   // const IndexType paddingIndex_ = this->getPaddingIndex();
    auto columns = this->getColumns();
-   auto f = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType globalIdx ) mutable {
-      if( localIdx < columns )
-      {
+   auto f = [ = ] __cuda_callable__( IndexType rowIdx, IndexType localIdx, IndexType globalIdx ) mutable
+   {
+      if( localIdx < columns ) {
          if( isBinary() )
-            function( rowIdx, localIdx, columns_view[ globalIdx ], ( RealType ) 1.0 );
+            function( rowIdx, localIdx, columns_view[ globalIdx ], (RealType) 1.0 );
          else
             function( rowIdx, localIdx, columns_view[ globalIdx ], values_view[ globalIdx ] );
       }
-      //return true;
+      // return true;
    };
    this->segments.forElements( begin, end, f );
 }
@@ -610,22 +627,23 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-forElements( IndexType begin, IndexType end, Function& function )
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::forElements( IndexType begin,
+                                                                                             IndexType end,
+                                                                                             Function& function )
 {
    auto columns_view = this->columnIndexes.getView();
    auto values_view = this->values.getView();
    const IndexType paddingIndex_ = this->getPaddingIndex();
    auto columns = this->getColumns();
-   auto f = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType globalIdx ) mutable {
-      if( localIdx < columns )
-      {
-         if( isBinary() )
-         {
+   auto f = [ = ] __cuda_callable__( IndexType rowIdx, IndexType localIdx, IndexType globalIdx ) mutable
+   {
+      if( localIdx < columns ) {
+         if( isBinary() ) {
             RealType one( columns_view[ globalIdx ] != paddingIndex_ );
             function( rowIdx, localIdx, columns_view[ globalIdx ], one );
          }
@@ -640,12 +658,12 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-forAllElements( Function& function ) const
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::forAllElements( Function& function ) const
 {
    this->forElements( (IndexType) 0, this->getRows(), function );
 }
@@ -654,12 +672,12 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-forAllElements( Function& function )
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::forAllElements( Function& function )
 {
    this->forElements( (IndexType) 0, this->getRows(), function );
 }
@@ -668,17 +686,20 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-forRows( IndexType begin, IndexType end, Function&& function )
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::forRows( IndexType begin,
+                                                                                         IndexType end,
+                                                                                         Function&& function )
 {
    auto columns_view = this->columnIndexes.getView();
    auto values_view = this->values.getView();
    using SegmentViewType = typename SegmentsViewType::SegmentViewType;
-   auto f = [=] __cuda_callable__ ( SegmentViewType& segmentView ) mutable {
+   auto f = [ = ] __cuda_callable__( SegmentViewType & segmentView ) mutable
+   {
       auto rowView = RowView( segmentView, values_view, columns_view );
       function( rowView );
    };
@@ -689,17 +710,20 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-forRows( IndexType begin, IndexType end, Function&& function ) const
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::forRows( IndexType begin,
+                                                                                         IndexType end,
+                                                                                         Function&& function ) const
 {
    const auto columns_view = this->columnIndexes.getConstView();
    const auto values_view = this->values.getConstView();
    using SegmentViewType = typename SegmentsViewType::SegmentViewType;
-   auto f = [=] __cuda_callable__ ( const SegmentViewType& segmentView ) mutable {
+   auto f = [ = ] __cuda_callable__( const SegmentViewType& segmentView ) mutable
+   {
       const auto rowView = ConstRowView( segmentView, values_view, columns_view );
       function( rowView );
    };
@@ -710,12 +734,12 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-forAllRows( Function&& function )
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::forAllRows( Function&& function )
 {
    this->forRows( (IndexType) 0, this->getRows(), function );
 }
@@ -724,12 +748,12 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-forAllRows( Function&& function ) const
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::forAllRows( Function&& function ) const
 {
    this->forRows( (IndexType) 0, this->getRows(), function );
 }
@@ -738,14 +762,16 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-sequentialForRows( IndexType begin, IndexType end, Function& function ) const
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::sequentialForRows( IndexType begin,
+                                                                                                   IndexType end,
+                                                                                                   Function& function ) const
 {
-   for( IndexType row = begin; row < end; row ++ )
+   for( IndexType row = begin; row < end; row++ )
       this->forRows( row, row + 1, function );
 }
 
@@ -753,14 +779,16 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-sequentialForRows( IndexType begin, IndexType end, Function& function )
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::sequentialForRows( IndexType begin,
+                                                                                                   IndexType end,
+                                                                                                   Function& function )
 {
-   for( IndexType row = begin; row < end; row ++ )
+   for( IndexType row = begin; row < end; row++ )
       this->forRows( row, row + 1, function );
 }
 
@@ -768,12 +796,12 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-sequentialForAllRows( Function& function ) const
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::sequentialForAllRows( Function& function ) const
 {
    this->sequentialForRows( (IndexType) 0, this->getRows(), function );
 }
@@ -782,12 +810,12 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-   template< typename Function >
+template< typename Function >
 void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-sequentialForAllRows( Function& function )
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::sequentialForAllRows( Function& function )
 {
    this->sequentialForRows( (IndexType) 0, this->getRows(), function );
 }
@@ -798,12 +826,10 @@ sequentialForAllRows( Function& function )
           typename Index,
           typename RealAllocator,
           typename IndexAllocator >
-template< typename Real2, template< typename, typename > class Segments2, typename Index2, typename RealAllocator2, typename IndexAllocator2 >
-void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-addMatrix( const SparseMatrixView< Real2, Segments2, Device, Index2, RealAllocator2, IndexAllocator2 >& matrix,
-           const RealType& matrixMultiplicator,
-           const RealType& thisMatrixMultiplicator )
+template< typename Real2, template< typename, typename > class Segments2, typename Index2, typename RealAllocator2, typename
+IndexAllocator2 > void SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >:: addMatrix( const
+SparseMatrixView< Real2, Segments2, Device, Index2, RealAllocator2, IndexAllocator2 >& matrix, const RealType&
+matrixMultiplicator, const RealType& thisMatrixMultiplicator )
 {
 
 }
@@ -827,11 +853,12 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
 SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >&
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-operator=( const SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >& matrix )
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::operator=(
+   const SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >& matrix )
 {
    MatrixView< Real, Device, Index >::operator=( matrix );
    this->columnIndexes.bind( matrix.columnIndexes );
@@ -843,32 +870,32 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-   template< typename Matrix >
+template< typename Matrix >
 bool
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-operator==( const Matrix& m ) const
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::operator==( const Matrix& m ) const
 {
    const auto& view1 = *this;
    const auto view2 = m.getConstView();
-   auto fetch = [=] __cuda_callable__ ( const IndexType i ) -> bool
+   auto fetch = [ = ] __cuda_callable__( const IndexType i ) -> bool
    {
       return view1.getRow( i ) == view2.getRow( i );
    };
-   return Algorithms::reduce< DeviceType >( ( IndexType ) 0, this->getRows(), fetch, std::logical_and<>{}, true );
+   return Algorithms::reduce< DeviceType >( (IndexType) 0, this->getRows(), fetch, std::logical_and<>{}, true );
 }
 
 template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
-   template< typename Matrix >
+template< typename Matrix >
 bool
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-operator!=( const Matrix& m ) const
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::operator!=( const Matrix& m ) const
 {
    return ! operator==( m );
 }
@@ -877,11 +904,11 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
 void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-save( File& file ) const
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::save( File& file ) const
 {
    MatrixView< Real, Device, Index >::save( file );
    file << this->columnIndexes;
@@ -892,11 +919,11 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
 void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-save( const String& fileName ) const
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::save( const String& fileName ) const
 {
    Object::save( fileName );
 }
@@ -905,44 +932,38 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
 void
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-print( std::ostream& str ) const
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::print( std::ostream& str ) const
 {
-   if( isSymmetric() )
-   {
-      for( IndexType row = 0; row < this->getRows(); row++ )
-      {
-         str <<"Row: " << row << " -> ";
-         for( IndexType column = 0; column < this->getColumns(); column++ )
-         {
+   if( isSymmetric() ) {
+      for( IndexType row = 0; row < this->getRows(); row++ ) {
+         str << "Row: " << row << " -> ";
+         for( IndexType column = 0; column < this->getColumns(); column++ ) {
             auto value = this->getElement( row, column );
-            if( value != ( RealType ) 0 )
+            if( value != (RealType) 0 )
                str << " Col:" << column << "->" << value << "\t";
          }
          str << std::endl;
       }
    }
    else
-      for( IndexType row = 0; row < this->getRows(); row++ )
-      {
-         str <<"Row: " << row << " -> ";
+      for( IndexType row = 0; row < this->getRows(); row++ ) {
+         str << "Row: " << row << " -> ";
          const auto rowLength = this->segments.getSegmentSize( row );
-         for( IndexType i = 0; i < rowLength; i++ )
-         {
+         for( IndexType i = 0; i < rowLength; i++ ) {
             const IndexType globalIdx = this->segments.getGlobalIndex( row, i );
             const IndexType column = this->columnIndexes.getElement( globalIdx );
             if( column == this->getPaddingIndex() )
                break;
             RealType value;
             if( isBinary() )
-               value = ( RealType ) 1.0;
+               value = (RealType) 1.0;
             else
                value = this->values.getElement( globalIdx );
-            if( value )
-            {
+            if( value ) {
                std::stringstream str_;
                str_ << std::setw( 4 ) << std::right << column << ":" << std::setw( 4 ) << std::left << value;
                str << std::setw( 10 ) << str_.str();
@@ -956,12 +977,12 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
 __cuda_callable__
 Index
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-getPaddingIndex() const
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::getPaddingIndex() const
 {
    return -1;
 }
@@ -970,11 +991,11 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
 auto
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-getSegments() const -> const SegmentsViewType&
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::getSegments() const -> const SegmentsViewType&
 {
    return this->segments;
 }
@@ -983,11 +1004,11 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
 auto
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-getSegments() -> SegmentsViewType&
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::getSegments() -> SegmentsViewType&
 {
    return this->segments;
 }
@@ -996,11 +1017,12 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
 auto
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-getColumnIndexes() const -> const ColumnsIndexesViewType&
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::getColumnIndexes() const
+   -> const ColumnsIndexesViewType&
 {
    return this->columnIndexes;
 }
@@ -1009,14 +1031,14 @@ template< typename Real,
           typename Device,
           typename Index,
           typename MatrixType,
-          template< typename, typename > class SegmentsView,
+          template< typename, typename >
+          class SegmentsView,
           typename ComputeReal >
 auto
-SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::
-getColumnIndexes() -> ColumnsIndexesViewType&
+SparseMatrixView< Real, Device, Index, MatrixType, SegmentsView, ComputeReal >::getColumnIndexes() -> ColumnsIndexesViewType&
 {
    return this->columnIndexes;
 }
 
-   } //namespace Matrices
-} // namespace  TNL
+}  // namespace Matrices
+}  // namespace  TNL
diff --git a/src/TNL/Matrices/SparseOperations.h b/src/TNL/Matrices/SparseOperations.h
index 7185e64f6d9ee89d2457dd8787cea499846b1416..6872a766bb8bf71a79ad28cc2f7cd19c95f0dde4 100644
--- a/src/TNL/Matrices/SparseOperations.h
+++ b/src/TNL/Matrices/SparseOperations.h
@@ -16,16 +16,15 @@ namespace TNL {
 namespace Matrices {
 
 template< typename Matrix1, typename Matrix2 >
-void copySparseMatrix( Matrix1& A, const Matrix2& B );
+void
+copySparseMatrix( Matrix1& A, const Matrix2& B );
 
 // NOTE: if `has_symmetric_pattern`, the sparsity pattern of `A` is assumed
 // to be symmetric and it is just copied to `B`. Otherwise, the sparsity
 // pattern of `A^T + A` is copied to `B`.
 template< typename Matrix, typename AdjacencyMatrix >
 void
-copyAdjacencyStructure( const Matrix& A, AdjacencyMatrix& B,
-                        bool has_symmetric_pattern = false,
-                        bool ignore_diagonal = true );
+copyAdjacencyStructure( const Matrix& A, AdjacencyMatrix& B, bool has_symmetric_pattern = false, bool ignore_diagonal = true );
 
 // Applies a permutation to the rows of a sparse matrix and its inverse
 // permutation to the columns of the matrix, i.e. A_perm = P*A*P^{-1}, where
@@ -33,15 +32,14 @@ copyAdjacencyStructure( const Matrix& A, AdjacencyMatrix& B,
 // inverse permutation represented by the iperm vector.
 template< typename Matrix1, typename Matrix2, typename PermutationArray >
 void
-reorderSparseMatrix( const Matrix1& A, Matrix2& A_perm,
-                     const PermutationArray& perm, const PermutationArray& iperm );
+reorderSparseMatrix( const Matrix1& A, Matrix2& A_perm, const PermutationArray& perm, const PermutationArray& iperm );
 
 // TODO: the method does not belong here, but there is no better place...
 template< typename Array1, typename Array2, typename PermutationArray >
 void
 reorderArray( const Array1& src, Array2& dest, const PermutationArray& perm );
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
 
 #include "SparseOperations_impl.h"
diff --git a/src/TNL/Matrices/SparseOperations_impl.h b/src/TNL/Matrices/SparseOperations_impl.h
index f4f4d21f922ad990a05374280a2672d4f6216c34..fcf9ce80d5bfdff1ad48e60b6eba20707c2d9af1 100644
--- a/src/TNL/Matrices/SparseOperations_impl.h
+++ b/src/TNL/Matrices/SparseOperations_impl.h
@@ -20,7 +20,8 @@ namespace Matrices {
 
 #ifdef HAVE_CUDA
 template< typename Vector, typename Matrix >
-__global__ void
+__global__
+void
 SparseMatrixSetRowLengthsVectorKernel( Vector* rowLengths,
                                        const Matrix* matrix,
                                        typename Matrix::IndexType rows,
@@ -45,7 +46,8 @@ SparseMatrixSetRowLengthsVectorKernel( Vector* rowLengths,
 }
 
 template< typename Matrix1, typename Matrix2 >
-__global__ void
+__global__
+void
 SparseMatrixCopyKernel( Matrix1* A,
                         const Matrix2* B,
                         const typename Matrix2::IndexType* rowLengths,
@@ -68,8 +70,7 @@ SparseMatrixCopyKernel( Matrix1* A,
 #endif
 
 // copy on the same device
-template< typename Matrix1,
-          typename Matrix2 >
+template< typename Matrix1, typename Matrix2 >
 typename std::enable_if< std::is_same< typename Matrix1::DeviceType, typename Matrix2::DeviceType >::value >::type
 copySparseMatrix_impl( Matrix1& A, const Matrix2& B )
 {
@@ -135,21 +136,18 @@ copySparseMatrix_impl( Matrix1& A, const Matrix2& B )
 
       // set row lengths
       Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >();
-      SparseMatrixSetRowLengthsVectorKernel<<< gridSize, blockSize >>>(
-            rowLengths.getData(),
-            &Bpointer.template getData< TNL::Devices::Cuda >(),
-            rows,
-            cols );
+      SparseMatrixSetRowLengthsVectorKernel<<< gridSize,
+         blockSize >>>( rowLengths.getData(), &Bpointer.template getData< TNL::Devices::Cuda >(), rows, cols );
       TNL_CHECK_CUDA_DEVICE;
       Apointer->setRowCapacities( rowLengths );
 
       // copy rows
       Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >();
-      SparseMatrixCopyKernel<<< gridSize, blockSize >>>(
-            &Apointer.template modifyData< TNL::Devices::Cuda >(),
-            &Bpointer.template getData< TNL::Devices::Cuda >(),
-            rowLengths.getData(),
-            rows );
+      SparseMatrixCopyKernel<<< gridSize,
+         blockSize >>>( &Apointer.template modifyData< TNL::Devices::Cuda >(),
+                                       &Bpointer.template getData< TNL::Devices::Cuda >(),
+                                       rowLengths.getData(),
+                                       rows );
       TNL_CHECK_CUDA_DEVICE;
 #else
       throw Exceptions::CudaSupportMissing();
@@ -158,10 +156,9 @@ copySparseMatrix_impl( Matrix1& A, const Matrix2& B )
 }
 
 // cross-device copy (host -> gpu)
-template< typename Matrix1,
-          typename Matrix2 >
-typename std::enable_if< ! std::is_same< typename Matrix1::DeviceType, typename Matrix2::DeviceType >::value &&
-                           std::is_same< typename Matrix2::DeviceType, Devices::Host >::value >::type
+template< typename Matrix1, typename Matrix2 >
+typename std::enable_if< ! std::is_same< typename Matrix1::DeviceType, typename Matrix2::DeviceType >::value
+                         && std::is_same< typename Matrix2::DeviceType, Devices::Host >::value >::type
 copySparseMatrix_impl( Matrix1& A, const Matrix2& B )
 {
    using CudaMatrix2 = typename Matrix2::template Self< typename Matrix2::RealType, Devices::Cuda >;
@@ -171,10 +168,9 @@ copySparseMatrix_impl( Matrix1& A, const Matrix2& B )
 }
 
 // cross-device copy (gpu -> host)
-template< typename Matrix1,
-          typename Matrix2 >
-typename std::enable_if< ! std::is_same< typename Matrix1::DeviceType, typename Matrix2::DeviceType >::value &&
-                           std::is_same< typename Matrix2::DeviceType, Devices::Cuda >::value >::type
+template< typename Matrix1, typename Matrix2 >
+typename std::enable_if< ! std::is_same< typename Matrix1::DeviceType, typename Matrix2::DeviceType >::value
+                         && std::is_same< typename Matrix2::DeviceType, Devices::Cuda >::value >::type
 copySparseMatrix_impl( Matrix1& A, const Matrix2& B )
 {
    using CudaMatrix1 = typename Matrix1::template Self< typename Matrix1::RealType, Devices::Cuda >;
@@ -190,12 +186,9 @@ copySparseMatrix( Matrix1& A, const Matrix2& B )
    copySparseMatrix_impl( A, B );
 }
 
-
 template< typename Matrix, typename AdjacencyMatrix >
 void
-copyAdjacencyStructure( const Matrix& A, AdjacencyMatrix& B,
-                        bool has_symmetric_pattern,
-                        bool ignore_diagonal )
+copyAdjacencyStructure( const Matrix& A, AdjacencyMatrix& B, bool has_symmetric_pattern, bool ignore_diagonal )
 {
    static_assert( std::is_same< typename Matrix::DeviceType, Devices::Host >::value,
                   "The function is not implemented for CUDA matrices - it would require atomic insertions "
@@ -204,8 +197,8 @@ copyAdjacencyStructure( const Matrix& A, AdjacencyMatrix& B,
                   "The matrices must be allocated on the same device." );
    static_assert( std::is_same< typename Matrix::IndexType, typename AdjacencyMatrix::IndexType >::value,
                   "The matrices must have the same IndexType." );
-//   static_assert( std::is_same< typename AdjacencyMatrix::RealType, bool >::value,
-//                  "The RealType of the adjacency matrix must be bool." );
+   //   static_assert( std::is_same< typename AdjacencyMatrix::RealType, bool >::value,
+   //                  "The RealType of the adjacency matrix must be bool." );
 
    using IndexType = typename Matrix::IndexType;
 
@@ -256,15 +249,17 @@ copyAdjacencyStructure( const Matrix& A, AdjacencyMatrix& B,
    }
 }
 
-
 template< typename Matrix1, typename Matrix2, typename PermutationArray >
 void
 reorderSparseMatrix( const Matrix1& matrix1, Matrix2& matrix2, const PermutationArray& perm, const PermutationArray& iperm )
 {
    // TODO: implement on GPU
-   static_assert( std::is_same< typename Matrix1::DeviceType, Devices::Host >::value, "matrix reordering is implemented only for host" );
-   static_assert( std::is_same< typename Matrix2::DeviceType, Devices::Host >::value, "matrix reordering is implemented only for host" );
-   static_assert( std::is_same< typename PermutationArray::DeviceType, Devices::Host >::value, "matrix reordering is implemented only for host" );
+   static_assert( std::is_same< typename Matrix1::DeviceType, Devices::Host >::value,
+                  "matrix reordering is implemented only for host" );
+   static_assert( std::is_same< typename Matrix2::DeviceType, Devices::Host >::value,
+                  "matrix reordering is implemented only for host" );
+   static_assert( std::is_same< typename PermutationArray::DeviceType, Devices::Host >::value,
+                  "matrix reordering is implemented only for host" );
 
    using IndexType = typename Matrix1::IndexType;
 
@@ -305,7 +300,8 @@ reorderSparseMatrix( const Matrix1& matrix1, Matrix2& matrix2, const Permutation
       // nvcc does not allow lambdas to capture VLAs, even in host code (WTF!?)
       //    error: a variable captured by a lambda cannot have a type involving a variable-length array
       IndexType* _columns = columns;
-      auto comparator = [=]( IndexType a, IndexType b ) {
+      auto comparator = [ = ]( IndexType a, IndexType b )
+      {
          return _columns[ a ] < _columns[ b ];
       };
       std::sort( indices, indices + rowLength, comparator );
@@ -325,29 +321,23 @@ reorderArray( const Array1& src, Array2& dest, const PermutationArray& perm )
                   "Arrays must reside on the same device." );
    static_assert( std::is_same< typename Array1::DeviceType, typename PermutationArray::DeviceType >::value,
                   "Arrays must reside on the same device." );
-   TNL_ASSERT_EQ( src.getSize(), perm.getSize(),
-                  "Source array and permutation must have the same size." );
-   TNL_ASSERT_EQ( dest.getSize(), perm.getSize(),
-                  "Destination array and permutation must have the same size." );
+   TNL_ASSERT_EQ( src.getSize(), perm.getSize(), "Source array and permutation must have the same size." );
+   TNL_ASSERT_EQ( dest.getSize(), perm.getSize(), "Destination array and permutation must have the same size." );
 
    using DeviceType = typename Array1::DeviceType;
    using IndexType = typename Array1::IndexType;
 
-   auto kernel = [] __cuda_callable__
-      ( IndexType i,
-        const typename Array1::ValueType* src,
-        typename Array2::ValueType* dest,
-        const typename PermutationArray::ValueType* perm )
+   auto kernel = [] __cuda_callable__( IndexType i,
+                                       const typename Array1::ValueType* src,
+                                       typename Array2::ValueType* dest,
+                                       const typename PermutationArray::ValueType* perm )
    {
       dest[ i ] = src[ perm[ i ] ];
    };
 
-   Algorithms::ParallelFor< DeviceType >::exec( (IndexType) 0, src.getSize(),
-                                                kernel,
-                                                src.getData(),
-                                                dest.getData(),
-                                                perm.getData() );
+   Algorithms::ParallelFor< DeviceType >::exec(
+      (IndexType) 0, src.getSize(), kernel, src.getData(), dest.getData(), perm.getData() );
 }
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/StaticMatrix.h b/src/TNL/Matrices/StaticMatrix.h
index 980a8c7656a6dc9c0517d9590c29e7cfd990db82..79a38f61e766a8e841c5febb8e4536122433a3b5 100644
--- a/src/TNL/Matrices/StaticMatrix.h
+++ b/src/TNL/Matrices/StaticMatrix.h
@@ -18,46 +18,45 @@ template< typename Value,
           std::size_t Rows,
           std::size_t Columns,
           typename Permutation = std::index_sequence< 0, 1 > >  // identity by default
-class StaticMatrix
-: public Containers::StaticNDArray< Value,
-                                    // note that using std::size_t in SizesHolder does not make sense, since the
-                                    // StaticNDArray is based on StaticArray, which uses int as IndexType
-                                    Containers::SizesHolder< int, Rows, Columns >,
-                                    Permutation >
+class StaticMatrix : public Containers::StaticNDArray< Value,
+                                                       // note that using std::size_t in SizesHolder does not make sense, since
+                                                       // the StaticNDArray is based on StaticArray, which uses int as IndexType
+                                                       Containers::SizesHolder< int, Rows, Columns >,
+                                                       Permutation >
 {
-   using Base = Containers::StaticNDArray< Value,
-                                           Containers::SizesHolder< int, Rows, Columns >,
-                                           Permutation >;
+   using Base = Containers::StaticNDArray< Value, Containers::SizesHolder< int, Rows, Columns >, Permutation >;
 
 public:
    // inherit all assignment operators
    using Base::operator=;
 
-   static constexpr std::size_t getRows()
+   static constexpr std::size_t
+   getRows()
    {
       return Rows;
    }
 
    __cuda_callable__
-   static constexpr std::size_t getColumns()
+   static constexpr std::size_t
+   getColumns()
    {
       return Columns;
    }
 
    __cuda_callable__
    Containers::StaticVector< Rows, Value >
-   operator*( const Containers::StaticVector< Columns, Value > & vector ) const
+   operator*( const Containers::StaticVector< Columns, Value >& vector ) const
    {
       Containers::StaticVector< Rows, Value > result;
       for( std::size_t i = 0; i < Rows; i++ ) {
          Value v = 0;
          for( std::size_t j = 0; j < Columns; j++ )
-            v += (*this)( i, j ) * vector[ j ];
+            v += ( *this )( i, j ) * vector[ j ];
          result[ i ] = v;
       }
       return result;
    }
 };
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/ThreePartVector.h b/src/TNL/Matrices/ThreePartVector.h
index fbe43a13ed734ddb2570d6ecf7c5d4c21206395d..49893e72fad2ec8d0ea465a2148ccdcd8311ac86 100644
--- a/src/TNL/Matrices/ThreePartVector.h
+++ b/src/TNL/Matrices/ThreePartVector.h
@@ -15,12 +15,11 @@ namespace TNL {
 namespace Matrices {
 namespace __DistributedSpMV_impl {
 
-template< typename Real,
-          typename Device = Devices::Host,
-          typename Index = int >
+template< typename Real, typename Device = Devices::Host, typename Index = int >
 class ThreePartVectorView
 {
    using ConstReal = std::add_const_t< Real >;
+
 public:
    using RealType = Real;
    using DeviceType = Device;
@@ -29,50 +28,55 @@ public:
 
    ThreePartVectorView() = default;
    ThreePartVectorView( const ThreePartVectorView& ) = default;
-   ThreePartVectorView( ThreePartVectorView&& ) = default;
+   ThreePartVectorView( ThreePartVectorView&& ) noexcept = default;
 
    ThreePartVectorView( VectorView view_left, VectorView view_mid, VectorView view_right )
    {
       bind( view_left, view_mid, view_right );
    }
 
-   void bind( VectorView view_left, VectorView view_mid, VectorView view_right )
+   void
+   bind( VectorView view_left, VectorView view_mid, VectorView view_right )
    {
       left.bind( view_left );
       middle.bind( view_mid );
       right.bind( view_right );
    }
 
-   void reset()
+   void
+   reset()
    {
       left.reset();
       middle.reset();
       right.reset();
    }
 
-   IndexType getSize() const
+   IndexType
+   getSize() const
    {
       return left.getSize() + middle.getSize() + right.getSize();
    }
 
-   ThreePartVectorView< ConstReal, Device, Index > getConstView() const
+   ThreePartVectorView< ConstReal, Device, Index >
+   getConstView() const
    {
-      return {left.getConstView(), middle, right.getConstView()};
+      return { left.getConstView(), middle, right.getConstView() };
    }
 
-//   __cuda_callable__
-//   Real& operator[]( Index i )
-//   {
-//      if( i < left.getSize() )
-//         return left[ i ];
-//      else if( i < left.getSize() + middle.getSize() )
-//         return middle[ i - left.getSize() ];
-//      else
-//         return right[ i - left.getSize() - middle.getSize() ];
-//   }
+   //   __cuda_callable__
+   //   Real& operator[]( Index i )
+   //   {
+   //      if( i < left.getSize() )
+   //         return left[ i ];
+   //      else if( i < left.getSize() + middle.getSize() )
+   //         return middle[ i - left.getSize() ];
+   //      else
+   //         return right[ i - left.getSize() - middle.getSize() ];
+   //   }
 
    __cuda_callable__
-   const Real& operator[]( Index i ) const
+   const Real&
+   operator[]( Index i ) const
    {
       if( i < left.getSize() )
          return left[ i ];
@@ -83,7 +87,8 @@ public:
    }
 
    __cuda_callable__
-   const Real* getPointer( Index i ) const
+   const Real*
+   getPointer( Index i ) const
    {
       if( i < left.getSize() )
          return &left.getData()[ i ];
@@ -93,7 +98,8 @@ public:
          return &right.getData()[ i - left.getSize() - middle.getSize() ];
    }
 
-   friend std::ostream& operator<<( std::ostream& str, const ThreePartVectorView& v )
+   friend std::ostream&
+   operator<<( std::ostream& str, const ThreePartVectorView& v )
    {
       str << "[\n\tleft: " << v.left << ",\n\tmiddle: " << v.middle << ",\n\tright: " << v.right << "\n]";
       return str;
@@ -103,12 +109,11 @@ protected:
    VectorView left, middle, right;
 };
 
-template< typename Real,
-          typename Device = Devices::Host,
-          typename Index = int >
+template< typename Real, typename Device = Devices::Host, typename Index = int >
 class ThreePartVector
 {
    using ConstReal = std::add_const_t< Real >;
+
 public:
    using RealType = Real;
    using DeviceType = Device;
@@ -120,43 +125,48 @@ public:
    ThreePartVector() = default;
    ThreePartVector( ThreePartVector& ) = default;
 
-   void init( Index size_left, ConstVectorView view_mid, Index size_right )
+   void
+   init( Index size_left, ConstVectorView view_mid, Index size_right )
    {
       left.setSize( size_left );
       middle.bind( view_mid );
       right.setSize( size_right );
    }
 
-   void reset()
+   void
+   reset()
    {
       left.reset();
       middle.reset();
       right.reset();
    }
 
-   IndexType getSize() const
+   IndexType
+   getSize() const
    {
       return left.getSize() + middle.getSize() + right.getSize();
    }
 
-   ThreePartVectorView< ConstReal, Device, Index > getConstView() const
+   ThreePartVectorView< ConstReal, Device, Index >
+   getConstView() const
    {
-      return {left.getConstView(), middle, right.getConstView()};
+      return { left.getConstView(), middle, right.getConstView() };
    }
 
-//   __cuda_callable__
-//   Real& operator[]( Index i )
-//   {
-//      if( i < left.getSize() )
-//         return left[ i ];
-//      else if( i < left.getSize() + middle.getSize() )
-//         return middle[ i - left.getSize() ];
-//      else
-//         return right[ i - left.getSize() - middle.getSize() ];
-//   }
+   //   __cuda_callable__
+   //   Real& operator[]( Index i )
+   //   {
+   //      if( i < left.getSize() )
+   //         return left[ i ];
+   //      else if( i < left.getSize() + middle.getSize() )
+   //         return middle[ i - left.getSize() ];
+   //      else
+   //         return right[ i - left.getSize() - middle.getSize() ];
+   //   }
 
    __cuda_callable__
-   const Real& operator[]( Index i ) const
+   const Real&
+   operator[]( Index i ) const
    {
       if( i < left.getSize() )
          return left[ i ];
@@ -167,7 +177,8 @@ public:
    }
 
    __cuda_callable__
-   const Real* getPointer( Index i ) const
+   const Real*
+   getPointer( Index i ) const
    {
       if( i < left.getSize() )
          return &left.getData()[ i ];
@@ -177,7 +188,8 @@ public:
          return &right.getData()[ i - left.getSize() - middle.getSize() ];
    }
 
-   friend std::ostream& operator<<( std::ostream& str, const ThreePartVector& v )
+   friend std::ostream&
+   operator<<( std::ostream& str, const ThreePartVector& v )
    {
       str << "[\n\tleft: " << v.left << ",\n\tmiddle: " << v.middle << ",\n\tright: " << v.right << "\n]";
       return str;
@@ -188,6 +200,6 @@ protected:
    ConstVectorView middle;
 };
 
-} // namespace __DistributedSpMV_impl
-} // namespace Matrices
-} // namespace TNL
+}  // namespace __DistributedSpMV_impl
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/TridiagonalMatrix.h b/src/TNL/Matrices/TridiagonalMatrix.h
index 806b3fc3b213c997c2e3a387d87fac81bc474faf..08db3dd8d010fe426795390f1b322bcfbc5bff4f 100644
--- a/src/TNL/Matrices/TridiagonalMatrix.h
+++ b/src/TNL/Matrices/TridiagonalMatrix.h
@@ -61,978 +61,1017 @@ template< typename Real = double,
           typename RealAllocator = typename Allocators::Default< Device >::template Allocator< Real > >
 class TridiagonalMatrix : public Matrix< Real, Device, Index, RealAllocator >
 {
-   public:
-
-      // Supporting types - they are not important for the user
-      using BaseType = Matrix< Real, Device, Index, RealAllocator >;
-      using IndexerType = details::TridiagonalMatrixIndexer< Index, Organization >;
-      using ValuesVectorType = typename BaseType::ValuesType;
-      using ValuesViewType = typename ValuesVectorType::ViewType;
-
-      /**
-       * \brief The type of matrix elements.
-       */
-      using RealType = Real;
-
-      /**
-       * \brief The device where the matrix is allocated.
-       */
-      using DeviceType = Device;
-
-      /**
-       * \brief The type used for matrix elements indexing.
-       */
-      using IndexType = Index;
-
-      /**
-       * \brief This is only for compatibility with sparse matrices.
-       *
-       * \return \e  \e false.
-       */
-      static constexpr bool isSymmetric() { return false; };
-
-      /**
-       * \brief The allocator for matrix elements values.
-       */
-      using RealAllocatorType = RealAllocator;
-
-      /**
-       * \brief Type of related matrix view.
-       *
-       * See \ref TridiagonalMatrixView.
-       */
-      using ViewType = TridiagonalMatrixView< Real, Device, Index, Organization >;
-
-      /**
-       * \brief Matrix view type for constant instances.
-       *
-       * See \ref TridiagonalMatrixView.
-       */
-      using ConstViewType = TridiagonalMatrixView< typename std::add_const< Real >::type, Device, Index, Organization >;
-
-      /**
-       * \brief Type for accessing matrix rows.
-       */
-      using RowView = typename ViewType::RowView;
-
-      /**
-       * \brief Type for accessing constant matrix rows.
-       */
-      using ConstRowView = typename ViewType::ConstRowView;
-
-      /**
-       * \brief Helper type for getting self type or its modifications.
-       */
-      template< typename _Real = Real,
-                typename _Device = Device,
-                typename _Index = Index,
-                ElementsOrganization _Organization = Algorithms::Segments::DefaultElementsOrganization< _Device >::getOrganization(),
-                typename _RealAllocator = typename Allocators::Default< _Device >::template Allocator< _Real > >
-      using Self = TridiagonalMatrix< _Real, _Device, _Index, _Organization, _RealAllocator >;
-
-      static constexpr ElementsOrganization getOrganization() { return Organization; };
-
-      /**
-       * \brief Constructor with no parameters.
-       */
-      TridiagonalMatrix();
-
-      /**
-       * \brief Constructor with matrix dimensions.
-       *
-       * \param rows is number of matrix rows.
-       * \param columns is number of matrix columns.
-       */
-      TridiagonalMatrix( const IndexType rows, const IndexType columns );
-
-      /**
-       * \brief Constructor with matrix dimensions, diagonals offsets and matrix elements.
-       *
-       * The number of matrix rows is deduced from the size of the initializer list \e data.
-       *
-       * \tparam ListReal is type used in the initializer list defining matrix elements values.
-       *
-       * \param columns is number of matrix columns.
-       * \param data is initializer list holding matrix elements. The size of the outer list
-       *    defines the number of matrix rows. Each inner list defines values of each sub-diagonal
-       *    and so its size should be lower or equal to three. Values
-       *    of sub-diagonals which do not fit to given row are omitted.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_Constructor_init_list_1.cpp
-       * \par Output
-       * \include TridiagonalMatrixExample_Constructor_init_list_1.out
-       */
-      template< typename ListReal >
-      TridiagonalMatrix( const IndexType columns,
-                         const std::initializer_list< std::initializer_list< ListReal > >& data );
-
-      /**
-       * \brief Copy constructor.
-       *
-       * \param matrix is an input matrix.
-       */
-      TridiagonalMatrix( const TridiagonalMatrix& matrix ) = default;
-
-      /**
-       * \brief Move constructor.
-       *
-       * \param matrix is an input matrix.
-       */
-      TridiagonalMatrix( TridiagonalMatrix&& matrix ) = default;
-
-      /**
-       * \brief Returns a modifiable view of the tridiagonal matrix.
-       *
-       * See \ref TridiagonalMatrixView.
-       *
-       * \return tridiagonal matrix view.
-       */
-      ViewType getView() const; // TODO: remove const
-
-      /**
-       * \brief Returns a non-modifiable view of the tridiagonal matrix.
-       *
-       * See \ref TridiagonalMatrixView.
-       *
-       * \return tridiagonal matrix view.
-       */
-      ConstViewType getConstView() const;
-
-      /**
-       * \brief Returns string with serialization type.
-       *
-       * The string has a form `Matrices::TridiagonalMatrix< RealType,  [any_device], IndexType, ElementsOrganization, [any_allocator] >`.
-       *
-       * \return \ref String with the serialization type.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_getSerializationType.cpp
-       * \par Output
-       * \include TridiagonalMatrixExample_getSerializationType.out
-       */
-      static String getSerializationType();
-
-      /**
-       * \brief Returns string with serialization type.
-       *
-       * See \ref TridiagonalMatrix::getSerializationType.
-       *
-       * \return \e String with the serialization type.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_getSerializationType.cpp
-       * \par Output
-       * \include TridiagonalMatrixExample_getSerializationType.out
-       */
-      virtual String getSerializationTypeVirtual() const;
-
-      /**
-       * \brief Set matrix dimensions.
-       *
-       * \param rows is number of matrix rows.
-       * \param columns is number of matrix columns.
-       */
-      void setDimensions( const IndexType rows,
-                          const IndexType columns );
-
-      /**
-       * \brief This method is for compatibility with \ref SparseMatrix.
-       *
-       * It checks if the number of matrix diagonals is compatible with
-       * required number of non-zero matrix elements in each row. If not
-       * exception is thrown.
-       *
-       * \tparam RowCapacitiesVector is vector-like container type for holding required
-       *    row capacities.
-       *
-       * \param rowCapacities is vector-like container holding required row capacities.
-       */
-      template< typename RowCapacitiesVector >
-      void setRowCapacities( const RowCapacitiesVector& rowCapacities );
-
-      /**
-       * \brief Set matrix elements from an initializer list.
-       *
-       * \tparam ListReal is data type of the initializer list.
-       *
-       * \param data is initializer list holding matrix elements. The size of the outer list
-       *    defines the number of matrix rows. Each inner list defines values of each sub-diagonal
-       *    and so its size should be lower or equal to three. Values
-       *    of sub-diagonals which do not fit to given row are omitted.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_setElements.cpp
-       * \par Output
-       * \include TridiagonalMatrixExample_setElements.out
-       */
-      template< typename ListReal >
-      void setElements( const std::initializer_list< std::initializer_list< ListReal > >& data );
-
-      /**
-       * \brief Compute capacities of all rows.
-       *
-       * The row capacities are not stored explicitly and must be computed.
-       *
-       * \param rowCapacities is a vector where the row capacities will be stored.
-       */
-      template< typename Vector >
-      void getRowCapacities( Vector& rowCapacities ) const;
-
-      /**
-       * \brief Computes number of non-zeros in each row.
-       *
-       * \param rowLengths is a vector into which the number of non-zeros in each row
-       * will be stored.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_getCompressedRowLengths.cpp
-       * \par Output
-       * \include TridiagonalMatrixExample_getCompressedRowLengths.out
-       */
-      template< typename Vector >
-      void getCompressedRowLengths( Vector& rowLengths ) const;
-
-      //[[deprecated]]
-      //IndexType getRowLength( const IndexType row ) const;
-
-      //IndexType getMaxRowLength() const;
-
-      /**
-       * \brief Setup the matrix dimensions and diagonals offsets based on another tridiagonal matrix.
-       *
-       * \tparam Real_ is \e Real type of the source matrix.
-       * \tparam Device_ is \e Device type of the source matrix.
-       * \tparam Index_ is \e Index type of the source matrix.
-       * \tparam Organization_ is \e Organization of the source matrix.
-       * \tparam RealAllocator_ is \e RealAllocator of the source matrix.
-       *
-       * \param matrix is the source matrix.
-       */
-      template< typename Real_,
-                typename Device_,
-                typename Index_,
-                ElementsOrganization Organization_,
-                typename RealAllocator_ >
-      void setLike( const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& matrix );
-
-      /**
-       * \brief Returns number of non-zero matrix elements.
-       *
-       * This method really counts the non-zero matrix elements and so
-       * it returns zero for matrix having all allocated elements set to zero.
-       *
-       * \return number of non-zero matrix elements.
-       */
-      IndexType getNonzeroElementsCount() const;
-
-      /**
-       * \brief Resets the matrix to zero dimensions.
-       */
-      void reset();
-
-      /**
-       * \brief Comparison operator with another tridiagonal matrix.
-       *
-       * \tparam Real_ is \e Real type of the source matrix.
-       * \tparam Device_ is \e Device type of the source matrix.
-       * \tparam Index_ is \e Index type of the source matrix.
-       * \tparam Organization_ is \e Organization of the source matrix.
-       * \tparam RealAllocator_ is \e RealAllocator of the source matrix.
-       *
-       * \return \e true if both matrices are identical and \e false otherwise.
-       */
-      template< typename Real_,
-                typename Device_,
-                typename Index_,
-                ElementsOrganization Organization_,
-                typename RealAllocator_ >
-      bool operator == ( const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& matrix ) const;
-
-      /**
-       * \brief Comparison operator with another tridiagonal matrix.
-       *
-       * \tparam Real_ is \e Real type of the source matrix.
-       * \tparam Device_ is \e Device type of the source matrix.
-       * \tparam Index_ is \e Index type of the source matrix.
-       * \tparam Organization_ is \e Organization of the source matrix.
-       * \tparam RealAllocator_ is \e RealAllocator of the source matrix.
-       *
-       * \param matrix is the source matrix.
-       *
-       * \return \e true if both matrices are NOT identical and \e false otherwise.
-       */
-      template< typename Real_,
-                typename Device_,
-                typename Index_,
-                ElementsOrganization Organization_,
-                typename RealAllocator_ >
-      bool operator != ( const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& matrix ) const;
-
-      /**
-       * \brief Non-constant getter of simple structure for accessing given matrix row.
-       *
-       * \param rowIdx is matrix row index.
-       *
-       * \return RowView for accessing given matrix row.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_getRow.cpp
-       * \par Output
-       * \include TridiagonalMatrixExample_getRow.out
-       *
-       * See \ref TridiagonalMatrixRowView.
-       */
-      __cuda_callable__
-      RowView getRow( const IndexType& rowIdx );
-
-      /**
-       * \brief Constant getter of simple structure for accessing given matrix row.
-       *
-       * \param rowIdx is matrix row index.
-       *
-       * \return RowView for accessing given matrix row.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_getConstRow.cpp
-       * \par Output
-       * \include TridiagonalMatrixExample_getConstRow.out
-       *
-       * See \ref TridiagonalMatrixRowView.
-       */
-      __cuda_callable__
-      const ConstRowView getRow( const IndexType& rowIdx ) const;
-
-      /**
-       * \brief Set all matrix elements to given value.
-       *
-       * \param value is the new value of all matrix elements.
-       */
-      void setValue( const RealType& value );
-
-      /**
-       * \brief Sets element at given \e row and \e column to given \e value.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref TridiagonalMatrix::getRow
-       * or \ref TridiagonalMatrix::forElements and \ref TridiagonalMatrix::forAllElements.
-       * The call may fail if the matrix row capacity is exhausted.
-       *
-       * \param row is row index of the element.
-       * \param column is columns index of the element.
-       * \param value is the value the element will be set to.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_setElement.cpp
-       * \par Output
-       * \include TridiagonalMatrixExample_setElement.out
-       */
-      void setElement( const IndexType row,
-                       const IndexType column,
-                       const RealType& value );
-
-      /**
-       * \brief Add element at given \e row and \e column to given \e value.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref TridiagonalMatrix::getRow
-       * or \ref TridiagonalMatrix::forElements and \ref TridiagonalMatrix::forAllElements.
-       * The call may fail if the matrix row capacity is exhausted.
-       *
-       * \param row is row index of the element.
-       * \param column is columns index of the element.
-       * \param value is the value the element will be set to.
-       * \param thisElementTriplicator is multiplicator the original matrix element
-       *   value is multiplied by before addition of given \e value.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_addElement.cpp
-       * \par Output
-       * \include TridiagonalMatrixExample_addElement.out
-       *
-       */
-      void addElement( const IndexType row,
-                       const IndexType column,
-                       const RealType& value,
-                       const RealType& thisElementTriplicator = 1.0 );
-
-      /**
-       * \brief Returns value of matrix element at position given by its row and column index.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref TridiagonalMatrix::getRow
-       * or \ref TridiagonalMatrix::forElements and \ref TridiagonalMatrix::forAllElements.
-       *
-       * \param row is a row index of the matrix element.
-       * \param column i a column index of the matrix element.
-       *
-       * \return value of given matrix element.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_getElement.cpp
-       * \par Output
-       * \include TridiagonalMatrixExample_getElement.out
-       */
-      RealType getElement( const IndexType row,
-                           const IndexType column ) const;
-
-      /**
-       * \brief Method for performing general reduction on matrix rows.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       * The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_reduceRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixExample_reduceRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceRows( IndexType begin, IndexType end, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity );
-
-      /**
-       * \brief Method for performing general reduction on matrix rows of constant matrix instances.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       *  The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_reduceRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixExample_reduceRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceRows( IndexType begin, IndexType end, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity ) const;
-
-      /**
-       * \brief Method for performing general reduction on all matrix rows.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       * The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row.  It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_reduceAllRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixExample_reduceAllRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity );
-
-      /**
-       * \brief Method for performing general reduction on all matrix rows of constant matrix instances.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       * The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_reduceAllRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixExample_reduceAllRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity ) const;
-
-      /**
-       * \brief Method for iteration over matrix rows for constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value ) { ... };
-       * ```
-       *
-       *  The \e localIdx parameter is a rank of the non-zero element in given row.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function& function ) const;
-
-      /**
-       * \brief Method for iteration over matrix rows for non-constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value ) { ... };
-       * ```
-       *
-       *  The \e localIdx parameter is a rank of the non-zero element in given row.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function& function );
-
-      /**
-       * \brief Method for iteration over all matrix rows for constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value ) { ... };
-       * ```
-       *
-       *  The \e localIdx parameter is a rank of the non-zero element in given row.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forAllRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixExample_forAllRows.out
-       */
-      template< typename Function >
-      void forAllElements( Function& function ) const;
-
-      /**
-       * \brief Method for iteration over all matrix rows for non-constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value ) { ... };
-       * ```
-       *
-       *  The \e localIdx parameter is a rank of the non-zero element in given row.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forAllRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixExample_forAllRows.out
-       */
-      template< typename Function >
-      void forAllElements( Function& function );
-
-      /**
-       * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end).
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref TridiagonalMatrix::forElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrix::RowView.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forRows( IndexType begin, IndexType end, Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end) for constant instances.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref TridiagonalMatrix::forElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrix::RowView.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forRows( IndexType begin, IndexType end, Function&& function ) const;
-
-      /**
-       * \brief Method for parallel iteration over all matrix rows.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref TridiagonalMatrix::forAllElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrix::RowView.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forAllRows( Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over all matrix rows for constant instances.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref TridiagonalMatrix::forAllElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrix::RowView.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixExample_forRows.out
-       */
-      template< typename Function >
-      void forAllRows( Function&& function ) const;
-
-      /**
-       * \brief Method for sequential iteration over all matrix rows for constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrix::RowView.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForRows( IndexType begin, IndexType end, Function& function ) const;
-
-      /**
-       * \brief Method for sequential iteration over all matrix rows for non-constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrix::RowView.
-       *
-       * \param begin defines beginning of the range [begin,end) of rows to be processed.
-       * \param end defines ending of the range [begin,end) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForRows( IndexType begin, IndexType end, Function& function );
-
-      /**
-       * \brief This method calls \e sequentialForRows for all matrix rows (for constant instances).
-       *
-       * See \ref TridiagonalMatrix::sequentialForRows.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForAllRows( Function& function ) const;
-
-      /**
-       * \brief This method calls \e sequentialForRows for all matrix rows.
-       *
-       * See \ref TridiagonalMatrix::sequentialForAllRows.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForAllRows( Function& function );
-
-      /**
-       * \brief Computes product of matrix and vector.
-       *
-       * More precisely, it computes:
-       *
-       * ```
-       * outVector = matrixTriplicator * ( * this ) * inVector + outVectorTriplicator * outVector
-       * ```
-       *
-       * \tparam InVector is type of input vector.  It can be \ref Vector,
-       *     \ref VectorView, \ref Array, \ref ArraView or similar container.
-       * \tparam OutVector is type of output vector. It can be \ref Vector,
-       *     \ref VectorView, \ref Array, \ref ArraView or similar container.
-       *
-       * \param inVector is input vector.
-       * \param outVector is output vector.
-       * \param matrixTriplicator is a factor by which the matrix is multiplied. It is one by default.
-       * \param outVectorTriplicator is a factor by which the outVector is multiplied before added
-       *    to the result of matrix-vector product. It is zero by default.
-       * \param begin is the beginning of the rows range for which the vector product
-       *    is computed. It is zero by default.
-       * \param end is the end of the rows range for which the vector product
-       *    is computed. It is number if the matrix rows by default.
-       */
-      template< typename InVector,
-                typename OutVector >
-      void vectorProduct( const InVector& inVector,
-                          OutVector& outVector,
-                          const RealType matrixTriplicator = 1.0,
-                          const RealType outVectorTriplicator = 0.0,
-                          const IndexType begin = 0,
-                          IndexType end = 0 ) const;
-
-      template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_ >
-      void addMatrix( const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& matrix,
-                      const RealType& matrixTriplicator = 1.0,
-                      const RealType& thisMatrixTriplicator = 1.0 );
-
-      template< typename Real2, typename Index2 >
-      void getTransposition( const TridiagonalMatrix< Real2, Device, Index2 >& matrix,
-                             const RealType& matrixTriplicator = 1.0 );
-
-      /**
-       * \brief Assignment of exactly the same matrix type.
-       *
-       * \param matrix is input matrix for the assignment.
-       * \return reference to this matrix.
-       */
-      TridiagonalMatrix& operator=( const TridiagonalMatrix& matrix );
-
-      /**
-       * \brief Assignment of another tridiagonal matrix
-       *
-       * \param matrix is input matrix for the assignment.
-       * \return reference to this matrix.
-       */
-      template< typename Real_,
-                typename Device_,
-                typename Index_,
-                ElementsOrganization Organization_,
-                typename RealAllocator_ >
-      TridiagonalMatrix& operator=( const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& matrix );
-
-      /**
-       * \brief Method for saving the matrix to a file.
-       *
-       * \param file is the output file.
-       */
-      void save( File& file ) const;
-
-      /**
-       * \brief Method for loading the matrix from a file.
-       *
-       * \param file is the input file.
-       */
-      void load( File& file );
-
-      /**
-       * \brief Method for saving the matrix to the file with given filename.
-       *
-       * \param fileName is name of the file.
-       */
-      void save( const String& fileName ) const;
-
-      /**
-       * \brief Method for loading the matrix from the file with given filename.
-       *
-       * \param fileName is name of the file.
-       */
-      void load( const String& fileName );
-
-      /**
-       * \brief Method for printing the matrix to output stream.
-       *
-       * \param str is the output stream.
-       */
-      void print( std::ostream& str ) const;
-
-      /**
-       * \brief This method returns matrix elements indexer used by this matrix.
-       *
-       * \return constant reference to the indexer.
-       */
-      const IndexerType& getIndexer() const;
-
-      /**
-       * \brief This method returns matrix elements indexer used by this matrix.
-       *
-       * \return non-constant reference to the indexer.
-       */
-      IndexerType& getIndexer();
-
-      /**
-       * \brief Returns padding index denoting padding zero elements.
-       *
-       * These elements are used for efficient data alignment in memory.
-       *
-       * \return value of the padding index.
-       */
-      __cuda_callable__
-      IndexType getPaddingIndex() const;
-
-   protected:
-
-      __cuda_callable__
-      IndexType getElementIndex( const IndexType row,
-                                 const IndexType localIdx ) const;
-
-      IndexerType indexer;
-
-      ViewType view;
+public:
+   // Supporting types - they are not important for the user
+   using BaseType = Matrix< Real, Device, Index, RealAllocator >;
+   using IndexerType = details::TridiagonalMatrixIndexer< Index, Organization >;
+   using ValuesVectorType = typename BaseType::ValuesType;
+   using ValuesViewType = typename ValuesVectorType::ViewType;
+
+   /**
+    * \brief The type of matrix elements.
+    */
+   using RealType = Real;
+
+   /**
+    * \brief The device where the matrix is allocated.
+    */
+   using DeviceType = Device;
+
+   /**
+    * \brief The type used for matrix elements indexing.
+    */
+   using IndexType = Index;
+
+   /**
+    * \brief This is only for compatibility with sparse matrices.
+    *
+    * \return \e  \e false.
+    */
+   static constexpr bool
+   isSymmetric()
+   {
+      return false;
+   };
+
+   /**
+    * \brief The allocator for matrix elements values.
+    */
+   using RealAllocatorType = RealAllocator;
+
+   /**
+    * \brief Type of related matrix view.
+    *
+    * See \ref TridiagonalMatrixView.
+    */
+   using ViewType = TridiagonalMatrixView< Real, Device, Index, Organization >;
+
+   /**
+    * \brief Matrix view type for constant instances.
+    *
+    * See \ref TridiagonalMatrixView.
+    */
+   using ConstViewType = TridiagonalMatrixView< typename std::add_const< Real >::type, Device, Index, Organization >;
+
+   /**
+    * \brief Type for accessing matrix rows.
+    */
+   using RowView = typename ViewType::RowView;
+
+   /**
+    * \brief Type for accessing constant matrix rows.
+    */
+   using ConstRowView = typename ViewType::ConstRowView;
+
+   /**
+    * \brief Helper type for getting self type or its modifications.
+    */
+   template< typename _Real = Real,
+             typename _Device = Device,
+             typename _Index = Index,
+             ElementsOrganization _Organization =
+                Algorithms::Segments::DefaultElementsOrganization< _Device >::getOrganization(),
+             typename _RealAllocator = typename Allocators::Default< _Device >::template Allocator< _Real > >
+   using Self = TridiagonalMatrix< _Real, _Device, _Index, _Organization, _RealAllocator >;
+
+   static constexpr ElementsOrganization
+   getOrganization()
+   {
+      return Organization;
+   };
+
+   /**
+    * \brief Constructor with no parameters.
+    */
+   TridiagonalMatrix();
+
+   /**
+    * \brief Constructor with matrix dimensions.
+    *
+    * \param rows is number of matrix rows.
+    * \param columns is number of matrix columns.
+    */
+   TridiagonalMatrix( IndexType rows, IndexType columns );
+
+   /**
+    * \brief Constructor with matrix dimensions, diagonals offsets and matrix elements.
+    *
+    * The number of matrix rows is deduced from the size of the initializer list \e data.
+    *
+    * \tparam ListReal is type used in the initializer list defining matrix elements values.
+    *
+    * \param columns is number of matrix columns.
+    * \param data is initializer list holding matrix elements. The size of the outer list
+    *    defines the number of matrix rows. Each inner list defines values of each sub-diagonal
+    *    and so its size should be lower or equal to three. Values
+    *    of sub-diagonals which do not fit to given row are omitted.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_Constructor_init_list_1.cpp
+    * \par Output
+    * \include TridiagonalMatrixExample_Constructor_init_list_1.out
+    */
+   template< typename ListReal >
+   TridiagonalMatrix( IndexType columns, const std::initializer_list< std::initializer_list< ListReal > >& data );
+
+   /**
+    * \brief Copy constructor.
+    *
+    * \param matrix is an input matrix.
+    */
+   TridiagonalMatrix( const TridiagonalMatrix& matrix ) = default;
+
+   /**
+    * \brief Move constructor.
+    *
+    * \param matrix is an input matrix.
+    */
+   TridiagonalMatrix( TridiagonalMatrix&& matrix ) noexcept = default;
+
+   /**
+    * \brief Returns a modifiable view of the tridiagonal matrix.
+    *
+    * See \ref TridiagonalMatrixView.
+    *
+    * \return tridiagonal matrix view.
+    */
+   ViewType
+   getView() const;  // TODO: remove const
+
+   /**
+    * \brief Returns a non-modifiable view of the tridiagonal matrix.
+    *
+    * See \ref TridiagonalMatrixView.
+    *
+    * \return tridiagonal matrix view.
+    */
+   ConstViewType
+   getConstView() const;
+
+   /**
+    * \brief Returns string with serialization type.
+    *
+    * The string has a form `Matrices::TridiagonalMatrix< RealType,  [any_device], IndexType, ElementsOrganization,
+    * [any_allocator] >`.
+    *
+    * \return \ref String with the serialization type.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_getSerializationType.cpp
+    * \par Output
+    * \include TridiagonalMatrixExample_getSerializationType.out
+    */
+   static std::string
+   getSerializationType();
+
+   /**
+    * \brief Returns string with serialization type.
+    *
+    * See \ref TridiagonalMatrix::getSerializationType.
+    *
+    * \return \e String with the serialization type.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_getSerializationType.cpp
+    * \par Output
+    * \include TridiagonalMatrixExample_getSerializationType.out
+    */
+   std::string
+   getSerializationTypeVirtual() const override;
+
+   /**
+    * \brief Set matrix dimensions.
+    *
+    * \param rows is number of matrix rows.
+    * \param columns is number of matrix columns.
+    */
+   void
+   setDimensions( IndexType rows, IndexType columns ) override;
+
+   /**
+    * \brief This method is for compatibility with \ref SparseMatrix.
+    *
+    * It checks if the number of matrix diagonals is compatible with
+    * required number of non-zero matrix elements in each row. If not
+    * exception is thrown.
+    *
+    * \tparam RowCapacitiesVector is vector-like container type for holding required
+    *    row capacities.
+    *
+    * \param rowCapacities is vector-like container holding required row capacities.
+    */
+   template< typename RowCapacitiesVector >
+   void
+   setRowCapacities( const RowCapacitiesVector& rowCapacities );
+
+   /**
+    * \brief Set matrix elements from an initializer list.
+    *
+    * \tparam ListReal is data type of the initializer list.
+    *
+    * \param data is initializer list holding matrix elements. The size of the outer list
+    *    defines the number of matrix rows. Each inner list defines values of each sub-diagonal
+    *    and so its size should be lower or equal to three. Values
+    *    of sub-diagonals which do not fit to given row are omitted.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_setElements.cpp
+    * \par Output
+    * \include TridiagonalMatrixExample_setElements.out
+    */
+   template< typename ListReal >
+   void
+   setElements( const std::initializer_list< std::initializer_list< ListReal > >& data );
+
+   /**
+    * \brief Compute capacities of all rows.
+    *
+    * The row capacities are not stored explicitly and must be computed.
+    *
+    * \param rowCapacities is a vector where the row capacities will be stored.
+    */
+   template< typename Vector >
+   void
+   getRowCapacities( Vector& rowCapacities ) const;
+
+   /**
+    * \brief Computes number of non-zeros in each row.
+    *
+    * \param rowLengths is a vector into which the number of non-zeros in each row
+    * will be stored.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_getCompressedRowLengths.cpp
+    * \par Output
+    * \include TridiagonalMatrixExample_getCompressedRowLengths.out
+    */
+   template< typename Vector >
+   void
+   getCompressedRowLengths( Vector& rowLengths ) const;
+
+   //[[deprecated]]
+   // IndexType getRowLength( const IndexType row ) const;
+
+   // IndexType getMaxRowLength() const;
+
+   /**
+    * \brief Setup the matrix dimensions and diagonals offsets based on another tridiagonal matrix.
+    *
+    * \tparam Real_ is \e Real type of the source matrix.
+    * \tparam Device_ is \e Device type of the source matrix.
+    * \tparam Index_ is \e Index type of the source matrix.
+    * \tparam Organization_ is \e Organization of the source matrix.
+    * \tparam RealAllocator_ is \e RealAllocator of the source matrix.
+    *
+    * \param matrix is the source matrix.
+    */
+   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_ >
+   void
+   setLike( const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& matrix );
+
+   /**
+    * \brief Returns number of non-zero matrix elements.
+    *
+    * This method really counts the non-zero matrix elements and so
+    * it returns zero for matrix having all allocated elements set to zero.
+    *
+    * \return number of non-zero matrix elements.
+    */
+   IndexType
+   getNonzeroElementsCount() const override;
+
+   /**
+    * \brief Resets the matrix to zero dimensions.
+    */
+   void
+   reset();
+
+   /**
+    * \brief Comparison operator with another tridiagonal matrix.
+    *
+    * \tparam Real_ is \e Real type of the source matrix.
+    * \tparam Device_ is \e Device type of the source matrix.
+    * \tparam Index_ is \e Index type of the source matrix.
+    * \tparam Organization_ is \e Organization of the source matrix.
+    * \tparam RealAllocator_ is \e RealAllocator of the source matrix.
+    *
+    * \return \e true if both matrices are identical and \e false otherwise.
+    */
+   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_ >
+   bool
+   operator==( const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& matrix ) const;
+
+   /**
+    * \brief Comparison operator with another tridiagonal matrix.
+    *
+    * \tparam Real_ is \e Real type of the source matrix.
+    * \tparam Device_ is \e Device type of the source matrix.
+    * \tparam Index_ is \e Index type of the source matrix.
+    * \tparam Organization_ is \e Organization of the source matrix.
+    * \tparam RealAllocator_ is \e RealAllocator of the source matrix.
+    *
+    * \param matrix is the source matrix.
+    *
+    * \return \e true if both matrices are NOT identical and \e false otherwise.
+    */
+   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_ >
+   bool
+   operator!=( const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& matrix ) const;
+
+   /**
+    * \brief Non-constant getter of simple structure for accessing given matrix row.
+    *
+    * \param rowIdx is matrix row index.
+    *
+    * \return RowView for accessing given matrix row.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_getRow.cpp
+    * \par Output
+    * \include TridiagonalMatrixExample_getRow.out
+    *
+    * See \ref TridiagonalMatrixRowView.
+    */
+   __cuda_callable__
+   RowView
+   getRow( const IndexType& rowIdx );
+
+   /**
+    * \brief Constant getter of simple structure for accessing given matrix row.
+    *
+    * \param rowIdx is matrix row index.
+    *
+    * \return RowView for accessing given matrix row.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_getConstRow.cpp
+    * \par Output
+    * \include TridiagonalMatrixExample_getConstRow.out
+    *
+    * See \ref TridiagonalMatrixRowView.
+    */
+   __cuda_callable__
+   const ConstRowView
+   getRow( const IndexType& rowIdx ) const;
+
+   /**
+    * \brief Set all matrix elements to given value.
+    *
+    * \param value is the new value of all matrix elements.
+    */
+   void
+   setValue( const RealType& value );
+
+   /**
+    * \brief Sets element at given \e row and \e column to given \e value.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref TridiagonalMatrix::getRow
+    * or \ref TridiagonalMatrix::forElements and \ref TridiagonalMatrix::forAllElements.
+    * The call may fail if the matrix row capacity is exhausted.
+    *
+    * \param row is row index of the element.
+    * \param column is columns index of the element.
+    * \param value is the value the element will be set to.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_setElement.cpp
+    * \par Output
+    * \include TridiagonalMatrixExample_setElement.out
+    */
+   void
+   setElement( IndexType row, IndexType column, const RealType& value );
+
+   /**
+    * \brief Add element at given \e row and \e column to given \e value.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref TridiagonalMatrix::getRow
+    * or \ref TridiagonalMatrix::forElements and \ref TridiagonalMatrix::forAllElements.
+    * The call may fail if the matrix row capacity is exhausted.
+    *
+    * \param row is row index of the element.
+    * \param column is columns index of the element.
+    * \param value is the value the element will be set to.
+    * \param thisElementTriplicator is multiplicator the original matrix element
+    *   value is multiplied by before addition of given \e value.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_addElement.cpp
+    * \par Output
+    * \include TridiagonalMatrixExample_addElement.out
+    *
+    */
+   void
+   addElement( IndexType row, IndexType column, const RealType& value, const RealType& thisElementTriplicator = 1.0 );
+
+   /**
+    * \brief Returns value of matrix element at position given by its row and column index.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref TridiagonalMatrix::getRow
+    * or \ref TridiagonalMatrix::forElements and \ref TridiagonalMatrix::forAllElements.
+    *
+    * \param row is a row index of the matrix element.
+    * \param column i a column index of the matrix element.
+    *
+    * \return value of given matrix element.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_getElement.cpp
+    * \par Output
+    * \include TridiagonalMatrixExample_getElement.out
+    */
+   RealType
+   getElement( IndexType row, IndexType column ) const;
+
+   /**
+    * \brief Method for performing general reduction on matrix rows.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ...
+    * };
+    * ```
+    *
+    * The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_reduceRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixExample_reduceRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceRows( IndexType begin, IndexType end, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity );
+
+   /**
+    * \brief Method for performing general reduction on matrix rows of constant matrix instances.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ...
+    * };
+    * ```
+    *
+    *  The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_reduceRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixExample_reduceRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceRows( IndexType begin, IndexType end, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity ) const;
+
+   /**
+    * \brief Method for performing general reduction on all matrix rows.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ...
+    * };
+    * ```
+    *
+    * The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row.  It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_reduceAllRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixExample_reduceAllRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity );
+
+   /**
+    * \brief Method for performing general reduction on all matrix rows of constant matrix instances.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ...
+    * };
+    * ```
+    *
+    * The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_reduceAllRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixExample_reduceAllRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity ) const;
+
+   /**
+    * \brief Method for iteration over matrix rows for constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )
+    * { ... };
+    * ```
+    *
+    *  The \e localIdx parameter is a rank of the non-zero element in given row.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function& function ) const;
+
+   /**
+    * \brief Method for iteration over matrix rows for non-constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )
+    * { ... };
+    * ```
+    *
+    *  The \e localIdx parameter is a rank of the non-zero element in given row.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function& function );
+
+   /**
+    * \brief Method for iteration over all matrix rows for constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )
+    * { ... };
+    * ```
+    *
+    *  The \e localIdx parameter is a rank of the non-zero element in given row.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forAllRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixExample_forAllRows.out
+    */
+   template< typename Function >
+   void
+   forAllElements( Function& function ) const;
+
+   /**
+    * \brief Method for iteration over all matrix rows for non-constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )
+    * { ... };
+    * ```
+    *
+    *  The \e localIdx parameter is a rank of the non-zero element in given row.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forAllRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixExample_forAllRows.out
+    */
+   template< typename Function >
+   void
+   forAllElements( Function& function );
+
+   /**
+    * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end).
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref TridiagonalMatrix::forElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrix::RowView.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forRows( IndexType begin, IndexType end, Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end) for constant instances.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref TridiagonalMatrix::forElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrix::RowView.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forRows( IndexType begin, IndexType end, Function&& function ) const;
+
+   /**
+    * \brief Method for parallel iteration over all matrix rows.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref TridiagonalMatrix::forAllElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrix::RowView.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forAllRows( Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over all matrix rows for constant instances.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref TridiagonalMatrix::forAllElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrix::RowView.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_forRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forAllRows( Function&& function ) const;
+
+   /**
+    * \brief Method for sequential iteration over all matrix rows for constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrix::RowView.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForRows( IndexType begin, IndexType end, Function& function ) const;
+
+   /**
+    * \brief Method for sequential iteration over all matrix rows for non-constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrix::RowView.
+    *
+    * \param begin defines beginning of the range [begin,end) of rows to be processed.
+    * \param end defines ending of the range [begin,end) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForRows( IndexType begin, IndexType end, Function& function );
+
+   /**
+    * \brief This method calls \e sequentialForRows for all matrix rows (for constant instances).
+    *
+    * See \ref TridiagonalMatrix::sequentialForRows.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForAllRows( Function& function ) const;
+
+   /**
+    * \brief This method calls \e sequentialForRows for all matrix rows.
+    *
+    * See \ref TridiagonalMatrix::sequentialForAllRows.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForAllRows( Function& function );
+
+   /**
+    * \brief Computes product of matrix and vector.
+    *
+    * More precisely, it computes:
+    *
+    * ```
+    * outVector = matrixTriplicator * ( * this ) * inVector + outVectorTriplicator * outVector
+    * ```
+    *
+    * \tparam InVector is type of input vector.  It can be \ref Vector,
+    *     \ref VectorView, \ref Array, \ref ArraView or similar container.
+    * \tparam OutVector is type of output vector. It can be \ref Vector,
+    *     \ref VectorView, \ref Array, \ref ArraView or similar container.
+    *
+    * \param inVector is input vector.
+    * \param outVector is output vector.
+    * \param matrixTriplicator is a factor by which the matrix is multiplied. It is one by default.
+    * \param outVectorTriplicator is a factor by which the outVector is multiplied before added
+    *    to the result of matrix-vector product. It is zero by default.
+    * \param begin is the beginning of the rows range for which the vector product
+    *    is computed. It is zero by default.
+    * \param end is the end of the rows range for which the vector product
+    *    is computed. It is number if the matrix rows by default.
+    */
+   template< typename InVector, typename OutVector >
+   void
+   vectorProduct( const InVector& inVector,
+                  OutVector& outVector,
+                  RealType matrixTriplicator = 1.0,
+                  RealType outVectorTriplicator = 0.0,
+                  IndexType begin = 0,
+                  IndexType end = 0 ) const;
+
+   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_ >
+   void
+   addMatrix( const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& matrix,
+              const RealType& matrixTriplicator = 1.0,
+              const RealType& thisMatrixTriplicator = 1.0 );
+
+   template< typename Real2, typename Index2 >
+   void
+   getTransposition( const TridiagonalMatrix< Real2, Device, Index2 >& matrix, const RealType& matrixTriplicator = 1.0 );
+
+   /**
+    * \brief Assignment of exactly the same matrix type.
+    *
+    * \param matrix is input matrix for the assignment.
+    * \return reference to this matrix.
+    */
+   TridiagonalMatrix&
+   operator=( const TridiagonalMatrix& matrix );
+
+   /**
+    * \brief Assignment of another tridiagonal matrix
+    *
+    * \param matrix is input matrix for the assignment.
+    * \return reference to this matrix.
+    */
+   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_ >
+   TridiagonalMatrix&
+   operator=( const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& matrix );
+
+   /**
+    * \brief Method for saving the matrix to a file.
+    *
+    * \param file is the output file.
+    */
+   void
+   save( File& file ) const override;
+
+   /**
+    * \brief Method for loading the matrix from a file.
+    *
+    * \param file is the input file.
+    */
+   void
+   load( File& file ) override;
+
+   /**
+    * \brief Method for saving the matrix to the file with given filename.
+    *
+    * \param fileName is name of the file.
+    */
+   void
+   save( const String& fileName ) const;
+
+   /**
+    * \brief Method for loading the matrix from the file with given filename.
+    *
+    * \param fileName is name of the file.
+    */
+   void
+   load( const String& fileName );
+
+   /**
+    * \brief Method for printing the matrix to output stream.
+    *
+    * \param str is the output stream.
+    */
+   void
+   print( std::ostream& str ) const override;
+
+   /**
+    * \brief This method returns matrix elements indexer used by this matrix.
+    *
+    * \return constant reference to the indexer.
+    */
+   const IndexerType&
+   getIndexer() const;
+
+   /**
+    * \brief This method returns matrix elements indexer used by this matrix.
+    *
+    * \return non-constant reference to the indexer.
+    */
+   IndexerType&
+   getIndexer();
+
+   /**
+    * \brief Returns padding index denoting padding zero elements.
+    *
+    * These elements are used for efficient data alignment in memory.
+    *
+    * \return value of the padding index.
+    */
+   __cuda_callable__
+   IndexType
+   getPaddingIndex() const;
+
+protected:
+   __cuda_callable__
+   IndexType
+   getElementIndex( IndexType row, IndexType localIdx ) const;
+
+   IndexerType indexer;
+
+   ViewType view;
 };
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/TridiagonalMatrix.hpp>
diff --git a/src/TNL/Matrices/TridiagonalMatrix.hpp b/src/TNL/Matrices/TridiagonalMatrix.hpp
index 1a486700d7cc83cba7bd04b90bc1a2f81b86e650..1831021d507ff4f6c68401ccdeb933deddc6a8ba 100644
--- a/src/TNL/Matrices/TridiagonalMatrix.hpp
+++ b/src/TNL/Matrices/TridiagonalMatrix.hpp
@@ -14,89 +14,53 @@
 namespace TNL {
 namespace Matrices {
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-TridiagonalMatrix()
-{
-}
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::TridiagonalMatrix() = default;
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-TridiagonalMatrix( const IndexType rows, const IndexType columns )
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::TridiagonalMatrix( const IndexType rows,
+                                                                                          const IndexType columns )
 {
    this->setDimensions( rows, columns );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename ListReal >
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-TridiagonalMatrix( const IndexType columns,
-                   const std::initializer_list< std::initializer_list< ListReal > >& data )
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename ListReal >
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::TridiagonalMatrix(
+   const IndexType columns,
+   const std::initializer_list< std::initializer_list< ListReal > >& data )
 {
    this->setDimensions( data.size(), columns );
    this->setElements( data );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 auto
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-getView() const -> ViewType
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::getView() const -> ViewType
 {
    // TODO: fix when getConstView works
    return ViewType( const_cast< TridiagonalMatrix* >( this )->values.getView(), indexer );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-String
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-getSerializationType()
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+std::string
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::getSerializationType()
 {
-   return String( "Matrices::TridiagonalMatrix< " ) +
-          TNL::getSerializationType< RealType >() + ", [any_device], " +
-          TNL::getSerializationType< IndexType >() + ", " +
-          ( Organization ? "true" : "false" ) + ", [any_allocator] >";
+   return "Matrices::TridiagonalMatrix< " + TNL::getSerializationType< RealType >() + ", [any_device], "
+        + TNL::getSerializationType< IndexType >() + ", " + TNL::getSerializationType( Organization ) + ", [any_allocator] >";
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-String
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-getSerializationTypeVirtual() const
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+std::string
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::getSerializationTypeVirtual() const
 {
    return this->getSerializationType();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-setDimensions( const IndexType rows, const IndexType columns )
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::setDimensions( const IndexType rows,
+                                                                                      const IndexType columns )
 {
    Matrix< Real, Device, Index >::setDimensions( rows, columns );
    this->indexer.setDimensions( rows, columns );
@@ -105,15 +69,11 @@ setDimensions( const IndexType rows, const IndexType columns )
    this->view = this->getView();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename RowCapacitiesVector >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename RowCapacitiesVector >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-setRowCapacities( const RowCapacitiesVector& rowCapacities )
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::setRowCapacities(
+   const RowCapacitiesVector& rowCapacities )
 {
    if( max( rowCapacities ) > 3 )
       throw std::logic_error( "Too many non-zero elements per row in a tri-diagonal matrix." );
@@ -121,531 +81,384 @@ setRowCapacities( const RowCapacitiesVector& rowCapacities )
       throw std::logic_error( "Too many non-zero elements per row in a tri-diagonal matrix." );
    const IndexType diagonalLength = min( this->getRows(), this->getColumns() );
    if( this->getRows() > this->getColumns() )
-      if( rowCapacities.getElement( this->getRows()-1 ) > 1 )
+      if( rowCapacities.getElement( this->getRows() - 1 ) > 1 )
          throw std::logic_error( "Too many non-zero elements per row in a tri-diagonal matrix." );
    if( this->getRows() == this->getColumns() )
-      if( rowCapacities.getElement( this->getRows()-1 ) > 2 )
+      if( rowCapacities.getElement( this->getRows() - 1 ) > 2 )
          throw std::logic_error( "Too many non-zero elements per row in a tri-diagonal matrix." );
    if( this->getRows() < this->getColumns() )
-      if( rowCapacities.getElement( this->getRows()-1 ) > 3 )
+      if( rowCapacities.getElement( this->getRows() - 1 ) > 3 )
          throw std::logic_error( "Too many non-zero elements per row in a tri-diagonal matrix." );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Vector >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Vector >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-getRowCapacities( Vector& rowCapacities ) const
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::getRowCapacities( Vector& rowCapacities ) const
 {
    return this->view.getRowCapacities( rowCapacities );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename ListReal >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename ListReal >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-setElements( const std::initializer_list< std::initializer_list< ListReal > >& data )
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::setElements(
+   const std::initializer_list< std::initializer_list< ListReal > >& data )
 {
-   if( std::is_same< DeviceType, Devices::Host >::value )
-   {
+   if( std::is_same< DeviceType, Devices::Host >::value ) {
       this->getValues() = 0.0;
       auto row_it = data.begin();
-      for( size_t rowIdx = 0; rowIdx < data.size(); rowIdx++ )
-      {
+      for( size_t rowIdx = 0; rowIdx < data.size(); rowIdx++ ) {
          auto data_it = row_it->begin();
          IndexType i = 0;
          while( data_it != row_it->end() )
             this->getRow( rowIdx ).setElement( i++, *data_it++ );
-         row_it ++;
+         row_it++;
       }
    }
-   else
-   {
-      TridiagonalMatrix< Real, Devices::Host, Index, Organization > hostMatrix(
-         this->getRows(),
-         this->getColumns() );
+   else {
+      TridiagonalMatrix< Real, Devices::Host, Index, Organization > hostMatrix( this->getRows(), this->getColumns() );
       hostMatrix.setElements( data );
       *this = hostMatrix;
    }
 }
 
-
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Vector >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Vector >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-getCompressedRowLengths( Vector& rowLengths ) const
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::getCompressedRowLengths( Vector& rowLengths ) const
 {
    return this->view.getCompressedRowLengths( rowLengths );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_ >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_ >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-setLike( const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& m )
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::setLike(
+   const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& m )
 {
    this->setDimensions( m.getRows(), m.getColumns() );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 Index
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-getNonzeroElementsCount() const
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::getNonzeroElementsCount() const
 {
    return this->view.getNonzeroElementsCount();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-reset()
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::reset()
 {
    Matrix< Real, Device, Index >::reset();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_ >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_ >
 bool
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-operator == ( const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& matrix ) const
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::operator==(
+   const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& matrix ) const
 {
    if( Organization == Organization_ )
       return this->values == matrix.values;
-   else
-   {
+   else {
       TNL_ASSERT_TRUE( false, "TODO" );
    }
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_ >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_ >
 bool
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-operator != ( const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& matrix ) const
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::operator!=(
+   const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& matrix ) const
 {
    return ! this->operator==( matrix );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-setValue( const RealType& v )
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::setValue( const RealType& v )
 {
    this->view.setValue( v );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 __cuda_callable__
 auto
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-getRow( const IndexType& rowIdx ) const -> const ConstRowView
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::getRow( const IndexType& rowIdx ) const
+   -> const ConstRowView
 {
    return this->view.getRow( rowIdx );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 __cuda_callable__
 auto
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-getRow( const IndexType& rowIdx ) -> RowView
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::getRow( const IndexType& rowIdx ) -> RowView
 {
    return this->view.getRow( rowIdx );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-setElement( const IndexType row, const IndexType column, const RealType& value )
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::setElement( const IndexType row,
+                                                                                   const IndexType column,
+                                                                                   const RealType& value )
 {
    this->view.setElement( row, column, value );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-addElement( const IndexType row,
-            const IndexType column,
-            const RealType& value,
-            const RealType& thisElementMultiplicator )
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::addElement( const IndexType row,
+                                                                                   const IndexType column,
+                                                                                   const RealType& value,
+                                                                                   const RealType& thisElementMultiplicator )
 {
    this->view.addElement( row, column, value, thisElementMultiplicator );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 Real
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-getElement( const IndexType row, const IndexType column ) const
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::getElement( const IndexType row,
+                                                                                   const IndexType column ) const
 {
    return this->view.getElement( row, column );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-reduceRows( IndexType first, IndexType last, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity ) const
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::reduceRows( IndexType first,
+                                                                                   IndexType last,
+                                                                                   Fetch& fetch,
+                                                                                   Reduce& reduce,
+                                                                                   Keep& keep,
+                                                                                   const FetchReal& identity ) const
 {
    this->view.reduceRows( first, last, fetch, reduce, keep, identity );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-reduceRows( IndexType first, IndexType last, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity )
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::reduceRows( IndexType first,
+                                                                                   IndexType last,
+                                                                                   Fetch& fetch,
+                                                                                   Reduce& reduce,
+                                                                                   Keep& keep,
+                                                                                   const FetchReal& identity )
 {
    this->view.reduceRows( first, last, fetch, reduce, keep, identity );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity ) const
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::reduceAllRows( Fetch& fetch,
+                                                                                      Reduce& reduce,
+                                                                                      Keep& keep,
+                                                                                      const FetchReal& identity ) const
 {
    this->view.reduceRows( (IndexType) 0, this->getRows(), fetch, reduce, keep, identity );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity )
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::reduceAllRows( Fetch& fetch,
+                                                                                      Reduce& reduce,
+                                                                                      Keep& keep,
+                                                                                      const FetchReal& identity )
 {
    this->view.reduceRows( (IndexType) 0, this->getRows(), fetch, reduce, keep, identity );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-forElements( IndexType first, IndexType last, Function& function ) const
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::forElements( IndexType first,
+                                                                                    IndexType last,
+                                                                                    Function& function ) const
 {
    this->view.forElements( first, last, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-  template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-forElements( IndexType first, IndexType last, Function& function )
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::forElements( IndexType first,
+                                                                                    IndexType last,
+                                                                                    Function& function )
 {
    this->view.forElements( first, last, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-forAllElements( Function& function ) const
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::forAllElements( Function& function ) const
 {
    this->view.forElements( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-forAllElements( Function& function )
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::forAllElements( Function& function )
 {
    this->view.forElements( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-forRows( IndexType begin, IndexType end, Function&& function )
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::forRows( IndexType begin,
+                                                                                IndexType end,
+                                                                                Function&& function )
 {
    this->getView().forRows( begin, end, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-forRows( IndexType begin, IndexType end, Function&& function ) const
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::forRows( IndexType begin,
+                                                                                IndexType end,
+                                                                                Function&& function ) const
 {
    this->getConstView().forRows( begin, end, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-forAllRows( Function&& function )
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::forAllRows( Function&& function )
 {
    this->getView().forAllRows( function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-forAllRows( Function&& function ) const
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::forAllRows( Function&& function ) const
 {
    this->getConsView().forAllRows( function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-sequentialForRows( IndexType begin, IndexType end, Function& function ) const
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::sequentialForRows( IndexType begin,
+                                                                                          IndexType end,
+                                                                                          Function& function ) const
 {
    this->view.sequentialForRows( begin, end, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-sequentialForRows( IndexType first, IndexType last, Function& function )
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::sequentialForRows( IndexType first,
+                                                                                          IndexType last,
+                                                                                          Function& function )
 {
    this->view.sequentialForRows( first, last, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-sequentialForAllRows( Function& function ) const
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::sequentialForAllRows( Function& function ) const
 {
    this->sequentialForRows( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Function >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-sequentialForAllRows( Function& function )
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::sequentialForAllRows( Function& function )
 {
    this->sequentialForRows( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename InVector, typename OutVector >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename InVector, typename OutVector >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-vectorProduct( const InVector& inVector,
-               OutVector& outVector,
-               const RealType matrixMultiplicator,
-               const RealType outVectorMultiplicator,
-               const IndexType begin,
-               IndexType end ) const
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::vectorProduct( const InVector& inVector,
+                                                                                      OutVector& outVector,
+                                                                                      RealType matrixMultiplicator,
+                                                                                      RealType outVectorMultiplicator,
+                                                                                      IndexType begin,
+                                                                                      IndexType end ) const
 {
    this->view.vectorProduct( inVector, outVector, matrixMultiplicator, outVectorMultiplicator, begin, end );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_ >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_ >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-addMatrix( const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& matrix,
-           const RealType& matrixMultiplicator,
-           const RealType& thisMatrixMultiplicator )
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::addMatrix(
+   const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& matrix,
+   const RealType& matrixMultiplicator,
+   const RealType& thisMatrixMultiplicator )
 {
    this->view.addMatrix( matrix.getView(), matrixMultiplicator, thisMatrixMultiplicator );
 }
 
 #ifdef HAVE_CUDA
-template< typename Real,
-          typename Real2,
-          typename Index,
-          typename Index2 >
-__global__ void TridiagonalMatrixTranspositionCudaKernel( const TridiagonalMatrix< Real2, Devices::Cuda, Index2 >* inMatrix,
-                                                             TridiagonalMatrix< Real, Devices::Cuda, Index >* outMatrix,
-                                                             const Real matrixMultiplicator,
-                                                             const Index gridIdx )
+template< typename Real, typename Real2, typename Index, typename Index2 >
+__global__
+void
+TridiagonalMatrixTranspositionCudaKernel( const TridiagonalMatrix< Real2, Devices::Cuda, Index2 >* inMatrix,
+                                          TridiagonalMatrix< Real, Devices::Cuda, Index >* outMatrix,
+                                          const Real matrixMultiplicator,
+                                          const Index gridIdx )
 {
    const Index rowIdx = ( gridIdx * Cuda::getMaxGridSize() + blockIdx.x ) * blockDim.x + threadIdx.x;
-   if( rowIdx < inMatrix->getRows() )
-   {
+   if( rowIdx < inMatrix->getRows() ) {
       if( rowIdx > 0 )
-        outMatrix->setElementFast( rowIdx-1,
-                                   rowIdx,
-                                   matrixMultiplicator * inMatrix->getElementFast( rowIdx, rowIdx-1 ) );
-      outMatrix->setElementFast( rowIdx,
-                                 rowIdx,
-                                 matrixMultiplicator * inMatrix->getElementFast( rowIdx, rowIdx ) );
-      if( rowIdx < inMatrix->getRows()-1 )
-         outMatrix->setElementFast( rowIdx+1,
-                                    rowIdx,
-                                    matrixMultiplicator * inMatrix->getElementFast( rowIdx, rowIdx+1 ) );
+         outMatrix->setElementFast( rowIdx - 1, rowIdx, matrixMultiplicator * inMatrix->getElementFast( rowIdx, rowIdx - 1 ) );
+      outMatrix->setElementFast( rowIdx, rowIdx, matrixMultiplicator * inMatrix->getElementFast( rowIdx, rowIdx ) );
+      if( rowIdx < inMatrix->getRows() - 1 )
+         outMatrix->setElementFast( rowIdx + 1, rowIdx, matrixMultiplicator * inMatrix->getElementFast( rowIdx, rowIdx + 1 ) );
    }
 }
 #endif
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Real2, typename Index2 >
-void TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::getTransposition( const TridiagonalMatrix< Real2, Device, Index2 >& matrix,
-                                                                    const RealType& matrixMultiplicator )
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Real2, typename Index2 >
+void
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::getTransposition(
+   const TridiagonalMatrix< Real2, Device, Index2 >& matrix,
+   const RealType& matrixMultiplicator )
 {
    TNL_ASSERT( this->getRows() == matrix.getRows(),
                std::cerr << "This matrix rows: " << this->getRows() << std::endl
-                    << "That matrix rows: " << matrix.getRows() << std::endl );
-   if( std::is_same< Device, Devices::Host >::value )
-   {
+                         << "That matrix rows: " << matrix.getRows() << std::endl );
+   if( std::is_same< Device, Devices::Host >::value ) {
       const IndexType& rows = matrix.getRows();
-      for( IndexType i = 1; i < rows; i++ )
-      {
-         RealType aux = matrix. getElement( i, i - 1 );
+      for( IndexType i = 1; i < rows; i++ ) {
+         RealType aux = matrix.getElement( i, i - 1 );
          this->setElement( i, i - 1, matrix.getElement( i - 1, i ) );
          this->setElement( i, i, matrix.getElement( i, i ) );
          this->setElement( i - 1, i, aux );
       }
    }
-   if( std::is_same< Device, Devices::Cuda >::value )
-   {
+   if( std::is_same< Device, Devices::Cuda >::value ) {
 #ifdef HAVE_CUDA
       TridiagonalMatrix* kernel_this = Cuda::passToDevice( *this );
-      typedef  TridiagonalMatrix< Real2, Device, Index2 > InMatrixType;
+      typedef TridiagonalMatrix< Real2, Device, Index2 > InMatrixType;
       InMatrixType* kernel_inMatrix = Cuda::passToDevice( matrix );
       dim3 cudaBlockSize( 256 ), cudaGridSize( Cuda::getMaxGridSize() );
       const IndexType cudaBlocks = roundUpDivision( matrix.getRows(), cudaBlockSize.x );
       const IndexType cudaGrids = roundUpDivision( cudaBlocks, Cuda::getMaxGridSize() );
-      for( IndexType gridIdx = 0; gridIdx < cudaGrids; gridIdx++ )
-      {
+      for( IndexType gridIdx = 0; gridIdx < cudaGrids; gridIdx++ ) {
          if( gridIdx == cudaGrids - 1 )
             cudaGridSize.x = cudaBlocks % Cuda::getMaxGridSize();
-         TridiagonalMatrixTranspositionCudaKernel<<< cudaGridSize, cudaBlockSize >>>
-                                                    ( kernel_inMatrix,
-                                                      kernel_this,
-                                                      matrixMultiplicator,
-                                                      gridIdx );
+         TridiagonalMatrixTranspositionCudaKernel<<< cudaGridSize,
+            cudaBlockSize >>>( kernel_inMatrix, kernel_this, matrixMultiplicator, gridIdx );
       }
       Cuda::freeFromDevice( kernel_this );
       Cuda::freeFromDevice( kernel_inMatrix );
@@ -655,11 +468,7 @@ void TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::getT
 }
 
 // copy assignment
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >&
 TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::operator=( const TridiagonalMatrix& matrix )
 {
@@ -669,15 +478,11 @@ TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::operator=
 }
 
 // cross-device copy assignment
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_ >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_, typename RealAllocator_ >
 TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >&
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-operator=( const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& matrix )
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::operator=(
+   const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealAllocator_ >& matrix )
 {
    static_assert( std::is_same< Device, Devices::Host >::value || std::is_same< Device, Devices::Cuda >::value,
                   "unknown device" );
@@ -687,22 +492,23 @@ operator=( const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealA
    this->setLike( matrix );
    if( Organization == Organization_ )
       this->values = matrix.getValues();
-   else
-   {
-      if( std::is_same< Device, Device_ >::value )
-      {
+   else {
+      if( std::is_same< Device, Device_ >::value ) {
          const auto matrix_view = matrix.getView();
-         auto f = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value ) mutable {
+         auto f = [ = ] __cuda_callable__(
+                     const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value ) mutable
+         {
             value = matrix_view.getValues()[ matrix_view.getIndexer().getGlobalIndex( rowIdx, localIdx ) ];
          };
          this->forAllElements( f );
       }
-      else
-      {
+      else {
          TridiagonalMatrix< Real, Device, Index, Organization_ > auxMatrix;
          auxMatrix = matrix;
          const auto matrix_view = auxMatrix.getView();
-         auto f = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value ) mutable {
+         auto f = [ = ] __cuda_callable__(
+                     const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value ) mutable
+         {
             value = matrix_view.getValues()[ matrix_view.getIndexer().getGlobalIndex( rowIdx, localIdx ) ];
          };
          this->forAllElements( f );
@@ -711,93 +517,62 @@ operator=( const TridiagonalMatrix< Real_, Device_, Index_, Organization_, RealA
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-void TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::save( File& file ) const
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+void
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::save( File& file ) const
 {
    Matrix< Real, Device, Index >::save( file );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-void TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::load( File& file )
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+void
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::load( File& file )
 {
    Matrix< Real, Device, Index >::load( file );
    this->indexer.setDimensions( this->getRows(), this->getColumns() );
    this->view = this->getView();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-void TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::save( const String& fileName ) const
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+void
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::save( const String& fileName ) const
 {
    Object::save( fileName );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
-void TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::load( const String& fileName )
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
+void
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::load( const String& fileName )
 {
    Object::load( fileName );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 void
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-print( std::ostream& str ) const
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::print( std::ostream& str ) const
 {
    this->view.print( str );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 auto
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-getIndexer() const -> const IndexerType&
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::getIndexer() const -> const IndexerType&
 {
    return this->indexer;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 auto
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-getIndexer() -> IndexerType&
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::getIndexer() -> IndexerType&
 {
    return this->indexer;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 __cuda_callable__
 Index
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-getElementIndex( const IndexType row, const IndexType column ) const
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::getElementIndex( const IndexType row,
+                                                                                        const IndexType column ) const
 {
    IndexType localIdx = column - row + 1;
 
@@ -807,18 +582,13 @@ getElementIndex( const IndexType row, const IndexType column ) const
    return this->indexer.getGlobalIndex( row, localIdx );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization,
-          typename RealAllocator >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization, typename RealAllocator >
 __cuda_callable__
 Index
-TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::
-getPaddingIndex() const
+TridiagonalMatrix< Real, Device, Index, Organization, RealAllocator >::getPaddingIndex() const
 {
    return this->view.getPaddingIndex();
 }
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/TridiagonalMatrixRowView.h b/src/TNL/Matrices/TridiagonalMatrixRowView.h
index 29e438acfe0bcd0314c977e7efd62119ed32af41..b6b7775b92e895d9ab9b3038514137f7bd877e2f 100644
--- a/src/TNL/Matrices/TridiagonalMatrixRowView.h
+++ b/src/TNL/Matrices/TridiagonalMatrixRowView.h
@@ -31,173 +31,177 @@ namespace Matrices {
  * \par Output
  * \include TridiagonalMatrixViewExample_getRow.out
  */
-template< typename ValuesView,
-          typename Indexer >
+template< typename ValuesView, typename Indexer >
 class TridiagonalMatrixRowView
 {
-   public:
-
-      /**
-       * \brief The type of matrix elements.
-       */
-      using RealType = typename ValuesView::RealType;
-
-      /**
-       * \brief The type used for matrix elements indexing.
-       */
-      using IndexType = typename ValuesView::IndexType;
-
-      /**
-       * \brief Type of container view used for storing the matrix elements values.
-       */
-      using ValuesViewType = ValuesView;
-
-      /**
-       * \brief Type of object responsible for indexing and organization of
-       * matrix elements.
-       */
-      using IndexerType = Indexer;
-
-      /**
-       * \brief Type of constant container view used for storing the matrix elements values.
-       */
-      using ConstValuesViewType = typename ValuesViewType::ConstViewType;
-
-      /**
-       * \brief Type of constant indexer view.
-       */
-      using ConstIndexerViewType = typename Indexer::ConstType;
-
-      /**
-       * \brief Type of constant sparse matrix row view.
-       */
-      using RowView = TridiagonalMatrixRowView< ValuesViewType, IndexerType >;
-
-      /**
-       * \brief Type of constant sparse matrix row view.
-       */
-      using ConstRowView = TridiagonalMatrixRowView< ConstValuesViewType, ConstIndexerViewType >;
-
-      /**
-       * \brief The type of related matrix element.
-       */
-      using MatrixElementType = MultidiagonalMatrixElement< RealType, IndexType >;
-
-      /**
-       * \brief Type of iterator for the matrix row.
-       */
-      using IteratorType = MatrixRowViewIterator< RowView >;
-
-      /**
-       * \brief Constructor with all necessary data.
-       *
-       * \param rowIdx is index of the matrix row this RowView refer to.
-       * \param values is a vector view holding values of matrix elements.
-       * \param indexer is object responsible for indexing and organization of matrix elements
-       */
-      __cuda_callable__
-      TridiagonalMatrixRowView( const IndexType rowIdx,
-                                const ValuesViewType& values,
-                                const IndexerType& indexer );
-
-      /**
-       * \brief Returns number of diagonals of the tridiagonal matrix which is three.
-       *
-       * \return number three.
-       */
-      __cuda_callable__
-      IndexType getSize() const;
-
-      /**
-       * \brief Returns the matrix row index.
-       *
-       * \return matrix row index.
-       */
-      __cuda_callable__
-      const IndexType& getRowIndex() const;
-
-      /**
-       * \brief Computes column index of matrix element on given subdiagonal.
-       *
-       * \param localIdx is an index of the subdiagonal.
-       *
-       * \return column index of matrix element on given subdiagonal.
-       */
-      __cuda_callable__
-      const IndexType getColumnIndex( const IndexType localIdx ) const;
-
-      /**
-       * \brief Returns value of matrix element on given subdiagonal.
-       *
-       * \param localIdx is an index of the subdiagonal.
-       *
-       * \return constant reference to matrix element value.
-       */
-      __cuda_callable__
-      const RealType& getValue( const IndexType localIdx ) const;
-
-      /**
-       * \brief Returns value of matrix element on given subdiagonal.
-       *
-       * \param localIdx is an index of the subdiagonal.
-       *
-       * \return non-constant reference to matrix element value.
-       */
-      __cuda_callable__
-      RealType& getValue( const IndexType localIdx );
-
-      /**
-       * \brief Changes value of matrix element on given subdiagonal.
-       *
-       * \param localIdx is an index of the matrix subdiagonal.
-       * \param value is the new value of the matrix element.
-       */
-      __cuda_callable__
-      void setElement( const IndexType localIdx,
-                       const RealType& value );
-
-      /**
-       * \brief Returns iterator pointing at the beginning of the matrix row.
-       *
-       * \return iterator pointing at the beginning.
-       */
-      __cuda_callable__
-      IteratorType begin();
-
-      /**
-       * \brief Returns iterator pointing at the end of the matrix row.
-       *
-       * \return iterator pointing at the end.
-       */
-      __cuda_callable__
-      IteratorType end();
-
-      /**
-       * \brief Returns constant iterator pointing at the beginning of the matrix row.
-       *
-       * \return iterator pointing at the beginning.
-       */
-      __cuda_callable__
-      const IteratorType cbegin() const;
-
-      /**
-       * \brief Returns constant iterator pointing at the end of the matrix row.
-       *
-       * \return iterator pointing at the end.
-       */
-      __cuda_callable__
-      const IteratorType cend() const;
-
-   protected:
-
-      IndexType rowIdx;
-
-      ValuesViewType values;
-
-      Indexer indexer;
+public:
+   /**
+    * \brief The type of matrix elements.
+    */
+   using RealType = typename ValuesView::RealType;
+
+   /**
+    * \brief The type used for matrix elements indexing.
+    */
+   using IndexType = typename ValuesView::IndexType;
+
+   /**
+    * \brief Type of container view used for storing the matrix elements values.
+    */
+   using ValuesViewType = ValuesView;
+
+   /**
+    * \brief Type of object responsible for indexing and organization of
+    * matrix elements.
+    */
+   using IndexerType = Indexer;
+
+   /**
+    * \brief Type of constant container view used for storing the matrix elements values.
+    */
+   using ConstValuesViewType = typename ValuesViewType::ConstViewType;
+
+   /**
+    * \brief Type of constant indexer view.
+    */
+   using ConstIndexerViewType = typename Indexer::ConstType;
+
+   /**
+    * \brief Type of constant sparse matrix row view.
+    */
+   using RowView = TridiagonalMatrixRowView< ValuesViewType, IndexerType >;
+
+   /**
+    * \brief Type of constant sparse matrix row view.
+    */
+   using ConstRowView = TridiagonalMatrixRowView< ConstValuesViewType, ConstIndexerViewType >;
+
+   /**
+    * \brief The type of related matrix element.
+    */
+   using MatrixElementType = MultidiagonalMatrixElement< RealType, IndexType >;
+
+   /**
+    * \brief Type of iterator for the matrix row.
+    */
+   using IteratorType = MatrixRowViewIterator< RowView >;
+
+   /**
+    * \brief Constructor with all necessary data.
+    *
+    * \param rowIdx is index of the matrix row this RowView refer to.
+    * \param values is a vector view holding values of matrix elements.
+    * \param indexer is object responsible for indexing and organization of matrix elements
+    */
+   __cuda_callable__
+   TridiagonalMatrixRowView( IndexType rowIdx, const ValuesViewType& values, const IndexerType& indexer );
+
+   /**
+    * \brief Returns number of diagonals of the tridiagonal matrix which is three.
+    *
+    * \return number three.
+    */
+   __cuda_callable__
+   IndexType
+   getSize() const;
+
+   /**
+    * \brief Returns the matrix row index.
+    *
+    * \return matrix row index.
+    */
+   __cuda_callable__
+   const IndexType&
+   getRowIndex() const;
+
+   /**
+    * \brief Computes column index of matrix element on given subdiagonal.
+    *
+    * \param localIdx is an index of the subdiagonal.
+    *
+    * \return column index of matrix element on given subdiagonal.
+    */
+   __cuda_callable__
+   const IndexType
+   getColumnIndex( IndexType localIdx ) const;
+
+   /**
+    * \brief Returns value of matrix element on given subdiagonal.
+    *
+    * \param localIdx is an index of the subdiagonal.
+    *
+    * \return constant reference to matrix element value.
+    */
+   __cuda_callable__
+   const RealType&
+   getValue( IndexType localIdx ) const;
+
+   /**
+    * \brief Returns value of matrix element on given subdiagonal.
+    *
+    * \param localIdx is an index of the subdiagonal.
+    *
+    * \return non-constant reference to matrix element value.
+    */
+   __cuda_callable__
+   RealType&
+   getValue( IndexType localIdx );
+
+   /**
+    * \brief Changes value of matrix element on given subdiagonal.
+    *
+    * \param localIdx is an index of the matrix subdiagonal.
+    * \param value is the new value of the matrix element.
+    */
+   __cuda_callable__
+   void
+   setElement( IndexType localIdx, const RealType& value );
+
+   /**
+    * \brief Returns iterator pointing at the beginning of the matrix row.
+    *
+    * \return iterator pointing at the beginning.
+    */
+   __cuda_callable__
+   IteratorType
+   begin();
+
+   /**
+    * \brief Returns iterator pointing at the end of the matrix row.
+    *
+    * \return iterator pointing at the end.
+    */
+   __cuda_callable__
+   IteratorType
+   end();
+
+   /**
+    * \brief Returns constant iterator pointing at the beginning of the matrix row.
+    *
+    * \return iterator pointing at the beginning.
+    */
+   __cuda_callable__
+   const IteratorType
+   cbegin() const;
+
+   /**
+    * \brief Returns constant iterator pointing at the end of the matrix row.
+    *
+    * \return iterator pointing at the end.
+    */
+   __cuda_callable__
+   const IteratorType
+   cend() const;
+
+protected:
+   IndexType rowIdx;
+
+   ValuesViewType values;
+
+   Indexer indexer;
 };
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/TridiagonalMatrixRowView.hpp>
diff --git a/src/TNL/Matrices/TridiagonalMatrixRowView.hpp b/src/TNL/Matrices/TridiagonalMatrixRowView.hpp
index c6080711efa4c79bde7147d238217e22b9d49a8b..4251c096bb9ac80dc936b499fc8d314699c11fd6 100644
--- a/src/TNL/Matrices/TridiagonalMatrixRowView.hpp
+++ b/src/TNL/Matrices/TridiagonalMatrixRowView.hpp
@@ -11,19 +11,16 @@ namespace Matrices {
 
 template< typename ValuesView, typename Indexer >
 __cuda_callable__
-TridiagonalMatrixRowView< ValuesView, Indexer >::
-TridiagonalMatrixRowView( const IndexType rowIdx,
-                          const ValuesViewType& values,
-                          const IndexerType& indexer )
+TridiagonalMatrixRowView< ValuesView, Indexer >::TridiagonalMatrixRowView( const IndexType rowIdx,
+                                                                           const ValuesViewType& values,
+                                                                           const IndexerType& indexer )
 : rowIdx( rowIdx ), values( values ), indexer( indexer )
-{
-}
+{}
 
 template< typename ValuesView, typename Indexer >
 __cuda_callable__
 auto
-TridiagonalMatrixRowView< ValuesView, Indexer >::
-getSize() const -> IndexType
+TridiagonalMatrixRowView< ValuesView, Indexer >::getSize() const -> IndexType
 {
    return indexer.getRowSize( rowIdx );
 }
@@ -31,8 +28,7 @@ getSize() const -> IndexType
 template< typename ValuesView, typename Indexer >
 __cuda_callable__
 auto
-TridiagonalMatrixRowView< ValuesView, Indexer >::
-getRowIndex() const -> const IndexType&
+TridiagonalMatrixRowView< ValuesView, Indexer >::getRowIndex() const -> const IndexType&
 {
    return rowIdx;
 }
@@ -40,8 +36,7 @@ getRowIndex() const -> const IndexType&
 template< typename ValuesView, typename Indexer >
 __cuda_callable__
 auto
-TridiagonalMatrixRowView< ValuesView, Indexer >::
-getColumnIndex( const IndexType localIdx ) const -> const IndexType
+TridiagonalMatrixRowView< ValuesView, Indexer >::getColumnIndex( const IndexType localIdx ) const -> const IndexType
 {
    TNL_ASSERT_GE( localIdx, 0, "" );
    TNL_ASSERT_LT( localIdx, 3, "" );
@@ -51,8 +46,7 @@ getColumnIndex( const IndexType localIdx ) const -> const IndexType
 template< typename ValuesView, typename Indexer >
 __cuda_callable__
 auto
-TridiagonalMatrixRowView< ValuesView, Indexer >::
-getValue( const IndexType localIdx ) const -> const RealType&
+TridiagonalMatrixRowView< ValuesView, Indexer >::getValue( const IndexType localIdx ) const -> const RealType&
 {
    return this->values[ this->indexer.getGlobalIndex( rowIdx, localIdx ) ];
 }
@@ -60,8 +54,7 @@ getValue( const IndexType localIdx ) const -> const RealType&
 template< typename ValuesView, typename Indexer >
 __cuda_callable__
 auto
-TridiagonalMatrixRowView< ValuesView, Indexer >::
-getValue( const IndexType localIdx ) -> RealType&
+TridiagonalMatrixRowView< ValuesView, Indexer >::getValue( const IndexType localIdx ) -> RealType&
 {
    return this->values[ this->indexer.getGlobalIndex( rowIdx, localIdx ) ];
 }
@@ -69,9 +62,7 @@ getValue( const IndexType localIdx ) -> RealType&
 template< typename ValuesView, typename Indexer >
 __cuda_callable__
 void
-TridiagonalMatrixRowView< ValuesView, Indexer >::
-setElement( const IndexType localIdx,
-            const RealType& value )
+TridiagonalMatrixRowView< ValuesView, Indexer >::setElement( const IndexType localIdx, const RealType& value )
 {
    this->values[ indexer.getGlobalIndex( rowIdx, localIdx ) ] = value;
 }
@@ -79,8 +70,7 @@ setElement( const IndexType localIdx,
 template< typename ValuesView, typename Indexer >
 __cuda_callable__
 auto
-TridiagonalMatrixRowView< ValuesView, Indexer >::
-begin() -> IteratorType
+TridiagonalMatrixRowView< ValuesView, Indexer >::begin() -> IteratorType
 {
    return IteratorType( *this, 0 );
 }
@@ -88,8 +78,7 @@ begin() -> IteratorType
 template< typename ValuesView, typename Indexer >
 __cuda_callable__
 auto
-TridiagonalMatrixRowView< ValuesView, Indexer >::
-end() -> IteratorType
+TridiagonalMatrixRowView< ValuesView, Indexer >::end() -> IteratorType
 {
    return IteratorType( *this, this->getSize() );
 }
@@ -97,8 +86,7 @@ end() -> IteratorType
 template< typename ValuesView, typename Indexer >
 __cuda_callable__
 auto
-TridiagonalMatrixRowView< ValuesView, Indexer >::
-cbegin() const -> const IteratorType
+TridiagonalMatrixRowView< ValuesView, Indexer >::cbegin() const -> const IteratorType
 {
    return IteratorType( *this, 0 );
 }
@@ -106,11 +94,10 @@ cbegin() const -> const IteratorType
 template< typename ValuesView, typename Indexer >
 __cuda_callable__
 auto
-TridiagonalMatrixRowView< ValuesView, Indexer >::
-cend() const -> const IteratorType
+TridiagonalMatrixRowView< ValuesView, Indexer >::cend() const -> const IteratorType
 {
    return IteratorType( *this, this->getSize() );
 }
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/TridiagonalMatrixView.h b/src/TNL/Matrices/TridiagonalMatrixView.h
index 0bc1fbb33052f71886cd3b2133792360e694c439..92356ec73d34e9e250f0c6eaf95191092cdf239b 100644
--- a/src/TNL/Matrices/TridiagonalMatrixView.h
+++ b/src/TNL/Matrices/TridiagonalMatrixView.h
@@ -35,811 +35,842 @@ template< typename Real = double,
           ElementsOrganization Organization = Algorithms::Segments::DefaultElementsOrganization< Device >::getOrganization() >
 class TridiagonalMatrixView : public MatrixView< Real, Device, Index >
 {
-   public:
-
-
-      // Supporting types - they are not important for the user
-      using BaseType = MatrixView< Real, Device, Index >;
-      using ValuesViewType = typename BaseType::ValuesView;
-      using IndexerType = details::TridiagonalMatrixIndexer< Index, Organization >;
-
-      /**
-       * \brief The type of matrix elements.
-       */
-      using RealType = Real;
-
-      /**
-       * \brief The device where the matrix is allocated.
-       */
-      using DeviceType = Device;
-
-      /**
-       * \brief The type used for matrix elements indexing.
-       */
-      using IndexType = Index;
-
-      /**
-       */
-      using ViewType = TridiagonalMatrixView< Real, Device, Index, Organization >;
-
-      /**
-       * \brief Matrix view type for constant instances.
-       */
-      using ConstViewType = TridiagonalMatrixView< typename std::add_const< Real >::type, Device, Index, Organization >;
-
-      /**
-       * \brief Type for accessing matrix rows.
-       */
-      using RowView = TridiagonalMatrixRowView< ValuesViewType, IndexerType >;
-
-      /**
-       * \brief Type for accessing constant matrix rows.
-       */
-      using ConstRowView = typename RowView::ConstRowView;
-
-      /**
-       * \brief Helper type for getting self type or its modifications.
-       */
-      template< typename _Real = Real,
-                typename _Device = Device,
-                typename _Index = Index,
-                ElementsOrganization Organization_ = Algorithms::Segments::DefaultElementsOrganization< Device >::getOrganization() >
-      using Self = TridiagonalMatrixView< _Real, _Device, _Index, Organization_ >;
-
-      /**
-       * \brief Constructor with no parameters.
-       */
-      __cuda_callable__
-      TridiagonalMatrixView();
-
-      /**
-       * \brief Constructor with all necessary data and views.
-       *
-       * \param values is a vector view with matrix elements values
-       * \param indexer is an indexer of matrix elements
-       */
-      __cuda_callable__
-      TridiagonalMatrixView( const ValuesViewType& values, const IndexerType& indexer );
-
-      /**
-       * \brief Copy constructor.
-       *
-       * \param matrix is an input tridiagonal matrix view.
-       */
-      __cuda_callable__
-      TridiagonalMatrixView( const TridiagonalMatrixView& view ) = default;
-
-      /**
-       * \brief Move constructor.
-       *
-       * \param matrix is an input tridiagonal matrix view.
-       */
-      __cuda_callable__
-      TridiagonalMatrixView( TridiagonalMatrixView&& view ) = default;
-
-      /**
-       * \brief Returns a modifiable view of the tridiagonal matrix.
-       *
-       * \return tridiagonal matrix view.
-       */
-      ViewType getView();
-
-      /**
-       * \brief Returns a non-modifiable view of the tridiagonal matrix.
-       *
-       * \return tridiagonal matrix view.
-       */
-      ConstViewType getConstView() const;
-
-      /**
-       * \brief Returns string with serialization type.
-       *
-       * The string has a form `Matrices::TridiagonalMatrix< RealType,  [any_device], IndexType, Organization, [any_allocator] >`.
-       *
-       * See \ref TridiagonalMatrix::getSerializationType.
-       *
-       * \return \ref String with the serialization type.
-       */
-      static String getSerializationType();
-
-      /**
-       * \brief Returns string with serialization type.
-       *
-       * See \ref TridiagonalMatrix::getSerializationType.
-       *
-       * \return \ref String with the serialization type.
-       */
-      virtual String getSerializationTypeVirtual() const;
-
-      /**
-       * \brief Compute capacities of all rows.
-       *
-       * The row capacities are not stored explicitly and must be computed.
-       *
-       * \param rowCapacities is a vector where the row capacities will be stored.
-       */
-      template< typename Vector >
-      void getRowCapacities( Vector& rowCapacities ) const;
-
-      /**
-       * \brief Computes number of non-zeros in each row.
-       *
-       * \param rowLengths is a vector into which the number of non-zeros in each row
-       * will be stored.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_getCompressedRowLengths.cpp
-       * \par Output
-       * \include TridiagonalMatrixViewExample_getCompressedRowLengths.out
-       */
-      template< typename Vector >
-      void getCompressedRowLengths( Vector& rowLengths ) const;
-
-      /**
-       * \brief Returns number of non-zero matrix elements.
-       *
-       * This method really counts the non-zero matrix elements and so
-       * it returns zero for matrix having all allocated elements set to zero.
-       *
-       * \return number of non-zero matrix elements.
-       */
-      IndexType getNonzeroElementsCount() const;
-
-      /**
-       * \brief Comparison operator with another tridiagonal matrix.
-       *
-       * \tparam Real_ is \e Real type of the source matrix.
-       * \tparam Device_ is \e Device type of the source matrix.
-       * \tparam Index_ is \e Index type of the source matrix.
-       * \tparam Organization_ is \e Organization of the source matrix.
-       *
-       * \return \e true if both matrices are identical and \e false otherwise.
-       */
-      template< typename Real_,
-                typename Device_,
-                typename Index_,
-                ElementsOrganization Organization_ >
-      bool operator == ( const TridiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix ) const;
-
-      /**
-       * \brief Comparison operator with another multidiagonal matrix.
-       *
-       * \tparam Real_ is \e Real type of the source matrix.
-       * \tparam Device_ is \e Device type of the source matrix.
-       * \tparam Index_ is \e Index type of the source matrix.
-       * \tparam Organization_ is \e Organization of the source matrix.
-       *
-       * \param matrix is the source matrix.
-       *
-       * \return \e true if both matrices are NOT identical and \e false otherwise.
-       */
-      template< typename Real_,
-                typename Device_,
-                typename Index_,
-                ElementsOrganization Organization_ >
-      bool operator != ( const TridiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix ) const;
-
-      /**
-       * \brief Non-constant getter of simple structure for accessing given matrix row.
-       *
-       * \param rowIdx is matrix row index.
-       *
-       * \return RowView for accessing given matrix row.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_getRow.cpp
-       * \par Output
-       * \include TridiagonalMatrixViewExample_getRow.out
-       *
-       * See \ref TridiagonalMatrixRowView.
-       */
-      __cuda_callable__
-      RowView getRow( const IndexType& rowIdx );
-
-      /**
-       * \brief Constant getter of simple structure for accessing given matrix row.
-       *
-       * \param rowIdx is matrix row index.
-       *
-       * \return RowView for accessing given matrix row.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_getConstRow.cpp
-       * \par Output
-       * \include TridiagonalMatrixViewExample_getConstRow.out
-       *
-       * See \ref TridiagonalMatrixRowView.
-       */
-      __cuda_callable__
-      const ConstRowView getRow( const IndexType& rowIdx ) const;
-
-      /**
-       * \brief Set all matrix elements to given value.
-       *
-       * \param value is the new value of all matrix elements.
-       */
-      void setValue( const RealType& v );
-
-      /**
-       * \brief Sets element at given \e row and \e column to given \e value.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref TridiagonalMatrix::getRow
-       * or \ref TridiagonalMatrix::forElements and \ref TridiagonalMatrix::forAllElements.
-       * The call may fail if the matrix row capacity is exhausted.
-       *
-       * \param row is row index of the element.
-       * \param column is columns index of the element.
-       * \param value is the value the element will be set to.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_setElement.cpp
-       * \par Output
-       * \include TridiagonalMatrixViewExample_setElement.out
-       */
-      __cuda_callable__
-      void setElement( const IndexType row,
-                       const IndexType column,
-                       const RealType& value );
-
-      /**
-       * \brief Add element at given \e row and \e column to given \e value.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref TridiagonalMatrix::getRow
-       * or \ref TridiagonalMatrix::forElements and \ref TridiagonalMatrix::forAllElements.
-       * The call may fail if the matrix row capacity is exhausted.
-       *
-       * \param row is row index of the element.
-       * \param column is columns index of the element.
-       * \param value is the value the element will be set to.
-       * \param thisElementMultiplicator is multiplicator the original matrix element
-       *   value is multiplied by before addition of given \e value.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_addElement.cpp
-       * \par Output
-       * \include TridiagonalMatrixViewExample_addElement.out
-       */
-      __cuda_callable__
-      void addElement( const IndexType row,
-                       const IndexType column,
-                       const RealType& value,
-                       const RealType& thisElementMultiplicator = 1.0 );
-
-      /**
-       * \brief Returns value of matrix element at position given by its row and column index.
-       *
-       * This method can be called from the host system (CPU) no matter
-       * where the matrix is allocated. If the matrix is allocated on GPU this method
-       * can be called even from device kernels. If the matrix is allocated in GPU device
-       * this method is called from CPU, it transfers values of each matrix element separately and so the
-       * performance is very low. For higher performance see. \ref TridiagonalMatrix::getRow
-       * or \ref TridiagonalMatrix::forElements and \ref TridiagonalMatrix::forAllElements.
-       *
-       * \param row is a row index of the matrix element.
-       * \param column i a column index of the matrix element.
-       *
-       * \return value of given matrix element.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_getElement.cpp
-       * \par Output
-       * \include TridiagonalMatrixViewExample_getElement.out
-       */
-      __cuda_callable__
-      RealType getElement( const IndexType row,
-                           const IndexType column ) const;
-
-      /**
-       * \brief Method for performing general reduction on matrix rows for constant instances.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       *  The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_reduceRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixViewExample_reduceRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceRows( IndexType begin, IndexType end, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& zero ) const;
-
-      /**
-       * \brief Method for performing general reduction on matrix rows.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       * The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_reduceRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixViewExample_reduceRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceRows( IndexType begin, IndexType end, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& zero );
-
-      /**
-       * \brief Method for performing general reduction on all matrix rows for constant instances.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       * The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_reduceAllRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixViewExample_reduceAllRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity ) const;
-
-      /**
-       * \brief Method for performing general reduction on all matrix rows.
-       *
-       * \tparam Fetch is a type of lambda function for data fetch declared as
-       *
-       * ```
-       * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ... };
-       * ```
-       *
-       *  The return type of this lambda can be any non void.
-       * \tparam Reduce is a type of lambda function for reduction declared as
-       *
-       * ```
-       * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
-       * ```
-       *
-       * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
-       *
-       * ```
-       * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
-       * ```
-       *
-       * \tparam FetchValue is type returned by the Fetch lambda function.
-       *
-       * \param fetch is an instance of lambda function for data fetch.
-       * \param reduce is an instance of lambda function for reduction.
-       * \param keep in an instance of lambda function for storing results.
-       * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
-       *                 for the reduction operation, i.e. element which does not
-       *                 change the result of the reduction.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_reduceAllRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixViewExample_reduceAllRows.out
-       */
-      template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
-      void reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity );
-
-      /**
-       * \brief Method for iteration over all matrix rows for constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value ) { ... };
-       * ```
-       *
-       * The \e localIdx parameter is a rank of the non-zero element in given row.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin,\e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function& function ) const;
-
-      /**
-       * \brief Method for iteration over all matrix rows for non-constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value ) { ... };
-       * ```
-       *
-       *  The \e localIdx parameter is a rank of the non-zero element in given row.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forElements( IndexType begin, IndexType end, Function& function );
-
-      /**
-       * \brief This method calls \e forElements for all matrix rows (for constant instances).
-       *
-       * See \ref TridiagonalMatrix::forElements.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forAllRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixViewExample_forAllRows.out
-       */
-      template< typename Function >
-      void forAllElements( Function& function ) const;
-
-      /**
-       * \brief This method calls \e forElements for all matrix rows.
-       *
-       * See \ref TridiagonalMatrix::forElements.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forAllRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixViewExample_forAllRows.out
-       */
-      template< typename Function >
-      void forAllElements( Function& function );
-
-      /**
-       * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end).
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref TridiagonalMatrixView::forElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrixView::RowView.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forRows( IndexType begin, IndexType end, Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end) for constant instances.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref TridiagonalMatrixView::forElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrixView::RowView.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forRows( IndexType begin, IndexType end, Function&& function ) const;
-
-      /**
-       * \brief Method for parallel iteration over all matrix rows.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref TridiagonalMatrixView::forAllElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrixView::RowView.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forAllRows( Function&& function );
-
-      /**
-       * \brief Method for parallel iteration over all matrix rows for constant instances.
-       *
-       * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
-       * \ref TridiagonalMatrixView::forAllElements where more than one thread can be mapped to each row.
-       *
-       * \tparam Function is type of the lambda function.
-       *
-       * \param function is an instance of the lambda function to be called for each row.
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrixView::RowView.
-       *
-       * \par Example
-       * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forRows.cpp
-       * \par Output
-       * \include TridiagonalMatrixViewExample_forRows.out
-       */
-      template< typename Function >
-      void forAllRows( Function&& function ) const;
-
-      /**
-       * \brief Method for sequential iteration over all matrix rows for constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrixView::RowView.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForRows( IndexType begin, IndexType end, Function& function ) const;
-
-      /**
-       * \brief Method for sequential iteration over all matrix rows for non-constant instances.
-       *
-       * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
-       *
-       * ```
-       * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
-       * ```
-       *
-       * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrixView::RowView.
-       *
-       * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
-       * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
-       * \param function is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForRows( IndexType begin, IndexType end, Function& function );
-
-      /**
-       * \brief This method calls \e sequentialForRows for all matrix rows (for constant instances).
-       *
-       * See \ref TridiagonalMatrixView::sequentialForRows.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForAllRows( Function& function ) const;
-
-      /**
-       * \brief This method calls \e sequentialForRows for all matrix rows.
-       *
-       * See \ref TridiagonalMatrixView::sequentialForAllRows.
-       *
-       * \tparam Function is a type of lambda function that will operate on matrix elements.
-       * \param function  is an instance of the lambda function to be called in each row.
-       */
-      template< typename Function >
-      void sequentialForAllRows( Function& function );
-
-      /**
-       * \brief Computes product of matrix and vector.
-       *
-       * More precisely, it computes:
-       *
-       * ```
-       * outVector = matrixMultiplicator * ( * this ) * inVector + outVectorMultiplicator * outVector
-       * ```
-       *
-       * \tparam InVector is type of input vector.  It can be \ref Vector,
-       *     \ref VectorView, \ref Array, \ref ArraView or similar container.
-       * \tparam OutVector is type of output vector. It can be \ref Vector,
-       *     \ref VectorView, \ref Array, \ref ArraView or similar container.
-       *
-       * \param inVector is input vector.
-       * \param outVector is output vector.
-       * \param matrixMultiplicator is a factor by which the matrix is multiplied. It is one by default.
-       * \param outVectorMultiplicator is a factor by which the outVector is multiplied before added
-       *    to the result of matrix-vector product. It is zero by default.
-       * \param begin is the beginning of the rows range for which the vector product
-       *    is computed. It is zero by default.
-       * \param end is the end of the rows range for which the vector product
-       *    is computed. It is number if the matrix rows by default.
-       */
-      template< typename InVector,
-                typename OutVector >
-      void vectorProduct( const InVector& inVector,
-                          OutVector& outVector,
-                          const RealType matrixMultiplicator = 1.0,
-                          const RealType outVectorMultiplicator = 0.0,
-                          const IndexType begin = 0,
-                          IndexType end = 0 ) const;
-
-      template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_ >
-      void addMatrix( const TridiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix,
-                      const RealType& matrixMultiplicator = 1.0,
-                      const RealType& thisMatrixMultiplicator = 1.0 );
-
-      template< typename Real2, typename Index2 >
-      void getTransposition( const TridiagonalMatrixView< Real2, Device, Index2 >& matrix,
-                             const RealType& matrixMultiplicator = 1.0 );
-
-      /**
-       * \brief Assignment of exactly the same matrix type.
-       *
-       * \param matrix is input matrix for the assignment.
-       * \return reference to this matrix.
-       */
-      TridiagonalMatrixView& operator=( const TridiagonalMatrixView& view );
-
-      /**
-       * \brief Method for saving the matrix to a file.
-       *
-       * \param file is the output file.
-       */
-      void save( File& file ) const;
-
-      /**
-       * \brief Method for saving the matrix to the file with given filename.
-       *
-       * \param fileName is name of the file.
-       */
-      void save( const String& fileName ) const;
-
-      /**
-       * \brief Method for printing the matrix to output stream.
-       *
-       * \param str is the output stream.
-       */
-      void print( std::ostream& str ) const;
-
-      /**
-       * \brief This method returns matrix elements indexer used by this matrix.
-       *
-       * \return constant reference to the indexer.
-       */
-      __cuda_callable__
-      const IndexerType& getIndexer() const;
-
-      /**
-       * \brief This method returns matrix elements indexer used by this matrix.
-       *
-       * \return non-constant reference to the indexer.
-       */
-      __cuda_callable__
-      IndexerType& getIndexer();
-
-      /**
-       * \brief Returns padding index denoting padding zero elements.
-       *
-       * These elements are used for efficient data alignment in memory.
-       *
-       * \return value of the padding index.
-       */
-      __cuda_callable__
-      IndexType getPaddingIndex() const;
-
-   protected:
-
-      __cuda_callable__
-      IndexType getElementIndex( const IndexType row,
-                                 const IndexType localIdx ) const;
-
-      IndexerType indexer;
+public:
+   // Supporting types - they are not important for the user
+   using BaseType = MatrixView< Real, Device, Index >;
+   using ValuesViewType = typename BaseType::ValuesView;
+   using IndexerType = details::TridiagonalMatrixIndexer< Index, Organization >;
+
+   /**
+    * \brief The type of matrix elements.
+    */
+   using RealType = Real;
+
+   /**
+    * \brief The device where the matrix is allocated.
+    */
+   using DeviceType = Device;
+
+   /**
+    * \brief The type used for matrix elements indexing.
+    */
+   using IndexType = Index;
+
+   /**
+    */
+   using ViewType = TridiagonalMatrixView< Real, Device, Index, Organization >;
+
+   /**
+    * \brief Matrix view type for constant instances.
+    */
+   using ConstViewType = TridiagonalMatrixView< typename std::add_const< Real >::type, Device, Index, Organization >;
+
+   /**
+    * \brief Type for accessing matrix rows.
+    */
+   using RowView = TridiagonalMatrixRowView< ValuesViewType, IndexerType >;
+
+   /**
+    * \brief Type for accessing constant matrix rows.
+    */
+   using ConstRowView = typename RowView::ConstRowView;
+
+   /**
+    * \brief Helper type for getting self type or its modifications.
+    */
+   template< typename _Real = Real,
+             typename _Device = Device,
+             typename _Index = Index,
+             ElementsOrganization Organization_ =
+                Algorithms::Segments::DefaultElementsOrganization< Device >::getOrganization() >
+   using Self = TridiagonalMatrixView< _Real, _Device, _Index, Organization_ >;
+
+   /**
+    * \brief Constructor with no parameters.
+    */
+   __cuda_callable__
+   TridiagonalMatrixView();
+
+   /**
+    * \brief Constructor with all necessary data and views.
+    *
+    * \param values is a vector view with matrix elements values
+    * \param indexer is an indexer of matrix elements
+    */
+   __cuda_callable__
+   TridiagonalMatrixView( const ValuesViewType& values, const IndexerType& indexer );
+
+   /**
+    * \brief Copy constructor.
+    *
+    * \param matrix is an input tridiagonal matrix view.
+    */
+   __cuda_callable__
+   TridiagonalMatrixView( const TridiagonalMatrixView& view ) = default;
+
+   /**
+    * \brief Move constructor.
+    *
+    * \param matrix is an input tridiagonal matrix view.
+    */
+   __cuda_callable__
+   TridiagonalMatrixView( TridiagonalMatrixView&& view ) noexcept = default;
+
+   /**
+    * \brief Returns a modifiable view of the tridiagonal matrix.
+    *
+    * \return tridiagonal matrix view.
+    */
+   ViewType
+   getView();
+
+   /**
+    * \brief Returns a non-modifiable view of the tridiagonal matrix.
+    *
+    * \return tridiagonal matrix view.
+    */
+   ConstViewType
+   getConstView() const;
+
+   /**
+    * \brief Returns string with serialization type.
+    *
+    * The string has a form `Matrices::TridiagonalMatrix< RealType,  [any_device], IndexType, Organization, [any_allocator] >`.
+    *
+    * See \ref TridiagonalMatrix::getSerializationType.
+    *
+    * \return \ref String with the serialization type.
+    */
+   static std::string
+   getSerializationType();
+
+   /**
+    * \brief Returns string with serialization type.
+    *
+    * See \ref TridiagonalMatrix::getSerializationType.
+    *
+    * \return \ref String with the serialization type.
+    */
+   std::string
+   getSerializationTypeVirtual() const override;
+
+   /**
+    * \brief Compute capacities of all rows.
+    *
+    * The row capacities are not stored explicitly and must be computed.
+    *
+    * \param rowCapacities is a vector where the row capacities will be stored.
+    */
+   template< typename Vector >
+   void
+   getRowCapacities( Vector& rowCapacities ) const;
+
+   /**
+    * \brief Computes number of non-zeros in each row.
+    *
+    * \param rowLengths is a vector into which the number of non-zeros in each row
+    * will be stored.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_getCompressedRowLengths.cpp
+    * \par Output
+    * \include TridiagonalMatrixViewExample_getCompressedRowLengths.out
+    */
+   template< typename Vector >
+   void
+   getCompressedRowLengths( Vector& rowLengths ) const;
+
+   /**
+    * \brief Returns number of non-zero matrix elements.
+    *
+    * This method really counts the non-zero matrix elements and so
+    * it returns zero for matrix having all allocated elements set to zero.
+    *
+    * \return number of non-zero matrix elements.
+    */
+   IndexType
+   getNonzeroElementsCount() const override;
+
+   /**
+    * \brief Comparison operator with another tridiagonal matrix.
+    *
+    * \tparam Real_ is \e Real type of the source matrix.
+    * \tparam Device_ is \e Device type of the source matrix.
+    * \tparam Index_ is \e Index type of the source matrix.
+    * \tparam Organization_ is \e Organization of the source matrix.
+    *
+    * \return \e true if both matrices are identical and \e false otherwise.
+    */
+   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_ >
+   bool
+   operator==( const TridiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix ) const;
+
+   /**
+    * \brief Comparison operator with another multidiagonal matrix.
+    *
+    * \tparam Real_ is \e Real type of the source matrix.
+    * \tparam Device_ is \e Device type of the source matrix.
+    * \tparam Index_ is \e Index type of the source matrix.
+    * \tparam Organization_ is \e Organization of the source matrix.
+    *
+    * \param matrix is the source matrix.
+    *
+    * \return \e true if both matrices are NOT identical and \e false otherwise.
+    */
+   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_ >
+   bool
+   operator!=( const TridiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix ) const;
+
+   /**
+    * \brief Non-constant getter of simple structure for accessing given matrix row.
+    *
+    * \param rowIdx is matrix row index.
+    *
+    * \return RowView for accessing given matrix row.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_getRow.cpp
+    * \par Output
+    * \include TridiagonalMatrixViewExample_getRow.out
+    *
+    * See \ref TridiagonalMatrixRowView.
+    */
+   __cuda_callable__
+   RowView
+   getRow( const IndexType& rowIdx );
+
+   /**
+    * \brief Constant getter of simple structure for accessing given matrix row.
+    *
+    * \param rowIdx is matrix row index.
+    *
+    * \return RowView for accessing given matrix row.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_getConstRow.cpp
+    * \par Output
+    * \include TridiagonalMatrixViewExample_getConstRow.out
+    *
+    * See \ref TridiagonalMatrixRowView.
+    */
+   __cuda_callable__
+   const ConstRowView
+   getRow( const IndexType& rowIdx ) const;
+
+   /**
+    * \brief Set all matrix elements to given value.
+    *
+    * \param value is the new value of all matrix elements.
+    */
+   void
+   setValue( const RealType& v );
+
+   /**
+    * \brief Sets element at given \e row and \e column to given \e value.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref TridiagonalMatrix::getRow
+    * or \ref TridiagonalMatrix::forElements and \ref TridiagonalMatrix::forAllElements.
+    * The call may fail if the matrix row capacity is exhausted.
+    *
+    * \param row is row index of the element.
+    * \param column is columns index of the element.
+    * \param value is the value the element will be set to.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_setElement.cpp
+    * \par Output
+    * \include TridiagonalMatrixViewExample_setElement.out
+    */
+   __cuda_callable__
+   void
+   setElement( IndexType row, IndexType column, const RealType& value );
+
+   /**
+    * \brief Add element at given \e row and \e column to given \e value.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref TridiagonalMatrix::getRow
+    * or \ref TridiagonalMatrix::forElements and \ref TridiagonalMatrix::forAllElements.
+    * The call may fail if the matrix row capacity is exhausted.
+    *
+    * \param row is row index of the element.
+    * \param column is columns index of the element.
+    * \param value is the value the element will be set to.
+    * \param thisElementMultiplicator is multiplicator the original matrix element
+    *   value is multiplied by before addition of given \e value.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_addElement.cpp
+    * \par Output
+    * \include TridiagonalMatrixViewExample_addElement.out
+    */
+   __cuda_callable__
+   void
+   addElement( IndexType row, IndexType column, const RealType& value, const RealType& thisElementMultiplicator = 1.0 );
+
+   /**
+    * \brief Returns value of matrix element at position given by its row and column index.
+    *
+    * This method can be called from the host system (CPU) no matter
+    * where the matrix is allocated. If the matrix is allocated on GPU this method
+    * can be called even from device kernels. If the matrix is allocated in GPU device
+    * this method is called from CPU, it transfers values of each matrix element separately and so the
+    * performance is very low. For higher performance see. \ref TridiagonalMatrix::getRow
+    * or \ref TridiagonalMatrix::forElements and \ref TridiagonalMatrix::forAllElements.
+    *
+    * \param row is a row index of the matrix element.
+    * \param column i a column index of the matrix element.
+    *
+    * \return value of given matrix element.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_getElement.cpp
+    * \par Output
+    * \include TridiagonalMatrixViewExample_getElement.out
+    */
+   __cuda_callable__
+   RealType
+   getElement( IndexType row, IndexType column ) const;
+
+   /**
+    * \brief Method for performing general reduction on matrix rows for constant instances.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ...
+    * };
+    * ```
+    *
+    *  The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_reduceRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixViewExample_reduceRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceRows( IndexType begin, IndexType end, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& zero ) const;
+
+   /**
+    * \brief Method for performing general reduction on matrix rows.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ...
+    * };
+    * ```
+    *
+    * The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_reduceRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixViewExample_reduceRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceRows( IndexType begin, IndexType end, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& zero );
+
+   /**
+    * \brief Method for performing general reduction on all matrix rows for constant instances.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ...
+    * };
+    * ```
+    *
+    * The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_reduceAllRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixViewExample_reduceAllRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity ) const;
+
+   /**
+    * \brief Method for performing general reduction on all matrix rows.
+    *
+    * \tparam Fetch is a type of lambda function for data fetch declared as
+    *
+    * ```
+    * auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType& columnIdx, RealType& elementValue ) -> FetchValue { ...
+    * };
+    * ```
+    *
+    *  The return type of this lambda can be any non void.
+    * \tparam Reduce is a type of lambda function for reduction declared as
+    *
+    * ```
+    * auto reduce = [=] __cuda_callable__ ( const FetchValue& v1, const FetchValue& v2 ) -> FetchValue { ... };
+    * ```
+    *
+    * \tparam Keep is a type of lambda function for storing results of reduction in each row. It is declared as
+    *
+    * ```
+    * auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const double& value ) { ... };
+    * ```
+    *
+    * \tparam FetchValue is type returned by the Fetch lambda function.
+    *
+    * \param fetch is an instance of lambda function for data fetch.
+    * \param reduce is an instance of lambda function for reduction.
+    * \param keep in an instance of lambda function for storing results.
+    * \param identity is the [identity element](https://en.wikipedia.org/wiki/Identity_element)
+    *                 for the reduction operation, i.e. element which does not
+    *                 change the result of the reduction.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_reduceAllRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixViewExample_reduceAllRows.out
+    */
+   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+   void
+   reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity );
+
+   /**
+    * \brief Method for iteration over all matrix rows for constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )
+    * { ... };
+    * ```
+    *
+    * The \e localIdx parameter is a rank of the non-zero element in given row.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin,\e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function& function ) const;
+
+   /**
+    * \brief Method for iteration over all matrix rows for non-constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, IndexType columnIdx, const RealType& value )
+    * { ... };
+    * ```
+    *
+    *  The \e localIdx parameter is a rank of the non-zero element in given row.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forElements( IndexType begin, IndexType end, Function& function );
+
+   /**
+    * \brief This method calls \e forElements for all matrix rows (for constant instances).
+    *
+    * See \ref TridiagonalMatrix::forElements.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forAllRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixViewExample_forAllRows.out
+    */
+   template< typename Function >
+   void
+   forAllElements( Function& function ) const;
+
+   /**
+    * \brief This method calls \e forElements for all matrix rows.
+    *
+    * See \ref TridiagonalMatrix::forElements.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forAllRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixViewExample_forAllRows.out
+    */
+   template< typename Function >
+   void
+   forAllElements( Function& function );
+
+   /**
+    * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end).
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref TridiagonalMatrixView::forElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrixView::RowView.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forRows( IndexType begin, IndexType end, Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over matrix rows from interval [ \e begin, \e end) for constant instances.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref TridiagonalMatrixView::forElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param begin defines beginning of the range [ \e begin,\e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrixView::RowView.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forRows( IndexType begin, IndexType end, Function&& function ) const;
+
+   /**
+    * \brief Method for parallel iteration over all matrix rows.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref TridiagonalMatrixView::forAllElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) mutable { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrixView::RowView.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forAllRows( Function&& function );
+
+   /**
+    * \brief Method for parallel iteration over all matrix rows for constant instances.
+    *
+    * In each row, given lambda function is performed. Each row is processed by at most one thread unlike the method
+    * \ref TridiagonalMatrixView::forAllElements where more than one thread can be mapped to each row.
+    *
+    * \tparam Function is type of the lambda function.
+    *
+    * \param function is an instance of the lambda function to be called for each row.
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrixView::RowView.
+    *
+    * \par Example
+    * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forRows.cpp
+    * \par Output
+    * \include TridiagonalMatrixViewExample_forRows.out
+    */
+   template< typename Function >
+   void
+   forAllRows( Function&& function ) const;
+
+   /**
+    * \brief Method for sequential iteration over all matrix rows for constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrixView::RowView.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForRows( IndexType begin, IndexType end, Function& function ) const;
+
+   /**
+    * \brief Method for sequential iteration over all matrix rows for non-constant instances.
+    *
+    * \tparam Function is type of lambda function that will operate on matrix elements. It is should have form like
+    *
+    * ```
+    * auto function = [] __cuda_callable__ ( RowView& row ) { ... };
+    * ```
+    *
+    * \e RowView represents matrix row - see \ref TNL::Matrices::TridiagonalMatrixView::RowView.
+    *
+    * \param begin defines beginning of the range [ \e begin, \e end ) of rows to be processed.
+    * \param end defines ending of the range [ \e begin, \e end ) of rows to be processed.
+    * \param function is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForRows( IndexType begin, IndexType end, Function& function );
+
+   /**
+    * \brief This method calls \e sequentialForRows for all matrix rows (for constant instances).
+    *
+    * See \ref TridiagonalMatrixView::sequentialForRows.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForAllRows( Function& function ) const;
+
+   /**
+    * \brief This method calls \e sequentialForRows for all matrix rows.
+    *
+    * See \ref TridiagonalMatrixView::sequentialForAllRows.
+    *
+    * \tparam Function is a type of lambda function that will operate on matrix elements.
+    * \param function  is an instance of the lambda function to be called in each row.
+    */
+   template< typename Function >
+   void
+   sequentialForAllRows( Function& function );
+
+   /**
+    * \brief Computes product of matrix and vector.
+    *
+    * More precisely, it computes:
+    *
+    * ```
+    * outVector = matrixMultiplicator * ( * this ) * inVector + outVectorMultiplicator * outVector
+    * ```
+    *
+    * \tparam InVector is type of input vector.  It can be \ref Vector,
+    *     \ref VectorView, \ref Array, \ref ArraView or similar container.
+    * \tparam OutVector is type of output vector. It can be \ref Vector,
+    *     \ref VectorView, \ref Array, \ref ArraView or similar container.
+    *
+    * \param inVector is input vector.
+    * \param outVector is output vector.
+    * \param matrixMultiplicator is a factor by which the matrix is multiplied. It is one by default.
+    * \param outVectorMultiplicator is a factor by which the outVector is multiplied before added
+    *    to the result of matrix-vector product. It is zero by default.
+    * \param begin is the beginning of the rows range for which the vector product
+    *    is computed. It is zero by default.
+    * \param end is the end of the rows range for which the vector product
+    *    is computed. It is number if the matrix rows by default.
+    */
+   template< typename InVector, typename OutVector >
+   void
+   vectorProduct( const InVector& inVector,
+                  OutVector& outVector,
+                  RealType matrixMultiplicator = 1.0,
+                  RealType outVectorMultiplicator = 0.0,
+                  IndexType begin = 0,
+                  IndexType end = 0 ) const;
+
+   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_ >
+   void
+   addMatrix( const TridiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix,
+              const RealType& matrixMultiplicator = 1.0,
+              const RealType& thisMatrixMultiplicator = 1.0 );
+
+   template< typename Real2, typename Index2 >
+   void
+   getTransposition( const TridiagonalMatrixView< Real2, Device, Index2 >& matrix, const RealType& matrixMultiplicator = 1.0 );
+
+   /**
+    * \brief Assignment of exactly the same matrix type.
+    *
+    * \param matrix is input matrix for the assignment.
+    * \return reference to this matrix.
+    */
+   TridiagonalMatrixView&
+   operator=( const TridiagonalMatrixView& view );
+
+   /**
+    * \brief Method for saving the matrix to a file.
+    *
+    * \param file is the output file.
+    */
+   void
+   save( File& file ) const override;
+
+   /**
+    * \brief Method for saving the matrix to the file with given filename.
+    *
+    * \param fileName is name of the file.
+    */
+   void
+   save( const String& fileName ) const;
+
+   /**
+    * \brief Method for printing the matrix to output stream.
+    *
+    * \param str is the output stream.
+    */
+   void
+   print( std::ostream& str ) const override;
+
+   /**
+    * \brief This method returns matrix elements indexer used by this matrix.
+    *
+    * \return constant reference to the indexer.
+    */
+   __cuda_callable__
+   const IndexerType&
+   getIndexer() const;
+
+   /**
+    * \brief This method returns matrix elements indexer used by this matrix.
+    *
+    * \return non-constant reference to the indexer.
+    */
+   __cuda_callable__
+   IndexerType&
+   getIndexer();
+
+   /**
+    * \brief Returns padding index denoting padding zero elements.
+    *
+    * These elements are used for efficient data alignment in memory.
+    *
+    * \return value of the padding index.
+    */
+   __cuda_callable__
+   IndexType
+   getPaddingIndex() const;
+
+protected:
+   __cuda_callable__
+   IndexType
+   getElementIndex( IndexType row, IndexType localIdx ) const;
+
+   IndexerType indexer;
 };
 
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
 
 #include <TNL/Matrices/TridiagonalMatrixView.hpp>
diff --git a/src/TNL/Matrices/TridiagonalMatrixView.hpp b/src/TNL/Matrices/TridiagonalMatrixView.hpp
index 421ee88209bfa24476212bb7cc2fb5563868c3e4..cd5c0ba23928656192fc7648b0b353b8b5f8b6de 100644
--- a/src/TNL/Matrices/TridiagonalMatrixView.hpp
+++ b/src/TNL/Matrices/TridiagonalMatrixView.hpp
@@ -14,235 +14,174 @@
 namespace TNL {
 namespace Matrices {
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-TridiagonalMatrixView()
-{
-}
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+TridiagonalMatrixView< Real, Device, Index, Organization >::TridiagonalMatrixView() = default;
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-TridiagonalMatrixView( const ValuesViewType& values, const IndexerType& indexer )
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+TridiagonalMatrixView< Real, Device, Index, Organization >::TridiagonalMatrixView( const ValuesViewType& values,
+                                                                                   const IndexerType& indexer )
 : MatrixView< Real, Device, Index >( indexer.getRows(), indexer.getColumns(), values ), indexer( indexer )
-{
-}
+{}
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 auto
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-getView() -> ViewType
+TridiagonalMatrixView< Real, Device, Index, Organization >::getView() -> ViewType
 {
    return ViewType( this->values.getView(), indexer );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 auto
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-getConstView() const -> ConstViewType
+TridiagonalMatrixView< Real, Device, Index, Organization >::getConstView() const -> ConstViewType
 {
    return ConstViewType( this->values.getConstView(), indexer );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-String
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-getSerializationType()
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+std::string
+TridiagonalMatrixView< Real, Device, Index, Organization >::getSerializationType()
 {
-   return String( "Matrices::TridiagonalMatrix< " ) +
-          TNL::getSerializationType< RealType >() + ", [any_device], " +
-          TNL::getSerializationType< IndexType >() + ", " +
-          TNL::getSerializationType( Organization ) + ", [any_allocator] >";
+   return "Matrices::TridiagonalMatrix< " + TNL::getSerializationType< RealType >() + ", [any_device], "
+        + TNL::getSerializationType< IndexType >() + ", " + TNL::getSerializationType( Organization ) + ", [any_allocator] >";
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-String
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-getSerializationTypeVirtual() const
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+std::string
+TridiagonalMatrixView< Real, Device, Index, Organization >::getSerializationTypeVirtual() const
 {
    return this->getSerializationType();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Vector >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Vector >
 void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-getRowCapacities( Vector& rowCapacities ) const
+TridiagonalMatrixView< Real, Device, Index, Organization >::getRowCapacities( Vector& rowCapacities ) const
 {
    rowCapacities.setSize( this->getRows() );
    rowCapacities = 3;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Vector >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Vector >
 void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-getCompressedRowLengths( Vector& rowLengths ) const
+TridiagonalMatrixView< Real, Device, Index, Organization >::getCompressedRowLengths( Vector& rowLengths ) const
 {
    rowLengths.setSize( this->getRows() );
    rowLengths = 0;
    auto rowLengths_view = rowLengths.getView();
-   auto fetch = [] __cuda_callable__ ( IndexType row, IndexType column, const RealType& value ) -> IndexType {
+   auto fetch = [] __cuda_callable__( IndexType row, IndexType column, const RealType& value ) -> IndexType
+   {
       return ( value != 0.0 );
    };
-   auto reduce = [] __cuda_callable__ ( const IndexType& aux, const IndexType a ) -> IndexType {
+   auto reduce = [] __cuda_callable__( const IndexType& aux, const IndexType a ) -> IndexType
+   {
       return aux + a;
    };
-   auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const IndexType value ) mutable {
+   auto keep = [ = ] __cuda_callable__( const IndexType rowIdx, const IndexType value ) mutable
+   {
       rowLengths_view[ rowIdx ] = value;
    };
    this->reduceAllRows( fetch, reduce, keep, 0 );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 Index
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-getNonzeroElementsCount() const
+TridiagonalMatrixView< Real, Device, Index, Organization >::getNonzeroElementsCount() const
 {
    const auto values_view = this->values.getConstView();
-   auto fetch = [=] __cuda_callable__ ( const IndexType i ) -> IndexType {
+   auto fetch = [ = ] __cuda_callable__( const IndexType i ) -> IndexType
+   {
       return ( values_view[ i ] != 0.0 );
    };
    return Algorithms::reduce< DeviceType >( (IndexType) 0, this->values.getSize(), fetch, std::plus<>{}, 0 );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_ >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_ >
 bool
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-operator == ( const TridiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix ) const
+TridiagonalMatrixView< Real, Device, Index, Organization >::operator==(
+   const TridiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix ) const
 {
    if( Organization == Organization_ )
       return this->values == matrix.values;
-   else
-   {
+   else {
       TNL_ASSERT_TRUE( false, "TODO" );
    }
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_ >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_ >
 bool
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-operator != ( const TridiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix ) const
+TridiagonalMatrixView< Real, Device, Index, Organization >::operator!=(
+   const TridiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix ) const
 {
    return ! this->operator==( matrix );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-setValue( const RealType& v )
+TridiagonalMatrixView< Real, Device, Index, Organization >::setValue( const RealType& v )
 {
    this->values = v;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
 auto
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-getRow( const IndexType& rowIdx ) const -> const ConstRowView
+TridiagonalMatrixView< Real, Device, Index, Organization >::getRow( const IndexType& rowIdx ) const -> const ConstRowView
 {
    return ConstRowView( rowIdx, this->values.getView(), this->indexer );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
 auto
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-getRow( const IndexType& rowIdx ) -> RowView
+TridiagonalMatrixView< Real, Device, Index, Organization >::getRow( const IndexType& rowIdx ) -> RowView
 {
    return RowView( rowIdx, this->values.getView(), this->indexer );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-__cuda_callable__ void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-setElement( const IndexType row, const IndexType column, const RealType& value )
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+__cuda_callable__
+void
+TridiagonalMatrixView< Real, Device, Index, Organization >::setElement( const IndexType row,
+                                                                        const IndexType column,
+                                                                        const RealType& value )
 {
    TNL_ASSERT_GE( row, 0, "" );
    TNL_ASSERT_LT( row, this->getRows(), "" );
    TNL_ASSERT_GE( column, 0, "" );
    TNL_ASSERT_LT( column, this->getColumns(), "" );
-   if( abs( row - column ) > 1 )
-   {
+   if( abs( row - column ) > 1 ) {
 #ifdef __CUDA_ARCH__
       TNL_ASSERT_TRUE( false, "Wrong matrix element coordinates tridiagonal matrix." );
 #else
       std::stringstream msg;
-      msg << "Wrong matrix element coordinates ( "  << row << ", " << column << " ) in tridiagonal matrix.";
+      msg << "Wrong matrix element coordinates ( " << row << ", " << column << " ) in tridiagonal matrix.";
       throw std::logic_error( msg.str() );
 #endif
    }
    this->values.setElement( this->getElementIndex( row, column ), value );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-__cuda_callable__ void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-addElement( const IndexType row,
-            const IndexType column,
-            const RealType& value,
-            const RealType& thisElementMultiplicator )
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+__cuda_callable__
+void
+TridiagonalMatrixView< Real, Device, Index, Organization >::addElement( const IndexType row,
+                                                                        const IndexType column,
+                                                                        const RealType& value,
+                                                                        const RealType& thisElementMultiplicator )
 {
    TNL_ASSERT_GE( row, 0, "" );
    TNL_ASSERT_LT( row, this->getRows(), "" );
    TNL_ASSERT_GE( column, 0, "" );
    TNL_ASSERT_LT( column, this->getColumns(), "" );
-   if( abs( row - column ) > 1 )
-   {
+   if( abs( row - column ) > 1 ) {
 #ifdef __CUDA_ARCH__
       TNL_ASSERT_TRUE( false, "Wrong matrix element coordinates tridiagonal matrix." );
 #else
       std::stringstream msg;
-      msg << "Wrong matrix element coordinates ( "  << row << ", " << column << " ) in tridiagonal matrix.";
+      msg << "Wrong matrix element coordinates ( " << row << ", " << column << " ) in tridiagonal matrix.";
       throw std::logic_error( msg.str() );
 #endif
    }
@@ -250,13 +189,10 @@ addElement( const IndexType row,
    this->values.setElement( i, thisElementMultiplicator * this->values.getElement( i ) + value );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-__cuda_callable__ Real
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-getElement( const IndexType row, const IndexType column ) const
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+__cuda_callable__
+Real
+TridiagonalMatrixView< Real, Device, Index, Organization >::getElement( const IndexType row, const IndexType column ) const
 {
    TNL_ASSERT_GE( row, 0, "" );
    TNL_ASSERT_LT( row, this->getRows(), "" );
@@ -268,143 +204,133 @@ getElement( const IndexType row, const IndexType column ) const
    return this->values.getElement( this->getElementIndex( row, column ) );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-reduceRows( IndexType first, IndexType last, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity ) const
+TridiagonalMatrixView< Real, Device, Index, Organization >::reduceRows( IndexType first,
+                                                                        IndexType last,
+                                                                        Fetch& fetch,
+                                                                        Reduce& reduce,
+                                                                        Keep& keep,
+                                                                        const FetchReal& identity ) const
 {
    using Real_ = decltype( fetch( IndexType(), IndexType(), RealType() ) );
    const auto values_view = this->values.getConstView();
    const auto indexer = this->indexer;
-   auto f = [=] __cuda_callable__ ( IndexType rowIdx ) mutable {
+   auto f = [ = ] __cuda_callable__( IndexType rowIdx ) mutable
+   {
       Real_ sum = identity;
-      if( rowIdx == 0 )
-      {
+      if( rowIdx == 0 ) {
          sum = reduce( sum, fetch( 0, 1, values_view[ indexer.getGlobalIndex( 0, 1 ) ] ) );
          sum = reduce( sum, fetch( 0, 2, values_view[ indexer.getGlobalIndex( 0, 2 ) ] ) );
          keep( 0, sum );
          return;
       }
-      if( rowIdx + 1 < indexer.getColumns() )
-      {
+      if( rowIdx + 1 < indexer.getColumns() ) {
          sum = reduce( sum, fetch( rowIdx, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ) );
-         sum = reduce( sum, fetch( rowIdx, rowIdx,     values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) );
+         sum = reduce( sum, fetch( rowIdx, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) );
          sum = reduce( sum, fetch( rowIdx, rowIdx + 1, values_view[ indexer.getGlobalIndex( rowIdx, 2 ) ] ) );
          keep( rowIdx, sum );
          return;
       }
-      if( rowIdx < indexer.getColumns() )
-      {
+      if( rowIdx < indexer.getColumns() ) {
          sum = reduce( sum, fetch( rowIdx, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ) );
-         sum = reduce( sum, fetch( rowIdx, rowIdx,     values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) );
+         sum = reduce( sum, fetch( rowIdx, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) );
          keep( rowIdx, sum );
       }
-      else
-      {
+      else {
          keep( rowIdx, fetch( rowIdx, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ) );
       }
    };
    Algorithms::ParallelFor< DeviceType >::exec( first, last, f );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-reduceRows( IndexType first, IndexType last, Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity )
+TridiagonalMatrixView< Real, Device, Index, Organization >::reduceRows( IndexType first,
+                                                                        IndexType last,
+                                                                        Fetch& fetch,
+                                                                        Reduce& reduce,
+                                                                        Keep& keep,
+                                                                        const FetchReal& identity )
 {
    using Real_ = decltype( fetch( IndexType(), IndexType(), RealType() ) );
    auto values_view = this->values.getConstView();
    const auto indexer = this->indexer;
-   auto f = [=] __cuda_callable__ ( IndexType rowIdx ) mutable {
+   auto f = [ = ] __cuda_callable__( IndexType rowIdx ) mutable
+   {
       Real_ sum = identity;
-      if( rowIdx == 0 )
-      {
+      if( rowIdx == 0 ) {
          sum = reduce( sum, fetch( 0, 1, values_view[ indexer.getGlobalIndex( 0, 1 ) ] ) );
          sum = reduce( sum, fetch( 0, 2, values_view[ indexer.getGlobalIndex( 0, 2 ) ] ) );
          keep( 0, sum );
          return;
       }
-      if( rowIdx + 1 < indexer.getColumns() )
-      {
+      if( rowIdx + 1 < indexer.getColumns() ) {
          sum = reduce( sum, fetch( rowIdx, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ) );
-         sum = reduce( sum, fetch( rowIdx, rowIdx,     values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) );
+         sum = reduce( sum, fetch( rowIdx, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) );
          sum = reduce( sum, fetch( rowIdx, rowIdx + 1, values_view[ indexer.getGlobalIndex( rowIdx, 2 ) ] ) );
          keep( rowIdx, sum );
          return;
       }
-      if( rowIdx < indexer.getColumns() )
-      {
+      if( rowIdx < indexer.getColumns() ) {
          sum = reduce( sum, fetch( rowIdx, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ) );
-         sum = reduce( sum, fetch( rowIdx, rowIdx,     values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) );
+         sum = reduce( sum, fetch( rowIdx, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) );
          keep( rowIdx, sum );
       }
-      else
-      {
+      else {
          keep( rowIdx, fetch( rowIdx, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ) );
       }
    };
    Algorithms::ParallelFor< DeviceType >::exec( first, last, f );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity ) const
+TridiagonalMatrixView< Real, Device, Index, Organization >::reduceAllRows( Fetch& fetch,
+                                                                           Reduce& reduce,
+                                                                           Keep& keep,
+                                                                           const FetchReal& identity ) const
 {
    this->reduceRows( (IndexType) 0, this->indexer.getNonemptyRowsCount(), fetch, reduce, keep, identity );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Fetch, typename Reduce, typename Keep, typename FetchReal >
 void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity )
+TridiagonalMatrixView< Real, Device, Index, Organization >::reduceAllRows( Fetch& fetch,
+                                                                           Reduce& reduce,
+                                                                           Keep& keep,
+                                                                           const FetchReal& identity )
 {
    this->reduceRows( (IndexType) 0, this->indexer.getNonemptyRowsCount(), fetch, reduce, keep, identity );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-forElements( IndexType first, IndexType last, Function& function ) const
+TridiagonalMatrixView< Real, Device, Index, Organization >::forElements( IndexType first,
+                                                                         IndexType last,
+                                                                         Function& function ) const
 {
    const auto values_view = this->values.getConstView();
    const auto indexer = this->indexer;
-   auto f = [=] __cuda_callable__ ( IndexType rowIdx ) mutable {
-      if( rowIdx == 0 )
-      {
+   auto f = [ = ] __cuda_callable__( IndexType rowIdx ) mutable
+   {
+      if( rowIdx == 0 ) {
          function( 0, 1, 0, values_view[ indexer.getGlobalIndex( 0, 1 ) ] );
          function( 0, 2, 1, values_view[ indexer.getGlobalIndex( 0, 2 ) ] );
       }
-      else if( rowIdx + 1 < indexer.getColumns() )
-      {
+      else if( rowIdx + 1 < indexer.getColumns() ) {
          function( rowIdx, 0, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] );
-         function( rowIdx, 1, rowIdx,     values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] );
+         function( rowIdx, 1, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] );
          function( rowIdx, 2, rowIdx + 1, values_view[ indexer.getGlobalIndex( rowIdx, 2 ) ] );
       }
-      else if( rowIdx < indexer.getColumns() )
-      {
+      else if( rowIdx < indexer.getColumns() ) {
          function( rowIdx, 0, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] );
-         function( rowIdx, 1, rowIdx,     values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] );
+         function( rowIdx, 1, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] );
       }
       else
          function( rowIdx, 0, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] );
@@ -412,33 +338,27 @@ forElements( IndexType first, IndexType last, Function& function ) const
    Algorithms::ParallelFor< DeviceType >::exec( first, last, f );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-  template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-forElements( IndexType first, IndexType last, Function& function )
+TridiagonalMatrixView< Real, Device, Index, Organization >::forElements( IndexType first, IndexType last, Function& function )
 {
    auto values_view = this->values.getView();
    const auto indexer = this->indexer;
-   auto f = [=] __cuda_callable__ ( IndexType rowIdx ) mutable {
-      if( rowIdx == 0 )
-      {
+   auto f = [ = ] __cuda_callable__( IndexType rowIdx ) mutable
+   {
+      if( rowIdx == 0 ) {
          function( 0, 1, 0, values_view[ indexer.getGlobalIndex( 0, 1 ) ] );
          function( 0, 2, 1, values_view[ indexer.getGlobalIndex( 0, 2 ) ] );
       }
-      else if( rowIdx + 1 < indexer.getColumns() )
-      {
+      else if( rowIdx + 1 < indexer.getColumns() ) {
          function( rowIdx, 0, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] );
-         function( rowIdx, 1, rowIdx,     values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] );
+         function( rowIdx, 1, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] );
          function( rowIdx, 2, rowIdx + 1, values_view[ indexer.getGlobalIndex( rowIdx, 2 ) ] );
       }
-      else if( rowIdx < indexer.getColumns() )
-      {
+      else if( rowIdx < indexer.getColumns() ) {
          function( rowIdx, 0, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] );
-         function( rowIdx, 1, rowIdx,     values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] );
+         function( rowIdx, 1, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] );
       }
       else
          function( rowIdx, 0, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] );
@@ -446,224 +366,186 @@ forElements( IndexType first, IndexType last, Function& function )
    Algorithms::ParallelFor< DeviceType >::exec( first, last, f );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-forAllElements( Function& function ) const
+TridiagonalMatrixView< Real, Device, Index, Organization >::forAllElements( Function& function ) const
 {
    this->forElements( (IndexType) 0, this->indxer.getNonEmptyRowsCount(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-forAllElements( Function& function )
+TridiagonalMatrixView< Real, Device, Index, Organization >::forAllElements( Function& function )
 {
    this->forElements( (IndexType) 0, this->indexer.getNonemptyRowsCount(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-forRows( IndexType begin, IndexType end, Function&& function )
+TridiagonalMatrixView< Real, Device, Index, Organization >::forRows( IndexType begin, IndexType end, Function&& function )
 {
    auto view = *this;
-   auto f = [=] __cuda_callable__ ( const IndexType rowIdx ) mutable {
+   auto f = [ = ] __cuda_callable__( const IndexType rowIdx ) mutable
+   {
       auto rowView = view.getRow( rowIdx );
       function( rowView );
    };
    TNL::Algorithms::ParallelFor< DeviceType >::exec( begin, end, f );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-forRows( IndexType begin, IndexType end, Function&& function ) const
+TridiagonalMatrixView< Real, Device, Index, Organization >::forRows( IndexType begin, IndexType end, Function&& function ) const
 {
    auto view = *this;
-   auto f = [=] __cuda_callable__ ( const IndexType rowIdx ) mutable {
+   auto f = [ = ] __cuda_callable__( const IndexType rowIdx ) mutable
+   {
       auto rowView = view.getRow( rowIdx );
       function( rowView );
    };
    TNL::Algorithms::ParallelFor< DeviceType >::exec( begin, end, f );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-forAllRows( Function&& function )
+TridiagonalMatrixView< Real, Device, Index, Organization >::forAllRows( Function&& function )
 {
    this->forRows( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-forAllRows( Function&& function ) const
+TridiagonalMatrixView< Real, Device, Index, Organization >::forAllRows( Function&& function ) const
 {
    this->forRows( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-sequentialForRows( IndexType begin, IndexType end, Function& function ) const
+TridiagonalMatrixView< Real, Device, Index, Organization >::sequentialForRows( IndexType begin,
+                                                                               IndexType end,
+                                                                               Function& function ) const
 {
-   for( IndexType row = begin; row < end; row ++ )
+   for( IndexType row = begin; row < end; row++ )
       this->forElements( row, row + 1, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-sequentialForRows( IndexType begin, IndexType end, Function& function )
+TridiagonalMatrixView< Real, Device, Index, Organization >::sequentialForRows( IndexType begin,
+                                                                               IndexType end,
+                                                                               Function& function )
 {
-   for( IndexType row = begin; row < end; row ++ )
+   for( IndexType row = begin; row < end; row++ )
       this->forElements( row, row + 1, function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-sequentialForAllRows( Function& function ) const
+TridiagonalMatrixView< Real, Device, Index, Organization >::sequentialForAllRows( Function& function ) const
 {
    this->sequentialForRows( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Function >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Function >
 void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-sequentialForAllRows( Function& function )
+TridiagonalMatrixView< Real, Device, Index, Organization >::sequentialForAllRows( Function& function )
 {
    this->sequentialForRows( (IndexType) 0, this->getRows(), function );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename InVector,
-             typename OutVector >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename InVector, typename OutVector >
 void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-vectorProduct( const InVector& inVector,
-               OutVector& outVector,
-               const RealType matrixMultiplicator,
-               const RealType outVectorMultiplicator,
-               const IndexType begin,
-               IndexType end ) const
+TridiagonalMatrixView< Real, Device, Index, Organization >::vectorProduct( const InVector& inVector,
+                                                                           OutVector& outVector,
+                                                                           RealType matrixMultiplicator,
+                                                                           RealType outVectorMultiplicator,
+                                                                           IndexType begin,
+                                                                           IndexType end ) const
 {
    TNL_ASSERT_EQ( this->getColumns(), inVector.getSize(), "Matrix columns do not fit with input vector." );
    TNL_ASSERT_EQ( this->getRows(), outVector.getSize(), "Matrix rows do not fit with output vector." );
 
    const auto inVectorView = inVector.getConstView();
    auto outVectorView = outVector.getView();
-   auto fetch = [=] __cuda_callable__ ( const IndexType& row, const IndexType& column, const RealType& value ) -> RealType {
+   auto fetch = [ = ] __cuda_callable__( const IndexType& row, const IndexType& column, const RealType& value ) -> RealType
+   {
       return value * inVectorView[ column ];
    };
-   auto reduction = [] __cuda_callable__ ( const RealType& sum, const RealType& value ) -> RealType {
+   auto reduction = [] __cuda_callable__( const RealType& sum, const RealType& value ) -> RealType
+   {
       return sum + value;
    };
-   auto keeper1 = [=] __cuda_callable__ ( IndexType row, const RealType& value ) mutable {
+   auto keeper1 = [ = ] __cuda_callable__( IndexType row, const RealType& value ) mutable
+   {
       outVectorView[ row ] = value;
    };
-   auto keeper2 = [=] __cuda_callable__ ( IndexType row, const RealType& value ) mutable {
+   auto keeper2 = [ = ] __cuda_callable__( IndexType row, const RealType& value ) mutable
+   {
       outVectorView[ row ] = outVectorMultiplicator * outVectorView[ row ] + matrixMultiplicator * value;
    };
    if( end == 0 )
       end = this->getRows();
    if( matrixMultiplicator == 1.0 && outVectorMultiplicator == 0.0 )
-      this->reduceRows( begin, end, fetch, reduction, keeper1, ( RealType ) 0.0 );
+      this->reduceRows( begin, end, fetch, reduction, keeper1, (RealType) 0.0 );
    else
-      this->reduceRows( begin, end, fetch, reduction, keeper2, ( RealType ) 0.0 );
+      this->reduceRows( begin, end, fetch, reduction, keeper2, (RealType) 0.0 );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 TridiagonalMatrixView< Real, Device, Index, Organization >&
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-operator=( const TridiagonalMatrixView& view )
+TridiagonalMatrixView< Real, Device, Index, Organization >::operator=( const TridiagonalMatrixView& view )
 {
    MatrixView< Real, Device, Index >::operator=( view );
    this->indexer = view.indexer;
    return *this;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_ >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Real_, typename Device_, typename Index_, ElementsOrganization Organization_ >
 void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-addMatrix( const TridiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix,
-           const RealType& matrixMultiplicator,
-           const RealType& thisMatrixMultiplicator )
+TridiagonalMatrixView< Real, Device, Index, Organization >::addMatrix(
+   const TridiagonalMatrixView< Real_, Device_, Index_, Organization_ >& matrix,
+   const RealType& matrixMultiplicator,
+   const RealType& thisMatrixMultiplicator )
 {
    TNL_ASSERT_EQ( this->getRows(), matrix.getRows(), "Matrices rows are not equal." );
    TNL_ASSERT_EQ( this->getColumns(), matrix.getColumns(), "Matrices columns are not equal." );
 
-   if( Organization == Organization_ )
-   {
+   if( Organization == Organization_ ) {
       if( thisMatrixMultiplicator == 1.0 )
          this->values += matrixMultiplicator * matrix.getValues();
       else
          this->values = thisMatrixMultiplicator * this->values + matrixMultiplicator * matrix.getValues();
    }
-   else
-   {
+   else {
       const auto matrix_view = matrix;
       const auto matrixMult = matrixMultiplicator;
       const auto thisMult = thisMatrixMultiplicator;
-      auto add0 = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value ) mutable {
+      auto add0 = [ = ] __cuda_callable__(
+                     const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value ) mutable
+      {
          value = matrixMult * matrix.getValues()[ matrix.getIndexer().getGlobalIndex( rowIdx, localIdx ) ];
       };
-      auto add1 = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value ) mutable {
+      auto add1 = [ = ] __cuda_callable__(
+                     const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value ) mutable
+      {
          value += matrixMult * matrix.getValues()[ matrix.getIndexer().getGlobalIndex( rowIdx, localIdx ) ];
       };
-      auto addGen = [=] __cuda_callable__ ( const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value ) mutable {
+      auto addGen = [ = ] __cuda_callable__(
+                       const IndexType& rowIdx, const IndexType& localIdx, const IndexType& column, Real& value ) mutable
+      {
          value = thisMult * value + matrixMult * matrix.getValues()[ matrix.getIndexer().getGlobalIndex( rowIdx, localIdx ) ];
       };
       if( thisMult == 0.0 )
@@ -703,32 +585,26 @@ __global__ void TridiagonalTranspositionCudaKernel( const Tridiagonal< Real2, De
 }*/
 #endif
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-   template< typename Real2, typename Index2 >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+template< typename Real2, typename Index2 >
 void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-getTransposition( const TridiagonalMatrixView< Real2, Device, Index2 >& matrix,
-                  const RealType& matrixMultiplicator )
+TridiagonalMatrixView< Real, Device, Index, Organization >::getTransposition(
+   const TridiagonalMatrixView< Real2, Device, Index2 >& matrix,
+   const RealType& matrixMultiplicator )
 {
    TNL_ASSERT( this->getRows() == matrix.getRows(),
                std::cerr << "This matrix rows: " << this->getRows() << std::endl
-                    << "That matrix rows: " << matrix.getRows() << std::endl );
-   if( std::is_same< Device, Devices::Host >::value )
-   {
+                         << "That matrix rows: " << matrix.getRows() << std::endl );
+   if( std::is_same< Device, Devices::Host >::value ) {
       const IndexType& rows = matrix.getRows();
-      for( IndexType i = 1; i < rows; i++ )
-      {
-         RealType aux = matrix. getElement( i, i - 1 );
+      for( IndexType i = 1; i < rows; i++ ) {
+         RealType aux = matrix.getElement( i, i - 1 );
          this->setElement( i, i - 1, matrix.getElement( i - 1, i ) );
          this->setElement( i, i, matrix.getElement( i, i ) );
          this->setElement( i - 1, i, aux );
       }
    }
-   if( std::is_same< Device, Devices::Cuda >::value )
-   {
+   if( std::is_same< Device, Devices::Cuda >::value ) {
 #ifdef HAVE_CUDA
       /*Tridiagonal* kernel_this = Cuda::passToDevice( *this );
       typedef  Tridiagonal< Real2, Device, Index2 > InMatrixType;
@@ -753,41 +629,30 @@ getTransposition( const TridiagonalMatrixView< Real2, Device, Index2 >& matrix,
    }
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-void TridiagonalMatrixView< Real, Device, Index, Organization >::save( File& file ) const
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+void
+TridiagonalMatrixView< Real, Device, Index, Organization >::save( File& file ) const
 {
    MatrixView< Real, Device, Index >::save( file );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 void
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-save( const String& fileName ) const
+TridiagonalMatrixView< Real, Device, Index, Organization >::save( const String& fileName ) const
 {
    Object::save( fileName );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
-void TridiagonalMatrixView< Real, Device, Index, Organization >::print( std::ostream& str ) const
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
+void
+TridiagonalMatrixView< Real, Device, Index, Organization >::print( std::ostream& str ) const
 {
-   for( IndexType row = 0; row < this->getRows(); row++ )
-   {
-      str <<"Row: " << row << " -> ";
+   for( IndexType row = 0; row < this->getRows(); row++ ) {
+      str << "Row: " << row << " -> ";
       for( IndexType column = row - 1; column < row + 2; column++ )
-         if( column >= 0 && column < this->columns )
-         {
+         if( column >= 0 && column < this->columns ) {
             auto value = this->getElement( row, column );
-            if( value )
-            {
+            if( value ) {
                std::stringstream str_;
                str_ << std::setw( 4 ) << std::right << column << ":" << std::setw( 4 ) << std::left << value;
                str << std::setw( 10 ) << str_.str();
@@ -797,38 +662,26 @@ void TridiagonalMatrixView< Real, Device, Index, Organization >::print( std::ost
    }
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
 auto
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-getIndexer() const -> const IndexerType&
+TridiagonalMatrixView< Real, Device, Index, Organization >::getIndexer() const -> const IndexerType&
 {
    return this->indexer;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
 auto
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-getIndexer() -> IndexerType&
+TridiagonalMatrixView< Real, Device, Index, Organization >::getIndexer() -> IndexerType&
 {
    return this->indexer;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
 Index
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-getElementIndex( const IndexType row, const IndexType column ) const
+TridiagonalMatrixView< Real, Device, Index, Organization >::getElementIndex( const IndexType row, const IndexType column ) const
 {
    IndexType localIdx = column - row + 1;
 
@@ -838,18 +691,13 @@ getElementIndex( const IndexType row, const IndexType column ) const
    return this->indexer.getGlobalIndex( row, localIdx );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          ElementsOrganization Organization >
+template< typename Real, typename Device, typename Index, ElementsOrganization Organization >
 __cuda_callable__
 Index
-TridiagonalMatrixView< Real, Device, Index, Organization >::
-getPaddingIndex() const
+TridiagonalMatrixView< Real, Device, Index, Organization >::getPaddingIndex() const
 {
    return -1;
 }
 
-
-} // namespace Matrices
-} // namespace TNL
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/details/DenseMatrix.h b/src/TNL/Matrices/details/DenseMatrix.h
index 0413622d8bae1d3e9bc8154374e4d89229de0653..7b0d529a72c2ab7ac98452b4ca8343f8313b1f17 100644
--- a/src/TNL/Matrices/details/DenseMatrix.h
+++ b/src/TNL/Matrices/details/DenseMatrix.h
@@ -7,55 +7,45 @@
 #pragma once
 
 namespace TNL {
-   namespace Matrices {
-      namespace details {
+namespace Matrices {
+namespace details {
 
 template< typename Device >
 class DenseDeviceDependentCode;
 template<>
 class DenseDeviceDependentCode< Devices::Host >
 {
-   public:
-
-      typedef Devices::Host Device;
-
-      template< typename Real,
-                typename Index,
-                bool RowMajorOrder,
-                typename RealAllocator,
-                typename InVector,
-                typename OutVector >
-      static void vectorProduct( const DenseMatrixView< Real, Device, Index, RowMajorOrder >& matrix,
-                                 const InVector& inVector,
-                                 OutVector& outVector )
-      {
+public:
+   typedef Devices::Host Device;
+
+   template< typename Real, typename Index, bool RowMajorOrder, typename RealAllocator, typename InVector, typename OutVector >
+   static void
+   vectorProduct( const DenseMatrixView< Real, Device, Index, RowMajorOrder >& matrix,
+                  const InVector& inVector,
+                  OutVector& outVector )
+   {
 #ifdef HAVE_OPENMP
 #pragma omp parallel for if( Devices::Host::isOMPEnabled() )
 #endif
-         for( Index row = 0; row < matrix.getRows(); row ++ )
-            outVector[ row ] = matrix.rowVectorProduct( row, inVector );
-      }
+      for( Index row = 0; row < matrix.getRows(); row++ )
+         outVector[ row ] = matrix.rowVectorProduct( row, inVector );
+   }
 };
 
 template<>
 class DenseDeviceDependentCode< Devices::Cuda >
 {
-   public:
-
-      typedef Devices::Cuda Device;
-
-      template< typename Real,
-                typename Index,
-                bool RowMajorOrder,
-                typename RealAllocator,
-                typename InVector,
-                typename OutVector >
-      static void vectorProduct( const DenseMatrixView< Real, Device, Index, RowMajorOrder >& matrix,
-                                 const InVector& inVector,
-                                 OutVector& outVector )
-      {
-         MatrixVectorProductCuda( matrix, inVector, outVector );
-      }
+public:
+   typedef Devices::Cuda Device;
+
+   template< typename Real, typename Index, bool RowMajorOrder, typename RealAllocator, typename InVector, typename OutVector >
+   static void
+   vectorProduct( const DenseMatrixView< Real, Device, Index, RowMajorOrder >& matrix,
+                  const InVector& inVector,
+                  OutVector& outVector )
+   {
+      MatrixVectorProductCuda( matrix, inVector, outVector );
+   }
 };
 
 #ifdef HAVE_CUDA
@@ -67,7 +57,8 @@ template< typename Real,
           typename Matrix2,
           int tileDim,
           int tileRowBlockSize >
-__global__ void
+__global__
+void
 DenseMatrixProductKernel( Dense< Real, Devices::Cuda, Index, RowMajorOrder >* resultMatrix,
                           const Matrix1* matrixA,
                           const Matrix2* matrixB,
@@ -83,9 +74,9 @@ DenseMatrixProductKernel( Dense< Real, Devices::Cuda, Index, RowMajorOrder >* re
 
    typedef Index IndexType;
    typedef Real RealType;
-   __shared__ Real tileA[ tileDim*tileDim ];
-   __shared__ Real tileB[ tileDim*tileDim ];
-   __shared__ Real tileC[ tileDim*tileDim ];
+   __shared__ Real tileA[ tileDim * tileDim ];
+   __shared__ Real tileB[ tileDim * tileDim ];
+   __shared__ Real tileC[ tileDim * tileDim ];
 
    const IndexType& matrixARows = matrixA->getRows();
    const IndexType& matrixAColumns = matrixA->getColumns();
@@ -96,31 +87,29 @@ DenseMatrixProductKernel( Dense< Real, Devices::Cuda, Index, RowMajorOrder >* re
     * Reset the tile C
     */
    for( IndexType row = 0; row < tileDim; row += tileRowBlockSize )
-      tileC[ ( row + threadIdx.y )*tileDim + threadIdx.x ] = 0.0;
+      tileC[ ( row + threadIdx.y ) * tileDim + threadIdx.x ] = 0.0;
 
    /****
     * Compute the result tile coordinates
     */
-   const IndexType resultTileRow = ( gridIdx_y*gridDim.y + blockIdx.y )*tileDim;
-   const IndexType resultTileColumn = ( gridIdx_x*gridDim.x + blockIdx.x )*tileDim;
+   const IndexType resultTileRow = ( gridIdx_y * gridDim.y + blockIdx.y ) * tileDim;
+   const IndexType resultTileColumn = ( gridIdx_x * gridDim.x + blockIdx.x ) * tileDim;
 
    /****
     * Sum over the matrix tiles
     */
-   for( IndexType i = 0; i < matrixAColumns; i += tileDim )
-   {
-      for( IndexType row = 0; row < tileDim; row += tileRowBlockSize )
-      {
+   for( IndexType i = 0; i < matrixAColumns; i += tileDim ) {
+      for( IndexType row = 0; row < tileDim; row += tileRowBlockSize ) {
          const IndexType matrixARow = resultTileRow + threadIdx.y + row;
          const IndexType matrixAColumn = i + threadIdx.x;
          if( matrixARow < matrixARows && matrixAColumn < matrixAColumns )
-            tileA[ (threadIdx.y + row)*tileDim + threadIdx.x ] =
-               matrixAMultiplicator * matrixA->getElementFast( matrixARow,  matrixAColumn );
+            tileA[ ( threadIdx.y + row ) * tileDim + threadIdx.x ] =
+               matrixAMultiplicator * matrixA->getElementFast( matrixARow, matrixAColumn );
 
          const IndexType matrixBRow = i + threadIdx.y + row;
          const IndexType matrixBColumn = resultTileColumn + threadIdx.x;
          if( matrixBRow < matrixBRows && matrixBColumn < matrixBColumns )
-            tileB[ (threadIdx.y + row)*tileDim + threadIdx.x ] =
+            tileB[ ( threadIdx.y + row ) * tileDim + threadIdx.x ] =
                matrixBMultiplicator * matrixB->getElementFast( matrixBRow, matrixBColumn );
       }
       __syncthreads();
@@ -128,16 +117,13 @@ DenseMatrixProductKernel( Dense< Real, Devices::Cuda, Index, RowMajorOrder >* re
       const IndexType tileALastRow = tnlCudaMin( tileDim, matrixARows - resultTileRow );
       const IndexType tileALastColumn = tnlCudaMin( tileDim, matrixAColumns - i );
       const IndexType tileBLastRow = tnlCudaMin( tileDim, matrixBRows - i );
-      const IndexType tileBLastColumn =
-         tnlCudaMin( tileDim, matrixBColumns - resultTileColumn );
+      const IndexType tileBLastColumn = tnlCudaMin( tileDim, matrixBColumns - resultTileColumn );
 
-      for( IndexType row = 0; row < tileALastRow; row += tileRowBlockSize )
-      {
+      for( IndexType row = 0; row < tileALastRow; row += tileRowBlockSize ) {
          RealType sum( 0.0 );
          for( IndexType j = 0; j < tileALastColumn; j++ )
-            sum += tileA[ ( threadIdx.y + row )*tileDim + j ]*
-                      tileB[ j*tileDim + threadIdx.x ];
-         tileC[ ( row + threadIdx.y )*tileDim + threadIdx.x ] += sum;
+            sum += tileA[ ( threadIdx.y + row ) * tileDim + j ] * tileB[ j * tileDim + threadIdx.x ];
+         tileC[ ( row + threadIdx.y ) * tileDim + threadIdx.x ] += sum;
       }
       __syncthreads();
    }
@@ -147,16 +133,12 @@ DenseMatrixProductKernel( Dense< Real, Devices::Cuda, Index, RowMajorOrder >* re
     */
    const IndexType& matrixCRows = resultMatrix->getRows();
    const IndexType& matrixCColumns = resultMatrix->getColumns();
-   for( IndexType row = 0; row < tileDim; row += tileRowBlockSize )
-   {
+   for( IndexType row = 0; row < tileDim; row += tileRowBlockSize ) {
       const IndexType matrixCRow = resultTileRow + row + threadIdx.y;
       const IndexType matrixCColumn = resultTileColumn + threadIdx.x;
       if( matrixCRow < matrixCRows && matrixCColumn < matrixCColumns )
-         resultMatrix->setElementFast( matrixCRow,
-                                       matrixCColumn,
-                                       tileC[ ( row + threadIdx.y )*tileDim + threadIdx.x ] );
+         resultMatrix->setElementFast( matrixCRow, matrixCColumn, tileC[ ( row + threadIdx.y ) * tileDim + threadIdx.x ] );
    }
-
 }
 
 template< typename Real,
@@ -166,30 +148,29 @@ template< typename Real,
           typename RealAllocator,
           int tileDim,
           int tileRowBlockSize >
-__global__ void DenseTranspositionAlignedKernel( Dense< Real, Devices::Cuda, Index >* resultMatrix,
-                                                          const Matrix* inputMatrix,
-                                                          const Real matrixMultiplicator,
-                                                          const Index gridIdx_x,
-                                                          const Index gridIdx_y )
+__global__
+void
+DenseTranspositionAlignedKernel( Dense< Real, Devices::Cuda, Index >* resultMatrix,
+                                 const Matrix* inputMatrix,
+                                 const Real matrixMultiplicator,
+                                 const Index gridIdx_x,
+                                 const Index gridIdx_y )
 {
-   __shared__ Real tile[ tileDim*tileDim ];
+   __shared__ Real tile[ tileDim * tileDim ];
 
    const Index columns = inputMatrix->getColumns();
    const Index rows = inputMatrix->getRows();
 
-
    /****
     * Diagonal mapping of the CUDA blocks
     */
    Index blockIdx_x, blockIdx_y;
-   if( columns == rows )
-   {
+   if( columns == rows ) {
       blockIdx_y = blockIdx.x;
-      blockIdx_x = (blockIdx.x+blockIdx.y)%gridDim.x;
+      blockIdx_x = ( blockIdx.x + blockIdx.y ) % gridDim.x;
    }
-   else
-   {
-      Index bID = blockIdx.x + gridDim.x*blockIdx.y;
+   else {
+      Index bID = blockIdx.x + gridDim.x * blockIdx.y;
       blockIdx_y = bID % gridDim.y;
       blockIdx_x = ( ( bID / gridDim.y ) + blockIdx_y ) % gridDim.x;
    }
@@ -197,37 +178,25 @@ __global__ void DenseTranspositionAlignedKernel( Dense< Real, Devices::Cuda, Ind
    /****
     * Read the tile to the shared memory
     */
-   const Index readRowPosition =
-      ( gridIdx_y*gridDim.y + blockIdx_y )*tileDim + threadIdx.y;
-   const Index readColumnPosition =
-      ( gridIdx_x*gridDim.x + blockIdx_x )*tileDim + threadIdx.x;
-   for( Index rowBlock = 0;
-        rowBlock < tileDim;
-        rowBlock += tileRowBlockSize )
-   {
-      tile[ Cuda::getInterleaving( threadIdx.x*tileDim +  threadIdx.y + rowBlock ) ] =
-               inputMatrix->getElementFast( readColumnPosition,
-                                            readRowPosition + rowBlock );
+   const Index readRowPosition = ( gridIdx_y * gridDim.y + blockIdx_y ) * tileDim + threadIdx.y;
+   const Index readColumnPosition = ( gridIdx_x * gridDim.x + blockIdx_x ) * tileDim + threadIdx.x;
+   for( Index rowBlock = 0; rowBlock < tileDim; rowBlock += tileRowBlockSize ) {
+      tile[ Cuda::getInterleaving( threadIdx.x * tileDim + threadIdx.y + rowBlock ) ] =
+         inputMatrix->getElementFast( readColumnPosition, readRowPosition + rowBlock );
    }
    __syncthreads();
 
    /****
     * Write the tile to the global memory
     */
-   const Index writeRowPosition =
-      ( gridIdx_x*gridDim.x + blockIdx_x )*tileDim + threadIdx.y;
-   const Index writeColumnPosition =
-      ( gridIdx_y*gridDim.y + blockIdx_y )*tileDim + threadIdx.x;
-   for( Index rowBlock = 0;
-        rowBlock < tileDim;
-        rowBlock += tileRowBlockSize )
-   {
+   const Index writeRowPosition = ( gridIdx_x * gridDim.x + blockIdx_x ) * tileDim + threadIdx.y;
+   const Index writeColumnPosition = ( gridIdx_y * gridDim.y + blockIdx_y ) * tileDim + threadIdx.x;
+   for( Index rowBlock = 0; rowBlock < tileDim; rowBlock += tileRowBlockSize ) {
       resultMatrix->setElementFast( writeColumnPosition,
                                     writeRowPosition + rowBlock,
-                                    matrixMultiplicator * tile[ Cuda::getInterleaving( ( threadIdx.y + rowBlock ) * tileDim + threadIdx.x ) ] );
-
+                                    matrixMultiplicator
+                                       * tile[ Cuda::getInterleaving( ( threadIdx.y + rowBlock ) * tileDim + threadIdx.x ) ] );
    }
-
 }
 
 template< typename Real,
@@ -237,13 +206,15 @@ template< typename Real,
           typename Matrix,
           int tileDim,
           int tileRowBlockSize >
-__global__ void DenseTranspositionNonAlignedKernel( Dense< Real, Devices::Cuda, Index >* resultMatrix,
-                                                             const Matrix* inputMatrix,
-                                                             const Real matrixMultiplicator,
-                                                             const Index gridIdx_x,
-                                                             const Index gridIdx_y )
+__global__
+void
+DenseTranspositionNonAlignedKernel( Dense< Real, Devices::Cuda, Index >* resultMatrix,
+                                    const Matrix* inputMatrix,
+                                    const Real matrixMultiplicator,
+                                    const Index gridIdx_x,
+                                    const Index gridIdx_y )
 {
-   __shared__ Real tile[ tileDim*tileDim ];
+   __shared__ Real tile[ tileDim * tileDim ];
 
    const Index columns = inputMatrix->getColumns();
    const Index rows = inputMatrix->getRows();
@@ -252,14 +223,12 @@ __global__ void DenseTranspositionNonAlignedKernel( Dense< Real, Devices::Cuda,
     * Diagonal mapping of the CUDA blocks
     */
    Index blockIdx_x, blockIdx_y;
-   if( columns == rows )
-   {
+   if( columns == rows ) {
       blockIdx_y = blockIdx.x;
-      blockIdx_x = (blockIdx.x+blockIdx.y)%gridDim.x;
+      blockIdx_x = ( blockIdx.x + blockIdx.y ) % gridDim.x;
    }
-   else
-   {
-      Index bID = blockIdx.x + gridDim.x*blockIdx.y;
+   else {
+      Index bID = blockIdx.x + gridDim.x * blockIdx.y;
       blockIdx_y = bID % gridDim.y;
       blockIdx_x = ( ( bID / gridDim.y ) + blockIdx_y ) % gridDim.x;
    }
@@ -267,21 +236,14 @@ __global__ void DenseTranspositionNonAlignedKernel( Dense< Real, Devices::Cuda,
    /****
     * Read the tile to the shared memory
     */
-   const Index readRowPosition =
-      ( gridIdx_y*gridDim.y + blockIdx_y )*tileDim + threadIdx.y;
-   const Index readColumnPosition =
-      ( gridIdx_x*gridDim.x + blockIdx_x )*tileDim + threadIdx.x;
-   if( readColumnPosition < columns )
-   {
+   const Index readRowPosition = ( gridIdx_y * gridDim.y + blockIdx_y ) * tileDim + threadIdx.y;
+   const Index readColumnPosition = ( gridIdx_x * gridDim.x + blockIdx_x ) * tileDim + threadIdx.x;
+   if( readColumnPosition < columns ) {
       const Index readOffset = readRowPosition * columns + readColumnPosition;
-      for( Index rowBlock = 0;
-           rowBlock < tileDim;
-           rowBlock += tileRowBlockSize )
-      {
+      for( Index rowBlock = 0; rowBlock < tileDim; rowBlock += tileRowBlockSize ) {
          if( readRowPosition + rowBlock < rows )
-            tile[ Cuda::getInterleaving( threadIdx.x*tileDim +  threadIdx.y + rowBlock ) ] =
-               inputMatrix->getElementFast( readColumnPosition,
-                                            readRowPosition + rowBlock );
+            tile[ Cuda::getInterleaving( threadIdx.x * tileDim + threadIdx.y + rowBlock ) ] =
+               inputMatrix->getElementFast( readColumnPosition, readRowPosition + rowBlock );
       }
    }
    __syncthreads();
@@ -289,28 +251,22 @@ __global__ void DenseTranspositionNonAlignedKernel( Dense< Real, Devices::Cuda,
    /****
     * Write the tile to the global memory
     */
-   const Index writeRowPosition =
-      ( gridIdx_x*gridDim.x + blockIdx_x )*tileDim + threadIdx.y;
-   const Index writeColumnPosition =
-      ( gridIdx_y*gridDim.y + blockIdx_y )*tileDim + threadIdx.x;
-   if( writeColumnPosition < rows )
-   {
+   const Index writeRowPosition = ( gridIdx_x * gridDim.x + blockIdx_x ) * tileDim + threadIdx.y;
+   const Index writeColumnPosition = ( gridIdx_y * gridDim.y + blockIdx_y ) * tileDim + threadIdx.x;
+   if( writeColumnPosition < rows ) {
       const Index writeOffset = writeRowPosition * rows + writeColumnPosition;
-      for( Index rowBlock = 0;
-           rowBlock < tileDim;
-           rowBlock += tileRowBlockSize )
-      {
+      for( Index rowBlock = 0; rowBlock < tileDim; rowBlock += tileRowBlockSize ) {
          if( writeRowPosition + rowBlock < columns )
-            resultMatrix->setElementFast( writeColumnPosition,
-                                          writeRowPosition + rowBlock,
-                                          matrixMultiplicator * tile[ Cuda::getInterleaving( ( threadIdx.y + rowBlock ) * tileDim + threadIdx.x ) ] );
+            resultMatrix->setElementFast(
+               writeColumnPosition,
+               writeRowPosition + rowBlock,
+               matrixMultiplicator * tile[ Cuda::getInterleaving( ( threadIdx.y + rowBlock ) * tileDim + threadIdx.x ) ] );
       }
    }
-
 }
 
 #endif
 
-      } //namespace details
-   } //namepsace Matrices
-} //namespace TNL
\ No newline at end of file
+}  // namespace details
+}  // namespace Matrices
+}  // namespace TNL
\ No newline at end of file
diff --git a/src/TNL/Matrices/details/MultidiagonalMatrixIndexer.h b/src/TNL/Matrices/details/MultidiagonalMatrixIndexer.h
index 766f478e3435a44ce812cb268b8a80caa2af1482..6223d9f0636f4696af8ad3038bbfcab6511fc8ab 100644
--- a/src/TNL/Matrices/details/MultidiagonalMatrixIndexer.h
+++ b/src/TNL/Matrices/details/MultidiagonalMatrixIndexer.h
@@ -7,85 +7,98 @@
 #pragma once
 
 namespace TNL {
-   namespace Matrices {
-      namespace details {
+namespace Matrices {
+namespace details {
 
-template< typename Index,
-          bool RowMajorOrder >
+template< typename Index, bool RowMajorOrder >
 class MultidiagonalMatrixIndexer
 {
-   public:
-
-      using IndexType = Index;
-      using ConstType = MultidiagonalMatrixIndexer< std::add_const_t< Index >, RowMajorOrder >;
-
-      static constexpr bool getRowMajorOrder() { return RowMajorOrder; };
-
-      __cuda_callable__
-      MultidiagonalMatrixIndexer()
-      : rows( 0 ), columns( 0 ), nonemptyRows( 0 ){};
-
-      __cuda_callable__
-      MultidiagonalMatrixIndexer( const IndexType& rows,
-                                  const IndexType& columns,
-                                  const IndexType& diagonals,
-                                  const IndexType& nonemptyRows )
-      : rows( rows ),
-        columns( columns ),
-        diagonals( diagonals ),
-        nonemptyRows( nonemptyRows ) {};
-
-      __cuda_callable__
-      MultidiagonalMatrixIndexer( const MultidiagonalMatrixIndexer& indexer )
-      : rows( indexer.rows ),
-        columns( indexer.columns ),
-        diagonals( indexer.diagonals ),
-        nonemptyRows( indexer.nonemptyRows ) {};
-
-      void set( const IndexType& rows,
-                const IndexType& columns,
-                const IndexType& diagonals,
-                const IndexType& nonemptyRows )
-      {
-         this->rows = rows;
-         this->columns = columns;
-         this->diagonals = diagonals;
-         this->nonemptyRows = nonemptyRows;
-      };
-
-      __cuda_callable__
-      const IndexType& getRows() const { return this->rows; };
-
-      __cuda_callable__
-      const IndexType& getColumns() const { return this->columns; };
-
-      __cuda_callable__
-      const IndexType& getDiagonals() const { return this->diagonals; };
-
-      __cuda_callable__
-      const IndexType& getNonemptyRowsCount() const { return this->nonemptyRows; };
-
-      __cuda_callable__
-      IndexType getStorageSize() const { return diagonals * this->nonemptyRows; };
-
-      __cuda_callable__
-      IndexType getGlobalIndex( const Index rowIdx, const Index localIdx ) const
-      {
-         TNL_ASSERT_GE( localIdx, 0, "" );
-         TNL_ASSERT_LT( localIdx, diagonals, "" );
-         TNL_ASSERT_GE( rowIdx, 0, "" );
-         TNL_ASSERT_LT( rowIdx, this->rows, "" );
-
-         if( RowMajorOrder )
-            return diagonals * rowIdx + localIdx;
-         else
-            return localIdx * nonemptyRows + rowIdx;
-      };
-
-      protected:
-
-         IndexType rows, columns, diagonals, nonemptyRows;
+public:
+   using IndexType = Index;
+   using ConstType = MultidiagonalMatrixIndexer< std::add_const_t< Index >, RowMajorOrder >;
+
+   static constexpr bool
+   getRowMajorOrder()
+   {
+      return RowMajorOrder;
+   };
+
+   __cuda_callable__
+   MultidiagonalMatrixIndexer() : rows( 0 ), columns( 0 ), nonemptyRows( 0 ){};
+
+   __cuda_callable__
+   MultidiagonalMatrixIndexer( const IndexType& rows,
+                               const IndexType& columns,
+                               const IndexType& diagonals,
+                               const IndexType& nonemptyRows )
+   : rows( rows ), columns( columns ), diagonals( diagonals ), nonemptyRows( nonemptyRows ){};
+
+   __cuda_callable__
+   MultidiagonalMatrixIndexer( const MultidiagonalMatrixIndexer& indexer )
+   : rows( indexer.rows ), columns( indexer.columns ), diagonals( indexer.diagonals ), nonemptyRows( indexer.nonemptyRows ){};
+
+   void
+   set( const IndexType& rows, const IndexType& columns, const IndexType& diagonals, const IndexType& nonemptyRows )
+   {
+      this->rows = rows;
+      this->columns = columns;
+      this->diagonals = diagonals;
+      this->nonemptyRows = nonemptyRows;
+   };
+
+   __cuda_callable__
+   const IndexType&
+   getRows() const
+   {
+      return this->rows;
+   };
+
+   __cuda_callable__
+   const IndexType&
+   getColumns() const
+   {
+      return this->columns;
+   };
+
+   __cuda_callable__
+   const IndexType&
+   getDiagonals() const
+   {
+      return this->diagonals;
+   };
+
+   __cuda_callable__
+   const IndexType&
+   getNonemptyRowsCount() const
+   {
+      return this->nonemptyRows;
+   };
+
+   __cuda_callable__
+   IndexType
+   getStorageSize() const
+   {
+      return diagonals * this->nonemptyRows;
+   };
+
+   __cuda_callable__
+   IndexType
+   getGlobalIndex( const Index rowIdx, const Index localIdx ) const
+   {
+      TNL_ASSERT_GE( localIdx, 0, "" );
+      TNL_ASSERT_LT( localIdx, diagonals, "" );
+      TNL_ASSERT_GE( rowIdx, 0, "" );
+      TNL_ASSERT_LT( rowIdx, this->rows, "" );
+
+      if( RowMajorOrder )
+         return diagonals * rowIdx + localIdx;
+      else
+         return localIdx * nonemptyRows + rowIdx;
+   };
+
+protected:
+   IndexType rows, columns, diagonals, nonemptyRows;
 };
-      } //namespace details
-   } // namespace Matrices
-} // namespace TNL
+}  // namespace details
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/details/SparseMatrix.h b/src/TNL/Matrices/details/SparseMatrix.h
index 64f25a90547151231ec59e70552509b0006ef747..93fc4db253b2a38f822b9c9a3bfc9e54f447b25b 100644
--- a/src/TNL/Matrices/details/SparseMatrix.h
+++ b/src/TNL/Matrices/details/SparseMatrix.h
@@ -9,23 +9,23 @@
 #include <TNL/TypeTraits.h>
 
 namespace TNL {
-   namespace Matrices {
-      namespace details {
+namespace Matrices {
+namespace details {
 
-template< typename VectorOrView,
-          std::enable_if_t< HasSetSizeMethod< VectorOrView >::value, bool > = true >
-static void set_size_if_resizable( VectorOrView& v, typename VectorOrView::IndexType size )
+template< typename VectorOrView, std::enable_if_t< HasSetSizeMethod< VectorOrView >::value, bool > = true >
+static void
+set_size_if_resizable( VectorOrView& v, typename VectorOrView::IndexType size )
 {
    v.setSize( size );
 }
 
-template< typename VectorOrView,
-          std::enable_if_t< ! HasSetSizeMethod< VectorOrView >::value, bool > = true >
-static void set_size_if_resizable( VectorOrView& v, typename VectorOrView::IndexType size )
+template< typename VectorOrView, std::enable_if_t< ! HasSetSizeMethod< VectorOrView >::value, bool > = true >
+static void
+set_size_if_resizable( VectorOrView& v, typename VectorOrView::IndexType size )
 {
    TNL_ASSERT_EQ( v.getSize(), size, "view has wrong size" );
 }
 
-      } //namespace details
-   } //namepsace Matrices
-} //namespace TNL
+}  // namespace details
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/details/SparseMatrixRowViewValueGetter.h b/src/TNL/Matrices/details/SparseMatrixRowViewValueGetter.h
index 93dba41a4bb92176e51f4918d2599f000a28c728..87db4469aa218c604ff61614899f51b531eb4ca7 100644
--- a/src/TNL/Matrices/details/SparseMatrixRowViewValueGetter.h
+++ b/src/TNL/Matrices/details/SparseMatrixRowViewValueGetter.h
@@ -9,21 +9,18 @@
 #pragma once
 
 namespace TNL {
-   namespace Matrices {
-      namespace details {
-
+namespace Matrices {
+namespace details {
 
 template< typename SegmentView,
           typename ValuesView,
           typename ColumnsIndexesView,
-          typename Real = std::remove_const_t<typename ValuesView::RealType >,
-          bool isBinary_ = std::is_same< std::remove_const_t<typename ValuesView::RealType >, bool >::value >
-struct SparseMatrixRowViewValueGetter {};
+          typename Real = std::remove_const_t< typename ValuesView::RealType >,
+          bool isBinary_ = std::is_same< std::remove_const_t< typename ValuesView::RealType >, bool >::value >
+struct SparseMatrixRowViewValueGetter
+{};
 
-template< typename SegmentView,
-          typename ValuesView,
-          typename ColumnsIndexesView,
-          typename Real >
+template< typename SegmentView, typename ValuesView, typename ColumnsIndexesView, typename Real >
 struct SparseMatrixRowViewValueGetter< SegmentView, ValuesView, ColumnsIndexesView, Real, true >
 {
    using RealType = typename ValuesView::RealType;
@@ -35,18 +32,17 @@ struct SparseMatrixRowViewValueGetter< SegmentView, ValuesView, ColumnsIndexesVi
    using ConstResultType = bool;
 
    __cuda_callable__
-   static bool getValue( const IndexType& globalIdx, const ValuesView& values, const ColumnsIndexesView& columnIndexes, const IndexType& paddingIndex )
+   static bool
+   getValue( const IndexType& globalIdx,
+             const ValuesView& values,
+             const ColumnsIndexesView& columnIndexes,
+             const IndexType& paddingIndex )
    {
-      if( columnIndexes[ globalIdx ] != paddingIndex )
-         return true;
-      return false;
+      return columnIndexes[ globalIdx ] != paddingIndex;
    };
 };
 
-template< typename SegmentView,
-          typename ValuesView,
-          typename ColumnsIndexesView,
-          typename Real >
+template< typename SegmentView, typename ValuesView, typename ColumnsIndexesView, typename Real >
 struct SparseMatrixRowViewValueGetter< SegmentView, ValuesView, ColumnsIndexesView, Real, false >
 {
    using RealType = typename ValuesView::RealType;
@@ -58,18 +54,23 @@ struct SparseMatrixRowViewValueGetter< SegmentView, ValuesView, ColumnsIndexesVi
    using ConstResultType = const RealType&;
 
    __cuda_callable__
-   static const RealType& getValue( const IndexType& globalIdx, const ValuesView& values, const ColumnsIndexesView& columnIndexes, const IndexType& paddingIndex )
+   static const RealType&
+   getValue( const IndexType& globalIdx,
+             const ValuesView& values,
+             const ColumnsIndexesView& columnIndexes,
+             const IndexType& paddingIndex )
    {
       return values[ globalIdx ];
    };
 
    __cuda_callable__
-   static RealType& getValue( const IndexType& globalIdx, ValuesView& values, ColumnsIndexesView& columnIndexes, const IndexType& paddingIndex )
+   static RealType&
+   getValue( const IndexType& globalIdx, ValuesView& values, ColumnsIndexesView& columnIndexes, const IndexType& paddingIndex )
    {
       return values[ globalIdx ];
    };
 };
 
-      } //namespace details
-   } //namepsace Matrices
-} //namespace TNL
+}  // namespace details
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Matrices/details/TridiagonalMatrixIndexer.h b/src/TNL/Matrices/details/TridiagonalMatrixIndexer.h
index 1a3f63d388edd7f8b2c238fa43d176af1cd7353a..d040cabe70d37a13dd534bf3721df27b7b18c812 100644
--- a/src/TNL/Matrices/details/TridiagonalMatrixIndexer.h
+++ b/src/TNL/Matrices/details/TridiagonalMatrixIndexer.h
@@ -6,75 +6,100 @@
 
 #pragma once
 
+#include <TNL/Algorithms/Segments/ElementsOrganization.h>
+
 namespace TNL {
-   namespace Matrices {
-      namespace details {
+namespace Matrices {
+namespace details {
 
-template< typename Index,
-          bool RowMajorOrder >
+template< typename Index, Algorithms::Segments::ElementsOrganization Organization >
 class TridiagonalMatrixIndexer
 {
-   public:
-
-      using IndexType = Index;
-      using ConstType = TridiagonalMatrixIndexer< std::add_const_t< Index >, RowMajorOrder >;
-
-      static constexpr bool getRowMajorOrder() { return RowMajorOrder; };
-
-      __cuda_callable__
-      TridiagonalMatrixIndexer()
-      : rows( 0 ), columns( 0 ), nonemptyRows( 0 ){};
-
-      __cuda_callable__
-      TridiagonalMatrixIndexer( const IndexType& rows, const IndexType& columns )
-      : rows( rows ), columns( columns ), nonemptyRows( TNL::min( rows, columns ) + ( rows > columns ) ) {};
-
-      __cuda_callable__
-      TridiagonalMatrixIndexer( const TridiagonalMatrixIndexer& indexer )
-      : rows( indexer.rows ), columns( indexer.columns ), nonemptyRows( indexer.nonemptyRows ) {};
-
-      void setDimensions( const IndexType& rows, const IndexType& columns )
-      {
-         this->rows = rows;
-         this->columns = columns;
-         this->nonemptyRows = min( rows, columns ) + ( rows > columns );
-      };
-
-      __cuda_callable__
-      IndexType getRowSize( const IndexType rowIdx ) const
-      {
-         return 3;
-      };
-
-      __cuda_callable__
-      const IndexType& getRows() const { return this->rows; };
-
-      __cuda_callable__
-      const IndexType& getColumns() const { return this->columns; };
-
-      __cuda_callable__
-      const IndexType& getNonemptyRowsCount() const { return this->nonemptyRows; };
-      __cuda_callable__
-      IndexType getStorageSize() const { return 3 * this->nonemptyRows; };
-
-      __cuda_callable__
-      IndexType getGlobalIndex( const Index rowIdx, const Index localIdx ) const
-      {
-         TNL_ASSERT_GE( localIdx, 0, "" );
-         TNL_ASSERT_LT( localIdx, 3, "" );
-         TNL_ASSERT_GE( rowIdx, 0, "" );
-         TNL_ASSERT_LT( rowIdx, this->rows, "" );
-
-         if( RowMajorOrder )
-            return 3 * rowIdx + localIdx;
-         else
-            return localIdx * nonemptyRows + rowIdx;
-      };
-
-      protected:
-
-         IndexType rows, columns, nonemptyRows;
+public:
+   using IndexType = Index;
+   using ConstType = TridiagonalMatrixIndexer< std::add_const_t< Index >, Organization >;
+
+   static constexpr bool
+   getRowMajorOrder()
+   {
+      return Organization == Algorithms::Segments::RowMajorOrder;
+   }
+
+   __cuda_callable__
+   TridiagonalMatrixIndexer() : rows( 0 ), columns( 0 ), nonemptyRows( 0 ) {}
+
+   __cuda_callable__
+   TridiagonalMatrixIndexer( const IndexType& rows, const IndexType& columns )
+   : rows( rows ), columns( columns ), nonemptyRows( TNL::min( rows, columns ) + ( rows > columns ) )
+   {}
+
+   __cuda_callable__
+   TridiagonalMatrixIndexer( const TridiagonalMatrixIndexer& indexer )
+   : rows( indexer.rows ), columns( indexer.columns ), nonemptyRows( indexer.nonemptyRows )
+   {}
+
+   void
+   setDimensions( const IndexType& rows, const IndexType& columns )
+   {
+      this->rows = rows;
+      this->columns = columns;
+      this->nonemptyRows = min( rows, columns ) + ( rows > columns );
+   }
+
+   __cuda_callable__
+   IndexType
+   getRowSize( const IndexType rowIdx ) const
+   {
+      return 3;
+   }
+
+   __cuda_callable__
+   const IndexType&
+   getRows() const
+   {
+      return this->rows;
+   }
+
+   __cuda_callable__
+   const IndexType&
+   getColumns() const
+   {
+      return this->columns;
+   }
+
+   __cuda_callable__
+   const IndexType&
+   getNonemptyRowsCount() const
+   {
+      return this->nonemptyRows;
+   }
+
+   __cuda_callable__
+   IndexType
+   getStorageSize() const
+   {
+      return 3 * this->nonemptyRows;
+   }
+
+   __cuda_callable__
+   IndexType
+   getGlobalIndex( const Index rowIdx, const Index localIdx ) const
+   {
+      TNL_ASSERT_GE( localIdx, 0, "" );
+      TNL_ASSERT_LT( localIdx, 3, "" );
+      TNL_ASSERT_GE( rowIdx, 0, "" );
+      TNL_ASSERT_LT( rowIdx, this->rows, "" );
+
+      if( Organization == Algorithms::Segments::RowMajorOrder )
+         return 3 * rowIdx + localIdx;
+      else
+         return localIdx * nonemptyRows + rowIdx;
+   }
+
+protected:
+   IndexType rows, columns, nonemptyRows;
 };
-      } //namespace details
-   } // namespace Materices
-} // namespace TNL
+
+}  // namespace details
+}  // namespace Matrices
+}  // namespace TNL
diff --git a/src/TNL/Meshes/DefaultConfig.h b/src/TNL/Meshes/DefaultConfig.h
index bd1c556e7784af1671d6d07aa958b7efaaa5d26b..4b167de7fa8e4135da2901cd684849ec2a6129b2 100644
--- a/src/TNL/Meshes/DefaultConfig.h
+++ b/src/TNL/Meshes/DefaultConfig.h
@@ -38,18 +38,20 @@ struct DefaultConfig
    /****
     * Storage of subentities of mesh entities.
     */
-   static constexpr bool subentityStorage( int entityDimension, int subentityDimension )
+   static constexpr bool
+   subentityStorage( int entityDimension, int subentityDimension )
    {
       return true;
       // Subvertices must be stored for all entities which appear in other
       // subentity or superentity mappings.
-      //return SubentityDimension == 0;
+      // return SubentityDimension == 0;
    }
 
    /****
     * Storage of superentities of mesh entities.
     */
-   static constexpr bool superentityStorage( int entityDimension, int superentityDimension )
+   static constexpr bool
+   superentityStorage( int entityDimension, int superentityDimension )
    {
       return true;
    }
@@ -63,11 +65,12 @@ struct DefaultConfig
     *    - if dim(entity) < dim(face), the entities on which the tags are stored
     *      must be stored as subentities of faces
     */
-   static constexpr bool entityTagsStorage( int entityDimension )
+   static constexpr bool
+   entityTagsStorage( int entityDimension )
    {
-      return superentityStorage( meshDimension - 1, meshDimension ) &&
-             ( entityDimension >= meshDimension - 1 || subentityStorage( meshDimension - 1, entityDimension ) );
-      //return false;
+      return superentityStorage( meshDimension - 1, meshDimension )
+          && ( entityDimension >= meshDimension - 1 || subentityStorage( meshDimension - 1, entityDimension ) );
+      // return false;
    }
 
    /****
@@ -75,7 +78,8 @@ struct DefaultConfig
     *
     * If enabled, links from vertices to cells must be stored.
     */
-   static constexpr bool dualGraphStorage()
+   static constexpr bool
+   dualGraphStorage()
    {
       return true;
    }
@@ -87,5 +91,5 @@ struct DefaultConfig
    static constexpr int dualGraphMinCommonVertices = meshDimension;
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/DimensionTag.h b/src/TNL/Meshes/DimensionTag.h
index 6d7b4de9a12348cda7742958b517587bdb6646f6..f0db389c56cd0923f557741352fa2656f2d488ae 100644
--- a/src/TNL/Meshes/DimensionTag.h
+++ b/src/TNL/Meshes/DimensionTag.h
@@ -48,5 +48,5 @@ public:
    using Increment = DimensionTag< 1 >;
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/DistributedMeshes/BufferEntitiesHelper.h b/src/TNL/Meshes/DistributedMeshes/BufferEntitiesHelper.h
index c3c6a44c5cf5a5b17140a7013576dceadbdae055..dd12353ae0b3f7867590a75f63aa96607fc9c2e4 100644
--- a/src/TNL/Meshes/DistributedMeshes/BufferEntitiesHelper.h
+++ b/src/TNL/Meshes/DistributedMeshes/BufferEntitiesHelper.h
@@ -13,157 +13,138 @@ namespace TNL {
 namespace Meshes {
 namespace DistributedMeshes {
 
-
-template < typename MeshFunctionType,
-           typename PeriodicBoundariesMaskPointer,
-           int dim,
-           typename RealType=typename MeshFunctionType::MeshType::RealType,
-           typename Device=typename MeshFunctionType::MeshType::DeviceType,
-           typename Index=typename MeshFunctionType::MeshType::GlobalIndexType >
+template< typename MeshFunctionType,
+          typename PeriodicBoundariesMaskPointer,
+          int dim,
+          typename RealType = typename MeshFunctionType::MeshType::RealType,
+          typename Device = typename MeshFunctionType::MeshType::DeviceType,
+          typename Index = typename MeshFunctionType::MeshType::GlobalIndexType >
 class BufferEntitiesHelper;
 
-
-template < typename MeshFunctionType,
-           typename MaskPointer,
-           typename RealType,
-           typename Device,
-           typename Index >
+template< typename MeshFunctionType, typename MaskPointer, typename RealType, typename Device, typename Index >
 class BufferEntitiesHelper< MeshFunctionType, MaskPointer, 1, RealType, Device, Index >
 {
-   public:
-      static void BufferEntities(
-         MeshFunctionType& meshFunction,
-         const MaskPointer& maskPointer,
-         RealType* buffer,
-         bool isBoundary,
-         const Containers::StaticVector<1,Index>& begin,
-         const Containers::StaticVector<1,Index>& size,
-         bool tobuffer )
+public:
+   static void
+   BufferEntities( MeshFunctionType& meshFunction,
+                   const MaskPointer& maskPointer,
+                   RealType* buffer,
+                   bool isBoundary,
+                   const Containers::StaticVector< 1, Index >& begin,
+                   const Containers::StaticVector< 1, Index >& size,
+                   bool tobuffer )
+   {
+      Index beginx = begin.x();
+      Index sizex = size.x();
+
+      auto* mesh = &meshFunction.getMeshPointer().template getData< Device >();
+      RealType* meshFunctionData = meshFunction.getData().getData();
+      const typename MaskPointer::ObjectType* mask( nullptr );
+      if( maskPointer )
+         mask = &maskPointer.template getData< Device >();
+      auto kernel = [ tobuffer, mesh, buffer, isBoundary, meshFunctionData, mask, beginx ] __cuda_callable__( Index j )
       {
-
-         Index beginx=begin.x();
-         Index sizex=size.x();
-
-         auto* mesh = &meshFunction.getMeshPointer().template getData< Device >();
-         RealType* meshFunctionData = meshFunction.getData().getData();
-         const typename MaskPointer::ObjectType* mask( nullptr );
-         if( maskPointer )
-            mask = &maskPointer.template getData< Device >();
-         auto kernel = [tobuffer, mesh, buffer, isBoundary, meshFunctionData, mask, beginx ] __cuda_callable__ ( Index j )
-         {
-            typename MeshFunctionType::MeshType::Cell entity(*mesh);
-            entity.getCoordinates().x()=beginx+j;
-            entity.refresh();
-            if( ! isBoundary || ! mask || ( *mask )[ entity.getIndex() ] )
-            {
-               if( tobuffer )
-                  buffer[ j ] = meshFunctionData[ entity.getIndex() ];
-               else
-                  meshFunctionData[ entity.getIndex() ] = buffer[ j ];
-            }
-         };
-         Algorithms::ParallelFor< Device >::exec( 0, sizex, kernel );
+         typename MeshFunctionType::MeshType::Cell entity( *mesh );
+         entity.getCoordinates().x() = beginx + j;
+         entity.refresh();
+         if( ! isBoundary || ! mask || ( *mask )[ entity.getIndex() ] ) {
+            if( tobuffer )
+               buffer[ j ] = meshFunctionData[ entity.getIndex() ];
+            else
+               meshFunctionData[ entity.getIndex() ] = buffer[ j ];
+         }
       };
+      Algorithms::ParallelFor< Device >::exec( 0, sizex, kernel );
+   };
 };
 
-
-template< typename MeshFunctionType,
-          typename MaskPointer,
-          typename RealType,
-          typename Device,
-          typename Index  >
+template< typename MeshFunctionType, typename MaskPointer, typename RealType, typename Device, typename Index >
 class BufferEntitiesHelper< MeshFunctionType, MaskPointer, 2, RealType, Device, Index >
 {
-   public:
-      static void BufferEntities(
-         MeshFunctionType& meshFunction,
-         const MaskPointer& maskPointer,
-         RealType* buffer,
-         bool isBoundary,
-         const Containers::StaticVector<2,Index>& begin,
-         const Containers::StaticVector<2,Index>& size,
-         bool tobuffer)
+public:
+   static void
+   BufferEntities( MeshFunctionType& meshFunction,
+                   const MaskPointer& maskPointer,
+                   RealType* buffer,
+                   bool isBoundary,
+                   const Containers::StaticVector< 2, Index >& begin,
+                   const Containers::StaticVector< 2, Index >& size,
+                   bool tobuffer )
+   {
+      Index beginx = begin.x();
+      Index beginy = begin.y();
+      Index sizex = size.x();
+      Index sizey = size.y();
+
+      auto* mesh = &meshFunction.getMeshPointer().template getData< Device >();
+      RealType* meshFunctionData = meshFunction.getData().getData();
+      const typename MaskPointer::ObjectType* mask( nullptr );
+      if( maskPointer )
+         mask = &maskPointer.template getData< Device >();
+
+      auto kernel = [ tobuffer, mask, mesh, buffer, isBoundary, meshFunctionData, beginx, sizex, beginy ] __cuda_callable__(
+                       Index i, Index j )
       {
-
-         Index beginx=begin.x();
-         Index beginy=begin.y();
-         Index sizex=size.x();
-         Index sizey=size.y();
-
-         auto* mesh = &meshFunction.getMeshPointer().template getData< Device >();
-         RealType* meshFunctionData = meshFunction.getData().getData();
-         const typename MaskPointer::ObjectType* mask( nullptr );
-         if( maskPointer )
-            mask = &maskPointer.template getData< Device >();
-
-         auto kernel = [ tobuffer, mask, mesh, buffer, isBoundary, meshFunctionData, beginx, sizex, beginy] __cuda_callable__ ( Index i, Index j )
-         {
-            typename MeshFunctionType::MeshType::Cell entity(*mesh);
-            entity.getCoordinates().x() = beginx + i;
-            entity.getCoordinates().y() = beginy + j;
-            entity.refresh();
-            if( ! isBoundary || ! mask || ( *mask )[ entity.getIndex() ] )
-            {
-               if( tobuffer )
-                  buffer[ j * sizex + i ] = meshFunctionData[ entity.getIndex() ];
-               else
-                  meshFunctionData[ entity.getIndex() ] = buffer[ j * sizex + i ];
-            }
-         };
-         Algorithms::ParallelFor2D< Device >::exec( 0, 0, sizex, sizey, kernel );
+         typename MeshFunctionType::MeshType::Cell entity( *mesh );
+         entity.getCoordinates().x() = beginx + i;
+         entity.getCoordinates().y() = beginy + j;
+         entity.refresh();
+         if( ! isBoundary || ! mask || ( *mask )[ entity.getIndex() ] ) {
+            if( tobuffer )
+               buffer[ j * sizex + i ] = meshFunctionData[ entity.getIndex() ];
+            else
+               meshFunctionData[ entity.getIndex() ] = buffer[ j * sizex + i ];
+         }
       };
+      Algorithms::ParallelFor2D< Device >::exec( 0, 0, sizex, sizey, kernel );
+   };
 };
 
-
-template< typename MeshFunctionType,
-          typename MaskPointer,
-          typename RealType,
-          typename Device,
-          typename Index >
+template< typename MeshFunctionType, typename MaskPointer, typename RealType, typename Device, typename Index >
 class BufferEntitiesHelper< MeshFunctionType, MaskPointer, 3, RealType, Device, Index >
 {
-   public:
-      static void BufferEntities(
-         MeshFunctionType& meshFunction,
-         const MaskPointer& maskPointer,
-         RealType* buffer,
-         bool isBoundary,
-         const Containers::StaticVector<3,Index>& begin,
-         const Containers::StaticVector<3,Index>& size,
-         bool tobuffer)
+public:
+   static void
+   BufferEntities( MeshFunctionType& meshFunction,
+                   const MaskPointer& maskPointer,
+                   RealType* buffer,
+                   bool isBoundary,
+                   const Containers::StaticVector< 3, Index >& begin,
+                   const Containers::StaticVector< 3, Index >& size,
+                   bool tobuffer )
+   {
+      Index beginx = begin.x();
+      Index beginy = begin.y();
+      Index beginz = begin.z();
+      Index sizex = size.x();
+      Index sizey = size.y();
+      Index sizez = size.z();
+
+      auto* mesh = &meshFunction.getMeshPointer().template getData< Device >();
+      RealType* meshFunctionData = meshFunction.getData().getData();
+      const typename MaskPointer::ObjectType* mask( nullptr );
+      if( maskPointer )
+         mask = &maskPointer.template getData< Device >();
+      auto kernel =
+         [ tobuffer, mesh, mask, buffer, isBoundary, meshFunctionData, beginx, sizex, beginy, sizey, beginz ] __cuda_callable__(
+            Index i, Index j, Index k )
       {
-         Index beginx=begin.x();
-         Index beginy=begin.y();
-         Index beginz=begin.z();
-         Index sizex=size.x();
-         Index sizey=size.y();
-         Index sizez=size.z();
-
-         auto* mesh = &meshFunction.getMeshPointer().template getData< Device >();
-         RealType * meshFunctionData=meshFunction.getData().getData();
-         const typename MaskPointer::ObjectType* mask( nullptr );
-         if( maskPointer )
-            mask = &maskPointer.template getData< Device >();
-         auto kernel = [ tobuffer, mesh, mask, buffer, isBoundary, meshFunctionData, beginx, sizex, beginy, sizey, beginz] __cuda_callable__ ( Index i, Index j, Index k )
-         {
-            typename MeshFunctionType::MeshType::Cell entity(*mesh);
-            entity.getCoordinates().x() = beginx + i;
-            entity.getCoordinates().y() = beginy + j;
-            entity.getCoordinates().z() = beginz + k;
-            entity.refresh();
-            if( ! isBoundary || ! mask || ( *mask )[ entity.getIndex() ] )
-            {
-               if( tobuffer )
-                  buffer[ k * sizex * sizey + j * sizex + i ] = meshFunctionData[ entity.getIndex() ];
-               else
-                  meshFunctionData[ entity.getIndex() ] = buffer[ k * sizex * sizey + j * sizex + i ];
-            }
-         };
-         Algorithms::ParallelFor3D< Device >::exec( 0, 0, 0, sizex, sizey, sizez, kernel );
+         typename MeshFunctionType::MeshType::Cell entity( *mesh );
+         entity.getCoordinates().x() = beginx + i;
+         entity.getCoordinates().y() = beginy + j;
+         entity.getCoordinates().z() = beginz + k;
+         entity.refresh();
+         if( ! isBoundary || ! mask || ( *mask )[ entity.getIndex() ] ) {
+            if( tobuffer )
+               buffer[ k * sizex * sizey + j * sizex + i ] = meshFunctionData[ entity.getIndex() ];
+            else
+               meshFunctionData[ entity.getIndex() ] = buffer[ k * sizex * sizey + j * sizex + i ];
+         }
       };
+      Algorithms::ParallelFor3D< Device >::exec( 0, 0, 0, sizex, sizey, sizez, kernel );
+   };
 };
 
-
-} // namespace DistributedMeshes
-} // namespace Meshes
-} // namespace TNL
+}  // namespace DistributedMeshes
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/DistributedMeshes/CopyEntitiesHelper.h b/src/TNL/Meshes/DistributedMeshes/CopyEntitiesHelper.h
index 841e4b90e2a799476aec9e561bfda92dc3f7ab03..15c168d4e2f2f20371ce33762afa1fc8fd24eda1 100644
--- a/src/TNL/Meshes/DistributedMeshes/CopyEntitiesHelper.h
+++ b/src/TNL/Meshes/DistributedMeshes/CopyEntitiesHelper.h
@@ -12,108 +12,108 @@ namespace TNL {
 namespace Meshes {
 namespace DistributedMeshes {
 
-template<typename MeshFunctionType,
-         int dim=MeshFunctionType::getMeshDimension()>
+template< typename MeshFunctionType, int dim = MeshFunctionType::getMeshDimension() >
 class CopyEntitiesHelper;
 
-
-template<typename MeshFunctionType>
-class CopyEntitiesHelper<MeshFunctionType, 1>
+template< typename MeshFunctionType >
+class CopyEntitiesHelper< MeshFunctionType, 1 >
 {
-    public:
-    typedef typename MeshFunctionType::MeshType::CoordinatesType CoordinatesType;
-    typedef typename MeshFunctionType::MeshType::Cell Cell;
-    typedef typename MeshFunctionType::MeshType::GlobalIndexType Index;
-
-    template< typename FromFunction >
-    static void Copy(FromFunction &from, MeshFunctionType &to, CoordinatesType &fromBegin, CoordinatesType &toBegin, CoordinatesType &size)
-    {
-        auto toData=to.getData().getData();
-        auto fromData=from.getData().getData();
-        auto* fromMesh=&from.getMeshPointer().template getData< typename MeshFunctionType::MeshType::DeviceType >();
-        auto* toMesh=&to.getMeshPointer().template getData< typename MeshFunctionType::MeshType::DeviceType >();
-        auto kernel = [fromData,toData, fromMesh, toMesh, fromBegin, toBegin] __cuda_callable__ ( Index i )
-        {
-            Cell fromEntity(*fromMesh);
-            Cell toEntity(*toMesh);
-            toEntity.getCoordinates().x()=toBegin.x()+i;
-            toEntity.refresh();
-            fromEntity.getCoordinates().x()=fromBegin.x()+i;
-            fromEntity.refresh();
-            toData[toEntity.getIndex()]=fromData[fromEntity.getIndex()];
-        };
-        Algorithms::ParallelFor< typename MeshFunctionType::MeshType::DeviceType >::exec( (Index)0, (Index)size.x(), kernel );
-    }
+public:
+   using CoordinatesType = typename MeshFunctionType::MeshType::CoordinatesType;
+   using Cell = typename MeshFunctionType::MeshType::Cell;
+   using Index = typename MeshFunctionType::MeshType::GlobalIndexType;
+
+   template< typename FromFunction >
+   static void
+   Copy( FromFunction& from, MeshFunctionType& to, CoordinatesType& fromBegin, CoordinatesType& toBegin, CoordinatesType& size )
+   {
+      auto toData = to.getData().getData();
+      auto fromData = from.getData().getData();
+      auto* fromMesh = &from.getMeshPointer().template getData< typename MeshFunctionType::MeshType::DeviceType >();
+      auto* toMesh = &to.getMeshPointer().template getData< typename MeshFunctionType::MeshType::DeviceType >();
+      auto kernel = [ fromData, toData, fromMesh, toMesh, fromBegin, toBegin ] __cuda_callable__( Index i )
+      {
+         Cell fromEntity( *fromMesh );
+         Cell toEntity( *toMesh );
+         toEntity.getCoordinates().x() = toBegin.x() + i;
+         toEntity.refresh();
+         fromEntity.getCoordinates().x() = fromBegin.x() + i;
+         fromEntity.refresh();
+         toData[ toEntity.getIndex() ] = fromData[ fromEntity.getIndex() ];
+      };
+      Algorithms::ParallelFor< typename MeshFunctionType::MeshType::DeviceType >::exec( (Index) 0, (Index) size.x(), kernel );
+   }
 };
 
+template< typename MeshFunctionType >
 
-template<typename MeshFunctionType>
-
-class CopyEntitiesHelper<MeshFunctionType,2>
+class CopyEntitiesHelper< MeshFunctionType, 2 >
 {
-    public:
-    typedef typename MeshFunctionType::MeshType::CoordinatesType CoordinatesType;
-    typedef typename MeshFunctionType::MeshType::Cell Cell;
-    typedef typename MeshFunctionType::MeshType::GlobalIndexType Index;
-
-    template< typename FromFunction >
-    static void Copy(FromFunction &from, MeshFunctionType &to, CoordinatesType &fromBegin, CoordinatesType &toBegin, CoordinatesType &size)
-    {
-        auto toData=to.getData().getData();
-        auto fromData=from.getData().getData();
-        auto* fromMesh=&from.getMeshPointer().template getData< typename MeshFunctionType::MeshType::DeviceType >();
-        auto* toMesh=&to.getMeshPointer().template getData< typename MeshFunctionType::MeshType::DeviceType >();
-        auto kernel = [fromData,toData, fromMesh, toMesh, fromBegin, toBegin] __cuda_callable__ ( Index i, Index j )
-        {
-            Cell fromEntity(*fromMesh);
-            Cell toEntity(*toMesh);
-            toEntity.getCoordinates().x()=toBegin.x()+i;
-            toEntity.getCoordinates().y()=toBegin.y()+j;
-            toEntity.refresh();
-            fromEntity.getCoordinates().x()=fromBegin.x()+i;
-            fromEntity.getCoordinates().y()=fromBegin.y()+j;
-            fromEntity.refresh();
-            toData[toEntity.getIndex()]=fromData[fromEntity.getIndex()];
-        };
-        Algorithms::ParallelFor2D< typename MeshFunctionType::MeshType::DeviceType >::exec( (Index)0,(Index)0,(Index)size.x(), (Index)size.y(), kernel );
-    }
+public:
+   using CoordinatesType = typename MeshFunctionType::MeshType::CoordinatesType;
+   using Cell = typename MeshFunctionType::MeshType::Cell;
+   using Index = typename MeshFunctionType::MeshType::GlobalIndexType;
+
+   template< typename FromFunction >
+   static void
+   Copy( FromFunction& from, MeshFunctionType& to, CoordinatesType& fromBegin, CoordinatesType& toBegin, CoordinatesType& size )
+   {
+      auto toData = to.getData().getData();
+      auto fromData = from.getData().getData();
+      auto* fromMesh = &from.getMeshPointer().template getData< typename MeshFunctionType::MeshType::DeviceType >();
+      auto* toMesh = &to.getMeshPointer().template getData< typename MeshFunctionType::MeshType::DeviceType >();
+      auto kernel = [ fromData, toData, fromMesh, toMesh, fromBegin, toBegin ] __cuda_callable__( Index i, Index j )
+      {
+         Cell fromEntity( *fromMesh );
+         Cell toEntity( *toMesh );
+         toEntity.getCoordinates().x() = toBegin.x() + i;
+         toEntity.getCoordinates().y() = toBegin.y() + j;
+         toEntity.refresh();
+         fromEntity.getCoordinates().x() = fromBegin.x() + i;
+         fromEntity.getCoordinates().y() = fromBegin.y() + j;
+         fromEntity.refresh();
+         toData[ toEntity.getIndex() ] = fromData[ fromEntity.getIndex() ];
+      };
+      Algorithms::ParallelFor2D< typename MeshFunctionType::MeshType::DeviceType >::exec(
+         (Index) 0, (Index) 0, (Index) size.x(), (Index) size.y(), kernel );
+   }
 };
 
-
-template<typename MeshFunctionType>
-class CopyEntitiesHelper<MeshFunctionType,3>
+template< typename MeshFunctionType >
+class CopyEntitiesHelper< MeshFunctionType, 3 >
 {
-    public:
-    typedef typename MeshFunctionType::MeshType::CoordinatesType CoordinatesType;
-    typedef typename MeshFunctionType::MeshType::Cell Cell;
-    typedef typename MeshFunctionType::MeshType::GlobalIndexType Index;
-
-    template< typename FromFunction >
-    static void Copy(FromFunction &from, MeshFunctionType &to, CoordinatesType &fromBegin, CoordinatesType &toBegin, CoordinatesType &size)
-    {
-        auto toData=to.getData().getData();
-        auto fromData=from.getData().getData();
-        auto* fromMesh=&from.getMeshPointer().template getData< typename MeshFunctionType::MeshType::DeviceType >();
-        auto* toMesh=&to.getMeshPointer().template getData< typename MeshFunctionType::MeshType::DeviceType >();
-        auto kernel = [fromData,toData, fromMesh, toMesh, fromBegin, toBegin] __cuda_callable__ ( Index i, Index j, Index k )
-        {
-            Cell fromEntity(*fromMesh);
-            Cell toEntity(*toMesh);
-            toEntity.getCoordinates().x()=toBegin.x()+i;
-            toEntity.getCoordinates().y()=toBegin.y()+j;
-            toEntity.getCoordinates().z()=toBegin.z()+k;
-            toEntity.refresh();
-            fromEntity.getCoordinates().x()=fromBegin.x()+i;
-            fromEntity.getCoordinates().y()=fromBegin.y()+j;
-            fromEntity.getCoordinates().z()=fromBegin.z()+k;
-            fromEntity.refresh();
-            toData[toEntity.getIndex()]=fromData[fromEntity.getIndex()];
-        };
-        Algorithms::ParallelFor3D< typename MeshFunctionType::MeshType::DeviceType >::exec( (Index)0,(Index)0,(Index)0,(Index)size.x(),(Index)size.y(), (Index)size.z(), kernel );
-    }
+public:
+   using CoordinatesType = typename MeshFunctionType::MeshType::CoordinatesType;
+   using Cell = typename MeshFunctionType::MeshType::Cell;
+   using Index = typename MeshFunctionType::MeshType::GlobalIndexType;
+
+   template< typename FromFunction >
+   static void
+   Copy( FromFunction& from, MeshFunctionType& to, CoordinatesType& fromBegin, CoordinatesType& toBegin, CoordinatesType& size )
+   {
+      auto toData = to.getData().getData();
+      auto fromData = from.getData().getData();
+      auto* fromMesh = &from.getMeshPointer().template getData< typename MeshFunctionType::MeshType::DeviceType >();
+      auto* toMesh = &to.getMeshPointer().template getData< typename MeshFunctionType::MeshType::DeviceType >();
+      auto kernel = [ fromData, toData, fromMesh, toMesh, fromBegin, toBegin ] __cuda_callable__( Index i, Index j, Index k )
+      {
+         Cell fromEntity( *fromMesh );
+         Cell toEntity( *toMesh );
+         toEntity.getCoordinates().x() = toBegin.x() + i;
+         toEntity.getCoordinates().y() = toBegin.y() + j;
+         toEntity.getCoordinates().z() = toBegin.z() + k;
+         toEntity.refresh();
+         fromEntity.getCoordinates().x() = fromBegin.x() + i;
+         fromEntity.getCoordinates().y() = fromBegin.y() + j;
+         fromEntity.getCoordinates().z() = fromBegin.z() + k;
+         fromEntity.refresh();
+         toData[ toEntity.getIndex() ] = fromData[ fromEntity.getIndex() ];
+      };
+      Algorithms::ParallelFor3D< typename MeshFunctionType::MeshType::DeviceType >::exec(
+         (Index) 0, (Index) 0, (Index) 0, (Index) size.x(), (Index) size.y(), (Index) size.z(), kernel );
+   }
 };
 
-
-} // namespace DistributedMeshes
-} // namespace Meshes
-} // namespace TNL
+}  // namespace DistributedMeshes
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/DistributedMeshes/Directions.h b/src/TNL/Meshes/DistributedMeshes/Directions.h
index 6cc688c4d4eacc72ce1e903b4938ad45329f74f5..0b615ad2e0e6e89d195f03fd06918c9fdb6ef6da 100644
--- a/src/TNL/Meshes/DistributedMeshes/Directions.h
+++ b/src/TNL/Meshes/DistributedMeshes/Directions.h
@@ -13,12 +13,12 @@ namespace TNL {
 namespace Meshes {
 namespace DistributedMeshes {
 
-//index of direction can be written as number in 3-base system
-//  -> 1 order x axis, 2 order y axis, 3 order z axis
-//  -> 0 - not used, 1 negative direction, 2 positive direction
-//finaly we subtrackt 1 because we dont need (0,0,0) aka 0 aka no direction
+// index of direction can be written as number in 3-base system
+//   -> 1 order x axis, 2 order y axis, 3 order z axis
+//   -> 0 - not used, 1 negative direction, 2 positive direction
+// finaly we subtrackt 1 because we dont need (0,0,0) aka 0 aka no direction
 
-//enum Directions2D { Left = 0 , Right = 1 , Up = 2, UpLeft =3, UpRight=4, Down=5, DownLeft=6, DownRight=7 };
+// enum Directions2D { Left = 0 , Right = 1 , Up = 2, UpLeft =3, UpRight=4, Down=5, DownLeft=6, DownRight=7 };
 
 /*MEH - osa zed je zdola nahoru, asi---
 enum Directions3D { West = 0 , East = 1 ,
@@ -47,96 +47,115 @@ enum Directions3D {
                   };
 */
 
-enum Directions3D {
-                    ZzYzXm =  0, ZzYzXp =  1,
-                    ZzYmXz =  2, ZzYmXm =  3, ZzYmXp =  4,
-                    ZzYpXz =  5, ZzYpXm =  6, ZzYpXp =  7,
-                    ZmYzXz =  8, ZmYzXm =  9, ZmYzXp = 10,
-                    ZmYmXz = 11, ZmYmXm = 12, ZmYmXp = 13,
-                    ZmYpXz = 14, ZmYpXm = 15, ZmYpXp = 16,
-                    ZpYzXz = 17, ZpYzXm = 18, ZpYzXp = 19,
-                    ZpYmXz = 20, ZpYmXm = 21, ZpYmXp = 22,
-                    ZpYpXz = 23, ZpYpXm = 24, ZpYpXp = 25
-                  };
-
-
-class Directions {
+enum Directions3D
+{
+   ZzYzXm = 0,
+   ZzYzXp = 1,
+   ZzYmXz = 2,
+   ZzYmXm = 3,
+   ZzYmXp = 4,
+   ZzYpXz = 5,
+   ZzYpXm = 6,
+   ZzYpXp = 7,
+   ZmYzXz = 8,
+   ZmYzXm = 9,
+   ZmYzXp = 10,
+   ZmYmXz = 11,
+   ZmYmXm = 12,
+   ZmYmXp = 13,
+   ZmYpXz = 14,
+   ZmYpXm = 15,
+   ZmYpXp = 16,
+   ZpYzXz = 17,
+   ZpYzXm = 18,
+   ZpYzXp = 19,
+   ZpYmXz = 20,
+   ZpYmXm = 21,
+   ZpYmXp = 22,
+   ZpYpXz = 23,
+   ZpYpXm = 24,
+   ZpYpXp = 25
+};
 
+class Directions
+{
 public:
-    template<int numerofDriection>
-    static int getDirection(Containers::StaticVector<numerofDriection,int> directions) //takes +/- nuber of ax (i.e. (-2,+3))
-    {
-        int result=0;
-        for(int i=0;i<directions.getSize();i++)
-            result+=add(directions[i]);
-        return result-1;
-    }
-
-    template<int dim>
-    static Containers::StaticVector<dim,int> getXYZ(int neighbor)// return neighbor as direction like (0,-1,1)
-    {
-        Containers::StaticVector<dim,int> res;
-        int number=neighbor+1;
-        for(int i=0;i<dim;i++)
-        {
-            int direction=number%3;
-            if(direction==0)
-                res[i]=0;
-            if(direction==1)
-                res[i]=-1;
-            if(direction==2)
-                res[i]=1;
-            number=number/3;
-        }
-        return res;
-    }
-
-
- /*   static int getDirection(int direction)
-    {
-        int result=0;
-        result+=add(direction);
-        return result-1;
-    }
-
-    static int getDirection(int direction1,int direction2)
-    {
-        int result=0;
-        result+=add(direction1);
-        result+=add(direction2);
-        return result-1;
-    }
-
-    static int getDirection(int direction1,int direction2, int direction3)
-    {
-        int result=0;
-        result+=add(direction1);
-        result+=add(direction2);
-        result+=add(direction3);
-        return result-1;
-    }*/
-
-    static constexpr int add(int direction)
-    {
-        if(direction==0)
-            return 0;
-
-        if(direction>0)
-            return 2*i3pow(direction-1); //positive direction has higer index
-        else
-            return i3pow(-direction-1);
-    }
-
-    // return 3^exp
-    static constexpr int i3pow(int exp)
-    {
-        int ret=1;
-        for(int i=0;i<exp;i++)
-            ret*=3;
-        return ret;
-    }
+   template< int numerofDriection >
+   static int
+   getDirection( Containers::StaticVector< numerofDriection, int > directions )  // takes +/- nuber of ax (i.e. (-2,+3))
+   {
+      int result = 0;
+      for( int i = 0; i < directions.getSize(); i++ )
+         result += add( directions[ i ] );
+      return result - 1;
+   }
+
+   template< int dim >
+   static Containers::StaticVector< dim, int >
+   getXYZ( int neighbor )  // return neighbor as direction like (0,-1,1)
+   {
+      Containers::StaticVector< dim, int > res;
+      int number = neighbor + 1;
+      for( int i = 0; i < dim; i++ ) {
+         int direction = number % 3;
+         if( direction == 0 )
+            res[ i ] = 0;
+         if( direction == 1 )
+            res[ i ] = -1;
+         if( direction == 2 )
+            res[ i ] = 1;
+         number = number / 3;
+      }
+      return res;
+   }
+
+   /*   static int getDirection(int direction)
+      {
+          int result=0;
+          result+=add(direction);
+          return result-1;
+      }
+
+      static int getDirection(int direction1,int direction2)
+      {
+          int result=0;
+          result+=add(direction1);
+          result+=add(direction2);
+          return result-1;
+      }
+
+      static int getDirection(int direction1,int direction2, int direction3)
+      {
+          int result=0;
+          result+=add(direction1);
+          result+=add(direction2);
+          result+=add(direction3);
+          return result-1;
+      }*/
+
+   static constexpr int
+   add( int direction )
+   {
+      if( direction == 0 )
+         return 0;
+
+      if( direction > 0 )
+         return 2 * i3pow( direction - 1 );  // positive direction has higer index
+      else
+         return i3pow( -direction - 1 );
+   }
+
+   // return 3^exp
+   static constexpr int
+   i3pow( int exp )
+   {
+      int ret = 1;
+      for( int i = 0; i < exp; i++ )
+         ret *= 3;
+      return ret;
+   }
 };
 
-} // namespace DistributedMeshes
-} // namespace Meshes
-} // namespace TNL
+}  // namespace DistributedMeshes
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/DistributedMeshes/DistributedGrid.h b/src/TNL/Meshes/DistributedMeshes/DistributedGrid.h
index 582153863c6ca41f2f54e16e7c8796b027623e75..64548a6a9940e6eb247622a8b05d2589cb30213d 100644
--- a/src/TNL/Meshes/DistributedMeshes/DistributedGrid.h
+++ b/src/TNL/Meshes/DistributedMeshes/DistributedGrid.h
@@ -4,7 +4,6 @@
 //
 // SPDX-License-Identifier: MIT
 
-
 #pragma once
 
 #include <TNL/Meshes/Grid.h>
@@ -16,134 +15,168 @@ namespace TNL {
 namespace Meshes {
 namespace DistributedMeshes {
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index >
+template< int Dimension, typename Real, typename Device, typename Index >
 class DistributedMesh< Grid< Dimension, Real, Device, Index > >
 {
-   public:
-      using RealType = Real;
-      using DeviceType = Device;
-      using IndexType = Index;
-      using GlobalIndexType = Index;
-      using GridType = Grid< Dimension, Real, Device, IndexType >;
-      using PointType = typename GridType::PointType;
-      using CoordinatesType = Containers::StaticVector< Dimension, IndexType >;
-      using SubdomainOverlapsType = Containers::StaticVector< Dimension, IndexType >;
-
-      static constexpr int getMeshDimension() { return Dimension; };
+public:
+   using RealType = Real;
+   using DeviceType = Device;
+   using IndexType = Index;
+   using GlobalIndexType = Index;
+   using GridType = Grid< Dimension, Real, Device, IndexType >;
+   using PointType = typename GridType::PointType;
+   using CoordinatesType = Containers::StaticVector< Dimension, IndexType >;
+   using SubdomainOverlapsType = Containers::StaticVector< Dimension, IndexType >;
 
-      static constexpr int getNeighborsCount() { return Directions::i3pow(Dimension)-1; }
+   static constexpr int
+   getMeshDimension()
+   {
+      return Dimension;
+   };
 
-      DistributedMesh() = default;
+   static constexpr int
+   getNeighborsCount()
+   {
+      return Directions::i3pow( Dimension ) - 1;
+   }
 
-      ~DistributedMesh() = default;
+   DistributedMesh() = default;
 
-      void setDomainDecomposition( const CoordinatesType& domainDecomposition );
+   ~DistributedMesh() = default;
 
-      const CoordinatesType& getDomainDecomposition() const;
+   void
+   setDomainDecomposition( const CoordinatesType& domainDecomposition );
 
-      void setGlobalGrid( const GridType& globalGrid );
+   const CoordinatesType&
+   getDomainDecomposition() const;
 
-      const GridType& getGlobalGrid() const;
+   void
+   setGlobalGrid( const GridType& globalGrid );
 
-      void setOverlaps( const SubdomainOverlapsType& lower,
-                        const SubdomainOverlapsType& upper);
+   const GridType&
+   getGlobalGrid() const;
 
-      // for compatibility with DistributedMesh
-      void setGhostLevels( int levels );
-      int getGhostLevels() const;
+   void
+   setOverlaps( const SubdomainOverlapsType& lower, const SubdomainOverlapsType& upper );
 
-      bool isDistributed() const;
+   // for compatibility with DistributedMesh
+   void
+   setGhostLevels( int levels );
+   int
+   getGhostLevels() const;
 
-      bool isBoundarySubdomain() const;
+   bool
+   isDistributed() const;
 
-      //currently used overlaps at this subdomain
-      const SubdomainOverlapsType& getLowerOverlap() const;
+   bool
+   isBoundarySubdomain() const;
 
-      const SubdomainOverlapsType& getUpperOverlap() const;
+   // currently used overlaps at this subdomain
+   const SubdomainOverlapsType&
+   getLowerOverlap() const;
 
-      // returns the local grid WITH overlap
-      const GridType& getLocalMesh() const;
+   const SubdomainOverlapsType&
+   getUpperOverlap() const;
 
-      //number of elements of local sub domain WITHOUT overlap
-      // TODO: getSubdomainDimensions
-      const CoordinatesType& getLocalSize() const;
+   // returns the local grid WITH overlap
+   const GridType&
+   getLocalMesh() const;
 
-      // TODO: delete
-      //Dimensions of global grid
-      const CoordinatesType& getGlobalSize() const;
+   // number of elements of local sub domain WITHOUT overlap
+   //  TODO: getSubdomainDimensions
+   const CoordinatesType&
+   getLocalSize() const;
 
-      //coordinates of begin of local subdomain without overlaps in global grid
-      const CoordinatesType& getGlobalBegin() const;
+   // TODO: delete
+   // Dimensions of global grid
+   const CoordinatesType&
+   getGlobalSize() const;
 
-      const CoordinatesType& getSubdomainCoordinates() const;
+   // coordinates of begin of local subdomain without overlaps in global grid
+   const CoordinatesType&
+   getGlobalBegin() const;
 
-      void setCommunicator( MPI_Comm communicator );
+   const CoordinatesType&
+   getSubdomainCoordinates() const;
 
-      MPI_Comm getCommunicator() const;
+   void
+   setCommunicator( MPI_Comm communicator );
 
-      template< int EntityDimension >
-      IndexType getEntitiesCount() const;
+   MPI_Comm
+   getCommunicator() const;
 
-      template< typename Entity >
-      IndexType getEntitiesCount() const;
+   template< int EntityDimension >
+   IndexType
+   getEntitiesCount() const;
 
-      const int* getNeighbors() const;
+   template< typename Entity >
+   IndexType
+   getEntitiesCount() const;
 
-      const int* getPeriodicNeighbors() const;
+   const int*
+   getNeighbors() const;
 
-      template<typename DistributedGridType>
-      bool SetupByCut(DistributedGridType &inputDistributedGrid,
-                 Containers::StaticVector<Dimension, int> savedDimensions,
-                 Containers::StaticVector<DistributedGridType::getMeshDimension()-Dimension,int> reducedDimensions,
-                 Containers::StaticVector<DistributedGridType::getMeshDimension()-Dimension,IndexType> fixedIndexs);
+   const int*
+   getPeriodicNeighbors() const;
 
-      int getRankOfProcCoord(const CoordinatesType &nodeCoordinates) const;
+   template< typename DistributedGridType >
+   bool
+   SetupByCut( DistributedGridType& inputDistributedGrid,
+               Containers::StaticVector< Dimension, int > savedDimensions,
+               Containers::StaticVector< DistributedGridType::getMeshDimension() - Dimension, int > reducedDimensions,
+               Containers::StaticVector< DistributedGridType::getMeshDimension() - Dimension, IndexType > fixedIndexs );
 
-      String printProcessCoords() const;
+   int
+   getRankOfProcCoord( const CoordinatesType& nodeCoordinates ) const;
 
-      String printProcessDistr() const;
+   String
+   printProcessCoords() const;
 
-      void writeProlog( Logger& logger );
+   String
+   printProcessDistr() const;
 
-      bool operator==( const DistributedMesh& other ) const;
+   void
+   writeProlog( Logger& logger );
 
-      bool operator!=( const DistributedMesh& other ) const;
+   bool
+   operator==( const DistributedMesh& other ) const;
 
-   public:
+   bool
+   operator!=( const DistributedMesh& other ) const;
 
-      bool isThereNeighbor(const CoordinatesType &direction) const;
+   bool
+   isThereNeighbor( const CoordinatesType& direction ) const;
 
-      void setupNeighbors();
+   void
+   setupNeighbors();
 
-      GridType globalGrid, localGrid;
-      CoordinatesType localSize = 0;
-      CoordinatesType globalBegin = 0;
+   GridType globalGrid, localGrid;
+   CoordinatesType localSize = 0;
+   CoordinatesType globalBegin = 0;
 
-      SubdomainOverlapsType lowerOverlap = 0;
-      SubdomainOverlapsType upperOverlap = 0;
+   SubdomainOverlapsType lowerOverlap = 0;
+   SubdomainOverlapsType upperOverlap = 0;
 
-      CoordinatesType domainDecomposition = 0;
-      CoordinatesType subdomainCoordinates = 0;
+   CoordinatesType domainDecomposition = 0;
+   CoordinatesType subdomainCoordinates = 0;
 
-      // TODO: static arrays
-      int neighbors[ getNeighborsCount() ];
-      int periodicNeighbors[ getNeighborsCount() ];
+   // TODO: static arrays
+   int neighbors[ getNeighborsCount() ];
+   int periodicNeighbors[ getNeighborsCount() ];
 
-      bool distributed = false;
+   bool distributed = false;
 
-      bool isSet = false;
+   bool isSet = false;
 
-      MPI_Comm communicator = MPI_COMM_WORLD;
+   MPI_Comm communicator = MPI_COMM_WORLD;
 };
 
 template< int Dimension, typename Real, typename Device, typename Index >
-std::ostream& operator<<( std::ostream& str, const DistributedMesh< Grid< Dimension, Real, Device, Index > >& grid );
+std::ostream&
+operator<<( std::ostream& str, const DistributedMesh< Grid< Dimension, Real, Device, Index > >& grid );
 
-} // namespace DistributedMeshes
-} // namespace Meshes
-} // namespace TNL
+}  // namespace DistributedMeshes
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/DistributedMeshes/DistributedGrid.hpp>
diff --git a/src/TNL/Meshes/DistributedMeshes/DistributedGrid.hpp b/src/TNL/Meshes/DistributedMeshes/DistributedGrid.hpp
index ec70e008cf71e1a709113346c2f04a6b1c2cb54c..c8591885491b08f053d6e93ebbddc607e3963995 100644
--- a/src/TNL/Meshes/DistributedMeshes/DistributedGrid.hpp
+++ b/src/TNL/Meshes/DistributedMeshes/DistributedGrid.hpp
@@ -18,27 +18,24 @@ namespace DistributedMeshes {
 
 template< int Dimension, typename Real, typename Device, typename Index >
 void
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-setDomainDecomposition( const CoordinatesType& domainDecomposition )
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::setDomainDecomposition( const CoordinatesType& domainDecomposition )
 {
    this->domainDecomposition = domainDecomposition;
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
 const typename DistributedMesh< Grid< Dimension, Real, Device, Index > >::CoordinatesType&
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-getDomainDecomposition() const
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::getDomainDecomposition() const
 {
    return this->domainDecomposition;
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
 void
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-setGlobalGrid( const GridType& globalGrid )
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::setGlobalGrid( const GridType& globalGrid )
 {
    this->globalGrid = globalGrid;
-   this->isSet=true;
+   this->isSet = true;
 
    for( int i = 0; i < getNeighborsCount(); i++ )
       this->neighbors[ i ] = -1;
@@ -46,8 +43,7 @@ setGlobalGrid( const GridType& globalGrid )
    // use MPI only if have more than one process
    this->distributed = MPI::GetSize( communicator ) > 1;
 
-   if( !this->distributed )
-   {
+   if( ! this->distributed ) {
       this->subdomainCoordinates.setValue( 0 );
       this->domainDecomposition.setValue( 0 );
       localGrid.setOrigin( globalGrid.getOrigin() );
@@ -55,10 +51,9 @@ setGlobalGrid( const GridType& globalGrid )
       this->localSize = globalGrid.getDimensions();
       this->globalBegin = 0;
    }
-   else
-   {
+   else {
       CoordinatesType numberOfLarger;
-      //compute node distribution
+      // compute node distribution
       int dims[ Dimension ];
       for( int i = 0; i < Dimension; i++ )
          dims[ i ] = this->domainDecomposition[ i ];
@@ -68,15 +63,13 @@ setGlobalGrid( const GridType& globalGrid )
 
       int size = MPI::GetSize( communicator );
       int tmp = MPI::GetRank( communicator );
-      for( int i = Dimension - 1; i >= 0; i-- )
-      {
+      for( int i = Dimension - 1; i >= 0; i-- ) {
          size = size / this->domainDecomposition[ i ];
          this->subdomainCoordinates[ i ] = tmp / size;
          tmp = tmp % size;
       }
 
-      for( int i = 0; i < Dimension; i++ )
-      {
+      for( int i = 0; i < Dimension; i++ ) {
          numberOfLarger[ i ] = globalGrid.getDimensions()[ i ] % this->domainDecomposition[ i ];
 
          this->localSize[ i ] = globalGrid.getDimensions()[ i ] / this->domainDecomposition[ i ];
@@ -85,10 +78,10 @@ setGlobalGrid( const GridType& globalGrid )
             this->localSize[ i ] += 1;
 
          if( numberOfLarger[ i ] > this->subdomainCoordinates[ i ] )
-             this->globalBegin[ i ] = this->subdomainCoordinates[ i ] * this->localSize[ i ];
+            this->globalBegin[ i ] = this->subdomainCoordinates[ i ] * this->localSize[ i ];
          else
-             this->globalBegin[ i ] = numberOfLarger[ i ] * ( this->localSize[ i ] + 1 ) +
-                                     ( this->subdomainCoordinates[ i ] - numberOfLarger[ i ] ) * this->localSize[ i ];
+            this->globalBegin[ i ] = numberOfLarger[ i ] * ( this->localSize[ i ] + 1 )
+                                   + ( this->subdomainCoordinates[ i ] - numberOfLarger[ i ] ) * this->localSize[ i ];
       }
 
       localGrid.setDimensions( this->localSize );
@@ -101,13 +94,13 @@ setGlobalGrid( const GridType& globalGrid )
 
 template< int Dimension, typename Real, typename Device, typename Index >
 void
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-setOverlaps( const SubdomainOverlapsType& lower,
-             const SubdomainOverlapsType& upper)
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::setOverlaps( const SubdomainOverlapsType& lower,
+                                                                        const SubdomainOverlapsType& upper )
 {
    this->lowerOverlap = lower;
    this->upperOverlap = upper;
-   localGrid.setOrigin( this->globalGrid.getOrigin() + this->globalGrid.getSpaceSteps() * (this->globalBegin - this->lowerOverlap) );
+   localGrid.setOrigin( this->globalGrid.getOrigin()
+                        + this->globalGrid.getSpaceSteps() * ( this->globalBegin - this->lowerOverlap ) );
    localGrid.setDimensions( this->localSize + this->lowerOverlap + this->upperOverlap );
    // setting space steps computes the grid proportions as a side efect
    localGrid.setSpaceSteps( globalGrid.getSpaceSteps() );
@@ -121,59 +114,55 @@ setOverlaps( const SubdomainOverlapsType& lower,
    CoordinatesType interiorEnd = localGrid.getDimensions() - this->upperOverlap;
    const int* neighbors = getNeighbors();
    if( neighbors[ ZzYzXm ] == -1 )
-      interiorBegin[0] += 1;
+      interiorBegin[ 0 ] += 1;
    if( neighbors[ ZzYzXp ] == -1 )
-      interiorEnd[0] -= 1;
+      interiorEnd[ 0 ] -= 1;
    if( ZzYmXz < getNeighborsCount() && neighbors[ ZzYmXz ] == -1 )
-      interiorBegin[1] += 1;
+      interiorBegin[ 1 ] += 1;
    if( ZzYpXz < getNeighborsCount() && neighbors[ ZzYpXz ] == -1 )
-      interiorEnd[1] -= 1;
+      interiorEnd[ 1 ] -= 1;
    if( ZmYzXz < getNeighborsCount() && neighbors[ ZmYzXz ] == -1 )
-      interiorBegin[2] += 1;
+      interiorBegin[ 2 ] += 1;
    if( ZpYzXz < getNeighborsCount() && neighbors[ ZpYzXz ] == -1 )
-      interiorEnd[2] -= 1;
+      interiorEnd[ 2 ] -= 1;
    localGrid.setInteriorBegin( interiorBegin );
    localGrid.setInteriorEnd( interiorEnd );
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
 void
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-setGhostLevels( int levels )
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::setGhostLevels( int levels )
 {
-   SubdomainOverlapsType lowerOverlap, upperOverlap;
+   SubdomainOverlapsType lowerOverlap;
+   SubdomainOverlapsType upperOverlap;
    SubdomainOverlapsGetter< GridType >::getOverlaps( this, lowerOverlap, upperOverlap, levels );
    setOverlaps( lowerOverlap, upperOverlap );
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
 int
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-getGhostLevels() const
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::getGhostLevels() const
 {
-   return TNL::max( TNL::max(lowerOverlap), TNL::max(upperOverlap) );
+   return TNL::max( TNL::max( lowerOverlap ), TNL::max( upperOverlap ) );
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
 const typename DistributedMesh< Grid< Dimension, Real, Device, Index > >::CoordinatesType&
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-getSubdomainCoordinates() const
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::getSubdomainCoordinates() const
 {
    return this->subdomainCoordinates;
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
 bool
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-isDistributed() const
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::isDistributed() const
 {
    return this->distributed;
 };
 
 template< int Dimension, typename Real, typename Device, typename Index >
 bool
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-isBoundarySubdomain() const
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::isBoundarySubdomain() const
 {
    for( int i = 0; i < getNeighborsCount(); i++ )
       if( this->neighbors[ i ] == -1 )
@@ -183,144 +172,125 @@ isBoundarySubdomain() const
 
 template< int Dimension, typename Real, typename Device, typename Index >
 const typename DistributedMesh< Grid< Dimension, Real, Device, Index > >::CoordinatesType&
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-getLowerOverlap() const
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::getLowerOverlap() const
 {
    return this->lowerOverlap;
 };
 
 template< int Dimension, typename Real, typename Device, typename Index >
 const typename DistributedMesh< Grid< Dimension, Real, Device, Index > >::CoordinatesType&
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-getUpperOverlap() const
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::getUpperOverlap() const
 {
    return this->upperOverlap;
 };
 
 template< int Dimension, typename Real, typename Device, typename Index >
 const typename DistributedMesh< Grid< Dimension, Real, Device, Index > >::GridType&
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-getLocalMesh() const
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::getLocalMesh() const
 {
-    return this->localGrid;
+   return this->localGrid;
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
 const typename DistributedMesh< Grid< Dimension, Real, Device, Index > >::CoordinatesType&
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-getLocalSize() const
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::getLocalSize() const
 {
    return this->localSize;
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
 const typename DistributedMesh< Grid< Dimension, Real, Device, Index > >::CoordinatesType&
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-getGlobalSize() const
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::getGlobalSize() const
 {
    return this->globalGrid.getDimensions();
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
 const typename DistributedMesh< Grid< Dimension, Real, Device, Index > >::GridType&
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-getGlobalGrid() const
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::getGlobalGrid() const
 {
-    return this->globalGrid;
+   return this->globalGrid;
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
 const typename DistributedMesh< Grid< Dimension, Real, Device, Index > >::CoordinatesType&
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-getGlobalBegin() const
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::getGlobalBegin() const
 {
    return this->globalBegin;
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
-   template< int EntityDimension >
+template< int EntityDimension >
 Index
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-getEntitiesCount() const
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::getEntitiesCount() const
 {
-   return this->globalGrid. template getEntitiesCount< EntityDimension >();
+   return this->globalGrid.template getEntitiesCount< EntityDimension >();
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
-   template< typename Entity >
+template< typename Entity >
 Index
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-getEntitiesCount() const
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::getEntitiesCount() const
 {
-   return this->globalGrid. template getEntitiesCount< Entity >();
+   return this->globalGrid.template getEntitiesCount< Entity >();
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
 void
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-setCommunicator( MPI_Comm communicator )
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::setCommunicator( MPI_Comm communicator )
 {
    this->communicator = communicator;
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
 MPI_Comm
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-getCommunicator() const
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::getCommunicator() const
 {
    return this->communicator;
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
 int
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-getRankOfProcCoord(const CoordinatesType &nodeCoordinates) const
-{
-    int DimensionOffset=1;
-    int ret=0;
-    for(int i=0;i<Dimension;i++)
-    {
-        ret += DimensionOffset*nodeCoordinates[i];
-        DimensionOffset *= this->domainDecomposition[i];
-    }
-    return ret;
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::getRankOfProcCoord( const CoordinatesType& nodeCoordinates ) const
+{
+   int DimensionOffset = 1;
+   int ret = 0;
+   for( int i = 0; i < Dimension; i++ ) {
+      ret += DimensionOffset * nodeCoordinates[ i ];
+      DimensionOffset *= this->domainDecomposition[ i ];
+   }
+   return ret;
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
 bool
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-isThereNeighbor(const CoordinatesType &direction) const
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::isThereNeighbor( const CoordinatesType& direction ) const
 {
-    bool res=true;
-    for(int i=0;i<Dimension;i++)
-    {
-        if(direction[i]==-1)
-            res&= this->subdomainCoordinates[i]>0;
-
-        if(direction[i]==1)
-            res&= this->subdomainCoordinates[i]<this->domainDecomposition[i]-1;
-    }
-    return res;
+   bool res = true;
+   for( int i = 0; i < Dimension; i++ ) {
+      if( direction[ i ] == -1 )
+         res &= this->subdomainCoordinates[ i ] > 0;
 
+      if( direction[ i ] == 1 )
+         res &= this->subdomainCoordinates[ i ] < this->domainDecomposition[ i ] - 1;
+   }
+   return res;
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
 void
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-setupNeighbors()
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::setupNeighbors()
 {
-   for( int i = 0; i < getNeighborsCount(); i++ )
-   {
+   for( int i = 0; i < getNeighborsCount(); i++ ) {
       auto direction = Directions::template getXYZ< Dimension >( i );
-      CoordinatesType coordinates = this->subdomainCoordinates+direction;
+      CoordinatesType coordinates = this->subdomainCoordinates + direction;
       if( this->isThereNeighbor( direction ) )
          this->neighbors[ i ] = this->getRankOfProcCoord( coordinates );
       else
          this->neighbors[ i ] = -1;
 
       // Handling periodic neighbors
-      for( int d = 0; d < Dimension; d++ )
-      {
+      for( int d = 0; d < Dimension; d++ ) {
          if( coordinates[ d ] == -1 )
             coordinates[ d ] = this->domainDecomposition[ d ] - 1;
          if( coordinates[ d ] == this->domainDecomposition[ d ] )
@@ -328,51 +298,48 @@ setupNeighbors()
          this->periodicNeighbors[ i ] = this->getRankOfProcCoord( coordinates );
       }
 
-      //std::cout << "Setting i-th neighbour to " << neighbors[ i ] << " and " << periodicNeighbors[ i ] << std::endl;
+      // std::cout << "Setting i-th neighbour to " << neighbors[ i ] << " and " << periodicNeighbors[ i ] << std::endl;
    }
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
 const int*
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-getNeighbors() const
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::getNeighbors() const
 {
-    TNL_ASSERT_TRUE(this->isSet,"DistributedGrid is not set, but used by getNeighbors");
-    return this->neighbors;
+   TNL_ASSERT_TRUE( this->isSet, "DistributedGrid is not set, but used by getNeighbors" );
+   return this->neighbors;
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
 const int*
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-getPeriodicNeighbors() const
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::getPeriodicNeighbors() const
 {
-    TNL_ASSERT_TRUE(this->isSet,"DistributedGrid is not set, but used by getNeighbors");
-    return this->periodicNeighbors;
+   TNL_ASSERT_TRUE( this->isSet, "DistributedGrid is not set, but used by getNeighbors" );
+   return this->periodicNeighbors;
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
-    template<typename DistributedGridType >
+template< typename DistributedGridType >
 bool
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-SetupByCut( DistributedGridType &inputDistributedGrid,
-            Containers::StaticVector<Dimension, int> savedDimensions,
-            Containers::StaticVector<DistributedGridType::getMeshDimension()-Dimension,int> reducedDimensions,
-            Containers::StaticVector<DistributedGridType::getMeshDimension()-Dimension,IndexType> fixedIndexs)
-{
-   bool isInCut=true;
-   const int coDimension = DistributedGridType::getMeshDimension()-Dimension;
-   for( int i = 0; i < coDimension; i++ )
-   {
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::SetupByCut(
+   DistributedGridType& inputDistributedGrid,
+   Containers::StaticVector< Dimension, int > savedDimensions,
+   Containers::StaticVector< DistributedGridType::getMeshDimension() - Dimension, int > reducedDimensions,
+   Containers::StaticVector< DistributedGridType::getMeshDimension() - Dimension, IndexType > fixedIndexs )
+{
+   bool isInCut = true;
+   const int coDimension = DistributedGridType::getMeshDimension() - Dimension;
+   for( int i = 0; i < coDimension; i++ ) {
       auto begin = inputDistributedGrid.getGlobalBegin();
       auto size = inputDistributedGrid.getLocalSize();
-      isInCut &= fixedIndexs[i] > begin[reducedDimensions[i]] && fixedIndexs[i] < begin[reducedDimensions[i]] + size[reducedDimensions[i]];
+      isInCut &= fixedIndexs[ i ] > begin[ reducedDimensions[ i ] ]
+              && fixedIndexs[ i ] < begin[ reducedDimensions[ i ] ] + size[ reducedDimensions[ i ] ];
    }
 
    // create new communicator with used nodes
    const MPI_Comm oldCommunicator = inputDistributedGrid.getCommunicator();
-   if(isInCut)
-   {
-      this->isSet=true;
+   if( isInCut ) {
+      this->isSet = true;
 
       auto fromGlobalMesh = inputDistributedGrid.getGlobalGrid();
       // set global grid
@@ -381,31 +348,31 @@ SetupByCut( DistributedGridType &inputDistributedGrid,
       typename GridType::CoordinatesType outDimensions;
       // set local grid
       typename GridType::PointType localOrigin;
-      typename GridType::CoordinatesType localBegin, localGridSize;
-
-      for(int i=0; i<Dimension;i++)
-      {
-         outOrigin[i] = fromGlobalMesh.getOrigin()[savedDimensions[i]];
-         outProportions[i] = fromGlobalMesh.getProportions()[savedDimensions[i]];
-         outDimensions[i] = fromGlobalMesh.getDimensions()[savedDimensions[i]];
-
-         this->domainDecomposition[i] = inputDistributedGrid.getDomainDecomposition()[savedDimensions[i]];
-         this->subdomainCoordinates[i] = inputDistributedGrid.getSubdomainCoordinates()[savedDimensions[i]];
-
-         this->lowerOverlap[i] = inputDistributedGrid.getLowerOverlap()[savedDimensions[i]];
-         this->upperOverlap[i] = inputDistributedGrid.getUpperOverlap()[savedDimensions[i]];
-         this->localSize[i] = inputDistributedGrid.getLocalSize()[savedDimensions[i]];
-         this->globalBegin[i] = inputDistributedGrid.getGlobalBegin()[savedDimensions[i]];
-         localGridSize[i] = inputDistributedGrid.getLocalMesh().getDimensions()[savedDimensions[i]];
-         localBegin[i] = inputDistributedGrid.getLocalMesh().getLocalBegin()[savedDimensions[i]];
-         localOrigin[i] = inputDistributedGrid.getLocalMesh().getOrigin()[savedDimensions[i]];
+      typename GridType::CoordinatesType localBegin;
+      typename GridType::CoordinatesType localGridSize;
+
+      for( int i = 0; i < Dimension; i++ ) {
+         outOrigin[ i ] = fromGlobalMesh.getOrigin()[ savedDimensions[ i ] ];
+         outProportions[ i ] = fromGlobalMesh.getProportions()[ savedDimensions[ i ] ];
+         outDimensions[ i ] = fromGlobalMesh.getDimensions()[ savedDimensions[ i ] ];
+
+         this->domainDecomposition[ i ] = inputDistributedGrid.getDomainDecomposition()[ savedDimensions[ i ] ];
+         this->subdomainCoordinates[ i ] = inputDistributedGrid.getSubdomainCoordinates()[ savedDimensions[ i ] ];
+
+         this->lowerOverlap[ i ] = inputDistributedGrid.getLowerOverlap()[ savedDimensions[ i ] ];
+         this->upperOverlap[ i ] = inputDistributedGrid.getUpperOverlap()[ savedDimensions[ i ] ];
+         this->localSize[ i ] = inputDistributedGrid.getLocalSize()[ savedDimensions[ i ] ];
+         this->globalBegin[ i ] = inputDistributedGrid.getGlobalBegin()[ savedDimensions[ i ] ];
+         localGridSize[ i ] = inputDistributedGrid.getLocalMesh().getDimensions()[ savedDimensions[ i ] ];
+         localBegin[ i ] = inputDistributedGrid.getLocalMesh().getLocalBegin()[ savedDimensions[ i ] ];
+         localOrigin[ i ] = inputDistributedGrid.getLocalMesh().getOrigin()[ savedDimensions[ i ] ];
       }
 
-      this->globalGrid.setDimensions(outDimensions);
-      this->globalGrid.setDomain(outOrigin,outProportions);
+      this->globalGrid.setDimensions( outDimensions );
+      this->globalGrid.setDomain( outOrigin, outProportions );
 
       // setOverlaps resets the local grid
-//      setOverlaps( this->lowerOverlap, this->upperOverlap );
+      //      setOverlaps( this->lowerOverlap, this->upperOverlap );
 
       localGrid.setDimensions( localGridSize );
       localGrid.setOrigin( localOrigin );
@@ -415,22 +382,20 @@ SetupByCut( DistributedGridType &inputDistributedGrid,
       localGrid.setLocalEnd( localBegin + localSize );
       // TODO: set interiorBegin, interiorEnd
 
-      const int newRank = getRankOfProcCoord(this->subdomainCoordinates);
+      const int newRank = getRankOfProcCoord( this->subdomainCoordinates );
       this->communicator = MPI::Comm_split( oldCommunicator, 1, newRank );
 
       setupNeighbors();
 
       bool isDistributed = false;
-      for( int i = 0; i < Dimension; i++ )
-      {
-         isDistributed |= domainDecomposition[i] > 1;
+      for( int i = 0; i < Dimension; i++ ) {
+         isDistributed |= domainDecomposition[ i ] > 1;
       }
       this->distributed = isDistributed;
 
       return true;
    }
-   else
-   {
+   else {
       this->communicator = MPI::Comm_split( oldCommunicator, MPI_UNDEFINED, 0 );
       return false;
    }
@@ -438,67 +403,54 @@ SetupByCut( DistributedGridType &inputDistributedGrid,
 
 template< int Dimension, typename Real, typename Device, typename Index >
 String
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-printProcessCoords() const
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::printProcessCoords() const
 {
-   String res = convertToString(this->subdomainCoordinates[0]);
-   for(int i=1; i<Dimension; i++)
-        res=res+String("-")+convertToString(this->subdomainCoordinates[i]);
+   String res = convertToString( this->subdomainCoordinates[ 0 ] );
+   for( int i = 1; i < Dimension; i++ )
+      res = res + String( "-" ) + convertToString( this->subdomainCoordinates[ i ] );
    return res;
 };
 
 template< int Dimension, typename Real, typename Device, typename Index >
 String
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-printProcessDistr() const
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::printProcessDistr() const
 {
-   String res = convertToString(this->domainDecomposition[0]);
-   for(int i=1; i<Dimension; i++)
-        res=res+String("-")+convertToString(this->domainDecomposition[i]);
+   String res = convertToString( this->domainDecomposition[ 0 ] );
+   for( int i = 1; i < Dimension; i++ )
+      res = res + String( "-" ) + convertToString( this->domainDecomposition[ i ] );
    return res;
 };
 
 template< int Dimension, typename Real, typename Device, typename Index >
 void
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-writeProlog( Logger& logger )
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::writeProlog( Logger& logger )
 {
    logger.writeParameter( "Domain decomposition:", this->getDomainDecomposition() );
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
 bool
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-operator==( const DistributedMesh& other ) const
-{
-   return globalGrid == other.globalGrid
-       && localGrid == other.localGrid
-       && localSize == other.localSize
-       && globalBegin == other.globalBegin
-       && lowerOverlap == other.lowerOverlap
-       && upperOverlap == other.upperOverlap
-       && domainDecomposition == other.domainDecomposition
-       && subdomainCoordinates == other.subdomainCoordinates
-       && distributed == other.distributed
-       && isSet == other.isSet
-       && communicator == other.communicator;
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::operator==( const DistributedMesh& other ) const
+{
+   return globalGrid == other.globalGrid && localGrid == other.localGrid && localSize == other.localSize
+       && globalBegin == other.globalBegin && lowerOverlap == other.lowerOverlap && upperOverlap == other.upperOverlap
+       && domainDecomposition == other.domainDecomposition && subdomainCoordinates == other.subdomainCoordinates
+       && distributed == other.distributed && isSet == other.isSet && communicator == other.communicator;
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
 bool
-DistributedMesh< Grid< Dimension, Real, Device, Index > >::
-operator!=( const DistributedMesh& other ) const
+DistributedMesh< Grid< Dimension, Real, Device, Index > >::operator!=( const DistributedMesh& other ) const
 {
    return ! operator==( other );
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
-std::ostream& operator<<( std::ostream& str, const DistributedMesh< Grid< Dimension, Real, Device, Index > >& grid )
+std::ostream&
+operator<<( std::ostream& str, const DistributedMesh< Grid< Dimension, Real, Device, Index > >& grid )
 {
-   for( int j = 0; j < MPI::GetSize(); j++ )
-   {
-      if( j == MPI::GetRank() )
-      {
+   for( int j = 0; j < MPI::GetSize(); j++ ) {
+      if( j == MPI::GetRank() ) {
          str << "Node : " << MPI::GetRank() << std::endl
              << " globalGrid : " << grid.getGlobalGrid() << std::endl
              << " localGrid : " << grid.getLocalMesh() << std::endl
@@ -522,6 +474,6 @@ std::ostream& operator<<( std::ostream& str, const DistributedMesh< Grid< Dimens
    return str;
 }
 
-} // namespace DistributedMeshes
-} // namespace Meshes
-} // namespace TNL
+}  // namespace DistributedMeshes
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer.h b/src/TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer.h
index bda46401f9f49220c5e33420bf5dce6ac776a022..48c75b882f676ce861b436401e60d2c366272ef6 100644
--- a/src/TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer.h
+++ b/src/TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer.h
@@ -19,210 +19,223 @@ namespace Meshes {
 namespace DistributedMeshes {
 
 // NOTE: this specialization works only for synchronizations on cells
-template< int MeshDimension,
-          typename Index,
-          typename Device,
-          typename GridReal >
+template< int MeshDimension, typename Index, typename Device, typename GridReal >
 class DistributedMeshSynchronizer< DistributedMesh< Grid< MeshDimension, GridReal, Device, Index > >, MeshDimension >
 {
-   public:
-      typedef typename Grid< MeshDimension, GridReal, Device, Index >::Cell Cell;
-      typedef DistributedMesh< Grid< MeshDimension, GridReal, Device, Index > > DistributedGridType;
-      typedef typename DistributedGridType::CoordinatesType CoordinatesType;
-      using SubdomainOverlapsType = typename DistributedGridType::SubdomainOverlapsType;
-
-      static constexpr int getMeshDimension() { return DistributedGridType::getMeshDimension(); };
-      static constexpr int getNeighborsCount() { return DistributedGridType::getNeighborsCount(); };
-
-      enum PeriodicBoundariesCopyDirection
-      {
-         BoundaryToOverlap,
-         OverlapToBoundary
-      };
-
-      DistributedMeshSynchronizer()
-      {
-         isSet = false;
-      };
-
-      DistributedMeshSynchronizer( const DistributedGridType *distributedGrid )
-      {
-         isSet = false;
-         setDistributedGrid( distributedGrid );
-      };
-
-      void setPeriodicBoundariesCopyDirection( const PeriodicBoundariesCopyDirection dir )
-      {
-         this->periodicBoundariesCopyDirection = dir;
-      }
-
-      void setDistributedGrid( const DistributedGridType *distributedGrid )
-      {
-         isSet = true;
-
-         this->distributedGrid = distributedGrid;
-
-         const SubdomainOverlapsType& lowerOverlap = this->distributedGrid->getLowerOverlap();
-         const SubdomainOverlapsType& upperOverlap = this->distributedGrid->getUpperOverlap();
-
-         const CoordinatesType& localBegin = this->distributedGrid->getLocalMesh().getLocalBegin();
-         const CoordinatesType& localSize = this->distributedGrid->getLocalSize();
-
-         const int *neighbors = distributedGrid->getNeighbors();
-
-         for( int i=0; i<this->getNeighborsCount(); i++ )
-         {
-            Index sendSize=1;//send and receive  areas have the same size
-
-           // bool isBoundary=( neighbor[ i ] == -1 );
-            auto directions=Directions::template getXYZ<getMeshDimension()>(i);
-
-            sendDimensions[i]=localSize; //send and receive areas have the same dimensions
-            sendBegin[i]=localBegin;
-            recieveBegin[i]=localBegin;
+public:
+   using Cell = typename Grid< MeshDimension, GridReal, Device, Index >::Cell;
+   using DistributedGridType = DistributedMesh< Grid< MeshDimension, GridReal, Device, Index > >;
+   using CoordinatesType = typename DistributedGridType::CoordinatesType;
+   using SubdomainOverlapsType = typename DistributedGridType::SubdomainOverlapsType;
+
+   static constexpr int
+   getMeshDimension()
+   {
+      return DistributedGridType::getMeshDimension();
+   };
+   static constexpr int
+   getNeighborsCount()
+   {
+      return DistributedGridType::getNeighborsCount();
+   };
+
+   enum PeriodicBoundariesCopyDirection
+   {
+      BoundaryToOverlap,
+      OverlapToBoundary
+   };
+
+   DistributedMeshSynchronizer()
+   {
+      isSet = false;
+   };
+
+   DistributedMeshSynchronizer( const DistributedGridType* distributedGrid )
+   {
+      isSet = false;
+      setDistributedGrid( distributedGrid );
+   };
+
+   void
+   setPeriodicBoundariesCopyDirection( const PeriodicBoundariesCopyDirection dir )
+   {
+      this->periodicBoundariesCopyDirection = dir;
+   }
+
+   void
+   setDistributedGrid( const DistributedGridType* distributedGrid )
+   {
+      isSet = true;
+
+      this->distributedGrid = distributedGrid;
+
+      const SubdomainOverlapsType& lowerOverlap = this->distributedGrid->getLowerOverlap();
+      const SubdomainOverlapsType& upperOverlap = this->distributedGrid->getUpperOverlap();
+
+      const CoordinatesType& localBegin = this->distributedGrid->getLocalMesh().getLocalBegin();
+      const CoordinatesType& localSize = this->distributedGrid->getLocalSize();
+
+      const int* neighbors = distributedGrid->getNeighbors();
+
+      for( int i = 0; i < this->getNeighborsCount(); i++ ) {
+         Index sendSize = 1;  // send and receive  areas have the same size
+
+         // bool isBoundary=( neighbor[ i ] == -1 );
+         auto directions = Directions::template getXYZ< getMeshDimension() >( i );
+
+         sendDimensions[ i ] = localSize;  // send and receive areas have the same dimensions
+         sendBegin[ i ] = localBegin;
+         recieveBegin[ i ] = localBegin;
+
+         for( int j = 0; j < this->getMeshDimension(); j++ ) {
+            if( directions[ j ] == -1 ) {
+               sendDimensions[ i ][ j ] = lowerOverlap[ j ];
+               recieveBegin[ i ][ j ] = 0;
+            }
 
-            for(int j=0;j<this->getMeshDimension();j++)
-            {
-               if(directions[j]==-1)
-               {
-                  sendDimensions[i][j]=lowerOverlap[j];
-                  recieveBegin[i][j]=0;
-               }
+            if( directions[ j ] == 1 ) {
+               sendDimensions[ i ][ j ] = upperOverlap[ j ];
+               sendBegin[ i ][ j ] = localBegin[ j ] + localSize[ j ] - upperOverlap[ j ];
+               recieveBegin[ i ][ j ] = localBegin[ j ] + localSize[ j ];
+            }
 
-               if(directions[j]==1)
-               {
-                  sendDimensions[i][j]=upperOverlap[j];
-                  sendBegin[i][j]=localBegin[j]+localSize[j]-upperOverlap[j];
-                  recieveBegin[i][j]=localBegin[j]+localSize[j];
-               }
+            sendSize *= sendDimensions[ i ][ j ];
+         }
 
-               sendSize*=sendDimensions[i][j];
-            }
+         sendSizes[ i ] = sendSize;
 
-            sendSizes[ i ] = sendSize;
+         if( this->periodicBoundariesCopyDirection == OverlapToBoundary && neighbors[ i ] == -1 )
+            swap( sendBegin[ i ], recieveBegin[ i ] );
+      }
+   }
+
+   template< typename MeshFunctionType, typename PeriodicBoundariesMaskPointer = Pointers::SharedPointer< MeshFunctionType > >
+   void
+   synchronize( MeshFunctionType& meshFunction,
+                bool periodicBoundaries = false,
+                const PeriodicBoundariesMaskPointer& mask = PeriodicBoundariesMaskPointer( nullptr ) )
+   {
+      using RealType = typename MeshFunctionType::RealType;
+
+      static_assert( MeshFunctionType::getEntitiesDimension() == MeshFunctionType::getMeshDimension(),
+                     "this specialization works only for synchronizations on cells" );
+      TNL_ASSERT_TRUE( isSet, "Synchronizer is not set, but used to synchronize" );
+
+      if( ! distributedGrid->isDistributed() )
+         return;
+
+      // allocate buffers (setSize does nothing if the array size is already correct)
+      for( int i = 0; i < this->getNeighborsCount(); i++ ) {
+         sendBuffers[ i ].setSize( sendSizes[ i ] * sizeof( RealType ) );
+         recieveBuffers[ i ].setSize( sendSizes[ i ] * sizeof( RealType ) );
+      }
 
-            if( this->periodicBoundariesCopyDirection == OverlapToBoundary &&
-               neighbors[ i ] == -1 )
-                  swap( sendBegin[i], recieveBegin[i] );
+      const int* neighbors = distributedGrid->getNeighbors();
+      const int* periodicNeighbors = distributedGrid->getPeriodicNeighbors();
+
+      // fill send buffers
+      copyBuffers( meshFunction,
+                   sendBuffers,
+                   sendBegin,
+                   sendDimensions,
+                   true,
+                   neighbors,
+                   periodicBoundaries,
+                   PeriodicBoundariesMaskPointer( nullptr ) );  // the mask is used only when receiving data );
+
+      // async send and receive
+      MPI_Request requests[ 2 * this->getNeighborsCount() ];
+      MPI_Comm communicator = distributedGrid->getCommunicator();
+      int requestsCount( 0 );
+
+      // send everything, recieve everything
+      for( int i = 0; i < this->getNeighborsCount(); i++ ) {
+         /*TNL_MPI_PRINT( "Sending data... " << i << " sizes -> "
+            << sendSizes[ i ] << "sendDimensions -> " <<  sendDimensions[ i ]
+            << " upperOverlap -> " << this->distributedGrid->getUpperOverlap() );*/
+         if( neighbors[ i ] != -1 ) {
+            // TNL_MPI_PRINT( "Sending data to node " << neighbors[ i ] );
+            requests[ requestsCount++ ] = MPI::Isend(
+               reinterpret_cast< RealType* >( sendBuffers[ i ].getData() ), sendSizes[ i ], neighbors[ i ], 0, communicator );
+            // TNL_MPI_PRINT( "Receiving data from node " << neighbors[ i ] );
+            requests[ requestsCount++ ] = MPI::Irecv( reinterpret_cast< RealType* >( recieveBuffers[ i ].getData() ),
+                                                      sendSizes[ i ],
+                                                      neighbors[ i ],
+                                                      0,
+                                                      communicator );
          }
-     }
-
-      template< typename MeshFunctionType,
-                typename PeriodicBoundariesMaskPointer = Pointers::SharedPointer< MeshFunctionType > >
-      void synchronize( MeshFunctionType &meshFunction,
-                        bool periodicBoundaries = false,
-                        const PeriodicBoundariesMaskPointer& mask = PeriodicBoundariesMaskPointer( nullptr ) )
-      {
-         using RealType = typename MeshFunctionType::RealType;
-
-         static_assert( MeshFunctionType::getEntitiesDimension() == MeshFunctionType::getMeshDimension(),
-                        "this specialization works only for synchronizations on cells" );
-         TNL_ASSERT_TRUE( isSet, "Synchronizer is not set, but used to synchronize" );
-
-         if( !distributedGrid->isDistributed() ) return;
-
-         // allocate buffers (setSize does nothing if the array size is already correct)
-         for( int i=0; i<this->getNeighborsCount(); i++ ) {
-            sendBuffers[ i ].setSize( sendSizes[ i ] * sizeof(RealType) );
-            recieveBuffers[ i ].setSize( sendSizes[ i ] * sizeof(RealType));
-         }
-
-         const int *neighbors = distributedGrid->getNeighbors();
-         const int *periodicNeighbors = distributedGrid->getPeriodicNeighbors();
-
-         //fill send buffers
-         copyBuffers( meshFunction,
-            sendBuffers, sendBegin,sendDimensions,
-            true,
-            neighbors,
-            periodicBoundaries,
-            PeriodicBoundariesMaskPointer( nullptr ) ); // the mask is used only when receiving data );
-
-         //async send and receive
-         MPI_Request requests[2*this->getNeighborsCount()];
-         MPI_Comm communicator = distributedGrid->getCommunicator();
-         int requestsCount( 0 );
-
-         //send everything, recieve everything
-         for( int i=0; i<this->getNeighborsCount(); i++ )
-         {
-            /*TNL_MPI_PRINT( "Sending data... " << i << " sizes -> "
-               << sendSizes[ i ] << "sendDimensions -> " <<  sendDimensions[ i ]
-               << " upperOverlap -> " << this->distributedGrid->getUpperOverlap() );*/
-            if( neighbors[ i ] != -1 )
-            {
-               //TNL_MPI_PRINT( "Sending data to node " << neighbors[ i ] );
-               requests[ requestsCount++ ] = MPI::Isend( reinterpret_cast<RealType*>( sendBuffers[ i ].getData() ),  sendSizes[ i ], neighbors[ i ], 0, communicator );
-               //TNL_MPI_PRINT( "Receiving data from node " << neighbors[ i ] );
-               requests[ requestsCount++ ] = MPI::Irecv( reinterpret_cast<RealType*>( recieveBuffers[ i ].getData() ),  sendSizes[ i ], neighbors[ i ], 0, communicator );
-            }
-            else if( periodicBoundaries && sendSizes[ i ] !=0 )
-            {
-               //TNL_MPI_PRINT( "Sending data to node " << periodicNeighbors[ i ] );
-               requests[ requestsCount++ ] = MPI::Isend( reinterpret_cast<RealType*>( sendBuffers[ i ].getData() ),  sendSizes[ i ], periodicNeighbors[ i ], 1, communicator );
-               //TNL_MPI_PRINT( "Receiving data to node " << periodicNeighbors[ i ] );
-               requests[ requestsCount++ ] = MPI::Irecv( reinterpret_cast<RealType*>( recieveBuffers[ i ].getData() ),  sendSizes[ i ], periodicNeighbors[ i ], 1, communicator );
-            }
+         else if( periodicBoundaries && sendSizes[ i ] != 0 ) {
+            // TNL_MPI_PRINT( "Sending data to node " << periodicNeighbors[ i ] );
+            requests[ requestsCount++ ] = MPI::Isend( reinterpret_cast< RealType* >( sendBuffers[ i ].getData() ),
+                                                      sendSizes[ i ],
+                                                      periodicNeighbors[ i ],
+                                                      1,
+                                                      communicator );
+            // TNL_MPI_PRINT( "Receiving data to node " << periodicNeighbors[ i ] );
+            requests[ requestsCount++ ] = MPI::Irecv( reinterpret_cast< RealType* >( recieveBuffers[ i ].getData() ),
+                                                      sendSizes[ i ],
+                                                      periodicNeighbors[ i ],
+                                                      1,
+                                                      communicator );
          }
+      }
 
-        //wait until send is done
-        //TNL_MPI_PRINT( "Waiting for data ..." )
-        MPI::Waitall( requests, requestsCount );
-
-        //copy data from receive buffers
-        //TNL_MPI_PRINT( "Copying data ..." )
-        copyBuffers(meshFunction,
-            recieveBuffers,recieveBegin,sendDimensions  ,
-            false,
-            neighbors,
-            periodicBoundaries,
-            mask );
-    }
-
-   private:
-      template< typename MeshFunctionType,
-                typename PeriodicBoundariesMaskPointer >
-      void copyBuffers(
-         MeshFunctionType& meshFunction,
-         Containers::Array<std::uint8_t, Device, Index>* buffers,
-         CoordinatesType* begins,
-         CoordinatesType* sizes,
-         bool toBuffer,
-         const int* neighbor,
-         bool periodicBoundaries,
-         const PeriodicBoundariesMaskPointer& mask )
-      {
-         using RealType = typename MeshFunctionType::RealType;
-         using Helper = BufferEntitiesHelper< MeshFunctionType, PeriodicBoundariesMaskPointer, getMeshDimension(), RealType, Device >;
-
-         for(int i=0;i<this->getNeighborsCount();i++)
-         {
-            bool isBoundary=( neighbor[ i ] == -1 );
-            if( ! isBoundary || periodicBoundaries )
-            {
-               Helper::BufferEntities( meshFunction, mask, reinterpret_cast<RealType*>( buffers[ i ].getData() ), isBoundary, begins[i], sizes[i], toBuffer );
-            }
+      // wait until send is done
+      // TNL_MPI_PRINT( "Waiting for data ..." )
+      MPI::Waitall( requests, requestsCount );
+
+      // copy data from receive buffers
+      // TNL_MPI_PRINT( "Copying data ..." )
+      copyBuffers( meshFunction, recieveBuffers, recieveBegin, sendDimensions, false, neighbors, periodicBoundaries, mask );
+   }
+
+private:
+   template< typename MeshFunctionType, typename PeriodicBoundariesMaskPointer >
+   void
+   copyBuffers( MeshFunctionType& meshFunction,
+                Containers::Array< std::uint8_t, Device, Index >* buffers,
+                CoordinatesType* begins,
+                CoordinatesType* sizes,
+                bool toBuffer,
+                const int* neighbor,
+                bool periodicBoundaries,
+                const PeriodicBoundariesMaskPointer& mask )
+   {
+      using RealType = typename MeshFunctionType::RealType;
+      using Helper =
+         BufferEntitiesHelper< MeshFunctionType, PeriodicBoundariesMaskPointer, getMeshDimension(), RealType, Device >;
+
+      for( int i = 0; i < this->getNeighborsCount(); i++ ) {
+         bool isBoundary = ( neighbor[ i ] == -1 );
+         if( ! isBoundary || periodicBoundaries ) {
+            Helper::BufferEntities( meshFunction,
+                                    mask,
+                                    reinterpret_cast< RealType* >( buffers[ i ].getData() ),
+                                    isBoundary,
+                                    begins[ i ],
+                                    sizes[ i ],
+                                    toBuffer );
          }
       }
+   }
 
-   private:
-
-      Containers::StaticArray< getNeighborsCount(), int > sendSizes;
-      Containers::Array< std::uint8_t, Device, Index > sendBuffers[getNeighborsCount()];
-      Containers::Array< std::uint8_t, Device, Index > recieveBuffers[getNeighborsCount()];
+private:
+   Containers::StaticArray< getNeighborsCount(), int > sendSizes;
+   Containers::Array< std::uint8_t, Device, Index > sendBuffers[ getNeighborsCount() ];
+   Containers::Array< std::uint8_t, Device, Index > recieveBuffers[ getNeighborsCount() ];
 
-      PeriodicBoundariesCopyDirection periodicBoundariesCopyDirection = BoundaryToOverlap;
+   PeriodicBoundariesCopyDirection periodicBoundariesCopyDirection = BoundaryToOverlap;
 
-      CoordinatesType sendDimensions[getNeighborsCount()];
-      CoordinatesType recieveDimensions[getNeighborsCount()];
-      CoordinatesType sendBegin[getNeighborsCount()];
-      CoordinatesType recieveBegin[getNeighborsCount()];
+   CoordinatesType sendDimensions[ getNeighborsCount() ];
+   CoordinatesType recieveDimensions[ getNeighborsCount() ];
+   CoordinatesType sendBegin[ getNeighborsCount() ];
+   CoordinatesType recieveBegin[ getNeighborsCount() ];
 
-      const DistributedGridType *distributedGrid;
+   const DistributedGridType* distributedGrid;
 
-      bool isSet;
+   bool isSet;
 };
 
-} // namespace DistributedMeshes
-} // namespace Meshes
-} // namespace TNL
+}  // namespace DistributedMeshes
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/DistributedMeshes/DistributedMesh.h b/src/TNL/Meshes/DistributedMeshes/DistributedMesh.h
index 28151b9b7ba5c851bd6861f73e0df27a94747292..ff384078b56cfb5fffc060d88444b30e0c11fce9 100644
--- a/src/TNL/Meshes/DistributedMeshes/DistributedMesh.h
+++ b/src/TNL/Meshes/DistributedMeshes/DistributedMesh.h
@@ -18,36 +18,36 @@ namespace Meshes {
 namespace DistributedMeshes {
 
 template< typename Mesh >
-class DistributedMesh
-: protected GlobalIndexStorageFamily< Mesh >
+class DistributedMesh : protected GlobalIndexStorageFamily< Mesh >
 {
 public:
-   using MeshType           = Mesh;
-   using Config             = typename Mesh::Config;
-   using DeviceType         = typename Mesh::DeviceType;
-   using GlobalIndexType    = typename Mesh::GlobalIndexType;
-   using LocalIndexType     = typename Mesh::LocalIndexType;
-   using PointType          = typename Mesh::PointType;
-   using RealType           = typename PointType::RealType;
-   using GlobalIndexArray   = typename Mesh::GlobalIndexArray;
-   using VTKTypesArrayType  = Containers::Array< std::uint8_t, Devices::Sequential, GlobalIndexType >;
+   using MeshType = Mesh;
+   using Config = typename Mesh::Config;
+   using DeviceType = typename Mesh::DeviceType;
+   using GlobalIndexType = typename Mesh::GlobalIndexType;
+   using LocalIndexType = typename Mesh::LocalIndexType;
+   using PointType = typename Mesh::PointType;
+   using RealType = typename PointType::RealType;
+   using GlobalIndexArray = typename Mesh::GlobalIndexArray;
+   using VTKTypesArrayType = Containers::Array< std::uint8_t, Devices::Sequential, GlobalIndexType >;
 
    DistributedMesh() = default;
 
-   DistributedMesh( MeshType&& localMesh )
-   : localMesh( std::move(localMesh) )
-   {}
+   DistributedMesh( MeshType&& localMesh ) : localMesh( std::move( localMesh ) ) {}
 
    DistributedMesh( const DistributedMesh& ) = default;
 
-   DistributedMesh( DistributedMesh&& ) = default;
+   DistributedMesh( DistributedMesh&& ) noexcept = default;
 
-   DistributedMesh& operator=( const DistributedMesh& ) = default;
+   DistributedMesh&
+   operator=( const DistributedMesh& ) = default;
 
-   DistributedMesh& operator=( DistributedMesh&& ) = default;
+   DistributedMesh&
+   operator=( DistributedMesh&& ) noexcept = default;
 
    template< typename Mesh_ >
-   DistributedMesh& operator=( const Mesh_& other )
+   DistributedMesh&
+   operator=( const Mesh_& other )
    {
       GlobalIndexStorageFamily< Mesh >::operator=( other );
       localMesh = other.getLocalMesh();
@@ -58,17 +58,17 @@ public:
       return *this;
    }
 
-   bool operator==( const DistributedMesh& other ) const
+   bool
+   operator==( const DistributedMesh& other ) const
    {
-      return ( GlobalIndexStorageFamily< Mesh, DeviceType >::operator==( other ) &&
-               localMesh == other.getLocalMesh() &&
-               communicator == other.getCommunicator() &&
-               ghostLevels == other.getGhostLevels() &&
-               vtkPointGhostTypesArray == other.vtkPointGhostTypes() &&
-               vtkCellGhostTypesArray == other.vtkCellGhostTypes() );
+      return ( GlobalIndexStorageFamily< Mesh, DeviceType >::operator==( other ) && localMesh == other.getLocalMesh()
+               && communicator == other.getCommunicator() && ghostLevels == other.getGhostLevels()
+               && vtkPointGhostTypesArray == other.vtkPointGhostTypes()
+               && vtkCellGhostTypesArray == other.vtkCellGhostTypes() );
    }
 
-   bool operator!=( const DistributedMesh& other ) const
+   bool
+   operator!=( const DistributedMesh& other ) const
    {
       return ! operator==( other );
    }
@@ -76,7 +76,8 @@ public:
    /**
     * Common methods redirected to the local mesh
     */
-   static constexpr int getMeshDimension()
+   static constexpr int
+   getMeshDimension()
    {
       return MeshType::getMeshDimension();
    }
@@ -86,41 +87,44 @@ public:
    using Face = typename MeshType::template EntityType< getMeshDimension() - 1 >;
    using Vertex = typename MeshType::template EntityType< 0 >;
 
-   static_assert( Mesh::Config::entityTagsStorage( getMeshDimension() ),
-                  "DistributedMesh must store entity tags on cells" );
-   static_assert( Mesh::Config::entityTagsStorage( 0 ),
-                  "DistributedMesh must store entity tags on vertices" );
-
+   static_assert( Mesh::Config::entityTagsStorage( getMeshDimension() ), "DistributedMesh must store entity tags on cells" );
+   static_assert( Mesh::Config::entityTagsStorage( 0 ), "DistributedMesh must store entity tags on vertices" );
 
    /**
     * Methods specific to the distributed mesh
     */
-   void setCommunicator( MPI_Comm communicator )
+   void
+   setCommunicator( MPI_Comm communicator )
    {
       this->communicator = communicator;
    }
 
-   MPI_Comm getCommunicator() const
+   MPI_Comm
+   getCommunicator() const
    {
       return communicator;
    }
 
-   const MeshType& getLocalMesh() const
+   const MeshType&
+   getLocalMesh() const
    {
       return localMesh;
    }
 
-   MeshType& getLocalMesh()
+   MeshType&
+   getLocalMesh()
    {
       return localMesh;
    }
 
-   void setGhostLevels( int levels )
+   void
+   setGhostLevels( int levels )
    {
       ghostLevels = levels;
    }
 
-   int getGhostLevels() const
+   int
+   getGhostLevels() const
    {
       return ghostLevels;
    }
@@ -166,8 +170,8 @@ public:
    // wrapper for MeshType::reorderEntities - reorders the local mesh, global indices and,
    // if applicable, the vtkCellGhostTypes/vtkPointGhostTypes arrays
    template< int Dimension >
-   void reorderEntities( const GlobalIndexArray& perm,
-                         const GlobalIndexArray& iperm )
+   void
+   reorderEntities( const GlobalIndexArray& perm, const GlobalIndexArray& iperm )
    {
       localMesh.template reorderEntities< Dimension >( perm, iperm );
       if( getGlobalIndices< Dimension >().getSize() > 0 )
@@ -195,10 +199,13 @@ public:
                 << "\tvertices count:\t" << verticesCount << "\n"
                 << "\tGhost levels:\t" << getGhostLevels() << "\n"
                 << "\tGhost cells count:\t" << localMesh.template getGhostEntitiesCount< Mesh::getMeshDimension() >() << "\n"
-                << "\tGhost faces count:\t" << localMesh.template getGhostEntitiesCount< Mesh::getMeshDimension() - 1 >() << "\n"
+                << "\tGhost faces count:\t" << localMesh.template getGhostEntitiesCount< Mesh::getMeshDimension() - 1 >()
+                << "\n"
                 << "\tGhost vertices count:\t" << localMesh.template getGhostEntitiesCount< 0 >() << "\n"
-                << "\tBoundary cells count:\t" << localMesh.template getBoundaryIndices< Mesh::getMeshDimension() >().getSize() << "\n"
-                << "\tBoundary faces count:\t" << localMesh.template getBoundaryIndices< Mesh::getMeshDimension() - 1 >().getSize() << "\n"
+                << "\tBoundary cells count:\t" << localMesh.template getBoundaryIndices< Mesh::getMeshDimension() >().getSize()
+                << "\n"
+                << "\tBoundary faces count:\t"
+                << localMesh.template getBoundaryIndices< Mesh::getMeshDimension() - 1 >().getSize() << "\n"
                 << "\tBoundary vertices count:\t" << localMesh.template getBoundaryIndices< 0 >().getSize() << "\n";
             const GlobalIndexType globalPointIndices = getGlobalIndices< 0 >().getSize();
             const GlobalIndexType globalCellIndices = getGlobalIndices< Mesh::getMeshDimension() >().getSize();
@@ -214,13 +221,17 @@ public:
             }
             else {
                if( globalPointIndices > 0 )
-                  str << "WARNING: mesh has 0 ghost levels, but array of global point indices has non-zero size: " << globalPointIndices << "\n";
+                  str << "WARNING: mesh has 0 ghost levels, but array of global point indices has non-zero size: "
+                      << globalPointIndices << "\n";
                if( globalCellIndices > 0 )
-                  str << "WARNING: mesh has 0 ghost levels, but array of global cell indices has non-zero size: " << globalCellIndices << "\n";
+                  str << "WARNING: mesh has 0 ghost levels, but array of global cell indices has non-zero size: "
+                      << globalCellIndices << "\n";
                if( vtkPointGhostTypesArray.getSize() > 0 )
-                  str << "WARNING: mesh has 0 ghost levels, but array of VTK point ghost types has non-zero size: " << vtkPointGhostTypesArray.getSize() << "\n";
+                  str << "WARNING: mesh has 0 ghost levels, but array of VTK point ghost types has non-zero size: "
+                      << vtkPointGhostTypesArray.getSize() << "\n";
                if( vtkCellGhostTypesArray.getSize() > 0 )
-                  str << "WARNING: mesh has 0 ghost levels, but array of VTK cell ghost types has non-zero size: " << vtkCellGhostTypesArray.getSize() << "\n";
+                  str << "WARNING: mesh has 0 ghost levels, but array of VTK cell ghost types has non-zero size: "
+                      << vtkCellGhostTypesArray.getSize() << "\n";
             }
             str.flush();
          }
@@ -237,8 +248,8 @@ protected:
    VTKTypesArrayType vtkPointGhostTypesArray, vtkCellGhostTypesArray;
 };
 
-} // namespace DistributedMeshes
-} // namespace Meshes
-} // namespace TNL
+}  // namespace DistributedMeshes
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/DistributedMeshes/DistributedGrid.h>
diff --git a/src/TNL/Meshes/DistributedMeshes/DistributedMeshSynchronizer.h b/src/TNL/Meshes/DistributedMeshes/DistributedMeshSynchronizer.h
index 9eae56706f21b282add557aa001f5dad9990e6e7..45b84a9b1ed6799840a13b998adfe98e4ff8768a 100644
--- a/src/TNL/Meshes/DistributedMeshes/DistributedMeshSynchronizer.h
+++ b/src/TNL/Meshes/DistributedMeshes/DistributedMeshSynchronizer.h
@@ -19,21 +19,19 @@ namespace Meshes {
 namespace DistributedMeshes {
 
 template< typename T, typename Enable = void >
-struct HasMeshType
-: public std::false_type
+struct HasMeshType : public std::false_type
 {};
 
 template< typename T >
-struct HasMeshType< T, typename enable_if_type< typename T::MeshType >::type >
-: public std::true_type
+struct HasMeshType< T, typename enable_if_type< typename T::MeshType >::type > : public std::true_type
 {};
 
-template< typename DistributedMesh,
-          int EntityDimension = DistributedMesh::getMeshDimension() >
+template< typename DistributedMesh, int EntityDimension = DistributedMesh::getMeshDimension() >
 class DistributedMeshSynchronizer
 : public Containers::ByteArraySynchronizer< typename DistributedMesh::DeviceType, typename DistributedMesh::GlobalIndexType >
 {
-   using Base = Containers::ByteArraySynchronizer< typename DistributedMesh::DeviceType, typename DistributedMesh::GlobalIndexType >;
+   using Base =
+      Containers::ByteArraySynchronizer< typename DistributedMesh::DeviceType, typename DistributedMesh::GlobalIndexType >;
 
 public:
    using DeviceType = typename DistributedMesh::DeviceType;
@@ -41,7 +39,7 @@ public:
    using ByteArrayView = typename Base::ByteArrayView;
    using RequestsVector = typename Base::RequestsVector;
 
-   ~DistributedMeshSynchronizer()
+   ~DistributedMeshSynchronizer() override
    {
       // wait for pending async operation, otherwise it would crash
       if( this->async_op.valid() )
@@ -50,11 +48,13 @@ public:
 
    DistributedMeshSynchronizer() = default;
 
-   void initialize( const DistributedMesh& mesh )
+   void
+   initialize( const DistributedMesh& mesh )
    {
       if( mesh.getGhostLevels() <= 0 )
          throw std::logic_error( "There are no ghost levels on the distributed mesh." );
-      TNL_ASSERT_EQ( mesh.template getGlobalIndices< EntityDimension >().getSize(), mesh.getLocalMesh().template getEntitiesCount< EntityDimension >(),
+      TNL_ASSERT_EQ( mesh.template getGlobalIndices< EntityDimension >().getSize(),
+                     mesh.getLocalMesh().template getEntitiesCount< EntityDimension >(),
                      "Global indices are not allocated properly." );
 
       communicator = mesh.getCommunicator();
@@ -68,9 +68,7 @@ public:
       {
          Containers::Array< GlobalIndexType, Devices::Host, int > sendbuf( nproc );
          sendbuf.setValue( ownStart );
-         MPI::Alltoall( sendbuf.getData(), 1,
-                        globalOffsets.getData(), 1,
-                        communicator );
+         MPI::Alltoall( sendbuf.getData(), 1, globalOffsets.getData(), 1, communicator );
       }
 
       // count local ghost entities for each rank
@@ -81,21 +79,23 @@ public:
          hostGlobalIndices = mesh.template getGlobalIndices< EntityDimension >();
          GlobalIndexType prev_global_idx = 0;
          mesh.getLocalMesh().template forGhost< EntityDimension, Devices::Sequential >(
-            [&] ( GlobalIndexType local_idx )
+            [ & ]( GlobalIndexType local_idx )
             {
                if( ! std::is_same< DeviceType, Devices::Cuda >::value )
-               if( ! mesh.getLocalMesh().template isGhostEntity< EntityDimension >( local_idx ) )
-                  throw std::runtime_error( "encountered local entity while iterating over ghost entities - the mesh is probably inconsistent or there is a bug in the DistributedMeshSynchronizer" );
+                  if( ! mesh.getLocalMesh().template isGhostEntity< EntityDimension >( local_idx ) )
+                     throw std::runtime_error( "encountered local entity while iterating over ghost entities - the mesh is "
+                                               "probably inconsistent or there is a bug in the DistributedMeshSynchronizer" );
                const GlobalIndexType global_idx = hostGlobalIndices[ local_idx ];
                if( global_idx < prev_global_idx )
-                  throw std::runtime_error( "ghost indices are not sorted - the mesh is probably inconsistent or there is a bug in the DistributedMeshSynchronizer" );
+                  throw std::runtime_error( "ghost indices are not sorted - the mesh is probably inconsistent or there is a "
+                                            "bug in the DistributedMeshSynchronizer" );
                prev_global_idx = global_idx;
                const int owner = getEntityOwner( global_idx );
                if( owner == rank )
-                  throw std::runtime_error( "the owner of a ghost entity cannot be the local rank - the mesh is probably inconsistent or there is a bug in the DistributedMeshSynchronizer" );
+                  throw std::runtime_error( "the owner of a ghost entity cannot be the local rank - the mesh is probably "
+                                            "inconsistent or there is a bug in the DistributedMeshSynchronizer" );
                ++localGhostCounts[ owner ];
-            }
-         );
+            } );
       }
 
       // exchange the ghost counts
@@ -105,11 +105,9 @@ public:
          sendbuf.setDimensions( nproc, nproc );
          // copy the local ghost counts into all rows of the sendbuf
          for( int j = 0; j < nproc; j++ )
-         for( int i = 0; i < nproc; i++ )
-            sendbuf.setElement( j, i, localGhostCounts[ i ] );
-         MPI::Alltoall( &sendbuf(0, 0), nproc,
-                        &ghostEntitiesCounts(0, 0), nproc,
-                        communicator );
+            for( int i = 0; i < nproc; i++ )
+               sendbuf.setElement( j, i, localGhostCounts[ i ] );
+         MPI::Alltoall( &sendbuf( 0, 0 ), nproc, &ghostEntitiesCounts( 0, 0 ), nproc, communicator );
       }
 
       // allocate ghost offsets
@@ -133,25 +131,25 @@ public:
          ghostOffsets[ 0 ] = ghostOffset;
          for( int i = 0; i < nproc; i++ ) {
             if( ghostEntitiesCounts( rank, i ) > 0 ) {
-               requests.push_back( MPI::Isend(
-                        mesh.template getGlobalIndices< EntityDimension >().getData() + ghostOffset,
-                        ghostEntitiesCounts( rank, i ),
-                        i, 0, communicator ) );
+               requests.push_back( MPI::Isend( mesh.template getGlobalIndices< EntityDimension >().getData() + ghostOffset,
+                                               ghostEntitiesCounts( rank, i ),
+                                               i,
+                                               0,
+                                               communicator ) );
                ghostOffset += ghostEntitiesCounts( rank, i );
             }
             // update ghost offsets
             ghostOffsets[ i + 1 ] = ghostOffset;
          }
-         TNL_ASSERT_EQ( ghostOffsets[ nproc ], mesh.getLocalMesh().template getEntitiesCount< EntityDimension >(),
+         TNL_ASSERT_EQ( ghostOffsets[ nproc ],
+                        mesh.getLocalMesh().template getEntitiesCount< EntityDimension >(),
                         "bug in setting ghost offsets" );
 
          // receive ghost indices from the neighboring ranks
          for( int j = 0; j < nproc; j++ ) {
             if( ghostEntitiesCounts( j, rank ) > 0 ) {
                requests.push_back( MPI::Irecv(
-                        ghostNeighbors.getData() + ghostNeighborOffsets[ j ],
-                        ghostEntitiesCounts( j, rank ),
-                        j, 0, communicator ) );
+                  ghostNeighbors.getData() + ghostNeighborOffsets[ j ], ghostEntitiesCounts( j, rank ), j, 0, communicator ) );
             }
          }
 
@@ -163,9 +161,9 @@ public:
       }
    }
 
-   template< typename MeshFunction,
-             std::enable_if_t< HasMeshType< MeshFunction >::value, bool > = true >
-   void synchronize( MeshFunction& function )
+   template< typename MeshFunction, std::enable_if_t< HasMeshType< MeshFunction >::value, bool > = true >
+   void
+   synchronize( MeshFunction& function )
    {
       static_assert( MeshFunction::getEntitiesDimension() == EntityDimension,
                      "the mesh function's entity dimension does not match" );
@@ -175,35 +173,38 @@ public:
       synchronize( function.getData() );
    }
 
-   template< typename Array,
-             std::enable_if_t< ! HasMeshType< Array >::value, bool > = true >
-   void synchronize( Array& array )
+   template< typename Array, std::enable_if_t< ! HasMeshType< Array >::value, bool > = true >
+   void
+   synchronize( Array& array )
    {
       // wrapped only because nvcc is fucked up and does not like __cuda_callable__ lambdas in enable_if methods
       synchronizeArray( array );
    }
 
    template< typename Array >
-   void synchronizeArray( Array& array, int valuesPerElement = 1 )
+   void
+   synchronizeArray( Array& array, int valuesPerElement = 1 )
    {
-      static_assert( std::is_same< typename Array::DeviceType, DeviceType >::value,
-                     "mismatched DeviceType of the array" );
+      static_assert( std::is_same< typename Array::DeviceType, DeviceType >::value, "mismatched DeviceType of the array" );
       using ValueType = typename Array::ValueType;
 
       ByteArrayView view;
-      view.bind( reinterpret_cast<std::uint8_t*>( array.getData() ), sizeof(ValueType) * array.getSize() );
-      synchronizeByteArray( view, sizeof(ValueType) * valuesPerElement );
+      view.bind( reinterpret_cast< std::uint8_t* >( array.getData() ), sizeof( ValueType ) * array.getSize() );
+      synchronizeByteArray( view, sizeof( ValueType ) * valuesPerElement );
    }
 
-   virtual void synchronizeByteArray( ByteArrayView array, int bytesPerValue ) override
+   void
+   synchronizeByteArray( ByteArrayView array, int bytesPerValue ) override
    {
       auto requests = synchronizeByteArrayAsyncWorker( array, bytesPerValue );
       MPI::Waitall( requests.data(), requests.size() );
    }
 
-   virtual RequestsVector synchronizeByteArrayAsyncWorker( ByteArrayView array, int bytesPerValue ) override
+   RequestsVector
+   synchronizeByteArrayAsyncWorker( ByteArrayView array, int bytesPerValue ) override
    {
-      TNL_ASSERT_EQ( array.getSize(), bytesPerValue * ghostOffsets[ ghostOffsets.getSize() - 1 ],
+      TNL_ASSERT_EQ( array.getSize(),
+                     bytesPerValue * ghostOffsets[ ghostOffsets.getSize() - 1 ],
                      "The array does not have the expected size." );
 
       const int rank = MPI::GetRank( communicator );
@@ -218,10 +219,11 @@ public:
       // issue all receive async operations
       for( int j = 0; j < nproc; j++ ) {
          if( ghostEntitiesCounts( rank, j ) > 0 ) {
-            requests.push_back( MPI::Irecv(
-                     array.getData() + bytesPerValue * ghostOffsets[ j ],
-                     bytesPerValue * ghostEntitiesCounts( rank, j ),
-                     j, 0, communicator ) );
+            requests.push_back( MPI::Irecv( array.getData() + bytesPerValue * ghostOffsets[ j ],
+                                            bytesPerValue * ghostEntitiesCounts( rank, j ),
+                                            j,
+                                            0,
+                                            communicator ) );
          }
       }
 
@@ -229,23 +231,27 @@ public:
       sendBuffersView.bind( sendBuffers.getData(), bytesPerValue * ghostNeighborOffsets[ nproc ] );
       const auto ghostNeighborsView = ghostNeighbors.getConstView();
       const auto arrayView = array.getConstView();
-      auto copy_kernel = [sendBuffersView, arrayView, ghostNeighborsView, bytesPerValue] __cuda_callable__ ( GlobalIndexType k, GlobalIndexType offset ) mutable
+      auto copy_kernel = [ sendBuffersView, arrayView, ghostNeighborsView, bytesPerValue ] __cuda_callable__(
+                            GlobalIndexType k, GlobalIndexType offset ) mutable
       {
          for( int i = 0; i < bytesPerValue; i++ )
-            sendBuffersView[ i + bytesPerValue * (offset + k) ] = arrayView[ i + bytesPerValue * ghostNeighborsView[ offset + k ] ];
+            sendBuffersView[ i + bytesPerValue * ( offset + k ) ] =
+               arrayView[ i + bytesPerValue * ghostNeighborsView[ offset + k ] ];
       };
 
       for( int i = 0; i < nproc; i++ ) {
          if( ghostEntitiesCounts( i, rank ) > 0 ) {
             const GlobalIndexType offset = ghostNeighborOffsets[ i ];
             // copy data to send buffers
-            Algorithms::ParallelFor< DeviceType >::exec( (GlobalIndexType) 0, ghostEntitiesCounts( i, rank ), copy_kernel, offset );
+            Algorithms::ParallelFor< DeviceType >::exec(
+               (GlobalIndexType) 0, ghostEntitiesCounts( i, rank ), copy_kernel, offset );
 
             // issue async send operation
-            requests.push_back( MPI::Isend(
-                     sendBuffersView.getData() + bytesPerValue * ghostNeighborOffsets[ i ],
-                     bytesPerValue * ghostEntitiesCounts( i, rank ),
-                     i, 0, communicator ) );
+            requests.push_back( MPI::Isend( sendBuffersView.getData() + bytesPerValue * ghostNeighborOffsets[ i ],
+                                            bytesPerValue * ghostEntitiesCounts( i, rank ),
+                                            i,
+                                            0,
+                                            communicator ) );
          }
       }
 
@@ -272,7 +278,8 @@ public:
       RequestsVector requests;
 
       Containers::Array< GlobalIndexType, Devices::Host, int > send_rankOffsets( nproc + 1 ), recv_rankOffsets( nproc + 1 );
-      Containers::Array< GlobalIndexType, Devices::Host, GlobalIndexType > send_rowCapacities, send_rowPointers, send_columnIndices, recv_rowPointers, recv_columnIndices;
+      Containers::Array< GlobalIndexType, Devices::Host, GlobalIndexType > send_rowCapacities, send_rowPointers,
+         send_columnIndices, recv_rowPointers, recv_columnIndices;
 
       // sending part
       {
@@ -303,10 +310,11 @@ public:
             // send our row sizes to the target rank
             if( ! assumeConsistentRowCapacities )
                // issue async send operation
-               requests.push_back( MPI::Isend(
-                        send_rowCapacities.getData() + send_rankOffsets[ i ],
-                        ghostNeighborOffsets[ i + 1 ] - ghostNeighborOffsets[ i ],
-                        i, 1, communicator ) );
+               requests.push_back( MPI::Isend( send_rowCapacities.getData() + send_rankOffsets[ i ],
+                                               ghostNeighborOffsets[ i + 1 ] - ghostNeighborOffsets[ i ],
+                                               i,
+                                               1,
+                                               communicator ) );
          }
 
          // allocate column indices
@@ -331,10 +339,12 @@ public:
             if( send_rankOffsets[ i + 1 ] == send_rankOffsets[ i ] )
                continue;
             // issue async send operation
-            requests.push_back( MPI::Isend(
-                     send_columnIndices.getData() + send_rowPointers[ send_rankOffsets[ i ] ],
-                     send_rowPointers[ send_rankOffsets[ i + 1 ] ] - send_rowPointers[ send_rankOffsets[ i ] ],
-                     i, 0, communicator ) );
+            requests.push_back(
+               MPI::Isend( send_columnIndices.getData() + send_rowPointers[ send_rankOffsets[ i ] ],
+                           send_rowPointers[ send_rankOffsets[ i + 1 ] ] - send_rowPointers[ send_rankOffsets[ i ] ],
+                           i,
+                           0,
+                           communicator ) );
          }
       }
 
@@ -366,10 +376,11 @@ public:
             else {
                // receive row sizes from the sender
                // issue async recv operation
-               row_lengths_requests.push_back( MPI::Irecv(
-                        recv_rowPointers.getData() + recv_rankOffsets[ i ],
-                        ghostOffsets[ i + 1 ] - ghostOffsets[ i ],
-                        i, 1, communicator ) );
+               row_lengths_requests.push_back( MPI::Irecv( recv_rowPointers.getData() + recv_rankOffsets[ i ],
+                                                           ghostOffsets[ i + 1 ] - ghostOffsets[ i ],
+                                                           i,
+                                                           1,
+                                                           communicator ) );
             }
          }
 
@@ -390,10 +401,12 @@ public:
             if( recv_rankOffsets[ i + 1 ] == recv_rankOffsets[ i ] )
                continue;
             // issue async recv operation
-            requests.push_back( MPI::Irecv(
-                     recv_columnIndices.getData() + recv_rowPointers[ recv_rankOffsets[ i ] ],
-                     recv_rowPointers[ recv_rankOffsets[ i + 1 ] ] - recv_rowPointers[ recv_rankOffsets[ i ] ],
-                     i, 0, communicator ) );
+            requests.push_back(
+               MPI::Irecv( recv_columnIndices.getData() + recv_rowPointers[ recv_rankOffsets[ i ] ],
+                           recv_rowPointers[ recv_rankOffsets[ i + 1 ] ] - recv_rowPointers[ recv_rankOffsets[ i ] ],
+                           i,
+                           0,
+                           communicator ) );
          }
       }
 
@@ -404,7 +417,8 @@ public:
    }
 
    // get entity owner based on its global index - can be used only after running initialize()
-   int getEntityOwner( GlobalIndexType global_idx ) const
+   int
+   getEntityOwner( GlobalIndexType global_idx ) const
    {
       const int nproc = globalOffsets.getSize();
       for( int i = 0; i < nproc - 1; i++ )
@@ -415,27 +429,32 @@ public:
 
    // public const accessors for the communication pattern matrix and index arrays which were
    // created in the `initialize` method
-   const auto& getGlobalOffsets() const
+   const auto&
+   getGlobalOffsets() const
    {
       return globalOffsets;
    }
 
-   const auto& getGhostEntitiesCounts() const
+   const auto&
+   getGhostEntitiesCounts() const
    {
       return ghostEntitiesCounts;
    }
 
-   const auto& getGhostOffsets() const
+   const auto&
+   getGhostOffsets() const
    {
       return ghostOffsets;
    }
 
-   const auto& getGhostNeighborOffsets() const
+   const auto&
+   getGhostNeighborOffsets() const
    {
       return ghostNeighborOffsets;
    }
 
-   const auto& getGhostNeighbors() const
+   const auto&
+   getGhostNeighbors() const
    {
       return ghostNeighbors;
    }
@@ -501,8 +520,8 @@ protected:
    Containers::Array< std::uint8_t, DeviceType, GlobalIndexType > sendBuffers;
 };
 
-} // namespace DistributedMeshes
-} // namespace Meshes
-} // namespace TNL
+}  // namespace DistributedMeshes
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/DistributedMeshes/DistributedGridSynchronizer.h>
diff --git a/src/TNL/Meshes/DistributedMeshes/GlobalIndexStorage.h b/src/TNL/Meshes/DistributedMeshes/GlobalIndexStorage.h
index 066d9541aa174a5396aa1bc1b88df93e7a1b6e9b..68429e6634a548af0763fe117f4695b1921badb5 100644
--- a/src/TNL/Meshes/DistributedMeshes/GlobalIndexStorage.h
+++ b/src/TNL/Meshes/DistributedMeshes/GlobalIndexStorage.h
@@ -22,18 +22,22 @@ public:
 
    GlobalIndexStorage() = default;
    GlobalIndexStorage( const GlobalIndexStorage& ) = default;
-   GlobalIndexStorage( GlobalIndexStorage&& ) = default;
-   GlobalIndexStorage& operator=( const GlobalIndexStorage& ) = default;
-   GlobalIndexStorage& operator=( GlobalIndexStorage&& ) = default;
+   GlobalIndexStorage( GlobalIndexStorage&& ) noexcept = default;
+   GlobalIndexStorage&
+   operator=( const GlobalIndexStorage& ) = default;
+   GlobalIndexStorage&
+   operator=( GlobalIndexStorage&& ) noexcept = default;
 
    template< typename Mesh_ >
-   GlobalIndexStorage& operator=( const Mesh_& mesh )
+   GlobalIndexStorage&
+   operator=( const Mesh_& mesh )
    {
       globalIndices = mesh.template getGlobalIndices< Dimension >();
       return *this;
    }
 
-   bool operator==( const GlobalIndexStorage& other ) const
+   bool
+   operator==( const GlobalIndexStorage& other ) const
    {
       return globalIndices == other.getGlobalIndices();
    }
@@ -55,29 +59,32 @@ protected:
 };
 
 template< typename Mesh, typename Device = typename Mesh::DeviceType, typename DimensionTag = Meshes::DimensionTag< 0 > >
-class GlobalIndexStorageFamily
-: public GlobalIndexStorage< Mesh, Device, DimensionTag::value >,
-  public GlobalIndexStorageFamily< Mesh, Device, typename DimensionTag::Increment >
+class GlobalIndexStorageFamily : public GlobalIndexStorage< Mesh, Device, DimensionTag::value >,
+                                 public GlobalIndexStorageFamily< Mesh, Device, typename DimensionTag::Increment >
 {
 public:
    GlobalIndexStorageFamily() = default;
    GlobalIndexStorageFamily( const GlobalIndexStorageFamily& ) = default;
-   GlobalIndexStorageFamily( GlobalIndexStorageFamily&& ) = default;
-   GlobalIndexStorageFamily& operator=( const GlobalIndexStorageFamily& ) = default;
-   GlobalIndexStorageFamily& operator=( GlobalIndexStorageFamily&& ) = default;
+   GlobalIndexStorageFamily( GlobalIndexStorageFamily&& ) noexcept = default;
+   GlobalIndexStorageFamily&
+   operator=( const GlobalIndexStorageFamily& ) = default;
+   GlobalIndexStorageFamily&
+   operator=( GlobalIndexStorageFamily&& ) noexcept = default;
 
    template< typename Mesh_ >
-   GlobalIndexStorageFamily& operator=( const Mesh_& mesh )
+   GlobalIndexStorageFamily&
+   operator=( const Mesh_& mesh )
    {
       GlobalIndexStorage< Mesh, Device, DimensionTag::value >::operator=( mesh );
       GlobalIndexStorageFamily< Mesh, Device, typename DimensionTag::Increment >::operator=( mesh );
       return *this;
    }
 
-   bool operator==( const GlobalIndexStorageFamily& other ) const
+   bool
+   operator==( const GlobalIndexStorageFamily& other ) const
    {
-      return GlobalIndexStorage< Mesh, Device, DimensionTag::value >::operator==( other ) &&
-             GlobalIndexStorageFamily< Mesh, Device, typename DimensionTag::Increment >::operator==( other );
+      return GlobalIndexStorage< Mesh, Device, DimensionTag::value >::operator==( other )
+          && GlobalIndexStorageFamily< Mesh, Device, typename DimensionTag::Increment >::operator==( other );
    }
 };
 
@@ -87,22 +94,26 @@ class GlobalIndexStorageFamily< Mesh, Device, Meshes::DimensionTag< Mesh::getMes
 public:
    GlobalIndexStorageFamily() = default;
    GlobalIndexStorageFamily( const GlobalIndexStorageFamily& ) = default;
-   GlobalIndexStorageFamily( GlobalIndexStorageFamily&& ) = default;
-   GlobalIndexStorageFamily& operator=( const GlobalIndexStorageFamily& ) = default;
-   GlobalIndexStorageFamily& operator=( GlobalIndexStorageFamily&& ) = default;
+   GlobalIndexStorageFamily( GlobalIndexStorageFamily&& ) noexcept = default;
+   GlobalIndexStorageFamily&
+   operator=( const GlobalIndexStorageFamily& ) = default;
+   GlobalIndexStorageFamily&
+   operator=( GlobalIndexStorageFamily&& ) noexcept = default;
 
    template< typename Mesh_ >
-   GlobalIndexStorageFamily& operator=( const Mesh_& )
+   GlobalIndexStorageFamily&
+   operator=( const Mesh_& )
    {
       return *this;
    }
 
-   bool operator==( const GlobalIndexStorageFamily& ) const
+   bool
+   operator==( const GlobalIndexStorageFamily& ) const
    {
       return true;
    }
 };
 
-} // namespace DistributedMeshes
-} // namespace Meshes
-} // namespace TNL
+}  // namespace DistributedMeshes
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/DistributedMeshes/SubdomainOverlapsGetter.h b/src/TNL/Meshes/DistributedMeshes/SubdomainOverlapsGetter.h
index 2fe102be3a5c59bbf5014eece62f566074da96e0..8aa963c25bad156892e6471cec72e8d3d8194f82 100644
--- a/src/TNL/Meshes/DistributedMeshes/SubdomainOverlapsGetter.h
+++ b/src/TNL/Meshes/DistributedMeshes/SubdomainOverlapsGetter.h
@@ -22,102 +22,92 @@ class SubdomainOverlapsGetter
 // TODO: Specializations by the grid dimension can be avoided when the MPI directions are
 // rewritten in a dimension independent way
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 class SubdomainOverlapsGetter< Grid< 1, Real, Device, Index > >
 {
-   public:
-
-      static const int Dimension = 1;
-      using MeshType = Grid< Dimension, Real, Device, Index >;
-      using DeviceType = Device;
-      using IndexType = Index;
-      using DistributedMeshType = DistributedMesh< MeshType >;
-      using SubdomainOverlapsType = typename DistributedMeshType::SubdomainOverlapsType;
-      using CoordinatesType = typename DistributedMeshType::CoordinatesType;
-
-      // Computes subdomain overlaps
-      /* SubdomainOverlapsType is a touple of the same size as the mesh dimensions.
-       * lower.x() is overlap of the subdomain at boundary where x = 0,
-       * upper.x() is overlap of the subdomain at boundary where x = grid.getDimensions().x() - 1,
-       */
-      static void getOverlaps( const DistributedMeshType* distributedMesh,
-                               SubdomainOverlapsType& lower,
-                               SubdomainOverlapsType& upper,
-                               IndexType subdomainOverlapSize,
-                               const SubdomainOverlapsType& lowerPeriodicBoundariesOverlapSize = 0,
-                               const SubdomainOverlapsType& upperPeriodicBoundariesOverlapSize = 0 );
-
+public:
+   static const int Dimension = 1;
+   using MeshType = Grid< Dimension, Real, Device, Index >;
+   using DeviceType = Device;
+   using IndexType = Index;
+   using DistributedMeshType = DistributedMesh< MeshType >;
+   using SubdomainOverlapsType = typename DistributedMeshType::SubdomainOverlapsType;
+   using CoordinatesType = typename DistributedMeshType::CoordinatesType;
+
+   // Computes subdomain overlaps
+   /* SubdomainOverlapsType is a touple of the same size as the mesh dimensions.
+    * lower.x() is overlap of the subdomain at boundary where x = 0,
+    * upper.x() is overlap of the subdomain at boundary where x = grid.getDimensions().x() - 1,
+    */
+   static void
+   getOverlaps( const DistributedMeshType* distributedMesh,
+                SubdomainOverlapsType& lower,
+                SubdomainOverlapsType& upper,
+                IndexType subdomainOverlapSize,
+                const SubdomainOverlapsType& lowerPeriodicBoundariesOverlapSize = 0,
+                const SubdomainOverlapsType& upperPeriodicBoundariesOverlapSize = 0 );
 };
 
-
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 class SubdomainOverlapsGetter< Grid< 2, Real, Device, Index > >
 {
-   public:
-
-      static const int Dimension = 2;
-      using MeshType = Grid< Dimension, Real, Device, Index >;
-      using DeviceType = Device;
-      using IndexType = Index;
-      using DistributedMeshType = DistributedMesh< MeshType >;
-      using SubdomainOverlapsType = typename DistributedMeshType::SubdomainOverlapsType;
-      using CoordinatesType = typename DistributedMeshType::CoordinatesType;
-
-      // Computes subdomain overlaps
-      /* SubdomainOverlapsType is a touple of the same size as the mesh dimensions.
-       * lower.x() is overlap of the subdomain at boundary where x = 0,
-       * lower.y() is overlap of the subdomain at boundary where y = 0,
-       * upper.x() is overlap of the subdomain at boundary where x = grid.getDimensions().x() - 1,
-       * upper.y() is overlap of the subdomain at boundary where y = grid.getDimensions().y() - 1.
-       */
-      static void getOverlaps( const DistributedMeshType* distributedMesh,
-                               SubdomainOverlapsType& lower,
-                               SubdomainOverlapsType& upper,
-                               IndexType subdomainOverlapSize,
-                               const SubdomainOverlapsType& lowerPeriodicBoundariesOverlapSize = 0,
-                               const SubdomainOverlapsType& upperPeriodicBoundariesOverlapSize = 0 );
-
+public:
+   static const int Dimension = 2;
+   using MeshType = Grid< Dimension, Real, Device, Index >;
+   using DeviceType = Device;
+   using IndexType = Index;
+   using DistributedMeshType = DistributedMesh< MeshType >;
+   using SubdomainOverlapsType = typename DistributedMeshType::SubdomainOverlapsType;
+   using CoordinatesType = typename DistributedMeshType::CoordinatesType;
+
+   // Computes subdomain overlaps
+   /* SubdomainOverlapsType is a touple of the same size as the mesh dimensions.
+    * lower.x() is overlap of the subdomain at boundary where x = 0,
+    * lower.y() is overlap of the subdomain at boundary where y = 0,
+    * upper.x() is overlap of the subdomain at boundary where x = grid.getDimensions().x() - 1,
+    * upper.y() is overlap of the subdomain at boundary where y = grid.getDimensions().y() - 1.
+    */
+   static void
+   getOverlaps( const DistributedMeshType* distributedMesh,
+                SubdomainOverlapsType& lower,
+                SubdomainOverlapsType& upper,
+                IndexType subdomainOverlapSize,
+                const SubdomainOverlapsType& lowerPeriodicBoundariesOverlapSize = 0,
+                const SubdomainOverlapsType& upperPeriodicBoundariesOverlapSize = 0 );
 };
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 class SubdomainOverlapsGetter< Grid< 3, Real, Device, Index > >
 {
-   public:
-
-      static const int Dimension = 3;
-      using MeshType = Grid< Dimension, Real, Device, Index >;
-      using DeviceType = Device;
-      using IndexType = Index;
-      using DistributedMeshType = DistributedMesh< MeshType >;
-      using SubdomainOverlapsType = typename DistributedMeshType::SubdomainOverlapsType;
-      using CoordinatesType = typename DistributedMeshType::CoordinatesType;
-
-      // Computes subdomain overlaps
-      /* SubdomainOverlapsType is a touple of the same size as the mesh dimensions.
-       * lower.x() is overlap of the subdomain at boundary where x = 0,
-       * lower.y() is overlap of the subdomain at boundary where y = 0,
-       * lower.z() is overlap of the subdomain at boundary where z = 0,
-       * upper.x() is overlap of the subdomain at boundary where x = grid.getDimensions().x() - 1,
-       * upper.y() is overlap of the subdomain at boundary where y = grid.getDimensions().y() - 1,
-       * upper.z() is overlap of the subdomain at boundary where z = grid.getDimensions().z() - 1,
-       */
-      static void getOverlaps( const DistributedMeshType* distributedMesh,
-                               SubdomainOverlapsType& lower,
-                               SubdomainOverlapsType& upper,
-                               IndexType subdomainOverlapSize,
-                               const SubdomainOverlapsType& lowerPeriodicBoundariesOverlapSize = 0,
-                               const SubdomainOverlapsType& upperPeriodicBoundariesOverlapSize = 0 );
-
+public:
+   static const int Dimension = 3;
+   using MeshType = Grid< Dimension, Real, Device, Index >;
+   using DeviceType = Device;
+   using IndexType = Index;
+   using DistributedMeshType = DistributedMesh< MeshType >;
+   using SubdomainOverlapsType = typename DistributedMeshType::SubdomainOverlapsType;
+   using CoordinatesType = typename DistributedMeshType::CoordinatesType;
+
+   // Computes subdomain overlaps
+   /* SubdomainOverlapsType is a touple of the same size as the mesh dimensions.
+    * lower.x() is overlap of the subdomain at boundary where x = 0,
+    * lower.y() is overlap of the subdomain at boundary where y = 0,
+    * lower.z() is overlap of the subdomain at boundary where z = 0,
+    * upper.x() is overlap of the subdomain at boundary where x = grid.getDimensions().x() - 1,
+    * upper.y() is overlap of the subdomain at boundary where y = grid.getDimensions().y() - 1,
+    * upper.z() is overlap of the subdomain at boundary where z = grid.getDimensions().z() - 1,
+    */
+   static void
+   getOverlaps( const DistributedMeshType* distributedMesh,
+                SubdomainOverlapsType& lower,
+                SubdomainOverlapsType& upper,
+                IndexType subdomainOverlapSize,
+                const SubdomainOverlapsType& lowerPeriodicBoundariesOverlapSize = 0,
+                const SubdomainOverlapsType& upperPeriodicBoundariesOverlapSize = 0 );
 };
 
-} // namespace DistributedMeshes
-} // namespace Meshes
-} // namespace TNL
+}  // namespace DistributedMeshes
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/DistributedMeshes/SubdomainOverlapsGetter.hpp>
diff --git a/src/TNL/Meshes/DistributedMeshes/SubdomainOverlapsGetter.hpp b/src/TNL/Meshes/DistributedMeshes/SubdomainOverlapsGetter.hpp
index 785f26be5d0e87e972b13f467bcf763117ea7220..579ca421afca051e2e4c19622648dd2a6e1f2a09 100644
--- a/src/TNL/Meshes/DistributedMeshes/SubdomainOverlapsGetter.hpp
+++ b/src/TNL/Meshes/DistributedMeshes/SubdomainOverlapsGetter.hpp
@@ -57,24 +57,22 @@ getOverlaps( const DistributedMeshType* distributedMesh,
 
 */
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 void
-SubdomainOverlapsGetter< Grid< 1, Real, Device, Index > >::
-getOverlaps( const DistributedMeshType* distributedMesh,
-             SubdomainOverlapsType& lower,
-             SubdomainOverlapsType& upper,
-             IndexType subdomainOverlapSize,
-             const SubdomainOverlapsType& lowerPeriodicBoundariesOverlapSize,
-             const SubdomainOverlapsType& upperPeriodicBoundariesOverlapSize )
+SubdomainOverlapsGetter< Grid< 1, Real, Device, Index > >::getOverlaps(
+   const DistributedMeshType* distributedMesh,
+   SubdomainOverlapsType& lower,
+   SubdomainOverlapsType& upper,
+   IndexType subdomainOverlapSize,
+   const SubdomainOverlapsType& lowerPeriodicBoundariesOverlapSize,
+   const SubdomainOverlapsType& upperPeriodicBoundariesOverlapSize )
 {
    // initialize to 0
    lower = upper = 0;
 
    if( MPI::GetSize() == 1 )
       return;
-   TNL_ASSERT_TRUE( distributedMesh != NULL, "" );
+   TNL_ASSERT_TRUE( distributedMesh != nullptr, "" );
 
    const CoordinatesType& subdomainCoordinates = distributedMesh->getSubdomainCoordinates();
    int rank = MPI::GetRank();
@@ -90,25 +88,22 @@ getOverlaps( const DistributedMeshType* distributedMesh,
       upper[ 0 ] = upperPeriodicBoundariesOverlapSize[ 0 ];
 }
 
-
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 void
-SubdomainOverlapsGetter< Grid< 2, Real, Device, Index > >::
-getOverlaps( const DistributedMeshType* distributedMesh,
-             SubdomainOverlapsType& lower,
-             SubdomainOverlapsType& upper,
-             IndexType subdomainOverlapSize,
-             const SubdomainOverlapsType& lowerPeriodicBoundariesOverlapSize,
-             const SubdomainOverlapsType& upperPeriodicBoundariesOverlapSize )
+SubdomainOverlapsGetter< Grid< 2, Real, Device, Index > >::getOverlaps(
+   const DistributedMeshType* distributedMesh,
+   SubdomainOverlapsType& lower,
+   SubdomainOverlapsType& upper,
+   IndexType subdomainOverlapSize,
+   const SubdomainOverlapsType& lowerPeriodicBoundariesOverlapSize,
+   const SubdomainOverlapsType& upperPeriodicBoundariesOverlapSize )
 {
    // initialize to 0
    lower = upper = 0;
 
    if( MPI::GetSize() == 1 )
       return;
-   TNL_ASSERT_TRUE( distributedMesh != NULL, "" );
+   TNL_ASSERT_TRUE( distributedMesh != nullptr, "" );
 
    const CoordinatesType& subdomainCoordinates = distributedMesh->getSubdomainCoordinates();
    int rank = MPI::GetRank();
@@ -136,24 +131,22 @@ getOverlaps( const DistributedMeshType* distributedMesh,
       upper[ 1 ] = upperPeriodicBoundariesOverlapSize[ 1 ];
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 void
-SubdomainOverlapsGetter< Grid< 3, Real, Device, Index > >::
-getOverlaps( const DistributedMeshType* distributedMesh,
-             SubdomainOverlapsType& lower,
-             SubdomainOverlapsType& upper,
-             IndexType subdomainOverlapSize,
-             const SubdomainOverlapsType& lowerPeriodicBoundariesOverlapSize,
-             const SubdomainOverlapsType& upperPeriodicBoundariesOverlapSize )
+SubdomainOverlapsGetter< Grid< 3, Real, Device, Index > >::getOverlaps(
+   const DistributedMeshType* distributedMesh,
+   SubdomainOverlapsType& lower,
+   SubdomainOverlapsType& upper,
+   IndexType subdomainOverlapSize,
+   const SubdomainOverlapsType& lowerPeriodicBoundariesOverlapSize,
+   const SubdomainOverlapsType& upperPeriodicBoundariesOverlapSize )
 {
    // initialize to 0
    lower = upper = 0;
 
    if( MPI::GetSize() == 1 )
       return;
-   TNL_ASSERT_TRUE( distributedMesh != NULL, "" );
+   TNL_ASSERT_TRUE( distributedMesh != nullptr, "" );
 
    const CoordinatesType& subdomainCoordinates = distributedMesh->getSubdomainCoordinates();
    int rank = MPI::GetRank();
@@ -189,6 +182,6 @@ getOverlaps( const DistributedMeshType* distributedMesh,
       upper[ 2 ] = upperPeriodicBoundariesOverlapSize[ 2 ];
 }
 
-} // namespace DistributedMeshes
-} // namespace Meshes
-} // namespace TNL
+}  // namespace DistributedMeshes
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/DistributedMeshes/distributeSubentities.h b/src/TNL/Meshes/DistributedMeshes/distributeSubentities.h
index 5491a184b43329e732f1629072f49ef78e681378..e9e1e2f790ef8f1c9b36ba1f234d7f118301b502 100644
--- a/src/TNL/Meshes/DistributedMeshes/distributeSubentities.h
+++ b/src/TNL/Meshes/DistributedMeshes/distributeSubentities.h
@@ -34,12 +34,8 @@ exchangeGhostEntitySeeds( MPI_Comm communicator,
          sendbuf_indices[ i ] = seeds_vertex_indices[ i ].size();
          sendbuf_offsets[ i ] = seeds_entity_offsets[ i ].size();
       }
-      MPI::Alltoall( sendbuf_indices.getData(), 1,
-                     sizes_vertex_indices.getData(), 1,
-                     communicator );
-      MPI::Alltoall( sendbuf_offsets.getData(), 1,
-                     sizes_entity_offsets.getData(), 1,
-                     communicator );
+      MPI::Alltoall( sendbuf_indices.getData(), 1, sizes_vertex_indices.getData(), 1, communicator );
+      MPI::Alltoall( sendbuf_offsets.getData(), 1, sizes_entity_offsets.getData(), 1, communicator );
    }
 
    // allocate arrays for the results
@@ -57,29 +53,21 @@ exchangeGhostEntitySeeds( MPI_Comm communicator,
    // issue all async receive operations
    for( int j = 0; j < nproc; j++ ) {
       if( j == rank )
-          continue;
-      requests.push_back( MPI::Irecv(
-               foreign_seeds_vertex_indices[ j ].data(),
-               foreign_seeds_vertex_indices[ j ].size(),
-               j, 0, communicator ) );
-      requests.push_back( MPI::Irecv(
-               foreign_seeds_entity_offsets[ j ].data(),
-               foreign_seeds_entity_offsets[ j ].size(),
-               j, 1, communicator ) );
+         continue;
+      requests.push_back(
+         MPI::Irecv( foreign_seeds_vertex_indices[ j ].data(), foreign_seeds_vertex_indices[ j ].size(), j, 0, communicator ) );
+      requests.push_back(
+         MPI::Irecv( foreign_seeds_entity_offsets[ j ].data(), foreign_seeds_entity_offsets[ j ].size(), j, 1, communicator ) );
    }
 
    // issue all async send operations
    for( int i = 0; i < nproc; i++ ) {
       if( i == rank )
-          continue;
-      requests.push_back( MPI::Isend(
-               seeds_vertex_indices[ i ].data(),
-               seeds_vertex_indices[ i ].size(),
-               i, 0, communicator ) );
-      requests.push_back( MPI::Isend(
-               seeds_entity_offsets[ i ].data(),
-               seeds_entity_offsets[ i ].size(),
-               i, 1, communicator ) );
+         continue;
+      requests.push_back(
+         MPI::Isend( seeds_vertex_indices[ i ].data(), seeds_vertex_indices[ i ].size(), i, 0, communicator ) );
+      requests.push_back(
+         MPI::Isend( seeds_entity_offsets[ i ].data(), seeds_entity_offsets[ i ].size(), i, 1, communicator ) );
    }
 
    // wait for all communications to finish
@@ -109,21 +97,16 @@ exchangeGhostIndices( MPI_Comm communicator,
    // issue all async receive operations
    for( int j = 0; j < nproc; j++ ) {
       if( j == rank )
-          continue;
-      requests.push_back( MPI::Irecv(
-               ghost_indices[ j ].data(),
-               ghost_indices[ j ].size(),
-               j, 0, communicator ) );
+         continue;
+      requests.push_back( MPI::Irecv( ghost_indices[ j ].data(), ghost_indices[ j ].size(), j, 0, communicator ) );
    }
 
    // issue all async send operations
    for( int i = 0; i < nproc; i++ ) {
       if( i == rank )
-          continue;
-      requests.push_back( MPI::Isend(
-               foreign_ghost_indices[ i ].data(),
-               foreign_ghost_indices[ i ].size(),
-               i, 0, communicator ) );
+         continue;
+      requests.push_back(
+         MPI::Isend( foreign_ghost_indices[ i ].data(), foreign_ghost_indices[ i ].size(), i, 0, communicator ) );
    }
 
    // wait for all communications to finish
@@ -144,8 +127,7 @@ distributeSubentities( DistributedMesh& mesh, bool preferHighRanks = true )
    using LocalIndexType = typename DistributedMesh::LocalIndexType;
    using LocalMesh = typename DistributedMesh::MeshType;
 
-   static_assert( ! std::is_same< DeviceType, Devices::Cuda >::value,
-                  "this method can be called only for host meshes" );
+   static_assert( ! std::is_same< DeviceType, Devices::Cuda >::value, "this method can be called only for host meshes" );
    static_assert( 0 < Dimension && Dimension < DistributedMesh::getMeshDimension(),
                   "Vertices and cells cannot be distributed using this method." );
    if( mesh.getGhostLevels() <= 0 )
@@ -158,7 +140,7 @@ distributeSubentities( DistributedMesh& mesh, bool preferHighRanks = true )
    DistributedMeshSynchronizer< DistributedMesh, DistributedMesh::getMeshDimension() > cell_synchronizer;
    cell_synchronizer.initialize( mesh );
 
-   auto getCellOwner = [&] ( GlobalIndexType local_idx ) -> int
+   auto getCellOwner = [ & ]( GlobalIndexType local_idx ) -> int
    {
       const GlobalIndexType global_idx = mesh.template getGlobalIndices< DistributedMesh::getMeshDimension() >()[ local_idx ];
       return cell_synchronizer.getEntityOwner( global_idx );
@@ -181,8 +163,9 @@ distributeSubentities( DistributedMesh& mesh, bool preferHighRanks = true )
    //       and let the iterative algorithm with padding indices to take care of the rest
    //       (the neighbor will return a padding index until it gets the global index from the true owner)
    // TODO: implement getEntityOwner for other subentities
-   static_assert( Dimension == DistributedMesh::getMeshDimension() - 1, "the getEntityOwner function is implemented only for faces" );
-   auto getEntityOwner = [&] ( GlobalIndexType local_idx ) -> int
+   static_assert( Dimension == DistributedMesh::getMeshDimension() - 1,
+                  "the getEntityOwner function is implemented only for faces" );
+   auto getEntityOwner = [ & ]( GlobalIndexType local_idx ) -> int
    {
       auto entity = mesh.getLocalMesh().template getEntity< Dimension >( local_idx );
 
@@ -199,7 +182,7 @@ distributeSubentities( DistributedMesh& mesh, bool preferHighRanks = true )
 
       // face is on the interface
       if( local_neighbor_cells_count == 1 ) {
-         int owner = (preferHighRanks) ? 0 : nproc;
+         int owner = ( preferHighRanks ) ? 0 : nproc;
          for( LocalIndexType k = 0; k < entity.template getSuperentitiesCount< DistributedMesh::getMeshDimension() >(); k++ ) {
             const GlobalIndexType gk = entity.template getSuperentityIndex< DistributedMesh::getMeshDimension() >( k );
             if( preferHighRanks )
@@ -217,10 +200,12 @@ distributeSubentities( DistributedMesh& mesh, bool preferHighRanks = true )
 
    // 1. identify local entities, set the GhostEntity tag on others
    LocalMesh& localMesh = mesh.getLocalMesh();
-   localMesh.template forAll< Dimension >( [&] ( GlobalIndexType i ) mutable {
-      if( getEntityOwner( i ) != rank )
-         localMesh.template addEntityTag< Dimension >( i, EntityTags::GhostEntity );
-   });
+   localMesh.template forAll< Dimension >(
+      [ & ]( GlobalIndexType i ) mutable
+      {
+         if( getEntityOwner( i ) != rank )
+            localMesh.template addEntityTag< Dimension >( i, EntityTags::GhostEntity );
+      } );
 
    // 2. exchange the counts of local entities between ranks, compute offsets for global indices
    Containers::Vector< GlobalIndexType, Devices::Host, int > globalOffsets( nproc );
@@ -232,15 +217,14 @@ distributeSubentities( DistributedMesh& mesh, bool preferHighRanks = true )
 
       Containers::Array< GlobalIndexType, Devices::Host, int > sendbuf( nproc );
       sendbuf.setValue( localEntitiesCount );
-      MPI::Alltoall( sendbuf.getData(), 1,
-                     globalOffsets.getData(), 1,
-                     mesh.getCommunicator() );
+      MPI::Alltoall( sendbuf.getData(), 1, globalOffsets.getData(), 1, mesh.getCommunicator() );
    }
    Algorithms::inplaceExclusiveScan( globalOffsets );
 
    // 3. assign global indices to the local entities and a padding index to ghost entities
    //    (later we can check the padding index to know if an index was set or not)
-   const GlobalIndexType padding_index = (std::is_signed<GlobalIndexType>::value) ? -1 : std::numeric_limits<GlobalIndexType>::max();
+   const GlobalIndexType padding_index =
+      ( std::is_signed< GlobalIndexType >::value ) ? -1 : std::numeric_limits< GlobalIndexType >::max();
    mesh.template getGlobalIndices< Dimension >().setSize( localMesh.template getEntitiesCount< Dimension >() );
    // also create mapping for ghost entities so that we can efficiently iterate over ghost entities
    // while the entities were not sorted yet on the local mesh
@@ -296,78 +280,82 @@ distributeSubentities( DistributedMesh& mesh, bool preferHighRanks = true )
 
    // 6. iterate until there are no padding indices
    //    (maybe 2 iterations are always enough, but we should be extra careful)
-   for( int iter = 0; iter < DistributedMesh::getMeshDimension(); iter++ )
-   {
+   for( int iter = 0; iter < DistributedMesh::getMeshDimension(); iter++ ) {
       // 6a. determine global indices for the received seeds
-      Algorithms::ParallelFor< Devices::Host >::exec( 0, nproc, [&] ( int i ) {
-         GlobalIndexType vertexOffset = 0;
-         // loop over all foreign ghost entities
-         for( std::size_t entityIndex = 0; entityIndex < foreign_seeds_entity_offsets[ i ].size(); entityIndex++ ) {
-            // data structure for common indices
-            std::set< GlobalIndexType > common_indices;
-
-            // global vertex index offset (for global-to-local index conversion)
-            const GlobalIndexType globalOffset = mesh.template getGlobalIndices< 0 >().getElement( 0 );
-
-            // loop over all subvertices of the entity
-            while( vertexOffset < foreign_seeds_entity_offsets[ i ][ entityIndex ] ) {
-               const GlobalIndexType vertex = foreign_seeds_vertex_indices[ i ][ vertexOffset++ ];
-               GlobalIndexType localIndex = 0;
-               if( vertex >= globalOffset && vertex < globalOffset + localMesh.template getGhostEntitiesOffset< 0 >() )
-                  // subtract offset to get local index
-                  localIndex = vertex - globalOffset;
-               else {
-                  // we must go through the ghost vertices
-                  for( GlobalIndexType g = localMesh.template getGhostEntitiesOffset< 0 >();
-                       g < localMesh.template getEntitiesCount< 0 >();
-                       g++ )
-                     if( vertex == mesh.template getGlobalIndices< 0 >()[ g ] ) {
-                        localIndex = g;
-                        break;
+      Algorithms::ParallelFor< Devices::Host >::exec(
+         0,
+         nproc,
+         [ & ]( int i )
+         {
+            GlobalIndexType vertexOffset = 0;
+            // loop over all foreign ghost entities
+            for( std::size_t entityIndex = 0; entityIndex < foreign_seeds_entity_offsets[ i ].size(); entityIndex++ ) {
+               // data structure for common indices
+               std::set< GlobalIndexType > common_indices;
+
+               // global vertex index offset (for global-to-local index conversion)
+               const GlobalIndexType globalOffset = mesh.template getGlobalIndices< 0 >().getElement( 0 );
+
+               // loop over all subvertices of the entity
+               while( vertexOffset < foreign_seeds_entity_offsets[ i ][ entityIndex ] ) {
+                  const GlobalIndexType vertex = foreign_seeds_vertex_indices[ i ][ vertexOffset++ ];
+                  GlobalIndexType localIndex = 0;
+                  if( vertex >= globalOffset && vertex < globalOffset + localMesh.template getGhostEntitiesOffset< 0 >() )
+                     // subtract offset to get local index
+                     localIndex = vertex - globalOffset;
+                  else {
+                     // we must go through the ghost vertices
+                     for( GlobalIndexType g = localMesh.template getGhostEntitiesOffset< 0 >();
+                          g < localMesh.template getEntitiesCount< 0 >();
+                          g++ )
+                        if( vertex == mesh.template getGlobalIndices< 0 >()[ g ] ) {
+                           localIndex = g;
+                           break;
+                        }
+                     if( localIndex == 0 )
+                        throw std::runtime_error( "vertex with gid=" + std::to_string( vertex ) + " received from rank "
+                                                  + std::to_string( i ) + " was not found on the local mesh for rank "
+                                                  + std::to_string( rank )
+                                                  + " (global offset = " + std::to_string( globalOffset ) + ")" );
+                  }
+
+                  // collect superentities of this vertex
+                  std::set< GlobalIndexType > superentities;
+                  for( LocalIndexType e = 0; e < localMesh.template getSuperentitiesCount< 0, Dimension >( localIndex ); e++ ) {
+                     const GlobalIndexType entity = localMesh.template getSuperentityIndex< 0, Dimension >( localIndex, e );
+                     superentities.insert( entity );
+                  }
+
+                  // initialize or intersect
+                  if( common_indices.empty() )
+                     common_indices = superentities;
+                  else
+                     // remove indices which are not in the current superentities set
+                     for( auto it = common_indices.begin(); it != common_indices.end(); ) {
+                        if( superentities.count( *it ) == 0 )
+                           it = common_indices.erase( it );
+                        else
+                           ++it;
                      }
-                  if( localIndex == 0 )
-                     throw std::runtime_error( "vertex with gid=" + std::to_string(vertex) + " received from rank "
-                                             + std::to_string(i) + " was not found on the local mesh for rank " + std::to_string(rank)
-                                             + " (global offset = " + std::to_string(globalOffset) + ")" );
                }
 
-               // collect superentities of this vertex
-               std::set< GlobalIndexType > superentities;
-               for( LocalIndexType e = 0; e < localMesh.template getSuperentitiesCount< 0, Dimension >( localIndex ); e++ ) {
-                  const GlobalIndexType entity = localMesh.template getSuperentityIndex< 0, Dimension >( localIndex, e );
-                  superentities.insert( entity );
+               if( common_indices.size() != 1 ) {
+                  std::stringstream msg;
+                  msg << "expected exactly 1 common index, but the algorithm found these common indices: ";
+                  for( auto i : common_indices )
+                     msg << i << " ";
+                  msg << "\nDebug info: rank " << rank << ", entityIndex = " << entityIndex << ", received from rank " << i;
+                  throw std::runtime_error( msg.str() );
                }
 
-               // initialize or intersect
-               if( common_indices.empty() )
-                  common_indices = superentities;
-               else
-                  // remove indices which are not in the current superentities set
-                  for( auto it = common_indices.begin(); it != common_indices.end(); ) {
-                     if( superentities.count( *it ) == 0 )
-                        it = common_indices.erase(it);
-                     else
-                        ++it;
-                  }
-            }
-
-            if( common_indices.size() != 1 ) {
-               std::stringstream msg;
-               msg << "expected exactly 1 common index, but the algorithm found these common indices: ";
-               for( auto i : common_indices )
-                  msg << i << " ";
-               msg << "\nDebug info: rank " << rank << ", entityIndex = " << entityIndex << ", received from rank " << i;
-               throw std::runtime_error( msg.str() );
+               // assign global index
+               // (note that we do not have to check if we are the actual owner of the entity,
+               // we can just forward global indices that we received from somebody else, or
+               // send the padding index if the global index was not received yet)
+               const GlobalIndexType local_index = *common_indices.begin();
+               foreign_ghost_indices[ i ][ entityIndex ] = mesh.template getGlobalIndices< Dimension >()[ local_index ];
             }
-
-            // assign global index
-            // (note that we do not have to check if we are the actual owner of the entity,
-            // we can just forward global indices that we received from somebody else, or
-            // send the padding index if the global index was not received yet)
-            const GlobalIndexType local_index = *common_indices.begin();
-            foreign_ghost_indices[ i ][ entityIndex ] = mesh.template getGlobalIndices< Dimension >()[ local_index ];
-         }
-      });
+         } );
 
       // 6b. exchange global ghost indices
       const auto ghost_indices = exchangeGhostIndices( mesh.getCommunicator(), foreign_ghost_indices, seeds_local_indices );
@@ -399,30 +387,39 @@ distributeSubentities( DistributedMesh& mesh, bool preferHighRanks = true )
       iperm.setSize( localMesh.template getEntitiesCount< Dimension >() );
 
       // create the permutation - sort the identity array by the global index, but put local entities first
-      localMesh.template forAll< Dimension >( [&] ( GlobalIndexType i ) mutable { perm[ i ] = i; });
-      std::stable_sort( perm.getData(), // + mesh.getLocalMesh().template getGhostEntitiesOffset< Dimension >(),
+      localMesh.template forAll< Dimension >(
+         [ & ]( GlobalIndexType i ) mutable
+         {
+            perm[ i ] = i;
+         } );
+      std::stable_sort( perm.getData(),  // + mesh.getLocalMesh().template getGhostEntitiesOffset< Dimension >(),
                         perm.getData() + perm.getSize(),
-                        [&mesh, &localMesh](auto& left, auto& right) {
-         auto is_local = [&](auto& i) {
-            return ! localMesh.template isGhostEntity< Dimension >( i );
-         };
-         if( is_local(left) && ! is_local(right) )
-            return true;
-         if( ! is_local(left) && is_local(right) )
-            return false;
-         return mesh.template getGlobalIndices< Dimension >()[ left ] < mesh.template getGlobalIndices< Dimension >()[ right ];
-      });
+                        [ &mesh, &localMesh ]( auto& left, auto& right )
+                        {
+                           auto is_local = [ & ]( auto& i )
+                           {
+                              return ! localMesh.template isGhostEntity< Dimension >( i );
+                           };
+                           if( is_local( left ) && ! is_local( right ) )
+                              return true;
+                           if( ! is_local( left ) && is_local( right ) )
+                              return false;
+                           return mesh.template getGlobalIndices< Dimension >()[ left ]
+                                < mesh.template getGlobalIndices< Dimension >()[ right ];
+                        } );
 
       // invert the permutation
-      localMesh.template forAll< Dimension >( [&] ( GlobalIndexType i ) mutable {
-         iperm[ perm[ i ] ] = i;
-      });
+      localMesh.template forAll< Dimension >(
+         [ & ]( GlobalIndexType i ) mutable
+         {
+            iperm[ perm[ i ] ] = i;
+         } );
 
       // reorder the mesh
       mesh.template reorderEntities< Dimension >( perm, iperm );
    }
 }
 
-} // namespace DistributedMeshes
-} // namespace Meshes
-} // namespace TNL
+}  // namespace DistributedMeshes
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/DummyMesh.h b/src/TNL/Meshes/DummyMesh.h
index c6c984f55511baa4f11b3fce72c596679447b3d2..4e87567776f22fd5caf80eab72089de3fbc271bf 100644
--- a/src/TNL/Meshes/DummyMesh.h
+++ b/src/TNL/Meshes/DummyMesh.h
@@ -11,18 +11,20 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename Real = double,
-          typename Device = Devices::Host,
-          typename Index = int >
+template< typename Real = double, typename Device = Devices::Host, typename Index = int >
 class DummyMesh
 {
 public:
-   typedef Real RealType;
-   typedef Device DeviceType;
-   typedef Index IndexType;
+   using RealType = Real;
+   using DeviceType = Device;
+   using IndexType = Index;
 
-   constexpr static int getMeshDimension() { return 1; }
+   constexpr static int
+   getMeshDimension()
+   {
+      return 1;
+   }
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/EntityShapeGroup.h b/src/TNL/Meshes/EntityShapeGroup.h
index bedb5afb06c2aa8c4d152e8744a511b2546e85e2..c7d6899eafc0d1cbfd8edb13220382db6c9e78dc 100644
--- a/src/TNL/Meshes/EntityShapeGroup.h
+++ b/src/TNL/Meshes/EntityShapeGroup.h
@@ -12,77 +12,74 @@ namespace TNL {
 namespace Meshes {
 namespace VTK {
 
-template < EntityShape GeneralShape >
+template< EntityShape GeneralShape >
 struct EntityShapeGroup
-{
-};
+{};
 
-template < EntityShape GeneralShape, int index >
+template< EntityShape GeneralShape, int index >
 struct EntityShapeGroupElement
-{
-};
+{};
 
-template <>
+template<>
 struct EntityShapeGroup< EntityShape::Polygon >
 {
    static constexpr int size = 2;
 };
 
-template <>
+template<>
 struct EntityShapeGroupElement< EntityShape::Polygon, 0 >
 {
    static constexpr EntityShape shape = EntityShape::Triangle;
 };
 
-template <>
+template<>
 struct EntityShapeGroupElement< EntityShape::Polygon, 1 >
 {
    static constexpr EntityShape shape = EntityShape::Quad;
 };
 
-
-template <>
+template<>
 struct EntityShapeGroup< EntityShape::Polyhedron >
 {
    static constexpr int size = 6;
 };
 
-template <>
+template<>
 struct EntityShapeGroupElement< EntityShape::Polyhedron, 0 >
 {
    static constexpr EntityShape shape = EntityShape::Tetra;
 };
 
-template <>
+template<>
 struct EntityShapeGroupElement< EntityShape::Polyhedron, 1 >
 {
    static constexpr EntityShape shape = EntityShape::Hexahedron;
 };
 
-template <>
+template<>
 struct EntityShapeGroupElement< EntityShape::Polyhedron, 2 >
 {
    static constexpr EntityShape shape = EntityShape::Wedge;
 };
 
-template <>
+template<>
 struct EntityShapeGroupElement< EntityShape::Polyhedron, 3 >
 {
    static constexpr EntityShape shape = EntityShape::Pyramid;
 };
 
-template <>
+template<>
 struct EntityShapeGroupElement< EntityShape::Polyhedron, 4 >
 {
    static constexpr EntityShape shape = EntityShape::PentagonalPrism;
 };
 
-template <>
+template<>
 struct EntityShapeGroupElement< EntityShape::Polyhedron, 5 >
 {
    static constexpr EntityShape shape = EntityShape::HexagonalPrism;
 };
 
-} // namespace VTK
-} // namespace Meshes
-} // namespace TNL
+}  // namespace VTK
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/EntityShapeGroupChecker.h b/src/TNL/Meshes/EntityShapeGroupChecker.h
index 2fbde923b20c74d9fbe7d385707421fa630c81ab..a8c80e85c57dceb0485ab9de51690f2ee5a7a13a 100644
--- a/src/TNL/Meshes/EntityShapeGroupChecker.h
+++ b/src/TNL/Meshes/EntityShapeGroupChecker.h
@@ -19,33 +19,33 @@ class EntityShapeGroupChecker
 public:
    static constexpr EntityShape GeneralShape = GeneralShape_;
 
-   static bool belong( EntityShape shape )
+   static bool
+   belong( EntityShape shape )
    {
-      if( GeneralShape == shape )
-      {
+      if( GeneralShape == shape ) {
          return true;
       }
-      else
-      {
+      else {
          bool result = false;
 
          Algorithms::staticFor< int, 0, EntityShapeGroup< GeneralShape >::size >(
-            [&] ( auto index ) {
+            [ & ]( auto index )
+            {
                EntityShape groupShape = EntityShapeGroupElement< GeneralShape, index >::shape;
                result = result || ( shape == groupShape );
-            }
-         );
+            } );
 
          return result;
       }
    }
 
-   static bool bothBelong( EntityShape shape1, EntityShape shape2 )
+   static bool
+   bothBelong( EntityShape shape1, EntityShape shape2 )
    {
       return belong( shape1 ) && belong( shape2 );
    }
 };
 
-} // namespace VTK
-} // namespace Meshes
-} // namespace TNL
\ No newline at end of file
+}  // namespace VTK
+}  // namespace Meshes
+}  // namespace TNL
\ No newline at end of file
diff --git a/src/TNL/Meshes/Geometry/EntityDecomposer.h b/src/TNL/Meshes/Geometry/EntityDecomposer.h
index 15f15b9bd6366def7f22ec8c07bb9e17670f7e60..193186bd312175ac2136ccd4e23d627e3c60691c 100644
--- a/src/TNL/Meshes/Geometry/EntityDecomposer.h
+++ b/src/TNL/Meshes/Geometry/EntityDecomposer.h
@@ -17,7 +17,8 @@ namespace Meshes {
 
 enum class EntityDecomposerVersion
 {
-   ConnectEdgesToCentroid, ConnectEdgesToPoint
+   ConnectEdgesToCentroid,
+   ConnectEdgesToPoint
 };
 
 template< typename MeshConfig,
@@ -27,8 +28,12 @@ template< typename MeshConfig,
 struct EntityDecomposer;
 
 // Polygon
-template< typename MeshConfig, EntityDecomposerVersion SubentityDecomposerVersion > // SubentityDecomposerVersion is not used for polygons
-struct EntityDecomposer< MeshConfig, Topologies::Polygon, EntityDecomposerVersion::ConnectEdgesToCentroid, SubentityDecomposerVersion >
+template< typename MeshConfig,
+          EntityDecomposerVersion SubentityDecomposerVersion >  // SubentityDecomposerVersion is not used for polygons
+struct EntityDecomposer< MeshConfig,
+                         Topologies::Polygon,
+                         EntityDecomposerVersion::ConnectEdgesToCentroid,
+                         SubentityDecomposerVersion >
 {
    using Device = Devices::Host;
    using Topology = Topologies::Polygon;
@@ -37,28 +42,27 @@ struct EntityDecomposer< MeshConfig, Topologies::Polygon, EntityDecomposerVersio
    using GlobalIndexType = typename MeshConfig::GlobalIndexType;
    using LocalIndexType = typename MeshConfig::LocalIndexType;
 
-   static std::pair< GlobalIndexType, GlobalIndexType > getExtraPointsAndEntitiesCount( const MeshEntityType& entity )
+   static std::pair< GlobalIndexType, GlobalIndexType >
+   getExtraPointsAndEntitiesCount( const MeshEntityType& entity )
    {
       const auto pointsCount = entity.template getSubentitiesCount< 0 >();
-      if( pointsCount == 3 ) // polygon is triangle
-         return { 0, 1 }; // No extra points and no decomposition
-      return { 1, pointsCount }; // 1 extra centroid point and decomposition creates pointsCount triangles
+      if( pointsCount == 3 )      // polygon is triangle
+         return { 0, 1 };         // No extra points and no decomposition
+      return { 1, pointsCount };  // 1 extra centroid point and decomposition creates pointsCount triangles
    }
 
-   template< typename AddPointFunctor,
-             typename AddCellFunctor >
-   static void decompose( const MeshEntityType& entity,
-                          AddPointFunctor&& addPoint,
-                          AddCellFunctor&& addCell )
+   template< typename AddPointFunctor, typename AddCellFunctor >
+   static void
+   decompose( const MeshEntityType& entity, AddPointFunctor&& addPoint, AddCellFunctor&& addCell )
    {
       const auto verticesCount = entity.template getSubentitiesCount< 0 >();
-      if( verticesCount == 3 ) { // polygon is only copied as it's already a triangle
+      if( verticesCount == 3 ) {  // polygon is only copied as it's already a triangle
          const auto v0 = entity.template getSubentityIndex< 0 >( 0 );
          const auto v1 = entity.template getSubentityIndex< 0 >( 1 );
          const auto v2 = entity.template getSubentityIndex< 0 >( 2 );
          addCell( v0, v1, v2 );
       }
-      else { // polygon is decomposed as it has got more than 3 vertices
+      else {  // polygon is decomposed as it has got more than 3 vertices
          const auto v0 = addPoint( getEntityCenter( entity.getMesh(), entity ) );
          // decompose polygon into triangles by connecting each edge to the centroid
          for( LocalIndexType j = 0, k = 1; k < verticesCount; j++, k++ ) {
@@ -66,7 +70,7 @@ struct EntityDecomposer< MeshConfig, Topologies::Polygon, EntityDecomposerVersio
             const auto v2 = entity.template getSubentityIndex< 0 >( k );
             addCell( v0, v1, v2 );
          }
-         { // wrap around term
+         {  // wrap around term
             const auto v1 = entity.template getSubentityIndex< 0 >( verticesCount - 1 );
             const auto v2 = entity.template getSubentityIndex< 0 >( 0 );
             addCell( v0, v1, v2 );
@@ -75,8 +79,12 @@ struct EntityDecomposer< MeshConfig, Topologies::Polygon, EntityDecomposerVersio
    }
 };
 
-template< typename MeshConfig, EntityDecomposerVersion SubentityDecomposerVersion > // SubentityDecomposerVersion is not used for polygons
-struct EntityDecomposer< MeshConfig, Topologies::Polygon, EntityDecomposerVersion::ConnectEdgesToPoint, SubentityDecomposerVersion >
+template< typename MeshConfig,
+          EntityDecomposerVersion SubentityDecomposerVersion >  // SubentityDecomposerVersion is not used for polygons
+struct EntityDecomposer< MeshConfig,
+                         Topologies::Polygon,
+                         EntityDecomposerVersion::ConnectEdgesToPoint,
+                         SubentityDecomposerVersion >
 {
    using Device = Devices::Host;
    using Topology = Topologies::Polygon;
@@ -85,17 +93,18 @@ struct EntityDecomposer< MeshConfig, Topologies::Polygon, EntityDecomposerVersio
    using GlobalIndexType = typename MeshConfig::GlobalIndexType;
    using LocalIndexType = typename MeshConfig::LocalIndexType;
 
-   static std::pair< GlobalIndexType, GlobalIndexType > getExtraPointsAndEntitiesCount( const MeshEntityType& entity )
+   static std::pair< GlobalIndexType, GlobalIndexType >
+   getExtraPointsAndEntitiesCount( const MeshEntityType& entity )
    {
       const auto pointsCount = entity.template getSubentitiesCount< 0 >();
-      return { 0, pointsCount - 2 }; // no extra points and there is a triangle for every non-adjacent edge to the 0th point (pointsCount - 2)
+      return {
+         0, pointsCount - 2
+      };  // no extra points and there is a triangle for every non-adjacent edge to the 0th point (pointsCount - 2)
    }
 
-   template< typename AddPointFunctor,
-             typename AddCellFunctor >
-   static void decompose( const MeshEntityType& entity,
-                          AddPointFunctor&& addPoint,
-                          AddCellFunctor&& addCell )
+   template< typename AddPointFunctor, typename AddCellFunctor >
+   static void
+   decompose( const MeshEntityType& entity, AddPointFunctor&& addPoint, AddCellFunctor&& addCell )
    {
       // decompose polygon into triangles by connecting 0th point to each non-adjacent edge
       const auto verticesCount = entity.template getSubentitiesCount< 0 >();
@@ -110,7 +119,10 @@ struct EntityDecomposer< MeshConfig, Topologies::Polygon, EntityDecomposerVersio
 
 // Polyhedron
 template< typename MeshConfig, EntityDecomposerVersion SubentityDecomposerVersion >
-struct EntityDecomposer< MeshConfig, Topologies::Polyhedron, EntityDecomposerVersion::ConnectEdgesToCentroid, SubentityDecomposerVersion >
+struct EntityDecomposer< MeshConfig,
+                         Topologies::Polyhedron,
+                         EntityDecomposerVersion::ConnectEdgesToCentroid,
+                         SubentityDecomposerVersion >
 {
    using Device = Devices::Host;
    using CellTopology = Topologies::Polyhedron;
@@ -121,34 +133,34 @@ struct EntityDecomposer< MeshConfig, Topologies::Polyhedron, EntityDecomposerVer
    using LocalIndexType = typename MeshConfig::LocalIndexType;
    using SubentityDecomposer = EntityDecomposer< MeshConfig, FaceTopology, SubentityDecomposerVersion >;
 
-   static std::pair< GlobalIndexType, GlobalIndexType > getExtraPointsAndEntitiesCount( const MeshEntityType& entity )
+   static std::pair< GlobalIndexType, GlobalIndexType >
+   getExtraPointsAndEntitiesCount( const MeshEntityType& entity )
    {
       const auto& mesh = entity.getMesh();
-      GlobalIndexType extraPointsCount = 1, // there is one new centroid point
-                      entitiesCount = 0;
+      GlobalIndexType extraPointsCount = 1,  // there is one new centroid point
+         entitiesCount = 0;
       const auto facesCount = entity.template getSubentitiesCount< 2 >();
       for( LocalIndexType i = 0; i < facesCount; i++ ) {
          const auto face = mesh.template getEntity< 2 >( entity.template getSubentityIndex< 2 >( i ) );
 
          GlobalIndexType faceExtraPoints, faceEntitiesCount;
          std::tie( faceExtraPoints, faceEntitiesCount ) = SubentityDecomposer::getExtraPointsAndEntitiesCount( face );
-         extraPointsCount += faceExtraPoints; // add extra points from decomposition of faces
-         entitiesCount += faceEntitiesCount; // there is a new tetrahedron per triangle of a face
+         extraPointsCount += faceExtraPoints;  // add extra points from decomposition of faces
+         entitiesCount += faceEntitiesCount;   // there is a new tetrahedron per triangle of a face
       }
       return { extraPointsCount, entitiesCount };
    }
 
-   template< typename AddPointFunctor,
-             typename AddCellFunctor >
-   static void decompose( const MeshEntityType & entity,
-                          AddPointFunctor&& addPoint,
-                          AddCellFunctor&& addCell )
+   template< typename AddPointFunctor, typename AddCellFunctor >
+   static void
+   decompose( const MeshEntityType& entity, AddPointFunctor&& addPoint, AddCellFunctor&& addCell )
    {
       const auto& mesh = entity.getMesh();
       const auto v3 = addPoint( getEntityCenter( mesh, entity ) );
 
       // Lambda for creating tetrahedron from decomposed triangles of faces
-      auto addFace = [&] ( GlobalIndexType v0, GlobalIndexType v1, GlobalIndexType v2 ) {
+      auto addFace = [ & ]( GlobalIndexType v0, GlobalIndexType v1, GlobalIndexType v2 )
+      {
          addCell( v0, v1, v2, v3 );
       };
 
@@ -161,7 +173,10 @@ struct EntityDecomposer< MeshConfig, Topologies::Polyhedron, EntityDecomposerVer
 };
 
 template< typename MeshConfig, EntityDecomposerVersion SubentityDecomposerVersion >
-struct EntityDecomposer< MeshConfig, Topologies::Polyhedron, EntityDecomposerVersion::ConnectEdgesToPoint, SubentityDecomposerVersion >
+struct EntityDecomposer< MeshConfig,
+                         Topologies::Polyhedron,
+                         EntityDecomposerVersion::ConnectEdgesToPoint,
+                         SubentityDecomposerVersion >
 {
    // https://mathoverflow.net/a/7672
    using Device = Devices::Host;
@@ -174,50 +189,50 @@ struct EntityDecomposer< MeshConfig, Topologies::Polyhedron, EntityDecomposerVer
    using LocalIndexType = typename MeshConfig::LocalIndexType;
    using SubentityDecomposer = EntityDecomposer< MeshConfig, FaceTopology, SubentityDecomposerVersion >;
 
-   static std::pair< GlobalIndexType, GlobalIndexType > getExtraPointsAndEntitiesCount( const MeshEntityType& entity )
+   static std::pair< GlobalIndexType, GlobalIndexType >
+   getExtraPointsAndEntitiesCount( const MeshEntityType& entity )
    {
       const auto& mesh = entity.getMesh();
       const auto v3 = entity.template getSubentityIndex< 0 >( 0 );
-      GlobalIndexType extraPointsCount = 0,
-                      entitiesCount = 0;
+      GlobalIndexType extraPointsCount = 0, entitiesCount = 0;
       const auto facesCount = entity.template getSubentitiesCount< 2 >();
       for( LocalIndexType i = 0; i < facesCount; i++ ) {
          const auto face = mesh.template getEntity< 2 >( entity.template getSubentityIndex< 2 >( i ) );
-         if( !faceContainsPoint( face, v3 ) ) { // include only faces, that don't contain point v3
+         if( ! faceContainsPoint( face, v3 ) ) {  // include only faces, that don't contain point v3
             GlobalIndexType faceExtraPoints, faceEntitiesCount;
             std::tie( faceExtraPoints, faceEntitiesCount ) = SubentityDecomposer::getExtraPointsAndEntitiesCount( face );
-            extraPointsCount += faceExtraPoints; // add extra points from decomposition of faces
-            entitiesCount += faceEntitiesCount; // there is a new tetrahedron per triangle of a face
+            extraPointsCount += faceExtraPoints;  // add extra points from decomposition of faces
+            entitiesCount += faceEntitiesCount;   // there is a new tetrahedron per triangle of a face
          }
       }
       return { extraPointsCount, entitiesCount };
    }
 
-   template< typename AddPointFunctor,
-             typename AddCellFunctor >
-   static void decompose( const MeshEntityType& entity,
-                          AddPointFunctor&& addPoint,
-                          AddCellFunctor&& addCell )
+   template< typename AddPointFunctor, typename AddCellFunctor >
+   static void
+   decompose( const MeshEntityType& entity, AddPointFunctor&& addPoint, AddCellFunctor&& addCell )
    {
       const auto& mesh = entity.getMesh();
       const auto v3 = entity.template getSubentityIndex< 0 >( 0 );
 
       // Lambda for creating tetrahedron by connecting decomposed triangles of faces to 0th point of polyhedron
-      auto addFace = [&] ( GlobalIndexType v0, GlobalIndexType v1, GlobalIndexType v2 ) {
+      auto addFace = [ & ]( GlobalIndexType v0, GlobalIndexType v1, GlobalIndexType v2 )
+      {
          addCell( v0, v1, v2, v3 );
       };
 
       const auto facesCount = entity.template getSubentitiesCount< 2 >();
       for( LocalIndexType i = 0; i < facesCount; i++ ) {
          const auto face = mesh.template getEntity< 2 >( entity.template getSubentityIndex< 2 >( i ) );
-         if( !faceContainsPoint( face, v3 ) ) { // include only faces, that don't contain point v3
+         if( ! faceContainsPoint( face, v3 ) ) {  // include only faces, that don't contain point v3
             SubentityDecomposer::decompose( face, std::forward< AddPointFunctor >( addPoint ), addFace );
          }
       }
    }
 
 private:
-   static bool faceContainsPoint( const MeshSubentityType& face, const GlobalIndexType point )
+   static bool
+   faceContainsPoint( const MeshSubentityType& face, const GlobalIndexType point )
    {
       const LocalIndexType pointsCount = face.template getSubentitiesCount< 0 >();
       for( LocalIndexType i = 0; i < pointsCount; i++ ) {
@@ -229,5 +244,5 @@ private:
    }
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Geometry/EntityRefiner.h b/src/TNL/Meshes/Geometry/EntityRefiner.h
index 6c4d440f8b344eee561ff81542458a6188c5204d..714489915ccaaad689976bf0ad4dd29b77d2434c 100644
--- a/src/TNL/Meshes/Geometry/EntityRefiner.h
+++ b/src/TNL/Meshes/Geometry/EntityRefiner.h
@@ -34,16 +34,15 @@ struct EntityRefiner< MeshConfig, Topologies::Triangle, EntityRefinerVersion::Ed
    using GlobalIndexType = typename MeshConfig::GlobalIndexType;
 
    // returns: number of *new* points, number of *all* refined entities
-   static std::pair< GlobalIndexType, GlobalIndexType > getExtraPointsAndEntitiesCount( const MeshEntityType& entity )
+   static std::pair< GlobalIndexType, GlobalIndexType >
+   getExtraPointsAndEntitiesCount( const MeshEntityType& entity )
    {
       return { 3, 4 };
    }
 
-   template< typename AddPointFunctor,
-             typename AddCellFunctor >
-   static void decompose( const MeshEntityType& entity,
-                          AddPointFunctor&& addPoint,
-                          AddCellFunctor&& addCell )
+   template< typename AddPointFunctor, typename AddCellFunctor >
+   static void
+   decompose( const MeshEntityType& entity, AddPointFunctor&& addPoint, AddCellFunctor&& addCell )
    {
       const auto v0 = entity.template getSubentityIndex< 0 >( 0 );
       const auto v1 = entity.template getSubentityIndex< 0 >( 1 );
@@ -76,16 +75,15 @@ struct EntityRefiner< MeshConfig, Topologies::Quadrangle, EntityRefinerVersion::
    using GlobalIndexType = typename MeshConfig::GlobalIndexType;
 
    // returns: number of *new* points, number of *all* refined entities
-   static std::pair< GlobalIndexType, GlobalIndexType > getExtraPointsAndEntitiesCount( const MeshEntityType& entity )
+   static std::pair< GlobalIndexType, GlobalIndexType >
+   getExtraPointsAndEntitiesCount( const MeshEntityType& entity )
    {
       return { 5, 4 };
    }
 
-   template< typename AddPointFunctor,
-             typename AddCellFunctor >
-   static void decompose( const MeshEntityType& entity,
-                          AddPointFunctor&& addPoint,
-                          AddCellFunctor&& addCell )
+   template< typename AddPointFunctor, typename AddCellFunctor >
+   static void
+   decompose( const MeshEntityType& entity, AddPointFunctor&& addPoint, AddCellFunctor&& addCell )
    {
       const auto v0 = entity.template getSubentityIndex< 0 >( 0 );
       const auto v1 = entity.template getSubentityIndex< 0 >( 1 );
@@ -122,16 +120,15 @@ struct EntityRefiner< MeshConfig, Topologies::Tetrahedron, EntityRefinerVersion:
    using GlobalIndexType = typename MeshConfig::GlobalIndexType;
 
    // returns: number of *new* points, number of *all* refined entities
-   static std::pair< GlobalIndexType, GlobalIndexType > getExtraPointsAndEntitiesCount( const MeshEntityType& entity )
+   static std::pair< GlobalIndexType, GlobalIndexType >
+   getExtraPointsAndEntitiesCount( const MeshEntityType& entity )
    {
       return { 6, 8 };
    }
 
-   template< typename AddPointFunctor,
-             typename AddCellFunctor >
-   static void decompose( const MeshEntityType& entity,
-                          AddPointFunctor&& addPoint,
-                          AddCellFunctor&& addCell )
+   template< typename AddPointFunctor, typename AddCellFunctor >
+   static void
+   decompose( const MeshEntityType& entity, AddPointFunctor&& addPoint, AddCellFunctor&& addCell )
    {
       const auto v0 = entity.template getSubentityIndex< 0 >( 0 );
       const auto v1 = entity.template getSubentityIndex< 0 >( 1 );
@@ -174,16 +171,15 @@ struct EntityRefiner< MeshConfig, Topologies::Hexahedron, EntityRefinerVersion::
    using GlobalIndexType = typename MeshConfig::GlobalIndexType;
 
    // returns: number of *new* points, number of *all* refined entities
-   static std::pair< GlobalIndexType, GlobalIndexType > getExtraPointsAndEntitiesCount( const MeshEntityType& entity )
+   static std::pair< GlobalIndexType, GlobalIndexType >
+   getExtraPointsAndEntitiesCount( const MeshEntityType& entity )
    {
       return { 19, 8 };
    }
 
-   template< typename AddPointFunctor,
-             typename AddCellFunctor >
-   static void decompose( const MeshEntityType& entity,
-                          AddPointFunctor&& addPoint,
-                          AddCellFunctor&& addCell )
+   template< typename AddPointFunctor, typename AddCellFunctor >
+   static void
+   decompose( const MeshEntityType& entity, AddPointFunctor&& addPoint, AddCellFunctor&& addCell )
    {
       const auto v0 = entity.template getSubentityIndex< 0 >( 0 );
       const auto v1 = entity.template getSubentityIndex< 0 >( 1 );
@@ -227,7 +223,7 @@ struct EntityRefiner< MeshConfig, Topologies::Hexahedron, EntityRefinerVersion::
       const auto f4 = addPoint( 0.25 * ( v3_p + v0_p + v4_p + v7_p ) );
       const auto f5 = addPoint( 0.25 * ( v4_p + v5_p + v6_p + v7_p ) );
       // add new points: center of the cell
-      const auto cc = addPoint( 0.125 * ( v0_p + v1_p + v2_p + v3_p + v4_p + v5_p + v6_p + v7_p) );
+      const auto cc = addPoint( 0.125 * ( v0_p + v1_p + v2_p + v3_p + v4_p + v5_p + v6_p + v7_p ) );
 
       // add refined hexahedrons
       addCell( v0, b0, f0, b3, m0, f1, cc, f4 );
@@ -241,5 +237,5 @@ struct EntityRefiner< MeshConfig, Topologies::Hexahedron, EntityRefinerVersion::
    }
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Geometry/getDecomposedMesh.h b/src/TNL/Meshes/Geometry/getDecomposedMesh.h
index bbbdf5e51795f4031f218784f1a32fef24ccb2cb..efb59e855d0444ac87b65184cb530e134f93467b 100644
--- a/src/TNL/Meshes/Geometry/getDecomposedMesh.h
+++ b/src/TNL/Meshes/Geometry/getDecomposedMesh.h
@@ -22,7 +22,7 @@ namespace Meshes {
 
 // Polygon Mesh
 template< typename ParentConfig >
-struct TriangleConfig: public ParentConfig
+struct TriangleConfig : public ParentConfig
 {
    using CellTopology = Topologies::Triangle;
 };
@@ -31,7 +31,7 @@ template< EntityDecomposerVersion DecomposerVersion,
           EntityDecomposerVersion SubdecomposerVersion = EntityDecomposerVersion::ConnectEdgesToPoint,
           typename MeshConfig,
           std::enable_if_t< std::is_same< typename MeshConfig::CellTopology, Topologies::Polygon >::value, bool > = true >
-auto // returns MeshBuilder
+auto  // returns MeshBuilder
 decomposeMesh( const Mesh< MeshConfig, Devices::Host >& inMesh )
 {
    using namespace TNL;
@@ -55,13 +55,16 @@ decomposeMesh( const Mesh< MeshConfig, Devices::Host >& inMesh )
    // starting indices at which every cell will start writing new decomposed points and cells
    using IndexPair = std::pair< GlobalIndexType, GlobalIndexType >;
    Array< IndexPair, Devices::Host > indices( inCellsCount + 1 );
-   auto setCounts = [&] ( GlobalIndexType i ) {
+   auto setCounts = [ & ]( GlobalIndexType i )
+   {
       const auto cell = inMesh.template getEntity< CellDimension >( i );
       indices[ i ] = EntityDecomposer::getExtraPointsAndEntitiesCount( cell );
    };
    ParallelFor< Devices::Host >::exec( GlobalIndexType{ 0 }, inCellsCount, setCounts );
-   indices[ inCellsCount ] = { 0, 0 }; // extend exclusive prefix sum by one element to also get result of reduce at the same time
-   auto reduction = [] ( const IndexPair& a, const IndexPair& b ) -> IndexPair {
+   indices[ inCellsCount ] = { 0,
+                               0 };  // extend exclusive prefix sum by one element to also get result of reduce at the same time
+   auto reduction = []( const IndexPair& a, const IndexPair& b ) -> IndexPair
+   {
       return { a.first + b.first, a.second + b.second };
    };
    inplaceExclusiveScan( indices, 0, indices.getSize(), reduction, std::make_pair( 0, 0 ) );
@@ -71,19 +74,22 @@ decomposeMesh( const Mesh< MeshConfig, Devices::Host >& inMesh )
    meshBuilder.setEntitiesCount( outPointsCount, outCellsCount );
 
    // Copy the points from inMesh to outMesh
-   auto copyPoint = [&] ( GlobalIndexType i ) mutable {
+   auto copyPoint = [ & ]( GlobalIndexType i ) mutable
+   {
       meshBuilder.setPoint( i, inMesh.getPoint( i ) );
    };
    ParallelFor< Devices::Host >::exec( GlobalIndexType{ 0 }, inPointsCount, copyPoint );
 
    // Decompose each cell
-   auto decomposeCell = [&] ( GlobalIndexType i ) mutable {
+   auto decomposeCell = [ & ]( GlobalIndexType i ) mutable
+   {
       const auto cell = inMesh.template getEntity< CellDimension >( i );
       const auto& indexPair = indices[ i ];
 
       // Lambda for adding new points
       GlobalIndexType setPointIndex = inPointsCount + indexPair.first;
-      auto addPoint = [&] ( const PointType& point ) {
+      auto addPoint = [ & ]( const PointType& point )
+      {
          const auto pointIdx = setPointIndex++;
          meshBuilder.setPoint( pointIdx, point );
          return pointIdx;
@@ -91,7 +97,8 @@ decomposeMesh( const Mesh< MeshConfig, Devices::Host >& inMesh )
 
       // Lambda for adding new cells
       GlobalIndexType setCellIndex = indexPair.second;
-      auto addCell = [&] ( GlobalIndexType v0, GlobalIndexType v1, GlobalIndexType v2 ) {
+      auto addCell = [ & ]( GlobalIndexType v0, GlobalIndexType v1, GlobalIndexType v2 )
+      {
          auto entitySeed = meshBuilder.getCellSeed( setCellIndex++ );
          entitySeed.setCornerId( 0, v0 );
          entitySeed.setCornerId( 1, v1 );
@@ -109,7 +116,7 @@ template< EntityDecomposerVersion DecomposerVersion,
           EntityDecomposerVersion SubdecomposerVersion = EntityDecomposerVersion::ConnectEdgesToPoint,
           typename MeshConfig,
           std::enable_if_t< std::is_same< typename MeshConfig::CellTopology, Topologies::Polygon >::value, bool > = true >
-auto // returns Mesh
+auto  // returns Mesh
 getDecomposedMesh( const Mesh< MeshConfig, Devices::Host >& inMesh )
 {
    using TriangleMeshConfig = TriangleConfig< MeshConfig >;
@@ -123,7 +130,7 @@ getDecomposedMesh( const Mesh< MeshConfig, Devices::Host >& inMesh )
 
 // Polyhedral Mesh
 template< typename ParentConfig >
-struct TetrahedronConfig: public ParentConfig
+struct TetrahedronConfig : public ParentConfig
 {
    using CellTopology = Topologies::Tetrahedron;
 };
@@ -132,7 +139,7 @@ template< EntityDecomposerVersion DecomposerVersion,
           EntityDecomposerVersion SubdecomposerVersion,
           typename MeshConfig,
           std::enable_if_t< std::is_same< typename MeshConfig::CellTopology, Topologies::Polyhedron >::value, bool > = true >
-auto // returns MeshBuilder
+auto  // returns MeshBuilder
 decomposeMesh( const Mesh< MeshConfig, Devices::Host >& inMesh )
 {
    using namespace TNL;
@@ -156,13 +163,16 @@ decomposeMesh( const Mesh< MeshConfig, Devices::Host >& inMesh )
    // starting indices at which every cell will start writing new decomposed points and cells
    using IndexPair = std::pair< GlobalIndexType, GlobalIndexType >;
    Array< IndexPair, Devices::Host > indices( inCellsCount + 1 );
-   auto setCounts = [&] ( GlobalIndexType i ) {
+   auto setCounts = [ & ]( GlobalIndexType i )
+   {
       const auto cell = inMesh.template getEntity< CellDimension >( i );
       indices[ i ] = EntityDecomposer::getExtraPointsAndEntitiesCount( cell );
    };
    ParallelFor< Devices::Host >::exec( GlobalIndexType{ 0 }, inCellsCount, setCounts );
-   indices[ inCellsCount ] = { 0, 0 }; // extend exclusive prefix sum by one element to also get result of reduce at the same time
-   auto reduction = [] ( const IndexPair& a, const IndexPair& b ) -> IndexPair {
+   indices[ inCellsCount ] = { 0,
+                               0 };  // extend exclusive prefix sum by one element to also get result of reduce at the same time
+   auto reduction = []( const IndexPair& a, const IndexPair& b ) -> IndexPair
+   {
       return { a.first + b.first, a.second + b.second };
    };
    inplaceExclusiveScan( indices, 0, indices.getSize(), reduction, std::make_pair( 0, 0 ) );
@@ -172,19 +182,22 @@ decomposeMesh( const Mesh< MeshConfig, Devices::Host >& inMesh )
    meshBuilder.setEntitiesCount( outPointsCount, outCellsCount );
 
    // Copy the points from inMesh to outMesh
-   auto copyPoint = [&] ( GlobalIndexType i ) mutable {
+   auto copyPoint = [ & ]( GlobalIndexType i ) mutable
+   {
       meshBuilder.setPoint( i, inMesh.getPoint( i ) );
    };
    ParallelFor< Devices::Host >::exec( GlobalIndexType{ 0 }, inPointsCount, copyPoint );
 
    // Decompose each cell
-   auto decomposeCell = [&] ( GlobalIndexType i ) mutable {
+   auto decomposeCell = [ & ]( GlobalIndexType i ) mutable
+   {
       const auto cell = inMesh.template getEntity< CellDimension >( i );
       const auto& indexPair = indices[ i ];
 
       // Lambda for adding new points
       GlobalIndexType setPointIndex = inPointsCount + indexPair.first;
-      auto addPoint = [&] ( const PointType& point ) {
+      auto addPoint = [ & ]( const PointType& point )
+      {
          const auto pointIdx = setPointIndex++;
          meshBuilder.setPoint( pointIdx, point );
          return pointIdx;
@@ -192,7 +205,8 @@ decomposeMesh( const Mesh< MeshConfig, Devices::Host >& inMesh )
 
       // Lambda for adding new cells
       GlobalIndexType setCellIndex = indexPair.second;
-      auto addCell = [&] ( GlobalIndexType v0, GlobalIndexType v1, GlobalIndexType v2, GlobalIndexType v3 ) {
+      auto addCell = [ & ]( GlobalIndexType v0, GlobalIndexType v1, GlobalIndexType v2, GlobalIndexType v3 )
+      {
          auto entitySeed = meshBuilder.getCellSeed( setCellIndex++ );
          entitySeed.setCornerId( 0, v0 );
          entitySeed.setCornerId( 1, v1 );
@@ -211,8 +225,8 @@ template< EntityDecomposerVersion DecomposerVersion,
           EntityDecomposerVersion SubDecomposerVersion,
           typename MeshConfig,
           std::enable_if_t< std::is_same< typename MeshConfig::CellTopology, Topologies::Polyhedron >::value, bool > = true >
-auto // returns Mesh
-getDecomposedMesh( const Mesh< MeshConfig, Devices::Host > & inMesh )
+auto  // returns Mesh
+getDecomposedMesh( const Mesh< MeshConfig, Devices::Host >& inMesh )
 {
    using TetrahedronMeshConfig = TetrahedronConfig< MeshConfig >;
    using TetrahedronMesh = Mesh< TetrahedronMeshConfig, Devices::Host >;
@@ -223,5 +237,5 @@ getDecomposedMesh( const Mesh< MeshConfig, Devices::Host > & inMesh )
    return outMesh;
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Geometry/getEntityCenter.h b/src/TNL/Meshes/Geometry/getEntityCenter.h
index c2ce8b206c85ffa0855e2e8d2d1f90ddf94c1e52..5cd2909a1ec8a79b1670ae13b7299e6100c1d555 100644
--- a/src/TNL/Meshes/Geometry/getEntityCenter.h
+++ b/src/TNL/Meshes/Geometry/getEntityCenter.h
@@ -18,7 +18,7 @@ namespace Meshes {
 template< typename Grid, int EntityDimension, typename Config >
 __cuda_callable__
 typename Grid::PointType
-getEntityCenter( const Grid & grid, const GridEntity< Grid, EntityDimension, Config > & entity )
+getEntityCenter( const Grid& grid, const GridEntity< Grid, EntityDimension, Config >& entity )
 {
    return entity.getCenter();
 }
@@ -26,8 +26,7 @@ getEntityCenter( const Grid & grid, const GridEntity< Grid, EntityDimension, Con
 template< typename MeshConfig, typename Device >
 __cuda_callable__
 typename MeshTraits< MeshConfig >::PointType
-getEntityCenter( const Mesh< MeshConfig, Device > & mesh,
-                 const MeshEntity< MeshConfig, Device, Topologies::Vertex > & entity )
+getEntityCenter( const Mesh< MeshConfig, Device >& mesh, const MeshEntity< MeshConfig, Device, Topologies::Vertex >& entity )
 {
    return entity.getPoint();
 }
@@ -42,20 +41,16 @@ getEntityCenter( const Mesh< MeshConfig, Device > & mesh,
 template< typename MeshConfig, typename Device, typename EntityTopology >
 __cuda_callable__
 typename MeshTraits< MeshConfig >::PointType
-getEntityCenter( const Mesh< MeshConfig, Device > & mesh,
-                 const MeshEntity< MeshConfig, Device, EntityTopology > & entity )
+getEntityCenter( const Mesh< MeshConfig, Device >& mesh, const MeshEntity< MeshConfig, Device, EntityTopology >& entity )
 {
    using EntityType = MeshEntity< MeshConfig, Device, EntityTopology >;
    const typename MeshConfig::LocalIndexType subvertices = entity.template getSubentitiesCount< 0 >();
    typename MeshTraits< MeshConfig >::PointType c = 0;
-   for( typename MeshConfig::LocalIndexType i = 0;
-        i < subvertices;
-        i++ )
-   {
+   for( typename MeshConfig::LocalIndexType i = 0; i < subvertices; i++ ) {
       c += mesh.getPoint( entity.template getSubentityIndex< 0 >( i ) );
    }
    return ( 1.0 / subvertices ) * c;
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Geometry/getEntityMeasure.h b/src/TNL/Meshes/Geometry/getEntityMeasure.h
index c1b69049f9eacb3411c8b4e702228e9db961d9d3..34ed01fdc5e4cacd27198750c2ad39786e755035 100644
--- a/src/TNL/Meshes/Geometry/getEntityMeasure.h
+++ b/src/TNL/Meshes/Geometry/getEntityMeasure.h
@@ -28,290 +28,259 @@ namespace Meshes {
 template< typename Grid, typename Config >
 __cuda_callable__
 typename Grid::RealType
-getEntityMeasure( const Grid & grid, const GridEntity< Grid, 0, Config > & entity )
+getEntityMeasure( const Grid& grid, const GridEntity< Grid, 0, Config >& entity )
 {
-    // entity.getMeasure() returns 0.0 !!!
-    return 1.0;
+   // entity.getMeasure() returns 0.0 !!!
+   return 1.0;
 }
 
 template< typename Grid, int EntityDimension, typename Config >
 __cuda_callable__
 typename Grid::RealType
-getEntityMeasure( const Grid & grid, const GridEntity< Grid, EntityDimension, Config > & entity )
+getEntityMeasure( const Grid& grid, const GridEntity< Grid, EntityDimension, Config >& entity )
 {
-    return entity.getMeasure();
+   return entity.getMeasure();
 }
 
 // Vertex
 template< typename MeshConfig, typename Device >
 __cuda_callable__
 typename MeshConfig::RealType
-getEntityMeasure( const Mesh< MeshConfig, Device > & mesh,
-                  const MeshEntity< MeshConfig, Device, Topologies::Vertex > & entity )
+getEntityMeasure( const Mesh< MeshConfig, Device >& mesh, const MeshEntity< MeshConfig, Device, Topologies::Vertex >& entity )
 {
-    return 1.0;
+   return 1.0;
 }
 
 // Edge
 template< typename MeshConfig, typename Device >
 __cuda_callable__
 typename MeshConfig::RealType
-getEntityMeasure( const Mesh< MeshConfig, Device > & mesh,
-                  const MeshEntity< MeshConfig, Device, Topologies::Edge > & entity )
+getEntityMeasure( const Mesh< MeshConfig, Device >& mesh, const MeshEntity< MeshConfig, Device, Topologies::Edge >& entity )
 {
-    const auto& v0 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) );
-    const auto& v1 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 1 ) );
-    return l2Norm( v1 - v0 );
+   const auto& v0 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) );
+   const auto& v1 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 1 ) );
+   return l2Norm( v1 - v0 );
 }
 
 // Triangle
-template< typename VectorExpression,
-          std::enable_if_t< VectorExpression::getSize() == 2, bool > = true >
+template< typename VectorExpression, std::enable_if_t< VectorExpression::getSize() == 2, bool > = true >
 __cuda_callable__
 typename VectorExpression::RealType
-getTriangleArea( const VectorExpression & v1,
-                 const VectorExpression & v2 )
+getTriangleArea( const VectorExpression& v1, const VectorExpression& v2 )
 {
-    using Real = typename VectorExpression::RealType;
-    return Real( 0.5 ) * TNL::abs( v1.x() * v2.y() - v1.y() * v2.x() );
+   using Real = typename VectorExpression::RealType;
+   return Real( 0.5 ) * TNL::abs( v1.x() * v2.y() - v1.y() * v2.x() );
 }
 
-template< typename VectorExpression,
-          std::enable_if_t< VectorExpression::getSize() == 3, bool > = true >
+template< typename VectorExpression, std::enable_if_t< VectorExpression::getSize() == 3, bool > = true >
 __cuda_callable__
 typename VectorExpression::RealType
-getTriangleArea( const VectorExpression & v1,
-                 const VectorExpression & v2 )
+getTriangleArea( const VectorExpression& v1, const VectorExpression& v2 )
 {
-    using Real = typename VectorExpression::RealType;
-    // formula from http://math.stackexchange.com/a/128999
-    const Real c1 = v1.y() * v2.z() - v1.z() * v2.y();   // first component of the cross product
-    const Real c2 = v1.z() * v2.x() - v1.x() * v2.z();   // second component of the cross product
-    const Real c3 = v1.x() * v2.y() - v1.y() * v2.x();   // third component of the cross product
-    return Real( 0.5 ) * TNL::sqrt( c1 * c1 + c2 * c2 + c3 * c3 );
+   using Real = typename VectorExpression::RealType;
+   // formula from http://math.stackexchange.com/a/128999
+   const Real c1 = v1.y() * v2.z() - v1.z() * v2.y();  // first component of the cross product
+   const Real c2 = v1.z() * v2.x() - v1.x() * v2.z();  // second component of the cross product
+   const Real c3 = v1.x() * v2.y() - v1.y() * v2.x();  // third component of the cross product
+   return Real( 0.5 ) * TNL::sqrt( c1 * c1 + c2 * c2 + c3 * c3 );
 }
 
 template< typename MeshConfig, typename Device >
 __cuda_callable__
 typename MeshConfig::RealType
-getEntityMeasure( const Mesh< MeshConfig, Device > & mesh,
-                  const MeshEntity< MeshConfig, Device, Topologies::Triangle > & entity )
+getEntityMeasure( const Mesh< MeshConfig, Device >& mesh, const MeshEntity< MeshConfig, Device, Topologies::Triangle >& entity )
 {
-    const auto& v0 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) );
-    const auto& v1 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 1 ) );
-    const auto& v2 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 2 ) );
-    return getTriangleArea( v2 - v0, v1 - v0 );
+   const auto& v0 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) );
+   const auto& v1 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 1 ) );
+   const auto& v2 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 2 ) );
+   return getTriangleArea( v2 - v0, v1 - v0 );
 }
 
 // Quadrangle
 template< typename MeshConfig, typename Device >
 __cuda_callable__
 typename MeshConfig::RealType
-getEntityMeasure( const Mesh< MeshConfig, Device > & mesh,
-                  const MeshEntity< MeshConfig, Device, Topologies::Quadrangle > & entity )
+getEntityMeasure( const Mesh< MeshConfig, Device >& mesh,
+                  const MeshEntity< MeshConfig, Device, Topologies::Quadrangle >& entity )
 {
-    // measure = 0.5 * |AC x BD|, where AC and BD are the diagonals
-    // Hence, we can use the same formula as for the triangle area.
-    const auto& v0 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) );
-    const auto& v1 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 1 ) );
-    const auto& v2 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 2 ) );
-    const auto& v3 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 3 ) );
-    return getTriangleArea( v2 - v0, v3 - v1 );
+   // measure = 0.5 * |AC x BD|, where AC and BD are the diagonals
+   // Hence, we can use the same formula as for the triangle area.
+   const auto& v0 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) );
+   const auto& v1 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 1 ) );
+   const auto& v2 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 2 ) );
+   const auto& v3 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 3 ) );
+   return getTriangleArea( v2 - v0, v3 - v1 );
 }
 
 template< typename VectorExpression >
 __cuda_callable__
 typename VectorExpression::RealType
-getTetrahedronVolume( const VectorExpression& v1,
-                      const VectorExpression& v2,
-                      const VectorExpression& v3 )
+getTetrahedronVolume( const VectorExpression& v1, const VectorExpression& v2, const VectorExpression& v3 )
 {
-    using Real = typename VectorExpression::RealType;
-    // V = (1/6) * det(v1, v2, v3)
-    const Real det = v1.x() * v2.y() * v3.z() +
-                     v1.y() * v2.z() * v3.x() +
-                     v1.z() * v2.x() * v3.y() -
-                   ( v1.z() * v2.y() * v3.x() +
-                     v1.y() * v2.x() * v3.z() +
-                     v1.x() * v2.z() * v3.y() );
-    return Real( 1.0 / 6.0 ) * TNL::abs( det );
+   using Real = typename VectorExpression::RealType;
+   // V = (1/6) * det(v1, v2, v3)
+   const Real det = v1.x() * v2.y() * v3.z() + v1.y() * v2.z() * v3.x() + v1.z() * v2.x() * v3.y()
+                  - ( v1.z() * v2.y() * v3.x() + v1.y() * v2.x() * v3.z() + v1.x() * v2.z() * v3.y() );
+   return Real( 1.0 / 6.0 ) * TNL::abs( det );
 }
 
 template< typename MeshConfig, typename Device >
 __cuda_callable__
 typename MeshConfig::RealType
-getEntityMeasure( const Mesh< MeshConfig, Device > & mesh,
-                  const MeshEntity< MeshConfig, Device, Topologies::Tetrahedron > & entity )
+getEntityMeasure( const Mesh< MeshConfig, Device >& mesh,
+                  const MeshEntity< MeshConfig, Device, Topologies::Tetrahedron >& entity )
 {
-    const auto& v0 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) );
-    const auto& v1 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 1 ) );
-    const auto& v2 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 2 ) );
-    const auto& v3 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 3 ) );
-    return getTetrahedronVolume( v3 - v0, v2 - v0, v1 - v0 );
+   const auto& v0 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) );
+   const auto& v1 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 1 ) );
+   const auto& v2 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 2 ) );
+   const auto& v3 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 3 ) );
+   return getTetrahedronVolume( v3 - v0, v2 - v0, v1 - v0 );
 }
 
 template< typename MeshConfig, typename Device >
 __cuda_callable__
 typename MeshConfig::RealType
-getEntityMeasure( const Mesh< MeshConfig, Device > & mesh,
-                  const MeshEntity< MeshConfig, Device, Topologies::Hexahedron > & entity )
+getEntityMeasure( const Mesh< MeshConfig, Device >& mesh,
+                  const MeshEntity< MeshConfig, Device, Topologies::Hexahedron >& entity )
 {
-    const auto& v0 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) );
-    const auto& v1 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 1 ) );
-    const auto& v2 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 2 ) );
-    const auto& v3 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 3 ) );
-    const auto& v4 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 4 ) );
-    const auto& v5 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 5 ) );
-    const auto& v6 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 6 ) );
-    const auto& v7 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 7 ) );
-    // https://www.cfd-online.com/Forums/main/163122-volume-general-hexahedron.html#post574650
-    return getTetrahedronVolume( v0 - v4, v3 - v4, v1 - v4 )
-         + getTetrahedronVolume( v2 - v4, v3 - v4, v1 - v4 )
-         + getTetrahedronVolume( v1 - v4, v2 - v4, v5 - v4 )
-         + getTetrahedronVolume( v6 - v4, v2 - v4, v5 - v4 )
-         + getTetrahedronVolume( v3 - v4, v2 - v4, v7 - v4 )
-         + getTetrahedronVolume( v6 - v4, v2 - v4, v7 - v4 );
+   const auto& v0 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) );
+   const auto& v1 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 1 ) );
+   const auto& v2 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 2 ) );
+   const auto& v3 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 3 ) );
+   const auto& v4 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 4 ) );
+   const auto& v5 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 5 ) );
+   const auto& v6 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 6 ) );
+   const auto& v7 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 7 ) );
+   // https://www.cfd-online.com/Forums/main/163122-volume-general-hexahedron.html#post574650
+   return getTetrahedronVolume( v0 - v4, v3 - v4, v1 - v4 ) + getTetrahedronVolume( v2 - v4, v3 - v4, v1 - v4 )
+        + getTetrahedronVolume( v1 - v4, v2 - v4, v5 - v4 ) + getTetrahedronVolume( v6 - v4, v2 - v4, v5 - v4 )
+        + getTetrahedronVolume( v3 - v4, v2 - v4, v7 - v4 ) + getTetrahedronVolume( v6 - v4, v2 - v4, v7 - v4 );
 }
 
 // Polygon
-template< int Coord1,
-          int Coord2,
-          typename MeshConfig,
-          typename Device >
+template< int Coord1, int Coord2, typename MeshConfig, typename Device >
 __cuda_callable__
 typename MeshConfig::RealType
-getPolygon2DArea( const Mesh< MeshConfig, Device > & mesh,
-                  const MeshEntity< MeshConfig, Device, Topologies::Polygon > & entity )
+getPolygon2DArea( const Mesh< MeshConfig, Device >& mesh, const MeshEntity< MeshConfig, Device, Topologies::Polygon >& entity )
 {
-    // http://geomalgorithms.com/code.html (function area2D_Polygon)
-
-    static_assert( Coord1 >= 0 && Coord1 <= 2 &&
-                   Coord2 >= 0 && Coord2 <= 2 &&
-                   Coord1 != Coord2, "Coord1 and Coord2 must be different integers with possible values {0, 1, 2}." );
-
-    using Real = typename MeshConfig::RealType;
-    using Index = typename MeshConfig::LocalIndexType;
-
-    Real area{ 0.0 };
-    const auto n = entity.template getSubentitiesCount< 0 >();
-    for ( Index i = 1, j = 2, k = 0; j < n; i++, j++, k++ ) {
-        const auto& v0 = mesh.getPoint( entity.template getSubentityIndex< 0 >( i ) );
-        const auto& v1 = mesh.getPoint( entity.template getSubentityIndex< 0 >( j ) );
-        const auto& v2 = mesh.getPoint( entity.template getSubentityIndex< 0 >( k ) );
-        area += v0[Coord1] * ( v1[Coord2] - v2[Coord2] );
-    }
-
-    // 1. wrap around term
-    {
-        const auto& v0 = mesh.getPoint( entity.template getSubentityIndex< 0 >( n - 1 ) );
-        const auto& v1 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) );
-        const auto& v2 = mesh.getPoint( entity.template getSubentityIndex< 0 >( n - 2 ) );
-        area += v0[Coord1] * ( v1[Coord2] - v2[Coord2] );
-    }
-
-    // 2. wrap around term
-    {
-        const auto& v0 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) );
-        const auto& v1 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 1 ) );
-        const auto& v2 = mesh.getPoint( entity.template getSubentityIndex< 0 >( n - 1 ) );
-        area += v0[Coord1] * ( v1[Coord2] - v2[Coord2] );
-    }
-
-    return Real( 0.5 ) * area;
+   // http://geomalgorithms.com/code.html (function area2D_Polygon)
+
+   static_assert( Coord1 >= 0 && Coord1 <= 2 && Coord2 >= 0 && Coord2 <= 2 && Coord1 != Coord2,
+                  "Coord1 and Coord2 must be different integers with possible values {0, 1, 2}." );
+
+   using Real = typename MeshConfig::RealType;
+   using Index = typename MeshConfig::LocalIndexType;
+
+   Real area{ 0.0 };
+   const auto n = entity.template getSubentitiesCount< 0 >();
+   for( Index i = 1, j = 2, k = 0; j < n; i++, j++, k++ ) {
+      const auto& v0 = mesh.getPoint( entity.template getSubentityIndex< 0 >( i ) );
+      const auto& v1 = mesh.getPoint( entity.template getSubentityIndex< 0 >( j ) );
+      const auto& v2 = mesh.getPoint( entity.template getSubentityIndex< 0 >( k ) );
+      area += v0[ Coord1 ] * ( v1[ Coord2 ] - v2[ Coord2 ] );
+   }
+
+   // 1. wrap around term
+   {
+      const auto& v0 = mesh.getPoint( entity.template getSubentityIndex< 0 >( n - 1 ) );
+      const auto& v1 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) );
+      const auto& v2 = mesh.getPoint( entity.template getSubentityIndex< 0 >( n - 2 ) );
+      area += v0[ Coord1 ] * ( v1[ Coord2 ] - v2[ Coord2 ] );
+   }
+
+   // 2. wrap around term
+   {
+      const auto& v0 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) );
+      const auto& v1 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 1 ) );
+      const auto& v2 = mesh.getPoint( entity.template getSubentityIndex< 0 >( n - 1 ) );
+      area += v0[ Coord1 ] * ( v1[ Coord2 ] - v2[ Coord2 ] );
+   }
+
+   return Real( 0.5 ) * area;
 }
 
-template< typename MeshConfig,
-          typename Device,
-          std::enable_if_t< MeshConfig::spaceDimension == 2, bool > = true >
+template< typename MeshConfig, typename Device, std::enable_if_t< MeshConfig::spaceDimension == 2, bool > = true >
 __cuda_callable__
 typename MeshConfig::RealType
-getEntityMeasure( const Mesh< MeshConfig, Device > & mesh,
-                  const MeshEntity< MeshConfig, Device, Topologies::Polygon > & entity )
+getEntityMeasure( const Mesh< MeshConfig, Device >& mesh, const MeshEntity< MeshConfig, Device, Topologies::Polygon >& entity )
 {
-    const auto area = getPolygon2DArea< 0, 1 >( mesh, entity );
-    return TNL::abs( area );
+   const auto area = getPolygon2DArea< 0, 1 >( mesh, entity );
+   return TNL::abs( area );
 }
 
-template< typename MeshConfig,
-          typename Device,
-          std::enable_if_t< MeshConfig::spaceDimension == 3, bool > = true >
+template< typename MeshConfig, typename Device, std::enable_if_t< MeshConfig::spaceDimension == 3, bool > = true >
 __cuda_callable__
 typename MeshConfig::RealType
-getEntityMeasure( const Mesh< MeshConfig, Device > & mesh,
-                  const MeshEntity< MeshConfig, Device, Topologies::Polygon > & entity )
+getEntityMeasure( const Mesh< MeshConfig, Device >& mesh, const MeshEntity< MeshConfig, Device, Topologies::Polygon >& entity )
 
 {
-    // http://geomalgorithms.com/code.html (function area3D_Polygon)
-
-    using Real = typename MeshConfig::RealType;
-
-    // select largest abs coordinate of normal vector to ignore for projection
-    auto normal = getNormalVector( mesh, entity );
-    normal = TNL::abs( normal );
-    int coord = 2;  // ignore z-coord
-    if ( normal.x() > normal.y() ) {
-        if ( normal.x() > normal.z() ) coord = 0;  // ignore x-coord
-    }
-    else if ( normal.y() > normal.z() ) coord = 1; // ignore y-coord
-
-    Real area;
-    switch( coord ) {
-        case 0: // ignored x-coord
-            area = getPolygon2DArea< 1, 2 >( mesh, entity );
-            area *= l2Norm( normal ) / normal.x();
-            break;
-        case 1: // ignored y-coord
-            area = getPolygon2DArea< 0, 2 >( mesh, entity );
-            area *= l2Norm( normal ) / normal.y();
-            break;
-        default: // ignored z-coord
-            area = getPolygon2DArea< 0, 1 >( mesh, entity );
-            area *= l2Norm( normal ) / normal.z();
-            break;
-    }
-    return TNL::abs( area );
+   // http://geomalgorithms.com/code.html (function area3D_Polygon)
+
+   using Real = typename MeshConfig::RealType;
+
+   // select largest abs coordinate of normal vector to ignore for projection
+   auto normal = getNormalVector( mesh, entity );
+   normal = TNL::abs( normal );
+   int coord = 2;  // ignore z-coord
+   if( normal.x() > normal.y() ) {
+      if( normal.x() > normal.z() )
+         coord = 0;  // ignore x-coord
+   }
+   else if( normal.y() > normal.z() )
+      coord = 1;  // ignore y-coord
+
+   Real area;
+   switch( coord ) {
+      case 0:  // ignored x-coord
+         area = getPolygon2DArea< 1, 2 >( mesh, entity );
+         area *= l2Norm( normal ) / normal.x();
+         break;
+      case 1:  // ignored y-coord
+         area = getPolygon2DArea< 0, 2 >( mesh, entity );
+         area *= l2Norm( normal ) / normal.y();
+         break;
+      default:  // ignored z-coord
+         area = getPolygon2DArea< 0, 1 >( mesh, entity );
+         area *= l2Norm( normal ) / normal.z();
+         break;
+   }
+   return TNL::abs( area );
 }
 
 // Wedge
-template< typename MeshConfig,
-          typename Device >
+template< typename MeshConfig, typename Device >
 __cuda_callable__
 typename MeshConfig::RealType
-getEntityMeasure( const Mesh< MeshConfig, Device > & mesh,
-                  const MeshEntity< MeshConfig, Device, Topologies::Wedge > & entity )
+getEntityMeasure( const Mesh< MeshConfig, Device >& mesh, const MeshEntity< MeshConfig, Device, Topologies::Wedge >& entity )
 {
-    using Real = typename MeshConfig::RealType;
-
-    const auto& v0 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) );
-    const auto& v1 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 1 ) );
-    const auto& v2 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 2 ) );
-    const auto& v3 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 3 ) );
-    const auto& v4 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 4 ) );
-    const auto& v5 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 5 ) );
-    // Partition wedge into three tetrahedrons.
-    return getTetrahedronVolume( v2 - v3, v0 - v3, v1 - v3 )
-         + getTetrahedronVolume( v2 - v3, v1 - v3, v4 - v3 )
-         + getTetrahedronVolume( v2 - v3, v4 - v3, v5 - v3 );
+   using Real = typename MeshConfig::RealType;
+
+   const auto& v0 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) );
+   const auto& v1 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 1 ) );
+   const auto& v2 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 2 ) );
+   const auto& v3 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 3 ) );
+   const auto& v4 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 4 ) );
+   const auto& v5 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 5 ) );
+   // Partition wedge into three tetrahedrons.
+   return getTetrahedronVolume( v2 - v3, v0 - v3, v1 - v3 ) + getTetrahedronVolume( v2 - v3, v1 - v3, v4 - v3 )
+        + getTetrahedronVolume( v2 - v3, v4 - v3, v5 - v3 );
 }
 
 // Pyramid
-template< typename MeshConfig,
-          typename Device >
+template< typename MeshConfig, typename Device >
 __cuda_callable__
 typename MeshConfig::RealType
-getEntityMeasure( const Mesh< MeshConfig, Device > & mesh,
-                  const MeshEntity< MeshConfig, Device, Topologies::Pyramid > & entity )
+getEntityMeasure( const Mesh< MeshConfig, Device >& mesh, const MeshEntity< MeshConfig, Device, Topologies::Pyramid >& entity )
 {
-    using Real = typename MeshConfig::RealType;
-
-    const auto& v0 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) );
-    const auto& v1 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 1 ) );
-    const auto& v2 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 2 ) );
-    const auto& v3 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 3 ) );
-    const auto& v4 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 4 ) );
-    // Partition pyramid into two tetrahedrons.
-    return getTetrahedronVolume( v4 - v0, v3 - v0, v1 - v0 )
-         + getTetrahedronVolume( v4 - v2, v1 - v2, v3 - v2 );
+   using Real = typename MeshConfig::RealType;
+
+   const auto& v0 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) );
+   const auto& v1 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 1 ) );
+   const auto& v2 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 2 ) );
+   const auto& v3 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 3 ) );
+   const auto& v4 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 4 ) );
+   // Partition pyramid into two tetrahedrons.
+   return getTetrahedronVolume( v4 - v0, v3 - v0, v1 - v0 ) + getTetrahedronVolume( v4 - v2, v1 - v2, v3 - v2 );
 }
 
 // Polyhedron
@@ -333,8 +302,10 @@ getEntityMeasure( const Mesh< MeshConfig, Device > & mesh,
         for( Index i = 1, j = 2; j < verticesCount; i++, j++ ) {
             const auto& v1 = mesh.getPoint( face.template getSubentityIndex< 0 >( i ) );
             const auto& v2 = mesh.getPoint( face.template getSubentityIndex< 0 >( j ) );
-            // Partition polyhedron into tetrahedrons by triangulating faces and connecting each triangle to the origin point (0,0,0).
-            // It is required that vertices of all faces are stored consistently in CW or CCW order as faces are viewed from the outside.
+            // Partition polyhedron into tetrahedrons by triangulating faces and connecting each triangle to the origin point
+(0,0,0).
+            // It is required that vertices of all faces are stored consistently in CW or CCW order as faces are viewed from the
+outside.
             // Otherwise signs of some tetrahedron volumes may be incorrect, resulting in overall incorrect volume.
             // https://stackoverflow.com/a/1849746
 
@@ -349,58 +320,59 @@ getEntityMeasure( const Mesh< MeshConfig, Device > & mesh,
     return Real{ 1.0 / 6.0 } * TNL::abs( volume );
 }*/
 
-template< typename MeshConfig,
-          typename Device >
+template< typename MeshConfig, typename Device >
 __cuda_callable__
 typename MeshConfig::RealType
-getEntityMeasure( const Mesh< MeshConfig, Device > & mesh,
-                  const MeshEntity< MeshConfig, Device, Topologies::Polyhedron > & entity )
+getEntityMeasure( const Mesh< MeshConfig, Device >& mesh,
+                  const MeshEntity< MeshConfig, Device, Topologies::Polyhedron >& entity )
 {
-    using Real = typename MeshConfig::RealType;
-    using Index = typename MeshConfig::LocalIndexType;
-    Real volume{ 0.0 };
-    const Index facesCount = entity.template getSubentitiesCount< 2 >();
-    const auto& v3 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) );
-    for( Index faceIdx = 0; faceIdx < facesCount; faceIdx++ ) {
-        const auto face = mesh.template getEntity< 2 >( entity.template getSubentityIndex< 2 >( faceIdx ) );
-        const Index verticesCount = face.template getSubentitiesCount< 0 >();
-        const auto& v0 = mesh.getPoint( face.template getSubentityIndex< 0 >( 0 ) );
-        for( Index i = 1, j = 2; j < verticesCount; i++, j++ ) {
-            const auto& v1 = mesh.getPoint( face.template getSubentityIndex< 0 >( i ) );
-            const auto& v2 = mesh.getPoint( face.template getSubentityIndex< 0 >( j ) );
-            // Partition polyhedron into tetrahedrons by triangulating faces and connecting each triangle to one point of the polyhedron.
-            volume += getTetrahedronVolume( v3 - v0, v2 - v0, v1 - v0 );
-        }
-    }
-    return volume;
+   using Real = typename MeshConfig::RealType;
+   using Index = typename MeshConfig::LocalIndexType;
+   Real volume{ 0.0 };
+   const Index facesCount = entity.template getSubentitiesCount< 2 >();
+   const auto& v3 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) );
+   for( Index faceIdx = 0; faceIdx < facesCount; faceIdx++ ) {
+      const auto face = mesh.template getEntity< 2 >( entity.template getSubentityIndex< 2 >( faceIdx ) );
+      const Index verticesCount = face.template getSubentitiesCount< 0 >();
+      const auto& v0 = mesh.getPoint( face.template getSubentityIndex< 0 >( 0 ) );
+      for( Index i = 1, j = 2; j < verticesCount; i++, j++ ) {
+         const auto& v1 = mesh.getPoint( face.template getSubentityIndex< 0 >( i ) );
+         const auto& v2 = mesh.getPoint( face.template getSubentityIndex< 0 >( j ) );
+         // Partition polyhedron into tetrahedrons by triangulating faces and connecting each triangle to one point of the
+         // polyhedron.
+         volume += getTetrahedronVolume( v3 - v0, v2 - v0, v1 - v0 );
+      }
+   }
+   return volume;
 }
 
 template< typename MeshConfig >
 __cuda_callable__
 typename MeshConfig::RealType
-getEntityMeasure( const Mesh< MeshConfig, Devices::Cuda > & mesh,
-                  const MeshEntity< MeshConfig, Devices::Cuda, Topologies::Polyhedron > & entity )
+getEntityMeasure( const Mesh< MeshConfig, Devices::Cuda >& mesh,
+                  const MeshEntity< MeshConfig, Devices::Cuda, Topologies::Polyhedron >& entity )
 {
-    using Real = typename MeshConfig::RealType;
-    using Index = typename MeshConfig::LocalIndexType;
-    using Point = typename Mesh< MeshConfig, Devices::Cuda >::PointType;
-    Real volume{ 0.0 };
-    const Index facesCount = entity.template getSubentitiesCount< 2 >();
-    const Point v3 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) );
-    for( Index faceIdx = 0; faceIdx < facesCount; faceIdx++ ) {
-        const auto face = mesh.template getEntity< 2 >( entity.template getSubentityIndex< 2 >( faceIdx ) );
-        const Index verticesCount = face.template getSubentitiesCount< 0 >();
-        const Point v0 = mesh.getPoint( face.template getSubentityIndex< 0 >( 0 ) );
-        Point v1 = mesh.getPoint( face.template getSubentityIndex< 0 >( 1 ) );
-        for( Index j = 2; j < verticesCount; j++ ) {
-            const Point v2 = mesh.getPoint( face.template getSubentityIndex< 0 >( j ) );
-            // Partition polyhedron into tetrahedrons by triangulating faces and connecting each triangle to one point of the polyhedron.
-            volume += getTetrahedronVolume( v3 - v0, v2 - v0, v1 - v0 );
-            v1 = v2;
-        }
-    }
-    return volume;
+   using Real = typename MeshConfig::RealType;
+   using Index = typename MeshConfig::LocalIndexType;
+   using Point = typename Mesh< MeshConfig, Devices::Cuda >::PointType;
+   Real volume{ 0.0 };
+   const Index facesCount = entity.template getSubentitiesCount< 2 >();
+   const Point v3 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) );
+   for( Index faceIdx = 0; faceIdx < facesCount; faceIdx++ ) {
+      const auto face = mesh.template getEntity< 2 >( entity.template getSubentityIndex< 2 >( faceIdx ) );
+      const Index verticesCount = face.template getSubentitiesCount< 0 >();
+      const Point v0 = mesh.getPoint( face.template getSubentityIndex< 0 >( 0 ) );
+      Point v1 = mesh.getPoint( face.template getSubentityIndex< 0 >( 1 ) );
+      for( Index j = 2; j < verticesCount; j++ ) {
+         const Point v2 = mesh.getPoint( face.template getSubentityIndex< 0 >( j ) );
+         // Partition polyhedron into tetrahedrons by triangulating faces and connecting each triangle to one point of the
+         // polyhedron.
+         volume += getTetrahedronVolume( v3 - v0, v2 - v0, v1 - v0 );
+         v1 = v2;
+      }
+   }
+   return volume;
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Geometry/getOutwardNormalVector.h b/src/TNL/Meshes/Geometry/getOutwardNormalVector.h
index 73e345c7b92b8dd667b30c2fa996c5172816f178..1b473ff40cb075c3f335b14f6cf8629b150c9f76 100644
--- a/src/TNL/Meshes/Geometry/getOutwardNormalVector.h
+++ b/src/TNL/Meshes/Geometry/getOutwardNormalVector.h
@@ -15,118 +15,112 @@ namespace Meshes {
 template< typename Grid, typename Config >
 __cuda_callable__
 typename Grid::PointType
-getOutwardNormalVector( const Grid & grid,
-                        const GridEntity< Grid, 0, Config > & face,
-                        const typename Grid::PointType cellCenter )
+getOutwardNormalVector( const Grid& grid, const GridEntity< Grid, 0, Config >& face, const typename Grid::PointType cellCenter )
 {
    static_assert( Grid::getMeshDimension() == 1, "getOutwardNormalVector can be used only with faces." );
    const typename Grid::PointType faceCenter = getEntityCenter( grid, face );
    if( faceCenter.x() > cellCenter.x() )
-      return {1};
+      return { 1 };
    else
-      return {-1};
+      return { -1 };
 }
 
 template< typename Grid, typename Config >
 __cuda_callable__
 typename Grid::PointType
-getOutwardNormalVector( const Grid & grid,
-                        const GridEntity< Grid, 1, Config > & face,
-                        const typename Grid::PointType cellCenter )
+getOutwardNormalVector( const Grid& grid, const GridEntity< Grid, 1, Config >& face, const typename Grid::PointType cellCenter )
 {
    static_assert( Grid::getMeshDimension() == 2, "getOutwardNormalVector can be used only with faces." );
    const typename Grid::PointType faceCenter = getEntityCenter( grid, face );
    if( face.getOrientation().x() != 0 ) {
       // x-normal face
       if( faceCenter.x() > cellCenter.x() )
-         return {1, 0};
+         return { 1, 0 };
       else
-         return {-1, 0};
+         return { -1, 0 };
    }
    else {
       // y-normal face
       if( faceCenter.y() > cellCenter.y() )
-         return {0, 1};
+         return { 0, 1 };
       else
-         return {0, -1};
+         return { 0, -1 };
    }
 }
 
 template< typename Grid, typename Config >
 __cuda_callable__
 typename Grid::PointType
-getOutwardNormalVector( const Grid & grid,
-                        const GridEntity< Grid, 2, Config > & face,
-                        const typename Grid::PointType cellCenter )
+getOutwardNormalVector( const Grid& grid, const GridEntity< Grid, 2, Config >& face, const typename Grid::PointType cellCenter )
 {
    static_assert( Grid::getMeshDimension() == 3, "getOutwardNormalVector can be used only with faces." );
    const typename Grid::PointType faceCenter = getEntityCenter( grid, face );
    if( face.getOrientation().x() != 0 ) {
       // x-normal face
       if( faceCenter.x() > cellCenter.x() )
-         return {1, 0, 0};
+         return { 1, 0, 0 };
       else
-         return {-1, 0, 0};
+         return { -1, 0, 0 };
    }
    else if( face.getOrientation().y() != 0 ) {
       // y-normal face
       if( faceCenter.y() > cellCenter.y() )
-         return {0, 1, 0};
+         return { 0, 1, 0 };
       else
-         return {0, -1, 0};
+         return { 0, -1, 0 };
    }
-   else  {
+   else {
       // z-normal face
       if( faceCenter.z() > cellCenter.z() )
-         return {0, 0, 1};
+         return { 0, 0, 1 };
       else
-         return {0, 0, -1};
+         return { 0, 0, -1 };
    }
 }
 
 template< typename MeshConfig, typename Device >
 __cuda_callable__
 typename MeshTraits< MeshConfig >::PointType
-getOutwardNormalVector( const Mesh< MeshConfig, Device > & mesh,
-                        const MeshEntity< MeshConfig, Device, Topologies::Edge > & face,
+getOutwardNormalVector( const Mesh< MeshConfig, Device >& mesh,
+                        const MeshEntity< MeshConfig, Device, Topologies::Edge >& face,
                         typename MeshTraits< MeshConfig >::PointType cellCenter )
 {
    using MeshType = Mesh< MeshConfig, Device >;
    using FaceType = MeshEntity< MeshConfig, Device, Topologies::Edge >;
    using PointType = typename MeshTraits< MeshConfig >::PointType;
-   static_assert( std::is_same< typename MeshType::Face, FaceType >::value, "getOutwardNormalVector called for an entity which is not a face" );
+   static_assert( std::is_same< typename MeshType::Face, FaceType >::value,
+                  "getOutwardNormalVector called for an entity which is not a face" );
    static_assert( MeshConfig::spaceDimension == 2, "TODO: normal vectors for 2D meshes in a 3D space are not implemented yet" );
 
    const auto& v0 = mesh.getPoint( face.template getSubentityIndex< 0 >( 0 ) );
    const auto& v1 = mesh.getPoint( face.template getSubentityIndex< 0 >( 1 ) );
    const PointType u = v0 - v1;
-   const PointType n {u[1], -u[0]};
+   const PointType n{ u[ 1 ], -u[ 0 ] };
 
    // check on which side of the face is the reference cell center
    const PointType faceCenter = getEntityCenter( mesh, face );
    if( dot( n, cellCenter - faceCenter ) < 0 )
       return n / l2Norm( n );
    else
-      return - n / l2Norm( n );
+      return -n / l2Norm( n );
 }
 
 template< typename MeshConfig, typename Device, typename EntityTopology >
 __cuda_callable__
 typename MeshTraits< MeshConfig >::PointType
-getNormalVector( const Mesh< MeshConfig, Device > & mesh,
-                 const MeshEntity< MeshConfig, Device, EntityTopology > & entity )
+getNormalVector( const Mesh< MeshConfig, Device >& mesh, const MeshEntity< MeshConfig, Device, EntityTopology >& entity )
 {
    using PointType = typename MeshTraits< MeshConfig >::PointType;
-   
+
    const auto& v0 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) );
    const auto& v1 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 1 ) );
    const auto& v2 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 2 ) );
    const PointType u1 = v0 - v1;
    const PointType u2 = v0 - v2;
-   const PointType n {
-      u1.y() * u2.z() - u1.z() * u2.y(),   // first component of the cross product
-      u1.z() * u2.x() - u1.x() * u2.z(),   // second component of the cross product
-      u1.x() * u2.y() - u1.y() * u2.x()    // third component of the cross product
+   const PointType n{
+      u1.y() * u2.z() - u1.z() * u2.y(),  // first component of the cross product
+      u1.z() * u2.x() - u1.x() * u2.z(),  // second component of the cross product
+      u1.x() * u2.y() - u1.y() * u2.x()   // third component of the cross product
    };
    return n;
 }
@@ -134,15 +128,17 @@ getNormalVector( const Mesh< MeshConfig, Device > & mesh,
 template< typename MeshConfig, typename Device, typename EntityTopology >
 __cuda_callable__
 typename MeshTraits< MeshConfig >::PointType
-getOutwardNormalVector( const Mesh< MeshConfig, Device > & mesh,
-                        const MeshEntity< MeshConfig, Device, EntityTopology > & face,
+getOutwardNormalVector( const Mesh< MeshConfig, Device >& mesh,
+                        const MeshEntity< MeshConfig, Device, EntityTopology >& face,
                         typename MeshTraits< MeshConfig >::PointType cellCenter )
 {
    using MeshType = Mesh< MeshConfig, Device >;
    using FaceType = MeshEntity< MeshConfig, Device, EntityTopology >;
    using PointType = typename MeshTraits< MeshConfig >::PointType;
-   static_assert( std::is_same< typename MeshType::Face, FaceType >::value, "getOutwardNormalVector called for an entity which is not a face" );
-   static_assert( MeshConfig::spaceDimension == 3, "general overload intended for 3D was called with the wrong space dimension" );
+   static_assert( std::is_same< typename MeshType::Face, FaceType >::value,
+                  "getOutwardNormalVector called for an entity which is not a face" );
+   static_assert( MeshConfig::spaceDimension == 3,
+                  "general overload intended for 3D was called with the wrong space dimension" );
 
    const PointType n = getNormalVector( mesh, face );
 
@@ -151,8 +147,8 @@ getOutwardNormalVector( const Mesh< MeshConfig, Device > & mesh,
    if( dot( n, cellCenter - faceCenter ) < 0 )
       return n / l2Norm( n );
    else
-      return - n / l2Norm( n );
+      return -n / l2Norm( n );
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Geometry/getPlanarMesh.h b/src/TNL/Meshes/Geometry/getPlanarMesh.h
index 7bacb6543bc0ccb5ad8061aeebc10c431ad7a707..2f70dea1a83f96a6366991e9240b319963935037 100644
--- a/src/TNL/Meshes/Geometry/getPlanarMesh.h
+++ b/src/TNL/Meshes/Geometry/getPlanarMesh.h
@@ -26,7 +26,7 @@ template< EntityDecomposerVersion DecomposerVersion,
           typename MeshConfig,
           std::enable_if_t< std::is_same< typename MeshConfig::CellTopology, Topologies::Polygon >::value, bool > = true,
           std::enable_if_t< MeshConfig::spaceDimension == 3, bool > = true >
-auto // returns MeshBuilder
+auto  // returns MeshBuilder
 planarCorrection( const Mesh< MeshConfig, Devices::Host >& inMesh )
 {
    using namespace TNL;
@@ -54,18 +54,21 @@ planarCorrection( const Mesh< MeshConfig, Devices::Host >& inMesh )
    // starting indices at which every cell will start writing new points and cells
    using IndexPair = std::pair< GlobalIndexType, GlobalIndexType >;
    Array< IndexPair, Devices::Host > indices( inCellsCount + 1 );
-   auto setCounts = [&] ( GlobalIndexType i ) {
+   auto setCounts = [ & ]( GlobalIndexType i )
+   {
       const auto cell = inMesh.template getEntity< CellDimension >( i );
       if( isPlanar( inMesh, cell, precision ) ) {
-         indices[ i ] = { 0, 1 }; // cell is not decomposed (0 extra points, 1 cell)
+         indices[ i ] = { 0, 1 };  // cell is not decomposed (0 extra points, 1 cell)
       }
       else {
          indices[ i ] = EntityDecomposer::getExtraPointsAndEntitiesCount( cell );
       }
    };
    ParallelFor< Devices::Host >::exec( GlobalIndexType{ 0 }, inCellsCount, setCounts );
-   indices[ inCellsCount ] = { 0, 0 }; // extend exclusive prefix sum by one element to also get result of reduce at the same time
-   auto reduction = [] ( const IndexPair& a, const IndexPair& b ) -> IndexPair {
+   indices[ inCellsCount ] = { 0,
+                               0 };  // extend exclusive prefix sum by one element to also get result of reduce at the same time
+   auto reduction = []( const IndexPair& a, const IndexPair& b ) -> IndexPair
+   {
       return { a.first + b.first, a.second + b.second };
    };
    inplaceExclusiveScan( indices, 0, indices.getSize(), reduction, std::make_pair( 0, 0 ) );
@@ -75,24 +78,26 @@ planarCorrection( const Mesh< MeshConfig, Devices::Host >& inMesh )
    meshBuilder.setEntitiesCount( outPointsCount, outCellsCount );
 
    // Copy the points from inMesh to outMesh
-   auto copyPoint = [&] ( GlobalIndexType i ) mutable {
+   auto copyPoint = [ & ]( GlobalIndexType i ) mutable
+   {
       meshBuilder.setPoint( i, inMesh.getPoint( i ) );
    };
    ParallelFor< Devices::Host >::exec( GlobalIndexType{ 0 }, inPointsCount, copyPoint );
 
    // set corner counts for cells
    NeighborCountsArray cellCornersCounts( outCellsCount );
-   auto setCornersCount = [&] ( GlobalIndexType i ) mutable {
+   auto setCornersCount = [ & ]( GlobalIndexType i ) mutable
+   {
       GlobalIndexType cellIndex = indices[ i ].second;
       const GlobalIndexType nextCellIndex = indices[ i + 1 ].second;
       const GlobalIndexType cellsCount = nextCellIndex - cellIndex;
 
-      if( cellsCount == 1 ) { // cell is already planar (cell is copied)
+      if( cellsCount == 1 ) {  // cell is already planar (cell is copied)
          const auto cell = inMesh.template getEntity< CellDimension >( i );
          const auto verticesCount = cell.template getSubentitiesCount< 0 >();
          cellCornersCounts[ cellIndex ] = verticesCount;
       }
-      else { // cell is not planar (cell is decomposed)
+      else {  // cell is not planar (cell is decomposed)
          for( ; cellIndex < nextCellIndex; cellIndex++ ) {
             cellCornersCounts[ cellIndex ] = 3;
          }
@@ -102,23 +107,25 @@ planarCorrection( const Mesh< MeshConfig, Devices::Host >& inMesh )
    meshBuilder.setCellCornersCounts( std::move( cellCornersCounts ) );
 
    // Decompose non-planar cells and copy the rest
-   auto decomposeCell = [&] ( GlobalIndexType i ) mutable {
+   auto decomposeCell = [ & ]( GlobalIndexType i ) mutable
+   {
       const auto cell = inMesh.template getEntity< CellDimension >( i );
       const auto& indexPair = indices[ i ];
       const auto& nextIndexPair = indices[ i + 1 ];
       const GlobalIndexType cellsCount = nextIndexPair.second - indexPair.second;
 
-      if( cellsCount == 1 ) { // cell is already planar (cell is copied)
+      if( cellsCount == 1 ) {  // cell is already planar (cell is copied)
          auto seed = meshBuilder.getCellSeed( indexPair.second );
          const auto verticesCount = cell.template getSubentitiesCount< 0 >();
          for( LocalIndexType j = 0; j < verticesCount; j++ ) {
             seed.setCornerId( j, cell.template getSubentityIndex< 0 >( j ) );
          }
       }
-      else { // cell is not planar (cell is decomposed)
+      else {  // cell is not planar (cell is decomposed)
          // Lambda for adding new points
          GlobalIndexType setPointIndex = inPointsCount + indexPair.first;
-         auto addPoint = [&] ( const PointType& point ) {
+         auto addPoint = [ & ]( const PointType& point )
+         {
             const auto pointIdx = setPointIndex++;
             meshBuilder.setPoint( pointIdx, point );
             return pointIdx;
@@ -126,7 +133,8 @@ planarCorrection( const Mesh< MeshConfig, Devices::Host >& inMesh )
 
          // Lambda for adding new cells
          GlobalIndexType setCellIndex = indexPair.second;
-         auto addCell = [&] ( GlobalIndexType v0, GlobalIndexType v1, GlobalIndexType v2 ) {
+         auto addCell = [ & ]( GlobalIndexType v0, GlobalIndexType v1, GlobalIndexType v2 )
+         {
             auto entitySeed = meshBuilder.getCellSeed( setCellIndex++ );
             entitySeed.setCornerId( 0, v0 );
             entitySeed.setCornerId( 1, v1 );
@@ -145,7 +153,7 @@ planarCorrection( const Mesh< MeshConfig, Devices::Host >& inMesh )
 template< EntityDecomposerVersion DecomposerVersion,
           typename MeshConfig,
           std::enable_if_t< std::is_same< typename MeshConfig::CellTopology, Topologies::Polyhedron >::value, bool > = true >
-auto // returns MeshBuilder
+auto  // returns MeshBuilder
 planarCorrection( const Mesh< MeshConfig, Devices::Host >& inMesh )
 {
    using namespace TNL;
@@ -175,36 +183,41 @@ planarCorrection( const Mesh< MeshConfig, Devices::Host >& inMesh )
    // starting indices at which every face will start writing new points and faces
    using IndexPair = std::pair< GlobalIndexType, GlobalIndexType >;
    Array< IndexPair, Devices::Host > indices( inFacesCount + 1 );
-   auto setCounts = [&] ( GlobalIndexType i ) {
+   auto setCounts = [ & ]( GlobalIndexType i )
+   {
       const auto face = inMesh.template getEntity< FaceDimension >( i );
       if( isPlanar( inMesh, face, precision ) ) {
-         indices[ i ] = { 0, 1 }; // face is not decomposed (0 extra points, 1 face)
+         indices[ i ] = { 0, 1 };  // face is not decomposed (0 extra points, 1 face)
       }
       else {
          indices[ i ] = EntityDecomposer::getExtraPointsAndEntitiesCount( face );
       }
    };
    ParallelFor< Devices::Host >::exec( GlobalIndexType{ 0 }, inFacesCount, setCounts );
-   indices[ inFacesCount ] = { 0, 0 }; // extend exclusive prefix sum by one element to also get result of reduce at the same time
-   auto reduction = [] ( const IndexPair& a, const IndexPair& b ) -> IndexPair {
+   indices[ inFacesCount ] = { 0,
+                               0 };  // extend exclusive prefix sum by one element to also get result of reduce at the same time
+   auto reduction = []( const IndexPair& a, const IndexPair& b ) -> IndexPair
+   {
       return { a.first + b.first, a.second + b.second };
    };
    inplaceExclusiveScan( indices, 0, indices.getSize(), reduction, std::make_pair( 0, 0 ) );
    const auto& reduceResult = indices[ inFacesCount ];
    const GlobalIndexType outPointsCount = inPointsCount + reduceResult.first;
    const GlobalIndexType outFacesCount = reduceResult.second;
-   const GlobalIndexType outCellsCount = inCellsCount; // The number of cells stays the same
+   const GlobalIndexType outCellsCount = inCellsCount;  // The number of cells stays the same
    meshBuilder.setEntitiesCount( outPointsCount, outCellsCount, outFacesCount );
 
    // Copy the points from inMesh to outMesh
-   auto copyPoint = [&] ( GlobalIndexType i ) mutable {
+   auto copyPoint = [ & ]( GlobalIndexType i ) mutable
+   {
       meshBuilder.setPoint( i, inMesh.getPoint( i ) );
    };
    ParallelFor< Devices::Host >::exec( GlobalIndexType{ 0 }, inPointsCount, copyPoint );
 
    // set corner counts for cells
    NeighborCountsArray cellCornersCounts( outCellsCount );
-   auto setCellCornersCount = [&] ( GlobalIndexType i ) mutable {
+   auto setCellCornersCount = [ & ]( GlobalIndexType i ) mutable
+   {
       const auto cell = inMesh.template getEntity< CellDimension >( i );
       const LocalIndexType cellFacesCount = cell.template getSubentitiesCount< FaceDimension >();
 
@@ -221,7 +234,8 @@ planarCorrection( const Mesh< MeshConfig, Devices::Host >& inMesh )
    meshBuilder.setCellCornersCounts( std::move( cellCornersCounts ) );
 
    // Set corner ids for cells
-   auto setCellCornersIds = [&] ( GlobalIndexType i ) mutable {
+   auto setCellCornersIds = [ & ]( GlobalIndexType i ) mutable
+   {
       const auto cell = inMesh.template getEntity< CellDimension >( i );
       const LocalIndexType cellFacesCount = cell.template getSubentitiesCount< FaceDimension >();
       auto cellSeed = meshBuilder.getCellSeed( i );
@@ -237,16 +251,17 @@ planarCorrection( const Mesh< MeshConfig, Devices::Host >& inMesh )
 
    // set corner counts for faces
    NeighborCountsArray faceCornersCounts( outFacesCount );
-   auto setFaceCornersCount = [&] ( GlobalIndexType i ) mutable {
+   auto setFaceCornersCount = [ & ]( GlobalIndexType i ) mutable
+   {
       GlobalIndexType faceIndex = indices[ i ].second;
       const GlobalIndexType nextFaceIndex = indices[ i + 1 ].second;
       const GlobalIndexType facesCount = nextFaceIndex - faceIndex;
-      if( facesCount == 1 ) { // face is already planar (it is copied)
+      if( facesCount == 1 ) {  // face is already planar (it is copied)
          const auto face = inMesh.template getEntity< FaceDimension >( i );
          const auto verticesCount = face.template getSubentitiesCount< 0 >();
          faceCornersCounts[ faceIndex ] = verticesCount;
       }
-      else { // face is not planar (it is decomposed)
+      else {  // face is not planar (it is decomposed)
          for( ; faceIndex < nextFaceIndex; faceIndex++ ) {
             faceCornersCounts[ faceIndex ] = 3;
          }
@@ -256,23 +271,25 @@ planarCorrection( const Mesh< MeshConfig, Devices::Host >& inMesh )
    meshBuilder.setFaceCornersCounts( std::move( faceCornersCounts ) );
 
    // Decompose non-planar faces and copy the rest
-   auto decomposeFace = [&] ( GlobalIndexType i ) mutable {
+   auto decomposeFace = [ & ]( GlobalIndexType i ) mutable
+   {
       const auto face = inMesh.template getEntity< FaceDimension >( i );
       const auto& indexPair = indices[ i ];
       const auto& nextIndexPair = indices[ i + 1 ];
       const GlobalIndexType facesCount = nextIndexPair.second - indexPair.second;
 
-      if( facesCount == 1 ) { // face is already planar (it is copied)
+      if( facesCount == 1 ) {  // face is already planar (it is copied)
          auto seed = meshBuilder.getFaceSeed( indexPair.second );
          const auto verticesCount = face.template getSubentitiesCount< 0 >();
          for( LocalIndexType j = 0; j < verticesCount; j++ ) {
             seed.setCornerId( j, face.template getSubentityIndex< 0 >( j ) );
          }
       }
-      else { // face is not planar (it is decomposed)
+      else {  // face is not planar (it is decomposed)
          // Lambda for adding new points
          GlobalIndexType setPointIndex = inPointsCount + indexPair.first;
-         auto addPoint = [&] ( const PointType& point ) {
+         auto addPoint = [ & ]( const PointType& point )
+         {
             const auto pointIdx = setPointIndex++;
             meshBuilder.setPoint( pointIdx, point );
             return pointIdx;
@@ -280,7 +297,8 @@ planarCorrection( const Mesh< MeshConfig, Devices::Host >& inMesh )
 
          // Lambda for adding new faces
          GlobalIndexType setFaceIndex = indexPair.second;
-         auto addFace = [&] ( GlobalIndexType v0, GlobalIndexType v1, GlobalIndexType v2 ) {
+         auto addFace = [ & ]( GlobalIndexType v0, GlobalIndexType v1, GlobalIndexType v2 )
+         {
             auto entitySeed = meshBuilder.getFaceSeed( setFaceIndex++ );
             entitySeed.setCornerId( 0, v0 );
             entitySeed.setCornerId( 1, v1 );
@@ -297,11 +315,11 @@ planarCorrection( const Mesh< MeshConfig, Devices::Host >& inMesh )
 
 template< EntityDecomposerVersion DecomposerVersion,
           typename MeshConfig,
-          std::enable_if_t<   MeshConfig::spaceDimension == 3 &&
-                            ( std::is_same< typename MeshConfig::CellTopology, Topologies::Polygon >::value ||
-                              std::is_same< typename MeshConfig::CellTopology, Topologies::Polyhedron >::value ),
-                              bool > = true >
-auto // returns Mesh
+          std::enable_if_t< MeshConfig::spaceDimension == 3
+                               && ( std::is_same< typename MeshConfig::CellTopology, Topologies::Polygon >::value
+                                    || std::is_same< typename MeshConfig::CellTopology, Topologies::Polyhedron >::value ),
+                            bool > = true >
+auto  // returns Mesh
 getPlanarMesh( const Mesh< MeshConfig, Devices::Host >& inMesh )
 {
    using Mesh = Mesh< MeshConfig, Devices::Host >;
@@ -312,5 +330,5 @@ getPlanarMesh( const Mesh< MeshConfig, Devices::Host >& inMesh )
    return outMesh;
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Geometry/getRefinedMesh.h b/src/TNL/Meshes/Geometry/getRefinedMesh.h
index 1115381fc89a12006fbb1206a6f4d6cb3c1ab41e..77485750da5af73654e169fcd8f32202ab6522a3 100644
--- a/src/TNL/Meshes/Geometry/getRefinedMesh.h
+++ b/src/TNL/Meshes/Geometry/getRefinedMesh.h
@@ -20,10 +20,11 @@ namespace Meshes {
 template< EntityRefinerVersion RefinerVersion,
           typename MeshConfig,
           std::enable_if_t< std::is_same< typename MeshConfig::CellTopology, Topologies::Triangle >::value
-                         || std::is_same< typename MeshConfig::CellTopology, Topologies::Quadrangle >::value
-                         || std::is_same< typename MeshConfig::CellTopology, Topologies::Tetrahedron >::value
-                         || std::is_same< typename MeshConfig::CellTopology, Topologies::Hexahedron >::value, bool > = true >
-auto // returns MeshBuilder
+                               || std::is_same< typename MeshConfig::CellTopology, Topologies::Quadrangle >::value
+                               || std::is_same< typename MeshConfig::CellTopology, Topologies::Tetrahedron >::value
+                               || std::is_same< typename MeshConfig::CellTopology, Topologies::Hexahedron >::value,
+                            bool > = true >
+auto  // returns MeshBuilder
 refineMesh( const Mesh< MeshConfig, Devices::Host >& inMesh )
 {
    using namespace TNL;
@@ -46,13 +47,16 @@ refineMesh( const Mesh< MeshConfig, Devices::Host >& inMesh )
    // starting indices at which every cell will start writing new refined points and cells
    using IndexPair = std::pair< GlobalIndexType, GlobalIndexType >;
    Array< IndexPair, Devices::Host > indices( inCellsCount + 1 );
-   auto setCounts = [&] ( GlobalIndexType i ) {
+   auto setCounts = [ & ]( GlobalIndexType i )
+   {
       const auto cell = inMesh.template getEntity< CellDimension >( i );
       indices[ i ] = EntityRefiner::getExtraPointsAndEntitiesCount( cell );
    };
    ParallelFor< Devices::Host >::exec( GlobalIndexType{ 0 }, inCellsCount, setCounts );
-   indices[ inCellsCount ] = { 0, 0 }; // extend exclusive prefix sum by one element to also get result of reduce at the same time
-   auto reduction = [] ( const IndexPair& a, const IndexPair& b ) -> IndexPair {
+   indices[ inCellsCount ] = { 0,
+                               0 };  // extend exclusive prefix sum by one element to also get result of reduce at the same time
+   auto reduction = []( const IndexPair& a, const IndexPair& b ) -> IndexPair
+   {
       return { a.first + b.first, a.second + b.second };
    };
    inplaceExclusiveScan( indices, 0, indices.getSize(), reduction, std::make_pair( 0, 0 ) );
@@ -62,19 +66,22 @@ refineMesh( const Mesh< MeshConfig, Devices::Host >& inMesh )
    meshBuilder.setEntitiesCount( outPointsCount, outCellsCount );
 
    // Copy the points from inMesh to outMesh
-   auto copyPoint = [&] ( GlobalIndexType i ) mutable {
+   auto copyPoint = [ & ]( GlobalIndexType i ) mutable
+   {
       meshBuilder.setPoint( i, inMesh.getPoint( i ) );
    };
    ParallelFor< Devices::Host >::exec( GlobalIndexType{ 0 }, inPointsCount, copyPoint );
 
    // Refine each cell
-   auto refineCell = [&] ( GlobalIndexType i ) mutable {
+   auto refineCell = [ & ]( GlobalIndexType i ) mutable
+   {
       const auto cell = inMesh.template getEntity< CellDimension >( i );
       const auto& indexPair = indices[ i ];
 
       // Lambda for adding new points
       GlobalIndexType setPointIndex = inPointsCount + indexPair.first;
-      auto addPoint = [&] ( const PointType& point ) {
+      auto addPoint = [ & ]( const PointType& point )
+      {
          const auto pointIdx = setPointIndex++;
          meshBuilder.setPoint( pointIdx, point );
          return pointIdx;
@@ -82,7 +89,8 @@ refineMesh( const Mesh< MeshConfig, Devices::Host >& inMesh )
 
       // Lambda for adding new cells
       GlobalIndexType setCellIndex = indexPair.second;
-      auto addCell = [&] ( auto... vertexIndices ) {
+      auto addCell = [ & ]( auto... vertexIndices )
+      {
          auto entitySeed = meshBuilder.getCellSeed( setCellIndex++ );
          entitySeed.setCornerIds( vertexIndices... );
       };
@@ -97,10 +105,11 @@ refineMesh( const Mesh< MeshConfig, Devices::Host >& inMesh )
 template< EntityRefinerVersion RefinerVersion,
           typename MeshConfig,
           std::enable_if_t< std::is_same< typename MeshConfig::CellTopology, Topologies::Triangle >::value
-                         || std::is_same< typename MeshConfig::CellTopology, Topologies::Quadrangle >::value
-                         || std::is_same< typename MeshConfig::CellTopology, Topologies::Tetrahedron >::value
-                         || std::is_same< typename MeshConfig::CellTopology, Topologies::Hexahedron >::value, bool > = true >
-auto // returns Mesh
+                               || std::is_same< typename MeshConfig::CellTopology, Topologies::Quadrangle >::value
+                               || std::is_same< typename MeshConfig::CellTopology, Topologies::Tetrahedron >::value
+                               || std::is_same< typename MeshConfig::CellTopology, Topologies::Hexahedron >::value,
+                            bool > = true >
+auto  // returns Mesh
 getRefinedMesh( const Mesh< MeshConfig, Devices::Host >& inMesh )
 {
    using Mesh = Mesh< MeshConfig, Devices::Host >;
@@ -112,5 +121,5 @@ getRefinedMesh( const Mesh< MeshConfig, Devices::Host >& inMesh )
    return outMesh;
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Geometry/isPlanar.h b/src/TNL/Meshes/Geometry/isPlanar.h
index 578d862d582c4f01b0d94f33f66b61e8fe641e8b..8c3733ab0c5f617f386eac4d7f5b8873f05c2d71 100644
--- a/src/TNL/Meshes/Geometry/isPlanar.h
+++ b/src/TNL/Meshes/Geometry/isPlanar.h
@@ -12,13 +12,11 @@ namespace TNL {
 namespace Meshes {
 
 // Polygon
-template< typename MeshConfig,
-          typename Device,
-          std::enable_if_t< MeshConfig::spaceDimension == 3, bool > = true >
+template< typename MeshConfig, typename Device, std::enable_if_t< MeshConfig::spaceDimension == 3, bool > = true >
 __cuda_callable__
 bool
-isPlanar( const Mesh< MeshConfig, Device > & mesh,
-          const MeshEntity< MeshConfig, Device, Topologies::Polygon > & entity,
+isPlanar( const Mesh< MeshConfig, Device >& mesh,
+          const MeshEntity< MeshConfig, Device, Topologies::Polygon >& entity,
           const typename MeshConfig::RealType precision )
 {
    using Real = typename MeshConfig::RealType;
@@ -36,5 +34,5 @@ isPlanar( const Mesh< MeshConfig, Device > & mesh,
    return true;
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Grid.h b/src/TNL/Meshes/Grid.h
index da2e8d060e617d45dd062d2a67c61b26c4d1fd7f..4ad322f308f23c769d229cf2323e22a001d7f032 100644
--- a/src/TNL/Meshes/Grid.h
+++ b/src/TNL/Meshes/Grid.h
@@ -11,33 +11,30 @@
 namespace TNL {
 namespace Meshes {
 
-template< int Dimension,
-          typename Real = double,
-          typename Device = Devices::Host,
-          typename Index = int >
+template< int Dimension, typename Real = double, typename Device = Devices::Host, typename Index = int >
 class Grid;
 
 template< int Dimension, typename Real, typename Device, typename Index >
-bool operator==( const Grid< Dimension, Real, Device, Index >& lhs,
-                 const Grid< Dimension, Real, Device, Index >& rhs )
+bool
+operator==( const Grid< Dimension, Real, Device, Index >& lhs, const Grid< Dimension, Real, Device, Index >& rhs )
 {
-   return lhs.getDimensions() == rhs.getDimensions()
-       && lhs.getOrigin() == rhs.getOrigin()
+   return lhs.getDimensions() == rhs.getDimensions() && lhs.getOrigin() == rhs.getOrigin()
        && lhs.getProportions() == rhs.getProportions();
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
-bool operator!=( const Grid< Dimension, Real, Device, Index >& lhs,
-                 const Grid< Dimension, Real, Device, Index >& rhs )
+bool
+operator!=( const Grid< Dimension, Real, Device, Index >& lhs, const Grid< Dimension, Real, Device, Index >& rhs )
 {
-   return ! (lhs == rhs);
+   return ! ( lhs == rhs );
 }
 
 template< int Dimension, typename Real, typename Device, typename Index >
-std::ostream& operator<<( std::ostream& str, const Grid< Dimension, Real, Device, Index >& grid )
+std::ostream&
+operator<<( std::ostream& str, const Grid< Dimension, Real, Device, Index >& grid )
 {
-   str << "Grid dimensions:    " << grid.getDimensions()  << std::endl;
-   str << "     origin:        " << grid.getOrigin()      << std::endl;
+   str << "Grid dimensions:    " << grid.getDimensions() << std::endl;
+   str << "     origin:        " << grid.getOrigin() << std::endl;
    str << "     proportions:   " << grid.getProportions() << std::endl;
    str << "     localBegin:    " << grid.getLocalBegin() << std::endl;
    str << "     localEnd:      " << grid.getLocalEnd() << std::endl;
@@ -46,8 +43,8 @@ std::ostream& operator<<( std::ostream& str, const Grid< Dimension, Real, Device
    return str;
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/GridDetails/Grid1D.h>
 #include <TNL/Meshes/GridDetails/Grid2D.h>
diff --git a/src/TNL/Meshes/GridDetails/BoundaryGridEntityChecker.h b/src/TNL/Meshes/GridDetails/BoundaryGridEntityChecker.h
index 4f4cb9449148a4bdbd19bb3105909c8e50242619..6a4d798b23cf985e5249d9fde1ed3fa6d707b8bb 100644
--- a/src/TNL/Meshes/GridDetails/BoundaryGridEntityChecker.h
+++ b/src/TNL/Meshes/GridDetails/BoundaryGridEntityChecker.h
@@ -11,215 +11,184 @@ namespace Meshes {
 
 template< typename GridEntity >
 class BoundaryGridEntityChecker
-{
-};
+{};
 
 /***
  * 1D grids
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
+template< typename Real, typename Device, typename Index, typename Config >
 class BoundaryGridEntityChecker< GridEntity< Meshes::Grid< 1, Real, Device, Index >, 1, Config > >
 {
-   public:
-
-      typedef Meshes::Grid< 1, Real, Device, Index > GridType;
-      typedef GridEntity< GridType, 1, Config > GridEntityType;
-
-      __cuda_callable__ inline
-      static bool isBoundaryEntity( const GridEntityType& entity )
-      {
-         return( entity.getCoordinates().x() == 0 ||
-                 entity.getCoordinates().x() == entity.getMesh().getDimensions().x() - 1 );
-      }
+public:
+   using GridType = Meshes::Grid< 1, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, 1, Config >;
+
+   __cuda_callable__
+   inline static bool
+   isBoundaryEntity( const GridEntityType& entity )
+   {
+      return ( entity.getCoordinates().x() == 0 || entity.getCoordinates().x() == entity.getMesh().getDimensions().x() - 1 );
+   }
 };
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
+template< typename Real, typename Device, typename Index, typename Config >
 class BoundaryGridEntityChecker< GridEntity< Meshes::Grid< 1, Real, Device, Index >, 0, Config > >
 {
-   public:
-
-      typedef Meshes::Grid< 1, Real, Device, Index > GridType;
-      typedef GridEntity< GridType, 0, Config > GridEntityType;
-
-      __cuda_callable__ inline
-      static bool isBoundaryEntity( const GridEntityType& entity )
-      {
-         return( entity.getCoordinates().x() == 0 ||
-                 entity.getCoordinates().x() == entity.getMesh().getDimensions().x() );
-      }
+public:
+   using GridType = Meshes::Grid< 1, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, 0, Config >;
+
+   __cuda_callable__
+   inline static bool
+   isBoundaryEntity( const GridEntityType& entity )
+   {
+      return ( entity.getCoordinates().x() == 0 || entity.getCoordinates().x() == entity.getMesh().getDimensions().x() );
+   }
 };
 
 /****
  * 2D grids
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
+template< typename Real, typename Device, typename Index, typename Config >
 class BoundaryGridEntityChecker< GridEntity< Meshes::Grid< 2, Real, Device, Index >, 2, Config > >
 {
-   public:
-
-      typedef Meshes::Grid< 2, Real, Device, Index > GridType;
-      typedef GridEntity< GridType, 2, Config > GridEntityType;
-
-      __cuda_callable__ inline
-      static bool isBoundaryEntity( const GridEntityType& entity )
-      {
-         return( entity.getCoordinates().x() == 0 ||
-                 entity.getCoordinates().y() == 0 ||
-                 entity.getCoordinates().x() == entity.getMesh().getDimensions().x() - 1 ||
-                 entity.getCoordinates().y() == entity.getMesh().getDimensions().y() - 1 );
-      }
+public:
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, 2, Config >;
+
+   __cuda_callable__
+   inline static bool
+   isBoundaryEntity( const GridEntityType& entity )
+   {
+      return ( entity.getCoordinates().x() == 0 || entity.getCoordinates().y() == 0
+               || entity.getCoordinates().x() == entity.getMesh().getDimensions().x() - 1
+               || entity.getCoordinates().y() == entity.getMesh().getDimensions().y() - 1 );
+   }
 };
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
+template< typename Real, typename Device, typename Index, typename Config >
 class BoundaryGridEntityChecker< GridEntity< Meshes::Grid< 2, Real, Device, Index >, 1, Config > >
 {
-   public:
-
-      typedef Meshes::Grid< 2, Real, Device, Index > GridType;
-      typedef GridEntity< GridType, 1, Config > GridEntityType;
-
-      __cuda_callable__ inline
-      static bool isBoundaryEntity( const GridEntityType& entity )
-      {
-         return( ( entity.getOrientation().x() && ( entity.getCoordinates().x() == 0 || entity.getCoordinates().x() == entity.getMesh().getDimensions().x() ) ) ||
-                 ( entity.getOrientation().y() && ( entity.getCoordinates().y() == 0 || entity.getCoordinates().y() == entity.getMesh().getDimensions().y() ) ) );
-      }
+public:
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, 1, Config >;
+
+   __cuda_callable__
+   inline static bool
+   isBoundaryEntity( const GridEntityType& entity )
+   {
+      return (
+         ( entity.getOrientation().x()
+           && ( entity.getCoordinates().x() == 0 || entity.getCoordinates().x() == entity.getMesh().getDimensions().x() ) )
+         || ( entity.getOrientation().y()
+              && ( entity.getCoordinates().y() == 0
+                   || entity.getCoordinates().y() == entity.getMesh().getDimensions().y() ) ) );
+   }
 };
 
-
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
+template< typename Real, typename Device, typename Index, typename Config >
 class BoundaryGridEntityChecker< GridEntity< Meshes::Grid< 2, Real, Device, Index >, 0, Config > >
 {
-   public:
-
-      typedef Meshes::Grid< 2, Real, Device, Index > GridType;
-      typedef GridEntity< GridType, 0, Config > GridEntityType;
-
-      __cuda_callable__ inline
-      static bool isBoundaryEntity( const GridEntityType& entity )
-      {
-         return( entity.getCoordinates().x() == 0 ||
-                 entity.getCoordinates().y() == 0 ||
-                 entity.getCoordinates().x() == entity.getMesh().getDimensions().x() ||
-                 entity.getCoordinates().y() == entity.getMesh().getDimensions().y() );
-
-      }
+public:
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, 0, Config >;
+
+   __cuda_callable__
+   inline static bool
+   isBoundaryEntity( const GridEntityType& entity )
+   {
+      return ( entity.getCoordinates().x() == 0 || entity.getCoordinates().y() == 0
+               || entity.getCoordinates().x() == entity.getMesh().getDimensions().x()
+               || entity.getCoordinates().y() == entity.getMesh().getDimensions().y() );
+   }
 };
 
-
 /***
  * 3D grid
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
+template< typename Real, typename Device, typename Index, typename Config >
 class BoundaryGridEntityChecker< GridEntity< Meshes::Grid< 3, Real, Device, Index >, 3, Config > >
 {
-   public:
-
-      typedef Meshes::Grid< 3, Real, Device, Index > GridType;
-      typedef GridEntity< GridType, 3, Config > GridEntityType;
-
-      __cuda_callable__ inline
-      static bool isBoundaryEntity( const GridEntityType& entity )
-      {
-         return( entity.getCoordinates().x() == 0 ||
-                 entity.getCoordinates().y() == 0 ||
-                 entity.getCoordinates().z() == 0 ||
-                 entity.getCoordinates().x() == entity.getMesh().getDimensions().x() - 1 ||
-                 entity.getCoordinates().y() == entity.getMesh().getDimensions().y() - 1 ||
-                 entity.getCoordinates().z() == entity.getMesh().getDimensions().z() - 1 );
-      }
+public:
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, 3, Config >;
+
+   __cuda_callable__
+   inline static bool
+   isBoundaryEntity( const GridEntityType& entity )
+   {
+      return ( entity.getCoordinates().x() == 0 || entity.getCoordinates().y() == 0 || entity.getCoordinates().z() == 0
+               || entity.getCoordinates().x() == entity.getMesh().getDimensions().x() - 1
+               || entity.getCoordinates().y() == entity.getMesh().getDimensions().y() - 1
+               || entity.getCoordinates().z() == entity.getMesh().getDimensions().z() - 1 );
+   }
 };
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
+template< typename Real, typename Device, typename Index, typename Config >
 class BoundaryGridEntityChecker< GridEntity< Meshes::Grid< 3, Real, Device, Index >, 2, Config > >
 {
-   public:
-
-      typedef Meshes::Grid< 3, Real, Device, Index > GridType;
-      typedef GridEntity< GridType, 2, Config > GridEntityType;
-
-      __cuda_callable__ inline
-      static bool isBoundaryEntity( const GridEntityType& entity )
-      {
-         return( ( entity.getOrientation().x() && ( entity.getCoordinates().x() == 0 || entity.getCoordinates().x() == entity.getMesh().getDimensions().x() ) ) ||
-                 ( entity.getOrientation().y() && ( entity.getCoordinates().y() == 0 || entity.getCoordinates().y() == entity.getMesh().getDimensions().y() ) ) ||
-                 ( entity.getOrientation().z() && ( entity.getCoordinates().z() == 0 || entity.getCoordinates().z() == entity.getMesh().getDimensions().z() ) ) );
-      }
+public:
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, 2, Config >;
+
+   __cuda_callable__
+   inline static bool
+   isBoundaryEntity( const GridEntityType& entity )
+   {
+      return (
+         ( entity.getOrientation().x()
+           && ( entity.getCoordinates().x() == 0 || entity.getCoordinates().x() == entity.getMesh().getDimensions().x() ) )
+         || ( entity.getOrientation().y()
+              && ( entity.getCoordinates().y() == 0 || entity.getCoordinates().y() == entity.getMesh().getDimensions().y() ) )
+         || ( entity.getOrientation().z()
+              && ( entity.getCoordinates().z() == 0
+                   || entity.getCoordinates().z() == entity.getMesh().getDimensions().z() ) ) );
+   }
 };
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
+template< typename Real, typename Device, typename Index, typename Config >
 class BoundaryGridEntityChecker< GridEntity< Meshes::Grid< 3, Real, Device, Index >, 1, Config > >
 {
-   public:
-
-      typedef Meshes::Grid< 3, Real, Device, Index > GridType;
-      typedef GridEntity< GridType, 1, Config > GridEntityType;
-
-      __cuda_callable__ inline
-      static bool isBoundaryEntity( const GridEntityType& entity )
-      {
-         return( ( entity.getOrientation().x() && (
-                     entity.getCoordinates().y() == 0 || entity.getCoordinates().y() == entity.getMesh().getDimensions().y() ||
-                     entity.getCoordinates().z() == 0 || entity.getCoordinates().z() == entity.getMesh().getDimensions().z()
-                     ) ) ||
-                 ( entity.getOrientation().y() && (
-                     entity.getCoordinates().x() == 0 || entity.getCoordinates().x() == entity.getMesh().getDimensions().x() ||
-                     entity.getCoordinates().z() == 0 || entity.getCoordinates().z() == entity.getMesh().getDimensions().z()
-                     ) ) ||
-                 ( entity.getOrientation().z() && (
-                     entity.getCoordinates().x() == 0 || entity.getCoordinates().x() == entity.getMesh().getDimensions().x() ||
-                     entity.getCoordinates().y() == 0 || entity.getCoordinates().y() == entity.getMesh().getDimensions().y()
-                      ) ) );
-      }
+public:
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, 1, Config >;
+
+   __cuda_callable__
+   inline static bool
+   isBoundaryEntity( const GridEntityType& entity )
+   {
+      return (
+         ( entity.getOrientation().x()
+           && ( entity.getCoordinates().y() == 0 || entity.getCoordinates().y() == entity.getMesh().getDimensions().y()
+                || entity.getCoordinates().z() == 0 || entity.getCoordinates().z() == entity.getMesh().getDimensions().z() ) )
+         || ( entity.getOrientation().y()
+              && ( entity.getCoordinates().x() == 0 || entity.getCoordinates().x() == entity.getMesh().getDimensions().x()
+                   || entity.getCoordinates().z() == 0
+                   || entity.getCoordinates().z() == entity.getMesh().getDimensions().z() ) )
+         || ( entity.getOrientation().z()
+              && ( entity.getCoordinates().x() == 0 || entity.getCoordinates().x() == entity.getMesh().getDimensions().x()
+                   || entity.getCoordinates().y() == 0
+                   || entity.getCoordinates().y() == entity.getMesh().getDimensions().y() ) ) );
+   }
 };
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
+template< typename Real, typename Device, typename Index, typename Config >
 class BoundaryGridEntityChecker< GridEntity< Meshes::Grid< 3, Real, Device, Index >, 0, Config > >
 {
-   public:
-
-      typedef Meshes::Grid< 3, Real, Device, Index > GridType;
-      typedef GridEntity< GridType, 0, Config > GridEntityType;
-
-      __cuda_callable__ inline
-      static bool isBoundaryEntity( const GridEntityType& entity )
-      {
-         return( entity.getCoordinates().x() == 0 ||
-                 entity.getCoordinates().y() == 0 ||
-                 entity.getCoordinates().z() == 0 ||
-                 entity.getCoordinates().x() == entity.getMesh().getDimensions().x() ||
-                 entity.getCoordinates().y() == entity.getMesh().getDimensions().y() ||
-                 entity.getCoordinates().z() == entity.getMesh().getDimensions().z() );
-      }
+public:
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, 0, Config >;
+
+   __cuda_callable__
+   inline static bool
+   isBoundaryEntity( const GridEntityType& entity )
+   {
+      return ( entity.getCoordinates().x() == 0 || entity.getCoordinates().y() == 0 || entity.getCoordinates().z() == 0
+               || entity.getCoordinates().x() == entity.getMesh().getDimensions().x()
+               || entity.getCoordinates().y() == entity.getMesh().getDimensions().y()
+               || entity.getCoordinates().z() == entity.getMesh().getDimensions().z() );
+   }
 };
 
-} // namespace Meshes
-} // namespace TNL
-
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/GridDetails/GnuplotWriter.h b/src/TNL/Meshes/GridDetails/GnuplotWriter.h
index 5b53d8b5a84b0beec9da90c3843faffc20968172..17c8cf821e78c25a2bfea6aea7c43237e50b8ad2 100644
--- a/src/TNL/Meshes/GridDetails/GnuplotWriter.h
+++ b/src/TNL/Meshes/GridDetails/GnuplotWriter.h
@@ -14,37 +14,35 @@ namespace Meshes {
 
 class GnuplotWriter
 {
-   public:
-
-      template< typename Element >
-      static void write( std::ostream& str,
-                         const Element& d )
-      {
-         str << d;
-      }
-
-      template< typename Real >
-      static void write( std::ostream& str,
-                         const Containers::StaticVector< 1, Real >& d )
-      {
-         str << d.x() << " ";
-      }
-
-      template< typename Real >
-      static void write( std::ostream& str,
-                         const Containers::StaticVector< 2, Real >& d )
-      {
-         str << d.x() << " " << d.y() << " ";
-      }
-
-      template< typename Real >
-      static void write( std::ostream& str,
-                         const Containers::StaticVector< 3, Real >& d )
-      {
-         str << d.x() << " " << d.y() << " " << d. z() << " ";
-      }
-
+public:
+   template< typename Element >
+   static void
+   write( std::ostream& str, const Element& d )
+   {
+      str << d;
+   }
+
+   template< typename Real >
+   static void
+   write( std::ostream& str, const Containers::StaticVector< 1, Real >& d )
+   {
+      str << d.x() << " ";
+   }
+
+   template< typename Real >
+   static void
+   write( std::ostream& str, const Containers::StaticVector< 2, Real >& d )
+   {
+      str << d.x() << " " << d.y() << " ";
+   }
+
+   template< typename Real >
+   static void
+   write( std::ostream& str, const Containers::StaticVector< 3, Real >& d )
+   {
+      str << d.x() << " " << d.y() << " " << d.z() << " ";
+   }
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/GridDetails/Grid1D.h b/src/TNL/Meshes/GridDetails/Grid1D.h
index a18d4560ad7d81da685914f8a390aa578c493367..cf3bc8337f36ee23b1d56b7a136e3cd9ecf54131 100644
--- a/src/TNL/Meshes/GridDetails/Grid1D.h
+++ b/src/TNL/Meshes/GridDetails/Grid1D.h
@@ -17,9 +17,7 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 class Grid< 1, Real, Device, Index >
 {
 public:
@@ -30,92 +28,109 @@ public:
    using CoordinatesType = Containers::StaticVector< 1, Index >;
 
    // TODO: deprecated and to be removed (GlobalIndexType shall be used instead)
-   typedef Index IndexType;
+   using IndexType = Index;
 
    /**
     * \brief Returns number of this mesh grid dimensions.
     */
-   static constexpr int getMeshDimension() { return 1; };
+   static constexpr int
+   getMeshDimension()
+   {
+      return 1;
+   };
 
-   template< int EntityDimension,
-             typename Config = GridEntityCrossStencilStorage< 1 > >
+   template< int EntityDimension, typename Config = GridEntityCrossStencilStorage< 1 > >
    using EntityType = GridEntity< Grid, EntityDimension, Config >;
 
-   typedef EntityType< getMeshDimension(), GridEntityCrossStencilStorage< 1 > > Cell;
-   typedef EntityType< 0 > Face;
-   typedef EntityType< 0 > Vertex;
+   using Cell = EntityType< getMeshDimension(), GridEntityCrossStencilStorage< 1 > >;
+   using Face = EntityType< 0 >;
+   using Vertex = EntityType< 0 >;
 
    /**
     * \brief Basic constructor.
     */
-   Grid();
+   Grid() = default;
 
-   Grid( const Index xSize );
+   Grid( Index xSize );
 
    // empty destructor is needed only to avoid crappy nvcc warnings
-   ~Grid() {}
+   ~Grid() = default;
 
    /**
     * \brief Sets the size of dimensions.
     * \param xSize Size of dimesion x.
     */
-   void setDimensions( const Index xSize );
+   void
+   setDimensions( Index xSize );
 
    /**
     * \brief Sets the number of dimensions.
     * \param dimensions Number of dimensions.
     */
-   void setDimensions( const CoordinatesType& dimensions );
+   void
+   setDimensions( const CoordinatesType& dimensions );
 
    __cuda_callable__
-   const CoordinatesType& getDimensions() const;
+   const CoordinatesType&
+   getDimensions() const;
 
-   void setLocalBegin( const CoordinatesType& begin );
+   void
+   setLocalBegin( const CoordinatesType& begin );
 
    __cuda_callable__
-   const CoordinatesType& getLocalBegin() const;
+   const CoordinatesType&
+   getLocalBegin() const;
 
-   void setLocalEnd( const CoordinatesType& end );
+   void
+   setLocalEnd( const CoordinatesType& end );
 
    __cuda_callable__
-   const CoordinatesType& getLocalEnd() const;
+   const CoordinatesType&
+   getLocalEnd() const;
 
-   void setInteriorBegin( const CoordinatesType& begin );
+   void
+   setInteriorBegin( const CoordinatesType& begin );
 
    __cuda_callable__
-   const CoordinatesType& getInteriorBegin() const;
+   const CoordinatesType&
+   getInteriorBegin() const;
 
-   void setInteriorEnd( const CoordinatesType& end );
+   void
+   setInteriorEnd( const CoordinatesType& end );
 
    __cuda_callable__
-   const CoordinatesType& getInteriorEnd() const;
+   const CoordinatesType&
+   getInteriorEnd() const;
 
    /**
     * \brief Sets the origin.
     * \param origin Starting point of this grid.
     */
-   void setOrigin( const PointType& origin);
+   void
+   setOrigin( const PointType& origin );
 
    /**
     * \brief Sets the origin and proportions of this grid.
     * \param origin Point where this grid starts.
     * \param proportions Total length of this grid.
     */
-   void setDomain( const PointType& origin,
-                   const PointType& proportions );
+   void
+   setDomain( const PointType& origin, const PointType& proportions );
 
    /**
     * \brief Returns the origin.
     * \param origin Starting point of this grid.
     */
    __cuda_callable__
-   inline const PointType& getOrigin() const;
+   inline const PointType&
+   getOrigin() const;
 
    /**
     * \brief Gets length of one entity of this grid.
     */
    __cuda_callable__
-   inline const PointType& getProportions() const;
+   inline const PointType&
+   getProportions() const;
 
    /**
     * \brief Gets number of entities in this grid.
@@ -123,7 +138,8 @@ public:
     */
    template< int EntityDimension >
    __cuda_callable__
-   IndexType getEntitiesCount() const;
+   IndexType
+   getEntitiesCount() const;
 
    /**
     * \brief Gets number of entities in this grid.
@@ -131,7 +147,8 @@ public:
     */
    template< typename Entity >
    __cuda_callable__
-   IndexType getEntitiesCount() const;
+   IndexType
+   getEntitiesCount() const;
 
    /**
     * \brief Gets entity type using entity index.
@@ -140,28 +157,32 @@ public:
     */
    template< typename Entity >
    __cuda_callable__
-   inline Entity getEntity( const IndexType& entityIndex ) const;
+   inline Entity
+   getEntity( const IndexType& entityIndex ) const;
 
-    /**
+   /**
     * \brief Gets entity index using entity type.
     * \param entity Type of entity.
     * \tparam Entity Type of the entity.
     */
    template< typename Entity >
    __cuda_callable__
-   inline Index getEntityIndex( const Entity& entity ) const;
+   inline Index
+   getEntityIndex( const Entity& entity ) const;
 
    /**
     * \brief Returns the length of one step.
     */
    __cuda_callable__
-   inline const PointType& getSpaceSteps() const;
+   inline const PointType&
+   getSpaceSteps() const;
 
    /**
     * \brief Sets the length of steps.
     * \param steps Length of one step.
     */
-   inline void setSpaceSteps(const PointType& steps);
+   inline void
+   setSpaceSteps( const PointType& steps );
 
    /**
     * \brief Returns product of space steps to the xPow.
@@ -169,42 +190,53 @@ public:
     */
    template< int xPow >
    __cuda_callable__
-   const RealType& getSpaceStepsProducts() const;
+   const RealType&
+   getSpaceStepsProducts() const;
 
    /**
     * \breif Returns the measure (length) of a cell in this grid.
     */
    __cuda_callable__
-   inline const RealType& getCellMeasure() const;
+   inline const RealType&
+   getCellMeasure() const;
 
    /**
     * \brief Returns the smallest length of step out of all coordinates (axes).
     */
    __cuda_callable__
-   inline RealType getSmallestSpaceStep() const;
+   inline RealType
+   getSmallestSpaceStep() const;
 
-   void writeProlog( Logger& logger ) const;
+   void
+   writeProlog( Logger& logger ) const;
 
 protected:
+   void
+   computeProportions();
 
-   void computeProportions();
-
-   void computeSpaceStepPowers();
-
-   void computeSpaceSteps();
+   void
+   computeSpaceStepPowers();
 
-   CoordinatesType dimensions, localBegin, localEnd, interiorBegin, interiorEnd;
+   void
+   computeSpaceSteps();
 
-   IndexType numberOfCells, numberOfVertices;
+   CoordinatesType dimensions = { 0 };
+   CoordinatesType localBegin = { 0 };
+   CoordinatesType localEnd = { 0 };
+   CoordinatesType interiorBegin = { 0 };
+   CoordinatesType interiorEnd = { 0 };
 
-   PointType origin, proportions;
+   IndexType numberOfCells = 0;
+   IndexType numberOfVertices = 0;
 
-   PointType spaceSteps;
+   PointType origin = { 0 };
+   PointType proportions = { 0 };
+   PointType spaceSteps = { 0 };
 
    RealType spaceStepsProducts[ 5 ];
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/GridDetails/Grid1D_impl.h>
diff --git a/src/TNL/Meshes/GridDetails/Grid1D_impl.h b/src/TNL/Meshes/GridDetails/Grid1D_impl.h
index 2c338eba4d73e72d157be89a9a3c3724c318506f..7deb52e22b8ce8e5c350b747b2bead7ddb19c161 100644
--- a/src/TNL/Meshes/GridDetails/Grid1D_impl.h
+++ b/src/TNL/Meshes/GridDetails/Grid1D_impl.h
@@ -17,72 +17,51 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename Real,
-          typename Device,
-          typename Index >
-Grid< 1, Real, Device, Index >::Grid()
-: numberOfCells( 0 ),
-  numberOfVertices( 0 )
-{
-}
-
-template< typename Real,
-          typename Device,
-          typename Index >
-Grid< 1, Real, Device, Index >::Grid( const Index xSize )
-: numberOfCells( 0 ),
-  numberOfVertices( 0 )
+template< typename Real, typename Device, typename Index >
+Grid< 1, Real, Device, Index >::Grid( Index xSize )
 {
    this->setDimensions( xSize );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-void Grid< 1, Real, Device, Index >::computeSpaceSteps()
+template< typename Real, typename Device, typename Index >
+void
+Grid< 1, Real, Device, Index >::computeSpaceSteps()
 {
-   if( this->getDimensions().x() != 0 )
-   {
-      this->spaceSteps.x() = this->proportions.x() / ( Real )  this->getDimensions().x();
+   if( this->getDimensions().x() != 0 ) {
+      this->spaceSteps.x() = this->proportions.x() / (Real) this->getDimensions().x();
       this->computeSpaceStepPowers();
    }
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-void Grid< 1, Real, Device, Index > ::computeSpaceStepPowers()
+template< typename Real, typename Device, typename Index >
+void
+Grid< 1, Real, Device, Index >::computeSpaceStepPowers()
 {
-      const RealType& hx = this->spaceSteps.x();
-      this->spaceStepsProducts[ 0 ] = 1.0 / ( hx * hx );
-      this->spaceStepsProducts[ 1 ] = 1.0 / hx;
-      this->spaceStepsProducts[ 2 ] = 1.0;
-      this->spaceStepsProducts[ 3 ] = hx;
-      this->spaceStepsProducts[ 4 ] = hx * hx;
-
+   const RealType& hx = this->spaceSteps.x();
+   this->spaceStepsProducts[ 0 ] = 1.0 / ( hx * hx );
+   this->spaceStepsProducts[ 1 ] = 1.0 / hx;
+   this->spaceStepsProducts[ 2 ] = 1.0;
+   this->spaceStepsProducts[ 3 ] = hx;
+   this->spaceStepsProducts[ 4 ] = hx * hx;
 }
 
-
-template< typename Real,
-          typename Device,
-          typename Index >
-void Grid< 1, Real, Device, Index > ::computeProportions()
+template< typename Real, typename Device, typename Index >
+void
+Grid< 1, Real, Device, Index >::computeProportions()
 {
-    this->proportions.x()=this->dimensions.x()*this->spaceSteps.x();
+   this->proportions.x() = this->dimensions.x() * this->spaceSteps.x();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-void Grid< 1, Real, Device, Index > :: setOrigin( const PointType& origin)
+template< typename Real, typename Device, typename Index >
+void
+Grid< 1, Real, Device, Index >::setOrigin( const PointType& origin )
 {
    this->origin = origin;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
-void Grid< 1, Real, Device, Index >::setDimensions( const Index xSize )
+template< typename Real, typename Device, typename Index >
+void
+Grid< 1, Real, Device, Index >::setDimensions( Index xSize )
 {
    TNL_ASSERT_GE( xSize, 0, "Grid size must be non-negative." );
    this->dimensions.x() = xSize;
@@ -97,143 +76,115 @@ void Grid< 1, Real, Device, Index >::setDimensions( const Index xSize )
    interiorEnd = dimensions - 1;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
-void Grid< 1, Real, Device, Index >::setDimensions( const CoordinatesType& dimensions )
+template< typename Real, typename Device, typename Index >
+void
+Grid< 1, Real, Device, Index >::setDimensions( const CoordinatesType& dimensions )
 {
-   this->setDimensions( dimensions. x() );
+   this->setDimensions( dimensions.x() );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
-__cuda_callable__ inline
-const typename Grid< 1, Real, Device, Index >::CoordinatesType&
-   Grid< 1, Real, Device, Index >::getDimensions() const
+template< typename Real, typename Device, typename Index >
+__cuda_callable__
+inline const typename Grid< 1, Real, Device, Index >::CoordinatesType&
+Grid< 1, Real, Device, Index >::getDimensions() const
 {
    return this->dimensions;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
-void Grid< 1, Real, Device, Index >::setLocalBegin( const CoordinatesType& begin )
+template< typename Real, typename Device, typename Index >
+void
+Grid< 1, Real, Device, Index >::setLocalBegin( const CoordinatesType& begin )
 {
    localBegin = begin;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
 const typename Grid< 1, Real, Device, Index >::CoordinatesType&
-   Grid< 1, Real, Device, Index >::getLocalBegin() const
+Grid< 1, Real, Device, Index >::getLocalBegin() const
 {
    return localBegin;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
-void Grid< 1, Real, Device, Index >::setLocalEnd( const CoordinatesType& end )
+template< typename Real, typename Device, typename Index >
+void
+Grid< 1, Real, Device, Index >::setLocalEnd( const CoordinatesType& end )
 {
    localEnd = end;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
 const typename Grid< 1, Real, Device, Index >::CoordinatesType&
-   Grid< 1, Real, Device, Index >::
-   getLocalEnd() const
+Grid< 1, Real, Device, Index >::getLocalEnd() const
 {
    return localEnd;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
-void Grid< 1, Real, Device, Index >::setInteriorBegin( const CoordinatesType& begin )
+template< typename Real, typename Device, typename Index >
+void
+Grid< 1, Real, Device, Index >::setInteriorBegin( const CoordinatesType& begin )
 {
    interiorBegin = begin;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
 const typename Grid< 1, Real, Device, Index >::CoordinatesType&
-   Grid< 1, Real, Device, Index >::getInteriorBegin() const
+Grid< 1, Real, Device, Index >::getInteriorBegin() const
 {
    return interiorBegin;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
-void Grid< 1, Real, Device, Index >::setInteriorEnd( const CoordinatesType& end )
+template< typename Real, typename Device, typename Index >
+void
+Grid< 1, Real, Device, Index >::setInteriorEnd( const CoordinatesType& end )
 {
    interiorEnd = end;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
 const typename Grid< 1, Real, Device, Index >::CoordinatesType&
-   Grid< 1, Real, Device, Index >::getInteriorEnd() const
+Grid< 1, Real, Device, Index >::getInteriorEnd() const
 {
    return interiorEnd;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-void Grid< 1, Real, Device, Index >::setDomain( const PointType& origin,
-                                                const PointType& proportions )
+template< typename Real, typename Device, typename Index >
+void
+Grid< 1, Real, Device, Index >::setDomain( const PointType& origin, const PointType& proportions )
 {
    this->origin = origin;
    this->proportions = proportions;
    computeSpaceSteps();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
-__cuda_callable__ inline
-const typename Grid< 1, Real, Device, Index >::PointType&
-  Grid< 1, Real, Device, Index >::getOrigin() const
+template< typename Real, typename Device, typename Index >
+__cuda_callable__
+inline const typename Grid< 1, Real, Device, Index >::PointType&
+Grid< 1, Real, Device, Index >::getOrigin() const
 {
    return this->origin;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-__cuda_callable__ inline
-const typename Grid< 1, Real, Device, Index >::PointType&
-   Grid< 1, Real, Device, Index >::getProportions() const
+template< typename Real, typename Device, typename Index >
+__cuda_callable__
+inline const typename Grid< 1, Real, Device, Index >::PointType&
+Grid< 1, Real, Device, Index >::getProportions() const
 {
    return this->proportions;
 }
 
-
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< int EntityDimension >
-__cuda_callable__  inline
-Index
-Grid< 1, Real, Device, Index >::
-getEntitiesCount() const
+template< typename Real, typename Device, typename Index >
+template< int EntityDimension >
+__cuda_callable__
+inline Index
+Grid< 1, Real, Device, Index >::getEntitiesCount() const
 {
-   static_assert( EntityDimension <= 1 &&
-                  EntityDimension >= 0, "Wrong grid entity dimensions." );
+   static_assert( EntityDimension <= 1 && EntityDimension >= 0, "Wrong grid entity dimensions." );
 
-   switch( EntityDimension )
-   {
+   switch( EntityDimension ) {
       case 1:
          return this->numberOfCells;
       case 0:
@@ -242,111 +193,83 @@ getEntitiesCount() const
    return -1;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename Entity >
-__cuda_callable__  inline
-Index
-Grid< 1, Real, Device, Index >::
-getEntitiesCount() const
+template< typename Real, typename Device, typename Index >
+template< typename Entity >
+__cuda_callable__
+inline Index
+Grid< 1, Real, Device, Index >::getEntitiesCount() const
 {
    return getEntitiesCount< Entity::getEntityDimension() >();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename Entity >
- __cuda_callable__ inline
-Entity
-Grid< 1, Real, Device, Index >::
-getEntity( const IndexType& entityIndex ) const
+template< typename Real, typename Device, typename Index >
+template< typename Entity >
+__cuda_callable__
+inline Entity
+Grid< 1, Real, Device, Index >::getEntity( const IndexType& entityIndex ) const
 {
-   static_assert( Entity::getEntityDimension() <= 1 &&
-                  Entity::getEntityDimension() >= 0, "Wrong grid entity dimensions." );
+   static_assert( Entity::getEntityDimension() <= 1 && Entity::getEntityDimension() >= 0, "Wrong grid entity dimensions." );
 
    return GridEntityGetter< Grid, Entity >::getEntity( *this, entityIndex );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename Entity >
-__cuda_callable__ inline
-Index
-Grid< 1, Real, Device, Index >::
-getEntityIndex( const Entity& entity ) const
+template< typename Real, typename Device, typename Index >
+template< typename Entity >
+__cuda_callable__
+inline Index
+Grid< 1, Real, Device, Index >::getEntityIndex( const Entity& entity ) const
 {
-   static_assert( Entity::getEntityDimension() <= 1 &&
-                  Entity::getEntityDimension() >= 0, "Wrong grid entity dimensions." );
+   static_assert( Entity::getEntityDimension() <= 1 && Entity::getEntityDimension() >= 0, "Wrong grid entity dimensions." );
 
    return GridEntityGetter< Grid, Entity >::getEntityIndex( *this, entity );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-__cuda_callable__ inline
-const typename Grid< 1, Real, Device, Index >::PointType&
-Grid< 1, Real, Device, Index >::
-getSpaceSteps() const
+template< typename Real, typename Device, typename Index >
+__cuda_callable__
+inline const typename Grid< 1, Real, Device, Index >::PointType&
+Grid< 1, Real, Device, Index >::getSpaceSteps() const
 {
    return this->spaceSteps;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 inline void
-Grid< 1, Real, Device, Index >::
-setSpaceSteps(const typename Grid< 1, Real, Device, Index >::PointType& steps)
+Grid< 1, Real, Device, Index >::setSpaceSteps( const typename Grid< 1, Real, Device, Index >::PointType& steps )
 {
-    this->spaceSteps=steps;
-    computeSpaceStepPowers();
-    computeProportions();
+   this->spaceSteps = steps;
+   computeSpaceStepPowers();
+   computeProportions();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< int xPow >
-__cuda_callable__ inline
-const Real&
-Grid< 1, Real, Device, Index >::
-getSpaceStepsProducts() const
+template< typename Real, typename Device, typename Index >
+template< int xPow >
+__cuda_callable__
+inline const Real&
+Grid< 1, Real, Device, Index >::getSpaceStepsProducts() const
 {
    static_assert( xPow >= -2 && xPow <= 2, "unsupported value of xPow" );
    return this->spaceStepsProducts[ xPow + 2 ];
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
 const Real&
-Grid< 1, Real, Device, Index >::
-getCellMeasure() const
+Grid< 1, Real, Device, Index >::getCellMeasure() const
 {
    return this->template getSpaceStepsProducts< 1 >();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-__cuda_callable__ inline
-Real Grid< 1, Real, Device, Index >::
-getSmallestSpaceStep() const
+template< typename Real, typename Device, typename Index >
+__cuda_callable__
+inline Real
+Grid< 1, Real, Device, Index >::getSmallestSpaceStep() const
 {
    return this->spaceSteps.x();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 void
-Grid< 1, Real, Device, Index >::
-writeProlog( Logger& logger ) const
+Grid< 1, Real, Device, Index >::writeProlog( Logger& logger ) const
 {
    logger.writeParameter( "Dimension:", getMeshDimension() );
    logger.writeParameter( "Domain origin:", this->origin );
@@ -357,5 +280,5 @@ writeProlog( Logger& logger ) const
    logger.writeParameter( "Number of vertices:", getEntitiesCount< Vertex >() );
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/GridDetails/Grid2D.h b/src/TNL/Meshes/GridDetails/Grid2D.h
index fc255ecdcd8fa922ecfed8f79b85086136293d58..17eb80837d582678e4f1f28c90cd2c7a68def34c 100644
--- a/src/TNL/Meshes/GridDetails/Grid2D.h
+++ b/src/TNL/Meshes/GridDetails/Grid2D.h
@@ -17,102 +17,116 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 class Grid< 2, Real, Device, Index >
 {
-   public:
-
-   typedef Real RealType;
-   typedef Device DeviceType;
-   typedef Index GlobalIndexType;
-   typedef Containers::StaticVector< 2, Real > PointType;
-   typedef Containers::StaticVector< 2, Index > CoordinatesType;
+public:
+   using RealType = Real;
+   using DeviceType = Device;
+   using GlobalIndexType = Index;
+   using PointType = Containers::StaticVector< 2, Real >;
+   using CoordinatesType = Containers::StaticVector< 2, Index >;
 
    // TODO: deprecated and to be removed (GlobalIndexType shall be used instead)
-   typedef Index IndexType;
+   using IndexType = Index;
 
-   static constexpr int getMeshDimension() { return 2; };
+   static constexpr int
+   getMeshDimension()
+   {
+      return 2;
+   };
 
-   template< int EntityDimension,
-             typename Config = GridEntityCrossStencilStorage< 1 > >
+   template< int EntityDimension, typename Config = GridEntityCrossStencilStorage< 1 > >
    using EntityType = GridEntity< Grid, EntityDimension, Config >;
 
-   typedef EntityType< getMeshDimension(), GridEntityCrossStencilStorage< 1 > > Cell;
-   typedef EntityType< getMeshDimension() - 1 > Face;
-   typedef EntityType< 0 > Vertex;
+   using Cell = EntityType< getMeshDimension(), GridEntityCrossStencilStorage< 1 > >;
+   using Face = EntityType< getMeshDimension() - 1 >;
+   using Vertex = EntityType< 0 >;
 
    /**
     * \brief See Grid1D::Grid().
     */
-   Grid();
+   Grid() = default;
 
-   Grid( const Index xSize, const Index ySize );
+   Grid( Index xSize, Index ySize );
 
    // empty destructor is needed only to avoid crappy nvcc warnings
-   ~Grid() {}
+   ~Grid() = default;
 
    /**
     * \brief Sets the size of dimensions.
     * \param xSize Size of dimension x.
     * \param ySize Size of dimension y.
     */
-   void setDimensions( const Index xSize, const Index ySize );
+   void
+   setDimensions( Index xSize, Index ySize );
 
    /**
     * \brief See Grid1D::setDimensions( const CoordinatesType& dimensions ).
     */
-   void setDimensions( const CoordinatesType& dimensions );
+   void
+   setDimensions( const CoordinatesType& dimensions );
 
    /**
     * \brief See Grid1D::getDimensions().
     */
    __cuda_callable__
-   const CoordinatesType& getDimensions() const;
+   const CoordinatesType&
+   getDimensions() const;
 
-   void setLocalBegin( const CoordinatesType& begin );
+   void
+   setLocalBegin( const CoordinatesType& begin );
 
    __cuda_callable__
-   const CoordinatesType& getLocalBegin() const;
+   const CoordinatesType&
+   getLocalBegin() const;
 
-   void setLocalEnd( const CoordinatesType& end );
+   void
+   setLocalEnd( const CoordinatesType& end );
 
    __cuda_callable__
-   const CoordinatesType& getLocalEnd() const;
+   const CoordinatesType&
+   getLocalEnd() const;
 
-   void setInteriorBegin( const CoordinatesType& begin );
+   void
+   setInteriorBegin( const CoordinatesType& begin );
 
    __cuda_callable__
-   const CoordinatesType& getInteriorBegin() const;
+   const CoordinatesType&
+   getInteriorBegin() const;
 
-   void setInteriorEnd( const CoordinatesType& end );
+   void
+   setInteriorEnd( const CoordinatesType& end );
 
    __cuda_callable__
-   const CoordinatesType& getInteriorEnd() const;
+   const CoordinatesType&
+   getInteriorEnd() const;
 
    /**
     * \brief See Grid1D::setDomain().
     */
-   void setDomain( const PointType& origin,
-                   const PointType& proportions );
+   void
+   setDomain( const PointType& origin, const PointType& proportions );
 
    /**
     * \brief See Grid1D::setOrigin()
     */
-   void setOrigin( const PointType& origin);
+   void
+   setOrigin( const PointType& origin );
 
    /**
     * \brief See Grid1D::getOrigin().
     */
    __cuda_callable__
-   inline const PointType& getOrigin() const;
+   inline const PointType&
+   getOrigin() const;
 
    /**
     * \brief See Grid1D::getProportions().
     */
    __cuda_callable__
-   inline const PointType& getProportions() const;
+   inline const PointType&
+   getProportions() const;
 
    /**
     * \brief Gets number of entities in this grid.
@@ -120,7 +134,8 @@ class Grid< 2, Real, Device, Index >
     */
    template< int EntityDimension >
    __cuda_callable__
-   IndexType getEntitiesCount() const;
+   IndexType
+   getEntitiesCount() const;
 
    /**
     * \brief Gets number of entities in this grid.
@@ -128,32 +143,37 @@ class Grid< 2, Real, Device, Index >
     */
    template< typename Entity >
    __cuda_callable__
-   inline IndexType getEntitiesCount() const;
+   inline IndexType
+   getEntitiesCount() const;
 
    /**
     * \brief See Grid1D::getEntity().
     */
    template< typename Entity >
    __cuda_callable__
-   inline Entity getEntity( const IndexType& entityIndex ) const;
+   inline Entity
+   getEntity( const IndexType& entityIndex ) const;
 
    /**
     * \brief See Grid1D::getEntityIndex().
     */
    template< typename Entity >
    __cuda_callable__
-   inline Index getEntityIndex( const Entity& entity ) const;
+   inline Index
+   getEntityIndex( const Entity& entity ) const;
 
    /**
     * \brief See Grid1D::getSpaceSteps().
     */
    __cuda_callable__
-   inline const PointType& getSpaceSteps() const;
+   inline const PointType&
+   getSpaceSteps() const;
 
    /**
     * \brief See Grid1D::setSpaceSteps().
     */
-   inline void setSpaceSteps(const PointType& steps);
+   inline void
+   setSpaceSteps( const PointType& steps );
 
    /**
     * \brief Returns product of space steps to the xPow.
@@ -162,45 +182,60 @@ class Grid< 2, Real, Device, Index >
     */
    template< int xPow, int yPow >
    __cuda_callable__
-   const RealType& getSpaceStepsProducts() const;
+   const RealType&
+   getSpaceStepsProducts() const;
 
    /**
     * \brief Returns the number of x-normal faces.
     */
    __cuda_callable__
-   IndexType getNumberOfNxFaces() const;
+   IndexType
+   getNumberOfNxFaces() const;
 
    /**
     * \breif Returns the measure (area) of a cell in this grid.
     */
    __cuda_callable__
-   inline const RealType& getCellMeasure() const;
+   inline const RealType&
+   getCellMeasure() const;
 
    /**
     * \brief See Grid1D::getSmallestSpaceStep().
     */
    __cuda_callable__
-   inline RealType getSmallestSpaceStep() const;
-
-   void writeProlog( Logger& logger ) const;
+   inline RealType
+   getSmallestSpaceStep() const;
 
-   protected:
+   void
+   writeProlog( Logger& logger ) const;
 
-   void computeProportions();
+protected:
+   void
+   computeProportions();
 
    __cuda_callable__
-   void computeSpaceStepPowers();
+   void
+   computeSpaceStepPowers();
 
    __cuda_callable__
-   void computeSpaceSteps();
-
-   CoordinatesType dimensions, localBegin, localEnd, interiorBegin, interiorEnd;
+   void
+   computeSpaceSteps();
 
-   IndexType numberOfCells, numberOfNxFaces, numberOfNyFaces, numberOfFaces, numberOfVertices;
+   CoordinatesType dimensions = { 0, 0 };
+   CoordinatesType localBegin = { 0, 0 };
+   CoordinatesType localEnd = { 0, 0 };
+   CoordinatesType interiorBegin = { 0, 0 };
+   CoordinatesType interiorEnd = { 0, 0 };
 
-   PointType origin, proportions;
+   IndexType numberOfCells = 0;
+   IndexType numberOfNxFaces = 0;
+   IndexType numberOfNyFaces = 0;
+   IndexType numberOfFaces = 0;
+   IndexType numberOfVertices = 0;
 
-   PointType spaceSteps;
+   PointType origin = { 0, 0 };
+   PointType proportions = { 0, 0 };
+   PointType spaceSteps = { 0, 0 };
 
    RealType spaceStepsProducts[ 5 ][ 5 ];
 
@@ -208,7 +243,7 @@ class Grid< 2, Real, Device, Index >
    friend class GridEntityGetter;
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/GridDetails/Grid2D_impl.h>
diff --git a/src/TNL/Meshes/GridDetails/Grid2D_impl.h b/src/TNL/Meshes/GridDetails/Grid2D_impl.h
index 6d55838b9bf7c71b5ff51e37a328a1d5a23750d7..91b45bec83dee72f2f519b63af3fb243930e28f6 100644
--- a/src/TNL/Meshes/GridDetails/Grid2D_impl.h
+++ b/src/TNL/Meshes/GridDetails/Grid2D_impl.h
@@ -17,113 +17,86 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename Real,
-          typename Device,
-          typename Index >
-Grid< 2, Real, Device, Index > :: Grid()
-: numberOfCells( 0 ),
-  numberOfNxFaces( 0 ),
-  numberOfNyFaces( 0 ),
-  numberOfFaces( 0 ),
-  numberOfVertices( 0 )
-{
-}
-
-template< typename Real,
-          typename Device,
-          typename Index >
-Grid< 2, Real, Device, Index >::Grid( const Index xSize, const Index ySize )
-: numberOfCells( 0 ),
-  numberOfNxFaces( 0 ),
-  numberOfNyFaces( 0 ),
-  numberOfFaces( 0 ),
-  numberOfVertices( 0 )
+template< typename Real, typename Device, typename Index >
+Grid< 2, Real, Device, Index >::Grid( Index xSize, Index ySize )
 {
    this->setDimensions( xSize, ySize );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
-void Grid< 2, Real, Device, Index > :: computeSpaceSteps()
+void
+Grid< 2, Real, Device, Index >::computeSpaceSteps()
 {
-   if( this->getDimensions().x() > 0 && this->getDimensions().y() > 0 )
-   {
-      this->spaceSteps.x() = this->proportions.x() / ( Real ) this->getDimensions().x();
-      this->spaceSteps.y() = this->proportions.y() / ( Real ) this->getDimensions().y();
+   if( this->getDimensions().x() > 0 && this->getDimensions().y() > 0 ) {
+      this->spaceSteps.x() = this->proportions.x() / (Real) this->getDimensions().x();
+      this->spaceSteps.y() = this->proportions.y() / (Real) this->getDimensions().y();
       this->computeSpaceStepPowers();
    }
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
-void Grid< 2, Real, Device, Index > ::computeSpaceStepPowers()
+void
+Grid< 2, Real, Device, Index >::computeSpaceStepPowers()
 {
-      const RealType& hx = this->spaceSteps.x();
-      const RealType& hy = this->spaceSteps.y();
-
-      Real auxX, auxY;
-      for( int i = 0; i < 5; i++ )
-      {
-         switch( i )
-         {
+   const RealType& hx = this->spaceSteps.x();
+   const RealType& hy = this->spaceSteps.y();
+
+   Real auxX;
+   Real auxY;
+   for( int i = 0; i < 5; i++ ) {
+      switch( i ) {
+         case 0:
+            auxX = 1.0 / ( hx * hx );
+            break;
+         case 1:
+            auxX = 1.0 / hx;
+            break;
+         case 2:
+            auxX = 1.0;
+            break;
+         case 3:
+            auxX = hx;
+            break;
+         case 4:
+            auxX = hx * hx;
+            break;
+      }
+      for( int j = 0; j < 5; j++ ) {
+         switch( j ) {
             case 0:
-               auxX = 1.0 / ( hx * hx );
+               auxY = 1.0 / ( hy * hy );
                break;
             case 1:
-               auxX = 1.0 / hx;
+               auxY = 1.0 / hy;
                break;
             case 2:
-               auxX = 1.0;
+               auxY = 1.0;
                break;
             case 3:
-               auxX = hx;
+               auxY = hy;
                break;
             case 4:
-               auxX = hx * hx;
+               auxY = hy * hy;
                break;
          }
-         for( int j = 0; j < 5; j++ )
-         {
-            switch( j )
-            {
-               case 0:
-                  auxY = 1.0 / ( hy * hy );
-                  break;
-               case 1:
-                  auxY = 1.0 / hy;
-                  break;
-               case 2:
-                  auxY = 1.0;
-                  break;
-               case 3:
-                  auxY = hy;
-                  break;
-               case 4:
-                  auxY = hy * hy;
-                  break;
-            }
-            this->spaceStepsProducts[ i ][ j ] = auxX * auxY;
-         }
+         this->spaceStepsProducts[ i ][ j ] = auxX * auxY;
       }
+   }
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-void Grid< 2, Real, Device, Index > ::computeProportions()
+template< typename Real, typename Device, typename Index >
+void
+Grid< 2, Real, Device, Index >::computeProportions()
 {
-    this->proportions.x()=this->dimensions.x()*this->spaceSteps.x();
-    this->proportions.y()=this->dimensions.y()*this->spaceSteps.y();
+   this->proportions.x() = this->dimensions.x() * this->spaceSteps.x();
+   this->proportions.y() = this->dimensions.y() * this->spaceSteps.y();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-void Grid< 2, Real, Device, Index > :: setDimensions( const Index xSize, const Index ySize )
+template< typename Real, typename Device, typename Index >
+void
+Grid< 2, Real, Device, Index >::setDimensions( Index xSize, Index ySize )
 {
    TNL_ASSERT_GE( xSize, 0, "Grid size must be non-negative." );
    TNL_ASSERT_GE( ySize, 0, "Grid size must be non-negative." );
@@ -144,151 +117,122 @@ void Grid< 2, Real, Device, Index > :: setDimensions( const Index xSize, const I
    interiorEnd = dimensions - 1;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-void Grid< 2, Real, Device, Index > :: setDimensions( const CoordinatesType& dimensions )
+template< typename Real, typename Device, typename Index >
+void
+Grid< 2, Real, Device, Index >::setDimensions( const CoordinatesType& dimensions )
 {
-   return this->setDimensions( dimensions. x(), dimensions. y() );
+   return this->setDimensions( dimensions.x(), dimensions.y() );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-__cuda_callable__ inline
-const typename Grid< 2, Real, Device, Index >::CoordinatesType&
-Grid< 2, Real, Device, Index > :: getDimensions() const
+template< typename Real, typename Device, typename Index >
+__cuda_callable__
+inline const typename Grid< 2, Real, Device, Index >::CoordinatesType&
+Grid< 2, Real, Device, Index >::getDimensions() const
 {
    return this->dimensions;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
-void Grid< 2, Real, Device, Index >::setLocalBegin( const CoordinatesType& begin )
+template< typename Real, typename Device, typename Index >
+void
+Grid< 2, Real, Device, Index >::setLocalBegin( const CoordinatesType& begin )
 {
    localBegin = begin;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
 const typename Grid< 2, Real, Device, Index >::CoordinatesType&
-   Grid< 2, Real, Device, Index >::getLocalBegin() const
+Grid< 2, Real, Device, Index >::getLocalBegin() const
 {
    return localBegin;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
-void Grid< 2, Real, Device, Index >::setLocalEnd( const CoordinatesType& end )
+template< typename Real, typename Device, typename Index >
+void
+Grid< 2, Real, Device, Index >::setLocalEnd( const CoordinatesType& end )
 {
    localEnd = end;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
 const typename Grid< 2, Real, Device, Index >::CoordinatesType&
-   Grid< 2, Real, Device, Index >::
-   getLocalEnd() const
+Grid< 2, Real, Device, Index >::getLocalEnd() const
 {
    return localEnd;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
-void Grid< 2, Real, Device, Index >::setInteriorBegin( const CoordinatesType& begin )
+template< typename Real, typename Device, typename Index >
+void
+Grid< 2, Real, Device, Index >::setInteriorBegin( const CoordinatesType& begin )
 {
    interiorBegin = begin;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
 const typename Grid< 2, Real, Device, Index >::CoordinatesType&
-   Grid< 2, Real, Device, Index >::getInteriorBegin() const
+Grid< 2, Real, Device, Index >::getInteriorBegin() const
 {
    return interiorBegin;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
-void Grid< 2, Real, Device, Index >::setInteriorEnd( const CoordinatesType& end )
+template< typename Real, typename Device, typename Index >
+void
+Grid< 2, Real, Device, Index >::setInteriorEnd( const CoordinatesType& end )
 {
    interiorEnd = end;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
 const typename Grid< 2, Real, Device, Index >::CoordinatesType&
-   Grid< 2, Real, Device, Index >::getInteriorEnd() const
+Grid< 2, Real, Device, Index >::getInteriorEnd() const
 {
    return interiorEnd;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-void Grid< 2, Real, Device, Index > :: setDomain( const PointType& origin,
-                                                     const PointType& proportions )
+template< typename Real, typename Device, typename Index >
+void
+Grid< 2, Real, Device, Index >::setDomain( const PointType& origin, const PointType& proportions )
 {
    this->origin = origin;
    this->proportions = proportions;
    computeSpaceSteps();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-void Grid< 2, Real, Device, Index > :: setOrigin( const PointType& origin)
+template< typename Real, typename Device, typename Index >
+void
+Grid< 2, Real, Device, Index >::setOrigin( const PointType& origin )
 {
    this->origin = origin;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-__cuda_callable__ inline
-const typename Grid< 2, Real, Device, Index >::PointType&
+template< typename Real, typename Device, typename Index >
+__cuda_callable__
+inline const typename Grid< 2, Real, Device, Index >::PointType&
 Grid< 2, Real, Device, Index >::getOrigin() const
 {
    return this->origin;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-__cuda_callable__ inline
-const typename Grid< 2, Real, Device, Index > :: PointType&
-   Grid< 2, Real, Device, Index > :: getProportions() const
+template< typename Real, typename Device, typename Index >
+__cuda_callable__
+inline const typename Grid< 2, Real, Device, Index >::PointType&
+Grid< 2, Real, Device, Index >::getProportions() const
 {
    return this->proportions;
 }
 
-
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< int EntityDimension >
-__cuda_callable__ inline
-Index
-Grid< 2, Real, Device, Index >::
-getEntitiesCount() const
+template< typename Real, typename Device, typename Index >
+template< int EntityDimension >
+__cuda_callable__
+inline Index
+Grid< 2, Real, Device, Index >::getEntitiesCount() const
 {
-   static_assert( EntityDimension <= 2 &&
-                  EntityDimension >= 0, "Wrong grid entity dimensions." );
+   static_assert( EntityDimension <= 2 && EntityDimension >= 0, "Wrong grid entity dimensions." );
 
-   switch( EntityDimension )
-   {
+   switch( EntityDimension ) {
       case 2:
          return this->numberOfCells;
       case 1:
@@ -299,122 +243,92 @@ getEntitiesCount() const
    return -1;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename Entity >
-__cuda_callable__ inline
-Index
-Grid< 2, Real, Device, Index >::
-getEntitiesCount() const
+template< typename Real, typename Device, typename Index >
+template< typename Entity >
+__cuda_callable__
+inline Index
+Grid< 2, Real, Device, Index >::getEntitiesCount() const
 {
    return getEntitiesCount< Entity::getEntityDimension() >();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename Entity >
-__cuda_callable__ inline
-Entity
-Grid< 2, Real, Device, Index >::
-getEntity( const IndexType& entityIndex ) const
+template< typename Real, typename Device, typename Index >
+template< typename Entity >
+__cuda_callable__
+inline Entity
+Grid< 2, Real, Device, Index >::getEntity( const IndexType& entityIndex ) const
 {
-   static_assert( Entity::getEntityDimension() <= 2 &&
-                  Entity::getEntityDimension() >= 0, "Wrong grid entity dimensions." );
+   static_assert( Entity::getEntityDimension() <= 2 && Entity::getEntityDimension() >= 0, "Wrong grid entity dimensions." );
 
    return GridEntityGetter< Grid, Entity >::getEntity( *this, entityIndex );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename Entity >
-__cuda_callable__ inline
-Index
-Grid< 2, Real, Device, Index >::
-getEntityIndex( const Entity& entity ) const
+template< typename Real, typename Device, typename Index >
+template< typename Entity >
+__cuda_callable__
+inline Index
+Grid< 2, Real, Device, Index >::getEntityIndex( const Entity& entity ) const
 {
-   static_assert( Entity::getEntityDimension() <= 2 &&
-                  Entity::getEntityDimension() >= 0, "Wrong grid entity dimensions." );
+   static_assert( Entity::getEntityDimension() <= 2 && Entity::getEntityDimension() >= 0, "Wrong grid entity dimensions." );
 
    return GridEntityGetter< Grid, Entity >::getEntityIndex( *this, entity );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-__cuda_callable__ inline
-const typename Grid< 2, Real, Device, Index >::PointType&
-Grid< 2, Real, Device, Index >::
-getSpaceSteps() const
+template< typename Real, typename Device, typename Index >
+__cuda_callable__
+inline const typename Grid< 2, Real, Device, Index >::PointType&
+Grid< 2, Real, Device, Index >::getSpaceSteps() const
 {
    return this->spaceSteps;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 inline void
-Grid< 2, Real, Device, Index >::
-setSpaceSteps(const typename Grid< 2, Real, Device, Index >::PointType& steps)
+Grid< 2, Real, Device, Index >::setSpaceSteps( const typename Grid< 2, Real, Device, Index >::PointType& steps )
 {
-    this->spaceSteps=steps;
-    computeSpaceStepPowers();
-    computeProportions();
+   this->spaceSteps = steps;
+   computeSpaceStepPowers();
+   computeProportions();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< int xPow, int yPow  >
-__cuda_callable__ inline
-const Real&
-Grid< 2, Real, Device, Index >::
-getSpaceStepsProducts() const
+template< typename Real, typename Device, typename Index >
+template< int xPow, int yPow >
+__cuda_callable__
+inline const Real&
+Grid< 2, Real, Device, Index >::getSpaceStepsProducts() const
 {
    static_assert( xPow >= -2 && xPow <= 2, "unsupported value of xPow" );
    static_assert( yPow >= -2 && yPow <= 2, "unsupported value of yPow" );
    return this->spaceStepsProducts[ xPow + 2 ][ yPow + 2 ];
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
 Index
-Grid< 2, Real, Device, Index >::
-getNumberOfNxFaces() const
+Grid< 2, Real, Device, Index >::getNumberOfNxFaces() const
 {
    return numberOfNxFaces;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
 const Real&
-Grid< 2, Real, Device, Index >::
-getCellMeasure() const
+Grid< 2, Real, Device, Index >::getCellMeasure() const
 {
    return this->template getSpaceStepsProducts< 1, 1 >();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-__cuda_callable__ inline
-Real Grid< 2, Real, Device, Index > :: getSmallestSpaceStep() const
+template< typename Real, typename Device, typename Index >
+__cuda_callable__
+inline Real
+Grid< 2, Real, Device, Index >::getSmallestSpaceStep() const
 {
    return min( this->spaceSteps.x(), this->spaceSteps.y() );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 void
-Grid< 2, Real, Device, Index >::
-writeProlog( Logger& logger ) const
+Grid< 2, Real, Device, Index >::writeProlog( Logger& logger ) const
 {
    logger.writeParameter( "Dimension:", getMeshDimension() );
    logger.writeParameter( "Domain origin:", this->origin );
@@ -426,5 +340,5 @@ writeProlog( Logger& logger ) const
    logger.writeParameter( "Number of vertices:", getEntitiesCount< Vertex >() );
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/GridDetails/Grid3D.h b/src/TNL/Meshes/GridDetails/Grid3D.h
index 62fab58d1f1df2a482397113066d5295f8d0ea95..0ec5144f62f788624837ee15bfb20acb03240c65 100644
--- a/src/TNL/Meshes/GridDetails/Grid3D.h
+++ b/src/TNL/Meshes/GridDetails/Grid3D.h
@@ -17,42 +17,42 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 class Grid< 3, Real, Device, Index >
 {
-   public:
-
-   typedef Real RealType;
-   typedef Device DeviceType;
-   typedef Index GlobalIndexType;
-   typedef Containers::StaticVector< 3, Real > PointType;
-   typedef Containers::StaticVector< 3, Index > CoordinatesType;
+public:
+   using RealType = Real;
+   using DeviceType = Device;
+   using GlobalIndexType = Index;
+   using PointType = Containers::StaticVector< 3, Real >;
+   using CoordinatesType = Containers::StaticVector< 3, Index >;
 
    // TODO: deprecated and to be removed (GlobalIndexType shall be used instead)
-   typedef Index IndexType;
+   using IndexType = Index;
 
-   static constexpr int getMeshDimension() { return 3; };
+   static constexpr int
+   getMeshDimension()
+   {
+      return 3;
+   };
 
-   template< int EntityDimension,
-             typename Config = GridEntityCrossStencilStorage< 1 > >
+   template< int EntityDimension, typename Config = GridEntityCrossStencilStorage< 1 > >
    using EntityType = GridEntity< Grid, EntityDimension, Config >;
 
-   typedef EntityType< getMeshDimension(), GridEntityCrossStencilStorage< 1 > > Cell;
-   typedef EntityType< getMeshDimension() - 1 > Face;
-   typedef EntityType< 1 > Edge;
-   typedef EntityType< 0 > Vertex;
+   using Cell = EntityType< getMeshDimension(), GridEntityCrossStencilStorage< 1 > >;
+   using Face = EntityType< getMeshDimension() - 1 >;
+   using Edge = EntityType< 1 >;
+   using Vertex = EntityType< 0 >;
 
    /**
     * \brief See Grid1D::Grid().
     */
-   Grid();
+   Grid() = default;
 
-   Grid( const Index xSize, const Index ySize, const Index zSize );
+   Grid( Index xSize, Index ySize, Index zSize );
 
    // empty destructor is needed only to avoid crappy nvcc warnings
-   ~Grid() {}
+   ~Grid() = default;
 
    /**
     * \brief Sets the size of dimensions.
@@ -60,61 +60,75 @@ class Grid< 3, Real, Device, Index >
     * \param ySize Size of dimesion y.
     * \param zSize Size of dimesion z.
     */
-   void setDimensions( const Index xSize, const Index ySize, const Index zSize );
+   void
+   setDimensions( Index xSize, Index ySize, Index zSize );
 
    /**
     * \brief See Grid1D::setDimensions( const CoordinatesType& dimensions ).
     */
-   void setDimensions( const CoordinatesType& );
+   void
+   setDimensions( const CoordinatesType& dimensions );
 
    /**
     * \brief See Grid1D::getDimensions().
     */
    __cuda_callable__
-   const CoordinatesType& getDimensions() const;
+   const CoordinatesType&
+   getDimensions() const;
 
-   void setLocalBegin( const CoordinatesType& begin );
+   void
+   setLocalBegin( const CoordinatesType& begin );
 
    __cuda_callable__
-   const CoordinatesType& getLocalBegin() const;
+   const CoordinatesType&
+   getLocalBegin() const;
 
-   void setLocalEnd( const CoordinatesType& end );
+   void
+   setLocalEnd( const CoordinatesType& end );
 
    __cuda_callable__
-   const CoordinatesType& getLocalEnd() const;
+   const CoordinatesType&
+   getLocalEnd() const;
 
-   void setInteriorBegin( const CoordinatesType& begin );
+   void
+   setInteriorBegin( const CoordinatesType& begin );
 
    __cuda_callable__
-   const CoordinatesType& getInteriorBegin() const;
+   const CoordinatesType&
+   getInteriorBegin() const;
 
-   void setInteriorEnd( const CoordinatesType& end );
+   void
+   setInteriorEnd( const CoordinatesType& end );
 
    __cuda_callable__
-   const CoordinatesType& getInteriorEnd() const;
+   const CoordinatesType&
+   getInteriorEnd() const;
 
    /**
     * \brief See Grid1D::setDomain().
     */
-   void setDomain( const PointType& origin,
-                   const PointType& proportions );
+   void
+   setDomain( const PointType& origin, const PointType& proportions );
 
    /**
     * \brief See Grid1D::setOrigin()
     */
-   void setOrigin( const PointType& origin);
+   void
+   setOrigin( const PointType& origin );
 
    /**
     * \brief See Grid1D::getOrigin().
     */
    __cuda_callable__
-   inline const PointType& getOrigin() const;
+   inline const PointType&
+   getOrigin() const;
 
    /**
     * \brief See Grid1D::getProportions().
     */
    __cuda_callable__
-   inline const PointType& getProportions() const;
+   inline const PointType&
+   getProportions() const;
 
    /**
     * \brief Gets number of entities in this grid.
@@ -122,7 +136,8 @@ class Grid< 3, Real, Device, Index >
     */
    template< int EntityDimension >
    __cuda_callable__
-   IndexType getEntitiesCount() const;
+   IndexType
+   getEntitiesCount() const;
 
    /**
     * \brief Gets number of entities in this grid.
@@ -130,32 +145,37 @@ class Grid< 3, Real, Device, Index >
     */
    template< typename Entity >
    __cuda_callable__
-   IndexType getEntitiesCount() const;
+   IndexType
+   getEntitiesCount() const;
 
    /**
     * \brief See Grid1D::getEntity().
     */
    template< typename Entity >
    __cuda_callable__
-   inline Entity getEntity( const IndexType& entityIndex ) const;
+   inline Entity
+   getEntity( const IndexType& entityIndex ) const;
 
    /**
     * \brief See Grid1D::getEntityIndex().
     */
    template< typename Entity >
    __cuda_callable__
-   inline Index getEntityIndex( const Entity& entity ) const;
+   inline Index
+   getEntityIndex( const Entity& entity ) const;
 
    /**
     * \brief See Grid1D::getSpaceSteps().
     */
    __cuda_callable__
-   inline const PointType& getSpaceSteps() const;
+   inline const PointType&
+   getSpaceSteps() const;
 
    /**
     * \brief See Grid1D::setSpaceSteps().
     */
-   inline void setSpaceSteps(const PointType& steps);
+   inline void
+   setSpaceSteps( const PointType& steps );
 
    /**
     * \brief Returns product of space steps to the xPow.
@@ -165,54 +185,73 @@ class Grid< 3, Real, Device, Index >
     */
    template< int xPow, int yPow, int zPow >
    __cuda_callable__
-   const RealType& getSpaceStepsProducts() const;
+   const RealType&
+   getSpaceStepsProducts() const;
 
    /**
     * \brief Returns the number of x-normal faces.
     */
    __cuda_callable__
-   IndexType getNumberOfNxFaces() const;
+   IndexType
+   getNumberOfNxFaces() const;
 
    /**
     * \brief Returns the number of x-normal and y-normal faces.
     */
    __cuda_callable__
-   IndexType getNumberOfNxAndNyFaces() const;
+   IndexType
+   getNumberOfNxAndNyFaces() const;
 
    /**
     * \breif Returns the measure (volume) of a cell in this grid.
     */
    __cuda_callable__
-   inline const RealType& getCellMeasure() const;
+   inline const RealType&
+   getCellMeasure() const;
 
    /**
     * \brief See Grid1D::getSmallestSpaceStep().
     */
    __cuda_callable__
-   RealType getSmallestSpaceStep() const;
-
-   void writeProlog( Logger& logger ) const;
-
-   protected:
-
-   void computeProportions();
-
-   void computeSpaceStepPowers();
-
-   void computeSpaceSteps();
-
-   CoordinatesType dimensions, localBegin, localEnd, interiorBegin, interiorEnd;
-
-   IndexType numberOfCells,
-          numberOfNxFaces, numberOfNyFaces, numberOfNzFaces, numberOfNxAndNyFaces, numberOfFaces,
-          numberOfDxEdges, numberOfDyEdges, numberOfDzEdges, numberOfDxAndDyEdges, numberOfEdges,
-          numberOfVertices;
-
-   PointType origin, proportions;
-
-   IndexType cellZNeighborsStep;
-
-   PointType spaceSteps;
+   RealType
+   getSmallestSpaceStep() const;
+
+   void
+   writeProlog( Logger& logger ) const;
+
+protected:
+   void
+   computeProportions();
+
+   void
+   computeSpaceStepPowers();
+
+   void
+   computeSpaceSteps();
+
+   CoordinatesType dimensions = { 0, 0, 0 };
+   CoordinatesType localBegin = { 0, 0, 0 };
+   CoordinatesType localEnd = { 0, 0, 0 };
+   CoordinatesType interiorBegin = { 0, 0, 0 };
+   CoordinatesType interiorEnd = { 0, 0, 0 };
+
+   IndexType numberOfCells = 0;
+   IndexType numberOfNxFaces = 0;
+   IndexType numberOfNyFaces = 0;
+   IndexType numberOfNzFaces = 0;
+   IndexType numberOfNxAndNyFaces = 0;
+   IndexType numberOfFaces = 0;
+   IndexType numberOfDxEdges = 0;
+   IndexType numberOfDyEdges = 0;
+   IndexType numberOfDzEdges = 0;
+   IndexType numberOfDxAndDyEdges = 0;
+   IndexType numberOfEdges = 0;
+   IndexType numberOfVertices = 0;
+   IndexType cellZNeighborsStep = 0;
+
+   PointType origin = { 0, 0, 0 };
+   PointType proportions = { 0, 0, 0 };
+   PointType spaceSteps = { 0, 0, 0 };
 
    RealType spaceStepsProducts[ 5 ][ 5 ][ 5 ];
 
@@ -223,7 +262,7 @@ class Grid< 3, Real, Device, Index >
    friend class NeighborGridEntityGetter;
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/GridDetails/Grid3D_impl.h>
diff --git a/src/TNL/Meshes/GridDetails/Grid3D_impl.h b/src/TNL/Meshes/GridDetails/Grid3D_impl.h
index 9528cb9edd004897a51f5fba36ad5396745822ee..671afcf4e80c2e11a6abfbc7ba1903bbd14151cc 100644
--- a/src/TNL/Meshes/GridDetails/Grid3D_impl.h
+++ b/src/TNL/Meshes/GridDetails/Grid3D_impl.h
@@ -17,174 +17,124 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename Real,
-          typename Device,
-          typename Index >
-Grid< 3, Real, Device, Index > :: Grid()
-: numberOfCells( 0 ),
-  numberOfNxFaces( 0 ),
-  numberOfNyFaces( 0 ),
-  numberOfNzFaces( 0 ),
-  numberOfNxAndNyFaces( 0 ),
-  numberOfFaces( 0 ),
-  numberOfDxEdges( 0 ),
-  numberOfDyEdges( 0 ),
-  numberOfDzEdges( 0 ),
-  numberOfDxAndDyEdges( 0 ),
-  numberOfEdges( 0 ),
-  numberOfVertices( 0 )
-{
-}
-
-template< typename Real,
-          typename Device,
-          typename Index >
-Grid< 3, Real, Device, Index >::Grid( const Index xSize, const Index ySize, const Index zSize )
-: numberOfCells( 0 ),
-  numberOfNxFaces( 0 ),
-  numberOfNyFaces( 0 ),
-  numberOfNzFaces( 0 ),
-  numberOfNxAndNyFaces( 0 ),
-  numberOfFaces( 0 ),
-  numberOfDxEdges( 0 ),
-  numberOfDyEdges( 0 ),
-  numberOfDzEdges( 0 ),
-  numberOfDxAndDyEdges( 0 ),
-  numberOfEdges( 0 ),
-  numberOfVertices( 0 )
+template< typename Real, typename Device, typename Index >
+Grid< 3, Real, Device, Index >::Grid( Index xSize, Index ySize, Index zSize )
 {
    this->setDimensions( xSize, ySize, zSize );
 }
 
-
-template< typename Real,
-          typename Device,
-          typename Index >
-void Grid< 3, Real, Device, Index > :: computeSpaceSteps()
+template< typename Real, typename Device, typename Index >
+void
+Grid< 3, Real, Device, Index >::computeSpaceSteps()
 {
-   if( this->getDimensions().x() > 0 &&
-       this->getDimensions().y() > 0 &&
-       this->getDimensions().z() > 0 )
-   {
-      this->spaceSteps.x() = this->proportions.x() / ( Real ) this->getDimensions().x();
-      this->spaceSteps.y() = this->proportions.y() / ( Real ) this->getDimensions().y();
-      this->spaceSteps.z() = this->proportions.z() / ( Real ) this->getDimensions().z();
+   if( this->getDimensions().x() > 0 && this->getDimensions().y() > 0 && this->getDimensions().z() > 0 ) {
+      this->spaceSteps.x() = this->proportions.x() / (Real) this->getDimensions().x();
+      this->spaceSteps.y() = this->proportions.y() / (Real) this->getDimensions().y();
+      this->spaceSteps.z() = this->proportions.z() / (Real) this->getDimensions().z();
 
       this->computeSpaceStepPowers();
-
    }
 };
 
-template< typename Real,
-          typename Device,
-          typename Index >
-void Grid< 3, Real, Device, Index > :: computeSpaceStepPowers()
-{
-      const RealType& hx = this->spaceSteps.x();
-      const RealType& hy = this->spaceSteps.y();
-      const RealType& hz = this->spaceSteps.z();
-
-      Real auxX, auxY, auxZ;
-      for( int i = 0; i < 5; i++ )
-      {
-         switch( i )
-         {
+template< typename Real, typename Device, typename Index >
+void
+Grid< 3, Real, Device, Index >::computeSpaceStepPowers()
+{
+   const RealType& hx = this->spaceSteps.x();
+   const RealType& hy = this->spaceSteps.y();
+   const RealType& hz = this->spaceSteps.z();
+
+   Real auxX;
+   Real auxY;
+   Real auxZ;
+   for( int i = 0; i < 5; i++ ) {
+      switch( i ) {
+         case 0:
+            auxX = 1.0 / ( hx * hx );
+            break;
+         case 1:
+            auxX = 1.0 / hx;
+            break;
+         case 2:
+            auxX = 1.0;
+            break;
+         case 3:
+            auxX = hx;
+            break;
+         case 4:
+            auxX = hx * hx;
+            break;
+      }
+      for( int j = 0; j < 5; j++ ) {
+         switch( j ) {
             case 0:
-               auxX = 1.0 / ( hx * hx );
+               auxY = 1.0 / ( hy * hy );
                break;
             case 1:
-               auxX = 1.0 / hx;
+               auxY = 1.0 / hy;
                break;
             case 2:
-               auxX = 1.0;
+               auxY = 1.0;
                break;
             case 3:
-               auxX = hx;
+               auxY = hy;
                break;
             case 4:
-               auxX = hx * hx;
+               auxY = hy * hy;
                break;
          }
-         for( int j = 0; j < 5; j++ )
-         {
-            switch( j )
-            {
+         for( int k = 0; k < 5; k++ ) {
+            switch( k ) {
                case 0:
-                  auxY = 1.0 / ( hy * hy );
+                  auxZ = 1.0 / ( hz * hz );
                   break;
                case 1:
-                  auxY = 1.0 / hy;
+                  auxZ = 1.0 / hz;
                   break;
                case 2:
-                  auxY = 1.0;
+                  auxZ = 1.0;
                   break;
                case 3:
-                  auxY = hy;
+                  auxZ = hz;
                   break;
                case 4:
-                  auxY = hy * hy;
+                  auxZ = hz * hz;
                   break;
             }
-            for( int k = 0; k < 5; k++ )
-            {
-               switch( k )
-               {
-                  case 0:
-                     auxZ = 1.0 / ( hz * hz );
-                     break;
-                  case 1:
-                     auxZ = 1.0 / hz;
-                     break;
-                  case 2:
-                     auxZ = 1.0;
-                     break;
-                  case 3:
-                     auxZ = hz;
-                     break;
-                  case 4:
-                     auxZ = hz * hz;
-                     break;
-               }
-               this->spaceStepsProducts[ i ][ j ][ k ] = auxX * auxY * auxZ;
-            }
+            this->spaceStepsProducts[ i ][ j ][ k ] = auxX * auxY * auxZ;
          }
       }
+   }
 }
 
-
-template< typename Real,
-          typename Device,
-          typename Index >
-void Grid< 3, Real, Device, Index > :: computeProportions()
+template< typename Real, typename Device, typename Index >
+void
+Grid< 3, Real, Device, Index >::computeProportions()
 {
-    this->proportions.x()=this->dimensions.x()*this->spaceSteps.x();
-    this->proportions.y()=this->dimensions.y()*this->spaceSteps.y();
-    this->proportions.z()=this->dimensions.z()*this->spaceSteps.z();
+   this->proportions.x() = this->dimensions.x() * this->spaceSteps.x();
+   this->proportions.y() = this->dimensions.y() * this->spaceSteps.y();
+   this->proportions.z() = this->dimensions.z() * this->spaceSteps.z();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-void Grid< 3, Real, Device, Index > :: setOrigin( const PointType& origin)
+template< typename Real, typename Device, typename Index >
+void
+Grid< 3, Real, Device, Index >::setOrigin( const PointType& origin )
 {
-    this->origin=origin;
+   this->origin = origin;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-void Grid< 3, Real, Device, Index > :: setSpaceSteps(const PointType& steps)
+template< typename Real, typename Device, typename Index >
+void
+Grid< 3, Real, Device, Index >::setSpaceSteps( const PointType& steps )
 {
-     this->spaceSteps=steps;
-     computeSpaceStepPowers();
-     computeProportions();
+   this->spaceSteps = steps;
+   computeSpaceStepPowers();
+   computeProportions();
 }
 
-
-template< typename Real,
-          typename Device,
-          typename Index >
-void Grid< 3, Real, Device, Index > :: setDimensions( const Index xSize, const Index ySize, const Index zSize )
+template< typename Real, typename Device, typename Index >
+void
+Grid< 3, Real, Device, Index >::setDimensions( Index xSize, Index ySize, Index zSize )
 {
    TNL_ASSERT_GE( xSize, 0, "Grid size must be non-negative." );
    TNL_ASSERT_GE( ySize, 0, "Grid size must be non-negative." );
@@ -198,16 +148,12 @@ void Grid< 3, Real, Device, Index > :: setDimensions( const Index xSize, const I
    this->numberOfNyFaces = xSize * ( ySize + 1 ) * zSize;
    this->numberOfNzFaces = xSize * ySize * ( zSize + 1 );
    this->numberOfNxAndNyFaces = this->numberOfNxFaces + this->numberOfNyFaces;
-   this->numberOfFaces = this->numberOfNxFaces +
-                         this->numberOfNyFaces +
-                         this->numberOfNzFaces;
+   this->numberOfFaces = this->numberOfNxFaces + this->numberOfNyFaces + this->numberOfNzFaces;
    this->numberOfDxEdges = xSize * ( ySize + 1 ) * ( zSize + 1 );
    this->numberOfDyEdges = ( xSize + 1 ) * ySize * ( zSize + 1 );
    this->numberOfDzEdges = ( xSize + 1 ) * ( ySize + 1 ) * zSize;
    this->numberOfDxAndDyEdges = this->numberOfDxEdges + this->numberOfDyEdges;
-   this->numberOfEdges = this->numberOfDxEdges +
-                         this->numberOfDyEdges +
-                         this->numberOfDzEdges;
+   this->numberOfEdges = this->numberOfDxEdges + this->numberOfDyEdges + this->numberOfDzEdges;
    this->numberOfVertices = ( xSize + 1 ) * ( ySize + 1 ) * ( zSize + 1 );
 
    this->cellZNeighborsStep = xSize * ySize;
@@ -221,143 +167,115 @@ void Grid< 3, Real, Device, Index > :: setDimensions( const Index xSize, const I
    interiorEnd = dimensions - 1;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-void Grid< 3, Real, Device, Index > :: setDimensions( const CoordinatesType& dimensions )
+template< typename Real, typename Device, typename Index >
+void
+Grid< 3, Real, Device, Index >::setDimensions( const CoordinatesType& dimensions )
 {
-   return this->setDimensions( dimensions. x(), dimensions. y(), dimensions. z() );
+   return this->setDimensions( dimensions.x(), dimensions.y(), dimensions.z() );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-__cuda_callable__ inline
-const typename Grid< 3, Real, Device, Index > :: CoordinatesType&
-   Grid< 3, Real, Device, Index > :: getDimensions() const
+template< typename Real, typename Device, typename Index >
+__cuda_callable__
+inline const typename Grid< 3, Real, Device, Index >::CoordinatesType&
+Grid< 3, Real, Device, Index >::getDimensions() const
 {
    return this->dimensions;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
-void Grid< 3, Real, Device, Index >::setLocalBegin( const CoordinatesType& begin )
+template< typename Real, typename Device, typename Index >
+void
+Grid< 3, Real, Device, Index >::setLocalBegin( const CoordinatesType& begin )
 {
    localBegin = begin;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
 const typename Grid< 3, Real, Device, Index >::CoordinatesType&
-   Grid< 3, Real, Device, Index >::getLocalBegin() const
+Grid< 3, Real, Device, Index >::getLocalBegin() const
 {
    return localBegin;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
-void Grid< 3, Real, Device, Index >::setLocalEnd( const CoordinatesType& end )
+template< typename Real, typename Device, typename Index >
+void
+Grid< 3, Real, Device, Index >::setLocalEnd( const CoordinatesType& end )
 {
    localEnd = end;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
 const typename Grid< 3, Real, Device, Index >::CoordinatesType&
-   Grid< 3, Real, Device, Index >::
-   getLocalEnd() const
+Grid< 3, Real, Device, Index >::getLocalEnd() const
 {
    return localEnd;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
-void Grid< 3, Real, Device, Index >::setInteriorBegin( const CoordinatesType& begin )
+template< typename Real, typename Device, typename Index >
+void
+Grid< 3, Real, Device, Index >::setInteriorBegin( const CoordinatesType& begin )
 {
    interiorBegin = begin;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
 const typename Grid< 3, Real, Device, Index >::CoordinatesType&
-   Grid< 3, Real, Device, Index >::getInteriorBegin() const
+Grid< 3, Real, Device, Index >::getInteriorBegin() const
 {
    return interiorBegin;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
-void Grid< 3, Real, Device, Index >::setInteriorEnd( const CoordinatesType& end )
+template< typename Real, typename Device, typename Index >
+void
+Grid< 3, Real, Device, Index >::setInteriorEnd( const CoordinatesType& end )
 {
    interiorEnd = end;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index  >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
 const typename Grid< 3, Real, Device, Index >::CoordinatesType&
-   Grid< 3, Real, Device, Index >::getInteriorEnd() const
+Grid< 3, Real, Device, Index >::getInteriorEnd() const
 {
    return interiorEnd;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-void Grid< 3, Real, Device, Index > :: setDomain( const PointType& origin,
-                                                     const PointType& proportions )
+template< typename Real, typename Device, typename Index >
+void
+Grid< 3, Real, Device, Index >::setDomain( const PointType& origin, const PointType& proportions )
 {
    this->origin = origin;
    this->proportions = proportions;
    computeSpaceSteps();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-__cuda_callable__ inline
-const typename Grid< 3, Real, Device, Index >::PointType&
+template< typename Real, typename Device, typename Index >
+__cuda_callable__
+inline const typename Grid< 3, Real, Device, Index >::PointType&
 Grid< 3, Real, Device, Index >::getOrigin() const
 {
    return this->origin;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-__cuda_callable__ inline
-const typename Grid< 3, Real, Device, Index > :: PointType&
-   Grid< 3, Real, Device, Index > :: getProportions() const
+template< typename Real, typename Device, typename Index >
+__cuda_callable__
+inline const typename Grid< 3, Real, Device, Index >::PointType&
+Grid< 3, Real, Device, Index >::getProportions() const
 {
-	return this->proportions;
+   return this->proportions;
 }
 
-
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< int EntityDimension >
-__cuda_callable__  inline
-Index
-Grid< 3, Real, Device, Index >::
-getEntitiesCount() const
+template< typename Real, typename Device, typename Index >
+template< int EntityDimension >
+__cuda_callable__
+inline Index
+Grid< 3, Real, Device, Index >::getEntitiesCount() const
 {
-   static_assert( EntityDimension <= 3 &&
-                  EntityDimension >= 0, "Wrong grid entity dimensions." );
+   static_assert( EntityDimension <= 3 && EntityDimension >= 0, "Wrong grid entity dimensions." );
 
-   switch( EntityDimension )
-   {
+   switch( EntityDimension ) {
       case 3:
          return this->numberOfCells;
       case 2:
@@ -370,67 +288,50 @@ getEntitiesCount() const
    return -1;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename Entity >
-__cuda_callable__  inline
-Index
-Grid< 3, Real, Device, Index >::
-getEntitiesCount() const
+template< typename Real, typename Device, typename Index >
+template< typename Entity >
+__cuda_callable__
+inline Index
+Grid< 3, Real, Device, Index >::getEntitiesCount() const
 {
    return getEntitiesCount< Entity::getEntityDimension() >();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename Entity >
- __cuda_callable__ inline
-Entity
-Grid< 3, Real, Device, Index >::
-getEntity( const IndexType& entityIndex ) const
+template< typename Real, typename Device, typename Index >
+template< typename Entity >
+__cuda_callable__
+inline Entity
+Grid< 3, Real, Device, Index >::getEntity( const IndexType& entityIndex ) const
 {
-   static_assert( Entity::getEntityDimension() <= 3 &&
-                  Entity::getEntityDimension() >= 0, "Wrong grid entity dimensions." );
+   static_assert( Entity::getEntityDimension() <= 3 && Entity::getEntityDimension() >= 0, "Wrong grid entity dimensions." );
 
    return GridEntityGetter< Grid, Entity >::getEntity( *this, entityIndex );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename Entity >
-__cuda_callable__ inline
-Index
-Grid< 3, Real, Device, Index >::
-getEntityIndex( const Entity& entity ) const
+template< typename Real, typename Device, typename Index >
+template< typename Entity >
+__cuda_callable__
+inline Index
+Grid< 3, Real, Device, Index >::getEntityIndex( const Entity& entity ) const
 {
-   static_assert( Entity::getEntityDimension() <= 3 &&
-                  Entity::getEntityDimension() >= 0, "Wrong grid entity dimensions." );
+   static_assert( Entity::getEntityDimension() <= 3 && Entity::getEntityDimension() >= 0, "Wrong grid entity dimensions." );
 
    return GridEntityGetter< Grid, Entity >::getEntityIndex( *this, entity );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-__cuda_callable__ inline
-const typename Grid< 3, Real, Device, Index >::PointType&
-Grid< 3, Real, Device, Index >::
-getSpaceSteps() const
+template< typename Real, typename Device, typename Index >
+__cuda_callable__
+inline const typename Grid< 3, Real, Device, Index >::PointType&
+Grid< 3, Real, Device, Index >::getSpaceSteps() const
 {
    return this->spaceSteps;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< int xPow, int yPow, int zPow >
-__cuda_callable__ inline
-const Real&
-Grid< 3, Real, Device, Index >::
-getSpaceStepsProducts() const
+template< typename Real, typename Device, typename Index >
+template< int xPow, int yPow, int zPow >
+__cuda_callable__
+inline const Real&
+Grid< 3, Real, Device, Index >::getSpaceStepsProducts() const
 {
    static_assert( xPow >= -2 && xPow <= 2, "unsupported value of xPow" );
    static_assert( yPow >= -2 && yPow <= 2, "unsupported value of yPow" );
@@ -438,54 +339,41 @@ getSpaceStepsProducts() const
    return this->spaceStepsProducts[ xPow + 2 ][ yPow + 2 ][ zPow + 2 ];
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
 Index
-Grid< 3, Real, Device, Index >::
-getNumberOfNxFaces() const
+Grid< 3, Real, Device, Index >::getNumberOfNxFaces() const
 {
    return numberOfNxFaces;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
 Index
-Grid< 3, Real, Device, Index >::
-getNumberOfNxAndNyFaces() const
+Grid< 3, Real, Device, Index >::getNumberOfNxAndNyFaces() const
 {
    return numberOfNxAndNyFaces;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 __cuda_callable__
 const Real&
-Grid< 3, Real, Device, Index >::
-getCellMeasure() const
+Grid< 3, Real, Device, Index >::getCellMeasure() const
 {
    return this->template getSpaceStepsProducts< 1, 1, 1 >();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-__cuda_callable__ inline
-Real Grid< 3, Real, Device, Index > :: getSmallestSpaceStep() const
+template< typename Real, typename Device, typename Index >
+__cuda_callable__
+inline Real
+Grid< 3, Real, Device, Index >::getSmallestSpaceStep() const
 {
    return min( this->spaceSteps.x(), min( this->spaceSteps.y(), this->spaceSteps.z() ) );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 void
-Grid< 3, Real, Device, Index >::
-writeProlog( Logger& logger ) const
+Grid< 3, Real, Device, Index >::writeProlog( Logger& logger ) const
 {
    logger.writeParameter( "Dimension:", getMeshDimension() );
    logger.writeParameter( "Domain origin:", this->origin );
@@ -497,5 +385,5 @@ writeProlog( Logger& logger ) const
    logger.writeParameter( "Number of vertices:", getEntitiesCount< Vertex >() );
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/GridDetails/GridEntityCenterGetter.h b/src/TNL/Meshes/GridDetails/GridEntityCenterGetter.h
index 7a81367e72fd0011e90ae693aeae610a40b152a8..af30ce8f97d8cca270232d34acb5f1be43405393 100644
--- a/src/TNL/Meshes/GridDetails/GridEntityCenterGetter.h
+++ b/src/TNL/Meshes/GridDetails/GridEntityCenterGetter.h
@@ -11,203 +11,163 @@ namespace Meshes {
 
 template< typename GridEntity >
 class GridEntityCenterGetter
-{
-};
+{};
 
 /***
  * 1D grids
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
+template< typename Real, typename Device, typename Index, typename Config >
 class GridEntityCenterGetter< GridEntity< Meshes::Grid< 1, Real, Device, Index >, 1, Config > >
 {
-   public:
-
-      typedef Meshes::Grid< 1, Real, Device, Index > GridType;
-      typedef GridEntity< GridType, 1, Config > GridEntityType;
-      typedef typename GridType::PointType PointType;
-
-      __cuda_callable__ inline
-      static PointType getEntityCenter( const GridEntityType& entity )
-      {
-         const GridType& grid = entity.getMesh();
-         return PointType(
-            grid.getOrigin().x() + ( entity.getCoordinates().x() + 0.5 ) * grid.getSpaceSteps().x() );
-      }
+public:
+   using GridType = Meshes::Grid< 1, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, 1, Config >;
+   using PointType = typename GridType::PointType;
+
+   __cuda_callable__
+   inline static PointType
+   getEntityCenter( const GridEntityType& entity )
+   {
+      const GridType& grid = entity.getMesh();
+      return PointType( grid.getOrigin().x() + ( entity.getCoordinates().x() + 0.5 ) * grid.getSpaceSteps().x() );
+   }
 };
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
+template< typename Real, typename Device, typename Index, typename Config >
 class GridEntityCenterGetter< GridEntity< Meshes::Grid< 1, Real, Device, Index >, 0, Config > >
 {
-   public:
-
-      typedef Meshes::Grid< 1, Real, Device, Index > GridType;
-      typedef GridEntity< GridType, 0, Config > GridEntityType;
-      typedef typename GridType::PointType PointType;
-
-      __cuda_callable__ inline
-      static PointType getEntityCenter( const GridEntityType& entity )
-      {
-         const GridType& grid = entity.getMesh();
-         return PointType(
-            grid.getOrigin().x() + ( entity.getCoordinates().x() ) * grid.getSpaceSteps().x() );
-      }
+public:
+   using GridType = Meshes::Grid< 1, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, 0, Config >;
+   using PointType = typename GridType::PointType;
+
+   __cuda_callable__
+   inline static PointType
+   getEntityCenter( const GridEntityType& entity )
+   {
+      const GridType& grid = entity.getMesh();
+      return PointType( grid.getOrigin().x() + ( entity.getCoordinates().x() ) * grid.getSpaceSteps().x() );
+   }
 };
 
 /****
  * 2D grids
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
+template< typename Real, typename Device, typename Index, typename Config >
 class GridEntityCenterGetter< GridEntity< Meshes::Grid< 2, Real, Device, Index >, 2, Config > >
 {
-   public:
-
-      typedef Meshes::Grid< 2, Real, Device, Index > GridType;
-      typedef GridEntity< GridType, 2, Config > GridEntityType;
-      typedef typename GridType::PointType PointType;
-
-      __cuda_callable__ inline
-      static PointType getEntityCenter( const GridEntityType& entity )
-      {
-         const GridType& grid = entity.getMesh();
-         return PointType(
-            grid.getOrigin().x() + ( entity.getCoordinates().x() + 0.5 ) * grid.getSpaceSteps().x(),
-            grid.getOrigin().y() + ( entity.getCoordinates().y() + 0.5 ) * grid.getSpaceSteps().y() );
-      }
+public:
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, 2, Config >;
+   using PointType = typename GridType::PointType;
+
+   __cuda_callable__
+   inline static PointType
+   getEntityCenter( const GridEntityType& entity )
+   {
+      const GridType& grid = entity.getMesh();
+      return PointType( grid.getOrigin().x() + ( entity.getCoordinates().x() + 0.5 ) * grid.getSpaceSteps().x(),
+                        grid.getOrigin().y() + ( entity.getCoordinates().y() + 0.5 ) * grid.getSpaceSteps().y() );
+   }
 };
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
+template< typename Real, typename Device, typename Index, typename Config >
 class GridEntityCenterGetter< GridEntity< Meshes::Grid< 2, Real, Device, Index >, 1, Config > >
 {
-   public:
-
-      typedef Meshes::Grid< 2, Real, Device, Index > GridType;
-      typedef GridEntity< GridType, 1, Config > GridEntityType;
-      typedef typename GridType::PointType PointType;
-
-      __cuda_callable__ inline
-      static PointType getEntityCenter( const GridEntityType& entity )
-      {
-         const GridType& grid = entity.getMesh();
-         return PointType(
-            grid.getOrigin().x() +
-               ( entity.getCoordinates().x() + 0.5 * entity.getBasis().x() ) * grid.getSpaceSteps().x(),
-            grid.getOrigin().y() +
-               ( entity.getCoordinates().y() + 0.5 * entity.getBasis().y() ) * grid.getSpaceSteps().y() );
-      }
+public:
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, 1, Config >;
+   using PointType = typename GridType::PointType;
+
+   __cuda_callable__
+   inline static PointType
+   getEntityCenter( const GridEntityType& entity )
+   {
+      const GridType& grid = entity.getMesh();
+      return PointType(
+         grid.getOrigin().x() + ( entity.getCoordinates().x() + 0.5 * entity.getBasis().x() ) * grid.getSpaceSteps().x(),
+         grid.getOrigin().y() + ( entity.getCoordinates().y() + 0.5 * entity.getBasis().y() ) * grid.getSpaceSteps().y() );
+   }
 };
 
-
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
+template< typename Real, typename Device, typename Index, typename Config >
 class GridEntityCenterGetter< GridEntity< Meshes::Grid< 2, Real, Device, Index >, 0, Config > >
 {
-   public:
-
-      typedef Meshes::Grid< 2, Real, Device, Index > GridType;
-      typedef GridEntity< GridType, 0, Config > GridEntityType;
-      typedef typename GridType::PointType PointType;
-
-      __cuda_callable__ inline
-      static PointType getEntityCenter( const GridEntityType& entity )
-      {
-         const GridType& grid = entity.getMesh();
-         return PointType(
-            grid.getOrigin().x() + entity.getCoordinates().x() * grid.getSpaceSteps().x(),
-            grid.getOrigin().y() + entity.getCoordinates().y() * grid.getSpaceSteps().y() );
-      }
+public:
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, 0, Config >;
+   using PointType = typename GridType::PointType;
+
+   __cuda_callable__
+   inline static PointType
+   getEntityCenter( const GridEntityType& entity )
+   {
+      const GridType& grid = entity.getMesh();
+      return PointType( grid.getOrigin().x() + entity.getCoordinates().x() * grid.getSpaceSteps().x(),
+                        grid.getOrigin().y() + entity.getCoordinates().y() * grid.getSpaceSteps().y() );
+   }
 };
 
-
 /***
  * 3D grid
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          int EntityDimension,
-          typename Config >
+template< typename Real, typename Device, typename Index, int EntityDimension, typename Config >
 class GridEntityCenterGetter< GridEntity< Meshes::Grid< 3, Real, Device, Index >, EntityDimension, Config > >
 {
-   public:
-
-      typedef Meshes::Grid< 3, Real, Device, Index > GridType;
-      typedef GridEntity< GridType, EntityDimension, Config > GridEntityType;
-      typedef typename GridType::PointType PointType;
-
-      __cuda_callable__ inline
-      static PointType getEntityCenter( const GridEntityType& entity )
-      {
-         const GridType& grid = entity.getMesh();
-         return PointType(
-            grid.getOrigin().x() +
-               ( entity.getCoordinates().x() + 0.5 * entity.getBasis().x() ) * grid.getSpaceSteps().x(),
-            grid.getOrigin().y() +
-               ( entity.getCoordinates().y() + 0.5 * entity.getBasis().y() ) * grid.getSpaceSteps().y(),
-            grid.getOrigin().z() +
-               ( entity.getCoordinates().z() + 0.5 * entity.getBasis().z() ) * grid.getSpaceSteps().z() );
-      }
+public:
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, EntityDimension, Config >;
+   using PointType = typename GridType::PointType;
+
+   __cuda_callable__
+   inline static PointType
+   getEntityCenter( const GridEntityType& entity )
+   {
+      const GridType& grid = entity.getMesh();
+      return PointType(
+         grid.getOrigin().x() + ( entity.getCoordinates().x() + 0.5 * entity.getBasis().x() ) * grid.getSpaceSteps().x(),
+         grid.getOrigin().y() + ( entity.getCoordinates().y() + 0.5 * entity.getBasis().y() ) * grid.getSpaceSteps().y(),
+         grid.getOrigin().z() + ( entity.getCoordinates().z() + 0.5 * entity.getBasis().z() ) * grid.getSpaceSteps().z() );
+   }
 };
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config  >
+template< typename Real, typename Device, typename Index, typename Config >
 class GridEntityCenterGetter< GridEntity< Meshes::Grid< 3, Real, Device, Index >, 3, Config > >
 {
-   public:
-
-      typedef Meshes::Grid< 3, Real, Device, Index > GridType;
-      typedef GridEntity< GridType, 3, Config > GridEntityType;
-      typedef typename GridType::PointType PointType;
-
-      __cuda_callable__ inline
-      static PointType getEntityCenter( const GridEntityType& entity )
-      {
-         const GridType& grid = entity.getMesh();
-         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() );
-      }
+public:
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, 3, Config >;
+   using PointType = typename GridType::PointType;
+
+   __cuda_callable__
+   inline static PointType
+   getEntityCenter( const GridEntityType& entity )
+   {
+      const GridType& grid = entity.getMesh();
+      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() );
+   }
 };
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config  >
+template< typename Real, typename Device, typename Index, typename Config >
 class GridEntityCenterGetter< GridEntity< Meshes::Grid< 3, Real, Device, Index >, 0, Config > >
 {
-   public:
-
-      typedef Meshes::Grid< 3, Real, Device, Index > GridType;
-      typedef GridEntity< GridType, 0, Config > GridEntityType;
-      typedef typename GridType::PointType PointType;
-
-      __cuda_callable__ inline
-      static PointType getEntityCenter( const GridEntityType& entity )
-      {
-         const GridType& grid = entity.getMesh();
-         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() );
-      }
+public:
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, 0, Config >;
+   using PointType = typename GridType::PointType;
+
+   __cuda_callable__
+   inline static PointType
+   getEntityCenter( const GridEntityType& entity )
+   {
+      const GridType& grid = entity.getMesh();
+      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() );
+   }
 };
 
-} // namespace Meshes
-} // namespace TNL
-
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/GridDetails/GridEntityGetter.h b/src/TNL/Meshes/GridDetails/GridEntityGetter.h
index 73fde42e3e85e5b0ab8d1b55d3dcd8fea35f334c..72008111212132b33c31c6644ca9a1772f97d0ea 100644
--- a/src/TNL/Meshes/GridDetails/GridEntityGetter.h
+++ b/src/TNL/Meshes/GridDetails/GridEntityGetter.h
@@ -9,18 +9,15 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename Grid,
-          typename GridEntity,
-          int EntityDimension = GridEntity::getEntityDimension() >
+template< typename Grid, typename GridEntity, int EntityDimension = GridEntity::getEntityDimension() >
 class GridEntityGetter
 {
-   //static_assert( false, "Wrong mesh type or entity topology." );
+   // static_assert( false, "Wrong mesh type or entity topology." );
 };
 
 /***
  * The main code is in template specializations in GridEntityIndexer.h
  */
 
-} // namespace Meshes
-} // namespace TNL
-
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/GridDetails/GridEntityGetter_impl.h b/src/TNL/Meshes/GridDetails/GridEntityGetter_impl.h
index b725a5c392886a9ac72d085436318aa4958bf679..b4914a1b7ade6e45028f3895d2b52b4dc0305d53 100644
--- a/src/TNL/Meshes/GridDetails/GridEntityGetter_impl.h
+++ b/src/TNL/Meshes/GridDetails/GridEntityGetter_impl.h
@@ -17,476 +17,393 @@ namespace Meshes {
 /****
  * 1D grid
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity,
-          int EntityDimension >
-class GridEntityGetter<
-   Meshes::Grid< 1, Real, Device, Index >,
-   GridEntity,
-   EntityDimension >
+template< typename Real, typename Device, typename Index, typename GridEntity, int EntityDimension >
+class GridEntityGetter< Meshes::Grid< 1, Real, Device, Index >, GridEntity, EntityDimension >
 {
-   public:
- 
-      static constexpr 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< entityDimension > GridEntity;
- 
-      __cuda_callable__ inline
-      static GridEntity getEntity( const GridType& grid,
-                                   const IndexType& index )
-      {
-         TNL_ASSERT_GE( index, 0, "Index must be non-negative." );
-         TNL_ASSERT_LT( index, grid.template getEntitiesCount< GridEntity >(), "Index is out of bounds." );
-         return GridEntity
-            ( grid,
-              CoordinatesType( index ),
-              typename GridEntity::EntityOrientationType( 0 ),
-              typename GridEntity::EntityBasisType( EntityDimension ) );
-      }
- 
-      __cuda_callable__ inline
-      static IndexType getEntityIndex( const GridType& grid,
-                                       const GridEntity& entity )
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), grid.getDimensions() + CoordinatesType( 1 - entityDimension ), "wrong coordinates" );
-         return entity.getCoordinates().x();
-      }
+public:
+   static constexpr int entityDimension = EntityDimension;
+
+   using GridType = Meshes::Grid< 1, Real, Device, Index >;
+   using IndexType = typename GridType::IndexType;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   // typedef typename GridType::template GridEntity< entityDimension > GridEntity;
+
+   __cuda_callable__
+   inline static GridEntity
+   getEntity( const GridType& grid, const IndexType& index )
+   {
+      TNL_ASSERT_GE( index, 0, "Index must be non-negative." );
+      TNL_ASSERT_LT( index, grid.template getEntitiesCount< GridEntity >(), "Index is out of bounds." );
+      return GridEntity( grid,
+                         CoordinatesType( index ),
+                         typename GridEntity::EntityOrientationType( 0 ),
+                         typename GridEntity::EntityBasisType( EntityDimension ) );
+   }
+
+   __cuda_callable__
+   inline static IndexType
+   getEntityIndex( const GridType& grid, const GridEntity& entity )
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT(
+         entity.getCoordinates(), grid.getDimensions() + CoordinatesType( 1 - entityDimension ), "wrong coordinates" );
+      return entity.getCoordinates().x();
+   }
 };
 
 /****
  * 2D grid
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
+template< typename Real, typename Device, typename Index, typename GridEntity >
 class GridEntityGetter< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 2 >
 {
-   public:
- 
-      static constexpr 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< entityDimension > GridEntity;
- 
-      __cuda_callable__ inline
-      static GridEntity getEntity( const GridType& grid,
-                                   const IndexType& index )
-      {
-         TNL_ASSERT_GE( index, 0, "Index must be non-negative." );
-         TNL_ASSERT_LT( index, grid.template getEntitiesCount< GridEntity >(), "Index is out of bounds." );
-
-         const CoordinatesType dimensions = grid.getDimensions();
-
-         return GridEntity
-            ( grid,
-              CoordinatesType( index % dimensions.x(),
-                               index / dimensions.x() ),
-              typename GridEntity::EntityOrientationType( 0, 0 ),
-              typename GridEntity::EntityBasisType( 1, 1 ) );
-      }
- 
-      __cuda_callable__ inline
-      static IndexType getEntityIndex( const GridType& grid,
-                                       const GridEntity& entity )
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), grid.getDimensions(), "wrong coordinates" );
-
-         //const CoordinatesType coordinates = entity.getCoordinates();
-         //const CoordinatesType dimensions = grid.getDimensions();
- 
-         return entity.getCoordinates().y() * grid.getDimensions().x() + entity.getCoordinates().x();
-      }
- 
- 
+public:
+   static constexpr int entityDimension = 2;
+
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
+   using IndexType = typename GridType::IndexType;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   // typedef typename GridType::template GridEntity< entityDimension > GridEntity;
+
+   __cuda_callable__
+   inline static GridEntity
+   getEntity( const GridType& grid, const IndexType& index )
+   {
+      TNL_ASSERT_GE( index, 0, "Index must be non-negative." );
+      TNL_ASSERT_LT( index, grid.template getEntitiesCount< GridEntity >(), "Index is out of bounds." );
+
+      const CoordinatesType& dimensions = grid.getDimensions();
+
+      return GridEntity( grid,
+                         CoordinatesType( index % dimensions.x(), index / dimensions.x() ),
+                         typename GridEntity::EntityOrientationType( 0, 0 ),
+                         typename GridEntity::EntityBasisType( 1, 1 ) );
+   }
+
+   __cuda_callable__
+   inline static IndexType
+   getEntityIndex( const GridType& grid, const GridEntity& entity )
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), grid.getDimensions(), "wrong coordinates" );
+
+      // const CoordinatesType coordinates = entity.getCoordinates();
+      // const CoordinatesType dimensions = grid.getDimensions();
+
+      return entity.getCoordinates().y() * grid.getDimensions().x() + entity.getCoordinates().x();
+   }
 };
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
+template< typename Real, typename Device, typename Index, typename GridEntity >
 class GridEntityGetter< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 1 >
 {
-   public:
- 
-      static constexpr 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< entityDimension, EntityConfig > GridEntity;
- 
-      __cuda_callable__ inline
-      static GridEntity getEntity( const GridType& grid,
-                                   const IndexType& index )
-      {
-         TNL_ASSERT_GE( index, 0, "Index must be non-negative." );
-         TNL_ASSERT_LT( index, grid.template getEntitiesCount< GridEntity >(), "Index is out of bounds." );
- 
-         const CoordinatesType dimensions = grid.getDimensions();
-
-         if( index < grid.numberOfNxFaces )
-         {
-            const IndexType aux = dimensions.x() + 1;
-            return GridEntity
-               ( grid,
-                 CoordinatesType( index % aux, index / aux ),
-                 typename GridEntity::EntityOrientationType( 1, 0 ),
-                 typename GridEntity::EntityBasisType( 0, 1 ) );
-         }
-         const IndexType i = index - grid.numberOfNxFaces;
-         const IndexType& aux = dimensions.x();
-         return GridEntity
-            ( grid,
-              CoordinatesType( i % aux, i / aux ),
-              typename GridEntity::EntityOrientationType( 0, 1 ),
-              typename GridEntity::EntityBasisType( 1, 0 ) );
-      }
- 
-      __cuda_callable__ inline
-      static IndexType getEntityIndex( const GridType& grid,
-                                       const GridEntity& entity )
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), grid.getDimensions() + abs( entity.getOrientation() ), "wrong coordinates" );
- 
-         const CoordinatesType coordinates = entity.getCoordinates();
-         const CoordinatesType dimensions = grid.getDimensions();
- 
-         if( entity.getOrientation().x() )
-            return coordinates.y() * ( dimensions.x() + 1 ) + coordinates.x();
-         return grid.numberOfNxFaces + coordinates.y() * dimensions.x() + coordinates.x();
+public:
+   static constexpr int entityDimension = 1;
+
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
+   using IndexType = typename GridType::IndexType;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   // typedef typename GridType::template GridEntity< entityDimension, EntityConfig > GridEntity;
+
+   __cuda_callable__
+   inline static GridEntity
+   getEntity( const GridType& grid, const IndexType& index )
+   {
+      TNL_ASSERT_GE( index, 0, "Index must be non-negative." );
+      TNL_ASSERT_LT( index, grid.template getEntitiesCount< GridEntity >(), "Index is out of bounds." );
+
+      const CoordinatesType dimensions = grid.getDimensions();
+
+      if( index < grid.numberOfNxFaces ) {
+         const IndexType aux = dimensions.x() + 1;
+         return GridEntity( grid,
+                            CoordinatesType( index % aux, index / aux ),
+                            typename GridEntity::EntityOrientationType( 1, 0 ),
+                            typename GridEntity::EntityBasisType( 0, 1 ) );
       }
+      const IndexType i = index - grid.numberOfNxFaces;
+      const IndexType& aux = dimensions.x();
+      return GridEntity( grid,
+                         CoordinatesType( i % aux, i / aux ),
+                         typename GridEntity::EntityOrientationType( 0, 1 ),
+                         typename GridEntity::EntityBasisType( 1, 0 ) );
+   }
+
+   __cuda_callable__
+   inline static IndexType
+   getEntityIndex( const GridType& grid, const GridEntity& entity )
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), grid.getDimensions() + abs( entity.getOrientation() ), "wrong coordinates" );
+
+      const CoordinatesType coordinates = entity.getCoordinates();
+      const CoordinatesType dimensions = grid.getDimensions();
+
+      if( entity.getOrientation().x() )
+         return coordinates.y() * ( dimensions.x() + 1 ) + coordinates.x();
+      return grid.numberOfNxFaces + coordinates.y() * dimensions.x() + coordinates.x();
+   }
 };
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
+template< typename Real, typename Device, typename Index, typename GridEntity >
 class GridEntityGetter< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 0 >
 {
-   public:
- 
-      static constexpr 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< entityDimension > GridEntity;
- 
-      __cuda_callable__ inline
-      static GridEntity getEntity( const GridType& grid,
-                                   const IndexType& index )
-      {
-         TNL_ASSERT_GE( index, 0, "Index must be non-negative." );
-         TNL_ASSERT_LT( index, grid.template getEntitiesCount< GridEntity >(), "Index is out of bounds." );
-
-         const CoordinatesType dimensions = grid.getDimensions();
+public:
+   static constexpr int entityDimension = 0;
 
-         const IndexType aux = dimensions.x() + 1;
-         return GridEntity
-            ( grid,
-              CoordinatesType( index % aux,
-                               index / aux ),
-              typename GridEntity::EntityOrientationType( 0, 0 ),
-              typename GridEntity::EntityBasisType( 0, 0 ) );
-      }
- 
-      __cuda_callable__ inline
-      static IndexType getEntityIndex( const GridType& grid,
-                                       const GridEntity& entity )
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LE( entity.getCoordinates(), grid.getDimensions(), "wrong coordinates" );
- 
-         const CoordinatesType coordinates = entity.getCoordinates();
-         const CoordinatesType dimensions = grid.getDimensions();
- 
-         return coordinates.y() * ( dimensions.x() + 1 ) + coordinates.x();
-      }
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
+   using IndexType = typename GridType::IndexType;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   // typedef typename GridType::template GridEntity< entityDimension > GridEntity;
+
+   __cuda_callable__
+   inline static GridEntity
+   getEntity( const GridType& grid, const IndexType& index )
+   {
+      TNL_ASSERT_GE( index, 0, "Index must be non-negative." );
+      TNL_ASSERT_LT( index, grid.template getEntitiesCount< GridEntity >(), "Index is out of bounds." );
+
+      const CoordinatesType& dimensions = grid.getDimensions();
+
+      const IndexType aux = dimensions.x() + 1;
+      return GridEntity( grid,
+                         CoordinatesType( index % aux, index / aux ),
+                         typename GridEntity::EntityOrientationType( 0, 0 ),
+                         typename GridEntity::EntityBasisType( 0, 0 ) );
+   }
+
+   __cuda_callable__
+   inline static IndexType
+   getEntityIndex( const GridType& grid, const GridEntity& entity )
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LE( entity.getCoordinates(), grid.getDimensions(), "wrong coordinates" );
+
+      const CoordinatesType& coordinates = entity.getCoordinates();
+      const CoordinatesType& dimensions = grid.getDimensions();
+
+      return coordinates.y() * ( dimensions.x() + 1 ) + coordinates.x();
+   }
 };
 
 /****
  * 3D grid
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
+template< typename Real, typename Device, typename Index, typename GridEntity >
 class GridEntityGetter< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 3 >
 {
-   public:
- 
-      static constexpr 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< entityDimension > GridEntity;
- 
-      __cuda_callable__ inline
-      static GridEntity getEntity( const GridType& grid,
-                                   const IndexType& index )
-      {
-         TNL_ASSERT_GE( index, 0, "Index must be non-negative." );
-         TNL_ASSERT_LT( index, grid.template getEntitiesCount< GridEntity >(), "Index is out of bounds." );
-
-         const CoordinatesType dimensions = grid.getDimensions();
-
-         return GridEntity
-            ( grid,
-              CoordinatesType( index % dimensions.x(),
-                               ( index / dimensions.x() ) % dimensions.y(),
-                               index / ( dimensions.x() * dimensions.y() ) ),
-              typename GridEntity::EntityOrientationType( 0, 0, 0 ),
-              typename GridEntity::EntityBasisType( 1, 1, 1 ) );
-      }
- 
-      __cuda_callable__ inline
-      static IndexType getEntityIndex( const GridType& grid,
-                                       const GridEntity& entity )
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), grid.getDimensions(), "wrong coordinates" );
-
-         const CoordinatesType coordinates = entity.getCoordinates();
-         const CoordinatesType dimensions = grid.getDimensions();
- 
-         return ( coordinates.z() * dimensions.y() + coordinates.y() ) *
-            dimensions.x() + coordinates.x();
-      }
+public:
+   static constexpr int entityDimension = 3;
+
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   using IndexType = typename GridType::IndexType;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   // typedef typename GridType::template GridEntity< entityDimension > GridEntity;
+
+   __cuda_callable__
+   inline static GridEntity
+   getEntity( const GridType& grid, const IndexType& index )
+   {
+      TNL_ASSERT_GE( index, 0, "Index must be non-negative." );
+      TNL_ASSERT_LT( index, grid.template getEntitiesCount< GridEntity >(), "Index is out of bounds." );
+
+      const CoordinatesType& dimensions = grid.getDimensions();
+
+      return GridEntity( grid,
+                         CoordinatesType( index % dimensions.x(),
+                                          ( index / dimensions.x() ) % dimensions.y(),
+                                          index / ( dimensions.x() * dimensions.y() ) ),
+                         typename GridEntity::EntityOrientationType( 0, 0, 0 ),
+                         typename GridEntity::EntityBasisType( 1, 1, 1 ) );
+   }
+
+   __cuda_callable__
+   inline static IndexType
+   getEntityIndex( const GridType& grid, const GridEntity& entity )
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), grid.getDimensions(), "wrong coordinates" );
+
+      const CoordinatesType& coordinates = entity.getCoordinates();
+      const CoordinatesType& dimensions = grid.getDimensions();
+
+      return ( coordinates.z() * dimensions.y() + coordinates.y() ) * dimensions.x() + coordinates.x();
+   }
 };
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
+template< typename Real, typename Device, typename Index, typename GridEntity >
 class GridEntityGetter< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 2 >
 {
-   public:
- 
-      static constexpr 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< entityDimension > GridEntity;
- 
-      __cuda_callable__ inline
-      static GridEntity getEntity( const GridType& grid,
-                                   const IndexType& index )
-      {
-         TNL_ASSERT_GE( index, 0, "Index must be non-negative." );
-         TNL_ASSERT_LT( index, grid.template getEntitiesCount< GridEntity >(), "Index is out of bounds." );
-
-         const CoordinatesType dimensions = grid.getDimensions();
- 
-         if( index < grid.numberOfNxFaces )
-         {
-            const IndexType aux = dimensions.x() + 1;
-            return GridEntity
-               ( grid,
-                 CoordinatesType( index % aux,
-                                  ( index / aux ) % dimensions.y(),
-                                  index / ( aux * dimensions.y() ) ),
-                 typename GridEntity::EntityOrientationType( 1, 0, 0 ),
-                 typename GridEntity::EntityBasisType( 0, 1, 1 ) );
-         }
-         if( index < grid.numberOfNxAndNyFaces )
-         {
-            const IndexType i = index - grid.numberOfNxFaces;
-            const IndexType aux = dimensions.y() + 1;
-            return GridEntity
-               ( grid,
-                 CoordinatesType( i % dimensions.x(),
-                                  ( i / dimensions.x() ) % aux,
-                                  i / ( aux * dimensions.x() ) ),
-                 typename GridEntity::EntityOrientationType( 0, 1, 0 ),
-                 typename GridEntity::EntityBasisType( 1, 0, 1 ) );
-         }
-         const IndexType i = index - grid.numberOfNxAndNyFaces;
-         return GridEntity
-            ( grid,
-              CoordinatesType( i % dimensions.x(),
-                               ( i / dimensions.x() ) % dimensions.y(),
-                               i / ( dimensions.x() * dimensions.y() ) ),
-              typename GridEntity::EntityOrientationType( 0, 0, 1 ),
-              typename GridEntity::EntityBasisType( 1, 1, 0 ) );
+public:
+   static constexpr int entityDimension = 2;
+
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   using IndexType = typename GridType::IndexType;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   // typedef typename GridType::template GridEntity< entityDimension > GridEntity;
+
+   __cuda_callable__
+   inline static GridEntity
+   getEntity( const GridType& grid, const IndexType& index )
+   {
+      TNL_ASSERT_GE( index, 0, "Index must be non-negative." );
+      TNL_ASSERT_LT( index, grid.template getEntitiesCount< GridEntity >(), "Index is out of bounds." );
+
+      const CoordinatesType dimensions = grid.getDimensions();
+
+      if( index < grid.numberOfNxFaces ) {
+         const IndexType aux = dimensions.x() + 1;
+         return GridEntity( grid,
+                            CoordinatesType( index % aux, ( index / aux ) % dimensions.y(), index / ( aux * dimensions.y() ) ),
+                            typename GridEntity::EntityOrientationType( 1, 0, 0 ),
+                            typename GridEntity::EntityBasisType( 0, 1, 1 ) );
+      }
+      if( index < grid.numberOfNxAndNyFaces ) {
+         const IndexType i = index - grid.numberOfNxFaces;
+         const IndexType aux = dimensions.y() + 1;
+         return GridEntity( grid,
+                            CoordinatesType( i % dimensions.x(), ( i / dimensions.x() ) % aux, i / ( aux * dimensions.x() ) ),
+                            typename GridEntity::EntityOrientationType( 0, 1, 0 ),
+                            typename GridEntity::EntityBasisType( 1, 0, 1 ) );
+      }
+      const IndexType i = index - grid.numberOfNxAndNyFaces;
+      return GridEntity( grid,
+                         CoordinatesType( i % dimensions.x(),
+                                          ( i / dimensions.x() ) % dimensions.y(),
+                                          i / ( dimensions.x() * dimensions.y() ) ),
+                         typename GridEntity::EntityOrientationType( 0, 0, 1 ),
+                         typename GridEntity::EntityBasisType( 1, 1, 0 ) );
+   }
+
+   __cuda_callable__
+   inline static IndexType
+   getEntityIndex( const GridType& grid, const GridEntity& entity )
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), grid.getDimensions() + abs( entity.getOrientation() ), "wrong coordinates" );
+
+      const CoordinatesType coordinates = entity.getCoordinates();
+      const CoordinatesType dimensions = grid.getDimensions();
+
+      if( entity.getOrientation().x() ) {
+         return ( coordinates.z() * dimensions.y() + coordinates.y() ) * ( dimensions.x() + 1 ) + coordinates.x();
       }
- 
-      __cuda_callable__ inline
-      static IndexType getEntityIndex( const GridType& grid,
-                                       const GridEntity& entity )
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), grid.getDimensions() + abs( entity.getOrientation() ), "wrong coordinates" );
- 
-         const CoordinatesType coordinates = entity.getCoordinates();
-         const CoordinatesType dimensions = grid.getDimensions();
-
- 
-         if( entity.getOrientation().x() )
-         {
-            return ( coordinates.z() * dimensions.y() + coordinates.y() ) *
-               ( dimensions.x() + 1 ) + coordinates.x();
-         }
-         if( entity.getOrientation().y() )
-         {
-            return grid.numberOfNxFaces +
-               ( coordinates.z() * ( dimensions.y() + 1 ) + coordinates.y() ) *
-               dimensions.x() + coordinates.x();
-         }
-         return grid.numberOfNxAndNyFaces +
-            ( coordinates.z() * dimensions.y() + coordinates.y() ) *
-            dimensions.x() + coordinates.x();
+      if( entity.getOrientation().y() ) {
+         return grid.numberOfNxFaces + ( coordinates.z() * ( dimensions.y() + 1 ) + coordinates.y() ) * dimensions.x()
+              + coordinates.x();
       }
+      return grid.numberOfNxAndNyFaces + ( coordinates.z() * dimensions.y() + coordinates.y() ) * dimensions.x()
+           + coordinates.x();
+   }
 };
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
+template< typename Real, typename Device, typename Index, typename GridEntity >
 class GridEntityGetter< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 1 >
 {
-   public:
- 
-      static constexpr 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< entityDimension > GridEntity;
- 
-      __cuda_callable__ inline
-      static GridEntity getEntity( const GridType& grid,
-                                   const IndexType& index )
-      {
-         TNL_ASSERT_GE( index, 0, "Index must be non-negative." );
-         TNL_ASSERT_LT( index, grid.template getEntitiesCount< GridEntity >(), "Index is out of bounds." );
- 
-         const CoordinatesType dimensions = grid.getDimensions();
-
-         if( index < grid.numberOfDxEdges )
-         {
-            const IndexType aux = dimensions.y() + 1;
-            return GridEntity
-               ( grid,
-                 CoordinatesType( index % dimensions.x(),
-                                  ( index / dimensions.x() ) % aux,
-                                  index / ( dimensions.x() * aux ) ),
-                 typename GridEntity::EntityOrientationType( 0, 0, 0 ),
-                 typename GridEntity::EntityBasisType( 1, 0, 0 ) );
-
-         }
-         if( index < grid.numberOfDxAndDyEdges )
-         {
-            const IndexType i = index - grid.numberOfDxEdges;
-            const IndexType aux = dimensions.x() + 1;
-            return GridEntity
-               ( grid,
-                 CoordinatesType( i % aux,
-                                  ( i / aux ) % dimensions.y(),
-                                  i / ( aux * dimensions.y() ) ),
-                 typename GridEntity::EntityOrientationType( 0, 0, 0 ),
-                 typename GridEntity::EntityBasisType( 0, 1, 0 ) );
-         }
-         const IndexType i = index - grid.numberOfDxAndDyEdges;
-         const IndexType aux1 = dimensions.x() + 1;
-         const IndexType aux2 = dimensions.y() + 1;
-         return GridEntity
-            ( grid,
-              CoordinatesType( i % aux1,
-                               ( i / aux1 ) % aux2,
-                               i / ( aux1 * aux2 ) ),
-              typename GridEntity::EntityOrientationType( 0, 0, 0 ),
-              typename GridEntity::EntityBasisType( 0, 0, 1 ) );
-      }
- 
-      __cuda_callable__ inline
-      static IndexType getEntityIndex( const GridType& grid,
-                                       const GridEntity& entity )
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(),
-                        grid.getDimensions() + CoordinatesType( 1, 1, 1 ) - entity.getBasis(),
-                        "wrong coordinates" );
- 
-         const CoordinatesType coordinates = entity.getCoordinates();
-         const CoordinatesType dimensions = grid.getDimensions();
- 
-         if( entity.getBasis().x() )
-            return ( coordinates.z() * ( dimensions.y() + 1 ) +
-                     coordinates.y() ) * dimensions.x() + coordinates.x();
-         if( entity.getBasis().y() )
-            return grid.numberOfDxEdges +
-               ( coordinates.z() * dimensions.y() + coordinates.y() ) * ( dimensions.x() + 1 ) +
-               coordinates.x();
-         return grid.numberOfDxAndDyEdges +
-            ( coordinates.z() * ( dimensions.y() + 1 ) + coordinates.y() ) * ( dimensions.x() + 1 ) +
-            coordinates.x();
+public:
+   static constexpr int entityDimension = 1;
+
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   using IndexType = typename GridType::IndexType;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   // typedef typename GridType::template GridEntity< entityDimension > GridEntity;
+
+   __cuda_callable__
+   inline static GridEntity
+   getEntity( const GridType& grid, const IndexType& index )
+   {
+      TNL_ASSERT_GE( index, 0, "Index must be non-negative." );
+      TNL_ASSERT_LT( index, grid.template getEntitiesCount< GridEntity >(), "Index is out of bounds." );
 
+      const CoordinatesType dimensions = grid.getDimensions();
+
+      if( index < grid.numberOfDxEdges ) {
+         const IndexType aux = dimensions.y() + 1;
+         return GridEntity(
+            grid,
+            CoordinatesType( index % dimensions.x(), ( index / dimensions.x() ) % aux, index / ( dimensions.x() * aux ) ),
+            typename GridEntity::EntityOrientationType( 0, 0, 0 ),
+            typename GridEntity::EntityBasisType( 1, 0, 0 ) );
       }
+      if( index < grid.numberOfDxAndDyEdges ) {
+         const IndexType i = index - grid.numberOfDxEdges;
+         const IndexType aux = dimensions.x() + 1;
+         return GridEntity( grid,
+                            CoordinatesType( i % aux, ( i / aux ) % dimensions.y(), i / ( aux * dimensions.y() ) ),
+                            typename GridEntity::EntityOrientationType( 0, 0, 0 ),
+                            typename GridEntity::EntityBasisType( 0, 1, 0 ) );
+      }
+      const IndexType i = index - grid.numberOfDxAndDyEdges;
+      const IndexType aux1 = dimensions.x() + 1;
+      const IndexType aux2 = dimensions.y() + 1;
+      return GridEntity( grid,
+                         CoordinatesType( i % aux1, ( i / aux1 ) % aux2, i / ( aux1 * aux2 ) ),
+                         typename GridEntity::EntityOrientationType( 0, 0, 0 ),
+                         typename GridEntity::EntityBasisType( 0, 0, 1 ) );
+   }
+
+   __cuda_callable__
+   inline static IndexType
+   getEntityIndex( const GridType& grid, const GridEntity& entity )
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT(
+         entity.getCoordinates(), grid.getDimensions() + CoordinatesType( 1, 1, 1 ) - entity.getBasis(), "wrong coordinates" );
+
+      const CoordinatesType coordinates = entity.getCoordinates();
+      const CoordinatesType dimensions = grid.getDimensions();
+
+      if( entity.getBasis().x() )
+         return ( coordinates.z() * ( dimensions.y() + 1 ) + coordinates.y() ) * dimensions.x() + coordinates.x();
+      if( entity.getBasis().y() )
+         return grid.numberOfDxEdges + ( coordinates.z() * dimensions.y() + coordinates.y() ) * ( dimensions.x() + 1 )
+              + coordinates.x();
+      return grid.numberOfDxAndDyEdges + ( coordinates.z() * ( dimensions.y() + 1 ) + coordinates.y() ) * ( dimensions.x() + 1 )
+           + coordinates.x();
+   }
 };
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
+template< typename Real, typename Device, typename Index, typename GridEntity >
 class GridEntityGetter< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 0 >
 {
-   public:
- 
-      static constexpr 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< entityDimension > GridEntity;
- 
-      __cuda_callable__ inline
-      static GridEntity getEntity( const GridType& grid,
-                                   const IndexType& index )
-      {
-         TNL_ASSERT_GE( index, 0, "Index must be non-negative." );
-         TNL_ASSERT_LT( index, grid.template getEntitiesCount< GridEntity >(), "Index is out of bounds." );
-
-         const CoordinatesType dimensions = grid.getDimensions();
- 
-         const IndexType auxX = dimensions.x() + 1;
-         const IndexType auxY = dimensions.y() + 1;
-         return GridEntity
-            ( grid,
-              CoordinatesType( index % auxX,
-                               ( index / auxX ) % auxY,
-                               index / ( auxX * auxY ) ),
-              typename GridEntity::EntityOrientationType( 0, 0, 0 ),
-              typename GridEntity::EntityBasisType( 0, 0, 0 ) );
-      }
- 
-      __cuda_callable__ inline
-      static IndexType getEntityIndex( const GridType& grid,
-                                       const GridEntity& entity )
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LE( entity.getCoordinates(), grid.getDimensions(), "wrong coordinates" );
- 
-         const CoordinatesType coordinates = entity.getCoordinates();
-         const CoordinatesType dimensions = grid.getDimensions();
- 
-         return ( coordinates.z() * ( dimensions.y() + 1 ) + coordinates.y() ) *
-                ( dimensions.x() + 1 ) +
-                coordinates.x();
-      }
+public:
+   static constexpr int entityDimension = 0;
+
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   using IndexType = typename GridType::IndexType;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   // typedef typename GridType::template GridEntity< entityDimension > GridEntity;
+
+   __cuda_callable__
+   inline static GridEntity
+   getEntity( const GridType& grid, const IndexType& index )
+   {
+      TNL_ASSERT_GE( index, 0, "Index must be non-negative." );
+      TNL_ASSERT_LT( index, grid.template getEntitiesCount< GridEntity >(), "Index is out of bounds." );
+
+      const CoordinatesType& dimensions = grid.getDimensions();
+
+      const IndexType auxX = dimensions.x() + 1;
+      const IndexType auxY = dimensions.y() + 1;
+      return GridEntity( grid,
+                         CoordinatesType( index % auxX, ( index / auxX ) % auxY, index / ( auxX * auxY ) ),
+                         typename GridEntity::EntityOrientationType( 0, 0, 0 ),
+                         typename GridEntity::EntityBasisType( 0, 0, 0 ) );
+   }
+
+   __cuda_callable__
+   inline static IndexType
+   getEntityIndex( const GridType& grid, const GridEntity& entity )
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LE( entity.getCoordinates(), grid.getDimensions(), "wrong coordinates" );
+
+      const CoordinatesType& coordinates = entity.getCoordinates();
+      const CoordinatesType& dimensions = grid.getDimensions();
+
+      return ( coordinates.z() * ( dimensions.y() + 1 ) + coordinates.y() ) * ( dimensions.x() + 1 ) + coordinates.x();
+   }
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/GridDetails/GridEntityMeasureGetter.h b/src/TNL/Meshes/GridDetails/GridEntityMeasureGetter.h
index c9d132557adf1b9ee4a50529ec7dd9bc9ceb16cd..539c6e247db04fcff32f5ed75a0825cbcf0853a6 100644
--- a/src/TNL/Meshes/GridDetails/GridEntityMeasureGetter.h
+++ b/src/TNL/Meshes/GridDetails/GridEntityMeasureGetter.h
@@ -9,165 +9,140 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename Grid,
-          int EntityDimension >
+template< typename Grid, int EntityDimension >
 class GridEntityMeasureGetter
-{
-};
+{};
 
 /***
  * Common implementation for vertices
  */
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index >
+template< int Dimension, typename Real, typename Device, typename Index >
 class GridEntityMeasureGetter< Meshes::Grid< Dimension, Real, Device, Index >, 0 >
 {
-   public:
- 
-      typedef Meshes::Grid< Dimension, Real, Device, Index > GridType;
- 
-      template< typename EntityType >
-      __cuda_callable__ inline
-      static const Real getMeasure( const GridType& grid,
-                                     const EntityType& entity )
-      {
-         return 0.0;
-      }
+public:
+   using GridType = Meshes::Grid< Dimension, Real, Device, Index >;
+
+   template< typename EntityType >
+   __cuda_callable__
+   inline static Real
+   getMeasure( const GridType& grid, const EntityType& entity )
+   {
+      return 0.0;
+   }
 };
 
 /****
  * 1D grid
  */
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 class GridEntityMeasureGetter< Meshes::Grid< 1, Real, Device, Index >, 1 >
 {
-   public:
- 
-      typedef Meshes::Grid< 1, Real, Device, Index > GridType;
- 
-      template< typename EntityType >
-      __cuda_callable__ inline
-      static const Real& getMeasure( const GridType& grid,
-                                     const EntityType& entity )
-      {
-         return grid.template getSpaceStepsProducts< 1 >();
-      }
+public:
+   using GridType = Meshes::Grid< 1, Real, Device, Index >;
+
+   template< typename EntityType >
+   __cuda_callable__
+   inline static const Real&
+   getMeasure( const GridType& grid, const EntityType& entity )
+   {
+      return grid.template getSpaceStepsProducts< 1 >();
+   }
 };
 
 /****
  * 2D grid
  */
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 class GridEntityMeasureGetter< Meshes::Grid< 2, Real, Device, Index >, 2 >
 {
-   public:
- 
-      typedef Meshes::Grid< 2, Real, Device, Index > GridType;
- 
-      template< typename EntityType >
-      __cuda_callable__ inline
-      static const Real& getMeasure( const GridType& grid,
-                                     const EntityType& entity )
-      {
-         return grid.template getSpaceStepsProducts< 1, 1 >();
-      }
+public:
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
+
+   template< typename EntityType >
+   __cuda_callable__
+   inline static const Real&
+   getMeasure( const GridType& grid, const EntityType& entity )
+   {
+      return grid.template getSpaceStepsProducts< 1, 1 >();
+   }
 };
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 class GridEntityMeasureGetter< Meshes::Grid< 2, Real, Device, Index >, 1 >
 {
-   public:
- 
-      typedef Meshes::Grid< 2, Real, Device, Index > GridType;
- 
-      template< typename EntityType >
-      __cuda_callable__ inline
-      static const Real& getMeasure( const GridType& grid,
-                                     const EntityType& entity )
-      {
-         if( entity.getOrientation().x() )
-            return grid.template getSpaceStepsProducts< 0, 1 >();
-         else
-            return grid.template getSpaceStepsProducts< 1, 0 >();
-      }
+public:
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
+
+   template< typename EntityType >
+   __cuda_callable__
+   inline static const Real&
+   getMeasure( const GridType& grid, const EntityType& entity )
+   {
+      if( entity.getOrientation().x() )
+         return grid.template getSpaceStepsProducts< 0, 1 >();
+      else
+         return grid.template getSpaceStepsProducts< 1, 0 >();
+   }
 };
 
 /****
  * 3D grid
  */
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 class GridEntityMeasureGetter< Meshes::Grid< 3, Real, Device, Index >, 3 >
 {
-   public:
- 
-      typedef Meshes::Grid< 3, Real, Device, Index > GridType;
- 
-      template< typename EntityType >
-      __cuda_callable__ inline
-      static const Real& getMeasure( const GridType& grid,
-                                     const EntityType& entity )
-      {
-         return grid.template getSpaceStepsProducts< 1, 1, 1 >();
-      }
+public:
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+
+   template< typename EntityType >
+   __cuda_callable__
+   inline static const Real&
+   getMeasure( const GridType& grid, const EntityType& entity )
+   {
+      return grid.template getSpaceStepsProducts< 1, 1, 1 >();
+   }
 };
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 class GridEntityMeasureGetter< Meshes::Grid< 3, Real, Device, Index >, 2 >
 {
-   public:
- 
-      typedef Meshes::Grid< 3, Real, Device, Index > GridType;
- 
-      template< typename EntityType >
-      __cuda_callable__ inline
-      static const Real& getMeasure( const GridType& grid,
-                                     const EntityType& entity )
-      {
-         if( entity.getOrientation().x() )
-            return grid.template getSpaceStepsProducts< 0, 1, 1 >();
-         if( entity.getOrientation().y() )
-            return grid.template getSpaceStepsProducts< 1, 0, 1 >();
-         else
-            return grid.template getSpaceStepsProducts< 1, 1, 0 >();
-      }
+public:
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+
+   template< typename EntityType >
+   __cuda_callable__
+   inline static const Real&
+   getMeasure( const GridType& grid, const EntityType& entity )
+   {
+      if( entity.getOrientation().x() )
+         return grid.template getSpaceStepsProducts< 0, 1, 1 >();
+      if( entity.getOrientation().y() )
+         return grid.template getSpaceStepsProducts< 1, 0, 1 >();
+      else
+         return grid.template getSpaceStepsProducts< 1, 1, 0 >();
+   }
 };
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 class GridEntityMeasureGetter< Meshes::Grid< 3, Real, Device, Index >, 1 >
 {
-   public:
- 
-      typedef Meshes::Grid< 3, Real, Device, Index > GridType;
- 
-      template< typename EntityType >
-      __cuda_callable__ inline
-      static const Real& getMeasure( const GridType& grid,
-                                     const EntityType& entity )
-      {
-         if( entity.getBasis().x() )
-            return grid.template getSpaceStepsProducts< 1, 0, 0 >();
-         if( entity.getBasis().y() )
-            return grid.template getSpaceStepsProducts< 0, 1, 0 >();
-         else
-            return grid.template getSpaceStepsProducts< 0, 0, 1 >();
-      }
-};
+public:
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
 
-} // namespace Meshes
-} // namespace TNL
+   template< typename EntityType >
+   __cuda_callable__
+   inline static const Real&
+   getMeasure( const GridType& grid, const EntityType& entity )
+   {
+      if( entity.getBasis().x() )
+         return grid.template getSpaceStepsProducts< 1, 0, 0 >();
+      if( entity.getBasis().y() )
+         return grid.template getSpaceStepsProducts< 0, 1, 0 >();
+      else
+         return grid.template getSpaceStepsProducts< 0, 0, 1 >();
+   }
+};
 
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/GridDetails/GridEntityTopology.h b/src/TNL/Meshes/GridDetails/GridEntityTopology.h
index 0cf52b3e9460e9ca28a5027fac6828edf75c6ccb..3f4d0baaec08e9df184dbcd0502a18f69e8cd3d1 100644
--- a/src/TNL/Meshes/GridDetails/GridEntityTopology.h
+++ b/src/TNL/Meshes/GridDetails/GridEntityTopology.h
@@ -9,30 +9,24 @@
 namespace TNL {
 namespace Meshes {
 
-
-template< typename Grid,
-          int EntityDimension,
-          typename EntityOrientation_,
-          typename EntityProportions_ >
+template< typename Grid, int EntityDimension, typename EntityOrientation_, typename EntityProportions_ >
 class GridEntityTopology
 {
-   public:
- 
-      typedef Grid GridType;
- 
-      static constexpr int meshDimension = GridType::getMeshDimension();
- 
-      static constexpr int entityDimension = EntityDimension;
- 
-      typedef EntityOrientation_ EntityOrientation;
- 
-      typedef EntityProportions_ EntityProportions;
- 
-      // TODO: restore when CUDA allows it
-   //static_assert( meshDimension == EntityOrientation_::size,
-   //               "Entity orientation is not a proper static multiindex." );
-};
+public:
+   using GridType = Grid;
+
+   static constexpr int meshDimension = GridType::getMeshDimension();
+
+   static constexpr int entityDimension = EntityDimension;
 
-} // namespace Meshes
-} // namespace TNL
+   using EntityOrientation = EntityOrientation_;
+
+   using EntityProportions = EntityProportions_;
+
+   // TODO: restore when CUDA allows it
+   // static_assert( meshDimension == EntityOrientation_::size,
+   //                "Entity orientation is not a proper static multiindex." );
+};
 
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/GridDetails/GridEntity_impl.h b/src/TNL/Meshes/GridDetails/GridEntity_impl.h
index 6b2facfb77c5fd7a356c8be0865b5d2454edc741..6fdb0a85f886ecf1bae952a8582576e670d6d805 100644
--- a/src/TNL/Meshes/GridDetails/GridEntity_impl.h
+++ b/src/TNL/Meshes/GridDetails/GridEntity_impl.h
@@ -4,7 +4,6 @@
 //
 // SPDX-License-Identifier: MIT
 
-
 #pragma once
 
 #include <TNL/Meshes/GridDetails/BoundaryGridEntityChecker.h>
@@ -26,248 +25,145 @@ GridEntity()
 {
 }*/
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          int EntityDimension,
-          typename Config >
-__cuda_callable__ inline
-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 ),
+template< int Dimension, typename Real, typename Device, typename Index, int EntityDimension, typename Config >
+__cuda_callable__
+inline 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 ), neighborEntitiesStorage( *this )
+{}
+
+template< int Dimension, typename Real, typename Device, typename Index, int EntityDimension, typename Config >
+__cuda_callable__
+inline 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 )
+: grid( grid ), entityIndex( -1 ), coordinates( coordinates ), orientation( orientation ), basis( basis ),
   neighborEntitiesStorage( *this )
-{
-}
+{}
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          int EntityDimension,
-          typename Config >
-__cuda_callable__ inline
-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 )
-: grid( grid ),
-  entityIndex( -1 ),
-  coordinates( coordinates ),
-  orientation( orientation ),
-  basis( basis ),
-  neighborEntitiesStorage( *this )
-{
-}
-
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          int EntityDimension,
-          typename Config >
-__cuda_callable__ inline
-const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::CoordinatesType&
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::
-getCoordinates() const
+template< int Dimension, typename Real, typename Device, typename Index, int EntityDimension, typename Config >
+__cuda_callable__
+inline 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 Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          int EntityDimension,
-          typename Config >
-__cuda_callable__ inline
-typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::CoordinatesType&
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::
-getCoordinates()
+template< int Dimension, typename Real, typename Device, typename Index, int EntityDimension, typename Config >
+__cuda_callable__
+inline 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 Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          int EntityDimension,
-          typename Config >
-__cuda_callable__ inline
-void
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::
-setCoordinates( const CoordinatesType& coordinates )
+template< int Dimension, typename Real, typename Device, typename Index, int EntityDimension, typename Config >
+__cuda_callable__
+inline void
+GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::setCoordinates(
+   const CoordinatesType& coordinates )
 {
    this->coordinates = coordinates;
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          int EntityDimension,
-          typename Config >
-__cuda_callable__ inline
-void
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::
-refresh()
+template< int Dimension, typename Real, typename Device, typename Index, int EntityDimension, typename Config >
+__cuda_callable__
+inline void
+GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::refresh()
 {
    this->entityIndex = this->grid.getEntityIndex( *this );
    this->neighborEntitiesStorage.refresh( this->grid, this->entityIndex );
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          int EntityDimension,
-          typename Config >
-__cuda_callable__ inline
-Index
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::
-getIndex() const
+template< int Dimension, typename Real, typename Device, typename Index, int EntityDimension, typename Config >
+__cuda_callable__
+inline Index
+GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::getIndex() const
 {
-   typedef Meshes::Grid< Dimension, Real, Device, Index > GridType;
-   typedef typename GridType::template EntityType< EntityDimension > EntityType;
+   using GridType = Meshes::Grid< Dimension, Real, Device, Index >;
+   using EntityType = typename GridType::template EntityType< EntityDimension >;
    TNL_ASSERT_GE( this->entityIndex, 0, "Entity index is not non-negative." );
-   TNL_ASSERT_LT( this->entityIndex, grid.template getEntitiesCount< EntityDimension >(),
-                  "Entity index is out of bounds." );
-   TNL_ASSERT_EQ( this->entityIndex, grid.getEntityIndex( *this ),
-                  "Wrong value of stored index." );
+   TNL_ASSERT_LT( this->entityIndex, grid.template getEntitiesCount< EntityDimension >(), "Entity index is out of bounds." );
+   TNL_ASSERT_EQ( this->entityIndex, grid.getEntityIndex( *this ), "Wrong value of stored index." );
    return this->entityIndex;
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          int EntityDimension,
-          typename Config >
-__cuda_callable__ inline
-const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::EntityOrientationType&
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::
-getOrientation() const
+template< int Dimension, typename Real, typename Device, typename Index, int EntityDimension, typename Config >
+__cuda_callable__
+inline 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 Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          int EntityDimension,
-          typename Config >
-__cuda_callable__ inline
-void
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::
-setOrientation( const EntityOrientationType& orientation )
+template< int Dimension, typename Real, typename Device, typename Index, int EntityDimension, typename Config >
+__cuda_callable__
+inline void
+GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::setOrientation(
+   const EntityOrientationType& orientation )
 {
    this->orientation = orientation;
    this->basis = EntityBasisType( 1 ) - abs( orientation );
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          int EntityDimension,
-          typename Config >
-__cuda_callable__ inline
-const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::EntityBasisType&
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::
-getBasis() const
+template< int Dimension, typename Real, typename Device, typename Index, int EntityDimension, typename Config >
+__cuda_callable__
+inline 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 Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          int EntityDimension,
-          typename Config >
-__cuda_callable__ inline
-void
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::
-setBasis( const EntityBasisType& basis )
+template< int Dimension, typename Real, typename Device, typename Index, int EntityDimension, typename Config >
+__cuda_callable__
+inline void
+GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::setBasis( const EntityBasisType& basis )
 {
    this->basis = basis;
    this->orientation = EntityOrientationType( 1 ) - abs( basis );
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          int EntityDimension,
-          typename Config >
-   template< int NeighborEntityDimension >
-__cuda_callable__ inline
-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
+template< int Dimension, typename Real, typename Device, typename Index, int EntityDimension, typename Config >
+template< int NeighborEntityDimension >
+__cuda_callable__
+inline 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 neighborEntitiesStorage.template getNeighborEntities< NeighborEntityDimension >();
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          int EntityDimension,
-          typename Config >
-__cuda_callable__ inline
-bool
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::
-isBoundaryEntity() const
+template< int Dimension, typename Real, typename Device, typename Index, int EntityDimension, typename Config >
+__cuda_callable__
+inline bool
+GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::isBoundaryEntity() const
 {
    return BoundaryGridEntityChecker< GridEntity >::isBoundaryEntity( *this );
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          int EntityDimension,
-          typename Config >
-__cuda_callable__ inline
-typename Meshes::Grid< Dimension, Real, Device, Index >::PointType
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::
-getCenter() const
+template< int Dimension, typename Real, typename Device, typename Index, int EntityDimension, typename Config >
+__cuda_callable__
+inline typename Meshes::Grid< Dimension, Real, Device, Index >::PointType
+GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::getCenter() const
 {
    return GridEntityCenterGetter< GridEntity >::getEntityCenter( *this );
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          int EntityDimension,
-          typename Config >
-__cuda_callable__ inline
-const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::RealType&
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::
-getMeasure() const
+template< int Dimension, typename Real, typename Device, typename Index, int EntityDimension, typename Config >
+__cuda_callable__
+inline 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, EntityDimension >::getMeasure( this->getMesh(), *this );
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          int EntityDimension,
-          typename Config >
-__cuda_callable__ inline
-const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::GridType&
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >::
-getMesh() const
+template< int Dimension, typename Real, typename Device, typename Index, int EntityDimension, typename Config >
+__cuda_callable__
+inline 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;
 }
@@ -285,445 +181,273 @@ GridEntity()
 {
 }*/
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::
-GridEntity( const GridType& grid )
-: grid( grid ),
-  entityIndex( -1 ),
-  neighborEntitiesStorage( *this )
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::GridEntity( const GridType& grid )
+: grid( grid ), entityIndex( -1 ), neighborEntitiesStorage( *this )
 {
-   this->coordinates = CoordinatesType( ( Index ) 0 );
+   this->coordinates = CoordinatesType( (Index) 0 );
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::
-GridEntity( const GridType& grid,
-               const CoordinatesType& coordinates,
-               const EntityOrientationType& orientation,
-               const EntityBasisType& basis )
-: grid( grid ),
-  entityIndex( -1 ),
-  coordinates( coordinates ),
-  neighborEntitiesStorage( *this )
-{
-}
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::GridEntity(
+   const GridType& grid,
+   const CoordinatesType& coordinates,
+   const EntityOrientationType& orientation,
+   const EntityBasisType& basis )
+: grid( grid ), entityIndex( -1 ), coordinates( coordinates ), neighborEntitiesStorage( *this )
+{}
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::CoordinatesType&
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::
-getCoordinates() const
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline 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 Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::CoordinatesType&
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::
-getCoordinates()
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline 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 Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-void
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::
-setCoordinates( const CoordinatesType& coordinates )
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline void
+GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::setCoordinates(
+   const CoordinatesType& coordinates )
 {
    this->coordinates = coordinates;
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-void
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::
-refresh()
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline void
+GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::refresh()
 {
    this->entityIndex = this->grid.getEntityIndex( *this );
    this->neighborEntitiesStorage.refresh( this->grid, this->entityIndex );
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-Index
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::
-getIndex() const
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline Index
+GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::getIndex() const
 {
    TNL_ASSERT_GE( this->entityIndex, 0, "Entity index is not non-negative." );
-   TNL_ASSERT_LT( this->entityIndex, grid.template getEntitiesCount< Dimension >(),
-                  "Entity index is out of bounds." );
-   TNL_ASSERT_EQ( this->entityIndex, grid.getEntityIndex( *this ),
-                  "Wrong value of stored index." );
+   TNL_ASSERT_LT( this->entityIndex, grid.template getEntitiesCount< Dimension >(), "Entity index is out of bounds." );
+   TNL_ASSERT_EQ( this->entityIndex, grid.getEntityIndex( *this ), "Wrong value of stored index." );
    return this->entityIndex;
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::EntityOrientationType
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::
-getOrientation() const
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline 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 );
+   return EntityOrientationType( (IndexType) 0 );
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::EntityBasisType
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::
-getBasis() const
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline 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 );
+   return EntityBasisType( (IndexType) 1 );
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-   template< int NeighborEntityDimension >
-__cuda_callable__ inline
-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
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+template< int NeighborEntityDimension >
+__cuda_callable__
+inline 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 neighborEntitiesStorage.template getNeighborEntities< NeighborEntityDimension >();
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-bool
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::
-isBoundaryEntity() const
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline bool
+GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::isBoundaryEntity() const
 {
    return BoundaryGridEntityChecker< GridEntity >::isBoundaryEntity( *this );
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-typename Meshes::Grid< Dimension, Real, Device, Index >::PointType
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::
-getCenter() const
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline typename Meshes::Grid< Dimension, Real, Device, Index >::PointType
+GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::getCenter() const
 {
    return GridEntityCenterGetter< GridEntity >::getEntityCenter( *this );
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::RealType&
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::
-getMeasure() const
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline 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 Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::PointType&
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::
-getEntityProportions() const
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline 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 Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::GridType&
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >::
-getMesh() const
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline 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;
 }
 
-
 /****
  * Specialization for vertices
  */
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::
-GridEntity( const GridType& grid )
- : grid( grid ),
-   entityIndex( -1 ),
-   coordinates( 0 ),
-   neighborEntitiesStorage( *this )
-{
-}
-
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::
-GridEntity( const GridType& grid,
-               const CoordinatesType& coordinates,
-               const EntityOrientationType& orientation,
-               const EntityBasisType& basis )
-: grid( grid ),
-  entityIndex( -1 ),
-  coordinates( coordinates ),
-  neighborEntitiesStorage( *this )
-{
-}
-
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::CoordinatesType&
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::
-getCoordinates() const
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::GridEntity( const GridType& grid )
+: grid( grid ), entityIndex( -1 ), coordinates( 0 ), neighborEntitiesStorage( *this )
+{}
+
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::GridEntity(
+   const GridType& grid,
+   const CoordinatesType& coordinates,
+   const EntityOrientationType& orientation,
+   const EntityBasisType& basis )
+: grid( grid ), entityIndex( -1 ), coordinates( coordinates ), neighborEntitiesStorage( *this )
+{}
+
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline 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 Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::CoordinatesType&
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::
-getCoordinates()
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline 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 Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-void
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::
-setCoordinates( const CoordinatesType& coordinates )
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline void
+GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::setCoordinates( const CoordinatesType& coordinates )
 {
    this->coordinates = coordinates;
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-void
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::
-refresh()
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline void
+GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::refresh()
 {
    this->entityIndex = this->grid.getEntityIndex( *this );
    this->neighborEntitiesStorage.refresh( this->grid, this->entityIndex );
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-Index
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::
-getIndex() const
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline Index
+GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::getIndex() const
 {
-   typedef Meshes::Grid< Dimension, Real, Device, Index > GridType;
-   typedef typename GridType::Vertex Vertex;
+   using GridType = Meshes::Grid< Dimension, Real, Device, Index >;
+   using Vertex = typename GridType::Vertex;
    TNL_ASSERT_GE( this->entityIndex, 0, "Entity index is not non-negative." );
-   TNL_ASSERT_LT( this->entityIndex, grid.template getEntitiesCount< 0 >(),
-                  "Entity index is out of bounds." );
-   TNL_ASSERT_EQ( this->entityIndex, grid.getEntityIndex( *this ),
-                  "Wrong value of stored index." );
+   TNL_ASSERT_LT( this->entityIndex, grid.template getEntitiesCount< 0 >(), "Entity index is out of bounds." );
+   TNL_ASSERT_EQ( this->entityIndex, grid.getEntityIndex( *this ), "Wrong value of stored index." );
    return this->entityIndex;
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::EntityOrientationType
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::
-getOrientation() const
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline 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 );
+   return EntityOrientationType( (IndexType) 0 );
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::EntityBasisType
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::
-getBasis() const
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline 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 );
+   return EntityBasisType( (IndexType) 0 );
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-   template< int NeighborEntityDimension >
-__cuda_callable__ inline
-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
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+template< int NeighborEntityDimension >
+__cuda_callable__
+inline 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 neighborEntitiesStorage.template getNeighborEntities< NeighborEntityDimension >();
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-bool
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::
-isBoundaryEntity() const
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline bool
+GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::isBoundaryEntity() const
 {
    return BoundaryGridEntityChecker< GridEntity >::isBoundaryEntity( *this );
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-typename Meshes::Grid< Dimension, Real, Device, Index >::PointType
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::
-getCenter() const
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline typename Meshes::Grid< Dimension, Real, Device, Index >::PointType
+GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::getCenter() const
 {
    return GridEntityCenterGetter< GridEntity >::getEntityCenter( *this );
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-typename Meshes::Grid< Dimension, Real, Device, Index >::PointType
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::
-getPoint() const
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline typename Meshes::Grid< Dimension, Real, Device, Index >::PointType
+GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::getPoint() const
 {
    return getCenter();
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::RealType
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::
-getMeasure() const
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline 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 Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::PointType
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::
-getEntityProportions() const
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::PointType
+GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::getEntityProportions() const
 {
    return PointType( 0.0 );
 }
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-__cuda_callable__ inline
-const typename GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::GridType&
-GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >::
-getMesh() const
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
+__cuda_callable__
+inline 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;
 }
 
-} // namespace Meshes
-} // namespace TNL
-
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/GridDetails/GridTraverser.h b/src/TNL/Meshes/GridDetails/GridTraverser.h
index 30a8c5178636057f846fddb4c3564bdc5b5edd14..3077328eb9e36b365606f27447e4acfb19f93796 100644
--- a/src/TNL/Meshes/GridDetails/GridTraverser.h
+++ b/src/TNL/Meshes/GridDetails/GridTraverser.h
@@ -17,239 +17,210 @@ namespace Meshes {
  */
 template< typename Grid >
 class GridTraverser
+{};
+
+enum GridTraverserMode
 {
+   synchronousMode,
+   asynchronousMode
 };
 
-enum GridTraverserMode { synchronousMode, asynchronousMode };
-
 /****
  * 1D grid, Devices::Host
  */
-template< typename Real,
-          typename Index >
+template< typename Real, typename Index >
 class GridTraverser< Meshes::Grid< 1, Real, Devices::Host, Index > >
 {
-   public:
-      
-      typedef Meshes::Grid< 1, Real, Devices::Host, Index > GridType;
-      typedef Pointers::SharedPointer<  GridType > GridPointer;
-      typedef Real RealType;
-      typedef Devices::Host DeviceType;
-      typedef Index IndexType;
-      typedef typename GridType::CoordinatesType CoordinatesType;
- 
-      template<
-         typename GridEntity,
-         typename EntitiesProcessor,
-         typename UserData,
-         bool processOnlyBoundaryEntities >
-      static void
-      processEntities(
-         const GridPointer& gridPointer,
-         const CoordinatesType begin,
-         const CoordinatesType end,
-         UserData& userData,
-         GridTraverserMode mode = synchronousMode, 
-         const int& stream = 0 );
+public:
+   using GridType = Meshes::Grid< 1, Real, Devices::Host, Index >;
+   using GridPointer = Pointers::SharedPointer< GridType >;
+   using RealType = Real;
+   using DeviceType = Devices::Host;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+
+   template< typename GridEntity, typename EntitiesProcessor, typename UserData, bool processOnlyBoundaryEntities >
+   static void
+   processEntities( const GridPointer& gridPointer,
+                    const CoordinatesType& begin,
+                    const CoordinatesType& end,
+                    UserData& userData,
+                    GridTraverserMode mode = synchronousMode,
+                    const int& stream = 0 );
 };
 
 /****
  * 1D grid, Devices::Cuda
  */
-template< typename Real,
-          typename Index >
+template< typename Real, typename Index >
 class GridTraverser< Meshes::Grid< 1, Real, Devices::Cuda, Index > >
 {
-   public:
-      
-      typedef Meshes::Grid< 1, Real, Devices::Cuda, Index > GridType;
-      typedef Pointers::SharedPointer<  GridType > GridPointer;
-      typedef Real RealType;
-      typedef Devices::Cuda DeviceType;
-      typedef Index IndexType;
-      typedef typename GridType::CoordinatesType CoordinatesType;
- 
-      template<
-         typename GridEntity,
-         typename EntitiesProcessor,
-         typename UserData,
-         bool processOnlyBoundaryEntities  >
-      static void
-      processEntities(
-         const GridPointer& gridPointer,
-         const CoordinatesType& begin,
-         const CoordinatesType& end,
-         UserData& userData,
-         GridTraverserMode mode = synchronousMode,
-         const int& stream = 0 );
-};
+public:
+   using GridType = Meshes::Grid< 1, Real, Devices::Cuda, Index >;
+   using GridPointer = Pointers::SharedPointer< GridType >;
+   using RealType = Real;
+   using DeviceType = Devices::Cuda;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
 
+   template< typename GridEntity, typename EntitiesProcessor, typename UserData, bool processOnlyBoundaryEntities >
+   static void
+   processEntities( const GridPointer& gridPointer,
+                    const CoordinatesType& begin,
+                    const CoordinatesType& end,
+                    UserData& userData,
+                    GridTraverserMode mode = synchronousMode,
+                    const int& stream = 0 );
+};
 
 /****
  * 2D grid, Devices::Host
  */
-template< typename Real,
-          typename Index >
+template< typename Real, typename Index >
 class GridTraverser< Meshes::Grid< 2, Real, Devices::Host, Index > >
 {
-   public:
-      
-      typedef Meshes::Grid< 2, Real, Devices::Host, Index > GridType;
-      typedef Pointers::SharedPointer<  GridType > GridPointer;
-      typedef Real RealType;
-      typedef Devices::Host DeviceType;
-      typedef Index IndexType;
-      typedef typename GridType::CoordinatesType CoordinatesType;
- 
-      template<
-         typename GridEntity,
-         typename EntitiesProcessor,
-         typename UserData,
-         bool processOnlyBoundaryEntities,
-         int XOrthogonalBoundary = 1,
-         int YOrthogonalBoundary = 1,
-         typename... GridEntityParameters >
-      static void
-      processEntities(
-         const GridPointer& gridPointer,
-         const CoordinatesType begin,
-         const CoordinatesType end,
-         UserData& userData,
-         // FIXME: hack around nvcc bug (error: default argument not at end of parameter list)
-         //GridTraverserMode mode = synchronousMode,
-         GridTraverserMode mode,
-         // const int& stream = 0,
-         const int& stream,
-         // gridEntityParameters are passed to GridEntity's constructor
-         // (i.e. orientation and basis for faces)
-         const GridEntityParameters&... gridEntityParameters );
+public:
+   using GridType = Meshes::Grid< 2, Real, Devices::Host, Index >;
+   using GridPointer = Pointers::SharedPointer< GridType >;
+   using RealType = Real;
+   using DeviceType = Devices::Host;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+
+   template< typename GridEntity,
+             typename EntitiesProcessor,
+             typename UserData,
+             bool processOnlyBoundaryEntities,
+             int XOrthogonalBoundary = 1,
+             int YOrthogonalBoundary = 1,
+             typename... GridEntityParameters >
+   static void
+   processEntities( const GridPointer& gridPointer,
+                    const CoordinatesType& begin,
+                    const CoordinatesType& end,
+                    UserData& userData,
+                    // FIXME: hack around nvcc bug (error: default argument not at end of parameter list)
+                    // GridTraverserMode mode = synchronousMode,
+                    GridTraverserMode mode,
+                    // const int& stream = 0,
+                    const int& stream,
+                    // gridEntityParameters are passed to GridEntity's constructor
+                    // (i.e. orientation and basis for faces)
+                    const GridEntityParameters&... gridEntityParameters );
 };
 
 /****
  * 2D grid, Devices::Cuda
  */
-template< typename Real,
-          typename Index >
+template< typename Real, typename Index >
 class GridTraverser< Meshes::Grid< 2, Real, Devices::Cuda, Index > >
 {
-   public:
-      
-      typedef Meshes::Grid< 2, Real, Devices::Cuda, Index > GridType;
-      typedef Pointers::SharedPointer<  GridType > GridPointer;
-      typedef Real RealType;
-      typedef Devices::Cuda DeviceType;
-      typedef Index IndexType;
-      typedef typename GridType::CoordinatesType CoordinatesType;
- 
-      template<
-         typename GridEntity,
-         typename EntitiesProcessor,
-         typename UserData,
-         bool processOnlyBoundaryEntities,
-         int XOrthogonalBoundary = 1,
-         int YOrthogonalBoundary = 1,
-         typename... GridEntityParameters >
-      static void
-      processEntities(
-         const GridPointer& gridPointer,
-         const CoordinatesType& begin,
-         const CoordinatesType& end,
-         UserData& userData,
-         // FIXME: hack around nvcc bug (error: default argument not at end of parameter list)
-         //GridTraverserMode mode = synchronousMode,
-         GridTraverserMode mode,
-         // const int& stream = 0,
-         const int& stream,
-         // gridEntityParameters are passed to GridEntity's constructor
-         // (i.e. orientation and basis for faces)
-         const GridEntityParameters&... gridEntityParameters );
-};
+public:
+   using GridType = Meshes::Grid< 2, Real, Devices::Cuda, Index >;
+   using GridPointer = Pointers::SharedPointer< GridType >;
+   using RealType = Real;
+   using DeviceType = Devices::Cuda;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
 
+   template< typename GridEntity,
+             typename EntitiesProcessor,
+             typename UserData,
+             bool processOnlyBoundaryEntities,
+             int XOrthogonalBoundary = 1,
+             int YOrthogonalBoundary = 1,
+             typename... GridEntityParameters >
+   static void
+   processEntities( const GridPointer& gridPointer,
+                    const CoordinatesType& begin,
+                    const CoordinatesType& end,
+                    UserData& userData,
+                    // FIXME: hack around nvcc bug (error: default argument not at end of parameter list)
+                    // GridTraverserMode mode = synchronousMode,
+                    GridTraverserMode mode,
+                    // const int& stream = 0,
+                    const int& stream,
+                    // gridEntityParameters are passed to GridEntity's constructor
+                    // (i.e. orientation and basis for faces)
+                    const GridEntityParameters&... gridEntityParameters );
+};
 
 /****
  * 3D grid, Devices::Host
  */
-template< typename Real,
-          typename Index >
+template< typename Real, typename Index >
 class GridTraverser< Meshes::Grid< 3, Real, Devices::Host, Index > >
 {
-   public:
-      
-      typedef Meshes::Grid< 3, Real, Devices::Host, Index > GridType;
-      typedef Pointers::SharedPointer<  GridType > GridPointer;
-      typedef Real RealType;
-      typedef Devices::Host DeviceType;
-      typedef Index IndexType;
-      typedef typename GridType::CoordinatesType CoordinatesType;
- 
-      template<
-         typename GridEntity,
-         typename EntitiesProcessor,
-         typename UserData,
-         bool processOnlyBoundaryEntities,
-         int XOrthogonalBoundary = 1,
-         int YOrthogonalBoundary = 1,
-         int ZOrthogonalBoundary = 1,
-         typename... GridEntityParameters >
-      static void
-      processEntities(
-         const GridPointer& gridPointer,
-         const CoordinatesType begin,
-         const CoordinatesType end,
-         UserData& userData,
-         // FIXME: hack around nvcc bug (error: default argument not at end of parameter list)
-         //GridTraverserMode mode = synchronousMode,
-         GridTraverserMode mode,
-         // const int& stream = 0,
-         const int& stream,
-         // gridEntityParameters are passed to GridEntity's constructor
-         // (i.e. orientation and basis for faces and edges)
-         const GridEntityParameters&... gridEntityParameters );
+public:
+   using GridType = Meshes::Grid< 3, Real, Devices::Host, Index >;
+   using GridPointer = Pointers::SharedPointer< GridType >;
+   using RealType = Real;
+   using DeviceType = Devices::Host;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+
+   template< typename GridEntity,
+             typename EntitiesProcessor,
+             typename UserData,
+             bool processOnlyBoundaryEntities,
+             int XOrthogonalBoundary = 1,
+             int YOrthogonalBoundary = 1,
+             int ZOrthogonalBoundary = 1,
+             typename... GridEntityParameters >
+   static void
+   processEntities( const GridPointer& gridPointer,
+                    const CoordinatesType& begin,
+                    const CoordinatesType& end,
+                    UserData& userData,
+                    // FIXME: hack around nvcc bug (error: default argument not at end of parameter list)
+                    // GridTraverserMode mode = synchronousMode,
+                    GridTraverserMode mode,
+                    // const int& stream = 0,
+                    const int& stream,
+                    // gridEntityParameters are passed to GridEntity's constructor
+                    // (i.e. orientation and basis for faces and edges)
+                    const GridEntityParameters&... gridEntityParameters );
 };
 
 /****
  * 3D grid, Devices::Cuda
  */
-template< typename Real,
-          typename Index >
+template< typename Real, typename Index >
 class GridTraverser< Meshes::Grid< 3, Real, Devices::Cuda, Index > >
 {
-   public:
-      
-      typedef Meshes::Grid< 3, Real, Devices::Cuda, Index > GridType;
-      typedef Pointers::SharedPointer<  GridType > GridPointer;
-      typedef Real RealType;
-      typedef Devices::Cuda DeviceType;
-      typedef Index IndexType;
-      typedef typename GridType::CoordinatesType CoordinatesType;
- 
-      template<
-         typename GridEntity,
-         typename EntitiesProcessor,
-         typename UserData,
-         bool processOnlyBoundaryEntities,
-         int XOrthogonalBoundary = 1,
-         int YOrthogonalBoundary = 1,
-         int ZOrthogonalBoundary = 1,
-         typename... GridEntityParameters >
-      static void
-      processEntities(
-         const GridPointer& gridPointer,
-         const CoordinatesType& begin,
-         const CoordinatesType& end,
-         UserData& userData,
-         // FIXME: hack around nvcc bug (error: default argument not at end of parameter list)
-         //GridTraverserMode mode = synchronousMode,
-         GridTraverserMode mode,
-         // const int& stream = 0,
-         const int& stream,
-         // gridEntityParameters are passed to GridEntity's constructor
-         // (i.e. orientation and basis for faces and edges)
-         const GridEntityParameters&... gridEntityParameters );
+public:
+   using GridType = Meshes::Grid< 3, Real, Devices::Cuda, Index >;
+   using GridPointer = Pointers::SharedPointer< GridType >;
+   using RealType = Real;
+   using DeviceType = Devices::Cuda;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+
+   template< typename GridEntity,
+             typename EntitiesProcessor,
+             typename UserData,
+             bool processOnlyBoundaryEntities,
+             int XOrthogonalBoundary = 1,
+             int YOrthogonalBoundary = 1,
+             int ZOrthogonalBoundary = 1,
+             typename... GridEntityParameters >
+   static void
+   processEntities( const GridPointer& gridPointer,
+                    const CoordinatesType& begin,
+                    const CoordinatesType& end,
+                    UserData& userData,
+                    // FIXME: hack around nvcc bug (error: default argument not at end of parameter list)
+                    // GridTraverserMode mode = synchronousMode,
+                    GridTraverserMode mode,
+                    // const int& stream = 0,
+                    const int& stream,
+                    // gridEntityParameters are passed to GridEntity's constructor
+                    // (i.e. orientation and basis for faces and edges)
+                    const GridEntityParameters&... gridEntityParameters );
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/GridDetails/GridTraverser_1D.hpp>
 #include <TNL/Meshes/GridDetails/GridTraverser_2D.hpp>
diff --git a/src/TNL/Meshes/GridDetails/GridTraverser_1D.hpp b/src/TNL/Meshes/GridDetails/GridTraverser_1D.hpp
index 4aa4f38d64f48ad8ad113bc8ff14a8a2da843564..b71c2a6ac0e3a37748d5785e9c2c321a7cb8e1ac 100644
--- a/src/TNL/Meshes/GridDetails/GridTraverser_1D.hpp
+++ b/src/TNL/Meshes/GridDetails/GridTraverser_1D.hpp
@@ -23,26 +23,18 @@ namespace Meshes {
 /****
  * 1D traverser, host
  */
-template< typename Real,
-          typename Index >
-   template<
-      typename GridEntity,
-      typename EntitiesProcessor,
-      typename UserData,
-      bool processOnlyBoundaryEntities >
+template< typename Real, typename Index >
+template< typename GridEntity, typename EntitiesProcessor, typename UserData, bool processOnlyBoundaryEntities >
 void
-GridTraverser< Meshes::Grid< 1, Real, Devices::Host, Index > >::
-processEntities(
-   const GridPointer& gridPointer,
-   const CoordinatesType begin,
-   const CoordinatesType end,
-   UserData& userData,
-   GridTraverserMode mode,
-   const int& stream )
+GridTraverser< Meshes::Grid< 1, Real, Devices::Host, Index > >::processEntities( const GridPointer& gridPointer,
+                                                                                 const CoordinatesType& begin,
+                                                                                 const CoordinatesType& end,
+                                                                                 UserData& userData,
+                                                                                 GridTraverserMode mode,
+                                                                                 const int& stream )
 {
    GridEntity entity( *gridPointer );
-   if( processOnlyBoundaryEntities )
-   {
+   if( processOnlyBoundaryEntities ) {
       GridEntity entity( *gridPointer );
 
       entity.getCoordinates() = begin;
@@ -52,41 +44,31 @@ processEntities(
       entity.refresh();
       EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
    }
-   else
-   {
+   else {
 #ifdef HAVE_OPENMP
-      if( Devices::Host::isOMPEnabled() && end.x() - begin.x() > 512 )
-      {
-#pragma omp parallel firstprivate( begin, end )
+      if( Devices::Host::isOMPEnabled() && end.x() - begin.x() > 512 ) {
+         #pragma omp parallel firstprivate( begin, end )
          {
             GridEntity entity( *gridPointer );
-#pragma omp for
+            #pragma omp for
             // TODO: g++ 5.5 crashes when coding this loop without auxiliary x as bellow
-            for( IndexType x = begin.x(); x < end.x(); x++ )
-            {
+            for( IndexType x = begin.x(); x < end.x(); x++ ) {
                entity.getCoordinates().x() = x;
                entity.refresh();
                EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
             }
          }
       }
-      else
-      {
+      else {
          GridEntity entity( *gridPointer );
-         for( entity.getCoordinates().x() = begin.x();
-              entity.getCoordinates().x() < end.x();
-              entity.getCoordinates().x() ++ )
-         {
+         for( entity.getCoordinates().x() = begin.x(); entity.getCoordinates().x() < end.x(); entity.getCoordinates().x()++ ) {
             entity.refresh();
             EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
          }
       }
 #else
       GridEntity entity( *gridPointer );
-      for( entity.getCoordinates().x() = begin.x();
-           entity.getCoordinates().x() < end.x();
-           entity.getCoordinates().x() ++ )
-      {
+      for( entity.getCoordinates().x() = begin.x(); entity.getCoordinates().x() < end.x(); entity.getCoordinates().x()++ ) {
          entity.refresh();
          EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
       }
@@ -98,18 +80,14 @@ processEntities(
  * 1D traverser, CUDA
  */
 #ifdef HAVE_CUDA
-template< typename Real,
-          typename Index,
-          typename GridEntity,
-          typename UserData,
-          typename EntitiesProcessor >
-__global__ void
-GridTraverser1D(
-   const Meshes::Grid< 1, Real, Devices::Cuda, Index >* grid,
-   UserData userData,
-   const typename GridEntity::CoordinatesType begin,
-   const typename GridEntity::CoordinatesType end,
-   const Index gridIdx )
+template< typename Real, typename Index, typename GridEntity, typename UserData, typename EntitiesProcessor >
+__global__
+void
+GridTraverser1D( const Meshes::Grid< 1, Real, Devices::Cuda, Index >* grid,
+                 UserData userData,
+                 const typename GridEntity::CoordinatesType begin,
+                 const typename GridEntity::CoordinatesType end,
+                 const Index gridIdx )
 {
    typedef Real RealType;
    typedef Index IndexType;
@@ -117,40 +95,33 @@ GridTraverser1D(
    typename GridType::CoordinatesType coordinates;
 
    coordinates.x() = begin.x() + ( gridIdx * Cuda::getMaxGridSize() + blockIdx.x ) * blockDim.x + threadIdx.x;
-   if( coordinates < end )
-   {
+   if( coordinates < end ) {
       GridEntity entity( *grid, coordinates );
       entity.refresh();
       EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
    }
 }
 
-template< typename Real,
-          typename Index,
-          typename GridEntity,
-          typename UserData,
-          typename EntitiesProcessor >
-__global__ void
-GridBoundaryTraverser1D(
-   const Meshes::Grid< 1, Real, Devices::Cuda, Index >* grid,
-   UserData userData,
-   const typename GridEntity::CoordinatesType begin,
-   const typename GridEntity::CoordinatesType end )
+template< typename Real, typename Index, typename GridEntity, typename UserData, typename EntitiesProcessor >
+__global__
+void
+GridBoundaryTraverser1D( const Meshes::Grid< 1, Real, Devices::Cuda, Index >* grid,
+                         UserData userData,
+                         const typename GridEntity::CoordinatesType begin,
+                         const typename GridEntity::CoordinatesType end )
 {
    typedef Real RealType;
    typedef Index IndexType;
    typedef Meshes::Grid< 1, Real, Devices::Cuda, Index > GridType;
    typename GridType::CoordinatesType coordinates;
 
-   if( threadIdx.x == 0 )
-   {
+   if( threadIdx.x == 0 ) {
       coordinates.x() = begin.x();
       GridEntity entity( *grid, coordinates );
       entity.refresh();
       EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
    }
-   if( threadIdx.x == 1 )
-   {
+   if( threadIdx.x == 1 ) {
       coordinates.x() = end.x() - 1;
       GridEntity entity( *grid, coordinates );
       entity.refresh();
@@ -160,63 +131,36 @@ GridBoundaryTraverser1D(
 
 #endif
 
-template< typename Real,
-          typename Index >
-   template<
-      typename GridEntity,
-      typename EntitiesProcessor,
-      typename UserData,
-      bool processOnlyBoundaryEntities >
+template< typename Real, typename Index >
+template< typename GridEntity, typename EntitiesProcessor, typename UserData, bool processOnlyBoundaryEntities >
 void
-GridTraverser< Meshes::Grid< 1, Real, Devices::Cuda, Index > >::
-processEntities(
-   const GridPointer& gridPointer,
-   const CoordinatesType& begin,
-   const CoordinatesType& end,
-   UserData& userData,
-   GridTraverserMode mode,
-   const int& stream )
+GridTraverser< Meshes::Grid< 1, Real, Devices::Cuda, Index > >::processEntities( const GridPointer& gridPointer,
+                                                                                 const CoordinatesType& begin,
+                                                                                 const CoordinatesType& end,
+                                                                                 UserData& userData,
+                                                                                 GridTraverserMode mode,
+                                                                                 const int& stream )
 {
 #ifdef HAVE_CUDA
    auto& pool = Cuda::StreamPool::getInstance();
    const cudaStream_t& s = pool.getStream( stream );
 
    Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >();
-   if( processOnlyBoundaryEntities )
-   {
+   if( processOnlyBoundaryEntities ) {
       dim3 cudaBlockSize( 2 );
       dim3 cudaBlocks( 1 );
-      GridBoundaryTraverser1D< Real, Index, GridEntity, UserData, EntitiesProcessor >
-            <<< cudaBlocks, cudaBlockSize, 0, s >>>
-            ( &gridPointer.template getData< Devices::Cuda >(),
-              userData,
-              begin,
-              end );
+      GridBoundaryTraverser1D< Real, Index, GridEntity, UserData, EntitiesProcessor > <<< cudaBlocks,
+         cudaBlockSize, 0, s >>>( &gridPointer.template getData< Devices::Cuda >(), userData, begin, end );
    }
-   else
-   {
+   else {
       dim3 blockSize( 256 ), blocksCount, gridsCount;
-      Cuda::setupThreads(
-         blockSize,
-         blocksCount,
-         gridsCount,
-         end.x() - begin.x() );
+      Cuda::setupThreads( blockSize, blocksCount, gridsCount, end.x() - begin.x() );
       dim3 gridIdx;
-      for( gridIdx.x = 0; gridIdx.x < gridsCount.x; gridIdx.x++ )
-      {
+      for( gridIdx.x = 0; gridIdx.x < gridsCount.x; gridIdx.x++ ) {
          dim3 gridSize;
-         Cuda::setupGrid(
-            blocksCount,
-            gridsCount,
-            gridIdx,
-            gridSize );
-         GridTraverser1D< Real, Index, GridEntity, UserData, EntitiesProcessor >
-            <<< blocksCount, blockSize, 0, s >>>
-            ( &gridPointer.template getData< Devices::Cuda >(),
-              userData,
-              begin,
-              end,
-              gridIdx.x );
+         Cuda::setupGrid( blocksCount, gridsCount, gridIdx, gridSize );
+         GridTraverser1D< Real, Index, GridEntity, UserData, EntitiesProcessor > <<< blocksCount, blockSize, 0,
+            s >>>( &gridPointer.template getData< Devices::Cuda >(), userData, begin, end, gridIdx.x );
       }
 
       /*dim3 cudaBlockSize( 256 );
@@ -234,21 +178,20 @@ processEntities(
               gridXIdx );*/
    }
 
-#ifdef NDEBUG
-   if( mode == synchronousMode )
-   {
+   #ifdef NDEBUG
+   if( mode == synchronousMode ) {
       cudaStreamSynchronize( s );
       TNL_CHECK_CUDA_DEVICE;
    }
-#else
+   #else
    cudaStreamSynchronize( s );
    TNL_CHECK_CUDA_DEVICE;
-#endif
+   #endif
 
 #else
    throw Exceptions::CudaSupportMissing();
 #endif
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/GridDetails/GridTraverser_2D.hpp b/src/TNL/Meshes/GridDetails/GridTraverser_2D.hpp
index f47d2c0547e9ba1f9cc577e40e91f317fefc94bb..77171e24cf978507408956c8263c19bbdbb6f4e6 100644
--- a/src/TNL/Meshes/GridDetails/GridTraverser_2D.hpp
+++ b/src/TNL/Meshes/GridDetails/GridTraverser_2D.hpp
@@ -17,40 +17,32 @@ namespace Meshes {
 
 //#define GRID_TRAVERSER_USE_STREAMS
 
-
 /****
  * 2D traverser, host
  */
-template< typename Real,
-          typename Index >
-   template<
-      typename GridEntity,
-      typename EntitiesProcessor,
-      typename UserData,
-      bool processOnlyBoundaryEntities,
-      int XOrthogonalBoundary,
-      int YOrthogonalBoundary,
-      typename... GridEntityParameters >
+template< typename Real, typename Index >
+template< typename GridEntity,
+          typename EntitiesProcessor,
+          typename UserData,
+          bool processOnlyBoundaryEntities,
+          int XOrthogonalBoundary,
+          int YOrthogonalBoundary,
+          typename... GridEntityParameters >
 void
-GridTraverser< Meshes::Grid< 2, Real, Devices::Host, Index > >::
-processEntities(
+GridTraverser< Meshes::Grid< 2, Real, Devices::Host, Index > >::processEntities(
    const GridPointer& gridPointer,
-   const CoordinatesType begin,
-   const CoordinatesType end,
+   const CoordinatesType& begin,
+   const CoordinatesType& end,
    UserData& userData,
    GridTraverserMode mode,
    const int& stream,
    const GridEntityParameters&... gridEntityParameters )
 {
-   if( processOnlyBoundaryEntities )
-   {
+   if( processOnlyBoundaryEntities ) {
       GridEntity entity( *gridPointer, begin, gridEntityParameters... );
 
       if( YOrthogonalBoundary )
-         for( entity.getCoordinates().x() = begin.x();
-              entity.getCoordinates().x() < end.x();
-              entity.getCoordinates().x() ++ )
-         {
+         for( entity.getCoordinates().x() = begin.x(); entity.getCoordinates().x() < end.x(); entity.getCoordinates().x()++ ) {
             entity.getCoordinates().y() = begin.y();
             entity.refresh();
             EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
@@ -59,10 +51,7 @@ processEntities(
             EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
          }
       if( XOrthogonalBoundary )
-         for( entity.getCoordinates().y() = begin.y();
-              entity.getCoordinates().y() < end.y();
-              entity.getCoordinates().y() ++ )
-         {
+         for( entity.getCoordinates().y() = begin.y(); entity.getCoordinates().y() < end.y(); entity.getCoordinates().y()++ ) {
             entity.getCoordinates().x() = begin.x();
             entity.refresh();
             EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
@@ -71,19 +60,16 @@ processEntities(
             EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
          }
    }
-   else
-   {
+   else {
 #ifdef HAVE_OPENMP
-      if( Devices::Host::isOMPEnabled() )
-      {
-#pragma omp parallel firstprivate( begin, end )
+      if( Devices::Host::isOMPEnabled() ) {
+         #pragma omp parallel firstprivate( begin, end )
          {
             GridEntity entity( *gridPointer, begin, gridEntityParameters... );
-#pragma omp for
+            #pragma omp for
             // TODO: g++ 5.5 crashes when coding this loop without auxiliary x and y as bellow
-            for( IndexType y = begin.y(); y < end.y(); y ++ )
-               for( IndexType x = begin.x(); x < end.x(); x ++ )
-               {
+            for( IndexType y = begin.y(); y < end.y(); y++ )
+               for( IndexType x = begin.x(); x < end.x(); x++ ) {
                   entity.getCoordinates().x() = x;
                   entity.getCoordinates().y() = y;
                   entity.refresh();
@@ -91,32 +77,22 @@ processEntities(
                }
          }
       }
-      else
-      {
+      else {
          GridEntity entity( *gridPointer, begin, gridEntityParameters... );
-         for( entity.getCoordinates().y() = begin.y();
-              entity.getCoordinates().y() < end.y();
-              entity.getCoordinates().y() ++ )
-            for( entity.getCoordinates().x() = begin.x();
-                 entity.getCoordinates().x() < end.x();
-                 entity.getCoordinates().x() ++ )
-               {
-                  entity.refresh();
-                  EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
-               }
+         for( entity.getCoordinates().y() = begin.y(); entity.getCoordinates().y() < end.y(); entity.getCoordinates().y()++ )
+            for( entity.getCoordinates().x() = begin.x(); entity.getCoordinates().x() < end.x(); entity.getCoordinates().x()++ )
+            {
+               entity.refresh();
+               EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
+            }
       }
 #else
       GridEntity entity( *gridPointer, begin, gridEntityParameters... );
-         for( entity.getCoordinates().y() = begin.y();
-              entity.getCoordinates().y() < end.y();
-              entity.getCoordinates().y() ++ )
-            for( entity.getCoordinates().x() = begin.x();
-                 entity.getCoordinates().x() < end.x();
-                 entity.getCoordinates().x() ++ )
-               {
-                  entity.refresh();
-                  EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
-               }
+      for( entity.getCoordinates().y() = begin.y(); entity.getCoordinates().y() < end.y(); entity.getCoordinates().y()++ )
+         for( entity.getCoordinates().x() = begin.x(); entity.getCoordinates().x() < end.x(); entity.getCoordinates().x()++ ) {
+            entity.refresh();
+            EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
+         }
 #endif
    }
 }
@@ -132,14 +108,14 @@ template< typename Real,
           typename EntitiesProcessor,
           bool processOnlyBoundaryEntities,
           typename... GridEntityParameters >
-__global__ void
-GridTraverser2D(
-   const Meshes::Grid< 2, Real, Devices::Cuda, Index >* grid,
-   UserData userData,
-   const typename GridEntity::CoordinatesType begin,
-   const typename GridEntity::CoordinatesType end,
-   const dim3 gridIdx,
-   const GridEntityParameters... gridEntityParameters )
+__global__
+void
+GridTraverser2D( const Meshes::Grid< 2, Real, Devices::Cuda, Index >* grid,
+                 UserData userData,
+                 const typename GridEntity::CoordinatesType begin,
+                 const typename GridEntity::CoordinatesType end,
+                 const dim3 gridIdx,
+                 const GridEntityParameters... gridEntityParameters )
 {
    typedef Meshes::Grid< 2, Real, Devices::Cuda, Index > GridType;
    typename GridType::CoordinatesType coordinates;
@@ -147,16 +123,11 @@ GridTraverser2D(
    coordinates.x() = begin.x() + Cuda::getGlobalThreadIdx_x( gridIdx );
    coordinates.y() = begin.y() + Cuda::getGlobalThreadIdx_y( gridIdx );
 
-   if( coordinates < end )
-   {
+   if( coordinates < end ) {
       GridEntity entity( *grid, coordinates, gridEntityParameters... );
       entity.refresh();
-      if( ! processOnlyBoundaryEntities || entity.isBoundaryEntity() )
-      {
-         EntitiesProcessor::processEntity
-         ( *grid,
-           userData,
-           entity );
+      if( ! processOnlyBoundaryEntities || entity.isBoundaryEntity() ) {
+         EntitiesProcessor::processEntity( *grid, userData, entity );
       }
    }
 }
@@ -169,15 +140,15 @@ template< typename Real,
           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 )
+__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;
@@ -185,14 +156,10 @@ GridTraverser2DBoundaryAlongX(
    coordinates.x() = beginX + Cuda::getGlobalThreadIdx_x( gridIdx );
    coordinates.y() = fixedY;
 
-   if( coordinates.x() < endX )
-   {
+   if( coordinates.x() < endX ) {
       GridEntity entity( *grid, coordinates, gridEntityParameters... );
       entity.refresh();
-      EntitiesProcessor::processEntity
-      ( *grid,
-        userData,
-        entity );
+      EntitiesProcessor::processEntity( *grid, userData, entity );
    }
 }
 
@@ -204,15 +171,15 @@ template< typename Real,
           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 )
+__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;
@@ -220,18 +187,13 @@ GridTraverser2DBoundaryAlongY(
    coordinates.x() = fixedX;
    coordinates.y() = beginY + Cuda::getGlobalThreadIdx_x( gridIdx );
 
-   if( coordinates.y() < endY )
-   {
+   if( coordinates.y() < endY ) {
       GridEntity entity( *grid, coordinates, gridEntityParameters... );
       entity.refresh();
-      EntitiesProcessor::processEntity
-      ( *grid,
-        userData,
-        entity );
+      EntitiesProcessor::processEntity( *grid, userData, entity );
    }
 }
 
-
 template< typename Real,
           typename Index,
           typename GridEntity,
@@ -239,53 +201,47 @@ template< typename Real,
           typename EntitiesProcessor,
           bool processOnlyBoundaryEntities,
           typename... GridEntityParameters >
-__global__ void
-GridTraverser2DBoundary(
-   const Meshes::Grid< 2, Real, Devices::Cuda, Index >* grid,
-   UserData userData,
-   const Index beginX,
-   const Index endX,
-   const Index beginY,
-   const Index endY,
-   const Index blocksPerFace,
-   const dim3 gridIdx,
-   const GridEntityParameters... gridEntityParameters )
+__global__
+void
+GridTraverser2DBoundary( const Meshes::Grid< 2, Real, Devices::Cuda, Index >* grid,
+                         UserData userData,
+                         const Index beginX,
+                         const Index endX,
+                         const Index beginY,
+                         const Index endY,
+                         const Index blocksPerFace,
+                         const dim3 gridIdx,
+                         const GridEntityParameters... gridEntityParameters )
 {
    using GridType = Meshes::Grid< 2, Real, Devices::Cuda, Index >;
    using CoordinatesType = typename GridType::CoordinatesType;
 
    const Index faceIdx = blockIdx.x / blocksPerFace;
    const Index faceBlockIdx = blockIdx.x % blocksPerFace;
-   const Index threadId = faceBlockIdx * blockDim. x + threadIdx.x;
-   if( faceIdx < 2 )
-   {
+   const Index threadId = faceBlockIdx * blockDim.x + threadIdx.x;
+   if( faceIdx < 2 ) {
       const Index entitiesAlongX = endX - beginX;
-      if( threadId < entitiesAlongX )
-      {
-         GridEntity entity( *grid,
-            CoordinatesType(  beginX + threadId, faceIdx == 0 ? beginY : endY - 1 ),
-            gridEntityParameters... );
-         //printf( "faceIdx %d Thread %d -> %d %d \n ", faceIdx, threadId, entity.getCoordinates().x(), entity.getCoordinates().y() );
+      if( threadId < entitiesAlongX ) {
+         GridEntity entity(
+            *grid, CoordinatesType( beginX + threadId, faceIdx == 0 ? beginY : endY - 1 ), gridEntityParameters... );
+         // printf( "faceIdx %d Thread %d -> %d %d \n ", faceIdx, threadId, entity.getCoordinates().x(),
+         // entity.getCoordinates().y() );
          entity.refresh();
          EntitiesProcessor::processEntity( *grid, userData, entity );
       }
    }
-   else
-   {
+   else {
       const Index entitiesAlongY = endY - beginY;
-      if( threadId < entitiesAlongY )
-      {
-         GridEntity entity( *grid,
-            CoordinatesType(  faceIdx == 2 ? beginX : endX - 1, beginY + threadId + 1  ),
-            gridEntityParameters... );
-         //printf( "faceIdx %d Thread %d -> %d %d \n ", faceIdx, threadId, entity.getCoordinates().x(), entity.getCoordinates().y() );
+      if( threadId < entitiesAlongY ) {
+         GridEntity entity(
+            *grid, CoordinatesType( faceIdx == 2 ? beginX : endX - 1, beginY + threadId + 1 ), gridEntityParameters... );
+         // printf( "faceIdx %d Thread %d -> %d %d \n ", faceIdx, threadId, entity.getCoordinates().x(),
+         // entity.getCoordinates().y() );
          entity.refresh();
          EntitiesProcessor::processEntity( *grid, userData, entity );
       }
    }
 
-
-
    /*const Index aux = max( entitiesAlongX, entitiesAlongY );
    const Index& warpSize = Cuda::getWarpSize();
    const Index threadsPerAxis = warpSize * ( aux / warpSize + ( aux % warpSize != 0 ) );
@@ -378,22 +334,18 @@ GridTraverser2DBoundary(
    }*/
 }
 
+#endif  // HAVE_CUDA
 
-#endif // HAVE_CUDA
-
-template< typename Real,
-          typename Index >
-   template<
-      typename GridEntity,
-      typename EntitiesProcessor,
-      typename UserData,
-      bool processOnlyBoundaryEntities,
-         int XOrthogonalBoundary,
-         int YOrthogonalBoundary,
-      typename... GridEntityParameters >
+template< typename Real, typename Index >
+template< typename GridEntity,
+          typename EntitiesProcessor,
+          typename UserData,
+          bool processOnlyBoundaryEntities,
+          int XOrthogonalBoundary,
+          int YOrthogonalBoundary,
+          typename... GridEntityParameters >
 void
-GridTraverser< Meshes::Grid< 2, Real, Devices::Cuda, Index > >::
-processEntities(
+GridTraverser< Meshes::Grid< 2, Real, Devices::Cuda, Index > >::processEntities(
    const GridPointer& gridPointer,
    const CoordinatesType& begin,
    const CoordinatesType& end,
@@ -403,13 +355,10 @@ processEntities(
    const GridEntityParameters&... gridEntityParameters )
 {
 #ifdef HAVE_CUDA
-   if( processOnlyBoundaryEntities &&
-       ( GridEntity::getEntityDimension() == 2 || GridEntity::getEntityDimension() == 0 ) )
-   {
-#ifdef GRID_TRAVERSER_USE_STREAMS
+   if( processOnlyBoundaryEntities && ( GridEntity::getEntityDimension() == 2 || GridEntity::getEntityDimension() == 0 ) ) {
+   #ifdef GRID_TRAVERSER_USE_STREAMS
       dim3 cudaBlockSize( 256 );
-      dim3 cudaBlocksCountAlongX, cudaGridsCountAlongX,
-           cudaBlocksCountAlongY, cudaGridsCountAlongY;
+      dim3 cudaBlocksCountAlongX, cudaGridsCountAlongX, cudaBlocksCountAlongY, cudaGridsCountAlongY;
       Cuda::setupThreads( cudaBlockSize, cudaBlocksCountAlongX, cudaGridsCountAlongX, end.x() - begin.x() );
       Cuda::setupThreads( cudaBlockSize, cudaBlocksCountAlongY, cudaGridsCountAlongY, end.y() - begin.y() - 2 );
 
@@ -419,58 +368,80 @@ processEntities(
       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++ )
-      {
+      for( gridIdx.x = 0; gridIdx.x < cudaGridsCountAlongX.x; gridIdx.x++ ) {
          Cuda::setupGrid( cudaBlocksCountAlongX, cudaGridsCountAlongX, gridIdx, cudaGridSize );
-         //Cuda::printThreadsSetup( cudaBlockSize, cudaBlocksCountAlongX, cudaGridSize, cudaGridsCountAlongX );
-         GridTraverser2DBoundaryAlongX< Real, Index, GridEntity, UserData, EntitiesProcessor, processOnlyBoundaryEntities, GridEntityParameters... >
-               <<< cudaGridSize, cudaBlockSize, 0, s1 >>>
-               ( &gridPointer.template getData< Devices::Cuda >(),
-                 userData,
-                 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 >(),
-                 userData,
-                 begin.x(),
-                 end.x(),
-                 end.y(),
-                 gridIdx,
-                 gridEntityParameters... );
+         // Cuda::printThreadsSetup( cudaBlockSize, cudaBlocksCountAlongX, cudaGridSize, cudaGridsCountAlongX );
+         GridTraverser2DBoundaryAlongX< Real,
+                                        Index,
+                                        GridEntity,
+                                        UserData,
+                                        EntitiesProcessor,
+                                        processOnlyBoundaryEntities,
+                                        GridEntityParameters... >
+            <<< cudaGridSize, cudaBlockSize, 0,
+            s1 >>>( &gridPointer.template getData< Devices::Cuda >(),
+                                   userData,
+                                   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 >(),
+                                   userData,
+                                   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++ )
-      {
+      for( gridIdx.x = 0; gridIdx.x < cudaGridsCountAlongY.x; gridIdx.x++ ) {
          Cuda::setupGrid( cudaBlocksCountAlongY, cudaGridsCountAlongY, gridIdx, cudaGridSize );
-         GridTraverser2DBoundaryAlongY< Real, Index, GridEntity, UserData, EntitiesProcessor, processOnlyBoundaryEntities, GridEntityParameters... >
-               <<< cudaGridSize, cudaBlockSize, 0, s3 >>>
-               ( &gridPointer.template getData< Devices::Cuda >(),
-                 userData,
-                 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 >(),
-                 userData,
-                 begin.y() + 1,
-                 end.y() - 1,
-                 end.x(),
-                 gridIdx,
-                 gridEntityParameters... );
+         GridTraverser2DBoundaryAlongY< Real,
+                                        Index,
+                                        GridEntity,
+                                        UserData,
+                                        EntitiesProcessor,
+                                        processOnlyBoundaryEntities,
+                                        GridEntityParameters... >
+            <<< cudaGridSize, cudaBlockSize, 0,
+            s3 >>>( &gridPointer.template getData< Devices::Cuda >(),
+                                   userData,
+                                   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 >(),
+                                   userData,
+                                   begin.y() + 1,
+                                   end.y() - 1,
+                                   end.x(),
+                                   gridIdx,
+                                   gridEntityParameters... );
       }
       cudaStreamSynchronize( s1 );
       cudaStreamSynchronize( s2 );
       cudaStreamSynchronize( s3 );
       cudaStreamSynchronize( s4 );
-#else // not defined GRID_TRAVERSER_USE_STREAMS
+   #else   // not defined GRID_TRAVERSER_USE_STREAMS
       dim3 cudaBlockSize( 256 );
       dim3 cudaBlocksCount, cudaGridsCount;
       const IndexType entitiesAlongX = end.x() - begin.x();
@@ -479,68 +450,69 @@ processEntities(
       const IndexType blocksPerFace = maxFaceSize / cudaBlockSize.x + ( maxFaceSize % cudaBlockSize.x != 0 );
       IndexType cudaThreadsCount = 4 * cudaBlockSize.x * blocksPerFace;
       Cuda::setupThreads( cudaBlockSize, cudaBlocksCount, cudaGridsCount, cudaThreadsCount );
-      //std::cerr << "blocksPerFace = " << blocksPerFace << "Threads count = " << cudaThreadsCount
-      //          << "cudaBlockCount = " << cudaBlocksCount.x << std::endl;
+      // std::cerr << "blocksPerFace = " << blocksPerFace << "Threads count = " << cudaThreadsCount
+      //           << "cudaBlockCount = " << cudaBlocksCount.x << std::endl;
       dim3 gridIdx, cudaGridSize;
       Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >();
-      for( gridIdx.x = 0; gridIdx.x < cudaGridsCount.x; gridIdx.x++ )
-      {
+      for( gridIdx.x = 0; gridIdx.x < cudaGridsCount.x; gridIdx.x++ ) {
          Cuda::setupGrid( cudaBlocksCount, cudaGridsCount, gridIdx, cudaGridSize );
-         //Cuda::printThreadsSetup( cudaBlockSize, cudaBlocksCountAlongX, cudaGridSize, cudaGridsCountAlongX );
-         GridTraverser2DBoundary< Real, Index, GridEntity, UserData, EntitiesProcessor, processOnlyBoundaryEntities, GridEntityParameters... >
-               <<< cudaGridSize, cudaBlockSize >>>
-               ( &gridPointer.template getData< Devices::Cuda >(),
-                 userData,
-                 begin.x(),
-                 end.x(),
-                 begin.y(),
-                 end.y(),
-                 blocksPerFace,
-                 gridIdx,
-                 gridEntityParameters... );
+         // Cuda::printThreadsSetup( cudaBlockSize, cudaBlocksCountAlongX, cudaGridSize, cudaGridsCountAlongX );
+         GridTraverser2DBoundary< Real,
+                                  Index,
+                                  GridEntity,
+                                  UserData,
+                                  EntitiesProcessor,
+                                  processOnlyBoundaryEntities,
+                                  GridEntityParameters... >
+            <<< cudaGridSize, cudaBlockSize >>>( &gridPointer.template getData< Devices::Cuda >(),
+                                                                              userData,
+                                                                              begin.x(),
+                                                                              end.x(),
+                                                                              begin.y(),
+                                                                              end.y(),
+                                                                              blocksPerFace,
+                                                                              gridIdx,
+                                                                              gridEntityParameters... );
       }
-#endif //GRID_TRAVERSER_USE_STREAMS
-      //getchar();
+   #endif  // GRID_TRAVERSER_USE_STREAMS
+      // getchar();
       TNL_CHECK_CUDA_DEVICE;
    }
-   else
-   {
+   else {
       dim3 cudaBlockSize( 16, 16 );
       dim3 cudaBlocksCount, cudaGridsCount;
-      Cuda::setupThreads( cudaBlockSize, cudaBlocksCount, cudaGridsCount,
-                          end.x() - begin.x(),
-                          end.y() - begin.y() );
+      Cuda::setupThreads( cudaBlockSize, cudaBlocksCount, cudaGridsCount, end.x() - begin.x(), end.y() - begin.y() );
 
       auto& pool = Cuda::StreamPool::getInstance();
       const cudaStream_t& s = pool.getStream( stream );
 
       Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >();
       dim3 gridIdx, cudaGridSize;
-      for( gridIdx.y = 0; gridIdx.y < cudaGridsCount.y; gridIdx.y ++ )
-         for( gridIdx.x = 0; gridIdx.x < cudaGridsCount.x; gridIdx.x ++ )
-         {
+      for( gridIdx.y = 0; gridIdx.y < cudaGridsCount.y; gridIdx.y++ )
+         for( gridIdx.x = 0; gridIdx.x < cudaGridsCount.x; gridIdx.x++ ) {
             Cuda::setupGrid( cudaBlocksCount, cudaGridsCount, gridIdx, cudaGridSize );
-	    //Cuda::printThreadsSetup( cudaBlockSize, cudaBlocksCount, cudaGridSize, cudaGridsCount );
-            GridTraverser2D< Real, Index, GridEntity, UserData, EntitiesProcessor, processOnlyBoundaryEntities, GridEntityParameters... >
-               <<< cudaGridSize, cudaBlockSize, 0, s >>>
-               ( &gridPointer.template getData< Devices::Cuda >(),
-                 userData,
-                 begin,
-                 end,
-                 gridIdx,
-                 gridEntityParameters... );
+            // Cuda::printThreadsSetup( cudaBlockSize, cudaBlocksCount, cudaGridSize, cudaGridsCount );
+            GridTraverser2D< Real,
+                             Index,
+                             GridEntity,
+                             UserData,
+                             EntitiesProcessor,
+                             processOnlyBoundaryEntities,
+                             GridEntityParameters... >
+               <<< cudaGridSize, cudaBlockSize, 0,
+               s >>>(
+                  &gridPointer.template getData< Devices::Cuda >(), userData, begin, end, gridIdx, gridEntityParameters... );
          }
 
-#ifdef NDEBUG
-   if( mode == synchronousMode )
-   {
+   #ifdef NDEBUG
+      if( mode == synchronousMode ) {
+         cudaStreamSynchronize( s );
+         TNL_CHECK_CUDA_DEVICE;
+      }
+   #else
       cudaStreamSynchronize( s );
       TNL_CHECK_CUDA_DEVICE;
-   }
-#else
-   cudaStreamSynchronize( s );
-   TNL_CHECK_CUDA_DEVICE;
-#endif
+   #endif
    }
 
 #else
@@ -548,5 +520,5 @@ processEntities(
 #endif
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/GridDetails/GridTraverser_3D.hpp b/src/TNL/Meshes/GridDetails/GridTraverser_3D.hpp
index c37f5cb3e84b9153995a4c6ddb3ff57b6326092f..332360080a5afbf8559f9220760665dc1884c8fc 100644
--- a/src/TNL/Meshes/GridDetails/GridTraverser_3D.hpp
+++ b/src/TNL/Meshes/GridDetails/GridTraverser_3D.hpp
@@ -16,43 +16,34 @@
 namespace TNL {
 namespace Meshes {
 
-
 /****
  * 3D traverser, host
  */
-template< typename Real,
-          typename Index >
-   template<
-      typename GridEntity,
-      typename EntitiesProcessor,
-      typename UserData,
-      bool processOnlyBoundaryEntities,
-      int XOrthogonalBoundary,
-      int YOrthogonalBoundary,
-      int ZOrthogonalBoundary,
-      typename... GridEntityParameters >
+template< typename Real, typename Index >
+template< typename GridEntity,
+          typename EntitiesProcessor,
+          typename UserData,
+          bool processOnlyBoundaryEntities,
+          int XOrthogonalBoundary,
+          int YOrthogonalBoundary,
+          int ZOrthogonalBoundary,
+          typename... GridEntityParameters >
 void
-GridTraverser< Meshes::Grid< 3, Real, Devices::Host, Index > >::
-processEntities(
+GridTraverser< Meshes::Grid< 3, Real, Devices::Host, Index > >::processEntities(
    const GridPointer& gridPointer,
-   const CoordinatesType begin,
-   const CoordinatesType end,
+   const CoordinatesType& begin,
+   const CoordinatesType& end,
    UserData& userData,
    GridTraverserMode mode,
    const int& stream,
    const GridEntityParameters&... gridEntityParameters )
 {
-   if( processOnlyBoundaryEntities )
-   {
+   if( processOnlyBoundaryEntities ) {
       GridEntity entity( *gridPointer, begin, gridEntityParameters... );
 
       if( ZOrthogonalBoundary )
-         for( entity.getCoordinates().y() = begin.y();
-              entity.getCoordinates().y() < end.y();
-              entity.getCoordinates().y() ++ )
-            for( entity.getCoordinates().x() = begin.x();
-                 entity.getCoordinates().x() < end.x();
-                 entity.getCoordinates().x() ++ )
+         for( entity.getCoordinates().y() = begin.y(); entity.getCoordinates().y() < end.y(); entity.getCoordinates().y()++ )
+            for( entity.getCoordinates().x() = begin.x(); entity.getCoordinates().x() < end.x(); entity.getCoordinates().x()++ )
             {
                entity.getCoordinates().z() = begin.z();
                entity.refresh();
@@ -62,12 +53,8 @@ processEntities(
                EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
             }
       if( YOrthogonalBoundary )
-         for( entity.getCoordinates().z() = begin.z();
-                 entity.getCoordinates().z() < end.z();
-                 entity.getCoordinates().z() ++ )
-            for( entity.getCoordinates().x() = begin.x();
-                 entity.getCoordinates().x() < end.x();
-                 entity.getCoordinates().x() ++ )
+         for( entity.getCoordinates().z() = begin.z(); entity.getCoordinates().z() < end.z(); entity.getCoordinates().z()++ )
+            for( entity.getCoordinates().x() = begin.x(); entity.getCoordinates().x() < end.x(); entity.getCoordinates().x()++ )
             {
                entity.getCoordinates().y() = begin.y();
                entity.refresh();
@@ -77,12 +64,8 @@ processEntities(
                EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
             }
       if( XOrthogonalBoundary )
-         for( entity.getCoordinates().z() = begin.z();
-              entity.getCoordinates().z() < end.z();
-              entity.getCoordinates().z() ++ )
-            for( entity.getCoordinates().y() = begin.y();
-                 entity.getCoordinates().y() < end.y();
-                 entity.getCoordinates().y() ++ )
+         for( entity.getCoordinates().z() = begin.z(); entity.getCoordinates().z() < end.z(); entity.getCoordinates().z()++ )
+            for( entity.getCoordinates().y() = begin.y(); entity.getCoordinates().y() < end.y(); entity.getCoordinates().y()++ )
             {
                entity.getCoordinates().x() = begin.x();
                entity.refresh();
@@ -92,20 +75,17 @@ processEntities(
                EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
             }
    }
-   else
-   {
+   else {
 #ifdef HAVE_OPENMP
-      if( Devices::Host::isOMPEnabled() )
-      {
-#pragma omp parallel firstprivate( begin, end )
+      if( Devices::Host::isOMPEnabled() ) {
+         #pragma omp parallel firstprivate( begin, end )
          {
             GridEntity entity( *gridPointer, begin, gridEntityParameters... );
-#pragma omp for
+            #pragma omp for
             // TODO: g++ 5.5 crashes when coding this loop without auxiliary x and y as bellow
-            for( IndexType z = begin.z(); z < end.z(); z ++ )
-               for( IndexType y = begin.y(); y < end.y(); y ++ )
-                  for( IndexType x = begin.x(); x < end.x(); x ++ )
-                  {
+            for( IndexType z = begin.z(); z < end.z(); z++ )
+               for( IndexType y = begin.y(); y < end.y(); y++ )
+                  for( IndexType x = begin.x(); x < end.x(); x++ ) {
                      entity.getCoordinates().x() = x;
                      entity.getCoordinates().y() = y;
                      entity.getCoordinates().z() = z;
@@ -114,38 +94,25 @@ processEntities(
                   }
          }
       }
-      else
-      {
+      else {
          GridEntity entity( *gridPointer, begin, gridEntityParameters... );
-         for( entity.getCoordinates().z() = begin.z();
-              entity.getCoordinates().z() < end.z();
-              entity.getCoordinates().z() ++ )
-            for( entity.getCoordinates().y() = begin.y();
-                 entity.getCoordinates().y() < end.y();
-                 entity.getCoordinates().y() ++ )
-               for( entity.getCoordinates().x() = begin.x();
-                    entity.getCoordinates().x() < end.x();
-                    entity.getCoordinates().x() ++ )
-                  {
-                     entity.refresh();
-                     EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
-                  }
-      }
-#else
-      GridEntity entity( *gridPointer, begin, gridEntityParameters... );
-      for( entity.getCoordinates().z() = begin.z();
-           entity.getCoordinates().z() < end.z();
-           entity.getCoordinates().z() ++ )
-         for( entity.getCoordinates().y() = begin.y();
-              entity.getCoordinates().y() < end.y();
-              entity.getCoordinates().y() ++ )
-            for( entity.getCoordinates().x() = begin.x();
-                 entity.getCoordinates().x() < end.x();
-                 entity.getCoordinates().x() ++ )
-               {
+         for( entity.getCoordinates().z() = begin.z(); entity.getCoordinates().z() < end.z(); entity.getCoordinates().z()++ )
+            for( entity.getCoordinates().y() = begin.y(); entity.getCoordinates().y() < end.y(); entity.getCoordinates().y()++ )
+               for( entity.getCoordinates().x() = begin.x(); entity.getCoordinates().x() < end.x();
+                    entity.getCoordinates().x()++ ) {
                   entity.refresh();
                   EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
                }
+      }
+#else
+      GridEntity entity( *gridPointer, begin, gridEntityParameters... );
+      for( entity.getCoordinates().z() = begin.z(); entity.getCoordinates().z() < end.z(); entity.getCoordinates().z()++ )
+         for( entity.getCoordinates().y() = begin.y(); entity.getCoordinates().y() < end.y(); entity.getCoordinates().y()++ )
+            for( entity.getCoordinates().x() = begin.x(); entity.getCoordinates().x() < end.x(); entity.getCoordinates().x()++ )
+            {
+               entity.refresh();
+               EntitiesProcessor::processEntity( entity.getMesh(), userData, entity );
+            }
 #endif
    }
 }
@@ -161,14 +128,14 @@ template< typename Real,
           typename EntitiesProcessor,
           bool processOnlyBoundaryEntities,
           typename... GridEntityParameters >
-__global__ void
-GridTraverser3D(
-   const Meshes::Grid< 3, Real, Devices::Cuda, Index >* grid,
-   UserData userData,
-   const typename GridEntity::CoordinatesType begin,
-   const typename GridEntity::CoordinatesType end,
-   const dim3 gridIdx,
-   const GridEntityParameters... gridEntityParameters )
+__global__
+void
+GridTraverser3D( const Meshes::Grid< 3, Real, Devices::Cuda, Index >* grid,
+                 UserData userData,
+                 const typename GridEntity::CoordinatesType begin,
+                 const typename GridEntity::CoordinatesType end,
+                 const dim3 gridIdx,
+                 const GridEntityParameters... gridEntityParameters )
 {
    typedef Meshes::Grid< 3, Real, Devices::Cuda, Index > GridType;
    typename GridType::CoordinatesType coordinates;
@@ -177,16 +144,11 @@ GridTraverser3D(
    coordinates.y() = begin.y() + Cuda::getGlobalThreadIdx_y( gridIdx );
    coordinates.z() = begin.z() + Cuda::getGlobalThreadIdx_z( gridIdx );
 
-   if( coordinates < end )
-   {
+   if( coordinates < end ) {
       GridEntity entity( *grid, coordinates, gridEntityParameters... );
       entity.refresh();
-      if( ! processOnlyBoundaryEntities || entity.isBoundaryEntity() )
-      {
-         EntitiesProcessor::processEntity
-         ( *grid,
-           userData,
-           entity );
+      if( ! processOnlyBoundaryEntities || entity.isBoundaryEntity() ) {
+         EntitiesProcessor::processEntity( *grid, userData, entity );
       }
    }
 }
@@ -198,17 +160,17 @@ template< typename Real,
           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 )
+__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;
@@ -217,14 +179,10 @@ GridTraverser3DBoundaryAlongXY(
    coordinates.y() = beginY + Cuda::getGlobalThreadIdx_y( gridIdx );
    coordinates.z() = fixedZ;
 
-   if( coordinates.x() < endX && coordinates.y() < endY )
-   {
+   if( coordinates.x() < endX && coordinates.y() < endY ) {
       GridEntity entity( *grid, coordinates, gridEntityParameters... );
       entity.refresh();
-      EntitiesProcessor::processEntity
-      ( *grid,
-        userData,
-        entity );
+      EntitiesProcessor::processEntity( *grid, userData, entity );
    }
 }
 
@@ -235,17 +193,17 @@ template< typename Real,
           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 )
+__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;
@@ -254,14 +212,10 @@ GridTraverser3DBoundaryAlongXZ(
    coordinates.y() = fixedY;
    coordinates.z() = beginZ + Cuda::getGlobalThreadIdx_y( gridIdx );
 
-   if( coordinates.x() < endX && coordinates.z() < endZ )
-   {
+   if( coordinates.x() < endX && coordinates.z() < endZ ) {
       GridEntity entity( *grid, coordinates, gridEntityParameters... );
       entity.refresh();
-      EntitiesProcessor::processEntity
-      ( *grid,
-        userData,
-        entity );
+      EntitiesProcessor::processEntity( *grid, userData, entity );
    }
 }
 
@@ -272,17 +226,17 @@ template< typename Real,
           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 )
+__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;
@@ -291,32 +245,25 @@ GridTraverser3DBoundaryAlongYZ(
    coordinates.y() = beginY + Cuda::getGlobalThreadIdx_x( gridIdx );
    coordinates.z() = beginZ + Cuda::getGlobalThreadIdx_y( gridIdx );
 
-   if( coordinates.y() < endY && coordinates.z() < endZ )
-   {
+   if( coordinates.y() < endY && coordinates.z() < endZ ) {
       GridEntity entity( *grid, coordinates, gridEntityParameters... );
       entity.refresh();
-      EntitiesProcessor::processEntity
-      ( *grid,
-        userData,
-        entity );
+      EntitiesProcessor::processEntity( *grid, userData, entity );
    }
 }
 #endif
 
-template< typename Real,
-          typename Index >
-   template<
-      typename GridEntity,
-      typename EntitiesProcessor,
-      typename UserData,
-      bool processOnlyBoundaryEntities,
-         int XOrthogonalBoundary,
-         int YOrthogonalBoundary,
-         int ZOrthogonalBoundary,
-      typename... GridEntityParameters >
+template< typename Real, typename Index >
+template< typename GridEntity,
+          typename EntitiesProcessor,
+          typename UserData,
+          bool processOnlyBoundaryEntities,
+          int XOrthogonalBoundary,
+          int YOrthogonalBoundary,
+          int ZOrthogonalBoundary,
+          typename... GridEntityParameters >
 void
-GridTraverser< Meshes::Grid< 3, Real, Devices::Cuda, Index > >::
-processEntities(
+GridTraverser< Meshes::Grid< 3, Real, Devices::Cuda, Index > >::processEntities(
    const GridPointer& gridPointer,
    const CoordinatesType& begin,
    const CoordinatesType& end,
@@ -326,20 +273,19 @@ processEntities(
    const GridEntityParameters&... gridEntityParameters )
 {
 #ifdef HAVE_CUDA
-   if( processOnlyBoundaryEntities &&
-       ( GridEntity::getEntityDimension() == 3 || GridEntity::getEntityDimension() == 0 ) )
-   {
+   if( processOnlyBoundaryEntities && ( GridEntity::getEntityDimension() == 3 || GridEntity::getEntityDimension() == 0 ) ) {
       dim3 cudaBlockSize( 16, 16 );
       const IndexType entitiesAlongX = end.x() - begin.x();
       const IndexType entitiesAlongY = end.y() - begin.y();
       const IndexType entitiesAlongZ = end.z() - begin.z();
 
-      dim3 cudaBlocksCountAlongXY, cudaBlocksCountAlongXZ, cudaBlocksCountAlongYZ,
-           cudaGridsCountAlongXY, cudaGridsCountAlongXZ, cudaGridsCountAlongYZ;
+      dim3 cudaBlocksCountAlongXY, cudaBlocksCountAlongXZ, cudaBlocksCountAlongYZ, cudaGridsCountAlongXY, cudaGridsCountAlongXZ,
+         cudaGridsCountAlongYZ;
 
       Cuda::setupThreads( cudaBlockSize, cudaBlocksCountAlongXY, cudaGridsCountAlongXY, entitiesAlongX, entitiesAlongY );
       Cuda::setupThreads( cudaBlockSize, cudaBlocksCountAlongXZ, cudaGridsCountAlongXZ, entitiesAlongX, entitiesAlongZ - 2 );
-      Cuda::setupThreads( cudaBlockSize, cudaBlocksCountAlongYZ, cudaGridsCountAlongYZ, entitiesAlongY - 2, entitiesAlongZ - 2 );
+      Cuda::setupThreads(
+         cudaBlockSize, cudaBlocksCountAlongYZ, cudaGridsCountAlongYZ, entitiesAlongY - 2, entitiesAlongZ - 2 );
 
       auto& pool = Cuda::StreamPool::getInstance();
       Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >();
@@ -353,85 +299,118 @@ processEntities(
 
       dim3 gridIdx, gridSize;
       for( gridIdx.y = 0; gridIdx.y < cudaGridsCountAlongXY.y; gridIdx.y++ )
-         for( gridIdx.x = 0; gridIdx.x < cudaGridsCountAlongXY.x; gridIdx.x++ )
-         {
+         for( gridIdx.x = 0; gridIdx.x < cudaGridsCountAlongXY.x; gridIdx.x++ ) {
             Cuda::setupGrid( cudaBlocksCountAlongXY, cudaGridsCountAlongXY, gridIdx, gridSize );
-            GridTraverser3DBoundaryAlongXY< Real, Index, GridEntity, UserData, EntitiesProcessor, processOnlyBoundaryEntities, GridEntityParameters... >
-                  <<< cudaBlocksCountAlongXY, cudaBlockSize, 0 , s1 >>>
-                  ( &gridPointer.template getData< Devices::Cuda >(),
-                    userData,
-                    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 >(),
-                    userData,
-                    begin.x(),
-                    end.x(),
-                    begin.y(),
-                    end.y(),
-                    end.z(),
-                    gridIdx,
-                    gridEntityParameters... );
+            GridTraverser3DBoundaryAlongXY< Real,
+                                            Index,
+                                            GridEntity,
+                                            UserData,
+                                            EntitiesProcessor,
+                                            processOnlyBoundaryEntities,
+                                            GridEntityParameters... >
+               <<< cudaBlocksCountAlongXY, cudaBlockSize, 0,
+               s1 >>>( &gridPointer.template getData< Devices::Cuda >(),
+                                      userData,
+                                      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 >(),
+                                      userData,
+                                      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++ )
-         {
+         for( gridIdx.x = 0; gridIdx.x < cudaGridsCountAlongXZ.x; gridIdx.x++ ) {
             Cuda::setupGrid( cudaBlocksCountAlongXZ, cudaGridsCountAlongXZ, gridIdx, gridSize );
-            GridTraverser3DBoundaryAlongXZ< Real, Index, GridEntity, UserData, EntitiesProcessor, processOnlyBoundaryEntities, GridEntityParameters... >
-                  <<< cudaBlocksCountAlongXZ, cudaBlockSize, 0, s3 >>>
-                  ( &gridPointer.template getData< Devices::Cuda >(),
-                    userData,
-                    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 >(),
-                    userData,
-                    begin.x(),
-                    end.x(),
-                    begin.z() + 1,
-                    end.z() - 1,
-                    end.y(),
-                    gridIdx,
-                    gridEntityParameters... );
+            GridTraverser3DBoundaryAlongXZ< Real,
+                                            Index,
+                                            GridEntity,
+                                            UserData,
+                                            EntitiesProcessor,
+                                            processOnlyBoundaryEntities,
+                                            GridEntityParameters... >
+               <<< cudaBlocksCountAlongXZ, cudaBlockSize, 0,
+               s3 >>>( &gridPointer.template getData< Devices::Cuda >(),
+                                      userData,
+                                      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 >(),
+                                      userData,
+                                      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++ )
-         {
+         for( gridIdx.x = 0; gridIdx.x < cudaGridsCountAlongYZ.x; gridIdx.x++ ) {
             Cuda::setupGrid( cudaBlocksCountAlongYZ, cudaGridsCountAlongYZ, gridIdx, gridSize );
-            GridTraverser3DBoundaryAlongYZ< Real, Index, GridEntity, UserData, EntitiesProcessor, processOnlyBoundaryEntities, GridEntityParameters... >
-                  <<< cudaBlocksCountAlongYZ, cudaBlockSize, 0, s5 >>>
-                  ( &gridPointer.template getData< Devices::Cuda >(),
-                    userData,
-                    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 >(),
-                    userData,
-                    begin.y() + 1,
-                    end.y() - 1,
-                    begin.z() + 1,
-                    end.z() - 1,
-                    end.x(),
-                    gridIdx,
-                    gridEntityParameters... );
+            GridTraverser3DBoundaryAlongYZ< Real,
+                                            Index,
+                                            GridEntity,
+                                            UserData,
+                                            EntitiesProcessor,
+                                            processOnlyBoundaryEntities,
+                                            GridEntityParameters... >
+               <<< cudaBlocksCountAlongYZ, cudaBlockSize, 0,
+               s5 >>>( &gridPointer.template getData< Devices::Cuda >(),
+                                      userData,
+                                      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 >(),
+                                      userData,
+                                      begin.y() + 1,
+                                      end.y() - 1,
+                                      begin.z() + 1,
+                                      end.z() - 1,
+                                      end.x(),
+                                      gridIdx,
+                                      gridEntityParameters... );
          }
       cudaStreamSynchronize( s1 );
       cudaStreamSynchronize( s2 );
@@ -441,39 +420,36 @@ processEntities(
       cudaStreamSynchronize( s6 );
       TNL_CHECK_CUDA_DEVICE;
    }
-   else
-   {
+   else {
       dim3 cudaBlockSize( 8, 8, 8 );
       dim3 cudaBlocksCount, cudaGridsCount;
 
-      Cuda::setupThreads( cudaBlockSize, cudaBlocksCount, cudaGridsCount,
-                          end.x() - begin.x(),
-                          end.y() - begin.y(),
-                          end.z() - begin.z() );
+      Cuda::setupThreads(
+         cudaBlockSize, cudaBlocksCount, cudaGridsCount, end.x() - begin.x(), end.y() - begin.y(), end.z() - begin.z() );
 
       auto& pool = Cuda::StreamPool::getInstance();
       const cudaStream_t& s = pool.getStream( stream );
 
       Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >();
       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 ++ )
-            {
+      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++ ) {
                Cuda::setupGrid( cudaBlocksCount, cudaGridsCount, gridIdx, gridSize );
-               GridTraverser3D< Real, Index, GridEntity, UserData, EntitiesProcessor, processOnlyBoundaryEntities, GridEntityParameters... >
-                  <<< gridSize, cudaBlockSize, 0, s >>>
-                  ( &gridPointer.template getData< Devices::Cuda >(),
-                    userData,
-                    begin,
-                    end,
-                    gridIdx,
-                    gridEntityParameters... );
+               GridTraverser3D< Real,
+                                Index,
+                                GridEntity,
+                                UserData,
+                                EntitiesProcessor,
+                                processOnlyBoundaryEntities,
+                                GridEntityParameters... >
+                  <<< gridSize, cudaBlockSize, 0,
+                  s >>>(
+                     &gridPointer.template getData< Devices::Cuda >(), userData, begin, end, gridIdx, gridEntityParameters... );
             }
 
       // only launches into the stream 0 are synchronized
-      if( stream == 0 )
-      {
+      if( stream == 0 ) {
          cudaStreamSynchronize( s );
          TNL_CHECK_CUDA_DEVICE;
       }
@@ -483,5 +459,5 @@ processEntities(
 #endif
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/GridDetails/NeighborGridEntitiesStorage.h b/src/TNL/Meshes/GridDetails/NeighborGridEntitiesStorage.h
index 36fab5fc53215194ae9d264536aad24dc8c8290d..ffd68c334580793e3972f70d3593dda28364c337 100644
--- a/src/TNL/Meshes/GridDetails/NeighborGridEntitiesStorage.h
+++ b/src/TNL/Meshes/GridDetails/NeighborGridEntitiesStorage.h
@@ -18,102 +18,84 @@ template< typename GridEntity,
           int NeighborEntityDimension,
           typename GridEntityConfig,
           bool storage = GridEntityConfig::template neighborEntityStorage< GridEntity >( NeighborEntityDimension ) >
-class NeighborGridEntityLayer
-: public NeighborGridEntityLayer< GridEntity, NeighborEntityDimension - 1, GridEntityConfig >
+class NeighborGridEntityLayer : 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 DimensionTag< 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;
+public:
+   using BaseType = NeighborGridEntityLayer< GridEntity, NeighborEntityDimension - 1, GridEntityConfig >;
+   using NeighborEntityGetterType = NeighborGridEntityGetter< GridEntity, NeighborEntityDimension >;
+
+   using BaseType::getNeighborEntities;
+
+   __cuda_callable__
+   NeighborGridEntityLayer( const GridEntity& entity ) : BaseType( entity ), neighborEntities( entity ) {}
+
+   __cuda_callable__
+   const NeighborEntityGetterType&
+   getNeighborEntities( const DimensionTag< 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,
-          bool storage >
+template< typename GridEntity, typename GridEntityConfig, bool storage >
 class NeighborGridEntityLayer< GridEntity, 0, GridEntityConfig, storage >
 {
-   public:
- 
-      typedef NeighborGridEntityGetter< GridEntity, 0 > NeighborEntityGetterType;
- 
-      __cuda_callable__
-      NeighborGridEntityLayer( const GridEntity& entity )
-      : neighborEntities( entity )
-      {}
-
-      __cuda_callable__
-      const NeighborEntityGetterType& getNeighborEntities( const DimensionTag< 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;
-};
+public:
+   using NeighborEntityGetterType = NeighborGridEntityGetter< GridEntity, 0 >;
 
+   __cuda_callable__
+   NeighborGridEntityLayer( const GridEntity& entity ) : neighborEntities( entity ) {}
 
+   __cuda_callable__
+   const NeighborEntityGetterType&
+   getNeighborEntities( const DimensionTag< 0 >& tag ) const
+   {
+      return this->neighborEntities;
+   }
 
-template< typename GridEntity,
-          typename GridEntityConfig >
+   __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, typename GridEntityConfig >
 class NeighborGridEntitiesStorage
 : public NeighborGridEntityLayer< GridEntity, GridEntity::getMeshDimension(), GridEntityConfig >
 {
-   typedef NeighborGridEntityLayer< GridEntity, GridEntity::getMeshDimension(), 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( DimensionTag< EntityDimension >() );
-      }
-};
+   using BaseType = NeighborGridEntityLayer< GridEntity, GridEntity::getMeshDimension(), GridEntityConfig >;
+
+public:
+   using BaseType::getNeighborEntities;
+   using BaseType::refresh;
 
+   __cuda_callable__
+   NeighborGridEntitiesStorage( const GridEntity& entity ) : BaseType( entity ) {}
 
-} // namespace Meshes
-} // namespace TNL
+   template< int EntityDimension >
+   __cuda_callable__
+   const NeighborGridEntityGetter< GridEntity, EntityDimension >&
+   getNeighborEntities() const
+   {
+      return BaseType::getNeighborEntities( DimensionTag< EntityDimension >() );
+   }
+};
 
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter.h b/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter.h
index 80bba14facb748d7e03363bc1e185812eb538338..b597751fda5abafcc47a6a293e989b7a2b72f9f7 100644
--- a/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter.h
+++ b/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter.h
@@ -15,29 +15,26 @@ namespace Meshes {
 
 template< typename GridEntity,
           int NeighborEntityDimension,
-          typename EntityStencilTag =
-            GridEntityStencilStorageTag< GridEntity::ConfigType::template neighborEntityStorage< GridEntity >( NeighborEntityDimension ) > >
+          typename EntityStencilTag = GridEntityStencilStorageTag<
+             GridEntity::ConfigType::template neighborEntityStorage< GridEntity >( NeighborEntityDimension ) > >
 class NeighborGridEntityGetter
 {
-   public:
-
-      // TODO: not all specializations are implemented yet
- 
-      __cuda_callable__
-      NeighborGridEntityGetter( const GridEntity& entity )
-      {
-         //TNL_ASSERT( false, );
-      }
- 
-      __cuda_callable__
-      void refresh( const typename GridEntity::GridType& grid,
-                    const typename GridEntity::IndexType& entityIndex )
-      {
-         //TNL_ASSERT( false, );
-      }
-
+public:
+   // TODO: not all specializations are implemented yet
+
+   __cuda_callable__
+   NeighborGridEntityGetter( const GridEntity& entity )
+   {
+      // TNL_ASSERT( false, );
+   }
+
+   __cuda_callable__
+   void
+   refresh( const typename GridEntity::GridType& grid, const typename GridEntity::IndexType& entityIndex )
+   {
+      // TNL_ASSERT( false, );
+   }
 };
 
-} // namespace Meshes
-} // namespace TNL
-
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter1D_impl.h b/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter1D_impl.h
index 22ae6ff3e14721d6e58804c02ba2e6221b2db79c..c9db445e6d938d2384f5cf7fc43e827eb5ba9cc3 100644
--- a/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter1D_impl.h
+++ b/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter1D_impl.h
@@ -22,69 +22,61 @@ namespace Meshes {
  * |       1         |              1            |       ----        |
  * +-----------------+---------------------------+-------------------+
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-class NeighborGridEntityGetter<
-   GridEntity< Meshes::Grid< 1, Real, Device, Index >, 1, Config >,
-   1,
-   GridEntityStencilStorageTag< GridEntityNoStencil > >
+template< typename Real, typename Device, typename Index, typename Config >
+class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 1, Real, Device, Index >, 1, Config >,
+                                1,
+                                GridEntityStencilStorageTag< GridEntityNoStencil > >
 {
-   public:
-
-      static constexpr int EntityDimension = 1;
-      static constexpr int NeighborEntityDimension = 1;
-      typedef Meshes::Grid< 1, Real, Device, Index > GridType;
-      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, NeighborGridEntityType > GridEntityGetterType;
-
-      __cuda_callable__ inline
-      NeighborGridEntityGetter( const GridEntityType& entity )
-      : entity( entity )
-      {}
-
-      template< int step >
-      __cuda_callable__ inline
-      NeighborGridEntityType getEntity() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
-         return NeighborGridEntity( CoordinatesType( entity.getCoordinates().x() + step ) );
-      }
-
-      template< int step >
-      __cuda_callable__ inline
-      IndexType getEntityIndex() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
-         return this->entity.getIndex() + step;
-      }
-
-      __cuda_callable__
-      void refresh( const GridType& grid, const IndexType& entityIndex ){};
-
-   protected:
-
-      const GridEntityType& entity;
+public:
+   static constexpr int EntityDimension = 1;
+   static constexpr int NeighborEntityDimension = 1;
+   using GridType = Meshes::Grid< 1, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, EntityDimension, Config >;
+   using NeighborGridEntityType = GridEntity< GridType, NeighborEntityDimension, Config >;
+   using RealType = Real;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using GridEntityGetterType = GridEntityGetter< GridType, NeighborGridEntityType >;
+
+   __cuda_callable__
+   inline NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {}
+
+   template< int step >
+   __cuda_callable__
+   inline NeighborGridEntityType
+   getEntity() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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() << " EntityDimension = " << EntityDimension );
+      return NeighborGridEntity( CoordinatesType( entity.getCoordinates().x() + step ) );
+   }
+
+   template< int step >
+   __cuda_callable__
+   inline IndexType
+   getEntityIndex() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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() << " EntityDimension = " << EntityDimension );
+      return this->entity.getIndex() + step;
+   }
+
+   __cuda_callable__
+   void
+   refresh( const GridType& grid, const IndexType& entityIndex ){};
+
+protected:
+   const GridEntityType& entity;
 };
 
-
 /****
  * +-----------------+---------------------------+-------------------+
  * | EntityDimenions | NeighborEntityDimension |  Stored Stencil   |
@@ -92,87 +84,76 @@ class NeighborGridEntityGetter<
  * |       1         |              1            |  Cross/Full       |
  * +-----------------+---------------------------+-------------------+
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config,
-          typename StencilStorage >
-class NeighborGridEntityGetter<
-   GridEntity< Meshes::Grid< 1, Real, Device, Index >, 1, Config >,
-   1,
-   StencilStorage >
+template< typename Real, typename Device, typename Index, typename Config, typename StencilStorage >
+class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 1, Real, Device, Index >, 1, Config >, 1, StencilStorage >
 {
-   public:
-
-      static constexpr int EntityDimension = 1;
-      static constexpr int NeighborEntityDimension = 1;
-      typedef Meshes::Grid< 1, Real, Device, Index > GridType;
-      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, NeighborGridEntityType > GridEntityGetterType;
-
-      static constexpr int stencilSize = Config::getStencilSize();
-
-      __cuda_callable__ inline
-      NeighborGridEntityGetter( const GridEntityType& entity )
-      : entity( entity )
-      {}
-
-      template< int step >
-      __cuda_callable__ inline
-      NeighborGridEntityType getEntity() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
-         return NeighborGridEntityType( this->entity.getMesh(), CoordinatesType( entity.getCoordinates().x() + step ) );
-      }
-
-      template< int step >
-      __cuda_callable__ inline
-      IndexType getEntityIndex() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
+public:
+   static constexpr int EntityDimension = 1;
+   static constexpr int NeighborEntityDimension = 1;
+   using GridType = Meshes::Grid< 1, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, EntityDimension, Config >;
+   using NeighborGridEntityType = GridEntity< GridType, NeighborEntityDimension, Config >;
+   using RealType = Real;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using GridEntityGetterType = GridEntityGetter< GridType, NeighborGridEntityType >;
+
+   static constexpr int stencilSize = Config::getStencilSize();
+
+   __cuda_callable__
+   inline NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {}
+
+   template< int step >
+   __cuda_callable__
+   inline NeighborGridEntityType
+   getEntity() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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() << " EntityDimension = " << EntityDimension );
+      return NeighborGridEntityType( this->entity.getMesh(), CoordinatesType( entity.getCoordinates().x() + step ) );
+   }
+
+   template< int step >
+   __cuda_callable__
+   inline IndexType
+   getEntityIndex() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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() << " EntityDimension = " << EntityDimension );
 #ifndef HAVE_CUDA  // TODO: fix it -- does not work with nvcc
-         if( step < -stencilSize || step > stencilSize )
-            return this->entity.getIndex() + step;
-         return stencil[ stencilSize + step ];
-#else
+      if( step < -stencilSize || step > stencilSize )
          return this->entity.getIndex() + step;
+      return stencil[ stencilSize + step ];
+#else
+      return this->entity.getIndex() + step;
 #endif
+   }
 
-      }
-
-      __cuda_callable__
-      void refresh( const GridType& grid, const IndexType& entityIndex )
-      {
+   __cuda_callable__
+   void
+   refresh( const GridType& grid, const IndexType& entityIndex )
+   {
 #ifndef HAVE_CUDA  // TODO: fix it -- does not work with nvcc
-         Algorithms::staticFor< IndexType, -stencilSize, stencilSize + 1 >(
-            [&] ( auto index ) {
-               stencil[ index + stencilSize ] = entityIndex + index;
-            }
-         );
+      Algorithms::staticFor< IndexType, -stencilSize, stencilSize + 1 >(
+         [ & ]( auto index )
+         {
+            stencil[ index + stencilSize ] = entityIndex + index;
+         } );
 #endif
-      };
-
-   protected:
+   };
 
-      const GridEntityType& entity;
+protected:
+   const GridEntityType& entity;
 
-      IndexType stencil[ 2 * stencilSize + 1 ];
+   IndexType stencil[ 2 * stencilSize + 1 ];
 };
 
 /****
@@ -182,69 +163,61 @@ class NeighborGridEntityGetter<
  * |       1         |              0            |       None        |
  * +-----------------+---------------------------+-------------------+
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-class NeighborGridEntityGetter<
-   GridEntity< Meshes::Grid< 1, Real, Device, Index >, 1, Config >,
-   0,
-   GridEntityStencilStorageTag< GridEntityNoStencil > >
+template< typename Real, typename Device, typename Index, typename Config >
+class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 1, Real, Device, Index >, 1, Config >,
+                                0,
+                                GridEntityStencilStorageTag< GridEntityNoStencil > >
 {
-   public:
-
-      static constexpr int EntityDimension = 1;
-      static constexpr int NeighborEntityDimension = 0;
-      typedef Meshes::Grid< 1, Real, Device, Index > GridType;
-      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, NeighborGridEntityType > GridEntityGetterType;
-
-      __cuda_callable__ inline
-      NeighborGridEntityGetter( const GridEntityType& entity )
-      : entity( entity )
-      {}
-
-      template< int step >
-      __cuda_callable__ inline
-      NeighborGridEntityType getEntity() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
-         return NeighborGridEntity( CoordinatesType( entity.getCoordinates().x() + step + ( step < 0 ) ) );
-      }
-
-      template< int step >
-      __cuda_callable__ inline
-      IndexType getEntityIndex() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
-         return this->entity.getIndex() + step + ( step < 0 );
-      }
-
-      __cuda_callable__
-      void refresh( const GridType& grid, const IndexType& entityIndex ){};
-
-   protected:
-
-      const GridEntityType& entity;
-
-      //NeighborGridEntityGetter(){};
-
+public:
+   static constexpr int EntityDimension = 1;
+   static constexpr int NeighborEntityDimension = 0;
+   using GridType = Meshes::Grid< 1, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, EntityDimension, Config >;
+   using NeighborGridEntityType = GridEntity< GridType, NeighborEntityDimension, Config >;
+   using RealType = Real;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using GridEntityGetterType = GridEntityGetter< GridType, NeighborGridEntityType >;
+
+   __cuda_callable__
+   inline NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {}
+
+   template< int step >
+   __cuda_callable__
+   inline NeighborGridEntityType
+   getEntity() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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() << " EntityDimension = " << EntityDimension );
+      return NeighborGridEntity( CoordinatesType( entity.getCoordinates().x() + step + ( step < 0 ) ) );
+   }
+
+   template< int step >
+   __cuda_callable__
+   inline IndexType
+   getEntityIndex() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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() << " EntityDimension = " << EntityDimension );
+      return this->entity.getIndex() + step + ( step < 0 );
+   }
+
+   __cuda_callable__
+   void
+   refresh( const GridType& grid, const IndexType& entityIndex ){};
+
+protected:
+   const GridEntityType& entity;
+
+   // NeighborGridEntityGetter(){};
 };
 
 /****
@@ -254,69 +227,65 @@ class NeighborGridEntityGetter<
  * |       0         |              1            |       None        |
  * +-----------------+---------------------------+-------------------+
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config,
-          typename StencilStorage >
-class NeighborGridEntityGetter<
-   GridEntity< Meshes::Grid< 1, Real, Device, Index >, 0, Config >,
-   1,
-   StencilStorage > //GridEntityStencilStorageTag< GridEntityNoStencil > >
+template< typename Real, typename Device, typename Index, typename Config, typename StencilStorage >
+class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 1, Real, Device, Index >, 0, Config >,
+                                1,
+                                StencilStorage >  // GridEntityStencilStorageTag< GridEntityNoStencil > >
 {
-   public:
-
-      static constexpr int EntityDimension = 0;
-      static constexpr int NeighborEntityDimension = 1;
-      typedef Meshes::Grid< 1, Real, Device, Index > GridType;
-      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, NeighborGridEntityType > GridEntityGetterType;
-
-      __cuda_callable__ inline
-      NeighborGridEntityGetter( const GridEntityType& entity )
-      : entity( entity )
-      {}
-
-      void test() const { std::cerr << "***" << std::endl; };
-
-      template< int step >
-      __cuda_callable__ inline
-      NeighborGridEntityType getEntity() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
-         TNL_ASSERT_LE( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
-         return NeighborGridEntity( CoordinatesType( entity.getCoordinates().x() + step - ( step > 0 ) ) );
-      }
-
-      template< int step >
-      __cuda_callable__ inline
-      IndexType getEntityIndex() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
-         TNL_ASSERT_LE( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
-         return this->entity.getIndex() + step - ( step > 0 );
-      }
-
-      __cuda_callable__
-      void refresh( const GridType& grid, const IndexType& entityIndex ){};
-
-   protected:
-
-      const GridEntityType& entity;
+public:
+   static constexpr int EntityDimension = 0;
+   static constexpr int NeighborEntityDimension = 1;
+   using GridType = Meshes::Grid< 1, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, EntityDimension, Config >;
+   using NeighborGridEntityType = GridEntity< GridType, NeighborEntityDimension, Config >;
+   using RealType = Real;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using GridEntityGetterType = GridEntityGetter< GridType, NeighborGridEntityType >;
+
+   __cuda_callable__
+   inline NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {}
+
+   void
+   test() const
+   {
+      std::cerr << "***" << std::endl;
+   };
+
+   template< int step >
+   __cuda_callable__
+   inline NeighborGridEntityType
+   getEntity() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
+      TNL_ASSERT_LE( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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() << " EntityDimension = " << EntityDimension );
+      return NeighborGridEntity( CoordinatesType( entity.getCoordinates().x() + step - ( step > 0 ) ) );
+   }
+
+   template< int step >
+   __cuda_callable__
+   inline IndexType
+   getEntityIndex() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
+      TNL_ASSERT_LE( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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() << " EntityDimension = " << EntityDimension );
+      return this->entity.getIndex() + step - ( step > 0 );
+   }
+
+   __cuda_callable__
+   void
+   refresh( const GridType& grid, const IndexType& entityIndex ){};
+
+protected:
+   const GridEntityType& entity;
 };
 
 /****   TODO: Implement this, now it is only a copy of specialization for none stencil storage
@@ -326,70 +295,61 @@ class NeighborGridEntityGetter<
  * |       0         |              1            |       Cross       |
  * +-----------------+---------------------------+-------------------+
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-class NeighborGridEntityGetter<
-   GridEntity< Meshes::Grid< 1, Real, Device, Index >, 0, Config >,
-   1,
-   GridEntityStencilStorageTag< GridEntityCrossStencil > >
+template< typename Real, typename Device, typename Index, typename Config >
+class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 1, Real, Device, Index >, 0, Config >,
+                                1,
+                                GridEntityStencilStorageTag< GridEntityCrossStencil > >
 {
-   public:
-
-      static constexpr int EntityDimension = 0;
-      static constexpr int NeighborEntityDimension = 1;
-      typedef Meshes::Grid< 1, Real, Device, Index > GridType;
-      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, NeighborGridEntityType > GridEntityGetterType;
-
-      __cuda_callable__ inline
-      NeighborGridEntityGetter( const GridEntityType& entity )
-      : entity( entity )
-      {}
-
-
-      template< int step >
-      __cuda_callable__ inline
-      NeighborGridEntityType getEntity() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
-         TNL_ASSERT_LE( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
-         return NeighborGridEntity( CoordinatesType( entity.getCoordinates().x() + step - ( step > 0 ) ) );
-      }
-
-      template< int step >
-      __cuda_callable__ inline
-      IndexType getEntityIndex() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
-         TNL_ASSERT_LE( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
-         return this->entity.getIndex() + step - ( step > 0 );
-      }
-
-      __cuda_callable__
-      void refresh( const GridType& grid, const IndexType& entityIndex ){};
-
-   protected:
-
-      const GridEntityType& entity;
+public:
+   static constexpr int EntityDimension = 0;
+   static constexpr int NeighborEntityDimension = 1;
+   using GridType = Meshes::Grid< 1, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, EntityDimension, Config >;
+   using NeighborGridEntityType = GridEntity< GridType, NeighborEntityDimension, Config >;
+   using RealType = Real;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using GridEntityGetterType = GridEntityGetter< GridType, NeighborGridEntityType >;
+
+   __cuda_callable__
+   inline NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {}
+
+   template< int step >
+   __cuda_callable__
+   inline NeighborGridEntityType
+   getEntity() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
+      TNL_ASSERT_LE( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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() << " EntityDimension = " << EntityDimension );
+      return NeighborGridEntity( CoordinatesType( entity.getCoordinates().x() + step - ( step > 0 ) ) );
+   }
+
+   template< int step >
+   __cuda_callable__
+   inline IndexType
+   getEntityIndex() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
+      TNL_ASSERT_LE( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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() << " EntityDimension = " << EntityDimension );
+      return this->entity.getIndex() + step - ( step > 0 );
+   }
+
+   __cuda_callable__
+   void
+   refresh( const GridType& grid, const IndexType& entityIndex ){};
+
+protected:
+   const GridEntityType& entity;
 };
 
-
 /****
  * +-----------------+---------------------------+-------------------+
  * | EntityDimenions | NeighborEntityDimension |  Stored Stencil   |
@@ -397,69 +357,61 @@ class NeighborGridEntityGetter<
  * |       0         |              0            |       None        |
  * +-----------------+---------------------------+-------------------+
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-class NeighborGridEntityGetter<
-   GridEntity< Meshes::Grid< 1, Real, Device, Index >, 0, Config >,
-   0,
-   GridEntityStencilStorageTag< GridEntityNoStencil > >
+template< typename Real, typename Device, typename Index, typename Config >
+class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 1, Real, Device, Index >, 0, Config >,
+                                0,
+                                GridEntityStencilStorageTag< GridEntityNoStencil > >
 {
-   public:
-
-      static constexpr int EntityDimension = 0;
-      static constexpr int NeighborEntityDimension = 0;
-      typedef Meshes::Grid< 1, Real, Device, Index > GridType;
-      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, NeighborGridEntityType > GridEntityGetterType;
-
-      __cuda_callable__ inline
-      NeighborGridEntityGetter( const GridEntityType& entity )
-      : entity( entity )
-      {}
-
-      template< int step >
-      __cuda_callable__ inline
-      NeighborGridEntityType getEntity() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
-         TNL_ASSERT_LE( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
-         return NeighborGridEntity( CoordinatesType( entity.getCoordinates().x() + step ) );
-      }
-
-      template< int step >
-      __cuda_callable__ inline
-      IndexType getEntityIndex() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
-         TNL_ASSERT_LE( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
-
-         return this->entity.getIndex() + step;
-      }
-
-      __cuda_callable__
-      void refresh( const GridType& grid, const IndexType& entityIndex ){};
-
-
-   protected:
-
-      const GridEntityType& entity;
+public:
+   static constexpr int EntityDimension = 0;
+   static constexpr int NeighborEntityDimension = 0;
+   using GridType = Meshes::Grid< 1, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, EntityDimension, Config >;
+   using NeighborGridEntityType = GridEntity< GridType, NeighborEntityDimension, Config >;
+   using RealType = Real;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using GridEntityGetterType = GridEntityGetter< GridType, NeighborGridEntityType >;
+
+   __cuda_callable__
+   inline NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {}
+
+   template< int step >
+   __cuda_callable__
+   inline NeighborGridEntityType
+   getEntity() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
+      TNL_ASSERT_LE( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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() << " EntityDimension = " << EntityDimension );
+      return NeighborGridEntity( CoordinatesType( entity.getCoordinates().x() + step ) );
+   }
+
+   template< int step >
+   __cuda_callable__
+   inline IndexType
+   getEntityIndex() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0 ), "wrong coordinates" );
+      TNL_ASSERT_LE( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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() << " EntityDimension = " << EntityDimension );
+
+      return this->entity.getIndex() + step;
+   }
+
+   __cuda_callable__
+   void
+   refresh( const GridType& grid, const IndexType& entityIndex ){};
+
+protected:
+   const GridEntityType& entity;
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter2D_impl.h b/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter2D_impl.h
index be212e4db187dae1f52bcfb6040c241766594859..dde6019d9f68bb08f8b709b33f56c5f4fa90339f 100644
--- a/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter2D_impl.h
+++ b/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter2D_impl.h
@@ -22,71 +22,64 @@ namespace Meshes {
  * |       2         |              2            | No specialization |
  * +-----------------+---------------------------+-------------------+
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config,
-          typename StencilStorage >
-class NeighborGridEntityGetter<
-   GridEntity< Meshes::Grid< 2, Real, Device, Index >, 2, Config >,
-   2,
-   StencilStorage >
+template< typename Real, typename Device, typename Index, typename Config, typename StencilStorage >
+class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 2, Real, Device, Index >, 2, Config >, 2, StencilStorage >
 {
-   public:
-
-      static constexpr int EntityDimension = 2;
-      static constexpr int NeighborEntityDimension = 2;
-      typedef Meshes::Grid< 2, Real, Device, Index > GridType;
-      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, NeighborGridEntityType > GridEntityGetterType;
-
-      __cuda_callable__ inline
-      NeighborGridEntityGetter( const GridEntityType& entity )
-      : entity( entity )
-      {}
-
-      template< int stepX, int stepY >
-      __cuda_callable__ inline
-      NeighborGridEntityType getEntity() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
-         return NeighborGridEntityType( this->entity.getMesh(),
-                                         CoordinatesType( entity.getCoordinates().x() + stepX,
-                                                          entity.getCoordinates().y() + stepY ) );
-      }
-
-      template< int stepX, int stepY >
-      __cuda_callable__ inline
-      IndexType getEntityIndex() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
-         return this->entity.getIndex() + stepY * entity.getMesh().getDimensions().x() + stepX;
-      }
-
-      __cuda_callable__
-      void refresh( const GridType& grid, const IndexType& entityIndex ){};
-
-   protected:
-
-      const GridEntityType& entity;
-
-      //NeighborGridEntityGetter(){};
+public:
+   static constexpr int EntityDimension = 2;
+   static constexpr int NeighborEntityDimension = 2;
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, EntityDimension, Config >;
+   using NeighborGridEntityType = GridEntity< GridType, NeighborEntityDimension, Config >;
+   using RealType = Real;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using GridEntityGetterType = GridEntityGetter< GridType, NeighborGridEntityType >;
+
+   __cuda_callable__
+   inline NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {}
+
+   template< int stepX, int stepY >
+   __cuda_callable__
+   inline NeighborGridEntityType
+   getEntity() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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()
+                            << " EntityDimension = " << EntityDimension );
+      return NeighborGridEntityType(
+         this->entity.getMesh(), CoordinatesType( entity.getCoordinates().x() + stepX, entity.getCoordinates().y() + stepY ) );
+   }
+
+   template< int stepX, int stepY >
+   __cuda_callable__
+   inline IndexType
+   getEntityIndex() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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()
+                            << " EntityDimension = " << EntityDimension );
+      return this->entity.getIndex() + stepY * entity.getMesh().getDimensions().x() + stepX;
+   }
+
+   __cuda_callable__
+   void
+   refresh( const GridType& grid, const IndexType& entityIndex ){};
+
+protected:
+   const GridEntityType& entity;
+
+   // NeighborGridEntityGetter(){};
 };
 
 /****
@@ -96,101 +89,96 @@ class NeighborGridEntityGetter<
  * |       2         |              2            |       Cross       |
  * +-----------------+---------------------------+-------------------+
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-class NeighborGridEntityGetter<
-   GridEntity< Meshes::Grid< 2, Real, Device, Index >, 2, Config >,
-   2,
-   GridEntityStencilStorageTag< GridEntityCrossStencil > >
+template< typename Real, typename Device, typename Index, typename Config >
+class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 2, Real, Device, Index >, 2, Config >,
+                                2,
+                                GridEntityStencilStorageTag< GridEntityCrossStencil > >
 {
-   public:
-
-      static constexpr int EntityDimension = 2;
-      static constexpr int NeighborEntityDimension = 2;
-      typedef Meshes::Grid< 2, Real, Device, Index > GridType;
-      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, NeighborGridEntityType > GridEntityGetterType;
-      typedef GridEntityStencilStorageTag< GridEntityCrossStencil > StencilStorage;
-
-      static constexpr int stencilSize = Config::getStencilSize();
-
-      __cuda_callable__ inline
-      NeighborGridEntityGetter( const GridEntityType& entity )
-      : entity( entity )
-      {}
-
-      template< int stepX, int stepY >
-      __cuda_callable__ inline
-      NeighborGridEntityType getEntity() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
-            return NeighborGridEntityType( this->entity.getMesh(),
-                                            CoordinatesType( entity.getCoordinates().x() + stepX,
-                                                             entity.getCoordinates().y() + stepY ) );
-      }
-
-      template< int stepX, int stepY >
-      __cuda_callable__ inline
-      IndexType getEntityIndex() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
-#ifndef HAVE_CUDA // TODO: fix this to work with CUDA
-         if( ( stepX != 0 && stepY != 0 ) ||
-             ( stepX < -stencilSize || stepX > stencilSize ||
-               stepY < -stencilSize || stepY > stencilSize ) )
-            return this->entity.getIndex() + stepY * entity.getMesh().getDimensions().x() + stepX;
-         if( stepY == 0 )
-            return stencilX[ stepX + stencilSize ];
-         return stencilY[ stepY + stencilSize ];
-#else
+public:
+   static constexpr int EntityDimension = 2;
+   static constexpr int NeighborEntityDimension = 2;
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, EntityDimension, Config >;
+   using NeighborGridEntityType = GridEntity< GridType, NeighborEntityDimension, Config >;
+   using RealType = Real;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using GridEntityGetterType = GridEntityGetter< GridType, NeighborGridEntityType >;
+   using StencilStorage = GridEntityStencilStorageTag< GridEntityCrossStencil >;
+
+   static constexpr int stencilSize = Config::getStencilSize();
+
+   __cuda_callable__
+   inline NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {}
+
+   template< int stepX, int stepY >
+   __cuda_callable__
+   inline NeighborGridEntityType
+   getEntity() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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()
+                            << " EntityDimension = " << EntityDimension );
+      return NeighborGridEntityType(
+         this->entity.getMesh(), CoordinatesType( entity.getCoordinates().x() + stepX, entity.getCoordinates().y() + stepY ) );
+   }
+
+   template< int stepX, int stepY >
+   __cuda_callable__
+   inline IndexType
+   getEntityIndex() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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()
+                            << " EntityDimension = " << EntityDimension );
+#ifndef HAVE_CUDA  // TODO: fix this to work with CUDA
+      if( ( stepX != 0 && stepY != 0 )
+          || ( stepX < -stencilSize || stepX > stencilSize || stepY < -stencilSize || stepY > stencilSize ) )
          return this->entity.getIndex() + stepY * entity.getMesh().getDimensions().x() + stepX;
+      if( stepY == 0 )
+         return stencilX[ stepX + stencilSize ];
+      return stencilY[ stepY + stencilSize ];
+#else
+      return this->entity.getIndex() + stepY * entity.getMesh().getDimensions().x() + stepX;
 #endif
-
-      }
-
-      __cuda_callable__
-      void refresh( const GridType& grid, const IndexType& entityIndex )
+   }
+
+   __cuda_callable__
+   void
+   refresh( const GridType& grid, const IndexType& entityIndex )
+   {
+#ifndef HAVE_CUDA  // TODO: fix this to work with CUDA
+      auto stencilXRefresher = [ & ]( auto index )
       {
-#ifndef HAVE_CUDA // TODO: fix this to work with CUDA
-         auto stencilXRefresher = [&] ( auto index ) {
-            stencilX[ index + stencilSize ] = entityIndex + index;
-         };
-         auto stencilYRefresher = [&] ( auto index ) {
-            stencilY[ index + stencilSize ] =
-               entityIndex + index * entity.getMesh().getDimensions().x();
-         };
-         Algorithms::staticFor< IndexType, -stencilSize, 0 >( stencilYRefresher );
-         Algorithms::staticFor< IndexType, 1, stencilSize + 1 >( stencilYRefresher );
-         Algorithms::staticFor< IndexType, -stencilSize, stencilSize + 1 >( stencilXRefresher );
-#endif
+         stencilX[ index + stencilSize ] = entityIndex + index;
       };
+      auto stencilYRefresher = [ & ]( auto index )
+      {
+         stencilY[ index + stencilSize ] = entityIndex + index * entity.getMesh().getDimensions().x();
+      };
+      Algorithms::staticFor< IndexType, -stencilSize, 0 >( stencilYRefresher );
+      Algorithms::staticFor< IndexType, 1, stencilSize + 1 >( stencilYRefresher );
+      Algorithms::staticFor< IndexType, -stencilSize, stencilSize + 1 >( stencilXRefresher );
+#endif
+   };
 
-   protected:
-
-      const GridEntityType& entity;
+protected:
+   const GridEntityType& entity;
 
-      IndexType stencilX[ 2 * stencilSize + 1 ];
-      IndexType stencilY[ 2 * stencilSize + 1 ];
+   IndexType stencilX[ 2 * stencilSize + 1 ];
+   IndexType stencilY[ 2 * stencilSize + 1 ];
 
-      //NeighborGridEntityGetter(){};
+   // NeighborGridEntityGetter(){};
 };
 
 /****
@@ -200,74 +188,63 @@ class NeighborGridEntityGetter<
  * |       2         |              1            |       None        |
  * +-----------------+---------------------------+-------------------+
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config,
-          typename StencilStorage >
-class NeighborGridEntityGetter<
-   GridEntity< Meshes::Grid< 2, Real, Device, Index >, 2, Config >,
-   1,
-   StencilStorage >
+template< typename Real, typename Device, typename Index, typename Config, typename StencilStorage >
+class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 2, Real, Device, Index >, 2, Config >, 1, StencilStorage >
 {
-   public:
-
-      static constexpr int EntityDimension = 2;
-      static constexpr int NeighborEntityDimension = 1;
-      typedef Meshes::Grid< 2, Real, Device, Index > GridType;
-      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, NeighborGridEntityType > GridEntityGetterType;
-      typedef typename GridEntityType::EntityOrientationType EntityOrientationType;
-      typedef typename GridEntityType::EntityBasisType EntityBasisType;
-
-      __cuda_callable__ inline
-      NeighborGridEntityGetter( const GridEntityType& entity )
-      : entity( entity )
-      {}
-
-      template< int stepX, int stepY >
-      __cuda_callable__ inline
-      NeighborGridEntityType getEntity() const
-      {
-         static_assert( ! stepX + ! stepY == 1, "Only one of the steps can be non-zero." );
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         TNL_ASSERT( entity.getCoordinates() +
-                       CoordinatesType( stepX + ( stepX < 0 ),
-                                        stepY + ( stepY < 0 ) ) >= CoordinatesType( 0, 0 ) &&
-                    entity.getCoordinates() +
-                       CoordinatesType( stepX + ( stepX < 0 ),
-                                        stepY + ( stepY < 0 ) )
-                       < entity.getMesh().getDimensions() + CoordinatesType( ( stepX > 0 ), ( stepY > 0 ) ),
-              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()
-                   << " 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,
-                                                                stepY ? (stepY > 0 ? 1 : -1) : 0 ),
-                                         EntityBasisType( ! stepX, ! stepY ) );
-      }
-
-      template< int stepX, int stepY >
-      __cuda_callable__ inline
-      IndexType getEntityIndex() const
-      {
-         return GridEntityGetterType::getEntityIndex( this->entity.getMesh(), this->template getEntity< stepX, stepY >() );
-      }
-
-      __cuda_callable__
-      void refresh( const GridType& grid, const IndexType& entityIndex ){};
-
-   protected:
-
-      const GridEntityType& entity;
+public:
+   static constexpr int EntityDimension = 2;
+   static constexpr int NeighborEntityDimension = 1;
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, EntityDimension, Config >;
+   using NeighborGridEntityType = GridEntity< GridType, NeighborEntityDimension, Config >;
+   using RealType = Real;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using GridEntityGetterType = GridEntityGetter< GridType, NeighborGridEntityType >;
+   using EntityOrientationType = typename GridEntityType::EntityOrientationType;
+   using EntityBasisType = typename GridEntityType::EntityBasisType;
+
+   __cuda_callable__
+   inline NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {}
+
+   template< int stepX, int stepY >
+   __cuda_callable__
+   inline NeighborGridEntityType
+   getEntity() const
+   {
+      static_assert( ! stepX + ! stepY == 1, "Only one of the steps can be non-zero." );
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      TNL_ASSERT( entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ) )
+                        >= CoordinatesType( 0, 0 )
+                     && entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ) )
+                           < entity.getMesh().getDimensions() + CoordinatesType( ( stepX > 0 ), ( stepY > 0 ) ),
+                  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()
+                            << " 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, stepY ? ( stepY > 0 ? 1 : -1 ) : 0 ),
+         EntityBasisType( ! stepX, ! stepY ) );
+   }
+
+   template< int stepX, int stepY >
+   __cuda_callable__
+   inline IndexType
+   getEntityIndex() const
+   {
+      return GridEntityGetterType::getEntityIndex( this->entity.getMesh(), this->template getEntity< stepX, stepY >() );
+   }
+
+   __cuda_callable__
+   void
+   refresh( const GridType& grid, const IndexType& entityIndex ){};
+
+protected:
+   const GridEntityType& entity;
 };
 
 /****
@@ -277,71 +254,61 @@ class NeighborGridEntityGetter<
  * |       2         |            0              |       None        |
  * +-----------------+---------------------------+-------------------+
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config,
-          typename StencilStorage >
-class NeighborGridEntityGetter<
-   GridEntity< Meshes::Grid< 2, Real, Device, Index >, 2, Config >,
-   0,
-   StencilStorage >
+template< typename Real, typename Device, typename Index, typename Config, typename StencilStorage >
+class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 2, Real, Device, Index >, 2, Config >, 0, StencilStorage >
 {
-   public:
-
-      static constexpr int EntityDimension = 2;
-      static constexpr int NeighborEntityDimension = 0;
-      typedef Meshes::Grid< 2, Real, Device, Index > GridType;
-      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, NeighborGridEntityType > GridEntityGetterType;
-
-      __cuda_callable__ inline
-      NeighborGridEntityGetter( const GridEntityType& entity )
-      : entity( entity )
-      {}
-
-      template< int stepX, int stepY >
-      __cuda_callable__ inline
-      NeighborGridEntityType getEntity() const
-      {
-         TNL_ASSERT( stepX != 0 && stepY != 0,
-                    std::cerr << " stepX = " << stepX << " stepY = " << stepY );
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         TNL_ASSERT( entity.getCoordinates() +
-                       CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ) ) >= CoordinatesType( 0, 0 ) &&
-                    entity.getCoordinates() +
-                       CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ) )
-                       < entity.getMesh().getDimensions() + CoordinatesType( ( stepX > 0 ), ( stepY > 0 ) ),
-              std::cerr << "entity.getCoordinates()  + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ) ) = "
-                   << 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 ) )
-                   << " EntityDimension = " << EntityDimension );
-         return NeighborGridEntityType( this->entity.getMesh(),
-                                         CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ),
-                                                          entity.getCoordinates().y() + stepY + ( stepY < 0 ) ) );
-      }
-
-      template< int stepX, int stepY >
-      __cuda_callable__ inline
-      IndexType getEntityIndex() const
-      {
-         return GridEntityGetterType::getEntityIndex( this->entity.getMesh(), this->template getEntity< stepX, stepY >() );
-      }
-
-      __cuda_callable__
-      void refresh( const GridType& grid, const IndexType& entityIndex ){};
-
-   protected:
-
-      const GridEntityType& entity;
-
-      //NeighborGridEntityGetter(){};
+public:
+   static constexpr int EntityDimension = 2;
+   static constexpr int NeighborEntityDimension = 0;
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, EntityDimension, Config >;
+   using NeighborGridEntityType = GridEntity< GridType, NeighborEntityDimension, Config >;
+   using RealType = Real;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using GridEntityGetterType = GridEntityGetter< GridType, NeighborGridEntityType >;
+
+   __cuda_callable__
+   inline NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {}
+
+   template< int stepX, int stepY >
+   __cuda_callable__
+   inline NeighborGridEntityType
+   getEntity() const
+   {
+      TNL_ASSERT( stepX != 0 && stepY != 0, std::cerr << " stepX = " << stepX << " stepY = " << stepY );
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      TNL_ASSERT( entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ) )
+                        >= CoordinatesType( 0, 0 )
+                     && entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ) )
+                           < entity.getMesh().getDimensions() + CoordinatesType( ( stepX > 0 ), ( stepY > 0 ) ),
+                  std::cerr << "entity.getCoordinates()  + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ) ) = "
+                            << 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 ) )
+                            << " EntityDimension = " << EntityDimension );
+      return NeighborGridEntityType( this->entity.getMesh(),
+                                     CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ),
+                                                      entity.getCoordinates().y() + stepY + ( stepY < 0 ) ) );
+   }
+
+   template< int stepX, int stepY >
+   __cuda_callable__
+   inline IndexType
+   getEntityIndex() const
+   {
+      return GridEntityGetterType::getEntityIndex( this->entity.getMesh(), this->template getEntity< stepX, stepY >() );
+   }
+
+   __cuda_callable__
+   void
+   refresh( const GridType& grid, const IndexType& entityIndex ){};
+
+protected:
+   const GridEntityType& entity;
+
+   // NeighborGridEntityGetter(){};
 };
 
 /****
@@ -351,71 +318,70 @@ class NeighborGridEntityGetter<
  * |       1         |              2            |       None        |
  * +-----------------+---------------------------+-------------------+
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config,
-          typename StencilStorage >
-class NeighborGridEntityGetter<
-   GridEntity< Meshes::Grid< 2, Real, Device, Index >, 1, Config >,
-   2,
-   StencilStorage >
+template< typename Real, typename Device, typename Index, typename Config, typename StencilStorage >
+class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 2, Real, Device, Index >, 1, Config >, 2, StencilStorage >
 {
-   public:
-
-      static constexpr int EntityDimension = 1;
-      static constexpr int NeighborEntityDimension = 2;
-      typedef Meshes::Grid< 2, Real, Device, Index > GridType;
-      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, NeighborGridEntityType > GridEntityGetterType;
-
-      __cuda_callable__ inline
-      NeighborGridEntityGetter( const GridEntityType& entity )
-      : entity( entity )
-      {}
-
-      template< int stepX, int stepY >
-      __cuda_callable__ inline
-      NeighborGridEntityType getEntity() const
-      {
-         /*TNL_ASSERT( ( ( !! stepX ) == ( !! entity.getOrientation().x() ) ) &&
-                    ( ( !! stepY ) == ( !! entity.getOrientation().y() ) ),
-                    std::cerr << "( stepX, stepY ) cannot be perpendicular to entity coordinates: stepX = " << stepX << " stepY = " << stepY
-                         << " entity.getOrientation() = " << entity.getOrientation() );*/
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions() + TNL::abs(entity.getOrientation()), "wrong coordinates" );
-         TNL_ASSERT( entity.getCoordinates() +
-                       CoordinatesType( stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ),
-                                        stepY - ( stepY > 0 ) * ( entity.getOrientation().y() != 0.0 ) ) >= CoordinatesType( 0, 0 ) &&
-                    entity.getCoordinates() +
-                       CoordinatesType( stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ),
-                                        stepY - ( stepY > 0 ) * ( entity.getOrientation().y() != 0.0 ) ) < entity.getMesh().getDimensions(),
-              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 ) )
+public:
+   static constexpr int EntityDimension = 1;
+   static constexpr int NeighborEntityDimension = 2;
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, EntityDimension, Config >;
+   using NeighborGridEntityType = GridEntity< GridType, NeighborEntityDimension, Config >;
+   using RealType = Real;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using GridEntityGetterType = GridEntityGetter< GridType, NeighborGridEntityType >;
+
+   __cuda_callable__
+   inline NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {}
+
+   template< int stepX, int stepY >
+   __cuda_callable__
+   inline NeighborGridEntityType
+   getEntity() const
+   {
+      /*TNL_ASSERT( ( ( !! stepX ) == ( !! entity.getOrientation().x() ) ) &&
+                 ( ( !! stepY ) == ( !! entity.getOrientation().y() ) ),
+                 std::cerr << "( stepX, stepY ) cannot be perpendicular to entity coordinates: stepX = " << stepX << " stepY = "
+         << stepY
+                      << " entity.getOrientation() = " << entity.getOrientation() );*/
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT(
+         entity.getCoordinates(), entity.getMesh().getDimensions() + TNL::abs( entity.getOrientation() ), "wrong coordinates" );
+      TNL_ASSERT(
+         entity.getCoordinates()
+                  + CoordinatesType( stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ),
+                                     stepY - ( stepY > 0 ) * ( entity.getOrientation().y() != 0.0 ) )
+               >= CoordinatesType( 0, 0 )
+            && entity.getCoordinates()
+                     + CoordinatesType( stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ),
+                                        stepY - ( stepY > 0 ) * ( entity.getOrientation().y() != 0.0 ) )
+                  < entity.getMesh().getDimensions(),
+         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()
                    << " 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 ) ) );
-      }
-
-      template< int stepX, int stepY >
-      __cuda_callable__ inline
-      IndexType getEntityIndex() const
-      {
-         return GridEntityGetterType::getEntityIndex( this->entity.getMesh(), this->template getEntity< stepX, stepY >() );
-      }
-
-      __cuda_callable__
-      void refresh( const GridType& grid, const IndexType& entityIndex ){};
-
-   protected:
-
-      const GridEntityType& entity;
+      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 ) ) );
+   }
+
+   template< int stepX, int stepY >
+   __cuda_callable__
+   inline IndexType
+   getEntityIndex() const
+   {
+      return GridEntityGetterType::getEntityIndex( this->entity.getMesh(), this->template getEntity< stepX, stepY >() );
+   }
+
+   __cuda_callable__
+   void
+   refresh( const GridType& grid, const IndexType& entityIndex ){};
+
+protected:
+   const GridEntityType& entity;
 };
 
 /****
@@ -425,72 +391,65 @@ class NeighborGridEntityGetter<
  * |       0         |              0            |       None        |
  * +-----------------+---------------------------+-------------------+
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config,
-          typename StencilStorage >
-class NeighborGridEntityGetter<
-   GridEntity< Meshes::Grid< 2, Real, Device, Index >, 0, Config >,
-   0,
-   StencilStorage >
+template< typename Real, typename Device, typename Index, typename Config, typename StencilStorage >
+class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 2, Real, Device, Index >, 0, Config >, 0, StencilStorage >
 {
-   public:
-
-      static constexpr int EntityDimension = 0;
-      static constexpr int NeighborEntityDimension = 0;
-      typedef Meshes::Grid< 2, Real, Device, Index > GridType;
-      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, NeighborGridEntityType > GridEntityGetterType;
-
-      __cuda_callable__ inline
-      NeighborGridEntityGetter( const GridEntityType& entity )
-      : entity( entity )
-      {}
-
-      template< int stepX, int stepY >
-      __cuda_callable__ inline
-      NeighborGridEntityType getEntity() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LE( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
-         return NeighborGridEntityType( this->entity.getMesh(),
-                                         CoordinatesType( entity.getCoordinates().x() + stepX,
-                                                          entity.getCoordinates().y() + stepY ) );
-      }
-
-      template< int stepX, int stepY >
-      __cuda_callable__ inline
-      IndexType getEntityIndex() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LE( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
-         return this->entity.getIndex() + stepY * ( entity.getMesh().getDimensions().x() + 1 ) + stepX;
-      }
-
-      __cuda_callable__
-      void refresh( const GridType& grid, const IndexType& entityIndex ){};
-
-   protected:
-
-      const GridEntityType& entity;
-
-      //NeighborGridEntityGetter(){};
+public:
+   static constexpr int EntityDimension = 0;
+   static constexpr int NeighborEntityDimension = 0;
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, EntityDimension, Config >;
+   using NeighborGridEntityType = GridEntity< GridType, NeighborEntityDimension, Config >;
+   using RealType = Real;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using GridEntityGetterType = GridEntityGetter< GridType, NeighborGridEntityType >;
+
+   __cuda_callable__
+   inline NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {}
+
+   template< int stepX, int stepY >
+   __cuda_callable__
+   inline NeighborGridEntityType
+   getEntity() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LE( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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()
+                            << " EntityDimension = " << EntityDimension );
+      return NeighborGridEntityType(
+         this->entity.getMesh(), CoordinatesType( entity.getCoordinates().x() + stepX, entity.getCoordinates().y() + stepY ) );
+   }
+
+   template< int stepX, int stepY >
+   __cuda_callable__
+   inline IndexType
+   getEntityIndex() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LE( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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()
+                            << " EntityDimension = " << EntityDimension );
+      return this->entity.getIndex() + stepY * ( entity.getMesh().getDimensions().x() + 1 ) + stepX;
+   }
+
+   __cuda_callable__
+   void
+   refresh( const GridType& grid, const IndexType& entityIndex ){};
+
+protected:
+   const GridEntityType& entity;
+
+   // NeighborGridEntityGetter(){};
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter3D_impl.h b/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter3D_impl.h
index bb5470abbdf25ef7d5035c3cb32dc5319742ec6f..405184a32096e1b96994a3310a02b47b5784a472 100644
--- a/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter3D_impl.h
+++ b/src/TNL/Meshes/GridDetails/NeighborGridEntityGetter3D_impl.h
@@ -22,76 +22,71 @@ namespace Meshes {
  * |       3         |              3            |       None        |
  * +-----------------+---------------------------+-------------------+
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-class NeighborGridEntityGetter<
-   GridEntity< Meshes::Grid< 3, Real, Device, Index >, 3, Config >,
-   3,
-   GridEntityStencilStorageTag< GridEntityNoStencil > >
+template< typename Real, typename Device, typename Index, typename Config >
+class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 3, Real, Device, Index >, 3, Config >,
+                                3,
+                                GridEntityStencilStorageTag< GridEntityNoStencil > >
 {
-   public:
-
-      static constexpr int EntityDimension = 3;
-      static constexpr int NeighborEntityDimension = 3;
-      typedef Meshes::Grid< 3, Real, Device, Index > GridType;
-      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, NeighborGridEntityType > GridEntityGetterType;
-
-      __cuda_callable__ inline
-      NeighborGridEntityGetter( const GridEntityType& entity )
-      : entity( entity )
-      {}
-
-      template< int stepX, int stepY, int stepZ >
-      __cuda_callable__ inline
-      NeighborGridEntityType getEntity() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
-         return NeighborGridEntityType( this->entity.getMesh(),
-                                        CoordinatesType( entity.getCoordinates().x() + stepX,
-                                                         entity.getCoordinates().y() + stepY,
-                                                         entity.getCoordinates().z() + stepZ ) );
-      }
-
-      template< int stepX, int stepY, int stepZ >
-      __cuda_callable__ inline
-      IndexType getEntityIndex() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
-         return this->entity.getIndex() + ( stepZ * entity.getMesh().getDimensions().y() + stepY ) * entity.getMesh().getDimensions().x() + stepX;
-      }
-
-      __cuda_callable__
-      void refresh( const GridType& grid, const IndexType& entityIndex ){};
-
-   protected:
-
-      const GridEntityType& entity;
-
-      //NeighborGridEntityGetter(){};
-
+public:
+   static constexpr int EntityDimension = 3;
+   static constexpr int NeighborEntityDimension = 3;
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, EntityDimension, Config >;
+   using NeighborGridEntityType = GridEntity< GridType, NeighborEntityDimension, Config >;
+   using RealType = Real;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using GridEntityGetterType = GridEntityGetter< GridType, NeighborGridEntityType >;
+
+   __cuda_callable__
+   inline NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {}
+
+   template< int stepX, int stepY, int stepZ >
+   __cuda_callable__
+   inline NeighborGridEntityType
+   getEntity() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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()
+                            << " EntityDimension = " << EntityDimension );
+      return NeighborGridEntityType( this->entity.getMesh(),
+                                     CoordinatesType( entity.getCoordinates().x() + stepX,
+                                                      entity.getCoordinates().y() + stepY,
+                                                      entity.getCoordinates().z() + stepZ ) );
+   }
+
+   template< int stepX, int stepY, int stepZ >
+   __cuda_callable__
+   inline IndexType
+   getEntityIndex() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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()
+                            << " EntityDimension = " << EntityDimension );
+      return this->entity.getIndex()
+           + ( stepZ * entity.getMesh().getDimensions().y() + stepY ) * entity.getMesh().getDimensions().x() + stepX;
+   }
+
+   __cuda_callable__
+   void
+   refresh( const GridType& grid, const IndexType& entityIndex ){};
+
+protected:
+   const GridEntityType& entity;
+
+   // NeighborGridEntityGetter(){};
 };
 
-
 /****
  * +-----------------+---------------------------+-------------------+
  * | EntityDimenions | NeighborEntityDimension |  Stored Stencil   |
@@ -99,115 +94,110 @@ class NeighborGridEntityGetter<
  * |       3         |              3            |       Cross       |
  * +-----------------+---------------------------+-------------------+
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-class NeighborGridEntityGetter<
-   GridEntity< Meshes::Grid< 3, Real, Device, Index >, 3, Config >,
-   3,
-   GridEntityStencilStorageTag< GridEntityCrossStencil > >
+template< typename Real, typename Device, typename Index, typename Config >
+class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 3, Real, Device, Index >, 3, Config >,
+                                3,
+                                GridEntityStencilStorageTag< GridEntityCrossStencil > >
 {
-   public:
-
-      static constexpr int EntityDimension = 3;
-      static constexpr int NeighborEntityDimension = 3;
-      typedef Meshes::Grid< 3, Real, Device, Index > GridType;
-      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, NeighborGridEntityType > GridEntityGetterType;
-      typedef GridEntityStencilStorageTag< GridEntityCrossStencil > StencilStorage;
-
-      static constexpr int stencilSize = Config::getStencilSize();
-
-      __cuda_callable__ inline
-      NeighborGridEntityGetter( const GridEntityType& entity )
-      : entity( entity )
-      {}
-
-      template< int stepX, int stepY, int stepZ >
-      __cuda_callable__ inline
-      NeighborGridEntityType getEntity() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
-         return NeighborGridEntityType( this->entity.getMesh(),
-                                        CoordinatesType( entity.getCoordinates().x() + stepX,
-                                                         entity.getCoordinates().y() + stepY,
-                                                         entity.getCoordinates().z() + stepZ ) );
-      }
-
-      template< int stepX, int stepY, int stepZ >
-      __cuda_callable__ inline
-      IndexType getEntityIndex() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
-#ifndef HAVE_CUDA // TODO: fix this to work with CUDA
-         if( ( stepX != 0 && stepY != 0 ) ||
-             ( stepX != 0 && stepZ != 0 ) ||
-             ( stepY != 0 && stepZ != 0 ) ||
-             ( stepX < -stencilSize || stepX > stencilSize ||
-               stepY < -stencilSize || stepY > stencilSize ||
-               stepZ < -stencilSize || stepZ > stencilSize ) )
-            return this->entity.getIndex() + ( stepZ * entity.getMesh().getDimensions().y() + stepY ) * entity.getMesh().getDimensions().x() + stepX;
-         if( stepY == 0 && stepZ == 0 )
-            return stencilX[ stepX + stencilSize ];
-         if( stepZ == 0 )
-            return stencilY[ stepY + stencilSize ];
-         return stencilZ[ stepZ + stencilSize ];
+public:
+   static constexpr int EntityDimension = 3;
+   static constexpr int NeighborEntityDimension = 3;
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, EntityDimension, Config >;
+   using NeighborGridEntityType = GridEntity< GridType, NeighborEntityDimension, Config >;
+   using RealType = Real;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using GridEntityGetterType = GridEntityGetter< GridType, NeighborGridEntityType >;
+   using StencilStorage = GridEntityStencilStorageTag< GridEntityCrossStencil >;
+
+   static constexpr int stencilSize = Config::getStencilSize();
+
+   __cuda_callable__
+   inline NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {}
+
+   template< int stepX, int stepY, int stepZ >
+   __cuda_callable__
+   inline NeighborGridEntityType
+   getEntity() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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()
+                            << " EntityDimension = " << EntityDimension );
+      return NeighborGridEntityType( this->entity.getMesh(),
+                                     CoordinatesType( entity.getCoordinates().x() + stepX,
+                                                      entity.getCoordinates().y() + stepY,
+                                                      entity.getCoordinates().z() + stepZ ) );
+   }
+
+   template< int stepX, int stepY, int stepZ >
+   __cuda_callable__
+   inline IndexType
+   getEntityIndex() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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()
+                            << " EntityDimension = " << EntityDimension );
+#ifndef HAVE_CUDA  // TODO: fix this to work with CUDA
+      if( ( stepX != 0 && stepY != 0 ) || ( stepX != 0 && stepZ != 0 ) || ( stepY != 0 && stepZ != 0 )
+          || ( stepX < -stencilSize || stepX > stencilSize || stepY < -stencilSize || stepY > stencilSize
+               || stepZ < -stencilSize || stepZ > stencilSize ) )
+         return this->entity.getIndex()
+              + ( stepZ * entity.getMesh().getDimensions().y() + stepY ) * entity.getMesh().getDimensions().x() + stepX;
+      if( stepY == 0 && stepZ == 0 )
+         return stencilX[ stepX + stencilSize ];
+      if( stepZ == 0 )
+         return stencilY[ stepY + stencilSize ];
+      return stencilZ[ stepZ + stencilSize ];
 #else
-         return this->entity.getIndex() + ( stepZ * entity.getMesh().getDimensions().y() + stepY ) * entity.getMesh().getDimensions().x() + stepX;
+      return this->entity.getIndex()
+           + ( stepZ * entity.getMesh().getDimensions().y() + stepY ) * entity.getMesh().getDimensions().x() + stepX;
 #endif
-
-      }
-
-      __cuda_callable__
-      void refresh( const GridType& grid, const IndexType& entityIndex )
+   }
+
+   __cuda_callable__
+   void
+   refresh( const GridType& grid, const IndexType& entityIndex )
+   {
+#ifndef HAVE_CUDA  // TODO: fix this to work with CUDA
+      auto stencilXRefresher = [ & ]( auto index )
       {
-#ifndef HAVE_CUDA // TODO: fix this to work with CUDA
-         auto stencilXRefresher = [&] ( auto index ) {
-            stencilX[ index + stencilSize ] = entityIndex + index;
-         };
-         auto stencilYRefresher = [&] ( auto index ) {
-            stencilY[ index + stencilSize ] =
-               entityIndex + index * entity.getMesh().getDimensions().x();
-         };
-         auto stencilZRefresher = [&] ( auto index ) {
-            stencilZ[ index + stencilSize ] =
-               entityIndex + index * entity.getMesh().cellZNeighborsStep;
-         };
-         Algorithms::staticFor< IndexType, -stencilSize, 0 >( stencilZRefresher );
-         Algorithms::staticFor< IndexType, 1, stencilSize + 1 >( stencilZRefresher );
-         Algorithms::staticFor< IndexType, -stencilSize, 0 >( stencilYRefresher );
-         Algorithms::staticFor< IndexType, 1, stencilSize + 1 >( stencilYRefresher );
-         Algorithms::staticFor< IndexType, -stencilSize, stencilSize + 1 >( stencilXRefresher );
-#endif
+         stencilX[ index + stencilSize ] = entityIndex + index;
       };
+      auto stencilYRefresher = [ & ]( auto index )
+      {
+         stencilY[ index + stencilSize ] = entityIndex + index * entity.getMesh().getDimensions().x();
+      };
+      auto stencilZRefresher = [ & ]( auto index )
+      {
+         stencilZ[ index + stencilSize ] = entityIndex + index * entity.getMesh().cellZNeighborsStep;
+      };
+      Algorithms::staticFor< IndexType, -stencilSize, 0 >( stencilZRefresher );
+      Algorithms::staticFor< IndexType, 1, stencilSize + 1 >( stencilZRefresher );
+      Algorithms::staticFor< IndexType, -stencilSize, 0 >( stencilYRefresher );
+      Algorithms::staticFor< IndexType, 1, stencilSize + 1 >( stencilYRefresher );
+      Algorithms::staticFor< IndexType, -stencilSize, stencilSize + 1 >( stencilXRefresher );
+#endif
+   };
 
-   protected:
-
-      const GridEntityType& entity;
+protected:
+   const GridEntityType& entity;
 
-      IndexType stencilX[ 2 * stencilSize + 1 ];
-      IndexType stencilY[ 2 * stencilSize + 1 ];
-      IndexType stencilZ[ 2 * stencilSize + 1 ];
+   IndexType stencilX[ 2 * stencilSize + 1 ];
+   IndexType stencilY[ 2 * stencilSize + 1 ];
+   IndexType stencilZ[ 2 * stencilSize + 1 ];
 
-      //NeighborGridEntityGetter(){};
+   // NeighborGridEntityGetter(){};
 };
 
 /****
@@ -217,80 +207,72 @@ class NeighborGridEntityGetter<
  * |       3         |              2            |       None        |
  * +-----------------+---------------------------+-------------------+
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-class NeighborGridEntityGetter<
-   GridEntity< Meshes::Grid< 3, Real, Device, Index >, 3, Config >,
-   2,
-   GridEntityStencilStorageTag< GridEntityNoStencil > >
+template< typename Real, typename Device, typename Index, typename Config >
+class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 3, Real, Device, Index >, 3, Config >,
+                                2,
+                                GridEntityStencilStorageTag< GridEntityNoStencil > >
 {
-   public:
-
-      static constexpr int EntityDimension = 3;
-      static constexpr int NeighborEntityDimension = 2;
-      typedef Meshes::Grid< 3, Real, Device, Index > GridType;
-      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, NeighborGridEntityType > GridEntityGetterType;
-      typedef typename GridEntityType::EntityOrientationType EntityOrientationType;
-      typedef typename GridEntityType::EntityBasisType EntityBasisType;
-
-      __cuda_callable__ inline
-      NeighborGridEntityGetter( const GridEntityType& entity )
-      : entity( entity )
-      {}
-
-      template< int stepX, int stepY, int stepZ >
-      __cuda_callable__ inline
-      NeighborGridEntityType getEntity() const
-      {
-         static_assert( ! stepX + ! stepY + ! stepZ == 2, "Only one of the steps can be non-zero." );
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         TNL_ASSERT( entity.getCoordinates() +
-                       CoordinatesType( stepX + ( stepX < 0 ),
-                                        stepY + ( stepY < 0 ),
-                                        stepZ + ( stepZ < 0 ) ) >= CoordinatesType( 0, 0, 0 ) &&
-                    entity.getCoordinates() +
-                       CoordinatesType( stepX + ( stepX < 0 ),
-                                        stepY + ( stepY < 0 ),
-                                        stepZ + ( stepZ < 0 ) )
-                       < entity.getMesh().getDimensions() +
-                        CoordinatesType( ( stepX > 0 ), ( stepY > 0 ), ( stepZ > 0 ) ),
-              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 ) )
+public:
+   static constexpr int EntityDimension = 3;
+   static constexpr int NeighborEntityDimension = 2;
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, EntityDimension, Config >;
+   using NeighborGridEntityType = GridEntity< GridType, NeighborEntityDimension, Config >;
+   using RealType = Real;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using GridEntityGetterType = GridEntityGetter< GridType, NeighborGridEntityType >;
+   using EntityOrientationType = typename GridEntityType::EntityOrientationType;
+   using EntityBasisType = typename GridEntityType::EntityBasisType;
+
+   __cuda_callable__
+   inline NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {}
+
+   template< int stepX, int stepY, int stepZ >
+   __cuda_callable__
+   inline NeighborGridEntityType
+   getEntity() const
+   {
+      static_assert( ! stepX + ! stepY + ! stepZ == 2, "Only one of the steps can be non-zero." );
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      TNL_ASSERT(
+         entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) )
+               >= CoordinatesType( 0, 0, 0 )
+            && entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) )
+                  < entity.getMesh().getDimensions() + CoordinatesType( ( stepX > 0 ), ( stepY > 0 ), ( stepZ > 0 ) ),
+         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()
                    << " 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 ) ),
-                                        EntityOrientationType( stepX ? (stepX > 0 ? 1 : -1) : 0,
-                                                               stepY ? (stepY > 0 ? 1 : -1) : 0,
-                                                               stepZ ? (stepZ > 0 ? 1 : -1) : 0 ),
-                                        EntityBasisType( ! stepX, !stepY, !stepZ ) );
-      }
-
-      template< int stepX, int stepY, int stepZ >
-      __cuda_callable__ inline
-      IndexType getEntityIndex() const
-      {
-         return GridEntityGetterType::getEntityIndex( this->entity.getMesh(), getEntity< stepX, stepY, stepZ >() );
-      }
-
-      __cuda_callable__
-      void refresh( const GridType& grid, const IndexType& entityIndex ){};
-
-   protected:
-
-      const GridEntityType& entity;
-
-      //NeighborGridEntityGetter(){};
+      return NeighborGridEntityType( this->entity.getMesh(),
+                                     CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ),
+                                                      entity.getCoordinates().y() + stepY + ( stepY < 0 ),
+                                                      entity.getCoordinates().z() + stepZ + ( stepZ < 0 ) ),
+                                     EntityOrientationType( stepX ? ( stepX > 0 ? 1 : -1 ) : 0,
+                                                            stepY ? ( stepY > 0 ? 1 : -1 ) : 0,
+                                                            stepZ ? ( stepZ > 0 ? 1 : -1 ) : 0 ),
+                                     EntityBasisType( ! stepX, ! stepY, ! stepZ ) );
+   }
+
+   template< int stepX, int stepY, int stepZ >
+   __cuda_callable__
+   inline IndexType
+   getEntityIndex() const
+   {
+      return GridEntityGetterType::getEntityIndex( this->entity.getMesh(), getEntity< stepX, stepY, stepZ >() );
+   }
+
+   __cuda_callable__
+   void
+   refresh( const GridType& grid, const IndexType& entityIndex ){};
+
+protected:
+   const GridEntityType& entity;
+
+   // NeighborGridEntityGetter(){};
 };
 
 /****      TODO: Finish it, knonw it is only a copy of specialization for none stored stencil
@@ -300,83 +282,74 @@ class NeighborGridEntityGetter<
  * |       3         |              2            |       Cross       |
  * +-----------------+---------------------------+-------------------+
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-class NeighborGridEntityGetter<
-   GridEntity< Meshes::Grid< 3, Real, Device, Index >, 3, Config >,
-   2,
-   GridEntityStencilStorageTag< GridEntityCrossStencil > >
+template< typename Real, typename Device, typename Index, typename Config >
+class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 3, Real, Device, Index >, 3, Config >,
+                                2,
+                                GridEntityStencilStorageTag< GridEntityCrossStencil > >
 {
-   public:
-
-      static constexpr int EntityDimension = 3;
-      static constexpr int NeighborEntityDimension = 2;
-      typedef Meshes::Grid< 3, Real, Device, Index > GridType;
-      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, NeighborGridEntityType > GridEntityGetterType;
-      typedef typename GridEntityType::EntityOrientationType EntityOrientationType;
-      typedef typename GridEntityType::EntityBasisType EntityBasisType;
-
-      __cuda_callable__ inline
-      NeighborGridEntityGetter( const GridEntityType& entity )
-      : entity( entity )
-      {}
-
-      template< int stepX, int stepY, int stepZ >
-      __cuda_callable__ inline
-      NeighborGridEntityType getEntity() const
-      {
-         static_assert( ! stepX + ! stepY + ! stepZ == 2, "Only one of the steps can be non-zero." );
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         TNL_ASSERT( entity.getCoordinates() +
-                       CoordinatesType( stepX + ( stepX < 0 ),
-                                        stepY + ( stepY < 0 ),
-                                        stepZ + ( stepZ < 0 ) ) >= CoordinatesType( 0, 0, 0 ) &&
-                    entity.getCoordinates() +
-                       CoordinatesType( stepX + ( stepX < 0 ),
-                                        stepY + ( stepY < 0 ),
-                                        stepZ + ( stepZ < 0 ) )
-                       < entity.getMesh().getDimensions() +
-                        CoordinatesType( ( stepX > 0 ), ( stepY > 0 ), ( stepZ > 0 ) ),
-              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 ) )
+public:
+   static constexpr int EntityDimension = 3;
+   static constexpr int NeighborEntityDimension = 2;
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, EntityDimension, Config >;
+   using NeighborGridEntityType = GridEntity< GridType, NeighborEntityDimension, Config >;
+   using RealType = Real;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using GridEntityGetterType = GridEntityGetter< GridType, NeighborGridEntityType >;
+   using EntityOrientationType = typename GridEntityType::EntityOrientationType;
+   using EntityBasisType = typename GridEntityType::EntityBasisType;
+
+   __cuda_callable__
+   inline NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {}
+
+   template< int stepX, int stepY, int stepZ >
+   __cuda_callable__
+   inline NeighborGridEntityType
+   getEntity() const
+   {
+      static_assert( ! stepX + ! stepY + ! stepZ == 2, "Only one of the steps can be non-zero." );
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      TNL_ASSERT(
+         entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) )
+               >= CoordinatesType( 0, 0, 0 )
+            && entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) )
+                  < entity.getMesh().getDimensions() + CoordinatesType( ( stepX > 0 ), ( stepY > 0 ), ( stepZ > 0 ) ),
+         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()
                    << " 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 ) ),
-                                        EntityOrientationType( stepX ? (stepX > 0 ? 1 : -1) : 0,
-                                                               stepY ? (stepY > 0 ? 1 : -1) : 0,
-                                                               stepZ ? (stepZ > 0 ? 1 : -1) : 0 ),
-                                        EntityBasisType( ! stepX, !stepY, !stepZ ) );
-      }
-
-      template< int stepX, int stepY, int stepZ >
-      __cuda_callable__ inline
-      IndexType getEntityIndex() const
-      {
-         return GridEntityGetterType::getEntityIndex( this->entity.getMesh(), getEntity< stepX, stepY, stepZ >() );
-      }
-
-      __cuda_callable__
-      void refresh( const GridType& grid, const IndexType& entityIndex ){};
-
-   protected:
-
-      const GridEntityType& entity;
-
-      //NeighborGridEntityGetter(){};
+      return NeighborGridEntityType( this->entity.getMesh(),
+                                     CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ),
+                                                      entity.getCoordinates().y() + stepY + ( stepY < 0 ),
+                                                      entity.getCoordinates().z() + stepZ + ( stepZ < 0 ) ),
+                                     EntityOrientationType( stepX ? ( stepX > 0 ? 1 : -1 ) : 0,
+                                                            stepY ? ( stepY > 0 ? 1 : -1 ) : 0,
+                                                            stepZ ? ( stepZ > 0 ? 1 : -1 ) : 0 ),
+                                     EntityBasisType( ! stepX, ! stepY, ! stepZ ) );
+   }
+
+   template< int stepX, int stepY, int stepZ >
+   __cuda_callable__
+   inline IndexType
+   getEntityIndex() const
+   {
+      return GridEntityGetterType::getEntityIndex( this->entity.getMesh(), getEntity< stepX, stepY, stepZ >() );
+   }
+
+   __cuda_callable__
+   void
+   refresh( const GridType& grid, const IndexType& entityIndex ){};
+
+protected:
+   const GridEntityType& entity;
+
+   // NeighborGridEntityGetter(){};
 };
 
-
 /****
  * +-----------------+---------------------------+-------------------+
  * | EntityDimenions | NeighborEntityDimension |  Stored Stencil   |
@@ -384,81 +357,72 @@ class NeighborGridEntityGetter<
  * |       3         |              1            |       None        |
  * +-----------------+---------------------------+-------------------+
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-class NeighborGridEntityGetter<
-   GridEntity< Meshes::Grid< 3, Real, Device, Index >, 3, Config >,
-   1,
-   GridEntityStencilStorageTag< GridEntityNoStencil > >
+template< typename Real, typename Device, typename Index, typename Config >
+class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 3, Real, Device, Index >, 3, Config >,
+                                1,
+                                GridEntityStencilStorageTag< GridEntityNoStencil > >
 {
-   public:
-
-      static constexpr int EntityDimension = 3;
-      static constexpr int NeighborEntityDimension = 1;
-      typedef Meshes::Grid< 3, Real, Device, Index > GridType;
-      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, NeighborGridEntityType > GridEntityGetterType;
-      typedef typename GridEntityType::EntityOrientationType EntityOrientationType;
-      typedef typename GridEntityType::EntityBasisType EntityBasisType;
-
-      __cuda_callable__ inline
-      NeighborGridEntityGetter( const GridEntityType& entity )
-      : entity( entity )
-      {}
-
-      template< int stepX, int stepY, int stepZ >
-      __cuda_callable__ inline
-      NeighborGridEntityType getEntity() const
-      {
-         static_assert( ! stepX + ! stepY + ! stepZ == 1, "Exactly two of the steps must be non-zero." );
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         TNL_ASSERT( entity.getCoordinates() +
-                       CoordinatesType( stepX + ( stepX < 0 ),
-                                        stepY + ( stepY < 0 ),
-                                        stepZ + ( stepZ < 0 ) ) >= CoordinatesType( 0, 0, 0 ) &&
-                    entity.getCoordinates() +
-                       CoordinatesType( stepX + ( stepX < 0 ),
-                                        stepY + ( stepY < 0 ),
-                                        stepZ + ( stepZ < 0 ) )
-                       < entity.getMesh().getDimensions() +
-                        CoordinatesType( ( stepX > 0 ), ( stepY > 0 ), ( stepZ > 0 ) ),
-              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 ) )
+public:
+   static constexpr int EntityDimension = 3;
+   static constexpr int NeighborEntityDimension = 1;
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, EntityDimension, Config >;
+   using NeighborGridEntityType = GridEntity< GridType, NeighborEntityDimension, Config >;
+   using RealType = Real;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using GridEntityGetterType = GridEntityGetter< GridType, NeighborGridEntityType >;
+   using EntityOrientationType = typename GridEntityType::EntityOrientationType;
+   using EntityBasisType = typename GridEntityType::EntityBasisType;
+
+   __cuda_callable__
+   inline NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {}
+
+   template< int stepX, int stepY, int stepZ >
+   __cuda_callable__
+   inline NeighborGridEntityType
+   getEntity() const
+   {
+      static_assert( ! stepX + ! stepY + ! stepZ == 1, "Exactly two of the steps must be non-zero." );
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      TNL_ASSERT(
+         entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) )
+               >= CoordinatesType( 0, 0, 0 )
+            && entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) )
+                  < entity.getMesh().getDimensions() + CoordinatesType( ( stepX > 0 ), ( stepY > 0 ), ( stepZ > 0 ) ),
+         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()
                    << " 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 ) ),
-                                        EntityOrientationType( !!stepX, !!stepY, !!stepZ ),
-                                        EntityBasisType( !stepX, !stepY, !stepZ ));
-      }
-
-      template< int stepX, int stepY, int stepZ >
-      __cuda_callable__ inline
-      IndexType getEntityIndex() const
-      {
-         return GridEntityGetterType::getEntityIndex( this->entity.getMesh(), getEntity< stepX, stepY, stepZ >() );
-      }
-
-      __cuda_callable__
-      void refresh( const GridType& grid, const IndexType& entityIndex ){};
-
-   protected:
-
-      const GridEntityType& entity;
-
-      //NeighborGridEntityGetter(){};
+      return NeighborGridEntityType( this->entity.getMesh(),
+                                     CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ),
+                                                      entity.getCoordinates().y() + stepY + ( stepY < 0 ),
+                                                      entity.getCoordinates().z() + stepZ + ( stepZ < 0 ) ),
+                                     EntityOrientationType( ! ! stepX, ! ! stepY, ! ! stepZ ),
+                                     EntityBasisType( ! stepX, ! stepY, ! stepZ ) );
+   }
+
+   template< int stepX, int stepY, int stepZ >
+   __cuda_callable__
+   inline IndexType
+   getEntityIndex() const
+   {
+      return GridEntityGetterType::getEntityIndex( this->entity.getMesh(), getEntity< stepX, stepY, stepZ >() );
+   }
+
+   __cuda_callable__
+   void
+   refresh( const GridType& grid, const IndexType& entityIndex ){};
+
+protected:
+   const GridEntityType& entity;
+
+   // NeighborGridEntityGetter(){};
 };
 
-
 /****
  * +-----------------+---------------------------+-------------------+
  * | EntityDimenions | NeighborEntityDimension |  Stored Stencil   |
@@ -466,78 +430,68 @@ class NeighborGridEntityGetter<
  * |       3         |            0              |       None        |
  * +-----------------+---------------------------+-------------------+
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-class NeighborGridEntityGetter<
-   GridEntity< Meshes::Grid< 3, Real, Device, Index >, 3, Config >,
-   0,
-   GridEntityStencilStorageTag< GridEntityNoStencil > >
+template< typename Real, typename Device, typename Index, typename Config >
+class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 3, Real, Device, Index >, 3, Config >,
+                                0,
+                                GridEntityStencilStorageTag< GridEntityNoStencil > >
 {
-   public:
-
-      static constexpr int EntityDimension = 3;
-      static constexpr int NeighborEntityDimension = 0;
-      typedef Meshes::Grid< 3, Real, Device, Index > GridType;
-      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, NeighborGridEntityType > GridEntityGetterType;
-
-      __cuda_callable__ inline
-      NeighborGridEntityGetter( const GridEntityType& entity )
-      : entity( entity )
-      {}
-
-      template< int stepX, int stepY,int stepZ >
-      __cuda_callable__ inline
-      NeighborGridEntityType getEntity() const
-      {
-         TNL_ASSERT( stepX != 0 && stepY != 0 && stepZ != 0,
-                    std::cerr << " stepX = " << stepX
-                         << " stepY = " << stepY
-                         << " stepZ = " << stepZ );
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         TNL_ASSERT( entity.getCoordinates() +
-                       CoordinatesType( stepX + ( stepX < 0 ),
-                                        stepY + ( stepY < 0 ),
-                                        stepZ + ( stepZ < 0 ) ) >= CoordinatesType( 0, 0, 0 ) &&
-                    entity.getCoordinates() +
-                       CoordinatesType( stepX + ( stepX < 0 ),
-                                        stepY + ( stepY < 0 ),
-                                        stepZ + ( stepZ < 0 ) )
-                       < entity.getMesh().getDimensions() +
-                            CoordinatesType( ( stepX > 0 ), ( stepY > 0 ), ( stepZ > 0 ) ),
-              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 ) )
+public:
+   static constexpr int EntityDimension = 3;
+   static constexpr int NeighborEntityDimension = 0;
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, EntityDimension, Config >;
+   using NeighborGridEntityType = GridEntity< GridType, NeighborEntityDimension, Config >;
+   using RealType = Real;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using GridEntityGetterType = GridEntityGetter< GridType, NeighborGridEntityType >;
+
+   __cuda_callable__
+   inline NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {}
+
+   template< int stepX, int stepY, int stepZ >
+   __cuda_callable__
+   inline NeighborGridEntityType
+   getEntity() const
+   {
+      TNL_ASSERT( stepX != 0 && stepY != 0 && stepZ != 0,
+                  std::cerr << " stepX = " << stepX << " stepY = " << stepY << " stepZ = " << stepZ );
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      TNL_ASSERT(
+         entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) )
+               >= CoordinatesType( 0, 0, 0 )
+            && entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) )
+                  < entity.getMesh().getDimensions() + CoordinatesType( ( stepX > 0 ), ( stepY > 0 ), ( stepZ > 0 ) ),
+         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() + CoordinatesType( sign( stepX ), sign( stepY ), sign( stepZ ) ) = "
-                   << entity.getMesh().getDimensions()  + CoordinatesType( sign( stepX ), sign( stepY ), sign( stepZ ) )
+                   << entity.getMesh().getDimensions() + CoordinatesType( sign( stepX ), sign( stepY ), sign( stepZ ) )
                    << " 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 ) ) );
-      }
-
-      template< int stepX, int stepY, int stepZ >
-      __cuda_callable__ inline
-      IndexType getEntityIndex() const
-      {
-         return GridEntityGetterType::getEntityIndex( entity.getMesh(), getEntity< stepX, stepY, stepZ >() );
-      }
-
-      __cuda_callable__
-      void refresh( const GridType& grid, const IndexType& entityIndex ){};
-
-   protected:
-
-      const GridEntityType& entity;
-
-      //NeighborGridEntityGetter(){};
+      return NeighborGridEntityType( this->entity.getMesh(),
+                                     CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ),
+                                                      entity.getCoordinates().y() + stepY + ( stepY < 0 ),
+                                                      entity.getCoordinates().z() + stepZ + ( stepZ < 0 ) ) );
+   }
+
+   template< int stepX, int stepY, int stepZ >
+   __cuda_callable__
+   inline IndexType
+   getEntityIndex() const
+   {
+      return GridEntityGetterType::getEntityIndex( entity.getMesh(), getEntity< stepX, stepY, stepZ >() );
+   }
+
+   __cuda_callable__
+   void
+   refresh( const GridType& grid, const IndexType& entityIndex ){};
+
+protected:
+   const GridEntityType& entity;
+
+   // NeighborGridEntityGetter(){};
 };
 
 /****
@@ -547,80 +501,81 @@ class NeighborGridEntityGetter<
  * |       2         |              3            |       None        |
  * +-----------------+---------------------------+-------------------+
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-class NeighborGridEntityGetter<
-   GridEntity< Meshes::Grid< 3, Real, Device, Index >, 2, Config >,
-   3,
-   GridEntityStencilStorageTag< GridEntityNoStencil > >
+template< typename Real, typename Device, typename Index, typename Config >
+class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 3, Real, Device, Index >, 2, Config >,
+                                3,
+                                GridEntityStencilStorageTag< GridEntityNoStencil > >
 {
-   public:
-
-      static constexpr int EntityDimension = 2;
-      static constexpr int NeighborEntityDimension = 3;
-      typedef Meshes::Grid< 3, Real, Device, Index > GridType;
-      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, NeighborGridEntityType > GridEntityGetterType;
-
-      __cuda_callable__ inline
-      NeighborGridEntityGetter( const GridEntityType& entity )
-      : entity( entity )
-      {}
-
-      template< int stepX, int stepY, int stepZ >
-      __cuda_callable__ inline
-      NeighborGridEntityType getEntity() const
-      {
-         /*TNL_ASSERT( ( ( !! stepX ) == ( !! entity.getOrientation().x() ) ) &&
-                    ( ( !! stepY ) == ( !! entity.getOrientation().y() ) ) &&
-                    ( ( !! stepZ ) == ( !! entity.getOrientation().z() ) ),
-                    std::cerr << "( stepX, stepY, stepZ ) cannot be perpendicular to entity coordinates: stepX = " << stepX
-                         << " stepY = " << stepY << " stepZ = " << stepZ
-                         << " entity.getOrientation() = " << entity.getOrientation() );*/
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LT( entity.getCoordinates(), entity.getMesh().getDimensions() + TNL::abs(entity.getOrientation()), "wrong coordinates" );
-         TNL_ASSERT( entity.getCoordinates() +
-                       CoordinatesType( stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ),
-                                        stepY - ( stepY > 0 ) * ( entity.getOrientation().y() != 0.0 ),
-                                        stepZ - ( stepZ > 0 ) * ( entity.getOrientation().z() != 0.0 ) ) >= CoordinatesType( 0, 0, 0 ) &&
-                    entity.getCoordinates() +
-                       CoordinatesType( stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ),
-                                        stepY - ( stepY > 0 ) * ( entity.getOrientation().y() != 0.0 ),
-                                        stepZ - ( stepZ > 0 ) * ( entity.getOrientation().z() != 0.0 ) ) < entity.getMesh().getDimensions(),
-              std::cerr << "entity.getCoordinates()  + CoordinatesType( stepX + ( stepX < 0 ) * ( entity.getOrientation().x() != 0.0 ), stepY + ( stepY < 0 ) * ( entity.getOrientation().y() != 0.0 ), stepZ + ( stepZ < 0 ) * ( entity.getOrientation().z() != 0.0 ) ) = "
-                   << entity.getCoordinates()  + CoordinatesType(
-                        stepX + ( stepX < 0 ) * ( entity.getOrientation().x() != 0.0 ),
-                        stepY + ( stepY < 0 ) * ( entity.getOrientation().y() != 0.0 ),
-                        stepZ + ( stepZ < 0 ) * ( entity.getOrientation().z() != 0.0 ) )
-                   << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions()
-                   << " 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 ),
-                                                         entity.getCoordinates().z() + stepZ - ( stepZ > 0 ) * ( entity.getOrientation().z() != 0.0 ) ) );
-      }
-
-      template< int stepX, int stepY, int stepZ >
-      __cuda_callable__ inline
-      IndexType getEntityIndex() const
-      {
-         return GridEntityGetterType::getEntityIndex( entity.getMesh(), getEntity< stepX, stepY, stepZ >() );
-      }
-
-      __cuda_callable__
-      void refresh( const GridType& grid, const IndexType& entityIndex ){};
-
-   protected:
-
-      const GridEntityType& entity;
-
-      //NeighborGridEntityGetter(){};
+public:
+   static constexpr int EntityDimension = 2;
+   static constexpr int NeighborEntityDimension = 3;
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, EntityDimension, Config >;
+   using NeighborGridEntityType = GridEntity< GridType, NeighborEntityDimension, Config >;
+   using RealType = Real;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using GridEntityGetterType = GridEntityGetter< GridType, NeighborGridEntityType >;
+
+   __cuda_callable__
+   inline NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {}
+
+   template< int stepX, int stepY, int stepZ >
+   __cuda_callable__
+   inline NeighborGridEntityType
+   getEntity() const
+   {
+      /*TNL_ASSERT( ( ( !! stepX ) == ( !! entity.getOrientation().x() ) ) &&
+                 ( ( !! stepY ) == ( !! entity.getOrientation().y() ) ) &&
+                 ( ( !! stepZ ) == ( !! entity.getOrientation().z() ) ),
+                 std::cerr << "( stepX, stepY, stepZ ) cannot be perpendicular to entity coordinates: stepX = " << stepX
+                      << " stepY = " << stepY << " stepZ = " << stepZ
+                      << " entity.getOrientation() = " << entity.getOrientation() );*/
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LT(
+         entity.getCoordinates(), entity.getMesh().getDimensions() + TNL::abs( entity.getOrientation() ), "wrong coordinates" );
+      TNL_ASSERT( entity.getCoordinates()
+                           + CoordinatesType( stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ),
+                                              stepY - ( stepY > 0 ) * ( entity.getOrientation().y() != 0.0 ),
+                                              stepZ - ( stepZ > 0 ) * ( entity.getOrientation().z() != 0.0 ) )
+                        >= CoordinatesType( 0, 0, 0 )
+                     && entity.getCoordinates()
+                              + CoordinatesType( stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ),
+                                                 stepY - ( stepY > 0 ) * ( entity.getOrientation().y() != 0.0 ),
+                                                 stepZ - ( stepZ > 0 ) * ( entity.getOrientation().z() != 0.0 ) )
+                           < entity.getMesh().getDimensions(),
+                  std::cerr << "entity.getCoordinates()  + CoordinatesType( stepX + ( stepX < 0 ) * ( "
+                               "entity.getOrientation().x() != 0.0 ), stepY + ( stepY < 0 ) * ( entity.getOrientation().y() != "
+                               "0.0 ), stepZ + ( stepZ < 0 ) * ( entity.getOrientation().z() != 0.0 ) ) = "
+                            << entity.getCoordinates()
+                                  + CoordinatesType( stepX + ( stepX < 0 ) * ( entity.getOrientation().x() != 0.0 ),
+                                                     stepY + ( stepY < 0 ) * ( entity.getOrientation().y() != 0.0 ),
+                                                     stepZ + ( stepZ < 0 ) * ( entity.getOrientation().z() != 0.0 ) )
+                            << " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions()
+                            << " 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 ),
+                          entity.getCoordinates().z() + stepZ - ( stepZ > 0 ) * ( entity.getOrientation().z() != 0.0 ) ) );
+   }
+
+   template< int stepX, int stepY, int stepZ >
+   __cuda_callable__
+   inline IndexType
+   getEntityIndex() const
+   {
+      return GridEntityGetterType::getEntityIndex( entity.getMesh(), getEntity< stepX, stepY, stepZ >() );
+   }
+
+   __cuda_callable__
+   void
+   refresh( const GridType& grid, const IndexType& entityIndex ){};
+
+protected:
+   const GridEntityType& entity;
+
+   // NeighborGridEntityGetter(){};
 };
 
 /****
@@ -630,75 +585,71 @@ class NeighborGridEntityGetter<
  * |       0         |              0            |       None        |
  * +-----------------+---------------------------+-------------------+
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
-class NeighborGridEntityGetter<
-   GridEntity< Meshes::Grid< 3, Real, Device, Index >, 0, Config >,
-   0,
-   GridEntityStencilStorageTag< GridEntityNoStencil > >
+template< typename Real, typename Device, typename Index, typename Config >
+class NeighborGridEntityGetter< GridEntity< Meshes::Grid< 3, Real, Device, Index >, 0, Config >,
+                                0,
+                                GridEntityStencilStorageTag< GridEntityNoStencil > >
 {
-   public:
-
-      static constexpr int EntityDimension = 0;
-      static constexpr int NeighborEntityDimension = 0;
-      typedef Meshes::Grid< 3, Real, Device, Index > GridType;
-      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, NeighborGridEntityType > GridEntityGetterType;
-
-      __cuda_callable__ inline
-      NeighborGridEntityGetter( const GridEntityType& entity )
-      : entity( entity )
-      {}
-
-      template< int stepX, int stepY, int stepZ >
-      __cuda_callable__ inline
-      NeighborGridEntityType getEntity() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LE( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
-         return NeighborGridEntityType( this->entity.getMesh(),
-                                        CoordinatesType( entity.getCoordinates().x() + stepX,
-                                                         entity.getCoordinates().y() + stepY,
-                                                         entity.getCoordinates().z() + stepZ ) );
-      }
-
-      template< int stepX, int stepY, int stepZ >
-      __cuda_callable__ inline
-      IndexType getEntityIndex() const
-      {
-         TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
-         TNL_ASSERT_LE( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
-         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()
-                   << " EntityDimension = " << EntityDimension );
-         return this->entity.getIndex() + stepZ * ( entity.getMesh().getDimensions().y() + 1 + stepY ) * ( entity.getMesh().getDimensions().x() + 1 ) + stepX;
-      }
-
-      __cuda_callable__
-      void refresh( const GridType& grid, const IndexType& entityIndex ){};
-
-   protected:
-
-      const GridEntityType& entity;
-
-      //NeighborGridEntityGetter(){};
-
+public:
+   static constexpr int EntityDimension = 0;
+   static constexpr int NeighborEntityDimension = 0;
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   using GridEntityType = GridEntity< GridType, EntityDimension, Config >;
+   using NeighborGridEntityType = GridEntity< GridType, NeighborEntityDimension, Config >;
+   using RealType = Real;
+   using IndexType = Index;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using GridEntityGetterType = GridEntityGetter< GridType, NeighborGridEntityType >;
+
+   __cuda_callable__
+   inline NeighborGridEntityGetter( const GridEntityType& entity ) : entity( entity ) {}
+
+   template< int stepX, int stepY, int stepZ >
+   __cuda_callable__
+   inline NeighborGridEntityType
+   getEntity() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LE( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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()
+                            << " EntityDimension = " << EntityDimension );
+      return NeighborGridEntityType( this->entity.getMesh(),
+                                     CoordinatesType( entity.getCoordinates().x() + stepX,
+                                                      entity.getCoordinates().y() + stepY,
+                                                      entity.getCoordinates().z() + stepZ ) );
+   }
+
+   template< int stepX, int stepY, int stepZ >
+   __cuda_callable__
+   inline IndexType
+   getEntityIndex() const
+   {
+      TNL_ASSERT_GE( entity.getCoordinates(), CoordinatesType( 0, 0, 0 ), "wrong coordinates" );
+      TNL_ASSERT_LE( entity.getCoordinates(), entity.getMesh().getDimensions(), "wrong coordinates" );
+      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()
+                            << " EntityDimension = " << EntityDimension );
+      return this->entity.getIndex()
+           + stepZ * ( entity.getMesh().getDimensions().y() + 1 + stepY ) * ( entity.getMesh().getDimensions().x() + 1 )
+           + stepX;
+   }
+
+   __cuda_callable__
+   void
+   refresh( const GridType& grid, const IndexType& entityIndex ){};
+
+protected:
+   const GridEntityType& entity;
+
+   // NeighborGridEntityGetter(){};
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/GridDetails/Traverser_Grid1D.h b/src/TNL/Meshes/GridDetails/Traverser_Grid1D.h
index 814f003c18ce45382820027d43b93626e7c55299..67b7cc619a4d601a4113358d5c9f8916488ffc76 100644
--- a/src/TNL/Meshes/GridDetails/Traverser_Grid1D.h
+++ b/src/TNL/Meshes/GridDetails/Traverser_Grid1D.h
@@ -12,62 +12,49 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
+template< typename Real, typename Device, typename Index, typename GridEntity >
 class Traverser< Meshes::Grid< 1, Real, Device, Index >, GridEntity, 1 >
 {
-   public:
-      using GridType = Meshes::Grid< 1, Real, Device, Index >;
-      using GridPointer = Pointers::SharedPointer< GridType >;
-      using CoordinatesType = typename GridType::CoordinatesType;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processBoundaryEntities( const GridPointer& gridPointer,
-                                    UserData& userData ) const;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processInteriorEntities( const GridPointer& gridPointer,
-                                    UserData& userData ) const;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processAllEntities( const GridPointer& gridPointer,
-                               UserData& userData ) const;
+public:
+   using GridType = Meshes::Grid< 1, Real, Device, Index >;
+   using GridPointer = Pointers::SharedPointer< GridType >;
+   using CoordinatesType = typename GridType::CoordinatesType;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processBoundaryEntities( const GridPointer& gridPointer, UserData& userData ) const;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processInteriorEntities( const GridPointer& gridPointer, UserData& userData ) const;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processAllEntities( const GridPointer& gridPointer, UserData& userData ) const;
 };
 
-
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
+template< typename Real, typename Device, typename Index, typename GridEntity >
 class Traverser< Meshes::Grid< 1, Real, Device, Index >, GridEntity, 0 >
 {
-   public:
-      using GridType = Meshes::Grid< 1, Real, Device, Index >;
-      using GridPointer = Pointers::SharedPointer< GridType >;
-      using CoordinatesType = typename GridType::CoordinatesType;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processBoundaryEntities( const GridPointer& gridPointer,
-                                    UserData& userData ) const;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processInteriorEntities( const GridPointer& gridPointer,
-                                    UserData& userData ) const;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processAllEntities( const GridPointer& gridPointer,
-                               UserData& userData ) const;
+public:
+   using GridType = Meshes::Grid< 1, Real, Device, Index >;
+   using GridPointer = Pointers::SharedPointer< GridType >;
+   using CoordinatesType = typename GridType::CoordinatesType;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processBoundaryEntities( const GridPointer& gridPointer, UserData& userData ) const;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processInteriorEntities( const GridPointer& gridPointer, UserData& userData ) const;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processAllEntities( const GridPointer& gridPointer, UserData& userData ) const;
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/GridDetails/Traverser_Grid1D_impl.h>
diff --git a/src/TNL/Meshes/GridDetails/Traverser_Grid1D_impl.h b/src/TNL/Meshes/GridDetails/Traverser_Grid1D_impl.h
index 811fea2f086bc735c9d46b9c2e95a00a7daf8ca0..2ddfbffcee8a65ea9555123d5992150de85cddc6 100644
--- a/src/TNL/Meshes/GridDetails/Traverser_Grid1D_impl.h
+++ b/src/TNL/Meshes/GridDetails/Traverser_Grid1D_impl.h
@@ -14,64 +14,41 @@ namespace Meshes {
 /****
  * Grid 1D, cells
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 1, Real, Device, Index >, GridEntity, 1 >::
-processBoundaryEntities( const GridPointer& gridPointer,
-                         UserData& userData ) const
+Traverser< Meshes::Grid< 1, Real, Device, Index >, GridEntity, 1 >::processBoundaryEntities( const GridPointer& gridPointer,
+                                                                                             UserData& userData ) const
 {
    /****
     * Boundary cells
     */
    static_assert( GridEntity::getEntityDimension() == 1, "The entity has wrong dimensions." );
 
-   if( gridPointer->getLocalBegin() < gridPointer->getInteriorBegin() && gridPointer->getInteriorEnd() < gridPointer->getLocalEnd() )
+   if( gridPointer->getLocalBegin() < gridPointer->getInteriorBegin()
+       && gridPointer->getInteriorEnd() < gridPointer->getLocalEnd() )
    {
       // 2 boundaries (left and right)
       GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true >(
-         gridPointer,
-         gridPointer->getInteriorBegin() - 1,
-         gridPointer->getInteriorEnd() + 1,
-         userData,
-         asynchronousMode );
+         gridPointer, gridPointer->getInteriorBegin() - 1, gridPointer->getInteriorEnd() + 1, userData, asynchronousMode );
    }
-   else if( gridPointer->getLocalBegin() < gridPointer->getInteriorBegin() )
-   {
+   else if( gridPointer->getLocalBegin() < gridPointer->getInteriorBegin() ) {
       // 1 boundary (left)
       GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
-         gridPointer,
-         gridPointer->getInteriorBegin() - 1,
-         gridPointer->getInteriorBegin(),
-         userData,
-         asynchronousMode );
+         gridPointer, gridPointer->getInteriorBegin() - 1, gridPointer->getInteriorBegin(), userData, asynchronousMode );
    }
-   else if( gridPointer->getInteriorEnd() < gridPointer->getLocalEnd() )
-   {
+   else if( gridPointer->getInteriorEnd() < gridPointer->getLocalEnd() ) {
       // 1 boundary (right)
       GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
-         gridPointer,
-         gridPointer->getInteriorEnd(),
-         gridPointer->getInteriorEnd() + 1,
-         userData,
-         asynchronousMode );
+         gridPointer, gridPointer->getInteriorEnd(), gridPointer->getInteriorEnd() + 1, userData, asynchronousMode );
    }
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 1, Real, Device, Index >, GridEntity, 1 >::
-processInteriorEntities( const GridPointer& gridPointer,
-                         UserData& userData ) const
+Traverser< Meshes::Grid< 1, Real, Device, Index >, GridEntity, 1 >::processInteriorEntities( const GridPointer& gridPointer,
+                                                                                             UserData& userData ) const
 {
    /****
     * Interior cells
@@ -79,24 +56,14 @@ processInteriorEntities( const GridPointer& gridPointer,
    static_assert( GridEntity::getEntityDimension() == 1, "The entity has wrong dimension." );
 
    GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
-      gridPointer,
-      gridPointer->getInteriorBegin(),
-      gridPointer->getInteriorEnd(),
-      userData,
-      asynchronousMode );
+      gridPointer, gridPointer->getInteriorBegin(), gridPointer->getInteriorEnd(), userData, asynchronousMode );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 1, Real, Device, Index >, GridEntity, 1 >::
-processAllEntities(
-   const GridPointer& gridPointer,
-   UserData& userData ) const
+Traverser< Meshes::Grid< 1, Real, Device, Index >, GridEntity, 1 >::processAllEntities( const GridPointer& gridPointer,
+                                                                                        UserData& userData ) const
 {
    /****
     * All cells
@@ -104,26 +71,17 @@ processAllEntities(
    static_assert( GridEntity::getEntityDimension() == 1, "The entity has wrong dimensions." );
 
    GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
-      gridPointer,
-      gridPointer->getLocalBegin(),
-      gridPointer->getLocalEnd(),
-      userData,
-      asynchronousMode );
+      gridPointer, gridPointer->getLocalBegin(), gridPointer->getLocalEnd(), userData, asynchronousMode );
 }
 
 /****
  * Grid 1D, vertices
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 1, Real, Device, Index >, GridEntity, 0 >::
-processBoundaryEntities( const GridPointer& gridPointer,
-                         UserData& userData ) const
+Traverser< Meshes::Grid< 1, Real, Device, Index >, GridEntity, 0 >::processBoundaryEntities( const GridPointer& gridPointer,
+                                                                                             UserData& userData ) const
 {
    /****
     * Boundary vertices
@@ -131,23 +89,14 @@ processBoundaryEntities( const GridPointer& gridPointer,
    static_assert( GridEntity::getEntityDimension() == 0, "The entity has wrong dimension." );
 
    GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true >(
-      gridPointer,
-      CoordinatesType( 0 ),
-      gridPointer->getDimensions() + 1,
-      userData,
-      asynchronousMode );
+      gridPointer, CoordinatesType( 0 ), gridPointer->getDimensions() + 1, userData, asynchronousMode );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 1, Real, Device, Index >, GridEntity, 0 >::
-processInteriorEntities( const GridPointer& gridPointer,
-                         UserData& userData ) const
+Traverser< Meshes::Grid< 1, Real, Device, Index >, GridEntity, 0 >::processInteriorEntities( const GridPointer& gridPointer,
+                                                                                             UserData& userData ) const
 {
    /****
     * Interior vertices
@@ -155,24 +104,14 @@ processInteriorEntities( const GridPointer& gridPointer,
    static_assert( GridEntity::getEntityDimension() == 0, "The entity has wrong dimension." );
 
    GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
-      gridPointer,
-      CoordinatesType( 1 ),
-      gridPointer->getDimensions(),
-      userData,
-      asynchronousMode );
+      gridPointer, CoordinatesType( 1 ), gridPointer->getDimensions(), userData, asynchronousMode );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 1, Real, Device, Index >, GridEntity, 0 >::
-processAllEntities(
-   const GridPointer& gridPointer,
-   UserData& userData ) const
+Traverser< Meshes::Grid< 1, Real, Device, Index >, GridEntity, 0 >::processAllEntities( const GridPointer& gridPointer,
+                                                                                        UserData& userData ) const
 {
    /****
     * All vertices
@@ -180,12 +119,8 @@ processAllEntities(
    static_assert( GridEntity::getEntityDimension() == 0, "The entity has wrong dimension." );
 
    GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
-      gridPointer,
-      CoordinatesType( 0 ),
-      gridPointer->getDimensions() + 1,
-      userData,
-      asynchronousMode );
+      gridPointer, CoordinatesType( 0 ), gridPointer->getDimensions() + 1, userData, asynchronousMode );
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/GridDetails/Traverser_Grid2D.h b/src/TNL/Meshes/GridDetails/Traverser_Grid2D.h
index 71b9a92d29a70238338180d3c3255b4c4845221c..0473c1236b8b219ab655789abaade6d941b8ebac 100644
--- a/src/TNL/Meshes/GridDetails/Traverser_Grid2D.h
+++ b/src/TNL/Meshes/GridDetails/Traverser_Grid2D.h
@@ -12,87 +12,69 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
+template< typename Real, typename Device, typename Index, typename GridEntity >
 class Traverser< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 2 >
 {
-   public:
-      using GridType = Meshes::Grid< 2, Real, Device, Index >;
-      using GridPointer = Pointers::SharedPointer< GridType >;
-      using CoordinatesType = typename GridType::CoordinatesType;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processBoundaryEntities( const GridPointer& gridPointer,
-                                    UserData& userData ) const;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processInteriorEntities( const GridPointer& gridPointer,
-                                    UserData& userData ) const;
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processAllEntities( const GridPointer& gridPointer,
-                               UserData& userData ) const;
+public:
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
+   using GridPointer = Pointers::SharedPointer< GridType >;
+   using CoordinatesType = typename GridType::CoordinatesType;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processBoundaryEntities( const GridPointer& gridPointer, UserData& userData ) const;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processInteriorEntities( const GridPointer& gridPointer, UserData& userData ) const;
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processAllEntities( const GridPointer& gridPointer, UserData& userData ) const;
 };
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
+template< typename Real, typename Device, typename Index, typename GridEntity >
 class Traverser< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 1 >
 {
-   public:
-      using GridType = Meshes::Grid< 2, Real, Device, Index >;
-      using GridPointer = Pointers::SharedPointer< GridType >;
-      using CoordinatesType = typename GridType::CoordinatesType;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processBoundaryEntities( const GridPointer& gridPointer,
-                                    UserData& userData ) const;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processInteriorEntities( const GridPointer& gridPointer,
-                                    UserData& userData ) const;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processAllEntities( const GridPointer& gridPointer,
-                               UserData& userData ) const;
+public:
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
+   using GridPointer = Pointers::SharedPointer< GridType >;
+   using CoordinatesType = typename GridType::CoordinatesType;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processBoundaryEntities( const GridPointer& gridPointer, UserData& userData ) const;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processInteriorEntities( const GridPointer& gridPointer, UserData& userData ) const;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processAllEntities( const GridPointer& gridPointer, UserData& userData ) const;
 };
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
+template< typename Real, typename Device, typename Index, typename GridEntity >
 class Traverser< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 0 >
 {
-   public:
-      using GridType = Meshes::Grid< 2, Real, Device, Index >;
-      using GridPointer = Pointers::SharedPointer< GridType >;
-      using CoordinatesType = typename GridType::CoordinatesType;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processBoundaryEntities( const GridPointer& gridPointer,
-                                    UserData& userData ) const;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processInteriorEntities( const GridPointer& gridPointer,
-                                    UserData& userData ) const;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processAllEntities( const GridPointer& gridPointer,
-                               UserData& userData ) const;
+public:
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
+   using GridPointer = Pointers::SharedPointer< GridType >;
+   using CoordinatesType = typename GridType::CoordinatesType;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processBoundaryEntities( const GridPointer& gridPointer, UserData& userData ) const;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processInteriorEntities( const GridPointer& gridPointer, UserData& userData ) const;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processAllEntities( const GridPointer& gridPointer, UserData& userData ) const;
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/GridDetails/Traverser_Grid2D_impl.h>
diff --git a/src/TNL/Meshes/GridDetails/Traverser_Grid2D_impl.h b/src/TNL/Meshes/GridDetails/Traverser_Grid2D_impl.h
index ef3369d578b5bb8623923fe1cb91765cdf575d64..56740c4c964ae78b6bf36a9ef7ef694283e64e2c 100644
--- a/src/TNL/Meshes/GridDetails/Traverser_Grid2D_impl.h
+++ b/src/TNL/Meshes/GridDetails/Traverser_Grid2D_impl.h
@@ -14,54 +14,34 @@ namespace Meshes {
 /****
  * Grid 2D, cells
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 2 >::
-processBoundaryEntities( const GridPointer& gridPointer,
-                         UserData& userData ) const
+Traverser< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 2 >::processBoundaryEntities( const GridPointer& gridPointer,
+                                                                                             UserData& userData ) const
 {
    /****
     * Boundary cells
     */
    static_assert( GridEntity::getEntityDimension() == 2, "The entity has wrong dimension." );
 
-   if( gridPointer->getLocalBegin() < gridPointer->getInteriorBegin() && gridPointer->getInteriorEnd() < gridPointer->getLocalEnd() )
+   if( gridPointer->getLocalBegin() < gridPointer->getInteriorBegin()
+       && gridPointer->getInteriorEnd() < gridPointer->getLocalEnd() )
    {
       // 4 boundaries (left, right, down, up)
       GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 1, 1 >(
-         gridPointer,
-         gridPointer->getInteriorBegin() - 1,
-         gridPointer->getInteriorEnd() + 1,
-         userData,
-         asynchronousMode,
-         0 );
+         gridPointer, gridPointer->getInteriorBegin() - 1, gridPointer->getInteriorEnd() + 1, userData, asynchronousMode, 0 );
    }
-   else
-   {
+   else {
       const CoordinatesType begin = gridPointer->getLocalBegin();
       const CoordinatesType end = gridPointer->getLocalEnd();
       const CoordinatesType skipBegin = gridPointer->getInteriorBegin();
       const CoordinatesType skipEnd = gridPointer->getInteriorEnd();
 
       GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
-         gridPointer,
-         begin,
-         CoordinatesType( end.x(), skipBegin.y() ),
-         userData,
-         asynchronousMode,
-         0 );
+         gridPointer, begin, CoordinatesType( end.x(), skipBegin.y() ), userData, asynchronousMode, 0 );
       GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
-         gridPointer,
-         CoordinatesType( begin.x(), skipEnd.y() ),
-         end,
-         userData,
-         asynchronousMode,
-         0 );
+         gridPointer, CoordinatesType( begin.x(), skipEnd.y() ), end, userData, asynchronousMode, 0 );
       GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
          gridPointer,
          CoordinatesType( begin.x(), skipBegin.y() ),
@@ -79,16 +59,11 @@ processBoundaryEntities( const GridPointer& gridPointer,
    }
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 2 >::
-processInteriorEntities( const GridPointer& gridPointer,
-                         UserData& userData ) const
+Traverser< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 2 >::processInteriorEntities( const GridPointer& gridPointer,
+                                                                                             UserData& userData ) const
 {
    /****
     * Interior cells
@@ -96,24 +71,14 @@ processInteriorEntities( const GridPointer& gridPointer,
    static_assert( GridEntity::getEntityDimension() == 2, "The entity has wrong dimensions." );
 
    GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
-      gridPointer,
-      gridPointer->getInteriorBegin(),
-      gridPointer->getInteriorEnd(),
-      userData,
-      asynchronousMode,
-      0 );
+      gridPointer, gridPointer->getInteriorBegin(), gridPointer->getInteriorEnd(), userData, asynchronousMode, 0 );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 2 >::
-processAllEntities( const GridPointer& gridPointer,
-                    UserData& userData ) const
+Traverser< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 2 >::processAllEntities( const GridPointer& gridPointer,
+                                                                                        UserData& userData ) const
 {
    /****
     * All cells
@@ -121,138 +86,119 @@ processAllEntities( const GridPointer& gridPointer,
    static_assert( GridEntity::getEntityDimension() == 2, "The entity has wrong dimension." );
 
    GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
-      gridPointer,
-      gridPointer->getLocalBegin(),
-      gridPointer->getLocalEnd(),
-      userData,
-      asynchronousMode,
-      0 );
+      gridPointer, gridPointer->getLocalBegin(), gridPointer->getLocalEnd(), userData, asynchronousMode, 0 );
 }
 
 /****
  * Grid 2D, faces
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 1 >::
-processBoundaryEntities( const GridPointer& gridPointer,
-                         UserData& userData ) const
+Traverser< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 1 >::processBoundaryEntities( const GridPointer& gridPointer,
+                                                                                             UserData& userData ) const
 {
    /****
     * Boundary faces
     */
    static_assert( GridEntity::getEntityDimension() == 1, "The entity has wrong dimension." );
 
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 1, 0, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 0, 0 ),
-      gridPointer->getDimensions() + CoordinatesType( 1, 0 ),
-      userData,
-      asynchronousMode,
-      1,
-      CoordinatesType( 1, 0 ),
-      CoordinatesType( 0, 1 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, true, 1, 0, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 0, 0 ),
+         gridPointer->getDimensions() + CoordinatesType( 1, 0 ),
+         userData,
+         asynchronousMode,
+         1,
+         CoordinatesType( 1, 0 ),
+         CoordinatesType( 0, 1 ) );
 
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 0, 1, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 0, 0 ),
-      gridPointer->getDimensions() + CoordinatesType( 0, 1 ),
-      userData,
-      asynchronousMode,
-      0,
-      CoordinatesType( 0, 1 ),
-      CoordinatesType( 1, 0 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, true, 0, 1, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 0, 0 ),
+         gridPointer->getDimensions() + CoordinatesType( 0, 1 ),
+         userData,
+         asynchronousMode,
+         0,
+         CoordinatesType( 0, 1 ),
+         CoordinatesType( 1, 0 ) );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 1 >::
-processInteriorEntities( const GridPointer& gridPointer,
-                         UserData& userData ) const
+Traverser< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 1 >::processInteriorEntities( const GridPointer& gridPointer,
+                                                                                             UserData& userData ) const
 {
    /****
     * Interior faces
     */
    static_assert( GridEntity::getEntityDimension() == 1, "The entity has wrong dimension." );
 
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 1, 0 ),
-      gridPointer->getDimensions(),
-      userData,
-      asynchronousMode,
-      1,
-      CoordinatesType( 1, 0 ),
-      CoordinatesType( 0, 1 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 1, 0 ),
+         gridPointer->getDimensions(),
+         userData,
+         asynchronousMode,
+         1,
+         CoordinatesType( 1, 0 ),
+         CoordinatesType( 0, 1 ) );
 
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 0, 1 ),
-      gridPointer->getDimensions(),
-      userData,
-      asynchronousMode,
-      0,
-      CoordinatesType( 0, 1 ),
-      CoordinatesType( 1, 0 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 0, 1 ),
+         gridPointer->getDimensions(),
+         userData,
+         asynchronousMode,
+         0,
+         CoordinatesType( 0, 1 ),
+         CoordinatesType( 1, 0 ) );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 1 >::
-processAllEntities( const GridPointer& gridPointer,
-                    UserData& userData ) const
+Traverser< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 1 >::processAllEntities( const GridPointer& gridPointer,
+                                                                                        UserData& userData ) const
 {
    /****
     * All faces
     */
    static_assert( GridEntity::getEntityDimension() == 1, "The entity has wrong dimension." );
 
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 0, 0 ),
-      gridPointer->getDimensions() + CoordinatesType( 1, 0 ),
-      userData,
-      asynchronousMode,
-      1,
-      CoordinatesType( 1, 0 ),
-      CoordinatesType( 0, 1 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 0, 0 ),
+         gridPointer->getDimensions() + CoordinatesType( 1, 0 ),
+         userData,
+         asynchronousMode,
+         1,
+         CoordinatesType( 1, 0 ),
+         CoordinatesType( 0, 1 ) );
 
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 0, 0 ),
-      gridPointer->getDimensions() + CoordinatesType( 0, 1 ),
-      userData,
-      asynchronousMode,
-      0,
-      CoordinatesType( 0, 1 ),
-      CoordinatesType( 1, 0 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 0, 0 ),
+         gridPointer->getDimensions() + CoordinatesType( 0, 1 ),
+         userData,
+         asynchronousMode,
+         0,
+         CoordinatesType( 0, 1 ),
+         CoordinatesType( 1, 0 ) );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 0 >::
-processBoundaryEntities( const GridPointer& gridPointer,
-                         UserData& userData ) const
+Traverser< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 0 >::processBoundaryEntities( const GridPointer& gridPointer,
+                                                                                             UserData& userData ) const
 {
    /****
     * Boundary vertices
@@ -268,16 +214,11 @@ processBoundaryEntities( const GridPointer& gridPointer,
       0 );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 0 >::
-processInteriorEntities( const GridPointer& gridPointer,
-                         UserData& userData ) const
+Traverser< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 0 >::processInteriorEntities( const GridPointer& gridPointer,
+                                                                                             UserData& userData ) const
 {
    /****
     * Interior vertices
@@ -285,24 +226,14 @@ processInteriorEntities( const GridPointer& gridPointer,
    static_assert( GridEntity::getEntityDimension() == 0, "The entity has wrong dimension." );
 
    GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
-      gridPointer,
-      CoordinatesType( 1, 1 ),
-      gridPointer->getDimensions(),
-      userData,
-      asynchronousMode,
-      0 );
+      gridPointer, CoordinatesType( 1, 1 ), gridPointer->getDimensions(), userData, asynchronousMode, 0 );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 0 >::
-processAllEntities( const GridPointer& gridPointer,
-                    UserData& userData ) const
+Traverser< Meshes::Grid< 2, Real, Device, Index >, GridEntity, 0 >::processAllEntities( const GridPointer& gridPointer,
+                                                                                        UserData& userData ) const
 {
    /****
     * All vertices
@@ -318,5 +249,5 @@ processAllEntities( const GridPointer& gridPointer,
       0 );
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/GridDetails/Traverser_Grid3D.h b/src/TNL/Meshes/GridDetails/Traverser_Grid3D.h
index c60bfaf441bb66adb1acfbf9de6919fc2a0f702d..002f63203e27649ab5280ccd40a05cd20fa49b96 100644
--- a/src/TNL/Meshes/GridDetails/Traverser_Grid3D.h
+++ b/src/TNL/Meshes/GridDetails/Traverser_Grid3D.h
@@ -12,113 +12,89 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
+template< typename Real, typename Device, typename Index, typename GridEntity >
 class Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 3 >
 {
-   public:
-      using GridType = Meshes::Grid< 3, Real, Device, Index >;
-      using GridPointer = Pointers::SharedPointer< GridType >;
-      using CoordinatesType = typename GridType::CoordinatesType;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processBoundaryEntities( const GridPointer& gridPointer,
-                                    UserData& userData ) const;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processInteriorEntities( const GridPointer& gridPointer,
-                                    UserData& userData ) const;
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processAllEntities( const GridPointer& gridPointer,
-                               UserData& userData ) const;
+public:
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   using GridPointer = Pointers::SharedPointer< GridType >;
+   using CoordinatesType = typename GridType::CoordinatesType;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processBoundaryEntities( const GridPointer& gridPointer, UserData& userData ) const;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processInteriorEntities( const GridPointer& gridPointer, UserData& userData ) const;
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processAllEntities( const GridPointer& gridPointer, UserData& userData ) const;
 };
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
+template< typename Real, typename Device, typename Index, typename GridEntity >
 class Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 2 >
 {
-   public:
-      using GridType = Meshes::Grid< 3, Real, Device, Index >;
-      using GridPointer = Pointers::SharedPointer< GridType >;
-      using CoordinatesType = typename GridType::CoordinatesType;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processBoundaryEntities( const GridPointer& gridPointer,
-                                    UserData& userData ) const;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processInteriorEntities( const GridPointer& gridPointer,
-                                    UserData& userData ) const;
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processAllEntities( const GridPointer& gridPointer,
-                               UserData& userData ) const;
+public:
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   using GridPointer = Pointers::SharedPointer< GridType >;
+   using CoordinatesType = typename GridType::CoordinatesType;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processBoundaryEntities( const GridPointer& gridPointer, UserData& userData ) const;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processInteriorEntities( const GridPointer& gridPointer, UserData& userData ) const;
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processAllEntities( const GridPointer& gridPointer, UserData& userData ) const;
 };
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
+template< typename Real, typename Device, typename Index, typename GridEntity >
 class Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 1 >
 {
-   public:
-      using GridType = Meshes::Grid< 3, Real, Device, Index >;
-      using GridPointer = Pointers::SharedPointer< GridType >;
-      using CoordinatesType = typename GridType::CoordinatesType;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processBoundaryEntities( const GridPointer& gridPointer,
-                                    UserData& userData ) const;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processInteriorEntities( const GridPointer& gridPointer,
-                                    UserData& userData ) const;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processAllEntities( const GridPointer& gridPointer,
-                               UserData& userData ) const;
+public:
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   using GridPointer = Pointers::SharedPointer< GridType >;
+   using CoordinatesType = typename GridType::CoordinatesType;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processBoundaryEntities( const GridPointer& gridPointer, UserData& userData ) const;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processInteriorEntities( const GridPointer& gridPointer, UserData& userData ) const;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processAllEntities( const GridPointer& gridPointer, UserData& userData ) const;
 };
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
+template< typename Real, typename Device, typename Index, typename GridEntity >
 class Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 0 >
 {
-   public:
-      using GridType = Meshes::Grid< 3, Real, Device, Index >;
-      using GridPointer = Pointers::SharedPointer< GridType >;
-      using CoordinatesType = typename GridType::CoordinatesType;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processBoundaryEntities( const GridPointer& gridPointer,
-                                    UserData& userData ) const;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processInteriorEntities( const GridPointer& gridPointer,
-                                    UserData& userData ) const;
-
-      template< typename EntitiesProcessor,
-                typename UserData >
-      void processAllEntities( const GridPointer& gridPointer,
-                               UserData& userData ) const;
+public:
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   using GridPointer = Pointers::SharedPointer< GridType >;
+   using CoordinatesType = typename GridType::CoordinatesType;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processBoundaryEntities( const GridPointer& gridPointer, UserData& userData ) const;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processInteriorEntities( const GridPointer& gridPointer, UserData& userData ) const;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processAllEntities( const GridPointer& gridPointer, UserData& userData ) const;
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/GridDetails/Traverser_Grid3D_impl.h>
diff --git a/src/TNL/Meshes/GridDetails/Traverser_Grid3D_impl.h b/src/TNL/Meshes/GridDetails/Traverser_Grid3D_impl.h
index e2ae33ae6d60d766c7da2fc38bf6880c91a1f5aa..f00b4dec391dbc7b3f865c166378329cc61e5139 100644
--- a/src/TNL/Meshes/GridDetails/Traverser_Grid3D_impl.h
+++ b/src/TNL/Meshes/GridDetails/Traverser_Grid3D_impl.h
@@ -16,54 +16,34 @@ namespace Meshes {
 /****
  * Grid 3D, cells
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 3 >::
-processBoundaryEntities( const GridPointer& gridPointer,
-                         UserData& userData ) const
+Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 3 >::processBoundaryEntities( const GridPointer& gridPointer,
+                                                                                             UserData& userData ) const
 {
    /****
     * Boundary cells
     */
    static_assert( GridEntity::getEntityDimension() == 3, "The entity has wrong dimension." );
 
-   if( gridPointer->getLocalBegin() < gridPointer->getInteriorBegin() && gridPointer->getInteriorEnd() < gridPointer->getLocalEnd() )
+   if( gridPointer->getLocalBegin() < gridPointer->getInteriorBegin()
+       && gridPointer->getInteriorEnd() < gridPointer->getLocalEnd() )
    {
       // 6 boundaries (left, right, down, up, front, back)
       GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 1, 1, 1 >(
-         gridPointer,
-         gridPointer->getInteriorBegin() - 1,
-         gridPointer->getInteriorEnd() + 1,
-         userData,
-         asynchronousMode,
-         0 );
+         gridPointer, gridPointer->getInteriorBegin() - 1, gridPointer->getInteriorEnd() + 1, userData, asynchronousMode, 0 );
    }
-   else
-   {
+   else {
       const CoordinatesType begin = gridPointer->getLocalBegin();
       const CoordinatesType end = gridPointer->getLocalEnd();
       const CoordinatesType skipBegin = gridPointer->getInteriorBegin();
       const CoordinatesType skipEnd = gridPointer->getInteriorEnd();
 
       GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
-         gridPointer,
-         begin,
-         CoordinatesType( end.x(), end.y(), skipBegin.z() ),
-         userData,
-         asynchronousMode,
-         0 );
+         gridPointer, begin, CoordinatesType( end.x(), end.y(), skipBegin.z() ), userData, asynchronousMode, 0 );
       GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
-         gridPointer,
-         CoordinatesType( begin.x(), begin.y(), skipEnd.z() ),
-         end,
-         userData,
-         asynchronousMode,
-         0 );
+         gridPointer, CoordinatesType( begin.x(), begin.y(), skipEnd.z() ), end, userData, asynchronousMode, 0 );
       GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
          gridPointer,
          CoordinatesType( begin.x(), begin.y(), skipBegin.z() ),
@@ -95,16 +75,11 @@ processBoundaryEntities( const GridPointer& gridPointer,
    }
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 3 >::
-processInteriorEntities( const GridPointer& gridPointer,
-                         UserData& userData ) const
+Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 3 >::processInteriorEntities( const GridPointer& gridPointer,
+                                                                                             UserData& userData ) const
 {
    /****
     * Interior cells
@@ -112,24 +87,14 @@ processInteriorEntities( const GridPointer& gridPointer,
    static_assert( GridEntity::getEntityDimension() == 3, "The entity has wrong dimension." );
 
    GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
-      gridPointer,
-      gridPointer->getInteriorBegin(),
-      gridPointer->getInteriorEnd(),
-      userData,
-      asynchronousMode,
-      0 );
+      gridPointer, gridPointer->getInteriorBegin(), gridPointer->getInteriorEnd(), userData, asynchronousMode, 0 );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 3 >::
-processAllEntities( const GridPointer& gridPointer,
-                    UserData& userData ) const
+Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 3 >::processAllEntities( const GridPointer& gridPointer,
+                                                                                        UserData& userData ) const
 {
    /****
     * All cells
@@ -137,313 +102,291 @@ processAllEntities( const GridPointer& gridPointer,
    static_assert( GridEntity::getEntityDimension() == 3, "The entity has wrong dimension." );
 
    GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
-      gridPointer,
-      gridPointer->getLocalBegin(),
-      gridPointer->getLocalEnd(),
-      userData,
-      asynchronousMode,
-      0 );
+      gridPointer, gridPointer->getLocalBegin(), gridPointer->getLocalEnd(), userData, asynchronousMode, 0 );
 }
 
 /****
  * Grid 3D, faces
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 2 >::
-processBoundaryEntities( const GridPointer& gridPointer,
-                         UserData& userData ) const
+Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 2 >::processBoundaryEntities( const GridPointer& gridPointer,
+                                                                                             UserData& userData ) const
 {
    /****
     * Boundary faces
     */
    static_assert( GridEntity::getEntityDimension() == 2, "The entity has wrong dimension." );
 
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 1, 0, 0, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 0, 0, 0 ),
-      gridPointer->getDimensions() + CoordinatesType( 1, 0, 0 ),
-      userData,
-      asynchronousMode,
-      2,
-      CoordinatesType( 1, 0, 0 ),
-      CoordinatesType( 0, 1, 1 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, true, 1, 0, 0, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 0, 0, 0 ),
+         gridPointer->getDimensions() + CoordinatesType( 1, 0, 0 ),
+         userData,
+         asynchronousMode,
+         2,
+         CoordinatesType( 1, 0, 0 ),
+         CoordinatesType( 0, 1, 1 ) );
 
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 0, 1, 0, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 0, 0, 0 ),
-      gridPointer->getDimensions() + CoordinatesType( 0, 1, 0 ),
-      userData,
-      asynchronousMode,
-      1,
-      CoordinatesType( 0, 1, 0 ),
-      CoordinatesType( 1, 0, 1 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, true, 0, 1, 0, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 0, 0, 0 ),
+         gridPointer->getDimensions() + CoordinatesType( 0, 1, 0 ),
+         userData,
+         asynchronousMode,
+         1,
+         CoordinatesType( 0, 1, 0 ),
+         CoordinatesType( 1, 0, 1 ) );
 
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 0, 0, 1, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 0, 0, 0 ),
-      gridPointer->getDimensions() + CoordinatesType( 0, 0, 1 ),
-      userData,
-      asynchronousMode,
-      0,
-      CoordinatesType( 0, 0, 1 ),
-      CoordinatesType( 1, 1, 0 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, true, 0, 0, 1, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 0, 0, 0 ),
+         gridPointer->getDimensions() + CoordinatesType( 0, 0, 1 ),
+         userData,
+         asynchronousMode,
+         0,
+         CoordinatesType( 0, 0, 1 ),
+         CoordinatesType( 1, 1, 0 ) );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 2 >::
-processInteriorEntities( const GridPointer& gridPointer,
-                         UserData& userData ) const
+Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 2 >::processInteriorEntities( const GridPointer& gridPointer,
+                                                                                             UserData& userData ) const
 {
    /****
     * Interior faces
     */
    static_assert( GridEntity::getEntityDimension() == 2, "The entity has wrong dimension." );
 
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 1, 0, 0 ),
-      gridPointer->getDimensions(),
-      userData,
-      asynchronousMode,
-      2,
-      CoordinatesType( 1, 0, 0 ),
-      CoordinatesType( 0, 1, 1 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 1, 0, 0 ),
+         gridPointer->getDimensions(),
+         userData,
+         asynchronousMode,
+         2,
+         CoordinatesType( 1, 0, 0 ),
+         CoordinatesType( 0, 1, 1 ) );
 
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 0, 1, 0 ),
-      gridPointer->getDimensions(),
-      userData,
-      asynchronousMode,
-      1,
-      CoordinatesType( 0, 1, 0 ),
-      CoordinatesType( 1, 0, 1 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 0, 1, 0 ),
+         gridPointer->getDimensions(),
+         userData,
+         asynchronousMode,
+         1,
+         CoordinatesType( 0, 1, 0 ),
+         CoordinatesType( 1, 0, 1 ) );
 
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 0, 0, 1 ),
-      gridPointer->getDimensions(),
-      userData,
-      asynchronousMode,
-      0,
-      CoordinatesType( 0, 0, 1 ),
-      CoordinatesType( 1, 1, 0 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 0, 0, 1 ),
+         gridPointer->getDimensions(),
+         userData,
+         asynchronousMode,
+         0,
+         CoordinatesType( 0, 0, 1 ),
+         CoordinatesType( 1, 1, 0 ) );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 2 >::
-processAllEntities( const GridPointer& gridPointer,
-                    UserData& userData ) const
+Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 2 >::processAllEntities( const GridPointer& gridPointer,
+                                                                                        UserData& userData ) const
 {
    /****
     * All faces
     */
    static_assert( GridEntity::getEntityDimension() == 2, "The entity has wrong dimension." );
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 0, 0, 0 ),
-      gridPointer->getDimensions() + CoordinatesType( 1, 0, 0 ),
-      userData,
-      asynchronousMode,
-      2,
-      CoordinatesType( 1, 0, 0 ),
-      CoordinatesType( 0, 1, 1 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 0, 0, 0 ),
+         gridPointer->getDimensions() + CoordinatesType( 1, 0, 0 ),
+         userData,
+         asynchronousMode,
+         2,
+         CoordinatesType( 1, 0, 0 ),
+         CoordinatesType( 0, 1, 1 ) );
 
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 0, 0, 0 ),
-      gridPointer->getDimensions() + CoordinatesType( 0, 1, 0 ),
-      userData,
-      asynchronousMode,
-      1,
-      CoordinatesType( 0, 1, 0 ),
-      CoordinatesType( 1, 0, 1 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 0, 0, 0 ),
+         gridPointer->getDimensions() + CoordinatesType( 0, 1, 0 ),
+         userData,
+         asynchronousMode,
+         1,
+         CoordinatesType( 0, 1, 0 ),
+         CoordinatesType( 1, 0, 1 ) );
 
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 0, 0, 0 ),
-      gridPointer->getDimensions() + CoordinatesType( 0, 0, 1 ),
-      userData,
-      asynchronousMode,
-      0,
-      CoordinatesType( 0, 0, 1 ),
-      CoordinatesType( 1, 1, 0 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 0, 0, 0 ),
+         gridPointer->getDimensions() + CoordinatesType( 0, 0, 1 ),
+         userData,
+         asynchronousMode,
+         0,
+         CoordinatesType( 0, 0, 1 ),
+         CoordinatesType( 1, 1, 0 ) );
 }
 
 /****
  * Grid 3D, edges
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 1 >::
-processBoundaryEntities( const GridPointer& gridPointer,
-                         UserData& userData ) const
+Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 1 >::processBoundaryEntities( const GridPointer& gridPointer,
+                                                                                             UserData& userData ) const
 {
    /****
     * Boundary edges
     */
    static_assert( GridEntity::getEntityDimension() == 1, "The entity has wrong dimension." );
 
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 0, 1, 1, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 0, 0, 0 ),
-      gridPointer->getDimensions() + CoordinatesType( 0, 1, 1 ),
-      userData,
-      asynchronousMode,
-      2,
-      CoordinatesType( 0, 1, 1 ),
-      CoordinatesType( 1, 0, 0 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, true, 0, 1, 1, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 0, 0, 0 ),
+         gridPointer->getDimensions() + CoordinatesType( 0, 1, 1 ),
+         userData,
+         asynchronousMode,
+         2,
+         CoordinatesType( 0, 1, 1 ),
+         CoordinatesType( 1, 0, 0 ) );
 
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 1, 0, 1, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 0, 0, 0 ),
-      gridPointer->getDimensions() + CoordinatesType( 1, 0, 1 ),
-      userData,
-      asynchronousMode,
-      1,
-      CoordinatesType( 1, 0, 1 ),
-      CoordinatesType( 0, 1, 0 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, true, 1, 0, 1, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 0, 0, 0 ),
+         gridPointer->getDimensions() + CoordinatesType( 1, 0, 1 ),
+         userData,
+         asynchronousMode,
+         1,
+         CoordinatesType( 1, 0, 1 ),
+         CoordinatesType( 0, 1, 0 ) );
 
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, true, 1, 1, 0, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 0, 0, 0 ),
-      gridPointer->getDimensions() + CoordinatesType( 1, 1, 0 ),
-      userData,
-      asynchronousMode,
-      0,
-      CoordinatesType( 1, 1, 0 ),
-      CoordinatesType( 0, 0, 1 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, true, 1, 1, 0, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 0, 0, 0 ),
+         gridPointer->getDimensions() + CoordinatesType( 1, 1, 0 ),
+         userData,
+         asynchronousMode,
+         0,
+         CoordinatesType( 1, 1, 0 ),
+         CoordinatesType( 0, 0, 1 ) );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 1 >::
-processInteriorEntities( const GridPointer& gridPointer,
-                         UserData& userData ) const
+Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 1 >::processInteriorEntities( const GridPointer& gridPointer,
+                                                                                             UserData& userData ) const
 {
    /****
     * Interior edges
     */
    static_assert( GridEntity::getEntityDimension() == 1, "The entity has wrong dimension." );
 
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 0, 1, 1 ),
-      gridPointer->getDimensions() + CoordinatesType( 1, 0, 0 ),
-      userData,
-      asynchronousMode,
-      2,
-      CoordinatesType( 0, 1, 1 ),
-      CoordinatesType( 1, 0, 0 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 0, 1, 1 ),
+         gridPointer->getDimensions() + CoordinatesType( 1, 0, 0 ),
+         userData,
+         asynchronousMode,
+         2,
+         CoordinatesType( 0, 1, 1 ),
+         CoordinatesType( 1, 0, 0 ) );
 
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 1, 0, 1 ),
-      gridPointer->getDimensions() + CoordinatesType( 0, 1, 0 ),
-      userData,
-      asynchronousMode,
-      1,
-      CoordinatesType( 1, 0, 1 ),
-      CoordinatesType( 0, 1, 0 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 1, 0, 1 ),
+         gridPointer->getDimensions() + CoordinatesType( 0, 1, 0 ),
+         userData,
+         asynchronousMode,
+         1,
+         CoordinatesType( 1, 0, 1 ),
+         CoordinatesType( 0, 1, 0 ) );
 
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 1, 1, 0 ),
-      gridPointer->getDimensions() + CoordinatesType( 0, 0, 1 ),
-      userData,
-      asynchronousMode,
-      0,
-      CoordinatesType( 1, 1, 0 ),
-      CoordinatesType( 0, 0, 1 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 1, 1, 0 ),
+         gridPointer->getDimensions() + CoordinatesType( 0, 0, 1 ),
+         userData,
+         asynchronousMode,
+         0,
+         CoordinatesType( 1, 1, 0 ),
+         CoordinatesType( 0, 0, 1 ) );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 1 >::
-processAllEntities( const GridPointer& gridPointer,
-                    UserData& userData ) const
+Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 1 >::processAllEntities( const GridPointer& gridPointer,
+                                                                                        UserData& userData ) const
 {
    /****
     * All edges
     */
    static_assert( GridEntity::getEntityDimension() == 1, "The entity has wrong dimension." );
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 0, 0, 0 ),
-      gridPointer->getDimensions() + CoordinatesType( 0, 1, 1 ),
-      userData,
-      asynchronousMode,
-      2,
-      CoordinatesType( 0, 1, 1 ),
-      CoordinatesType( 1, 0, 0 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 0, 0, 0 ),
+         gridPointer->getDimensions() + CoordinatesType( 0, 1, 1 ),
+         userData,
+         asynchronousMode,
+         2,
+         CoordinatesType( 0, 1, 1 ),
+         CoordinatesType( 1, 0, 0 ) );
 
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 0, 0, 0 ),
-      gridPointer->getDimensions() + CoordinatesType( 1, 0, 1 ),
-      userData,
-      asynchronousMode,
-      1,
-      CoordinatesType( 1, 0, 1 ),
-      CoordinatesType( 0, 1, 0 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 0, 0, 0 ),
+         gridPointer->getDimensions() + CoordinatesType( 1, 0, 1 ),
+         userData,
+         asynchronousMode,
+         1,
+         CoordinatesType( 1, 0, 1 ),
+         CoordinatesType( 0, 1, 0 ) );
 
-   GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
-      gridPointer,
-      CoordinatesType( 0, 0, 0 ),
-      gridPointer->getDimensions() + CoordinatesType( 1, 1, 0 ),
-      userData,
-      asynchronousMode,
-      0,
-      CoordinatesType( 1, 1, 0 ),
-      CoordinatesType( 0, 0, 1 ) );
+   GridTraverser< GridType >::
+      template processEntities< GridEntity, EntitiesProcessor, UserData, false, 1, 1, 1, CoordinatesType, CoordinatesType >(
+         gridPointer,
+         CoordinatesType( 0, 0, 0 ),
+         gridPointer->getDimensions() + CoordinatesType( 1, 1, 0 ),
+         userData,
+         asynchronousMode,
+         0,
+         CoordinatesType( 1, 1, 0 ),
+         CoordinatesType( 0, 0, 1 ) );
 }
 
 /****
  * Grid 3D, vertices
  */
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 0 >::
-processBoundaryEntities( const GridPointer& gridPointer,
-                         UserData& userData ) const
+Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 0 >::processBoundaryEntities( const GridPointer& gridPointer,
+                                                                                             UserData& userData ) const
 {
    /****
     * Boundary vertices
@@ -459,16 +402,11 @@ processBoundaryEntities( const GridPointer& gridPointer,
       0 );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 0 >::
-processInteriorEntities( const GridPointer& gridPointer,
-                         UserData& userData ) const
+Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 0 >::processInteriorEntities( const GridPointer& gridPointer,
+                                                                                             UserData& userData ) const
 {
    /****
     * Interior vertices
@@ -476,24 +414,14 @@ processInteriorEntities( const GridPointer& gridPointer,
    static_assert( GridEntity::getEntityDimension() == 0, "The entity has wrong dimension." );
 
    GridTraverser< GridType >::template processEntities< GridEntity, EntitiesProcessor, UserData, false >(
-      gridPointer,
-      CoordinatesType( 1, 1, 1 ),
-      gridPointer->getDimensions(),
-      userData,
-      asynchronousMode,
-      0 );
+      gridPointer, CoordinatesType( 1, 1, 1 ), gridPointer->getDimensions(), userData, asynchronousMode, 0 );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename GridEntity >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Real, typename Device, typename Index, typename GridEntity >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 0 >::
-processAllEntities( const GridPointer& gridPointer,
-                    UserData& userData ) const
+Traverser< Meshes::Grid< 3, Real, Device, Index >, GridEntity, 0 >::processAllEntities( const GridPointer& gridPointer,
+                                                                                        UserData& userData ) const
 {
    /****
     * All vertices
@@ -509,5 +437,5 @@ processAllEntities( const GridPointer& gridPointer,
       0 );
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/GridEntity.h b/src/TNL/Meshes/GridEntity.h
index 64ff7156c806de72168724536807c987b672265f..a7c863db5445a2b162445fbf5a0ddd975ece88ae 100644
--- a/src/TNL/Meshes/GridEntity.h
+++ b/src/TNL/Meshes/GridEntity.h
@@ -12,9 +12,7 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename GridEntity,
-          int NeighborEntityDimension,
-          typename StencilStorage >
+template< typename GridEntity, int NeighborEntityDimension, typename StencilStorage >
 class NeighborGridEntityGetter;
 
 template< typename GridEntityType >
@@ -23,369 +21,400 @@ class BoundaryGridEntityChecker;
 template< typename GridEntityType >
 class GridEntityCenterGetter;
 
-
-template< typename Grid,
-          int EntityDimension,
-          typename Config >
+template< typename Grid, int EntityDimension, typename Config >
 class GridEntity
-{
-};
+{};
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          int EntityDimension,
-          typename Config >
+template< int Dimension, typename Real, typename Device, typename Index, int EntityDimension, typename Config >
 class GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >
 {
-   public:
-
-      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;
-
-      constexpr static int getMeshDimension() { return GridType::getMeshDimension(); };
-
-      constexpr static int getEntityDimension() { return EntityDimension; };
-
-      typedef Containers::StaticVector< getMeshDimension(), IndexType > EntityOrientationType;
-      typedef Containers::StaticVector< getMeshDimension(), IndexType > EntityBasisType;
-      typedef typename GridType::PointType PointType;
-
-      typedef NeighborGridEntitiesStorage< GridEntity, Config > NeighborGridEntitiesStorageType;
+public:
+   using GridType = Meshes::Grid< Dimension, Real, Device, Index >;
+   using MeshType = GridType;
+   using RealType = typename GridType::RealType;
+   using IndexType = typename GridType::IndexType;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using ConfigType = Config;
+
+   constexpr static int
+   getMeshDimension()
+   {
+      return GridType::getMeshDimension();
+   };
+
+   constexpr static int
+   getEntityDimension()
+   {
+      return EntityDimension;
+   };
+
+   using EntityOrientationType = Containers::StaticVector< getMeshDimension(), IndexType >;
+   using EntityBasisType = Containers::StaticVector< getMeshDimension(), IndexType >;
+   using PointType = typename GridType::PointType;
 
-      template< int NeighborEntityDimension = getEntityDimension() >
-      using NeighborEntities =
-         NeighborGridEntityGetter<
-            GridEntity< Meshes::Grid< Dimension, Real, Device, Index >,
-                           EntityDimension,
-                           Config >,
-            NeighborEntityDimension >;
+   using NeighborGridEntitiesStorageType = NeighborGridEntitiesStorage< GridEntity, Config >;
 
-      __cuda_callable__ inline
-      GridEntity( const GridType& grid );
+   template< int NeighborEntityDimension = getEntityDimension() >
+   using NeighborEntities =
+      NeighborGridEntityGetter< GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, EntityDimension, Config >,
+                                NeighborEntityDimension >;
 
-      __cuda_callable__ inline
-      GridEntity( const GridType& grid,
-                     const CoordinatesType& coordinates,
-                     const EntityOrientationType& orientation,
-                     const EntityBasisType& basis );
+   __cuda_callable__
+   inline GridEntity( const GridType& grid );
 
-      __cuda_callable__ inline
-      const CoordinatesType& getCoordinates() const;
+   __cuda_callable__
+   inline GridEntity( const GridType& grid,
+                      const CoordinatesType& coordinates,
+                      const EntityOrientationType& orientation,
+                      const EntityBasisType& basis );
 
-      __cuda_callable__ inline
-      CoordinatesType& getCoordinates();
+   __cuda_callable__
+   inline const CoordinatesType&
+   getCoordinates() const;
 
-      __cuda_callable__ inline
-      void setCoordinates( const CoordinatesType& coordinates );
+   __cuda_callable__
+   inline CoordinatesType&
+   getCoordinates();
 
-      /***
-       * Call this method every time the coordinates are changed
-       * to recompute the mesh entity index. The reason for this strange
-       * mechanism is a performance.
-       */
-      __cuda_callable__ inline
-      //void setIndex( IndexType entityIndex );
-      void refresh();
+   __cuda_callable__
+   inline void
+   setCoordinates( const CoordinatesType& coordinates );
 
-      __cuda_callable__ inline
-      Index getIndex() const;
+   /***
+    * Call this method every time the coordinates are changed
+    * to recompute the mesh entity index. The reason for this strange
+    * mechanism is a performance.
+    */
+   __cuda_callable__
+   inline
+      // void setIndex( IndexType entityIndex );
+      void
+      refresh();
 
-      __cuda_callable__ inline
-      const EntityOrientationType& getOrientation() const;
+   __cuda_callable__
+   inline Index
+   getIndex() const;
 
-      __cuda_callable__ inline
-      void setOrientation( const EntityOrientationType& orientation );
+   __cuda_callable__
+   inline const EntityOrientationType&
+   getOrientation() const;
 
-      __cuda_callable__ inline
-      const EntityBasisType& getBasis() const;
+   __cuda_callable__
+   inline void
+   setOrientation( const EntityOrientationType& orientation );
 
-      __cuda_callable__ inline
-      void setBasis( const EntityBasisType& basis );
+   __cuda_callable__
+   inline const EntityBasisType&
+   getBasis() const;
 
-      template< int NeighborEntityDimension = getEntityDimension() >
-      __cuda_callable__ inline
-      const NeighborEntities< NeighborEntityDimension >&
-      getNeighborEntities() const;
+   __cuda_callable__
+   inline void
+   setBasis( const EntityBasisType& basis );
 
-      __cuda_callable__ inline
-      bool isBoundaryEntity() const;
+   template< int NeighborEntityDimension = getEntityDimension() >
+   __cuda_callable__
+   inline const NeighborEntities< NeighborEntityDimension >&
+   getNeighborEntities() const;
 
-      __cuda_callable__ inline
-      PointType getCenter() const;
+   __cuda_callable__
+   inline bool
+   isBoundaryEntity() const;
 
-      __cuda_callable__ inline
-      const RealType& getMeasure() const;
+   __cuda_callable__
+   inline PointType
+   getCenter() const;
 
-      __cuda_callable__ inline
-      const GridType& getMesh() const;
+   __cuda_callable__
+   inline const RealType&
+   getMeasure() const;
 
-   protected:
+   __cuda_callable__
+   inline const GridType&
+   getMesh() const;
 
-      const GridType& grid;
+protected:
+   const GridType& grid;
 
-      IndexType entityIndex;
+   IndexType entityIndex;
 
-      CoordinatesType coordinates;
+   CoordinatesType coordinates;
 
-      EntityOrientationType orientation;
+   EntityOrientationType orientation;
 
-      EntityBasisType basis;
+   EntityBasisType basis;
 
-      NeighborGridEntitiesStorageType neighborEntitiesStorage;
+   NeighborGridEntitiesStorageType neighborEntitiesStorage;
 
-      //__cuda_callable__ inline
-      //GridEntity();
+   //__cuda_callable__ inline
+   // GridEntity();
 
-      friend class BoundaryGridEntityChecker< GridEntity >;
+   friend class BoundaryGridEntityChecker< GridEntity >;
 
-      friend class GridEntityCenterGetter< GridEntity >;
+   friend class GridEntityCenterGetter< GridEntity >;
 };
 
 /****
  * Specializations for cells
  */
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
 class GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >
 {
-   public:
-
-      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::PointType PointType;
-      typedef Config ConfigType;
-
-      constexpr static int getMeshDimension() { return GridType::getMeshDimension(); };
-
-      constexpr static int getEntityDimension() { return getMeshDimension(); };
-
-
-      typedef Containers::StaticVector< getMeshDimension(), IndexType > EntityOrientationType;
-      typedef Containers::StaticVector< getMeshDimension(), IndexType > EntityBasisType;
-      typedef NeighborGridEntitiesStorage< GridEntity, Config > NeighborGridEntitiesStorageType;
-
-      template< int NeighborEntityDimension = getEntityDimension() >
-      using NeighborEntities =
-         NeighborGridEntityGetter<
-            GridEntity< Meshes::Grid< Dimension, Real, Device, Index >,
-                           Dimension,
-                           Config >,
-            NeighborEntityDimension >;
-
-
-      __cuda_callable__ inline
-      GridEntity( const GridType& grid );
-
-      __cuda_callable__ inline
-      GridEntity( const GridType& grid,
-                  const CoordinatesType& coordinates,
-                  const EntityOrientationType& orientation = EntityOrientationType( ( Index ) 0 ),
-                  const EntityBasisType& basis = EntityBasisType( ( Index ) 1 ) );
-
-      __cuda_callable__ inline
-      const CoordinatesType& getCoordinates() const;
-
-      __cuda_callable__ inline
-      CoordinatesType& getCoordinates();
-
-      __cuda_callable__ inline
-      void setCoordinates( const CoordinatesType& coordinates );
-
-      /***
-       * Call this method every time the coordinates are changed
-       * to recompute the mesh entity index. The reason for this strange
-       * mechanism is a performance.
-       */
-      __cuda_callable__ inline
-      //void setIndex( IndexType entityIndex );
-      void refresh();
-
-      __cuda_callable__ inline
-      Index getIndex() const;
-
-      __cuda_callable__ inline
-      const EntityOrientationType getOrientation() const;
-
-      __cuda_callable__ inline
-      void setOrientation( const EntityOrientationType& orientation ){};
-
-      __cuda_callable__ inline
-      const EntityBasisType getBasis() const;
-
-      __cuda_callable__ inline
-      void setBasis( const EntityBasisType& basis ){};
-
-      template< int NeighborEntityDimension = Dimension >
-      __cuda_callable__ inline
-      const NeighborEntities< NeighborEntityDimension >&
-      getNeighborEntities() const;
-
-      __cuda_callable__ inline
-      bool isBoundaryEntity() const;
-
-      __cuda_callable__ inline
-      PointType getCenter() const;
-
-      __cuda_callable__ inline
-      const RealType& getMeasure() const;
-
-      __cuda_callable__ inline
-      const PointType& getEntityProportions() const;
-
-      __cuda_callable__ inline
-      const GridType& getMesh() const;
+public:
+   using GridType = Meshes::Grid< Dimension, Real, Device, Index >;
+   using MeshType = GridType;
+   using RealType = typename GridType::RealType;
+   using IndexType = typename GridType::IndexType;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using PointType = typename GridType::PointType;
+   using ConfigType = Config;
+
+   constexpr static int
+   getMeshDimension()
+   {
+      return GridType::getMeshDimension();
+   };
+
+   constexpr static int
+   getEntityDimension()
+   {
+      return getMeshDimension();
+   };
+
+   using EntityOrientationType = Containers::StaticVector< getMeshDimension(), IndexType >;
+   using EntityBasisType = Containers::StaticVector< getMeshDimension(), IndexType >;
+   using NeighborGridEntitiesStorageType = NeighborGridEntitiesStorage< GridEntity, Config >;
+
+   template< int NeighborEntityDimension = getEntityDimension() >
+   using NeighborEntities =
+      NeighborGridEntityGetter< GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, Dimension, Config >,
+                                NeighborEntityDimension >;
+
+   __cuda_callable__
+   inline GridEntity( const GridType& grid );
+
+   __cuda_callable__
+   inline GridEntity( const GridType& grid,
+                      const CoordinatesType& coordinates,
+                      const EntityOrientationType& orientation = EntityOrientationType( (Index) 0 ),
+                      const EntityBasisType& basis = EntityBasisType( (Index) 1 ) );
+
+   __cuda_callable__
+   inline const CoordinatesType&
+   getCoordinates() const;
+
+   __cuda_callable__
+   inline CoordinatesType&
+   getCoordinates();
+
+   __cuda_callable__
+   inline void
+   setCoordinates( const CoordinatesType& coordinates );
+
+   /***
+    * Call this method every time the coordinates are changed
+    * to recompute the mesh entity index. The reason for this strange
+    * mechanism is a performance.
+    */
+   __cuda_callable__
+   inline
+      // void setIndex( IndexType entityIndex );
+      void
+      refresh();
+
+   __cuda_callable__
+   inline Index
+   getIndex() const;
+
+   __cuda_callable__
+   inline const EntityOrientationType
+   getOrientation() const;
+
+   __cuda_callable__
+   inline void
+   setOrientation( const EntityOrientationType& orientation ){};
+
+   __cuda_callable__
+   inline const EntityBasisType
+   getBasis() const;
+
+   __cuda_callable__
+   inline void
+   setBasis( const EntityBasisType& basis ){};
+
+   template< int NeighborEntityDimension = Dimension >
+   __cuda_callable__
+   inline const NeighborEntities< NeighborEntityDimension >&
+   getNeighborEntities() const;
+
+   __cuda_callable__
+   inline bool
+   isBoundaryEntity() const;
+
+   __cuda_callable__
+   inline PointType
+   getCenter() const;
+
+   __cuda_callable__
+   inline const RealType&
+   getMeasure() const;
+
+   __cuda_callable__
+   inline const PointType&
+   getEntityProportions() const;
+
+   __cuda_callable__
+   inline const GridType&
+   getMesh() const;
+
+protected:
+   const GridType& grid;
+
+   IndexType entityIndex;
 
-   protected:
+   CoordinatesType coordinates;
 
-      const GridType& grid;
+   NeighborGridEntitiesStorageType neighborEntitiesStorage;
 
-      IndexType entityIndex;
+   //__cuda_callable__ inline
+   // GridEntity();
 
-      CoordinatesType coordinates;
+   friend class BoundaryGridEntityChecker< GridEntity >;
 
-      NeighborGridEntitiesStorageType neighborEntitiesStorage;
-
-      //__cuda_callable__ inline
-      //GridEntity();
-
-      friend class BoundaryGridEntityChecker< GridEntity >;
-
-      friend class GridEntityCenterGetter< GridEntity >;
+   friend class GridEntityCenterGetter< GridEntity >;
 };
 
 /****
  * Specialization for vertices
  */
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename Config >
+template< int Dimension, typename Real, typename Device, typename Index, typename Config >
 class GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >
 {
-   public:
-
-      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::PointType PointType;
-      typedef Config ConfigType;
-
-      constexpr static int getMeshDimension() { return GridType::getMeshDimension(); };
-
-      constexpr static int getEntityDimension() { return 0; };
-
-      typedef Containers::StaticVector< getMeshDimension(), IndexType > EntityOrientationType;
-      typedef Containers::StaticVector< getMeshDimension(), IndexType > EntityBasisType;
-      typedef NeighborGridEntitiesStorage< GridEntity, Config > NeighborGridEntitiesStorageType;
-
-      template< int NeighborEntityDimension = getEntityDimension() >
-      using NeighborEntities =
-         NeighborGridEntityGetter<
-            GridEntity< Meshes::Grid< Dimension, Real, Device, Index >,
-                           0,
-                           Config >,
-            NeighborEntityDimension >;
-
-
-      __cuda_callable__ inline
-      GridEntity( const GridType& grid );
-
-      __cuda_callable__ inline
-      GridEntity( const GridType& grid,
-                     const CoordinatesType& coordinates,
-                     const EntityOrientationType& orientation = EntityOrientationType( ( Index ) 0 ),
-                     const EntityBasisType& basis = EntityOrientationType( ( Index ) 0 ) );
-
-      __cuda_callable__ inline
-      const CoordinatesType& getCoordinates() const;
-
-      __cuda_callable__ inline
-      CoordinatesType& getCoordinates();
-
-      __cuda_callable__ inline
-      void setCoordinates( const CoordinatesType& coordinates );
-
-      /***
-       * Call this method every time the coordinates are changed
-       * to recompute the mesh entity index. The reason for this strange
-       * mechanism is a performance.
-       */
-      __cuda_callable__ inline
-      //void setIndex( IndexType entityIndex );
-      void refresh();
-
-      __cuda_callable__ inline
-      Index getIndex() const;
+public:
+   using GridType = Meshes::Grid< Dimension, Real, Device, Index >;
+   using MeshType = GridType;
+   using RealType = typename GridType::RealType;
+   using IndexType = typename GridType::IndexType;
+   using CoordinatesType = typename GridType::CoordinatesType;
+   using PointType = typename GridType::PointType;
+   using ConfigType = Config;
+
+   constexpr static int
+   getMeshDimension()
+   {
+      return GridType::getMeshDimension();
+   };
+
+   constexpr static int
+   getEntityDimension()
+   {
+      return 0;
+   };
+
+   using EntityOrientationType = Containers::StaticVector< getMeshDimension(), IndexType >;
+   using EntityBasisType = Containers::StaticVector< getMeshDimension(), IndexType >;
+   using NeighborGridEntitiesStorageType = NeighborGridEntitiesStorage< GridEntity, Config >;
+
+   template< int NeighborEntityDimension = getEntityDimension() >
+   using NeighborEntities = NeighborGridEntityGetter< GridEntity< Meshes::Grid< Dimension, Real, Device, Index >, 0, Config >,
+                                                      NeighborEntityDimension >;
+
+   __cuda_callable__
+   inline GridEntity( const GridType& grid );
+
+   __cuda_callable__
+   inline GridEntity( const GridType& grid,
+                      const CoordinatesType& coordinates,
+                      const EntityOrientationType& orientation = EntityOrientationType( (Index) 0 ),
+                      const EntityBasisType& basis = EntityOrientationType( (Index) 0 ) );
+
+   __cuda_callable__
+   inline const CoordinatesType&
+   getCoordinates() const;
+
+   __cuda_callable__
+   inline CoordinatesType&
+   getCoordinates();
+
+   __cuda_callable__
+   inline void
+   setCoordinates( const CoordinatesType& coordinates );
+
+   /***
+    * Call this method every time the coordinates are changed
+    * to recompute the mesh entity index. The reason for this strange
+    * mechanism is a performance.
+    */
+   __cuda_callable__
+   inline
+      // void setIndex( IndexType entityIndex );
+      void
+      refresh();
+
+   __cuda_callable__
+   inline Index
+   getIndex() const;
+
+   __cuda_callable__
+   inline const EntityOrientationType
+   getOrientation() const;
+
+   __cuda_callable__
+   inline void
+   setOrientation( const EntityOrientationType& orientation ){};
+
+   __cuda_callable__
+   inline const EntityBasisType
+   getBasis() const;
+
+   __cuda_callable__
+   inline void
+   setBasis( const EntityBasisType& basis ){};
+
+   template< int NeighborEntityDimension = getEntityDimension() >
+   __cuda_callable__
+   inline const NeighborEntities< NeighborEntityDimension >&
+   getNeighborEntities() const;
+
+   __cuda_callable__
+   inline bool
+   isBoundaryEntity() const;
+
+   __cuda_callable__
+   inline PointType
+   getCenter() const;
+
+   // compatibility with meshes, equivalent to getCenter
+   __cuda_callable__
+   inline PointType
+   getPoint() const;
+
+   __cuda_callable__
+   inline const RealType
+   getMeasure() const;
+
+   __cuda_callable__
+   inline PointType
+   getEntityProportions() const;
+
+   __cuda_callable__
+   inline const GridType&
+   getMesh() const;
+
+protected:
+   const GridType& grid;
 
-      __cuda_callable__ inline
-      const EntityOrientationType getOrientation() const;
+   IndexType entityIndex;
+
+   CoordinatesType coordinates;
 
-      __cuda_callable__ inline
-      void setOrientation( const EntityOrientationType& orientation ){};
+   NeighborGridEntitiesStorageType neighborEntitiesStorage;
 
-      __cuda_callable__ inline
-      const EntityBasisType getBasis() const;
+   friend class BoundaryGridEntityChecker< GridEntity >;
 
-      __cuda_callable__ inline
-      void setBasis( const EntityBasisType& basis ){};
-
-
-      template< int NeighborEntityDimension = getEntityDimension() >
-      __cuda_callable__ inline
-      const NeighborEntities< NeighborEntityDimension >&
-      getNeighborEntities() const;
-
-      __cuda_callable__ inline
-      bool isBoundaryEntity() const;
-
-      __cuda_callable__ inline
-      PointType getCenter() const;
-
-      // compatibility with meshes, equivalent to getCenter
-      __cuda_callable__ inline
-      PointType getPoint() const;
-
-      __cuda_callable__ inline
-      const RealType getMeasure() const;
-
-      __cuda_callable__ inline
-      PointType getEntityProportions() const;
-
-      __cuda_callable__ inline
-      const GridType& getMesh() const;
-
-   protected:
-
-      const GridType& grid;
-
-      IndexType entityIndex;
-
-      CoordinatesType coordinates;
-
-      NeighborGridEntitiesStorageType neighborEntitiesStorage;
-
-      friend class BoundaryGridEntityChecker< GridEntity >;
-
-      friend class GridEntityCenterGetter< GridEntity >;
+   friend class GridEntityCenterGetter< GridEntity >;
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/GridDetails/GridEntity_impl.h>
-
diff --git a/src/TNL/Meshes/GridEntityConfig.h b/src/TNL/Meshes/GridEntityConfig.h
index 512f0b64d492afe810715e42a3c1bbc39774699c..ba08dffb6a16580c9504026bf204702db98fa763 100644
--- a/src/TNL/Meshes/GridEntityConfig.h
+++ b/src/TNL/Meshes/GridEntityConfig.h
@@ -10,7 +10,7 @@ namespace TNL {
 namespace Meshes {
 
 enum GridEntityStencilStorage
-{ 
+{
    GridEntityNoStencil = 0,
    GridEntityCrossStencil,
    GridEntityFullStencil
@@ -19,9 +19,8 @@ enum GridEntityStencilStorage
 template< int storage >
 class GridEntityStencilStorageTag
 {
-   public:
- 
-      static constexpr int stencilStorage = storage;
+public:
+   static constexpr int stencilStorage = storage;
 };
 
 /****
@@ -46,37 +45,39 @@ class GridEntityStencilStorageTag
 
 class GridEntityNoStencilStorage
 {
-   public:
- 
-      template< typename GridEntity >
-      constexpr static bool neighborEntityStorage( int neighborEntityStorage )
-      {
-         return false;
-      }
- 
-      constexpr static int getStencilSize()
-      {
-         return 0;
-      }
+public:
+   template< typename GridEntity >
+   constexpr static bool
+   neighborEntityStorage( int neighborEntityStorage )
+   {
+      return false;
+   }
+
+   constexpr static int
+   getStencilSize()
+   {
+      return 0;
+   }
 };
 
 template< int stencilSize = 1 >
 class GridEntityCrossStencilStorage
 {
-   public:
- 
-      template< typename GridEntity >
-      constexpr static bool neighborEntityStorage( const int neighborEntityDimension )
-      {
-         return ( GridEntity::getEntityDimension() == GridEntity::GridType::getMeshDimension() &&
-                  neighborEntityDimension == GridEntity::GridType::getMeshDimension() );
-      }
- 
-      constexpr static int getStencilSize()
-      {
-         return stencilSize;
-      }
+public:
+   template< typename GridEntity >
+   constexpr static bool
+   neighborEntityStorage( const int neighborEntityDimension )
+   {
+      return ( GridEntity::getEntityDimension() == GridEntity::GridType::getMeshDimension()
+               && neighborEntityDimension == GridEntity::GridType::getMeshDimension() );
+   }
+
+   constexpr static int
+   getStencilSize()
+   {
+      return stencilSize;
+   }
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Mesh.h b/src/TNL/Meshes/Mesh.h
index c8ebd533808d74b202f05e228be5dac8dbc1e2d6..bb6c08a5676d3c030a70b4dbcd28be9a73440c56 100644
--- a/src/TNL/Meshes/Mesh.h
+++ b/src/TNL/Meshes/Mesh.h
@@ -28,270 +28,293 @@ namespace TNL {
  */
 namespace Meshes {
 
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology_ >
+template< typename MeshConfig, typename Device, typename EntityTopology_ >
 class MeshEntity;
 
-template< typename MeshConfig > class Initializer;
-template< typename Mesh > class EntityStorageRebinder;
-template< typename Mesh, int Dimension > struct IndexPermutationApplier;
-
+template< typename MeshConfig >
+class Initializer;
+template< typename Mesh >
+class EntityStorageRebinder;
+template< typename Mesh, int Dimension >
+struct IndexPermutationApplier;
 
 template< typename MeshConfig, typename Device, typename MeshType >
 class MeshInitializableBase
 {
-   public:
-      using MeshTraitsType = MeshTraits< MeshConfig, Device >;
-
-      // The points and cellSeeds arrays will be reset when not needed to save memory.
-      void init( typename MeshTraitsType::PointArrayType& points,
-                 typename MeshTraitsType::FaceSeedMatrixType& faceSeeds,
-                 typename MeshTraitsType::CellSeedMatrixType& cellSeeds );
+public:
+   using MeshTraitsType = MeshTraits< MeshConfig, Device >;
+
+   // The points and cellSeeds arrays will be reset when not needed to save memory.
+   void
+   init( typename MeshTraitsType::PointArrayType& points,
+         typename MeshTraitsType::FaceSeedMatrixType& faceSeeds,
+         typename MeshTraitsType::CellSeedMatrixType& cellSeeds );
 };
 
 // The mesh cannot be initialized on CUDA GPU, so this specialization is empty.
 template< typename MeshConfig, typename MeshType >
 class MeshInitializableBase< MeshConfig, Devices::Cuda, MeshType >
-{
-};
-
+{};
 
-template< typename MeshConfig,
-          typename Device = Devices::Host >
-class Mesh
-   : public ConfigValidator< MeshConfig >,
-     public MeshInitializableBase< MeshConfig, Device, Mesh< MeshConfig, Device > >,
-     public StorageLayerFamily< MeshConfig, Device >,
-     public EntityTags::LayerFamily< MeshConfig, Device, Mesh< MeshConfig, Device > >
+template< typename MeshConfig, typename Device = Devices::Host >
+class Mesh : public ConfigValidator< MeshConfig >,
+             public MeshInitializableBase< MeshConfig, Device, Mesh< MeshConfig, Device > >,
+             public StorageLayerFamily< MeshConfig, Device >,
+             public EntityTags::LayerFamily< MeshConfig, Device, Mesh< MeshConfig, Device > >
 {
-      using StorageBaseType = StorageLayerFamily< MeshConfig, Device >;
-      using EntityTagsLayerFamily = EntityTags::LayerFamily< MeshConfig, Device, Mesh >;
-
-   public:
-      using Config          = MeshConfig;
-      using MeshTraitsType  = MeshTraits< MeshConfig, Device >;
-      using DeviceType      = typename MeshTraitsType::DeviceType;
-      using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
-      using LocalIndexType  = typename MeshTraitsType::LocalIndexType;
-      using PointType       = typename MeshTraitsType::PointType;
-      using RealType        = typename PointType::RealType;
-      using GlobalIndexArray = Containers::Array< GlobalIndexType, DeviceType, GlobalIndexType >;
-
-      template< int Dimension >
-      using EntityTraits = typename MeshTraitsType::template EntityTraits< Dimension >;
-
-      template< int Dimension >
-      using EntityType = typename EntityTraits< Dimension >::EntityType;
-
-      // constructors
-      Mesh() = default;
-
-      Mesh( const Mesh& mesh ) = default;
-
-      Mesh( Mesh&& mesh ) = default;
-
-      template< typename Device_ >
-      Mesh( const Mesh< MeshConfig, Device_ >& mesh );
-
-      Mesh& operator=( const Mesh& mesh ) = default;
-
-      Mesh& operator=( Mesh&& mesh ) = default;
-
-      template< typename Device_ >
-      Mesh& operator=( const Mesh< MeshConfig, Device_ >& mesh );
-
-
-      static constexpr int getMeshDimension();
-
-      // types of common entities
-      using Cell = EntityType< getMeshDimension() >;
-      using Face = EntityType< getMeshDimension() - 1 >;
-      using Vertex = EntityType< 0 >;
-
-      /**
-       * \brief Returns the count of mesh entities of the given dimension.
-       */
-      template< int Dimension >
-      __cuda_callable__
-      GlobalIndexType getEntitiesCount() const;
-
-      /**
-       * \brief Returns the mesh entity of the given dimension and index.
-       *
-       * Note that objects representing mesh entities are not stored in the mesh,
-       * but created on demand. Since the \ref MeshEntity contains just a pointer
-       * to the mesh and the supplied entity index, the creation should be fast.
-       */
-      template< int Dimension >
-      __cuda_callable__
-      EntityType< Dimension > getEntity( const GlobalIndexType entityIndex ) const;
-
-      template< int Dimension >
-      void setEntitiesCount( const typename MeshTraitsType::GlobalIndexType& entitiesCount );
-
-      // duplicated for compatibility with grids
-      template< typename EntityType >
-      __cuda_callable__
-      GlobalIndexType getEntitiesCount() const;
-
-      template< typename EntityType >
-      __cuda_callable__
-      EntityType getEntity( const GlobalIndexType entityIndex ) const;
-
-      /**
-       * \brief Returns the spatial coordinates of the vertex with given index.
-       */
-      const typename MeshTraitsType::PointArrayType& getPoints() const;
-
-      typename MeshTraitsType::PointArrayType& getPoints();
-
-      __cuda_callable__
-      const PointType& getPoint( const GlobalIndexType vertexIndex ) const;
-
-      /**
-       * \brief Returns the spatial coordinates of the vertex with given index.
-       */
-      __cuda_callable__
-      PointType& getPoint( const GlobalIndexType vertexIndex );
-
-      /**
-       * \brief Returns the count of subentities of the entity with given index.
-       */
-      template< int EntityDimension, int SubentityDimension >
-      __cuda_callable__
-      constexpr LocalIndexType getSubentitiesCount( const GlobalIndexType entityIndex ) const;
-
-      /**
-       * \brief Returns the global index of the subentity specified by its local index.
-       */
-      template< int EntityDimension, int SubentityDimension >
-      __cuda_callable__
-      GlobalIndexType getSubentityIndex( const GlobalIndexType entityIndex, const LocalIndexType subentityIndex ) const;
-
-      /**
-       * \brief Returns the count of superentities of the entity with given index.
-       */
-      template< int EntityDimension, int SuperentityDimension >
-      __cuda_callable__
-      LocalIndexType getSuperentitiesCount( const GlobalIndexType entityIndex ) const;
-
-      /**
-       * \brief Returns the global index of the superentity specified by its local index.
-       */
-      template< int EntityDimension, int SuperentityDimension >
-      __cuda_callable__
-      GlobalIndexType getSuperentityIndex( const GlobalIndexType entityIndex, const LocalIndexType superentityIndex ) const;
-
-      /**
-       * \brief Returns the count of neighbor cells of the cell with given index,
-       * based on the information stored in the dual graph.
-       */
-      __cuda_callable__
-      LocalIndexType getCellNeighborsCount( const GlobalIndexType cellIndex ) const;
-
-      /**
-       * \brief Returns the global index of the cell's specific neighbor cell wigh given local index,
-       * based on the information stored in the dual graph.
-       */
-      __cuda_callable__
-      GlobalIndexType getCellNeighborIndex( const GlobalIndexType cellIndex, const LocalIndexType neighborIndex ) const;
-
-
-      /**
-       * \brief Execute function \e f in parallel for all mesh entities with dimension \e EntityDimension.
-       *
-       * The function \e f is executed as `f(i)`, where `GlobalIndexType i` is the global index of the
-       * mesh entity to be processed. The mesh itself is not passed to the function `f`, it is the user's
-       * responsibility to ensure proper access to the mesh if needed, e.g. by the means of lambda capture
-       * and/or using a \ref TNL::Pointers::SharedPointer "SharedPointer".
-       */
-      template< int EntityDimension, typename Device2 = DeviceType, typename Func >
-      void forAll( Func f ) const;
-
-      /**
-       * \brief Execute function \e f in parallel for all boundary mesh entities with dimension \e EntityDimension.
-       *
-       * The function \e f is executed as `f(i)`, where `GlobalIndexType i` is the global index of the
-       * mesh entity to be processed. The mesh itself is not passed to the function `f`, it is the user's
-       * responsibility to ensure proper access to the mesh if needed, e.g. by the means of lambda capture
-       * and/or using a \ref TNL::Pointers::SharedPointer "SharedPointer".
-       */
-      template< int EntityDimension, typename Device2 = DeviceType, typename Func >
-      void forBoundary( Func f ) const;
-
-      /**
-       * \brief Execute function \e f in parallel for all interior mesh entities with dimension \e EntityDimension.
-       *
-       * The function \e f is executed as `f(i)`, where `GlobalIndexType i` is the global index of the
-       * mesh entity to be processed. The mesh itself is not passed to the function `f`, it is the user's
-       * responsibility to ensure proper access to the mesh if needed, e.g. by the means of lambda capture
-       * and/or using a \ref TNL::Pointers::SharedPointer "SharedPointer".
-       */
-      template< int EntityDimension, typename Device2 = DeviceType, typename Func >
-      void forInterior( Func f ) const;
-
-      /**
-       * \brief Execute function \e f in parallel for all local mesh entities with dimension \e EntityDimension.
-       *
-       * The function \e f is executed as `f(i)`, where `GlobalIndexType i` is the global index of the
-       * mesh entity to be processed. The mesh itself is not passed to the function `f`, it is the user's
-       * responsibility to ensure proper access to the mesh if needed, e.g. by the means of lambda capture
-       * and/or using a \ref TNL::Pointers::SharedPointer "SharedPointer".
-       */
-      template< int EntityDimension, typename Device2 = DeviceType, typename Func >
-      void forLocal( Func f ) const;
-
-      /**
-       * \brief Execute function \e f in parallel for all ghost mesh entities with dimension \e EntityDimension.
-       *
-       * The function \e f is executed as `f(i)`, where `GlobalIndexType i` is the global index of the
-       * mesh entity to be processed. The mesh itself is not passed to the function `f`, it is the user's
-       * responsibility to ensure proper access to the mesh if needed, e.g. by the means of lambda capture
-       * and/or using a \ref TNL::Pointers::SharedPointer "SharedPointer".
-       */
-      template< int EntityDimension, typename Device2 = DeviceType, typename Func >
-      void forGhost( Func f ) const;
-
-
-      /**
-       * \brief Reorders the entities of the given dimension.
-       *
-       * The permutations follow the definition used in the Metis library: Let M
-       * be the original mesh and M' the permuted mesh. Then entity with index i
-       * in M' is the entity with index perm[i] in M and entity with index j in
-       * M is the entity with index iperm[j] in M'.
-       */
-      template< int Dimension >
-      void reorderEntities( const GlobalIndexArray& perm,
-                            const GlobalIndexArray& iperm );
-
-
-      void print( std::ostream& str ) const;
-
-      bool operator==( const Mesh& mesh ) const;
-
-      bool operator!=( const Mesh& mesh ) const;
-
-      void writeProlog( Logger& logger ) const;
-
-   protected:
-      typename MeshTraitsType::PointArrayType points;
-
-      friend Initializer< MeshConfig >;
-
-      template< typename Mesh, int Dimension >
-      friend struct IndexPermutationApplier;
-
-      template< int EntityDimension, int SubentityDimension >
-      void setSubentitiesCounts( const typename MeshTraitsType::NeighborCountsArray& counts );
+   using StorageBaseType = StorageLayerFamily< MeshConfig, Device >;
+   using EntityTagsLayerFamily = EntityTags::LayerFamily< MeshConfig, Device, Mesh >;
+
+public:
+   using Config = MeshConfig;
+   using MeshTraitsType = MeshTraits< MeshConfig, Device >;
+   using DeviceType = typename MeshTraitsType::DeviceType;
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
+   using PointType = typename MeshTraitsType::PointType;
+   using RealType = typename PointType::RealType;
+   using GlobalIndexArray = Containers::Array< GlobalIndexType, DeviceType, GlobalIndexType >;
+
+   template< int Dimension >
+   using EntityTraits = typename MeshTraitsType::template EntityTraits< Dimension >;
+
+   template< int Dimension >
+   using EntityType = typename EntityTraits< Dimension >::EntityType;
+
+   // constructors
+   Mesh() = default;
+
+   Mesh( const Mesh& mesh ) = default;
+
+   Mesh( Mesh&& mesh ) = default;
+
+   template< typename Device_ >
+   Mesh( const Mesh< MeshConfig, Device_ >& mesh );
+
+   Mesh&
+   operator=( const Mesh& mesh ) = default;
+
+   Mesh&
+   operator=( Mesh&& mesh ) = default;
+
+   template< typename Device_ >
+   Mesh&
+   operator=( const Mesh< MeshConfig, Device_ >& mesh );
+
+   static constexpr int
+   getMeshDimension();
+
+   // types of common entities
+   using Cell = EntityType< getMeshDimension() >;
+   using Face = EntityType< getMeshDimension() - 1 >;
+   using Vertex = EntityType< 0 >;
+
+   /**
+    * \brief Returns the count of mesh entities of the given dimension.
+    */
+   template< int Dimension >
+   __cuda_callable__
+   GlobalIndexType
+   getEntitiesCount() const;
+
+   /**
+    * \brief Returns the mesh entity of the given dimension and index.
+    *
+    * Note that objects representing mesh entities are not stored in the mesh,
+    * but created on demand. Since the \ref MeshEntity contains just a pointer
+    * to the mesh and the supplied entity index, the creation should be fast.
+    */
+   template< int Dimension >
+   __cuda_callable__
+   EntityType< Dimension >
+   getEntity( GlobalIndexType entityIndex ) const;
+
+   template< int Dimension >
+   void
+   setEntitiesCount( const typename MeshTraitsType::GlobalIndexType& entitiesCount );
+
+   // duplicated for compatibility with grids
+   template< typename EntityType >
+   __cuda_callable__
+   GlobalIndexType
+   getEntitiesCount() const;
+
+   template< typename EntityType >
+   __cuda_callable__
+   EntityType
+   getEntity( GlobalIndexType entityIndex ) const;
+
+   /**
+    * \brief Returns the spatial coordinates of the vertex with given index.
+    */
+   const typename MeshTraitsType::PointArrayType&
+   getPoints() const;
+
+   typename MeshTraitsType::PointArrayType&
+   getPoints();
+
+   __cuda_callable__
+   const PointType&
+   getPoint( GlobalIndexType vertexIndex ) const;
+
+   /**
+    * \brief Returns the spatial coordinates of the vertex with given index.
+    */
+   __cuda_callable__
+   PointType&
+   getPoint( GlobalIndexType vertexIndex );
+
+   /**
+    * \brief Returns the count of subentities of the entity with given index.
+    */
+   template< int EntityDimension, int SubentityDimension >
+   __cuda_callable__
+   constexpr LocalIndexType
+   getSubentitiesCount( GlobalIndexType entityIndex ) const;
+
+   /**
+    * \brief Returns the global index of the subentity specified by its local index.
+    */
+   template< int EntityDimension, int SubentityDimension >
+   __cuda_callable__
+   GlobalIndexType
+   getSubentityIndex( GlobalIndexType entityIndex, LocalIndexType subentityIndex ) const;
+
+   /**
+    * \brief Returns the count of superentities of the entity with given index.
+    */
+   template< int EntityDimension, int SuperentityDimension >
+   __cuda_callable__
+   LocalIndexType
+   getSuperentitiesCount( GlobalIndexType entityIndex ) const;
+
+   /**
+    * \brief Returns the global index of the superentity specified by its local index.
+    */
+   template< int EntityDimension, int SuperentityDimension >
+   __cuda_callable__
+   GlobalIndexType
+   getSuperentityIndex( GlobalIndexType entityIndex, LocalIndexType superentityIndex ) const;
+
+   /**
+    * \brief Returns the count of neighbor cells of the cell with given index,
+    * based on the information stored in the dual graph.
+    */
+   __cuda_callable__
+   LocalIndexType
+   getCellNeighborsCount( GlobalIndexType cellIndex ) const;
+
+   /**
+    * \brief Returns the global index of the cell's specific neighbor cell wigh given local index,
+    * based on the information stored in the dual graph.
+    */
+   __cuda_callable__
+   GlobalIndexType
+   getCellNeighborIndex( GlobalIndexType cellIndex, LocalIndexType neighborIndex ) const;
+
+   /**
+    * \brief Execute function \e f in parallel for all mesh entities with dimension \e EntityDimension.
+    *
+    * The function \e f is executed as `f(i)`, where `GlobalIndexType i` is the global index of the
+    * mesh entity to be processed. The mesh itself is not passed to the function `f`, it is the user's
+    * responsibility to ensure proper access to the mesh if needed, e.g. by the means of lambda capture
+    * and/or using a \ref TNL::Pointers::SharedPointer "SharedPointer".
+    */
+   template< int EntityDimension, typename Device2 = DeviceType, typename Func >
+   void
+   forAll( Func f ) const;
+
+   /**
+    * \brief Execute function \e f in parallel for all boundary mesh entities with dimension \e EntityDimension.
+    *
+    * The function \e f is executed as `f(i)`, where `GlobalIndexType i` is the global index of the
+    * mesh entity to be processed. The mesh itself is not passed to the function `f`, it is the user's
+    * responsibility to ensure proper access to the mesh if needed, e.g. by the means of lambda capture
+    * and/or using a \ref TNL::Pointers::SharedPointer "SharedPointer".
+    */
+   template< int EntityDimension, typename Device2 = DeviceType, typename Func >
+   void
+   forBoundary( Func f ) const;
+
+   /**
+    * \brief Execute function \e f in parallel for all interior mesh entities with dimension \e EntityDimension.
+    *
+    * The function \e f is executed as `f(i)`, where `GlobalIndexType i` is the global index of the
+    * mesh entity to be processed. The mesh itself is not passed to the function `f`, it is the user's
+    * responsibility to ensure proper access to the mesh if needed, e.g. by the means of lambda capture
+    * and/or using a \ref TNL::Pointers::SharedPointer "SharedPointer".
+    */
+   template< int EntityDimension, typename Device2 = DeviceType, typename Func >
+   void
+   forInterior( Func f ) const;
+
+   /**
+    * \brief Execute function \e f in parallel for all local mesh entities with dimension \e EntityDimension.
+    *
+    * The function \e f is executed as `f(i)`, where `GlobalIndexType i` is the global index of the
+    * mesh entity to be processed. The mesh itself is not passed to the function `f`, it is the user's
+    * responsibility to ensure proper access to the mesh if needed, e.g. by the means of lambda capture
+    * and/or using a \ref TNL::Pointers::SharedPointer "SharedPointer".
+    */
+   template< int EntityDimension, typename Device2 = DeviceType, typename Func >
+   void
+   forLocal( Func f ) const;
+
+   /**
+    * \brief Execute function \e f in parallel for all ghost mesh entities with dimension \e EntityDimension.
+    *
+    * The function \e f is executed as `f(i)`, where `GlobalIndexType i` is the global index of the
+    * mesh entity to be processed. The mesh itself is not passed to the function `f`, it is the user's
+    * responsibility to ensure proper access to the mesh if needed, e.g. by the means of lambda capture
+    * and/or using a \ref TNL::Pointers::SharedPointer "SharedPointer".
+    */
+   template< int EntityDimension, typename Device2 = DeviceType, typename Func >
+   void
+   forGhost( Func f ) const;
+
+   /**
+    * \brief Reorders the entities of the given dimension.
+    *
+    * The permutations follow the definition used in the Metis library: Let M
+    * be the original mesh and M' the permuted mesh. Then entity with index i
+    * in M' is the entity with index perm[i] in M and entity with index j in
+    * M is the entity with index iperm[j] in M'.
+    */
+   template< int Dimension >
+   void
+   reorderEntities( const GlobalIndexArray& perm, const GlobalIndexArray& iperm );
+
+   void
+   print( std::ostream& str ) const;
+
+   bool
+   operator==( const Mesh& mesh ) const;
+
+   bool
+   operator!=( const Mesh& mesh ) const;
+
+   void
+   writeProlog( Logger& logger ) const;
+
+protected:
+   typename MeshTraitsType::PointArrayType points;
+
+   friend Initializer< MeshConfig >;
+
+   template< typename Mesh, int Dimension >
+   friend struct IndexPermutationApplier;
+
+   template< int EntityDimension, int SubentityDimension >
+   void
+   setSubentitiesCounts( const typename MeshTraitsType::NeighborCountsArray& counts );
 };
 
 template< typename MeshConfig, typename Device >
-std::ostream& operator<<( std::ostream& str, const Mesh< MeshConfig, Device >& mesh );
+std::ostream&
+operator<<( std::ostream& str, const Mesh< MeshConfig, Device >& mesh );
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/MeshEntity.h>
 
diff --git a/src/TNL/Meshes/Mesh.hpp b/src/TNL/Meshes/Mesh.hpp
index 11da9ef926883179a0eb75eaa12c4a2cd57b7941..12f2921df84605c1425bee4118e2879e6f818974 100644
--- a/src/TNL/Meshes/Mesh.hpp
+++ b/src/TNL/Meshes/Mesh.hpp
@@ -21,10 +21,9 @@ namespace Meshes {
 
 template< typename MeshConfig, typename Device, typename MeshType >
 void
-MeshInitializableBase< MeshConfig, Device, MeshType >::
-init( typename MeshTraitsType::PointArrayType& points,
-      typename MeshTraitsType::FaceSeedMatrixType& faceSeeds,
-      typename MeshTraitsType::CellSeedMatrixType& cellSeeds )
+MeshInitializableBase< MeshConfig, Device, MeshType >::init( typename MeshTraitsType::PointArrayType& points,
+                                                             typename MeshTraitsType::FaceSeedMatrixType& faceSeeds,
+                                                             typename MeshTraitsType::CellSeedMatrixType& cellSeeds )
 {
    MeshType* mesh = static_cast< MeshType* >( this );
    Initializer< typename MeshType::Config > initializer;
@@ -35,22 +34,18 @@ init( typename MeshTraitsType::PointArrayType& points,
    mesh->initializeDualGraph( *mesh );
 }
 
-
 template< typename MeshConfig, typename Device >
-   template< typename Device_ >
-Mesh< MeshConfig, Device >::
-Mesh( const Mesh< MeshConfig, Device_ >& mesh )
-   : StorageBaseType( mesh ),
-     EntityTagsLayerFamily( mesh )
+template< typename Device_ >
+Mesh< MeshConfig, Device >::Mesh( const Mesh< MeshConfig, Device_ >& mesh )
+: StorageBaseType( mesh ), EntityTagsLayerFamily( mesh )
 {
    points = mesh.getPoints();
 }
 
 template< typename MeshConfig, typename Device >
-   template< typename Device_ >
+template< typename Device_ >
 Mesh< MeshConfig, Device >&
-Mesh< MeshConfig, Device >::
-operator=( const Mesh< MeshConfig, Device_ >& mesh )
+Mesh< MeshConfig, Device >::operator=( const Mesh< MeshConfig, Device_ >& mesh )
 {
    points = mesh.getPoints();
    StorageBaseType::operator=( mesh );
@@ -60,38 +55,34 @@ operator=( const Mesh< MeshConfig, Device_ >& mesh )
 
 template< typename MeshConfig, typename Device >
 constexpr int
-Mesh< MeshConfig, Device >::
-getMeshDimension()
+Mesh< MeshConfig, Device >::getMeshDimension()
 {
    return MeshTraitsType::meshDimension;
 }
 
 template< typename MeshConfig, typename Device >
-   template< int Dimension >
+template< int Dimension >
 __cuda_callable__
 typename Mesh< MeshConfig, Device >::GlobalIndexType
-Mesh< MeshConfig, Device >::
-getEntitiesCount() const
+Mesh< MeshConfig, Device >::getEntitiesCount() const
 {
    return StorageBaseType::getEntitiesCount( DimensionTag< Dimension >() );
 }
 
 template< typename MeshConfig, typename Device >
-   template< int Dimension >
+template< int Dimension >
 __cuda_callable__
 typename Mesh< MeshConfig, Device >::template EntityType< Dimension >
-Mesh< MeshConfig, Device >::
-getEntity( const GlobalIndexType entityIndex ) const
+Mesh< MeshConfig, Device >::getEntity( GlobalIndexType entityIndex ) const
 {
    TNL_ASSERT_LT( entityIndex, getEntitiesCount< Dimension >(), "invalid entity index" );
    return EntityType< Dimension >( *this, entityIndex );
 }
 
 template< typename MeshConfig, typename Device >
-   template< int Dimension >
+template< int Dimension >
 void
-Mesh< MeshConfig, Device >::
-setEntitiesCount( const typename MeshTraitsType::GlobalIndexType& entitiesCount )
+Mesh< MeshConfig, Device >::setEntitiesCount( const typename MeshTraitsType::GlobalIndexType& entitiesCount )
 {
    StorageBaseType::setEntitiesCount( DimensionTag< Dimension >(), entitiesCount );
    if( Dimension == 0 )
@@ -100,37 +91,33 @@ setEntitiesCount( const typename MeshTraitsType::GlobalIndexType& entitiesCount
 
 // duplicated for compatibility with grids
 template< typename MeshConfig, typename Device >
-   template< typename Entity >
+template< typename Entity >
 __cuda_callable__
 typename Mesh< MeshConfig, Device >::GlobalIndexType
-Mesh< MeshConfig, Device >::
-getEntitiesCount() const
+Mesh< MeshConfig, Device >::getEntitiesCount() const
 {
    return getEntitiesCount< Entity::getEntityDimension() >();
 }
 
 template< typename MeshConfig, typename Device >
-   template< typename Entity >
+template< typename Entity >
 __cuda_callable__
 Entity
-Mesh< MeshConfig, Device >::
-getEntity( const GlobalIndexType entityIndex ) const
+Mesh< MeshConfig, Device >::getEntity( GlobalIndexType entityIndex ) const
 {
    return getEntity< Entity::getEntityDimension() >( entityIndex );
 }
 
 template< typename MeshConfig, typename Device >
 const typename Mesh< MeshConfig, Device >::MeshTraitsType::PointArrayType&
-Mesh< MeshConfig, Device >::
-getPoints() const
+Mesh< MeshConfig, Device >::getPoints() const
 {
    return points;
 }
 
 template< typename MeshConfig, typename Device >
 typename Mesh< MeshConfig, Device >::MeshTraitsType::PointArrayType&
-Mesh< MeshConfig, Device >::
-getPoints()
+Mesh< MeshConfig, Device >::getPoints()
 {
    return points;
 }
@@ -138,8 +125,7 @@ getPoints()
 template< typename MeshConfig, typename Device >
 __cuda_callable__
 const typename Mesh< MeshConfig, Device >::PointType&
-Mesh< MeshConfig, Device >::
-getPoint( const GlobalIndexType vertexIndex ) const
+Mesh< MeshConfig, Device >::getPoint( GlobalIndexType vertexIndex ) const
 {
    TNL_ASSERT_GE( vertexIndex, 0, "invalid vertex index" );
    TNL_ASSERT_LT( vertexIndex, getEntitiesCount< 0 >(), "invalid vertex index" );
@@ -149,8 +135,7 @@ getPoint( const GlobalIndexType vertexIndex ) const
 template< typename MeshConfig, typename Device >
 __cuda_callable__
 typename Mesh< MeshConfig, Device >::PointType&
-Mesh< MeshConfig, Device >::
-getPoint( const GlobalIndexType vertexIndex )
+Mesh< MeshConfig, Device >::getPoint( GlobalIndexType vertexIndex )
 {
    TNL_ASSERT_GE( vertexIndex, 0, "invalid vertex index" );
    TNL_ASSERT_LT( vertexIndex, getEntitiesCount< 0 >(), "invalid vertex index" );
@@ -158,30 +143,27 @@ getPoint( const GlobalIndexType vertexIndex )
 }
 
 template< typename MeshConfig, typename Device >
-   template< int EntityDimension, int SubentityDimension >
+template< int EntityDimension, int SubentityDimension >
 void
-Mesh< MeshConfig, Device >::
-setSubentitiesCounts( const typename MeshTraitsType::NeighborCountsArray& counts )
+Mesh< MeshConfig, Device >::setSubentitiesCounts( const typename MeshTraitsType::NeighborCountsArray& counts )
 {
    StorageBaseType::template setSubentitiesCounts< EntityDimension, SubentityDimension >( counts );
 }
 
 template< typename MeshConfig, typename Device >
-   template< int EntityDimension, int SubentityDimension >
+template< int EntityDimension, int SubentityDimension >
 __cuda_callable__
 constexpr typename Mesh< MeshConfig, Device >::LocalIndexType
-Mesh< MeshConfig, Device >::
-getSubentitiesCount( const GlobalIndexType entityIndex ) const
+Mesh< MeshConfig, Device >::getSubentitiesCount( GlobalIndexType entityIndex ) const
 {
    return StorageBaseType::template getSubentitiesCount< EntityDimension, SubentityDimension >( entityIndex );
 }
 
 template< typename MeshConfig, typename Device >
-   template< int EntityDimension, int SubentityDimension >
+template< int EntityDimension, int SubentityDimension >
 __cuda_callable__
 typename Mesh< MeshConfig, Device >::GlobalIndexType
-Mesh< MeshConfig, Device >::
-getSubentityIndex( const GlobalIndexType entityIndex, const LocalIndexType subentityIndex ) const
+Mesh< MeshConfig, Device >::getSubentityIndex( GlobalIndexType entityIndex, LocalIndexType subentityIndex ) const
 {
    const auto& row = this->template getSubentitiesMatrix< EntityDimension, SubentityDimension >().getRow( entityIndex );
    TNL_ASSERT_GE( row.getColumnIndex( subentityIndex ), 0, "padding index returned for given subentity index" );
@@ -189,21 +171,19 @@ getSubentityIndex( const GlobalIndexType entityIndex, const LocalIndexType suben
 }
 
 template< typename MeshConfig, typename Device >
-   template< int EntityDimension, int SuperentityDimension >
+template< int EntityDimension, int SuperentityDimension >
 __cuda_callable__
 typename Mesh< MeshConfig, Device >::LocalIndexType
-Mesh< MeshConfig, Device >::
-getSuperentitiesCount( const GlobalIndexType entityIndex ) const
+Mesh< MeshConfig, Device >::getSuperentitiesCount( GlobalIndexType entityIndex ) const
 {
    return this->template getSuperentitiesCountsArray< EntityDimension, SuperentityDimension >()[ entityIndex ];
 }
 
 template< typename MeshConfig, typename Device >
-   template< int EntityDimension, int SuperentityDimension >
+template< int EntityDimension, int SuperentityDimension >
 __cuda_callable__
 typename Mesh< MeshConfig, Device >::GlobalIndexType
-Mesh< MeshConfig, Device >::
-getSuperentityIndex( const GlobalIndexType entityIndex, const LocalIndexType superentityIndex ) const
+Mesh< MeshConfig, Device >::getSuperentityIndex( GlobalIndexType entityIndex, LocalIndexType superentityIndex ) const
 {
    const auto row = this->template getSuperentitiesMatrix< EntityDimension, SuperentityDimension >().getRow( entityIndex );
    TNL_ASSERT_GE( row.getColumnIndex( superentityIndex ), 0, "padding index returned for given superentity index" );
@@ -213,8 +193,7 @@ getSuperentityIndex( const GlobalIndexType entityIndex, const LocalIndexType sup
 template< typename MeshConfig, typename Device >
 __cuda_callable__
 typename Mesh< MeshConfig, Device >::LocalIndexType
-Mesh< MeshConfig, Device >::
-getCellNeighborsCount( const GlobalIndexType cellIndex ) const
+Mesh< MeshConfig, Device >::getCellNeighborsCount( GlobalIndexType cellIndex ) const
 {
    static_assert( MeshConfig::dualGraphStorage(),
                   "You try to access the dual graph which is disabled in the mesh configuration." );
@@ -224,8 +203,7 @@ getCellNeighborsCount( const GlobalIndexType cellIndex ) const
 template< typename MeshConfig, typename Device >
 __cuda_callable__
 typename Mesh< MeshConfig, Device >::GlobalIndexType
-Mesh< MeshConfig, Device >::
-getCellNeighborIndex( const GlobalIndexType cellIndex, const LocalIndexType neighborIndex ) const
+Mesh< MeshConfig, Device >::getCellNeighborIndex( GlobalIndexType cellIndex, LocalIndexType neighborIndex ) const
 {
    static_assert( MeshConfig::dualGraphStorage(),
                   "You try to access the dual graph which is disabled in the mesh configuration." );
@@ -236,26 +214,23 @@ getCellNeighborIndex( const GlobalIndexType cellIndex, const LocalIndexType neig
    return row.getColumnIndex( neighborIndex );
 }
 
-
 template< typename MeshConfig, typename Device >
-   template< int EntityDimension, typename Device2, typename Func >
+template< int EntityDimension, typename Device2, typename Func >
 void
-Mesh< MeshConfig, Device >::
-forAll( Func f ) const
+Mesh< MeshConfig, Device >::forAll( Func f ) const
 {
    const GlobalIndexType entitiesCount = getEntitiesCount< EntityDimension >();
    Algorithms::ParallelFor< Device2 >::exec( (GlobalIndexType) 0, entitiesCount, f );
 }
 
 template< typename MeshConfig, typename Device >
-   template< int EntityDimension, typename Device2, typename Func >
+template< int EntityDimension, typename Device2, typename Func >
 void
-Mesh< MeshConfig, Device >::
-forBoundary( Func f ) const
+Mesh< MeshConfig, Device >::forBoundary( Func f ) const
 {
    const auto boundaryIndices = this->template getBoundaryIndices< EntityDimension >();
    const GlobalIndexType entitiesCount = boundaryIndices.getSize();
-   auto wrapper = [f, boundaryIndices] __cuda_callable__ ( const GlobalIndexType i ) mutable
+   auto wrapper = [ f, boundaryIndices ] __cuda_callable__( GlobalIndexType i ) mutable
    {
       f( boundaryIndices[ i ] );
    };
@@ -263,14 +238,13 @@ forBoundary( Func f ) const
 }
 
 template< typename MeshConfig, typename Device >
-   template< int EntityDimension, typename Device2, typename Func >
+template< int EntityDimension, typename Device2, typename Func >
 void
-Mesh< MeshConfig, Device >::
-forInterior( Func f ) const
+Mesh< MeshConfig, Device >::forInterior( Func f ) const
 {
    const auto interiorIndices = this->template getInteriorIndices< EntityDimension >();
    const GlobalIndexType entitiesCount = interiorIndices.getSize();
-   auto wrapper = [f, interiorIndices] __cuda_callable__ ( const GlobalIndexType i ) mutable
+   auto wrapper = [ f, interiorIndices ] __cuda_callable__( GlobalIndexType i ) mutable
    {
       f( interiorIndices[ i ] );
    };
@@ -278,56 +252,50 @@ forInterior( Func f ) const
 }
 
 template< typename MeshConfig, typename Device >
-   template< int EntityDimension, typename Device2, typename Func >
+template< int EntityDimension, typename Device2, typename Func >
 void
-Mesh< MeshConfig, Device >::
-forLocal( Func f ) const
+Mesh< MeshConfig, Device >::forLocal( Func f ) const
 {
    const GlobalIndexType ghostsOffset = this->template getGhostEntitiesOffset< EntityDimension >();
    Algorithms::ParallelFor< DeviceType >::exec( (GlobalIndexType) 0, ghostsOffset, f );
 }
 
 template< typename MeshConfig, typename Device >
-   template< int EntityDimension, typename Device2, typename Func >
+template< int EntityDimension, typename Device2, typename Func >
 void
-Mesh< MeshConfig, Device >::
-forGhost( Func f ) const
+Mesh< MeshConfig, Device >::forGhost( Func f ) const
 {
    const GlobalIndexType ghostsOffset = this->template getGhostEntitiesOffset< EntityDimension >();
    const GlobalIndexType entitiesCount = this->template getEntitiesCount< EntityDimension >();
    Algorithms::ParallelFor< Device2 >::exec( ghostsOffset, entitiesCount, f );
 }
 
-
 template< typename MeshConfig, typename Device >
-   template< int Dimension >
+template< int Dimension >
 void
-Mesh< MeshConfig, Device >::
-reorderEntities( const GlobalIndexArray& perm,
-                 const GlobalIndexArray& iperm )
+Mesh< MeshConfig, Device >::reorderEntities( const GlobalIndexArray& perm, const GlobalIndexArray& iperm )
 {
    const GlobalIndexType entitiesCount = getEntitiesCount< Dimension >();
 
    // basic sanity check
    if( perm.getSize() != entitiesCount || iperm.getSize() != entitiesCount ) {
       throw std::logic_error( "Wrong size of permutation vectors: "
-                              "perm size = " + std::to_string( perm.getSize() ) + ", "
-                              "iperm size = " + std::to_string( iperm.getSize() ) );
+                              "perm size = "
+                              + std::to_string( perm.getSize() )
+                              + ", "
+                                "iperm size = "
+                              + std::to_string( iperm.getSize() ) );
    }
 #ifndef NDEBUG
    using View = Containers::VectorView< const GlobalIndexType, DeviceType, GlobalIndexType >;
    const View perm_view = perm.getConstView();
    const View iperm_view = iperm.getConstView();
    TNL_ASSERT( min( perm_view ) == 0 && max( perm_view ) == entitiesCount - 1,
-               std::cerr << "Given array is not a permutation: min = " << min( perm_view )
-                         << ", max = " << max( perm_view )
-                         << ", number of entities = " << entitiesCount
-                         << ", array = " << perm << std::endl; );
+               std::cerr << "Given array is not a permutation: min = " << min( perm_view ) << ", max = " << max( perm_view )
+                         << ", number of entities = " << entitiesCount << ", array = " << perm << std::endl; );
    TNL_ASSERT( min( iperm_view ) == 0 && max( iperm_view ) == entitiesCount - 1,
-               std::cerr << "Given array is not a permutation: min = " << min( iperm_view )
-                         << ", max = " << max( iperm_view )
-                         << ", number of entities = " << entitiesCount
-                         << ", array = " << iperm << std::endl; );
+               std::cerr << "Given array is not a permutation: min = " << min( iperm_view ) << ", max = " << max( iperm_view )
+                         << ", number of entities = " << entitiesCount << ", array = " << iperm << std::endl; );
 #endif
 
    IndexPermutationApplier< Mesh, Dimension >::exec( *this, perm, iperm );
@@ -338,11 +306,9 @@ reorderEntities( const GlobalIndexArray& perm,
    this->template updateEntityTagsLayer< Dimension >();
 }
 
-
 template< typename MeshConfig, typename Device >
 void
-Mesh< MeshConfig, Device >::
-print( std::ostream& str ) const
+Mesh< MeshConfig, Device >::print( std::ostream& str ) const
 {
    str << "Vertex coordinates are: " << points << std::endl;
    StorageBaseType::print( str );
@@ -351,26 +317,21 @@ print( std::ostream& str ) const
 
 template< typename MeshConfig, typename Device >
 bool
-Mesh< MeshConfig, Device >::
-operator==( const Mesh& mesh ) const
+Mesh< MeshConfig, Device >::operator==( const Mesh& mesh ) const
 {
-   return points == mesh.points &&
-          StorageBaseType::operator==( mesh ) &&
-          EntityTagsLayerFamily::operator==( mesh );
+   return points == mesh.points && StorageBaseType::operator==( mesh ) && EntityTagsLayerFamily::operator==( mesh );
 }
 
 template< typename MeshConfig, typename Device >
 bool
-Mesh< MeshConfig, Device >::
-operator!=( const Mesh& mesh ) const
+Mesh< MeshConfig, Device >::operator!=( const Mesh& mesh ) const
 {
    return ! operator==( mesh );
 }
 
 template< typename MeshConfig, typename Device >
 void
-Mesh< MeshConfig, Device >::
-writeProlog( Logger& logger ) const
+Mesh< MeshConfig, Device >::writeProlog( Logger& logger ) const
 {
    logger.writeParameter( "Dimension:", getMeshDimension() );
    logger.writeParameter( "Cell topology:", getType( typename Cell::EntityTopology{} ) );
@@ -382,13 +343,13 @@ writeProlog( Logger& logger ) const
    logger.writeParameter( "Boundary vertices count:", this->template getBoundaryEntitiesCount< 0 >() );
 }
 
-
 template< typename MeshConfig, typename Device >
-std::ostream& operator<<( std::ostream& str, const Mesh< MeshConfig, Device >& mesh )
+std::ostream&
+operator<<( std::ostream& str, const Mesh< MeshConfig, Device >& mesh )
 {
    mesh.print( str );
    return str;
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/MeshBuilder.h b/src/TNL/Meshes/MeshBuilder.h
index 149040b0b7e7f7a29656ef870b0c7e5c35473c6b..27cb2539d3cf54f5dfed1fcda1bd74458be34c76 100644
--- a/src/TNL/Meshes/MeshBuilder.h
+++ b/src/TNL/Meshes/MeshBuilder.h
@@ -12,7 +12,7 @@
 
 #pragma once
 
-#include <numeric>   // std::iota
+#include <numeric>  // std::iota
 #include <vector>
 
 #include <TNL/Containers/Vector.h>
@@ -25,92 +25,100 @@ template< typename Mesh >
 class MeshBuilder
 {
 public:
-   using MeshType           = Mesh;
-   using MeshTraitsType     = typename MeshType::MeshTraitsType;
-   using GlobalIndexType    = typename MeshTraitsType::GlobalIndexType;
-   using LocalIndexType     = typename MeshTraitsType::LocalIndexType;
-   using PointType          = typename MeshTraitsType::PointType;
-   using PointArrayType     = typename MeshTraitsType::PointArrayType;
-   using BoolVector         = Containers::Vector< bool, Devices::Host, GlobalIndexType >;
-   using CellTopology       = typename MeshTraitsType::CellTopology;
+   using MeshType = Mesh;
+   using MeshTraitsType = typename MeshType::MeshTraitsType;
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
+   using PointType = typename MeshTraitsType::PointType;
+   using PointArrayType = typename MeshTraitsType::PointArrayType;
+   using BoolVector = Containers::Vector< bool, Devices::Host, GlobalIndexType >;
+   using CellTopology = typename MeshTraitsType::CellTopology;
    using CellSeedMatrixType = typename MeshTraitsType::CellSeedMatrixType;
-   using CellSeedType       = typename CellSeedMatrixType::EntitySeedMatrixSeed;
+   using CellSeedType = typename CellSeedMatrixType::EntitySeedMatrixSeed;
    using FaceSeedMatrixType = typename MeshTraitsType::FaceSeedMatrixType;
-   using FaceSeedType       = typename FaceSeedMatrixType::EntitySeedMatrixSeed;
+   using FaceSeedType = typename FaceSeedMatrixType::EntitySeedMatrixSeed;
    using NeighborCountsArray = typename MeshTraitsType::NeighborCountsArray;
 
-   void setEntitiesCount( const GlobalIndexType& points,
-                          const GlobalIndexType& cells = 0,
-                          const GlobalIndexType& faces = 0 )
+   void
+   setEntitiesCount( const GlobalIndexType& points, const GlobalIndexType& cells = 0, const GlobalIndexType& faces = 0 )
    {
       this->points.setSize( points );
       this->pointsSet.setSize( points );
       pointsSet.setValue( false );
 
-      if( std::is_same< CellTopology, Topologies::Polyhedron >::value )
-      {
+      if( std::is_same< CellTopology, Topologies::Polyhedron >::value ) {
          this->faceSeeds.setDimensions( faces, points );
          this->cellSeeds.setDimensions( cells, faces );
       }
-      else // Topologies other than polyhedrons don't use face seeds
+      else  // Topologies other than polyhedrons don't use face seeds
       {
          this->cellSeeds.setDimensions( cells, points );
       }
    }
 
-   void setFaceCornersCounts( const NeighborCountsArray& counts )
+   void
+   setFaceCornersCounts( const NeighborCountsArray& counts )
    {
       this->faceSeeds.setEntityCornersCounts( counts );
    }
 
-   void setFaceCornersCounts( NeighborCountsArray&& counts )
+   void
+   setFaceCornersCounts( NeighborCountsArray&& counts )
    {
       this->faceSeeds.setEntityCornersCounts( std::move( counts ) );
    }
 
-   void setCellCornersCounts( const NeighborCountsArray& counts )
+   void
+   setCellCornersCounts( const NeighborCountsArray& counts )
    {
       this->cellSeeds.setEntityCornersCounts( counts );
    }
 
-   void setCellCornersCounts( NeighborCountsArray&& counts )
+   void
+   setCellCornersCounts( NeighborCountsArray&& counts )
    {
       this->cellSeeds.setEntityCornersCounts( std::move( counts ) );
    }
 
-   GlobalIndexType getPointsCount() const
+   GlobalIndexType
+   getPointsCount() const
    {
       return this->points.getSize();
    }
 
-   GlobalIndexType getFacesCount() const
+   GlobalIndexType
+   getFacesCount() const
    {
       return this->faceSeeds.getEntitiesCount();
    }
 
-   GlobalIndexType getCellsCount() const
+   GlobalIndexType
+   getCellsCount() const
    {
       return this->cellSeeds.getEntitiesCount();
    }
 
-   void setPoint( GlobalIndexType index,
-                  const PointType& point )
+   void
+   setPoint( GlobalIndexType index, const PointType& point )
    {
       this->points[ index ] = point;
       this->pointsSet[ index ] = true;
    }
 
-   FaceSeedType getFaceSeed( GlobalIndexType index )
+   FaceSeedType
+   getFaceSeed( GlobalIndexType index )
    {
       return this->faceSeeds.getSeed( index );
    }
 
-   CellSeedType getCellSeed( GlobalIndexType index )
+   CellSeedType
+   getCellSeed( GlobalIndexType index )
    {
       return this->cellSeeds.getSeed( index );
    }
 
-   void deduplicatePoints( const double numericalThreshold = 1e-9 )
+   void
+   deduplicatePoints( const double numericalThreshold = 1e-9 )
    {
       // prepare vector with an identity permutationutation
       std::vector< GlobalIndexType > permutation( points.getSize() );
@@ -118,7 +126,7 @@ public:
 
       // workaround for lexicographical sorting
       // FIXME: https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/79
-      auto lexless = [numericalThreshold, this] (const GlobalIndexType& a, const GlobalIndexType& b) -> bool
+      auto lexless = [ numericalThreshold, this ]( const GlobalIndexType& a, const GlobalIndexType& b ) -> bool
       {
          const PointType& left = this->points[ a ];
          const PointType& right = this->points[ b ];
@@ -153,7 +161,8 @@ public:
       if( uniquePointsCount == points.getSize() )
          return;
 
-      std::cout << "Found " << points.getSize() - uniquePointsCount << " duplicate points (total " << points.getSize() << ", unique " << uniquePointsCount << ")" << std::endl;
+      std::cout << "Found " << points.getSize() - uniquePointsCount << " duplicate points (total " << points.getSize()
+                << ", unique " << uniquePointsCount << ")" << std::endl;
 
       // copy this->points and this->pointsSet, drop duplicate points
       // (trying to do this in-place is not worth it, since even Array::reallocate
@@ -177,7 +186,7 @@ public:
       points_perm_to_new.clear();
       points_perm_to_new.shrink_to_fit();
 
-      auto remap_matrix = [uniquePointsCount, &points_old_to_new] ( auto& seeds )
+      auto remap_matrix = [ uniquePointsCount, &points_old_to_new ]( auto& seeds )
       {
          // TODO: parallelize (we have the IndexPermutationApplier)
          for( GlobalIndexType i = 0; i < seeds.getEntitiesCount(); i++ ) {
@@ -198,7 +207,8 @@ public:
          remap_matrix( faceSeeds );
    }
 
-   void deduplicateFaces()
+   void
+   deduplicateFaces()
    {
       // prepare vector with an identity permutationutation
       std::vector< GlobalIndexType > permutation( faceSeeds.getEntitiesCount() );
@@ -206,7 +216,7 @@ public:
 
       // workaround for lexicographical sorting
       // FIXME: https://mmg-gitlab.fjfi.cvut.cz/gitlab/tnl/tnl-dev/-/issues/79
-      auto lexless = [this] (const GlobalIndexType& a, const GlobalIndexType& b) -> bool
+      auto lexless = [ this ]( const GlobalIndexType& a, const GlobalIndexType& b ) -> bool
       {
          const auto& left = this->faceSeeds.getSeed( a );
          const auto& right = this->faceSeeds.getSeed( b );
@@ -224,9 +234,9 @@ public:
       // vertex indices in each seed, all that *before* lexicographical sorting)
       // (Just for the detection of duplicates, it does not matter that vertices of a polygon get sorted in an arbitrary order
       // instead of clock-wise or counter-clockwise.)
-      auto equiv = [lexless] (const GlobalIndexType& a, const GlobalIndexType& b) -> bool
+      auto equiv = [ lexless ]( const GlobalIndexType& a, const GlobalIndexType& b ) -> bool
       {
-         return ! lexless(a, b) && ! lexless(b, a);
+         return ! lexless( a, b ) && ! lexless( b, a );
       };
 
       // sort face seeds in lexicographical order
@@ -252,7 +262,8 @@ public:
       if( uniqueFacesCount == faceSeeds.getEntitiesCount() )
          return;
 
-      std::cout << "Found " << faceSeeds.getEntitiesCount() - uniqueFacesCount << " duplicate faces (total " << faceSeeds.getEntitiesCount() << ", unique " << uniqueFacesCount << ")" << std::endl;
+      std::cout << "Found " << faceSeeds.getEntitiesCount() - uniqueFacesCount << " duplicate faces (total "
+                << faceSeeds.getEntitiesCount() << ", unique " << uniqueFacesCount << ")" << std::endl;
 
       // get corners counts for unique faces
       NeighborCountsArray cornersCounts( uniqueFacesCount );
@@ -285,7 +296,7 @@ public:
       faceSeeds = std::move( newFaceSeeds );
 
       // TODO: refactoring - basically the same lambda as in deduplicatePoints
-      auto remap_matrix = [uniqueFacesCount, &faces_old_to_new] ( auto& seeds )
+      auto remap_matrix = [ uniqueFacesCount, &faces_old_to_new ]( auto& seeds )
       {
          // TODO: parallelize (we have the IndexPermutationApplier)
          for( GlobalIndexType i = 0; i < seeds.getEntitiesCount(); i++ ) {
@@ -303,7 +314,8 @@ public:
       remap_matrix( cellSeeds );
    }
 
-   bool build( MeshType& mesh )
+   bool
+   build( MeshType& mesh )
    {
       if( ! this->validate() )
          return false;
@@ -313,15 +325,16 @@ public:
    }
 
 private:
-   bool validate() const
+   bool
+   validate() const
    {
       // verify that matrix dimensions are consistent with points
       if( faceSeeds.empty() ) {
          // no face seeds - cell seeds refer to points
          if( cellSeeds.getMatrix().getColumns() != points.getSize() ) {
             std::cerr << "Mesh builder error: Inconsistent size of the cellSeeds matrix (it has "
-                      << cellSeeds.getMatrix().getColumns() << " columns, but there are " << points.getSize()
-                      << " points)." << std::endl;
+                      << cellSeeds.getMatrix().getColumns() << " columns, but there are " << points.getSize() << " points)."
+                      << std::endl;
             return false;
          }
       }
@@ -335,8 +348,8 @@ private:
          }
          if( faceSeeds.getMatrix().getColumns() != points.getSize() ) {
             std::cerr << "Mesh builder error: Inconsistent size of the faceSeeds matrix (it has "
-                      << faceSeeds.getMatrix().getColumns() << " columns, but there are " << points.getSize()
-                      << " points)." << std::endl;
+                      << faceSeeds.getMatrix().getColumns() << " columns, but there are " << points.getSize() << " points)."
+                      << std::endl;
             return false;
          }
       }
@@ -350,8 +363,7 @@ private:
       assignedPoints.setLike( pointsSet );
       assignedPoints.setValue( false );
 
-      if( faceSeeds.empty() )
-      {
+      if( faceSeeds.empty() ) {
          for( GlobalIndexType i = 0; i < getCellsCount(); i++ ) {
             const auto cellSeed = this->cellSeeds.getSeed( i );
             for( LocalIndexType j = 0; j < cellSeed.getCornersCount(); j++ ) {
@@ -369,8 +381,7 @@ private:
             return false;
          }
       }
-      else
-      {
+      else {
          for( GlobalIndexType i = 0; i < getFacesCount(); i++ ) {
             const auto faceSeed = this->faceSeeds.getSeed( i );
             for( LocalIndexType j = 0; j < faceSeed.getCornersCount(); j++ ) {
@@ -419,5 +430,5 @@ private:
    BoolVector pointsSet;
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/MeshDetails/ConfigValidator.h b/src/TNL/Meshes/MeshDetails/ConfigValidator.h
index e68ac332d4bb5eddfd25cd50e8b7801e5ad8570b..c63c4e0cc842497edf43dfa075730fd178e8d526 100644
--- a/src/TNL/Meshes/MeshDetails/ConfigValidator.h
+++ b/src/TNL/Meshes/MeshDetails/ConfigValidator.h
@@ -19,81 +19,72 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename MeshConfig,
-          typename EntityTopology,
-          typename DimensionTag >
+template< typename MeshConfig, typename EntityTopology, typename DimensionTag >
 class ConfigValidatorSubtopologyLayer
-   : public ConfigValidatorSubtopologyLayer< MeshConfig, EntityTopology, typename DimensionTag::Decrement >
+: public ConfigValidatorSubtopologyLayer< MeshConfig, EntityTopology, typename DimensionTag::Decrement >
 {
-   static_assert( ! MeshConfig::subentityStorage( EntityTopology::dimension, DimensionTag::value ) ||
-                    MeshConfig::subentityStorage( EntityTopology::dimension, 0 ),
+   static_assert( ! MeshConfig::subentityStorage( EntityTopology::dimension, DimensionTag::value )
+                     || MeshConfig::subentityStorage( EntityTopology::dimension, 0 ),
                   "entities of which subentities are stored must store their subvertices" );
-   static_assert( ! MeshConfig::subentityStorage( EntityTopology::dimension, DimensionTag::value ) ||
-                    MeshConfig::subentityStorage( EntityTopology::dimension, 0 ),
+   static_assert( ! MeshConfig::subentityStorage( EntityTopology::dimension, DimensionTag::value )
+                     || MeshConfig::subentityStorage( EntityTopology::dimension, 0 ),
                   "entities that are stored as subentities must store their subvertices" );
 };
 
-template< typename MeshConfig,
-          typename EntityTopology >
+template< typename MeshConfig, typename EntityTopology >
 class ConfigValidatorSubtopologyLayer< MeshConfig, EntityTopology, DimensionTag< 0 > >
 {};
 
-
-template< typename MeshConfig,
-          typename EntityTopology,
-          typename DimensionTag >
+template< typename MeshConfig, typename EntityTopology, typename DimensionTag >
 class ConfigValidatorSupertopologyLayer
-   : public ConfigValidatorSupertopologyLayer< MeshConfig, EntityTopology, typename DimensionTag::Decrement >
+: public ConfigValidatorSupertopologyLayer< MeshConfig, EntityTopology, typename DimensionTag::Decrement >
 {
-   static_assert( ! MeshConfig::superentityStorage( EntityTopology::dimension, DimensionTag::value ) ||
-                    MeshConfig::subentityStorage( EntityTopology::dimension, 0 ),
-                  "entities of which superentities are stored must store their subvertices");
-   static_assert( ! MeshConfig::superentityStorage( EntityTopology::dimension, DimensionTag::value ) ||
-                    MeshConfig::subentityStorage( EntityTopology::dimension, 0 ),
-                  "entities that are stored as superentities must store their subvertices");
+   static_assert( ! MeshConfig::superentityStorage( EntityTopology::dimension, DimensionTag::value )
+                     || MeshConfig::subentityStorage( EntityTopology::dimension, 0 ),
+                  "entities of which superentities are stored must store their subvertices" );
+   static_assert( ! MeshConfig::superentityStorage( EntityTopology::dimension, DimensionTag::value )
+                     || MeshConfig::subentityStorage( EntityTopology::dimension, 0 ),
+                  "entities that are stored as superentities must store their subvertices" );
 };
 
-template< typename MeshConfig,
-          typename EntityTopology >
+template< typename MeshConfig, typename EntityTopology >
 class ConfigValidatorSupertopologyLayer< MeshConfig, EntityTopology, DimensionTag< EntityTopology::dimension > >
 {};
 
-
 template< typename MeshConfig, int dimension >
-class ConfigValidatorLayer
-   : public ConfigValidatorLayer< MeshConfig, dimension - 1 >,
-     public ConfigValidatorSubtopologyLayer< MeshConfig,
-                                             typename Topologies::Subtopology< typename MeshConfig::CellTopology, dimension >::Topology,
-                                             DimensionTag< dimension - 1 > >,
-     public ConfigValidatorSupertopologyLayer< MeshConfig,
-                                               typename Topologies::Subtopology< typename MeshConfig::CellTopology, dimension >::Topology,
-                                               DimensionTag< MeshConfig::CellTopology::dimension > >
+class ConfigValidatorLayer : public ConfigValidatorLayer< MeshConfig, dimension - 1 >,
+                             public ConfigValidatorSubtopologyLayer<
+                                MeshConfig,
+                                typename Topologies::Subtopology< typename MeshConfig::CellTopology, dimension >::Topology,
+                                DimensionTag< dimension - 1 > >,
+                             public ConfigValidatorSupertopologyLayer<
+                                MeshConfig,
+                                typename Topologies::Subtopology< typename MeshConfig::CellTopology, dimension >::Topology,
+                                DimensionTag< MeshConfig::CellTopology::dimension > >
 {};
 
 template< typename MeshConfig >
 class ConfigValidatorLayer< MeshConfig, 0 >
-{
-};
+{};
 
 template< typename MeshConfig >
 class ConfigValidatorLayerCell
-   : public ConfigValidatorLayer< MeshConfig, MeshConfig::CellTopology::dimension - 1 >,
-     public ConfigValidatorSubtopologyLayer< MeshConfig,
-                                             typename MeshConfig::CellTopology,
-                                             DimensionTag< MeshConfig::CellTopology::dimension - 1 > >
+: public ConfigValidatorLayer< MeshConfig, MeshConfig::CellTopology::dimension - 1 >,
+  public ConfigValidatorSubtopologyLayer< MeshConfig,
+                                          typename MeshConfig::CellTopology,
+                                          DimensionTag< MeshConfig::CellTopology::dimension - 1 > >
 {
    using CellTopology = typename MeshConfig::CellTopology;
 
-   static_assert( MeshConfig::subentityStorage( CellTopology::dimension, 0 ),
-                  "subvertices of cells must be stored" );
+   static_assert( MeshConfig::subentityStorage( CellTopology::dimension, 0 ), "subvertices of cells must be stored" );
 
-   static_assert( !std::is_same< CellTopology, Topologies::Polyhedron >::value || MeshConfig::subentityStorage( CellTopology::dimension, 2 ),
+   static_assert( ! std::is_same< CellTopology, Topologies::Polyhedron >::value
+                     || MeshConfig::subentityStorage( CellTopology::dimension, 2 ),
                   "faces of cells must be stored for polyhedral meshes" );
 };
 
 template< typename MeshConfig >
-class ConfigValidator
-   : public ConfigValidatorLayerCell< MeshConfig >
+class ConfigValidator : public ConfigValidatorLayerCell< MeshConfig >
 {
    static constexpr int meshDimension = MeshConfig::CellTopology::dimension;
 
@@ -101,5 +92,5 @@ class ConfigValidator
    static_assert( meshDimension <= MeshConfig::spaceDimension, "space dimension must not be less than mesh dimension" );
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/MeshDetails/IndexPermutationApplier.h b/src/TNL/Meshes/MeshDetails/IndexPermutationApplier.h
index 7353d3e5a4081d63e2b62a7a26b62b6fff8e4359..ab22add505d5501c16fe46af32b8de47e828584e 100644
--- a/src/TNL/Meshes/MeshDetails/IndexPermutationApplier.h
+++ b/src/TNL/Meshes/MeshDetails/IndexPermutationApplier.h
@@ -22,11 +22,11 @@ private:
    template< int Subdimension,
              bool Enabled =
                 Mesh::MeshTraitsType::template SubentityTraits< typename Mesh::template EntityType< Dimension >::EntityTopology,
-                                                                Subdimension >::storageEnabled
-             >
+                                                                Subdimension >::storageEnabled >
    struct SubentitiesStorageWorker
    {
-      static void exec( Mesh& mesh, const GlobalIndexArray& perm )
+      static void
+      exec( Mesh& mesh, const GlobalIndexArray& perm )
       {
          auto& subentitiesStorage = mesh.template getSubentitiesMatrix< Dimension, Subdimension >();
          Matrices::permuteMatrixRows( subentitiesStorage, perm );
@@ -36,18 +36,19 @@ private:
    template< int Subdimension >
    struct SubentitiesStorageWorker< Subdimension, false >
    {
-      static void exec( Mesh& mesh, const GlobalIndexArray& iperm ) {}
+      static void
+      exec( Mesh& mesh, const GlobalIndexArray& iperm )
+      {}
    };
 
-
    template< int Superdimension,
-             bool Enabled =
-                Mesh::MeshTraitsType::template SuperentityTraits< typename Mesh::template EntityType< Dimension >::EntityTopology,
-                                                                  Superdimension >::storageEnabled
-             >
+             bool Enabled = Mesh::MeshTraitsType::template SuperentityTraits<
+                typename Mesh::template EntityType< Dimension >::EntityTopology,
+                Superdimension >::storageEnabled >
    struct SuperentitiesStorageWorker
    {
-      static void exec( Mesh& mesh, const GlobalIndexArray& perm )
+      static void
+      exec( Mesh& mesh, const GlobalIndexArray& perm )
       {
          permuteArray( mesh.template getSuperentitiesCountsArray< Dimension, Superdimension >(), perm );
          auto& superentitiesStorage = mesh.template getSuperentitiesMatrix< Dimension, Superdimension >();
@@ -58,18 +59,19 @@ private:
    template< int Superdimension >
    struct SuperentitiesStorageWorker< Superdimension, false >
    {
-      static void exec( Mesh& mesh, const GlobalIndexArray& iperm ) {}
+      static void
+      exec( Mesh& mesh, const GlobalIndexArray& iperm )
+      {}
    };
 
-
    template< int Subdimension,
-             bool Enabled =
-                Mesh::MeshTraitsType::template SuperentityTraits< typename Mesh::template EntityType< Subdimension >::EntityTopology,
-                                                                  Dimension >::storageEnabled
-             >
+             bool Enabled = Mesh::MeshTraitsType::template SuperentityTraits<
+                typename Mesh::template EntityType< Subdimension >::EntityTopology,
+                Dimension >::storageEnabled >
    struct SubentitiesWorker
    {
-      static void exec( Mesh& mesh, const GlobalIndexArray& iperm )
+      static void
+      exec( Mesh& mesh, const GlobalIndexArray& iperm )
       {
          auto& superentitiesStorage = mesh.template getSuperentitiesMatrix< Subdimension, Dimension >();
          Matrices::permuteMatrixColumns( superentitiesStorage, iperm );
@@ -79,18 +81,19 @@ private:
    template< int Subdimension >
    struct SubentitiesWorker< Subdimension, false >
    {
-      static void exec( Mesh& mesh, const GlobalIndexArray& iperm ) {}
+      static void
+      exec( Mesh& mesh, const GlobalIndexArray& iperm )
+      {}
    };
 
-
    template< int Superdimension,
-             bool Enabled =
-                Mesh::MeshTraitsType::template SubentityTraits< typename Mesh::template EntityType< Superdimension >::EntityTopology,
-                                                                Dimension >::storageEnabled
-             >
+             bool Enabled = Mesh::MeshTraitsType::template SubentityTraits<
+                typename Mesh::template EntityType< Superdimension >::EntityTopology,
+                Dimension >::storageEnabled >
    struct SuperentitiesWorker
    {
-      static void exec( Mesh& mesh, const GlobalIndexArray& iperm )
+      static void
+      exec( Mesh& mesh, const GlobalIndexArray& iperm )
       {
          auto& subentitiesStorage = mesh.template getSubentitiesMatrix< Superdimension, Dimension >();
          Matrices::permuteMatrixColumns( subentitiesStorage, iperm );
@@ -100,12 +103,14 @@ private:
    template< int Superdimension >
    struct SuperentitiesWorker< Superdimension, false >
    {
-      static void exec( Mesh& mesh, const GlobalIndexArray& iperm ) {}
+      static void
+      exec( Mesh& mesh, const GlobalIndexArray& iperm )
+      {}
    };
 
-
    template< typename Mesh_, std::enable_if_t< Mesh_::Config::dualGraphStorage(), bool > = true >
-   static void permuteDualGraph( Mesh_& mesh, const GlobalIndexArray& perm, const GlobalIndexArray& iperm )
+   static void
+   permuteDualGraph( Mesh_& mesh, const GlobalIndexArray& perm, const GlobalIndexArray& iperm )
    {
       permuteArray( mesh.getNeighborCounts(), perm );
       auto& graph = mesh.getDualGraph();
@@ -114,11 +119,14 @@ private:
    }
 
    template< typename Mesh_, std::enable_if_t< ! Mesh_::Config::dualGraphStorage(), bool > = true >
-   static void permuteDualGraph( Mesh_& mesh, const GlobalIndexArray& perm, const GlobalIndexArray& iperm ) {}
+   static void
+   permuteDualGraph( Mesh_& mesh, const GlobalIndexArray& perm, const GlobalIndexArray& iperm )
+   {}
 
 public:
    template< typename ArrayOrView >
-   static void permuteArray( ArrayOrView& array, const GlobalIndexArray& perm )
+   static void
+   permuteArray( ArrayOrView& array, const GlobalIndexArray& perm )
    {
       using ValueType = typename ArrayOrView::ValueType;
       using IndexType = typename ArrayOrView::IndexType;
@@ -127,38 +135,24 @@ public:
       Containers::Array< ValueType, DeviceType, IndexType > buffer( array.getSize() );
 
       // kernel to copy values to new array, applying the permutation
-      auto kernel1 = [] __cuda_callable__
-         ( IndexType i,
-           const ValueType* array,
-           ValueType* buffer,
-           const IndexType* perm )
+      auto kernel1 = [] __cuda_callable__( IndexType i, const ValueType* array, ValueType* buffer, const IndexType* perm )
       {
          buffer[ i ] = array[ perm[ i ] ];
       };
 
       // kernel to copy permuted values back to the mesh
-      auto kernel2 = [] __cuda_callable__
-         ( IndexType i,
-           ValueType* array,
-           const ValueType* buffer )
+      auto kernel2 = [] __cuda_callable__( IndexType i, ValueType * array, const ValueType* buffer )
       {
          array[ i ] = buffer[ i ];
       };
 
-      Algorithms::ParallelFor< DeviceType >::exec( (IndexType) 0, array.getSize(),
-                                                   kernel1,
-                                                   array.getData(),
-                                                   buffer.getData(),
-                                                   perm.getData() );
-      Algorithms::ParallelFor< DeviceType >::exec( (IndexType) 0, array.getSize(),
-                                                   kernel2,
-                                                   array.getData(),
-                                                   buffer.getData() );
+      Algorithms::ParallelFor< DeviceType >::exec(
+         (IndexType) 0, array.getSize(), kernel1, array.getData(), buffer.getData(), perm.getData() );
+      Algorithms::ParallelFor< DeviceType >::exec( (IndexType) 0, array.getSize(), kernel2, array.getData(), buffer.getData() );
    }
 
-   static void exec( Mesh& mesh,
-                     const GlobalIndexArray& perm,
-                     const GlobalIndexArray& iperm )
+   static void
+   exec( Mesh& mesh, const GlobalIndexArray& perm, const GlobalIndexArray& iperm )
    {
       using IndexType = typename Mesh::GlobalIndexType;
       using DeviceType = typename Mesh::DeviceType;
@@ -168,31 +162,31 @@ public:
 
       // permute subentities storage
       Algorithms::staticFor< int, 0, Dimension >(
-         [&] ( auto dim ) {
+         [ & ]( auto dim )
+         {
             SubentitiesStorageWorker< dim >::exec( mesh, perm );
-         }
-      );
+         } );
 
       // permute superentities storage
       Algorithms::staticFor< int, Dimension + 1, Mesh::getMeshDimension() + 1 >(
-         [&] ( auto dim ) {
+         [ & ]( auto dim )
+         {
             SuperentitiesStorageWorker< dim >::exec( mesh, perm );
-         }
-      );
+         } );
 
       // update superentity indices from the subentities
       Algorithms::staticFor< int, 0, Dimension >(
-         [&] ( auto dim ) {
+         [ & ]( auto dim )
+         {
             SubentitiesWorker< dim >::exec( mesh, iperm );
-         }
-      );
+         } );
 
       // update subentity indices from the superentities
       Algorithms::staticFor< int, Dimension + 1, Mesh::getMeshDimension() + 1 >(
-         [&] ( auto dim ) {
+         [ & ]( auto dim )
+         {
             SuperentitiesWorker< dim >::exec( mesh, iperm );
-         }
-      );
+         } );
 
       if( Dimension == Mesh::getMeshDimension() ) {
          // permute dual graph
@@ -201,5 +195,5 @@ public:
    }
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/MeshDetails/initializer/EntityInitializer.h b/src/TNL/Meshes/MeshDetails/initializer/EntityInitializer.h
index b9f236101769c594434e7026d7a770bb319c38ef..74067d1489291ce7e12fe92221d475394c458ef0 100644
--- a/src/TNL/Meshes/MeshDetails/initializer/EntityInitializer.h
+++ b/src/TNL/Meshes/MeshDetails/initializer/EntityInitializer.h
@@ -26,7 +26,8 @@ class Initializer;
 template< typename MeshConfig,
           typename SubdimensionTag,
           typename SuperdimensionTag,
-          typename SuperentityTopology = typename MeshTraits< MeshConfig >::template EntityTraits< SuperdimensionTag::value >::EntityTopology,
+          typename SuperentityTopology =
+             typename MeshTraits< MeshConfig >::template EntityTraits< SuperdimensionTag::value >::EntityTopology,
           // storage in the superentity
           bool SubentityStorage = MeshConfig::subentityStorage( SuperdimensionTag::value, SubdimensionTag::value ),
           // storage in the subentity
@@ -38,158 +39,171 @@ class EntityInitializerLayer;
 template< typename MeshConfig,
           typename EntityTopology,
           bool SubvertexStorage = MeshConfig::subentityStorage( EntityTopology::dimension, 0 ) >
-class EntityInitializer
-   : public EntityInitializerLayer< MeshConfig,
-                                    DimensionTag< EntityTopology::dimension >,
-                                    DimensionTag< MeshTraits< MeshConfig >::meshDimension > >
+class EntityInitializer : public EntityInitializerLayer< MeshConfig,
+                                                         DimensionTag< EntityTopology::dimension >,
+                                                         DimensionTag< MeshTraits< MeshConfig >::meshDimension > >
 {
    using BaseType = EntityInitializerLayer< MeshConfig,
                                             DimensionTag< EntityTopology::dimension >,
                                             DimensionTag< MeshTraits< MeshConfig >::meshDimension > >;
 
-   using MeshTraitsType      = MeshTraits< MeshConfig >;
-   using EntityTraitsType    = typename MeshTraitsType::template EntityTraits< EntityTopology::dimension >;
-   using GlobalIndexType     = typename MeshTraitsType::GlobalIndexType;
-   using LocalIndexType      = typename MeshTraitsType::LocalIndexType;
+   using MeshTraitsType = MeshTraits< MeshConfig >;
+   using EntityTraitsType = typename MeshTraitsType::template EntityTraits< EntityTopology::dimension >;
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
 
-   using SeedType            = EntitySeed< MeshConfig, EntityTopology >;
-   using InitializerType     = Initializer< MeshConfig >;
+   using SeedType = EntitySeed< MeshConfig, EntityTopology >;
+   using InitializerType = Initializer< MeshConfig >;
    using NeighborCountsArray = typename MeshTraitsType::NeighborCountsArray;
-   using SeedMatrixType      = typename EntityTraitsType::SeedMatrixType;
+   using SeedMatrixType = typename EntityTraitsType::SeedMatrixType;
 
 public:
-   static void initSubvertexMatrix( NeighborCountsArray& capacities, InitializerType& initializer )
+   static void
+   initSubvertexMatrix( NeighborCountsArray& capacities, InitializerType& initializer )
    {
       initializer.template initSubentityMatrix< EntityTopology::dimension, 0 >( capacities );
    }
 
-   static void initSubvertexMatrix( SeedMatrixType& seeds, InitializerType& initializer )
+   static void
+   initSubvertexMatrix( SeedMatrixType& seeds, InitializerType& initializer )
    {
       auto& subvertexMatrix = initializer.template getSubentitiesMatrix< EntityTopology::dimension, 0 >();
       subvertexMatrix = std::move( seeds.getMatrix() );
       initializer.template initSubentitiesCounts< EntityTopology::dimension, 0 >( seeds.getEntityCornerCounts() );
    }
 
-   static void initEntity( const GlobalIndexType entityIndex, const SeedType& entitySeed, InitializerType& initializer )
+   static void
+   initEntity( const GlobalIndexType entityIndex, const SeedType& entitySeed, InitializerType& initializer )
    {
       // this is necessary if we want to use existing entities instead of intermediate seeds to create subentity seeds
       for( LocalIndexType i = 0; i < entitySeed.getCornerIds().getSize(); i++ )
-         initializer.template setSubentityIndex< EntityTopology::dimension, 0 >( entityIndex, i, entitySeed.getCornerIds()[ i ] );
+         initializer.template setSubentityIndex< EntityTopology::dimension, 0 >(
+            entityIndex, i, entitySeed.getCornerIds()[ i ] );
    }
 };
 
-template< typename MeshConfig,
-          typename EntityTopology >
+template< typename MeshConfig, typename EntityTopology >
 class EntityInitializer< MeshConfig, EntityTopology, false >
-   : public EntityInitializerLayer< MeshConfig,
-                                    DimensionTag< EntityTopology::dimension >,
-                                    DimensionTag< MeshTraits< MeshConfig >::meshDimension > >
+: public EntityInitializerLayer< MeshConfig,
+                                 DimensionTag< EntityTopology::dimension >,
+                                 DimensionTag< MeshTraits< MeshConfig >::meshDimension > >
 {
-   using MeshTraitsType   = MeshTraits< MeshConfig >;
-   using EntityTraitsType    = typename MeshTraitsType::template EntityTraits< EntityTopology::dimension >;
-   using GlobalIndexType  = typename MeshTraitsType::GlobalIndexType;
+   using MeshTraitsType = MeshTraits< MeshConfig >;
+   using EntityTraitsType = typename MeshTraitsType::template EntityTraits< EntityTopology::dimension >;
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
 
-   using SeedType         = EntitySeed< MeshConfig, EntityTopology >;
-   using InitializerType  = Initializer< MeshConfig >;
+   using SeedType = EntitySeed< MeshConfig, EntityTopology >;
+   using InitializerType = Initializer< MeshConfig >;
    using NeighborCountsArray = typename MeshTraitsType::NeighborCountsArray;
-   using SeedMatrixType      = typename EntityTraitsType::SeedMatrixType;
+   using SeedMatrixType = typename EntityTraitsType::SeedMatrixType;
+
 public:
-   static void initSubvertexMatrix( const NeighborCountsArray& capacities, InitializerType& initializer ) {}
-   static void initSubvertexMatrix( SeedMatrixType& seeds, InitializerType& initializer ) {}
-   static void initEntity( const GlobalIndexType entityIndex, const SeedType& entitySeed, InitializerType& initializer ) {}
+   static void
+   initSubvertexMatrix( const NeighborCountsArray& capacities, InitializerType& initializer )
+   {}
+   static void
+   initSubvertexMatrix( SeedMatrixType& seeds, InitializerType& initializer )
+   {}
+   static void
+   initEntity( const GlobalIndexType entityIndex, const SeedType& entitySeed, InitializerType& initializer )
+   {}
 };
 
-
 /****
  *       Mesh entity initializer layer with specializations
  *
  *  SUBENTITY STORAGE     SUPERENTITY STORAGE
  *      TRUE                    TRUE
  */
-template< typename MeshConfig,
-          typename SubdimensionTag,
-          typename SuperdimensionTag,
-          typename SuperentityTopology >
-class EntityInitializerLayer< MeshConfig,
-                              SubdimensionTag,
-                              SuperdimensionTag,
-                              SuperentityTopology,
-                              true,
-                              true,
-                              true >
-   : public EntityInitializerLayer< MeshConfig,
-                                    SubdimensionTag,
-                                    typename SuperdimensionTag::Decrement >
+template< typename MeshConfig, typename SubdimensionTag, typename SuperdimensionTag, typename SuperentityTopology >
+class EntityInitializerLayer< MeshConfig, SubdimensionTag, SuperdimensionTag, SuperentityTopology, true, true, true >
+: public EntityInitializerLayer< MeshConfig, SubdimensionTag, typename SuperdimensionTag::Decrement >
 {
-   using BaseType = EntityInitializerLayer< MeshConfig,
-                                            SubdimensionTag,
-                                            typename SuperdimensionTag::Decrement >;
-   using InitializerType            = Initializer< MeshConfig >;
-   using MeshType                   = typename InitializerType::MeshType;
-   using MeshTraitsType             = MeshTraits< MeshConfig >;
-
-   using GlobalIndexType            = typename MeshTraitsType::GlobalIndexType;
-   using LocalIndexType             = typename MeshTraitsType::LocalIndexType;
-   using SubentityTraitsType        = typename MeshTraitsType::template EntityTraits< SubdimensionTag::value >;
-   using SubentityTopology          = typename SubentityTraitsType::EntityTopology;
-   using SuperentityTraitsType      = typename MeshTraitsType::template EntityTraits< SuperdimensionTag::value >;
-   using SubentitySeedsCreatorType  = SubentitySeedsCreator< MeshConfig, SuperentityTopology, SubdimensionTag >;
-   using SuperentityMatrixType      = typename MeshTraitsType::SuperentityMatrixType;
-   using NeighborCountsArray        = typename MeshTraitsType::NeighborCountsArray;
-   using SeedType                   = EntitySeed< MeshConfig, SubentityTopology >;
+   using BaseType = EntityInitializerLayer< MeshConfig, SubdimensionTag, typename SuperdimensionTag::Decrement >;
+   using InitializerType = Initializer< MeshConfig >;
+   using MeshType = typename InitializerType::MeshType;
+   using MeshTraitsType = MeshTraits< MeshConfig >;
+
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
+   using SubentityTraitsType = typename MeshTraitsType::template EntityTraits< SubdimensionTag::value >;
+   using SubentityTopology = typename SubentityTraitsType::EntityTopology;
+   using SuperentityTraitsType = typename MeshTraitsType::template EntityTraits< SuperdimensionTag::value >;
+   using SubentitySeedsCreatorType = SubentitySeedsCreator< MeshConfig, SuperentityTopology, SubdimensionTag >;
+   using SuperentityMatrixType = typename MeshTraitsType::SuperentityMatrixType;
+   using NeighborCountsArray = typename MeshTraitsType::NeighborCountsArray;
+   using SeedType = EntitySeed< MeshConfig, SubentityTopology >;
 
 public:
-   static void initSuperentities( InitializerType& meshInitializer, MeshType& mesh )
+   static void
+   initSuperentities( InitializerType& meshInitializer, MeshType& mesh )
    {
-      //std::cout << "   Initiating superentities with dimension " << SuperdimensionTag::value << " for subentities with dimension " << SubdimensionTag::value << " ... " << std::endl;
+      // std::cout << "   Initiating superentities with dimension " << SuperdimensionTag::value << " for subentities with
+      // dimension " << SubdimensionTag::value << " ... " << std::endl;
 
       const GlobalIndexType subentitiesCount = mesh.template getEntitiesCount< SubdimensionTag::value >();
       const GlobalIndexType superentitiesCount = mesh.template getEntitiesCount< SuperdimensionTag::value >();
 
-      if( SubdimensionTag::value > 0 || std::is_same< SuperentityTopology, Topologies::Polyhedron >::value )
-      {
+      if( SubdimensionTag::value > 0 || std::is_same< SuperentityTopology, Topologies::Polyhedron >::value ) {
          NeighborCountsArray capacities( superentitiesCount );
 
-         Algorithms::ParallelFor< Devices::Host >::exec( GlobalIndexType{ 0 }, superentitiesCount, [&] ( GlobalIndexType superentityIndex )
-         {
-            capacities[ superentityIndex ] = SubentitySeedsCreatorType::getSubentitiesCount( meshInitializer, mesh, superentityIndex );
-         });
-
-         meshInitializer.template initSubentityMatrix< SuperdimensionTag::value, SubdimensionTag::value >( capacities, subentitiesCount );
+         Algorithms::ParallelFor< Devices::Host >::exec( GlobalIndexType{ 0 },
+                                                         superentitiesCount,
+                                                         [ & ]( GlobalIndexType superentityIndex )
+                                                         {
+                                                            capacities[ superentityIndex ] =
+                                                               SubentitySeedsCreatorType::getSubentitiesCount(
+                                                                  meshInitializer, mesh, superentityIndex );
+                                                         } );
+
+         meshInitializer.template initSubentityMatrix< SuperdimensionTag::value, SubdimensionTag::value >( capacities,
+                                                                                                           subentitiesCount );
       }
 
       // counter for superentities of each subentity
-      auto& superentitiesCounts = meshInitializer.template getSuperentitiesCountsArray< SubdimensionTag::value, SuperdimensionTag::value >();
+      auto& superentitiesCounts =
+         meshInitializer.template getSuperentitiesCountsArray< SubdimensionTag::value, SuperdimensionTag::value >();
       superentitiesCounts.setSize( subentitiesCount );
       superentitiesCounts.setValue( 0 );
 
-      Algorithms::ParallelFor< Devices::Host >::exec( GlobalIndexType{ 0 }, superentitiesCount, [&] ( GlobalIndexType superentityIndex )
-      {
-         LocalIndexType i = 0;
-         SubentitySeedsCreatorType::iterate( meshInitializer, mesh, superentityIndex, [&] ( SeedType& seed ) {
-            const GlobalIndexType subentityIndex = meshInitializer.findEntitySeedIndex( seed );
-
-            // Subentity indices for SubdimensionTag::value == 0 of non-polyhedral meshes were already set up from seeds
-            if( SubdimensionTag::value > 0 || std::is_same< SuperentityTopology, Topologies::Polyhedron >::value )
-               meshInitializer.template setSubentityIndex< SuperdimensionTag::value, SubdimensionTag::value >( superentityIndex, i++, subentityIndex );
-
-            Algorithms::AtomicOperations< Devices::Host >::add( superentitiesCounts[ subentityIndex ], LocalIndexType{ 1 } );
-         });
-      });
+      Algorithms::ParallelFor< Devices::Host >::exec(
+         GlobalIndexType{ 0 },
+         superentitiesCount,
+         [ & ]( GlobalIndexType superentityIndex )
+         {
+            LocalIndexType i = 0;
+            SubentitySeedsCreatorType::iterate(
+               meshInitializer,
+               mesh,
+               superentityIndex,
+               [ & ]( SeedType& seed )
+               {
+                  const GlobalIndexType subentityIndex = meshInitializer.findEntitySeedIndex( seed );
+
+                  // Subentity indices for SubdimensionTag::value == 0 of non-polyhedral meshes were already set up from seeds
+                  if( SubdimensionTag::value > 0 || std::is_same< SuperentityTopology, Topologies::Polyhedron >::value )
+                     meshInitializer.template setSubentityIndex< SuperdimensionTag::value, SubdimensionTag::value >(
+                        superentityIndex, i++, subentityIndex );
+
+                  Algorithms::AtomicOperations< Devices::Host >::add( superentitiesCounts[ subentityIndex ],
+                                                                      LocalIndexType{ 1 } );
+               } );
+         } );
 
       // allocate superentities storage
-      SuperentityMatrixType& matrix = meshInitializer.template getSuperentitiesMatrix< SubdimensionTag::value, SuperdimensionTag::value >();
+      SuperentityMatrixType& matrix =
+         meshInitializer.template getSuperentitiesMatrix< SubdimensionTag::value, SuperdimensionTag::value >();
       matrix.setDimensions( subentitiesCount, superentitiesCount );
       matrix.setRowCapacities( superentitiesCounts );
       superentitiesCounts.setValue( 0 );
 
-      for( GlobalIndexType superentityIndex = 0; superentityIndex < superentitiesCount; superentityIndex++ )
-      {
+      for( GlobalIndexType superentityIndex = 0; superentityIndex < superentitiesCount; superentityIndex++ ) {
          for( LocalIndexType i = 0;
               i < mesh.template getSubentitiesCount< SuperdimensionTag::value, SubdimensionTag::value >( superentityIndex );
               i++ )
          {
-            const GlobalIndexType subentityIndex = mesh.template getSubentityIndex< SuperdimensionTag::value, SubdimensionTag::value >( superentityIndex, i );
+            const GlobalIndexType subentityIndex =
+               mesh.template getSubentityIndex< SuperdimensionTag::value, SubdimensionTag::value >( superentityIndex, i );
             auto row = matrix.getRow( subentityIndex );
             row.setElement( superentitiesCounts[ subentityIndex ]++, superentityIndex, true );
          }
@@ -206,79 +220,73 @@ public:
  *      TRUE                    TRUE                  2                 3                POLYHEDRON
  */
 template< typename MeshConfig >
-class EntityInitializerLayer< MeshConfig,
-                              DimensionTag< 2 >,
-                              DimensionTag< 3 >,
-                              Topologies::Polyhedron,
-                              true,
-                              true,
-                              true >
-   : public EntityInitializerLayer< MeshConfig,
-                                    DimensionTag< 2 >,
-                                    typename DimensionTag< 3 >::Decrement >
+class EntityInitializerLayer< MeshConfig, DimensionTag< 2 >, DimensionTag< 3 >, Topologies::Polyhedron, true, true, true >
+: public EntityInitializerLayer< MeshConfig, DimensionTag< 2 >, typename DimensionTag< 3 >::Decrement >
 {
    using SubdimensionTag = DimensionTag< 2 >;
    using SuperdimensionTag = DimensionTag< 3 >;
 
-   using BaseType = EntityInitializerLayer< MeshConfig,
-                                            SubdimensionTag,
-                                            typename SuperdimensionTag::Decrement >;
-   using InitializerType            = Initializer< MeshConfig >;
-   using MeshType                   = typename InitializerType::MeshType;
-   using MeshTraitsType             = MeshTraits< MeshConfig >;
-
-   using GlobalIndexType            = typename MeshTraitsType::GlobalIndexType;
-   using LocalIndexType             = typename MeshTraitsType::LocalIndexType;
-   using SubentityTraitsType        = typename MeshTraitsType::template EntityTraits< SubdimensionTag::value >;
-   using SubentityTopology          = typename SubentityTraitsType::EntityTopology;
-   using SuperentityTraitsType      = typename MeshTraitsType::template EntityTraits< SuperdimensionTag::value >;
-   using SuperentityTopology        = typename SuperentityTraitsType::EntityTopology;
-   using SuperentityMatrixType      = typename MeshTraitsType::SuperentityMatrixType;
-   using NeighborCountsArray        = typename MeshTraitsType::NeighborCountsArray;
-   using SeedType                   = EntitySeed< MeshConfig, SubentityTopology >;
+   using BaseType = EntityInitializerLayer< MeshConfig, SubdimensionTag, typename SuperdimensionTag::Decrement >;
+   using InitializerType = Initializer< MeshConfig >;
+   using MeshType = typename InitializerType::MeshType;
+   using MeshTraitsType = MeshTraits< MeshConfig >;
+
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
+   using SubentityTraitsType = typename MeshTraitsType::template EntityTraits< SubdimensionTag::value >;
+   using SubentityTopology = typename SubentityTraitsType::EntityTopology;
+   using SuperentityTraitsType = typename MeshTraitsType::template EntityTraits< SuperdimensionTag::value >;
+   using SuperentityTopology = typename SuperentityTraitsType::EntityTopology;
+   using SuperentityMatrixType = typename MeshTraitsType::SuperentityMatrixType;
+   using NeighborCountsArray = typename MeshTraitsType::NeighborCountsArray;
+   using SeedType = EntitySeed< MeshConfig, SubentityTopology >;
 
 public:
-   static void initSuperentities( InitializerType& meshInitializer, MeshType& mesh )
+   static void
+   initSuperentities( InitializerType& meshInitializer, MeshType& mesh )
    {
-      //std::cout << "   Initiating superentities with dimension " << SuperdimensionTag::value << " for subentities with dimension " << SubdimensionTag::value << " ... " << std::endl;
+      // std::cout << "   Initiating superentities with dimension " << SuperdimensionTag::value << " for subentities with
+      // dimension " << SubdimensionTag::value << " ... " << std::endl;
 
       const GlobalIndexType subentitiesCount = mesh.template getEntitiesCount< SubdimensionTag::value >();
       const GlobalIndexType superentitiesCount = mesh.template getEntitiesCount< SuperdimensionTag::value >();
 
       // counter for superentities of each subentity
-      auto& superentitiesCounts = meshInitializer.template getSuperentitiesCountsArray< SubdimensionTag::value, SuperdimensionTag::value >();
+      auto& superentitiesCounts =
+         meshInitializer.template getSuperentitiesCountsArray< SubdimensionTag::value, SuperdimensionTag::value >();
       superentitiesCounts.setSize( subentitiesCount );
       superentitiesCounts.setValue( 0 );
 
       auto& cellSeeds = meshInitializer.getCellSeeds();
-      for( GlobalIndexType superentityIndex = 0; superentityIndex < superentitiesCount; superentityIndex++ )
-      {
+      for( GlobalIndexType superentityIndex = 0; superentityIndex < superentitiesCount; superentityIndex++ ) {
          const auto cellSeed = cellSeeds.getSeed( superentityIndex );
-         for( LocalIndexType i = 0; i < cellSeed.getCornersCount(); i++ )
-         {
+         for( LocalIndexType i = 0; i < cellSeed.getCornersCount(); i++ ) {
             const GlobalIndexType subentityIndex = cellSeed.getCornerId( i );
             superentitiesCounts[ subentityIndex ]++;
          }
       }
 
-      auto& subvertexMatrix = meshInitializer.template getSubentitiesMatrix< SuperdimensionTag::value, SubdimensionTag::value >();
+      auto& subvertexMatrix =
+         meshInitializer.template getSubentitiesMatrix< SuperdimensionTag::value, SubdimensionTag::value >();
       subvertexMatrix = std::move( cellSeeds.getMatrix() );
-      meshInitializer.template initSubentitiesCounts< SuperdimensionTag::value, SubdimensionTag::value >( cellSeeds.getEntityCornerCounts() );
+      meshInitializer.template initSubentitiesCounts< SuperdimensionTag::value, SubdimensionTag::value >(
+         cellSeeds.getEntityCornerCounts() );
 
       // allocate superentities storage
-      SuperentityMatrixType& matrix = meshInitializer.template getSuperentitiesMatrix< SubdimensionTag::value, SuperdimensionTag::value >();
+      SuperentityMatrixType& matrix =
+         meshInitializer.template getSuperentitiesMatrix< SubdimensionTag::value, SuperdimensionTag::value >();
       matrix.setDimensions( subentitiesCount, superentitiesCount );
       matrix.setRowCapacities( superentitiesCounts );
       superentitiesCounts.setValue( 0 );
 
       // initialize superentities storage
-      for( GlobalIndexType superentityIndex = 0; superentityIndex < superentitiesCount; superentityIndex++ )
-      {
+      for( GlobalIndexType superentityIndex = 0; superentityIndex < superentitiesCount; superentityIndex++ ) {
          for( LocalIndexType i = 0;
               i < mesh.template getSubentitiesCount< SuperdimensionTag::value, SubdimensionTag::value >( superentityIndex );
               i++ )
          {
-            const GlobalIndexType subentityIndex = mesh.template getSubentityIndex< SuperdimensionTag::value, SubdimensionTag::value >( superentityIndex, i );
+            const GlobalIndexType subentityIndex =
+               mesh.template getSubentityIndex< SuperdimensionTag::value, SubdimensionTag::value >( superentityIndex, i );
             auto row = matrix.getRow( subentityIndex );
             row.setElement( superentitiesCounts[ subentityIndex ]++, superentityIndex, true );
          }
@@ -294,64 +302,65 @@ public:
  *  SUBENTITY STORAGE     SUPERENTITY STORAGE
  *      TRUE                   FALSE
  */
-template< typename MeshConfig,
-          typename SubdimensionTag,
-          typename SuperdimensionTag,
-          typename SuperentityTopology >
-class EntityInitializerLayer< MeshConfig,
-                              SubdimensionTag,
-                              SuperdimensionTag,
-                              SuperentityTopology,
-                              true,
-                              false,
-                              true >
-   : public EntityInitializerLayer< MeshConfig,
-                                    SubdimensionTag,
-                                    typename SuperdimensionTag::Decrement >
+template< typename MeshConfig, typename SubdimensionTag, typename SuperdimensionTag, typename SuperentityTopology >
+class EntityInitializerLayer< MeshConfig, SubdimensionTag, SuperdimensionTag, SuperentityTopology, true, false, true >
+: public EntityInitializerLayer< MeshConfig, SubdimensionTag, typename SuperdimensionTag::Decrement >
 {
-   using BaseType = EntityInitializerLayer< MeshConfig,
-                                            SubdimensionTag,
-                                            typename SuperdimensionTag::Decrement >;
-   using InitializerType           = Initializer< MeshConfig >;
-   using MeshType                  = typename InitializerType::MeshType;
-   using MeshTraitsType            = MeshTraits< MeshConfig >;
-
-   using GlobalIndexType           = typename MeshTraitsType::GlobalIndexType;
-   using LocalIndexType            = typename MeshTraitsType::LocalIndexType;
-   using SubentityTraitsType        = typename MeshTraitsType::template EntityTraits< SubdimensionTag::value >;
-   using SubentityTopology          = typename SubentityTraitsType::EntityTopology;
-   using SuperentityTraitsType     = typename MeshTraitsType::template EntityTraits< SuperdimensionTag::value >;
+   using BaseType = EntityInitializerLayer< MeshConfig, SubdimensionTag, typename SuperdimensionTag::Decrement >;
+   using InitializerType = Initializer< MeshConfig >;
+   using MeshType = typename InitializerType::MeshType;
+   using MeshTraitsType = MeshTraits< MeshConfig >;
+
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
+   using SubentityTraitsType = typename MeshTraitsType::template EntityTraits< SubdimensionTag::value >;
+   using SubentityTopology = typename SubentityTraitsType::EntityTopology;
+   using SuperentityTraitsType = typename MeshTraitsType::template EntityTraits< SuperdimensionTag::value >;
    using SubentitySeedsCreatorType = SubentitySeedsCreator< MeshConfig, SuperentityTopology, SubdimensionTag >;
-   using NeighborCountsArray       = typename MeshTraitsType::NeighborCountsArray;
-   using SeedType                  = EntitySeed< MeshConfig, SubentityTopology >;
+   using NeighborCountsArray = typename MeshTraitsType::NeighborCountsArray;
+   using SeedType = EntitySeed< MeshConfig, SubentityTopology >;
 
 public:
-   static void initSuperentities( InitializerType& meshInitializer, MeshType& mesh )
+   static void
+   initSuperentities( InitializerType& meshInitializer, MeshType& mesh )
    {
-      //std::cout << "   Initiating superentities with dimension " << SuperdimensionTag::value << " for subentities with dimension " << SubdimensionTag::value << " ... " << std::endl;
+      // std::cout << "   Initiating superentities with dimension " << SuperdimensionTag::value << " for subentities with
+      // dimension " << SubdimensionTag::value << " ... " << std::endl;
 
       const GlobalIndexType subentitiesCount = mesh.template getEntitiesCount< SubdimensionTag::value >();
       const GlobalIndexType superentitiesCount = mesh.template getEntitiesCount< SuperdimensionTag::value >();
-      if( SubdimensionTag::value > 0 || std::is_same< SuperentityTopology, Topologies::Polyhedron >::value )
-      {
+      if( SubdimensionTag::value > 0 || std::is_same< SuperentityTopology, Topologies::Polyhedron >::value ) {
          NeighborCountsArray capacities( superentitiesCount );
 
-         Algorithms::ParallelFor< Devices::Host >::exec( GlobalIndexType{ 0 }, superentitiesCount, [&] ( GlobalIndexType superentityIndex )
-         {
-            capacities[ superentityIndex ] = SubentitySeedsCreatorType::getSubentitiesCount( meshInitializer, mesh, superentityIndex );
-         });
-
-         meshInitializer.template initSubentityMatrix< SuperdimensionTag::value, SubdimensionTag::value >( capacities, subentitiesCount );
-
-         Algorithms::ParallelFor< Devices::Host >::exec( GlobalIndexType{ 0 }, superentitiesCount, [&] ( GlobalIndexType superentityIndex )
-         {
-            LocalIndexType i = 0;
-            SubentitySeedsCreatorType::iterate( meshInitializer, mesh, superentityIndex, [&] ( SeedType& seed )
+         Algorithms::ParallelFor< Devices::Host >::exec( GlobalIndexType{ 0 },
+                                                         superentitiesCount,
+                                                         [ & ]( GlobalIndexType superentityIndex )
+                                                         {
+                                                            capacities[ superentityIndex ] =
+                                                               SubentitySeedsCreatorType::getSubentitiesCount(
+                                                                  meshInitializer, mesh, superentityIndex );
+                                                         } );
+
+         meshInitializer.template initSubentityMatrix< SuperdimensionTag::value, SubdimensionTag::value >( capacities,
+                                                                                                           subentitiesCount );
+
+         Algorithms::ParallelFor< Devices::Host >::exec(
+            GlobalIndexType{ 0 },
+            superentitiesCount,
+            [ & ]( GlobalIndexType superentityIndex )
             {
-               const GlobalIndexType subentityIndex = meshInitializer.findEntitySeedIndex( seed );
-               meshInitializer.template setSubentityIndex< SuperdimensionTag::value, SubdimensionTag::value >( superentityIndex, i++, subentityIndex );
-            });
-         });
+               LocalIndexType i = 0;
+               SubentitySeedsCreatorType::iterate(
+                  meshInitializer,
+                  mesh,
+                  superentityIndex,
+                  [ & ]( SeedType& seed )
+                  {
+                     const GlobalIndexType subentityIndex = meshInitializer.findEntitySeedIndex( seed );
+                     meshInitializer.template setSubentityIndex< SuperdimensionTag::value, SubdimensionTag::value >(
+                        superentityIndex, i++, subentityIndex );
+                  } );
+            } );
       }
 
       BaseType::initSuperentities( meshInitializer, mesh );
@@ -365,44 +374,38 @@ public:
  *      TRUE                   FALSE                   2                 3                POLYHEDRON
  */
 template< typename MeshConfig >
-class EntityInitializerLayer< MeshConfig,
-                              DimensionTag< 2 >,
-                              DimensionTag< 3 >,
-                              Topologies::Polyhedron,
-                              true,
-                              false,
-                              true >
-   : public EntityInitializerLayer< MeshConfig,
-                                    DimensionTag< 2 >,
-                                    typename DimensionTag< 3 >::Decrement >
+class EntityInitializerLayer< MeshConfig, DimensionTag< 2 >, DimensionTag< 3 >, Topologies::Polyhedron, true, false, true >
+: public EntityInitializerLayer< MeshConfig, DimensionTag< 2 >, typename DimensionTag< 3 >::Decrement >
 {
    using SubdimensionTag = DimensionTag< 2 >;
    using SuperdimensionTag = DimensionTag< 3 >;
 
-   using BaseType = EntityInitializerLayer< MeshConfig,
-                                            SubdimensionTag,
-                                            typename SuperdimensionTag::Decrement >;
-   using InitializerType           = Initializer< MeshConfig >;
-   using MeshType                  = typename InitializerType::MeshType;
-   using MeshTraitsType            = MeshTraits< MeshConfig >;
-
-   using GlobalIndexType           = typename MeshTraitsType::GlobalIndexType;
-   using LocalIndexType            = typename MeshTraitsType::LocalIndexType;
-   using SubentityTraitsType       = typename MeshTraitsType::template EntityTraits< SubdimensionTag::value >;
-   using SubentityTopology         = typename SubentityTraitsType::EntityTopology;
-   using SuperentityTraitsType     = typename MeshTraitsType::template EntityTraits< SuperdimensionTag::value >;
-   using SuperentityTopology       = typename SuperentityTraitsType::EntityTopology;
-   using NeighborCountsArray       = typename MeshTraitsType::NeighborCountsArray;
-   using SeedType                  = EntitySeed< MeshConfig, SubentityTopology >;
+   using BaseType = EntityInitializerLayer< MeshConfig, SubdimensionTag, typename SuperdimensionTag::Decrement >;
+   using InitializerType = Initializer< MeshConfig >;
+   using MeshType = typename InitializerType::MeshType;
+   using MeshTraitsType = MeshTraits< MeshConfig >;
+
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
+   using SubentityTraitsType = typename MeshTraitsType::template EntityTraits< SubdimensionTag::value >;
+   using SubentityTopology = typename SubentityTraitsType::EntityTopology;
+   using SuperentityTraitsType = typename MeshTraitsType::template EntityTraits< SuperdimensionTag::value >;
+   using SuperentityTopology = typename SuperentityTraitsType::EntityTopology;
+   using NeighborCountsArray = typename MeshTraitsType::NeighborCountsArray;
+   using SeedType = EntitySeed< MeshConfig, SubentityTopology >;
 
 public:
-   static void initSuperentities( InitializerType& meshInitializer, MeshType& mesh )
+   static void
+   initSuperentities( InitializerType& meshInitializer, MeshType& mesh )
    {
-      //std::cout << "   Initiating superentities with dimension " << SuperdimensionTag::value << " for subentities with dimension " << SubdimensionTag::value << " ... " << std::endl;
+      // std::cout << "   Initiating superentities with dimension " << SuperdimensionTag::value << " for subentities with
+      // dimension " << SubdimensionTag::value << " ... " << std::endl;
       auto& cellSeeds = meshInitializer.getCellSeeds();
-      auto& subvertexMatrix = meshInitializer.template getSubentitiesMatrix< SuperdimensionTag::value, SubdimensionTag::value >();
+      auto& subvertexMatrix =
+         meshInitializer.template getSubentitiesMatrix< SuperdimensionTag::value, SubdimensionTag::value >();
       subvertexMatrix = std::move( cellSeeds.getMatrix() );
-      meshInitializer.template initSubentitiesCounts< SuperdimensionTag::value, SubdimensionTag::value >( cellSeeds.getEntityCornerCounts() );
+      meshInitializer.template initSubentitiesCounts< SuperdimensionTag::value, SubdimensionTag::value >(
+         cellSeeds.getEntityCornerCounts() );
       BaseType::initSuperentities( meshInitializer, mesh );
    }
 };
@@ -413,76 +416,81 @@ public:
  *  SUBENTITY STORAGE     SUPERENTITY STORAGE
  *      FALSE                  TRUE
  */
-template< typename MeshConfig,
-          typename SubdimensionTag,
-          typename SuperdimensionTag,
-          typename SuperentityTopology >
-class EntityInitializerLayer< MeshConfig,
-                              SubdimensionTag,
-                              SuperdimensionTag,
-                              SuperentityTopology,
-                              false,
-                              true,
-                              true >
-   : public EntityInitializerLayer< MeshConfig,
-                                    SubdimensionTag,
-                                    typename SuperdimensionTag::Decrement >
+template< typename MeshConfig, typename SubdimensionTag, typename SuperdimensionTag, typename SuperentityTopology >
+class EntityInitializerLayer< MeshConfig, SubdimensionTag, SuperdimensionTag, SuperentityTopology, false, true, true >
+: public EntityInitializerLayer< MeshConfig, SubdimensionTag, typename SuperdimensionTag::Decrement >
 {
-   using BaseType = EntityInitializerLayer< MeshConfig,
-                                            SubdimensionTag,
-                                            typename SuperdimensionTag::Decrement >;
-   using InitializerType            = Initializer< MeshConfig >;
-   using MeshType                   = typename InitializerType::MeshType;
-   using MeshTraitsType             = MeshTraits< MeshConfig >;
-
-   using GlobalIndexType            = typename MeshTraitsType::GlobalIndexType;
-   using LocalIndexType             = typename MeshTraitsType::LocalIndexType;
-   using SubentityTraitsType        = typename MeshTraitsType::template EntityTraits< SubdimensionTag::value >;
-   using SubentityTopology          = typename SubentityTraitsType::EntityTopology;
-   using SuperentityTraitsType      = typename MeshTraitsType::template EntityTraits< SuperdimensionTag::value >;
-   using SubentitySeedsCreatorType  = SubentitySeedsCreator< MeshConfig, SuperentityTopology, SubdimensionTag >;
-   using SuperentityMatrixType      = typename MeshTraitsType::SuperentityMatrixType;
-   using SeedType                   = EntitySeed< MeshConfig, SubentityTopology >;
+   using BaseType = EntityInitializerLayer< MeshConfig, SubdimensionTag, typename SuperdimensionTag::Decrement >;
+   using InitializerType = Initializer< MeshConfig >;
+   using MeshType = typename InitializerType::MeshType;
+   using MeshTraitsType = MeshTraits< MeshConfig >;
+
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
+   using SubentityTraitsType = typename MeshTraitsType::template EntityTraits< SubdimensionTag::value >;
+   using SubentityTopology = typename SubentityTraitsType::EntityTopology;
+   using SuperentityTraitsType = typename MeshTraitsType::template EntityTraits< SuperdimensionTag::value >;
+   using SubentitySeedsCreatorType = SubentitySeedsCreator< MeshConfig, SuperentityTopology, SubdimensionTag >;
+   using SuperentityMatrixType = typename MeshTraitsType::SuperentityMatrixType;
+   using SeedType = EntitySeed< MeshConfig, SubentityTopology >;
 
 public:
-   static void initSuperentities( InitializerType& meshInitializer, MeshType& mesh )
+   static void
+   initSuperentities( InitializerType& meshInitializer, MeshType& mesh )
    {
-      //std::cout << "   Initiating superentities with dimension " << SuperdimensionTag::value << " for subentities with dimension " << SubdimensionTag::value << " ... " << std::endl;
+      // std::cout << "   Initiating superentities with dimension " << SuperdimensionTag::value << " for subentities with
+      // dimension " << SubdimensionTag::value << " ... " << std::endl;
 
       const GlobalIndexType subentitiesCount = mesh.template getEntitiesCount< SubdimensionTag::value >();
       const GlobalIndexType superentitiesCount = mesh.template getEntitiesCount< SuperdimensionTag::value >();
 
       // counter for superentities of each subentity
-      auto& superentitiesCounts = meshInitializer.template getSuperentitiesCountsArray< SubdimensionTag::value, SuperdimensionTag::value >();
+      auto& superentitiesCounts =
+         meshInitializer.template getSuperentitiesCountsArray< SubdimensionTag::value, SuperdimensionTag::value >();
       superentitiesCounts.setSize( subentitiesCount );
       superentitiesCounts.setValue( 0 );
 
-      Algorithms::ParallelFor< Devices::Host >::exec( GlobalIndexType{ 0 }, superentitiesCount, [&] ( GlobalIndexType superentityIndex )
-      {
-         SubentitySeedsCreatorType::iterate( meshInitializer, mesh, superentityIndex, [&] ( SeedType& seed ) {
-            const GlobalIndexType subentityIndex = meshInitializer.findEntitySeedIndex( seed );
-            Algorithms::AtomicOperations< Devices::Host >::add( superentitiesCounts[ subentityIndex ], LocalIndexType{ 1 } );
-         });
-      });
+      Algorithms::ParallelFor< Devices::Host >::exec( GlobalIndexType{ 0 },
+                                                      superentitiesCount,
+                                                      [ & ]( GlobalIndexType superentityIndex )
+                                                      {
+                                                         SubentitySeedsCreatorType::iterate(
+                                                            meshInitializer,
+                                                            mesh,
+                                                            superentityIndex,
+                                                            [ & ]( SeedType& seed )
+                                                            {
+                                                               const GlobalIndexType subentityIndex =
+                                                                  meshInitializer.findEntitySeedIndex( seed );
+                                                               Algorithms::AtomicOperations< Devices::Host >::add(
+                                                                  superentitiesCounts[ subentityIndex ], LocalIndexType{ 1 } );
+                                                            } );
+                                                      } );
 
       // allocate superentities storage
-      SuperentityMatrixType& matrix = meshInitializer.template getSuperentitiesMatrix< SubdimensionTag::value, SuperdimensionTag::value >();
+      SuperentityMatrixType& matrix =
+         meshInitializer.template getSuperentitiesMatrix< SubdimensionTag::value, SuperdimensionTag::value >();
       matrix.setDimensions( subentitiesCount, superentitiesCount );
       matrix.setRowCapacities( superentitiesCounts );
       superentitiesCounts.setValue( 0 );
 
       // initialize superentities storage
-      for( GlobalIndexType superentityIndex = 0; superentityIndex < superentitiesCount; superentityIndex++ )
-      {
-         SubentitySeedsCreatorType::iterate( meshInitializer, mesh, superentityIndex, [&] ( SeedType& seed ) {
-            const GlobalIndexType subentityIndex = meshInitializer.findEntitySeedIndex( seed );
-            auto row = matrix.getRow( subentityIndex );
-            row.setElement( superentitiesCounts[ subentityIndex ]++, superentityIndex, true );
-         });
+      for( GlobalIndexType superentityIndex = 0; superentityIndex < superentitiesCount; superentityIndex++ ) {
+         SubentitySeedsCreatorType::iterate(
+            meshInitializer,
+            mesh,
+            superentityIndex,
+            [ & ]( SeedType& seed )
+            {
+               const GlobalIndexType subentityIndex = meshInitializer.findEntitySeedIndex( seed );
+               auto row = matrix.getRow( subentityIndex );
+               row.setElement( superentitiesCounts[ subentityIndex ]++, superentityIndex, true );
+            } );
       }
 
       // Here is an attempt of parallelization of previous for cycle, that seemingly causes some kind of race condition
-      /*Algorithms::ParallelFor< Devices::Host >::exec( GlobalIndexType{ 0 }, superentitiesCount, [&] ( GlobalIndexType superentityIndex )
+      /*Algorithms::ParallelFor< Devices::Host >::exec( GlobalIndexType{ 0 }, superentitiesCount, [&] ( GlobalIndexType
+      superentityIndex )
       {
          SubentitySeedsCreatorType::iterate( meshInitializer, mesh, superentityIndex, [&] ( SeedType& seed ) {
             const GlobalIndexType subentityIndex = meshInitializer.findEntitySeedIndex( seed );
@@ -503,20 +511,9 @@ public:
    }
 };
 
-template< typename MeshConfig,
-          typename SubdimensionTag,
-          typename SuperdimensionTag,
-          typename SuperentityTopology >
-class EntityInitializerLayer< MeshConfig,
-                              SubdimensionTag,
-                              SuperdimensionTag,
-                              SuperentityTopology,
-                              false,
-                              false,
-                              true >
-   : public EntityInitializerLayer< MeshConfig,
-                                    SubdimensionTag,
-                                    typename SuperdimensionTag::Decrement >
+template< typename MeshConfig, typename SubdimensionTag, typename SuperdimensionTag, typename SuperentityTopology >
+class EntityInitializerLayer< MeshConfig, SubdimensionTag, SuperdimensionTag, SuperentityTopology, false, false, true >
+: public EntityInitializerLayer< MeshConfig, SubdimensionTag, typename SuperdimensionTag::Decrement >
 {};
 
 template< typename MeshConfig,
@@ -533,11 +530,13 @@ class EntityInitializerLayer< MeshConfig,
                               false >
 {
    using InitializerType = Initializer< MeshConfig >;
-   using MeshType        = typename InitializerType::MeshType;
+   using MeshType = typename InitializerType::MeshType;
 
 public:
-   static void initSuperentities( InitializerType& meshInitializer, MeshType& mesh ) {}
+   static void
+   initSuperentities( InitializerType& meshInitializer, MeshType& mesh )
+   {}
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/MeshDetails/initializer/EntitySeed.h b/src/TNL/Meshes/MeshDetails/initializer/EntitySeed.h
index 3b34c6895c6497f56b2d8eff256be53382eeb838..a05ed5853caed19e2d831b7286a5b186a942d292 100644
--- a/src/TNL/Meshes/MeshDetails/initializer/EntitySeed.h
+++ b/src/TNL/Meshes/MeshDetails/initializer/EntitySeed.h
@@ -25,49 +25,54 @@ struct EntitySeedHash;
 template< typename EntitySeed >
 struct EntitySeedEq;
 
-template< typename MeshConfig,
-          typename EntityTopology >
+template< typename MeshConfig, typename EntityTopology >
 class EntitySeed< MeshConfig, EntityTopology, false >
 {
    using MeshTraitsType = MeshTraits< MeshConfig >;
    using SubvertexTraits = typename MeshTraitsType::template SubentityTraits< EntityTopology, 0 >;
 
-   public:
-      using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
-      using LocalIndexType  = typename MeshTraitsType::LocalIndexType;
-      using IdArrayType     = Containers::StaticArray< SubvertexTraits::count, GlobalIndexType >;
-      using HashType        = EntitySeedHash< EntitySeed >;
-      using KeyEqual        = EntitySeedEq< EntitySeed >;
-
-      //this function is here only for compatibility with MeshReader
-      void setCornersCount( const LocalIndexType& cornersCount ) {}
-
-      static constexpr LocalIndexType getCornersCount()
-      {
-         return SubvertexTraits::count;
-      }
-
-      void setCornerId( const LocalIndexType& cornerIndex, const GlobalIndexType& pointIndex )
-      {
-         TNL_ASSERT_GE( cornerIndex, 0, "corner index must be non-negative" );
-         TNL_ASSERT_LT( cornerIndex, getCornersCount(), "corner index is out of bounds" );
-         TNL_ASSERT_GE( pointIndex, 0, "point index must be non-negative" );
-
-         this->cornerIds[ cornerIndex ] = pointIndex;
-      }
-
-      IdArrayType& getCornerIds()
-      {
-         return cornerIds;
-      }
-
-      const IdArrayType& getCornerIds() const
-      {
-         return cornerIds;
-      }
-
-   private:
-      IdArrayType cornerIds;
+public:
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
+   using IdArrayType = Containers::StaticArray< SubvertexTraits::count, GlobalIndexType >;
+   using HashType = EntitySeedHash< EntitySeed >;
+   using KeyEqual = EntitySeedEq< EntitySeed >;
+
+   // this function is here only for compatibility with MeshReader
+   void
+   setCornersCount( const LocalIndexType& cornersCount )
+   {}
+
+   static constexpr LocalIndexType
+   getCornersCount()
+   {
+      return SubvertexTraits::count;
+   }
+
+   void
+   setCornerId( const LocalIndexType& cornerIndex, const GlobalIndexType& pointIndex )
+   {
+      TNL_ASSERT_GE( cornerIndex, 0, "corner index must be non-negative" );
+      TNL_ASSERT_LT( cornerIndex, getCornersCount(), "corner index is out of bounds" );
+      TNL_ASSERT_GE( pointIndex, 0, "point index must be non-negative" );
+
+      this->cornerIds[ cornerIndex ] = pointIndex;
+   }
+
+   IdArrayType&
+   getCornerIds()
+   {
+      return cornerIds;
+   }
+
+   const IdArrayType&
+   getCornerIds() const
+   {
+      return cornerIds;
+   }
+
+private:
+   IdArrayType cornerIds;
 };
 
 template< typename MeshConfig >
@@ -75,65 +80,69 @@ class EntitySeed< MeshConfig, Topologies::Vertex, false >
 {
    using MeshTraitsType = MeshTraits< MeshConfig >;
 
-   public:
-      using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
-      using LocalIndexType  = typename MeshTraitsType::LocalIndexType;
-      using IdArrayType     = Containers::StaticArray< 1, GlobalIndexType >;
-      using HashType        = EntitySeedHash< EntitySeed >;
-      using KeyEqual        = EntitySeedEq< EntitySeed >;
-
-      //this function is here only for compatibility with MeshReader
-      void setCornersCount( const LocalIndexType& cornersCount ) {}
-
-      static constexpr LocalIndexType getCornersCount()
-      {
-         return 1;
-      }
-
-      void setCornerId( const LocalIndexType& cornerIndex, const GlobalIndexType& pointIndex )
-      {
-         TNL_ASSERT_EQ( cornerIndex, 0, "corner index must be 0" );
-         TNL_ASSERT_GE( pointIndex, 0, "point index must be non-negative" );
-
-         this->cornerIds[ cornerIndex ] = pointIndex;
-      }
-
-      IdArrayType& getCornerIds()
-      {
-         return cornerIds;
-      }
-
-      const IdArrayType& getCornerIds() const
-      {
-         return cornerIds;
-      }
-
-   private:
-      IdArrayType cornerIds;
+public:
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
+   using IdArrayType = Containers::StaticArray< 1, GlobalIndexType >;
+   using HashType = EntitySeedHash< EntitySeed >;
+   using KeyEqual = EntitySeedEq< EntitySeed >;
+
+   // this function is here only for compatibility with MeshReader
+   void
+   setCornersCount( const LocalIndexType& cornersCount )
+   {}
+
+   static constexpr LocalIndexType
+   getCornersCount()
+   {
+      return 1;
+   }
+
+   void
+   setCornerId( const LocalIndexType& cornerIndex, const GlobalIndexType& pointIndex )
+   {
+      TNL_ASSERT_EQ( cornerIndex, 0, "corner index must be 0" );
+      TNL_ASSERT_GE( pointIndex, 0, "point index must be non-negative" );
+
+      this->cornerIds[ cornerIndex ] = pointIndex;
+   }
+
+   IdArrayType&
+   getCornerIds()
+   {
+      return cornerIds;
+   }
+
+   const IdArrayType&
+   getCornerIds() const
+   {
+      return cornerIds;
+   }
+
+private:
+   IdArrayType cornerIds;
 };
 
-template< typename MeshConfig,
-          typename EntityTopology >
+template< typename MeshConfig, typename EntityTopology >
 class EntitySeed< MeshConfig, EntityTopology, true >
 {
    using MeshTraitsType = MeshTraits< MeshConfig >;
 
 public:
    using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
-   using LocalIndexType  = typename MeshTraitsType::LocalIndexType;
-   using IdArrayType     = Containers::Array< GlobalIndexType, Devices::Host, LocalIndexType >;
-   using HashType        = EntitySeedHash< EntitySeed >;
-   using KeyEqual        = EntitySeedEq< EntitySeed >;
-
-   // this constructor definition is here to avoid default constructor being implicitly declared as __host__ __device__, that causes warning:
-   // warning #20011-D: calling a __host__ function("std::allocator<int> ::allocator") 
-   // from a __host__ __device__ function("TNL::Meshes::EntitySeed< ::MeshTest::TestTwoWedgesMeshConfig,  
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
+   using IdArrayType = Containers::Array< GlobalIndexType, Devices::Host, LocalIndexType >;
+   using HashType = EntitySeedHash< EntitySeed >;
+   using KeyEqual = EntitySeedEq< EntitySeed >;
+
+   // this constructor definition is here to avoid default constructor being implicitly declared as __host__ __device__, that
+   // causes warning: warning #20011-D: calling a __host__ function("std::allocator<int> ::allocator") from a __host__
+   // __device__ function("TNL::Meshes::EntitySeed< ::MeshTest::TestTwoWedgesMeshConfig,
    // ::TNL::Meshes::Topologies::Polygon> ::EntitySeed [subobject]") is not allowed
-   EntitySeed()
-   {
-   }
+   EntitySeed() {}
 
-   void setCornersCount( const LocalIndexType& cornersCount )
+   void
+   setCornersCount( const LocalIndexType& cornersCount )
    {
       if( std::is_same< EntityTopology, Topologies::Polygon >::value )
          TNL_ASSERT_GE( cornersCount, 3, "polygons must have at least 3 corners" );
@@ -143,12 +152,14 @@ public:
       this->cornerIds.setSize( cornersCount );
    }
 
-   LocalIndexType getCornersCount() const
+   LocalIndexType
+   getCornersCount() const
    {
       return this->cornerIds.getSize();
    }
 
-   void setCornerId( const LocalIndexType& cornerIndex, const GlobalIndexType& pointIndex )
+   void
+   setCornerId( const LocalIndexType& cornerIndex, const GlobalIndexType& pointIndex )
    {
       TNL_ASSERT_GE( cornerIndex, 0, "corner index must be non-negative" );
       TNL_ASSERT_LT( cornerIndex, getCornersCount(), "corner index is out of bounds" );
@@ -157,12 +168,14 @@ public:
       this->cornerIds[ cornerIndex ] = pointIndex;
    }
 
-   IdArrayType& getCornerIds()
+   IdArrayType&
+   getCornerIds()
    {
       return cornerIds;
    }
 
-   const IdArrayType& getCornerIds() const
+   const IdArrayType&
+   getCornerIds() const
    {
       return cornerIds;
    }
@@ -172,7 +185,8 @@ private:
 };
 
 template< typename MeshConfig, typename EntityTopology >
-std::ostream& operator<<( std::ostream& str, const EntitySeed< MeshConfig, EntityTopology >& e )
+std::ostream&
+operator<<( std::ostream& str, const EntitySeed< MeshConfig, EntityTopology >& e )
 {
    str << e.getCornerIds();
    return str;
@@ -181,7 +195,8 @@ std::ostream& operator<<( std::ostream& str, const EntitySeed< MeshConfig, Entit
 template< typename EntitySeed >
 struct EntitySeedHash
 {
-   std::size_t operator()( const EntitySeed& seed ) const
+   std::size_t
+   operator()( const EntitySeed& seed ) const
    {
       using LocalIndexType = typename EntitySeed::LocalIndexType;
       using GlobalIndexType = typename EntitySeed::GlobalIndexType;
@@ -190,7 +205,7 @@ struct EntitySeedHash
       // because we *want* to ignore the order of the corner IDs.
       std::size_t hash = 0;
       for( LocalIndexType i = 0; i < seed.getCornersCount(); i++ )
-//         hash ^= std::hash< GlobalIndexType >{}( seed.getCornerIds()[ i ] );
+         //         hash ^= std::hash< GlobalIndexType >{}( seed.getCornerIds()[ i ] );
          hash += std::hash< GlobalIndexType >{}( seed.getCornerIds()[ i ] );
       return hash;
    }
@@ -199,14 +214,16 @@ struct EntitySeedHash
 template< typename EntitySeed >
 struct EntitySeedEq
 {
-   bool operator()( const EntitySeed& left, const EntitySeed& right ) const
+   bool
+   operator()( const EntitySeed& left, const EntitySeed& right ) const
    {
       using IdArrayType = typename EntitySeed::IdArrayType;
 
       IdArrayType sortedLeft( left.getCornerIds() );
       IdArrayType sortedRight( right.getCornerIds() );
 
-      //use std::sort for now, because polygon EntitySeeds use TNL::Containers::Array for cornersIds, that is missing sort function
+      // use std::sort for now, because polygon EntitySeeds use TNL::Containers::Array for cornersIds, that is missing sort
+      // function
       std::sort( sortedLeft.getData(), sortedLeft.getData() + sortedLeft.getSize() );
       std::sort( sortedRight.getData(), sortedRight.getData() + sortedRight.getSize() );
       /*sortedLeft.sort();
@@ -220,11 +237,12 @@ struct EntitySeedEq< EntitySeed< MeshConfig, Topologies::Vertex > >
 {
    using Seed = EntitySeed< MeshConfig, Topologies::Vertex >;
 
-   bool operator()( const Seed& left, const Seed& right ) const
+   bool
+   operator()( const Seed& left, const Seed& right ) const
    {
       return left.getCornerIds() == right.getCornerIds();
    }
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/MeshDetails/initializer/EntitySeedMatrix.h b/src/TNL/Meshes/MeshDetails/initializer/EntitySeedMatrix.h
index 5ffad457a7ea56d7fbbcb110f46b4cc181b865de..479f54c7b07a687463ebb7ed319f4f5555ead0c0 100644
--- a/src/TNL/Meshes/MeshDetails/initializer/EntitySeedMatrix.h
+++ b/src/TNL/Meshes/MeshDetails/initializer/EntitySeedMatrix.h
@@ -12,8 +12,7 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename MeshConfig,
-          typename Device>
+template< typename MeshConfig, typename Device >
 class MeshTraits;
 
 template< typename MeshConfig,
@@ -21,164 +20,180 @@ template< typename MeshConfig,
           bool IsDynamicTopology = Topologies::IsDynamicTopology< EntityTopology >::value >
 class EntitySeedMatrix;
 
-template< typename MeshConfig,
-          typename EntityTopology >
+template< typename MeshConfig, typename EntityTopology >
 class EntitySeedMatrix< MeshConfig, EntityTopology, false >
 {
    using MeshTraitsType = MeshTraits< MeshConfig, Devices::Host >;
 
-   public:
-      using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
-      using LocalIndexType  = typename MeshTraitsType::LocalIndexType;
-      using SubentityTraitsType = typename MeshTraitsType::template SubentityTraits< EntityTopology, 0 >;
-      using SubentityMatrixType = typename MeshTraitsType::template SubentityMatrixType< EntityTopology::dimension >;
-      using NeighborCountsArray = typename MeshTraitsType::NeighborCountsArray;
+public:
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
+   using SubentityTraitsType = typename MeshTraitsType::template SubentityTraits< EntityTopology, 0 >;
+   using SubentityMatrixType = typename MeshTraitsType::template SubentityMatrixType< EntityTopology::dimension >;
+   using NeighborCountsArray = typename MeshTraitsType::NeighborCountsArray;
 
-      EntitySeedMatrix() = default;
+   EntitySeedMatrix() = default;
 
-      EntitySeedMatrix( const EntitySeedMatrix& other ) = default;
+   EntitySeedMatrix( const EntitySeedMatrix& other ) = default;
 
-      EntitySeedMatrix( EntitySeedMatrix&& other ) = default;
+   EntitySeedMatrix( EntitySeedMatrix&& other ) = default;
 
-      EntitySeedMatrix& operator=( const EntitySeedMatrix& other ) = default;
+   EntitySeedMatrix&
+   operator=( const EntitySeedMatrix& other ) = default;
 
-      EntitySeedMatrix& operator=( EntitySeedMatrix&& other ) = default;
+   EntitySeedMatrix&
+   operator=( EntitySeedMatrix&& other ) = default;
 
-      class EntitySeedMatrixSeed
-      {
-         using RowView = typename SubentityMatrixType::RowView;
-
-         public:
-            EntitySeedMatrixSeed( const RowView& matrixRow )
-            : row( matrixRow )
-            {}
-
-            static constexpr LocalIndexType getCornersCount()
-            {
-               return SubentityTraitsType::count;
-            }
-
-            void setCornerId( const LocalIndexType& cornerIndex, const GlobalIndexType& pointIndex )
-            {
-               TNL_ASSERT_GE( cornerIndex, 0, "corner index must be non-negative" );
-               TNL_ASSERT_LT( cornerIndex, getCornersCount(), "corner index is out of bounds" );
-               TNL_ASSERT_GE( pointIndex, 0, "point index must be non-negative" );
-               this->row.setColumnIndex( cornerIndex, pointIndex );
-            }
-
-            template< typename... IndexTypes >
-            void setCornerIds( const IndexTypes&... pointIndices )
-            {
-               static_assert( sizeof...( pointIndices ) == getCornersCount(), "invalid number of indices" );
-               setCornerIds_impl( 0, pointIndices... );
-            }
-
-            GlobalIndexType getCornerId( const LocalIndexType& cornerIndex ) const
-            {
-               return this->row.getColumnIndex( cornerIndex );
-            }
-
-         private:
-            RowView row;
-
-            // empty overload to terminate recursion
-            void setCornerIds_impl( const LocalIndexType& cornerIndex )
-            {}
-
-            template< typename... IndexTypes >
-            void setCornerIds_impl( const LocalIndexType& cornerIndex, const GlobalIndexType& pointIndex, const IndexTypes&... pointIndices )
-            {
-               setCornerId( cornerIndex, pointIndex );
-               setCornerIds_impl( cornerIndex + 1, pointIndices... );
-            }
-      };
-
-      class ConstEntitySeedMatrixSeed
-      {
-         using ConstRowView = typename SubentityMatrixType::ConstRowView;
+   class EntitySeedMatrixSeed
+   {
+      using RowView = typename SubentityMatrixType::RowView;
 
-         public:
-            ConstEntitySeedMatrixSeed( const ConstRowView& matrixRow )
-            : row( matrixRow )
-            {}
-
-            static constexpr LocalIndexType getCornersCount()
-            {
-               return SubentityTraitsType::count;
-            }
-
-            GlobalIndexType getCornerId( const LocalIndexType& cornerIndex ) const
-            {
-               return this->row.getColumnIndex( cornerIndex );
-            }
-
-         private:
-            ConstRowView row;
-      };
+   public:
+      EntitySeedMatrixSeed( const RowView& matrixRow ) : row( matrixRow ) {}
 
-      void setDimensions( const GlobalIndexType& entitiesCount, const GlobalIndexType& pointsCount )
+      static constexpr LocalIndexType
+      getCornersCount()
       {
-         matrix.setDimensions( entitiesCount, pointsCount );
-
-         NeighborCountsArray capacities( entitiesCount );
-         capacities.setValue( SubentityTraitsType::count );
-         matrix.setRowCapacities( capacities );
+         return SubentityTraitsType::count;
       }
 
-      // This method is only here for compatibility with specialization for dynamic entity topologies
-      void setEntityCornersCounts( const NeighborCountsArray& counts )
+      void
+      setCornerId( const LocalIndexType& cornerIndex, const GlobalIndexType& pointIndex )
       {
+         TNL_ASSERT_GE( cornerIndex, 0, "corner index must be non-negative" );
+         TNL_ASSERT_LT( cornerIndex, getCornersCount(), "corner index is out of bounds" );
+         TNL_ASSERT_GE( pointIndex, 0, "point index must be non-negative" );
+         this->row.setColumnIndex( cornerIndex, pointIndex );
       }
 
-      // This method is only here for compatibility with specialization for dynamic entity topologies
-      void setEntityCornersCounts( NeighborCountsArray&& counts )
+      template< typename... IndexTypes >
+      void
+      setCornerIds( const IndexTypes&... pointIndices )
       {
+         static_assert( sizeof...( pointIndices ) == getCornersCount(), "invalid number of indices" );
+         setCornerIds_impl( 0, pointIndices... );
       }
 
-      void reset()
+      GlobalIndexType
+      getCornerId( const LocalIndexType& cornerIndex ) const
       {
-         matrix.reset();
+         return this->row.getColumnIndex( cornerIndex );
       }
 
-      GlobalIndexType getEntitiesCount() const
-      {
-         return matrix.getRows();
-      }
+   private:
+      RowView row;
 
-      SubentityMatrixType& getMatrix()
-      {
-         return matrix;
-      }
+      // empty overload to terminate recursion
+      void
+      setCornerIds_impl( const LocalIndexType& cornerIndex )
+      {}
 
-      const SubentityMatrixType& getMatrix() const
+      template< typename... IndexTypes >
+      void
+      setCornerIds_impl( const LocalIndexType& cornerIndex,
+                         const GlobalIndexType& pointIndex,
+                         const IndexTypes&... pointIndices )
       {
-         return matrix;
+         setCornerId( cornerIndex, pointIndex );
+         setCornerIds_impl( cornerIndex + 1, pointIndices... );
       }
+   };
 
-      NeighborCountsArray getEntityCornerCounts() const
-      {
-         NeighborCountsArray counts( getEntitiesCount() );
-         counts.setValue( SubentityTraitsType::count );
-         return counts;
-      }
+   class ConstEntitySeedMatrixSeed
+   {
+      using ConstRowView = typename SubentityMatrixType::ConstRowView;
 
-      bool empty() const
-      {
-         return getEntitiesCount() == 0;
-      }
+   public:
+      ConstEntitySeedMatrixSeed( const ConstRowView& matrixRow ) : row( matrixRow ) {}
 
-      EntitySeedMatrixSeed getSeed( const GlobalIndexType& entityIndex )
+      static constexpr LocalIndexType
+      getCornersCount()
       {
-         return EntitySeedMatrixSeed( matrix.getRow( entityIndex ) );
+         return SubentityTraitsType::count;
       }
 
-      ConstEntitySeedMatrixSeed getSeed( const GlobalIndexType& entityIndex ) const
+      GlobalIndexType
+      getCornerId( const LocalIndexType& cornerIndex ) const
       {
-         return ConstEntitySeedMatrixSeed( matrix.getRow( entityIndex ) );
+         return this->row.getColumnIndex( cornerIndex );
       }
 
    private:
-      SubentityMatrixType matrix;
+      ConstRowView row;
+   };
+
+   void
+   setDimensions( const GlobalIndexType& entitiesCount, const GlobalIndexType& pointsCount )
+   {
+      matrix.setDimensions( entitiesCount, pointsCount );
+
+      NeighborCountsArray capacities( entitiesCount );
+      capacities.setValue( SubentityTraitsType::count );
+      matrix.setRowCapacities( capacities );
+   }
+
+   // This method is only here for compatibility with specialization for dynamic entity topologies
+   void
+   setEntityCornersCounts( const NeighborCountsArray& counts )
+   {}
+
+   // This method is only here for compatibility with specialization for dynamic entity topologies
+   void
+   setEntityCornersCounts( NeighborCountsArray&& counts )
+   {}
+
+   void
+   reset()
+   {
+      matrix.reset();
+   }
+
+   GlobalIndexType
+   getEntitiesCount() const
+   {
+      return matrix.getRows();
+   }
+
+   SubentityMatrixType&
+   getMatrix()
+   {
+      return matrix;
+   }
+
+   const SubentityMatrixType&
+   getMatrix() const
+   {
+      return matrix;
+   }
+
+   NeighborCountsArray
+   getEntityCornerCounts() const
+   {
+      NeighborCountsArray counts( getEntitiesCount() );
+      counts.setValue( SubentityTraitsType::count );
+      return counts;
+   }
+
+   bool
+   empty() const
+   {
+      return getEntitiesCount() == 0;
+   }
+
+   EntitySeedMatrixSeed
+   getSeed( const GlobalIndexType& entityIndex )
+   {
+      return EntitySeedMatrixSeed( matrix.getRow( entityIndex ) );
+   }
+
+   ConstEntitySeedMatrixSeed
+   getSeed( const GlobalIndexType& entityIndex ) const
+   {
+      return ConstEntitySeedMatrixSeed( matrix.getRow( entityIndex ) );
+   }
+
+private:
+   SubentityMatrixType matrix;
 };
 
 template< typename MeshConfig >
@@ -186,289 +201,317 @@ class EntitySeedMatrix< MeshConfig, Topologies::Vertex, false >
 {
    using MeshTraitsType = MeshTraits< MeshConfig, Devices::Host >;
 
-   public:
-      using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
-      using LocalIndexType  = typename MeshTraitsType::LocalIndexType;
-      using SubentityMatrixType = typename MeshTraitsType::template SubentityMatrixType< 0 >;
-      using NeighborCountsArray = typename MeshTraitsType::NeighborCountsArray;
-
-      EntitySeedMatrix() = default;
+public:
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
+   using SubentityMatrixType = typename MeshTraitsType::template SubentityMatrixType< 0 >;
+   using NeighborCountsArray = typename MeshTraitsType::NeighborCountsArray;
 
-      EntitySeedMatrix( const EntitySeedMatrix& other ) = default;
+   EntitySeedMatrix() = default;
 
-      EntitySeedMatrix( EntitySeedMatrix&& other ) = default;
+   EntitySeedMatrix( const EntitySeedMatrix& other ) = default;
 
-      EntitySeedMatrix& operator=( const EntitySeedMatrix& other ) = default;
-
-      EntitySeedMatrix& operator=( EntitySeedMatrix&& other ) = default;
-
-      class EntitySeedMatrixSeed
-      {
-         using RowView = typename SubentityMatrixType::RowView;
-
-         public:
-            EntitySeedMatrixSeed( const RowView& matrixRow )
-            : row( matrixRow )
-            {}
-
-            static constexpr LocalIndexType getCornersCount()
-            {
-               return 1;
-            }
-
-            void setCornerId( const LocalIndexType& cornerIndex, const GlobalIndexType& pointIndex )
-            {
-               TNL_ASSERT_GE( cornerIndex, 0, "corner index must be non-negative" );
-               TNL_ASSERT_LT( cornerIndex, getCornersCount(), "corner index is out of bounds" );
-               TNL_ASSERT_GE( pointIndex, 0, "point index must be non-negative" );
-               this->row.setColumnIndex( cornerIndex, pointIndex );
-            }
-
-            GlobalIndexType getCornerId( const LocalIndexType& cornerIndex ) const
-            {
-               return this->row.getColumnIndex( cornerIndex );
-            }
-
-         private:
-            RowView row;
-      };
-
-      class ConstEntitySeedMatrixSeed
-      {
-         using ConstRowView = typename SubentityMatrixType::ConstRowView;
+   EntitySeedMatrix( EntitySeedMatrix&& other ) = default;
 
-         public:
-            ConstEntitySeedMatrixSeed( const ConstRowView& matrixRow )
-            : row( matrixRow )
-            {}
+   EntitySeedMatrix&
+   operator=( const EntitySeedMatrix& other ) = default;
 
-            static constexpr LocalIndexType getCornersCount()
-            {
-               return 1;
-            }
+   EntitySeedMatrix&
+   operator=( EntitySeedMatrix&& other ) = default;
 
-            GlobalIndexType getCornerId( const LocalIndexType& cornerIndex ) const
-            {
-               return this->row.getColumnIndex( cornerIndex );
-            }
-
-         private:
-            ConstRowView row;
-      };
-
-      void setDimensions( const GlobalIndexType& entitiesCount, const GlobalIndexType& pointsCount )
-      {
-         matrix.setDimensions( entitiesCount, pointsCount );
-
-         NeighborCountsArray capacities( entitiesCount );
-         capacities.setValue( 1 );
-         matrix.setRowCapacities( capacities );
-      }
-
-      // This method is only here for compatibility with specialization for dynamic entity topologies
-      void setEntityCornersCounts( const NeighborCountsArray& counts )
-      {
-      }
+   class EntitySeedMatrixSeed
+   {
+      using RowView = typename SubentityMatrixType::RowView;
 
-      // This method is only here for compatibility with specialization for dynamic entity topologies
-      void setEntityCornersCounts( NeighborCountsArray&& counts )
-      {
-      }
+   public:
+      EntitySeedMatrixSeed( const RowView& matrixRow ) : row( matrixRow ) {}
 
-      void reset()
+      static constexpr LocalIndexType
+      getCornersCount()
       {
-         matrix.reset();
+         return 1;
       }
 
-      GlobalIndexType getEntitiesCount() const
+      void
+      setCornerId( const LocalIndexType& cornerIndex, const GlobalIndexType& pointIndex )
       {
-         return matrix.getRows();
+         TNL_ASSERT_GE( cornerIndex, 0, "corner index must be non-negative" );
+         TNL_ASSERT_LT( cornerIndex, getCornersCount(), "corner index is out of bounds" );
+         TNL_ASSERT_GE( pointIndex, 0, "point index must be non-negative" );
+         this->row.setColumnIndex( cornerIndex, pointIndex );
       }
 
-      SubentityMatrixType& getMatrix()
+      GlobalIndexType
+      getCornerId( const LocalIndexType& cornerIndex ) const
       {
-         return matrix;
+         return this->row.getColumnIndex( cornerIndex );
       }
 
-      const SubentityMatrixType& getMatrix() const
-      {
-         return matrix;
-      }
+   private:
+      RowView row;
+   };
 
-      NeighborCountsArray getEntityCornerCounts() const
-      {
-         NeighborCountsArray counts( getEntitiesCount() );
-         counts.setValue( 1 );
-         return counts;
-      }
+   class ConstEntitySeedMatrixSeed
+   {
+      using ConstRowView = typename SubentityMatrixType::ConstRowView;
 
-      bool empty() const
-      {
-         return getEntitiesCount() == 0;
-      }
+   public:
+      ConstEntitySeedMatrixSeed( const ConstRowView& matrixRow ) : row( matrixRow ) {}
 
-      EntitySeedMatrixSeed getSeed( const GlobalIndexType& entityIndex )
+      static constexpr LocalIndexType
+      getCornersCount()
       {
-         return EntitySeedMatrixSeed( matrix.getRow( entityIndex ) );
+         return 1;
       }
 
-      ConstEntitySeedMatrixSeed getSeed( const GlobalIndexType& entityIndex ) const
+      GlobalIndexType
+      getCornerId( const LocalIndexType& cornerIndex ) const
       {
-         return ConstEntitySeedMatrixSeed( matrix.getRow( entityIndex ) );
+         return this->row.getColumnIndex( cornerIndex );
       }
 
    private:
-      SubentityMatrixType matrix;
+      ConstRowView row;
+   };
+
+   void
+   setDimensions( const GlobalIndexType& entitiesCount, const GlobalIndexType& pointsCount )
+   {
+      matrix.setDimensions( entitiesCount, pointsCount );
+
+      NeighborCountsArray capacities( entitiesCount );
+      capacities.setValue( 1 );
+      matrix.setRowCapacities( capacities );
+   }
+
+   // This method is only here for compatibility with specialization for dynamic entity topologies
+   void
+   setEntityCornersCounts( const NeighborCountsArray& counts )
+   {}
+
+   // This method is only here for compatibility with specialization for dynamic entity topologies
+   void
+   setEntityCornersCounts( NeighborCountsArray&& counts )
+   {}
+
+   void
+   reset()
+   {
+      matrix.reset();
+   }
+
+   GlobalIndexType
+   getEntitiesCount() const
+   {
+      return matrix.getRows();
+   }
+
+   SubentityMatrixType&
+   getMatrix()
+   {
+      return matrix;
+   }
+
+   const SubentityMatrixType&
+   getMatrix() const
+   {
+      return matrix;
+   }
+
+   NeighborCountsArray
+   getEntityCornerCounts() const
+   {
+      NeighborCountsArray counts( getEntitiesCount() );
+      counts.setValue( 1 );
+      return counts;
+   }
+
+   bool
+   empty() const
+   {
+      return getEntitiesCount() == 0;
+   }
+
+   EntitySeedMatrixSeed
+   getSeed( const GlobalIndexType& entityIndex )
+   {
+      return EntitySeedMatrixSeed( matrix.getRow( entityIndex ) );
+   }
+
+   ConstEntitySeedMatrixSeed
+   getSeed( const GlobalIndexType& entityIndex ) const
+   {
+      return ConstEntitySeedMatrixSeed( matrix.getRow( entityIndex ) );
+   }
+
+private:
+   SubentityMatrixType matrix;
 };
 
-template< typename MeshConfig,
-          typename EntityTopology >
+template< typename MeshConfig, typename EntityTopology >
 class EntitySeedMatrix< MeshConfig, EntityTopology, true >
 {
    using MeshTraitsType = MeshTraits< MeshConfig, Devices::Host >;
 
-   public:
-      using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
-      using LocalIndexType  = typename MeshTraitsType::LocalIndexType;
-      using SubentityMatrixType = typename MeshTraitsType::template SubentityMatrixType< EntityTopology::dimension >;
-      using NeighborCountsArray = typename MeshTraitsType::NeighborCountsArray;
-
-      EntitySeedMatrix() = default;
-
-      EntitySeedMatrix( const EntitySeedMatrix& other ) = default;
+public:
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
+   using SubentityMatrixType = typename MeshTraitsType::template SubentityMatrixType< EntityTopology::dimension >;
+   using NeighborCountsArray = typename MeshTraitsType::NeighborCountsArray;
 
-      EntitySeedMatrix( EntitySeedMatrix&& other ) = default;
+   EntitySeedMatrix() = default;
 
-      EntitySeedMatrix& operator=( const EntitySeedMatrix& other ) = default;
+   EntitySeedMatrix( const EntitySeedMatrix& other ) = default;
 
-      EntitySeedMatrix& operator=( EntitySeedMatrix&& other ) = default;
+   EntitySeedMatrix( EntitySeedMatrix&& other ) = default;
 
-      class EntitySeedMatrixSeed
-      {
-         using RowView = typename SubentityMatrixType::RowView;
-
-         public:
-            EntitySeedMatrixSeed( const RowView& matrixRow, const LocalIndexType& corners )
-            : row( matrixRow ),
-              cornersCount( corners )
-            {}
-
-            LocalIndexType getCornersCount() const
-            {
-               return cornersCount;
-            }
-
-            void setCornerId( const LocalIndexType& cornerIndex, const GlobalIndexType& pointIndex )
-            {
-               TNL_ASSERT_GE( cornerIndex, 0, "corner index must be non-negative" );
-               TNL_ASSERT_LT( cornerIndex, getCornersCount(), "corner index is out of bounds" );
-               TNL_ASSERT_GE( pointIndex, 0, "point index must be non-negative" );
-               this->row.setColumnIndex( cornerIndex, pointIndex );
-            }
-
-            GlobalIndexType getCornerId( const LocalIndexType& cornerIndex ) const
-            {
-               return this->row.getColumnIndex( cornerIndex );
-            }
-
-         private:
-            RowView row;
-            LocalIndexType cornersCount;
-      };
-
-      class ConstEntitySeedMatrixSeed
-      {
-         using ConstRowView = typename SubentityMatrixType::ConstRowView;
-
-         public:
-            ConstEntitySeedMatrixSeed( const ConstRowView& matrixRow, const LocalIndexType& corners )
-            : row( matrixRow ),
-              cornersCount( corners )
-            {}
-
-            LocalIndexType getCornersCount() const
-            {
-               return cornersCount;
-            }
-
-            GlobalIndexType getCornerId( const LocalIndexType& cornerIndex ) const
-            {
-               return this->row.getColumnIndex( cornerIndex );
-            }
-
-         private:
-            ConstRowView row;
-            LocalIndexType cornersCount;
-      };
-
-      void setDimensions( const GlobalIndexType& entitiesCount, const GlobalIndexType& pointsCount )
-      {
-         counts.setSize( entitiesCount );
-         matrix.setDimensions( entitiesCount, pointsCount );
-      }
+   EntitySeedMatrix&
+   operator=( const EntitySeedMatrix& other ) = default;
 
-      void setEntityCornersCounts( const NeighborCountsArray& counts_ )
-      {
-         this->counts = counts_;
-         matrix.setRowCapacities( this->counts );
-      }
+   EntitySeedMatrix&
+   operator=( EntitySeedMatrix&& other ) = default;
 
-      void setEntityCornersCounts( NeighborCountsArray&& counts_ )
-      {
-         this->counts = std::move( counts_ );
-         matrix.setRowCapacities( this->counts );
-      }
+   class EntitySeedMatrixSeed
+   {
+      using RowView = typename SubentityMatrixType::RowView;
 
-      void reset()
-      {
-         matrix.reset();
-         counts.reset();
-      }
+   public:
+      EntitySeedMatrixSeed( const RowView& matrixRow, const LocalIndexType& corners )
+      : row( matrixRow ), cornersCount( corners )
+      {}
 
-      GlobalIndexType getEntitiesCount() const
+      LocalIndexType
+      getCornersCount() const
       {
-         return matrix.getRows();
+         return cornersCount;
       }
 
-      SubentityMatrixType& getMatrix()
+      void
+      setCornerId( const LocalIndexType& cornerIndex, const GlobalIndexType& pointIndex )
       {
-         return matrix;
+         TNL_ASSERT_GE( cornerIndex, 0, "corner index must be non-negative" );
+         TNL_ASSERT_LT( cornerIndex, getCornersCount(), "corner index is out of bounds" );
+         TNL_ASSERT_GE( pointIndex, 0, "point index must be non-negative" );
+         this->row.setColumnIndex( cornerIndex, pointIndex );
       }
 
-      const SubentityMatrixType& getMatrix() const
+      GlobalIndexType
+      getCornerId( const LocalIndexType& cornerIndex ) const
       {
-         return matrix;
+         return this->row.getColumnIndex( cornerIndex );
       }
 
-      NeighborCountsArray& getEntityCornerCounts()
-      {
-         return counts;
-      }
+   private:
+      RowView row;
+      LocalIndexType cornersCount;
+   };
 
-      const NeighborCountsArray& getEntityCornerCounts() const
-      {
-         return counts;
-      }
+   class ConstEntitySeedMatrixSeed
+   {
+      using ConstRowView = typename SubentityMatrixType::ConstRowView;
 
-      bool empty() const
-      {
-         return getEntitiesCount() == 0;
-      }
+   public:
+      ConstEntitySeedMatrixSeed( const ConstRowView& matrixRow, const LocalIndexType& corners )
+      : row( matrixRow ), cornersCount( corners )
+      {}
 
-      EntitySeedMatrixSeed getSeed( const GlobalIndexType& entityIndex )
+      LocalIndexType
+      getCornersCount() const
       {
-         return EntitySeedMatrixSeed( matrix.getRow( entityIndex ), counts[ entityIndex ] );
+         return cornersCount;
       }
 
-      ConstEntitySeedMatrixSeed getSeed( const GlobalIndexType& entityIndex ) const
+      GlobalIndexType
+      getCornerId( const LocalIndexType& cornerIndex ) const
       {
-         return ConstEntitySeedMatrixSeed( matrix.getRow( entityIndex ), counts[ entityIndex ] );
+         return this->row.getColumnIndex( cornerIndex );
       }
 
    private:
-      SubentityMatrixType matrix;
-      NeighborCountsArray counts;
+      ConstRowView row;
+      LocalIndexType cornersCount;
+   };
+
+   void
+   setDimensions( const GlobalIndexType& entitiesCount, const GlobalIndexType& pointsCount )
+   {
+      counts.setSize( entitiesCount );
+      matrix.setDimensions( entitiesCount, pointsCount );
+   }
+
+   void
+   setEntityCornersCounts( const NeighborCountsArray& counts_ )
+   {
+      this->counts = counts_;
+      matrix.setRowCapacities( this->counts );
+   }
+
+   void
+   setEntityCornersCounts( NeighborCountsArray&& counts_ )
+   {
+      this->counts = std::move( counts_ );
+      matrix.setRowCapacities( this->counts );
+   }
+
+   void
+   reset()
+   {
+      matrix.reset();
+      counts.reset();
+   }
+
+   GlobalIndexType
+   getEntitiesCount() const
+   {
+      return matrix.getRows();
+   }
+
+   SubentityMatrixType&
+   getMatrix()
+   {
+      return matrix;
+   }
+
+   const SubentityMatrixType&
+   getMatrix() const
+   {
+      return matrix;
+   }
+
+   NeighborCountsArray&
+   getEntityCornerCounts()
+   {
+      return counts;
+   }
+
+   const NeighborCountsArray&
+   getEntityCornerCounts() const
+   {
+      return counts;
+   }
+
+   bool
+   empty() const
+   {
+      return getEntitiesCount() == 0;
+   }
+
+   EntitySeedMatrixSeed
+   getSeed( const GlobalIndexType& entityIndex )
+   {
+      return EntitySeedMatrixSeed( matrix.getRow( entityIndex ), counts[ entityIndex ] );
+   }
+
+   ConstEntitySeedMatrixSeed
+   getSeed( const GlobalIndexType& entityIndex ) const
+   {
+      return ConstEntitySeedMatrixSeed( matrix.getRow( entityIndex ), counts[ entityIndex ] );
+   }
+
+private:
+   SubentityMatrixType matrix;
+   NeighborCountsArray counts;
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/MeshDetails/initializer/Initializer.h b/src/TNL/Meshes/MeshDetails/initializer/Initializer.h
index 1db087e63bb46236b1506e9b70b9c1b6ae38de37..c82de3d460e7776c23bfed02b7b024d14a8d53fa 100644
--- a/src/TNL/Meshes/MeshDetails/initializer/Initializer.h
+++ b/src/TNL/Meshes/MeshDetails/initializer/Initializer.h
@@ -54,131 +54,130 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename MeshConfig,
-          typename DimensionTag >
+template< typename MeshConfig, typename DimensionTag >
 class InitializerLayer;
 
-
 template< typename MeshConfig >
-class Initializer
-   : public InitializerLayer< MeshConfig, typename MeshTraits< MeshConfig >::DimensionTag >
+class Initializer : public InitializerLayer< MeshConfig, typename MeshTraits< MeshConfig >::DimensionTag >
 {
-   protected:
-      // must be declared before its use in expression with decltype()
-      Mesh< MeshConfig >* mesh = nullptr;
-
-   public:
-      using MeshType          = Mesh< MeshConfig >;
-      using MeshTraitsType    = MeshTraits< MeshConfig >;
-      using DimensionTag      = Meshes::DimensionTag< MeshTraitsType::meshDimension >;
-      using BaseType          = InitializerLayer< MeshConfig, DimensionTag >;
-      using PointArrayType    = typename MeshTraitsType::PointArrayType;
-      using CellSeedMatrixType = typename MeshTraitsType::CellSeedMatrixType;
-      using FaceSeedMatrixType = typename MeshTraitsType::FaceSeedMatrixType;
-      using GlobalIndexType   = typename MeshTraitsType::GlobalIndexType;
-      using LocalIndexType    = typename MeshTraitsType::LocalIndexType;
-      using NeighborCountsArray = typename MeshTraitsType::NeighborCountsArray;
-
-      template< int Dimension, int Subdimension >
-      using SubentityMatrixRowsCapacitiesType = typename MeshTraitsType::template SubentityMatrixType< Dimension >::RowsCapacitiesType;
-
-      // The points and cellSeeds arrays will be reset when not needed to save memory.
-      void createMesh( PointArrayType& points,
-                       FaceSeedMatrixType& faceSeeds,
-                       CellSeedMatrixType& cellSeeds,
-                       MeshType& mesh )
-      {
-         // move points
-         mesh.template setEntitiesCount< 0 >( points.getSize() );
-         mesh.getPoints() = std::move( points );
-
-         this->mesh = &mesh;
-         this->cellSeeds = &cellSeeds;
-
-         if( faceSeeds.empty() )
-            BaseType::initEntities( *this, cellSeeds, mesh );
-         else
-         {
-            BaseType::initEntities( *this, faceSeeds, mesh );
-         }
-      }
-
-      template< int Dimension, int Subdimension >
-      void initSubentityMatrix( NeighborCountsArray& capacities, GlobalIndexType subentitiesCount = 0 )
-      {
-         if( Subdimension == 0 )
-            subentitiesCount = mesh->template getEntitiesCount< 0 >();
-         auto& matrix = mesh->template getSubentitiesMatrix< Dimension, Subdimension >();
-         matrix.setDimensions( capacities.getSize(), subentitiesCount );
-         matrix.setRowCapacities( capacities );
-         initSubentitiesCounts< Dimension, Subdimension >( capacities );
-      }
-
-      template< int Dimension, int Subdimension >
-      void initSubentitiesCounts( const NeighborCountsArray& capacities )
-      {
-         mesh->template setSubentitiesCounts< Dimension, Subdimension >( std::move( capacities ) );
-      }
-
-      template< int Dimension >
-      void setEntitiesCount( const GlobalIndexType entitiesCount )
-      {
-         mesh->template setEntitiesCount< Dimension >( entitiesCount );
-      }
-
-      template< int Dimension, int Subdimension >
-      void
-      setSubentityIndex( const GlobalIndexType entityIndex, const LocalIndexType localIndex, const GlobalIndexType globalIndex )
-      {
-         mesh->template getSubentitiesMatrix< Dimension, Subdimension >().getRow( entityIndex ).setElement( localIndex, globalIndex, true );
-      }
-
-      template< int Dimension >
-      auto
-      getSubvertices( const GlobalIndexType entityIndex )
-         -> decltype( this->mesh->template getSubentitiesMatrix< Dimension, 0 >().getRow( 0 ) )
-      {
-         return mesh->template getSubentitiesMatrix< Dimension, 0 >().getRow( entityIndex );
-      }
-
-      template< int Dimension >
-      auto
-      getSubverticesCount( const GlobalIndexType entityIndex )
-         -> decltype( this->mesh->template getSubentitiesCount< Dimension, 0 >( 0 ) )
-      {
-         return mesh->template getSubentitiesCount< Dimension, 0 >( entityIndex );
-      }
-
-      template< int Dimension, int Subdimension >
-      auto
-      getSubentitiesMatrix()
-         -> decltype( this->mesh->template getSubentitiesMatrix< Dimension, Subdimension >() )
-      {
-         return mesh->template getSubentitiesMatrix< Dimension, Subdimension >();
-      }
-
-      template< int Dimension, int Superdimension >
-      auto
-      getSuperentitiesCountsArray()
-         -> decltype( this->mesh->template getSuperentitiesCountsArray< Dimension, Superdimension >() )
-      {
-         return mesh->template getSuperentitiesCountsArray< Dimension, Superdimension >();
-      }
-
-      template< int Dimension, int Superdimension >
-      auto
-      getSuperentitiesMatrix()
-         -> decltype( this->mesh->template getSuperentitiesMatrix< Dimension, Superdimension >() )
-      {
-         return mesh->template getSuperentitiesMatrix< Dimension, Superdimension >();
+protected:
+   // must be declared before its use in expression with decltype()
+   Mesh< MeshConfig >* mesh = nullptr;
+
+public:
+   using MeshType = Mesh< MeshConfig >;
+   using MeshTraitsType = MeshTraits< MeshConfig >;
+   using DimensionTag = Meshes::DimensionTag< MeshTraitsType::meshDimension >;
+   using BaseType = InitializerLayer< MeshConfig, DimensionTag >;
+   using PointArrayType = typename MeshTraitsType::PointArrayType;
+   using CellSeedMatrixType = typename MeshTraitsType::CellSeedMatrixType;
+   using FaceSeedMatrixType = typename MeshTraitsType::FaceSeedMatrixType;
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
+   using NeighborCountsArray = typename MeshTraitsType::NeighborCountsArray;
+
+   template< int Dimension, int Subdimension >
+   using SubentityMatrixRowsCapacitiesType =
+      typename MeshTraitsType::template SubentityMatrixType< Dimension >::RowsCapacitiesType;
+
+   // The points and cellSeeds arrays will be reset when not needed to save memory.
+   void
+   createMesh( PointArrayType& points, FaceSeedMatrixType& faceSeeds, CellSeedMatrixType& cellSeeds, MeshType& mesh )
+   {
+      // move points
+      mesh.template setEntitiesCount< 0 >( points.getSize() );
+      mesh.getPoints() = std::move( points );
+
+      this->mesh = &mesh;
+      this->cellSeeds = &cellSeeds;
+
+      if( faceSeeds.empty() )
+         BaseType::initEntities( *this, cellSeeds, mesh );
+      else {
+         BaseType::initEntities( *this, faceSeeds, mesh );
       }
+   }
+
+   template< int Dimension, int Subdimension >
+   void
+   initSubentityMatrix( NeighborCountsArray& capacities, GlobalIndexType subentitiesCount = 0 )
+   {
+      if( Subdimension == 0 )
+         subentitiesCount = mesh->template getEntitiesCount< 0 >();
+      auto& matrix = mesh->template getSubentitiesMatrix< Dimension, Subdimension >();
+      matrix.setDimensions( capacities.getSize(), subentitiesCount );
+      matrix.setRowCapacities( capacities );
+      initSubentitiesCounts< Dimension, Subdimension >( capacities );
+   }
+
+   template< int Dimension, int Subdimension >
+   void
+   initSubentitiesCounts( const NeighborCountsArray& capacities )
+   {
+      mesh->template setSubentitiesCounts< Dimension, Subdimension >( std::move( capacities ) );
+   }
+
+   template< int Dimension >
+   void
+   setEntitiesCount( const GlobalIndexType entitiesCount )
+   {
+      mesh->template setEntitiesCount< Dimension >( entitiesCount );
+   }
+
+   template< int Dimension, int Subdimension >
+   void
+   setSubentityIndex( const GlobalIndexType entityIndex, const LocalIndexType localIndex, const GlobalIndexType globalIndex )
+   {
+      mesh->template getSubentitiesMatrix< Dimension, Subdimension >()
+         .getRow( entityIndex )
+         .setElement( localIndex, globalIndex, true );
+   }
+
+   template< int Dimension >
+   auto
+   getSubvertices( const GlobalIndexType entityIndex )
+      -> decltype( this->mesh->template getSubentitiesMatrix< Dimension, 0 >().getRow( 0 ) )
+   {
+      return mesh->template getSubentitiesMatrix< Dimension, 0 >().getRow( entityIndex );
+   }
+
+   template< int Dimension >
+   auto
+   getSubverticesCount( const GlobalIndexType entityIndex )
+      -> decltype( this->mesh->template getSubentitiesCount< Dimension, 0 >( 0 ) )
+   {
+      return mesh->template getSubentitiesCount< Dimension, 0 >( entityIndex );
+   }
+
+   template< int Dimension, int Subdimension >
+   auto
+   getSubentitiesMatrix() -> decltype( this->mesh->template getSubentitiesMatrix< Dimension, Subdimension >() )
+   {
+      return mesh->template getSubentitiesMatrix< Dimension, Subdimension >();
+   }
+
+   template< int Dimension, int Superdimension >
+   auto
+   getSuperentitiesCountsArray() -> decltype( this->mesh->template getSuperentitiesCountsArray< Dimension, Superdimension >() )
+   {
+      return mesh->template getSuperentitiesCountsArray< Dimension, Superdimension >();
+   }
+
+   template< int Dimension, int Superdimension >
+   auto
+   getSuperentitiesMatrix() -> decltype( this->mesh->template getSuperentitiesMatrix< Dimension, Superdimension >() )
+   {
+      return mesh->template getSuperentitiesMatrix< Dimension, Superdimension >();
+   }
+
+   CellSeedMatrixType&
+   getCellSeeds()
+   {
+      return *( this->cellSeeds );
+   }
 
-      CellSeedMatrixType& getCellSeeds()
-      {
-         return *(this->cellSeeds);
-      }
-   protected:
-      CellSeedMatrixType* cellSeeds = nullptr;
+protected:
+   CellSeedMatrixType* cellSeeds = nullptr;
 };
 
 /****
@@ -186,145 +185,150 @@ class Initializer
  */
 template< typename MeshConfig >
 class InitializerLayer< MeshConfig, typename MeshTraits< MeshConfig >::DimensionTag >
-   : public InitializerLayer< MeshConfig,
-                              typename MeshTraits< MeshConfig >::DimensionTag::Decrement >
+: public InitializerLayer< MeshConfig, typename MeshTraits< MeshConfig >::DimensionTag::Decrement >
 {
 protected:
-   using MeshTraitsType        = MeshTraits< MeshConfig >;
-   using DimensionTag          = typename MeshTraitsType::DimensionTag;
-   using BaseType              = InitializerLayer< MeshConfig, typename DimensionTag::Decrement >;
+   using MeshTraitsType = MeshTraits< MeshConfig >;
+   using DimensionTag = typename MeshTraitsType::DimensionTag;
+   using BaseType = InitializerLayer< MeshConfig, typename DimensionTag::Decrement >;
 
-   using MeshType              = Mesh< MeshConfig >;
-   using EntityTraitsType      = typename MeshTraitsType::template EntityTraits< DimensionTag::value >;
-   using EntityTopology        = typename EntityTraitsType::EntityTopology;
-   using GlobalIndexType       = typename MeshTraitsType::GlobalIndexType;
-   using LocalIndexType        = typename MeshTraitsType::LocalIndexType;
+   using MeshType = Mesh< MeshConfig >;
+   using EntityTraitsType = typename MeshTraitsType::template EntityTraits< DimensionTag::value >;
+   using EntityTopology = typename EntityTraitsType::EntityTopology;
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
 
-   using InitializerType       = Initializer< MeshConfig >;
+   using InitializerType = Initializer< MeshConfig >;
    using EntityInitializerType = EntityInitializer< MeshConfig, EntityTopology >;
-   using CellSeedMatrixType     = typename MeshTraitsType::CellSeedMatrixType;
-   using FaceSeedMatrixType    = typename MeshTraitsType::FaceSeedMatrixType;
-   using NeighborCountsArray   = typename MeshTraitsType::NeighborCountsArray;
-
-   public:
-
-      void initEntities( InitializerType& initializer, CellSeedMatrixType& cellSeeds, MeshType& mesh )
-      {
-         //std::cout << " Initiating entities with dimension " << DimensionTag::value << " ... " << std::endl;
-         initializer.template setEntitiesCount< DimensionTag::value >( cellSeeds.getEntitiesCount() );
-         EntityInitializerType::initSubvertexMatrix( cellSeeds, initializer );
-         BaseType::initEntities( initializer, mesh );
-      }
-
-      void initEntities( InitializerType& initializer, FaceSeedMatrixType& faceSeeds, MeshType& mesh )
-      {
-         //std::cout << " Initiating entities with dimension " << DimensionTag::value << " ... " << std::endl;
-         initializer.template setEntitiesCount< DimensionTag::value >( initializer.getCellSeeds().getEntitiesCount() );
-         BaseType::initEntities( initializer, faceSeeds, mesh );
-      }
-
-      using BaseType::findEntitySeedIndex;
+   using CellSeedMatrixType = typename MeshTraitsType::CellSeedMatrixType;
+   using FaceSeedMatrixType = typename MeshTraitsType::FaceSeedMatrixType;
+   using NeighborCountsArray = typename MeshTraitsType::NeighborCountsArray;
+
+public:
+   void
+   initEntities( InitializerType& initializer, CellSeedMatrixType& cellSeeds, MeshType& mesh )
+   {
+      // std::cout << " Initiating entities with dimension " << DimensionTag::value << " ... " << std::endl;
+      initializer.template setEntitiesCount< DimensionTag::value >( cellSeeds.getEntitiesCount() );
+      EntityInitializerType::initSubvertexMatrix( cellSeeds, initializer );
+      BaseType::initEntities( initializer, mesh );
+   }
+
+   void
+   initEntities( InitializerType& initializer, FaceSeedMatrixType& faceSeeds, MeshType& mesh )
+   {
+      // std::cout << " Initiating entities with dimension " << DimensionTag::value << " ... " << std::endl;
+      initializer.template setEntitiesCount< DimensionTag::value >( initializer.getCellSeeds().getEntitiesCount() );
+      BaseType::initEntities( initializer, faceSeeds, mesh );
+   }
+
+   using BaseType::findEntitySeedIndex;
 };
 
 /****
  * Mesh initializer layer for mesh entities other than cells
  */
-template< typename MeshConfig,
-          typename DimensionTag >
-class InitializerLayer
-   : public InitializerLayer< MeshConfig,
-                              typename DimensionTag::Decrement >
+template< typename MeshConfig, typename DimensionTag >
+class InitializerLayer : public InitializerLayer< MeshConfig, typename DimensionTag::Decrement >
 {
 protected:
-   using BaseType              = InitializerLayer< MeshConfig, typename DimensionTag::Decrement >;
-   using MeshType              = Mesh< MeshConfig >;
-   using MeshTraitsType        = MeshTraits< MeshConfig >;
+   using BaseType = InitializerLayer< MeshConfig, typename DimensionTag::Decrement >;
+   using MeshType = Mesh< MeshConfig >;
+   using MeshTraitsType = MeshTraits< MeshConfig >;
 
-   using EntityTraitsType      = typename MeshTraitsType::template EntityTraits< DimensionTag::value >;
-   using EntityTopology        = typename EntityTraitsType::EntityTopology;
-   using GlobalIndexType       = typename MeshTraitsType::GlobalIndexType;
-   using LocalIndexType        = typename MeshTraitsType::LocalIndexType;
+   using EntityTraitsType = typename MeshTraitsType::template EntityTraits< DimensionTag::value >;
+   using EntityTopology = typename EntityTraitsType::EntityTopology;
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
 
-   using InitializerType       = Initializer< MeshConfig >;
+   using InitializerType = Initializer< MeshConfig >;
    using EntityInitializerType = EntityInitializer< MeshConfig, EntityTopology >;
-   using SeedType              = EntitySeed< MeshConfig, EntityTopology >;
-   using SeedIndexedSet        = typename MeshTraits< MeshConfig >::template EntityTraits< DimensionTag::value >::SeedIndexedSetType;
-   using SeedMatrixType        = typename EntityTraitsType::SeedMatrixType;
-   using NeighborCountsArray   = typename MeshTraitsType::NeighborCountsArray;
-
-   public:
-
-      void createSeeds( InitializerType& initializer, MeshType& mesh )
-      {
-         this->seedsIndexedSet.reserve( mesh.template getEntitiesCount< MeshTraitsType::meshDimension >() );
-         using SubentitySeedsCreator = SubentitySeedsCreator< MeshConfig, typename MeshTraitsType::CellTopology, DimensionTag >;
-         for( GlobalIndexType i = 0; i < mesh.template getEntitiesCount< MeshType::getMeshDimension() >(); i++ ) {
-            SubentitySeedsCreator::iterate( initializer, mesh, i, [&] ( SeedType& seed ) {
-               this->seedsIndexedSet.insert( std::move( seed ) );
-            });
-         }
-      }
-
-      using BaseType::findEntitySeedIndex;
-      GlobalIndexType findEntitySeedIndex( const SeedType& seed ) const
-      {
-         GlobalIndexType index = -1;
-         this->seedsIndexedSet.find( seed, index );
-         return index;
+   using SeedType = EntitySeed< MeshConfig, EntityTopology >;
+   using SeedIndexedSet = typename MeshTraits< MeshConfig >::template EntityTraits< DimensionTag::value >::SeedIndexedSetType;
+   using SeedMatrixType = typename EntityTraitsType::SeedMatrixType;
+   using NeighborCountsArray = typename MeshTraitsType::NeighborCountsArray;
+
+public:
+   void
+   createSeeds( InitializerType& initializer, MeshType& mesh )
+   {
+      this->seedsIndexedSet.reserve( mesh.template getEntitiesCount< MeshTraitsType::meshDimension >() );
+      using SubentitySeedsCreator = SubentitySeedsCreator< MeshConfig, typename MeshTraitsType::CellTopology, DimensionTag >;
+      for( GlobalIndexType i = 0; i < mesh.template getEntitiesCount< MeshType::getMeshDimension() >(); i++ ) {
+         SubentitySeedsCreator::iterate( initializer,
+                                         mesh,
+                                         i,
+                                         [ & ]( SeedType& seed )
+                                         {
+                                            this->seedsIndexedSet.insert( std::move( seed ) );
+                                         } );
       }
-
-      void initEntities( InitializerType& initializer, MeshType& mesh )
-      {
-         // skip initialization of entities which do not store their subvertices
-         // (and hence do not participate in any other incidence matrix)
-         if( ! MeshConfig::subentityStorage( DimensionTag::value, 0 ) ) {
-            BaseType::initEntities( initializer, mesh );
-            return;
-         }
-         //std::cout << " Initiating entities with dimension " << DimensionTag::value << " ... " << std::endl;
-
-         // create seeds and set entities count
-         createSeeds( initializer, mesh );
-         const GlobalIndexType numberOfEntities = this->seedsIndexedSet.size();
-         initializer.template setEntitiesCount< DimensionTag::value >( numberOfEntities );
-
-         // allocate the subvertex matrix
-         NeighborCountsArray capacities( numberOfEntities );
-         for( auto& pair : this->seedsIndexedSet ) {
-            const auto& seed = pair.first;
-            const auto& entityIndex = pair.second;
-            capacities.setElement( entityIndex, seed.getCornersCount() );
-         }
-         EntityInitializerType::initSubvertexMatrix( capacities, initializer );
-
-         // initialize the entities
-         for( auto& pair : this->seedsIndexedSet ) {
-            const auto& seed = pair.first;
-            const auto& entityIndex = pair.second;
-            EntityInitializerType::initEntity( entityIndex, seed, initializer );
-         }
-
-         // initialize links between the entities and all superentities
-         EntityInitializerType::initSuperentities( initializer, mesh );
-
-         // deallocate the indexed set and continue with the next dimension
-         this->seedsIndexedSet.clear();
+   }
+
+   using BaseType::findEntitySeedIndex;
+   GlobalIndexType
+   findEntitySeedIndex( const SeedType& seed ) const
+   {
+      GlobalIndexType index = -1;
+      this->seedsIndexedSet.find( seed, index );
+      return index;
+   }
+
+   void
+   initEntities( InitializerType& initializer, MeshType& mesh )
+   {
+      // skip initialization of entities which do not store their subvertices
+      // (and hence do not participate in any other incidence matrix)
+      if( ! MeshConfig::subentityStorage( DimensionTag::value, 0 ) ) {
          BaseType::initEntities( initializer, mesh );
+         return;
+      }
+      // std::cout << " Initiating entities with dimension " << DimensionTag::value << " ... " << std::endl;
+
+      // create seeds and set entities count
+      createSeeds( initializer, mesh );
+      const GlobalIndexType numberOfEntities = this->seedsIndexedSet.size();
+      initializer.template setEntitiesCount< DimensionTag::value >( numberOfEntities );
+
+      // allocate the subvertex matrix
+      NeighborCountsArray capacities( numberOfEntities );
+      for( auto& pair : this->seedsIndexedSet ) {
+         const auto& seed = pair.first;
+         const auto& entityIndex = pair.second;
+         capacities.setElement( entityIndex, seed.getCornersCount() );
       }
+      EntityInitializerType::initSubvertexMatrix( capacities, initializer );
 
-      // This overload of initEntities is only called when face seeds are required for initialization.
-      // Currently only polyhedral meshes use this function.
-      void initEntities( InitializerType& initializer, SeedMatrixType& seeds, MeshType& mesh )
-      {
-         //std::cout << " Initiating entities with dimension " << DimensionTag::value << " ... " << std::endl;
-         initializer.template setEntitiesCount< DimensionTag::value >( seeds.getEntitiesCount() );
-         EntityInitializerType::initSubvertexMatrix( seeds, initializer );
-         EntityInitializerType::initSuperentities( initializer, mesh ); // initialize links between the entities and all superentities
-         BaseType::initEntities( initializer, mesh ); // continue with the next dimension
+      // initialize the entities
+      for( auto& pair : this->seedsIndexedSet ) {
+         const auto& seed = pair.first;
+         const auto& entityIndex = pair.second;
+         EntityInitializerType::initEntity( entityIndex, seed, initializer );
       }
 
-   private:
-      SeedIndexedSet seedsIndexedSet;
+      // initialize links between the entities and all superentities
+      EntityInitializerType::initSuperentities( initializer, mesh );
+
+      // deallocate the indexed set and continue with the next dimension
+      this->seedsIndexedSet.clear();
+      BaseType::initEntities( initializer, mesh );
+   }
+
+   // This overload of initEntities is only called when face seeds are required for initialization.
+   // Currently only polyhedral meshes use this function.
+   void
+   initEntities( InitializerType& initializer, SeedMatrixType& seeds, MeshType& mesh )
+   {
+      // std::cout << " Initiating entities with dimension " << DimensionTag::value << " ... " << std::endl;
+      initializer.template setEntitiesCount< DimensionTag::value >( seeds.getEntitiesCount() );
+      EntityInitializerType::initSubvertexMatrix( seeds, initializer );
+      EntityInitializerType::initSuperentities( initializer,
+                                                mesh );  // initialize links between the entities and all superentities
+      BaseType::initEntities( initializer, mesh );       // continue with the next dimension
+   }
+
+private:
+   SeedIndexedSet seedsIndexedSet;
 };
 
 /****
@@ -333,38 +337,39 @@ protected:
 template< typename MeshConfig >
 class InitializerLayer< MeshConfig, DimensionTag< 0 > >
 {
-   using MeshType              = Mesh< MeshConfig >;
-   using MeshTraitsType        = MeshTraits< MeshConfig >;
-   using DimensionTag          = Meshes::DimensionTag< 0 >;
+   using MeshType = Mesh< MeshConfig >;
+   using MeshTraitsType = MeshTraits< MeshConfig >;
+   using DimensionTag = Meshes::DimensionTag< 0 >;
 
-   using EntityTraitsType      = typename MeshTraitsType::template EntityTraits< DimensionTag::value >;
-   using EntityTopology        = typename EntityTraitsType::EntityTopology;
-   using GlobalIndexType       = typename MeshTraitsType::GlobalIndexType;
-   using LocalIndexType        = typename MeshTraitsType::LocalIndexType;
+   using EntityTraitsType = typename MeshTraitsType::template EntityTraits< DimensionTag::value >;
+   using EntityTopology = typename EntityTraitsType::EntityTopology;
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
 
-   using InitializerType       = Initializer< MeshConfig >;
+   using InitializerType = Initializer< MeshConfig >;
    using EntityInitializerType = EntityInitializer< MeshConfig, EntityTopology >;
-   using SeedType              = EntitySeed< MeshConfig, EntityTopology >;
-   using SeedMatrixType        = typename EntityTraitsType::SeedMatrixType;
-
-   public:
-
-      GlobalIndexType findEntitySeedIndex( const SeedType& seed )
-      {
-         return seed.getCornerIds()[ 0 ];
-      }
-
-      void initEntities( InitializerType& initializer, MeshType& mesh )
-      {
-         //std::cout << " Initiating entities with dimension " << DimensionTag::value << " ... " << std::endl;
-         EntityInitializerType::initSuperentities( initializer, mesh );
-      }
-
-      // This overload is only here for compatibility with Polyhedrons, it is never called
-      void initEntities( InitializerType& initializer, SeedMatrixType& faceSeeds, MeshType& mesh )
-      {
-      }
+   using SeedType = EntitySeed< MeshConfig, EntityTopology >;
+   using SeedMatrixType = typename EntityTraitsType::SeedMatrixType;
+
+public:
+   GlobalIndexType
+   findEntitySeedIndex( const SeedType& seed )
+   {
+      return seed.getCornerIds()[ 0 ];
+   }
+
+   void
+   initEntities( InitializerType& initializer, MeshType& mesh )
+   {
+      // std::cout << " Initiating entities with dimension " << DimensionTag::value << " ... " << std::endl;
+      EntityInitializerType::initSuperentities( initializer, mesh );
+   }
+
+   // This overload is only here for compatibility with Polyhedrons, it is never called
+   void
+   initEntities( InitializerType& initializer, SeedMatrixType& faceSeeds, MeshType& mesh )
+   {}
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/MeshDetails/initializer/SubentitySeedsCreator.h b/src/TNL/Meshes/MeshDetails/initializer/SubentitySeedsCreator.h
index 70dc4b42b85c975f26cfab0896f24c8ff485b6f6..4245d6ed634e058eaa081a8f37e4e1ea8d42138e 100644
--- a/src/TNL/Meshes/MeshDetails/initializer/SubentitySeedsCreator.h
+++ b/src/TNL/Meshes/MeshDetails/initializer/SubentitySeedsCreator.h
@@ -20,24 +20,22 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename MeshConfig,
-          typename EntityTopology,
-          typename SubentityDimensionTag >
+template< typename MeshConfig, typename EntityTopology, typename SubentityDimensionTag >
 class SubentitySeedsCreator
 {
-   using MeshType              = Mesh< MeshConfig >;
-   using MeshTraitsType        = MeshTraits< MeshConfig >;
-   using InitializerType       = Initializer< MeshConfig >;
-   using GlobalIndexType       = typename MeshTraitsType::GlobalIndexType;
-   using LocalIndexType        = typename MeshTraitsType::LocalIndexType;
-   using EntityTraitsType      = typename MeshTraitsType::template EntityTraits< EntityTopology::dimension >;
-   using SubentityTraits       = typename MeshTraitsType::template SubentityTraits< EntityTopology, SubentityDimensionTag::value >;
-   using SubentityTopology     = typename SubentityTraits::SubentityTopology;
-   
+   using MeshType = Mesh< MeshConfig >;
+   using MeshTraitsType = MeshTraits< MeshConfig >;
+   using InitializerType = Initializer< MeshConfig >;
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
+   using EntityTraitsType = typename MeshTraitsType::template EntityTraits< EntityTopology::dimension >;
+   using SubentityTraits = typename MeshTraitsType::template SubentityTraits< EntityTopology, SubentityDimensionTag::value >;
+   using SubentityTopology = typename SubentityTraits::SubentityTopology;
+
 public:
    using SubentitySeed = EntitySeed< MeshConfig, SubentityTopology >;
-   //using SubentitySeedArray = Containers::StaticArray< SubentityTraits::count, SubentitySeed >;
-   
+   // using SubentitySeedArray = Containers::StaticArray< SubentityTraits::count, SubentitySeed >;
+
    /*static SubentitySeedArray create( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex )
    {
       const auto& subvertices = mesh.template getSubentitiesMatrix< EntityTopology::dimension, 0 >().getRow( entityIndex );
@@ -45,14 +43,14 @@ public:
       SubentitySeedArray subentitySeeds;
       Algorithms::staticFor< LocalIndexType, 0, SubentitySeedArray::getSize() >(
          [&] ( auto subentityIndex ) {
-            constexpr LocalIndexType subentityVerticesCount = Topologies::SubentityVertexCount< EntityTopology, SubentityTopology, subentityIndex >::count;
-            auto& subentitySeed = subentitySeeds[ subentityIndex ];
+            constexpr LocalIndexType subentityVerticesCount = Topologies::SubentityVertexCount< EntityTopology,
+   SubentityTopology, subentityIndex >::count; auto& subentitySeed = subentitySeeds[ subentityIndex ];
             subentitySeed.setCornersCount( subentityVerticesCount );
             Algorithms::staticFor< LocalIndexType, 0, subentityVerticesCount >(
                [&] ( auto subentityVertexIndex ) {
                   // subentityIndex cannot be captured as constexpr, so we need to create another instance of its type
-                  static constexpr LocalIndexType VERTEX_INDEX = SubentityTraits::template Vertex< decltype(subentityIndex){}, subentityVertexIndex >::index;
-                  subentitySeed.setCornerId( subentityVertexIndex, subvertices.getColumnIndex( VERTEX_INDEX ) );
+                  static constexpr LocalIndexType VERTEX_INDEX = SubentityTraits::template Vertex< decltype(subentityIndex){},
+   subentityVertexIndex >::index; subentitySeed.setCornerId( subentityVertexIndex, subvertices.getColumnIndex( VERTEX_INDEX ) );
                }
             );
          }
@@ -62,45 +60,48 @@ public:
    }*/
 
    template< typename FunctorType >
-   static void iterate( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex, FunctorType&& functor )
+   static void
+   iterate( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex, FunctorType&& functor )
    {
       const auto& subvertices = mesh.template getSubentitiesMatrix< EntityTopology::dimension, 0 >().getRow( entityIndex );
 
       Algorithms::staticFor< LocalIndexType, 0, SubentityTraits::count >(
-         [&] ( auto subentityIndex ) {
-            constexpr LocalIndexType subentityVerticesCount = Topologies::SubentityVertexCount< EntityTopology, SubentityTopology, subentityIndex >::count;
+         [ & ]( auto subentityIndex )
+         {
+            constexpr LocalIndexType subentityVerticesCount =
+               Topologies::SubentityVertexCount< EntityTopology, SubentityTopology, subentityIndex >::count;
             SubentitySeed subentitySeed;
             subentitySeed.setCornersCount( subentityVerticesCount );
             Algorithms::staticFor< LocalIndexType, 0, subentityVerticesCount >(
-               [&] ( auto subentityVertexIndex ) {
+               [ & ]( auto subentityVertexIndex )
+               {
                   // subentityIndex cannot be captured as constexpr, so we need to create another instance of its type
-                  static constexpr LocalIndexType VERTEX_INDEX = SubentityTraits::template Vertex< decltype(subentityIndex){}, subentityVertexIndex >::index;
+                  static constexpr LocalIndexType VERTEX_INDEX =
+                     SubentityTraits::template Vertex< decltype( subentityIndex ){}, subentityVertexIndex >::index;
                   subentitySeed.setCornerId( subentityVertexIndex, subvertices.getColumnIndex( VERTEX_INDEX ) );
-               }
-            );
+               } );
             std::forward< FunctorType >( functor )( subentitySeed );
-         }
-      );
+         } );
    }
 
-   constexpr static LocalIndexType getSubentitiesCount( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex )
+   constexpr static LocalIndexType
+   getSubentitiesCount( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex )
    {
       return SubentityTraits::count;
    }
 };
 
-template< typename MeshConfig,
-          typename EntityTopology >
+template< typename MeshConfig, typename EntityTopology >
 class SubentitySeedsCreator< MeshConfig, EntityTopology, DimensionTag< 0 > >
 {
-   using MeshType              = Mesh< MeshConfig >;
-   using MeshTraitsType        = MeshTraits< MeshConfig >;
-   using InitializerType       = Initializer< MeshConfig >;
-   using GlobalIndexType       = typename MeshTraitsType::GlobalIndexType;
-   using LocalIndexType        = typename MeshTraitsType::LocalIndexType;
-   using EntityTraitsType      = typename MeshTraitsType::template EntityTraits< EntityTopology::dimension >;
-   using SubentityTraits       = typename MeshTraitsType::template SubentityTraits< EntityTopology, 0 >;
-   using SubentityTopology     = typename SubentityTraits::SubentityTopology;
+   using MeshType = Mesh< MeshConfig >;
+   using MeshTraitsType = MeshTraits< MeshConfig >;
+   using InitializerType = Initializer< MeshConfig >;
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
+   using EntityTraitsType = typename MeshTraitsType::template EntityTraits< EntityTopology::dimension >;
+   using SubentityTraits = typename MeshTraitsType::template SubentityTraits< EntityTopology, 0 >;
+   using SubentityTopology = typename SubentityTraits::SubentityTopology;
 
 public:
    using SubentitySeed = EntitySeed< MeshConfig, SubentityTopology >;
@@ -117,7 +118,8 @@ public:
    }*/
 
    template< typename FunctorType >
-   static void iterate( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex, FunctorType&& functor )
+   static void
+   iterate( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex, FunctorType&& functor )
    {
       const auto& subvertices = mesh.template getSubentitiesMatrix< EntityTopology::dimension, 0 >().getRow( entityIndex );
 
@@ -128,7 +130,8 @@ public:
       }
    }
 
-   constexpr static LocalIndexType getSubentitiesCount( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex )
+   constexpr static LocalIndexType
+   getSubentitiesCount( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex )
    {
       return SubentityTraits::count;
    }
@@ -137,36 +140,37 @@ public:
 template< typename MeshConfig >
 class SubentitySeedsCreator< MeshConfig, Topologies::Polygon, DimensionTag< 1 > >
 {
-   using MeshType              = Mesh< MeshConfig >;
-   using MeshTraitsType        = MeshTraits< MeshConfig >;
-   using InitializerType       = Initializer< MeshConfig >;
-   using DeviceType            = typename MeshTraitsType::DeviceType;
-   using GlobalIndexType       = typename MeshTraitsType::GlobalIndexType;
-   using LocalIndexType        = typename MeshTraitsType::LocalIndexType;
-   using EntityTopology        = Topologies::Polygon;
-   using EntityTraitsType      = typename MeshTraitsType::template EntityTraits< EntityTopology::dimension >;
-   using SubentityTraits       = typename MeshTraitsType::template SubentityTraits< EntityTopology, 1 >;
-   using SubentityTopology     = typename SubentityTraits::SubentityTopology;
+   using MeshType = Mesh< MeshConfig >;
+   using MeshTraitsType = MeshTraits< MeshConfig >;
+   using InitializerType = Initializer< MeshConfig >;
+   using DeviceType = typename MeshTraitsType::DeviceType;
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
+   using EntityTopology = Topologies::Polygon;
+   using EntityTraitsType = typename MeshTraitsType::template EntityTraits< EntityTopology::dimension >;
+   using SubentityTraits = typename MeshTraitsType::template SubentityTraits< EntityTopology, 1 >;
+   using SubentityTopology = typename SubentityTraits::SubentityTopology;
 
 public:
    using SubentitySeed = EntitySeed< MeshConfig, SubentityTopology >;
-   
+
    template< typename FunctorType >
-   static void iterate( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex, FunctorType&& functor )
+   static void
+   iterate( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex, FunctorType&& functor )
    {
       const auto& subvertices = mesh.template getSubentitiesMatrix< EntityTopology::dimension, 0 >().getRow( entityIndex );
       const LocalIndexType subverticesCount = mesh.template getSubentitiesCount< EntityTopology::dimension, 0 >( entityIndex );
 
-      for( LocalIndexType i = 0; i < subverticesCount; i++ )
-      {
+      for( LocalIndexType i = 0; i < subverticesCount; i++ ) {
          SubentitySeed seed;
          seed.setCornerId( 0, subvertices.getColumnIndex( i ) );
-         seed.setCornerId( 1, subvertices.getColumnIndex( (i + 1) % subverticesCount ) );
+         seed.setCornerId( 1, subvertices.getColumnIndex( ( i + 1 ) % subverticesCount ) );
          std::forward< FunctorType >( functor )( seed );
       }
    }
 
-   static LocalIndexType getSubentitiesCount( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex )
+   static LocalIndexType
+   getSubentitiesCount( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex )
    {
       return mesh.template getSubentitiesCount< EntityTopology::dimension, 0 >( entityIndex );
    }
@@ -175,22 +179,23 @@ public:
 template< typename MeshConfig >
 class SubentitySeedsCreator< MeshConfig, Topologies::Polygon, DimensionTag< 0 > >
 {
-   using MeshType              = Mesh< MeshConfig >;
-   using MeshTraitsType        = MeshTraits< MeshConfig >;
-   using InitializerType       = Initializer< MeshConfig >;
-   using DeviceType            = typename MeshTraitsType::DeviceType;
-   using GlobalIndexType       = typename MeshTraitsType::GlobalIndexType;
-   using LocalIndexType        = typename MeshTraitsType::LocalIndexType;
-   using EntityTopology        = Topologies::Polygon;
-   using EntityTraitsType      = typename MeshTraitsType::template EntityTraits< EntityTopology::dimension >;
-   using SubentityTraits       = typename MeshTraitsType::template SubentityTraits< EntityTopology, 0 >;
-   using SubentityTopology     = typename SubentityTraits::SubentityTopology;
+   using MeshType = Mesh< MeshConfig >;
+   using MeshTraitsType = MeshTraits< MeshConfig >;
+   using InitializerType = Initializer< MeshConfig >;
+   using DeviceType = typename MeshTraitsType::DeviceType;
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
+   using EntityTopology = Topologies::Polygon;
+   using EntityTraitsType = typename MeshTraitsType::template EntityTraits< EntityTopology::dimension >;
+   using SubentityTraits = typename MeshTraitsType::template SubentityTraits< EntityTopology, 0 >;
+   using SubentityTopology = typename SubentityTraits::SubentityTopology;
 
 public:
    using SubentitySeed = EntitySeed< MeshConfig, SubentityTopology >;
 
    template< typename FunctorType >
-   static void iterate( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex, FunctorType&& functor )
+   static void
+   iterate( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex, FunctorType&& functor )
    {
       const auto& subvertices = mesh.template getSubentitiesMatrix< EntityTopology::dimension, 0 >().getRow( entityIndex );
       const LocalIndexType subverticesCount = mesh.template getSubentitiesCount< EntityTopology::dimension, 0 >( entityIndex );
@@ -202,7 +207,8 @@ public:
       }
    }
 
-   static LocalIndexType getSubentitiesCount( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex )
+   static LocalIndexType
+   getSubentitiesCount( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex )
    {
       return mesh.template getSubentitiesCount< EntityTopology::dimension, 0 >( entityIndex );
    }
@@ -211,20 +217,22 @@ public:
 template< typename MeshConfig >
 class SubentitySeedsCreator< MeshConfig, Topologies::Polyhedron, DimensionTag< 2 > >
 {
-   using MeshType              = Mesh< MeshConfig >;
-   using MeshTraitsType        = MeshTraits< MeshConfig >;
-   using InitializerType       = Initializer< MeshConfig >;
-   using GlobalIndexType       = typename MeshTraitsType::GlobalIndexType;
-   using LocalIndexType       = typename MeshTraitsType::LocalIndexType;
+   using MeshType = Mesh< MeshConfig >;
+   using MeshTraitsType = MeshTraits< MeshConfig >;
+   using InitializerType = Initializer< MeshConfig >;
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
 
 public:
    template< typename FunctorType >
-   static void iterate( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex, FunctorType&& functor )
+   static void
+   iterate( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex, FunctorType&& functor )
    {
       throw std::logic_error{ "Subentities of dimension 2 for polyhedrons should be initialized from seeds." };
    }
 
-   static LocalIndexType getSubentitiesCount( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex )
+   static LocalIndexType
+   getSubentitiesCount( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex )
    {
       throw std::logic_error{ "Subentities of dimension 2 for polyhedrons should be initialized from seeds." };
    }
@@ -233,24 +241,25 @@ public:
 template< typename MeshConfig >
 class SubentitySeedsCreator< MeshConfig, Topologies::Polyhedron, DimensionTag< 1 > >
 {
-   using MeshType              = Mesh< MeshConfig >;
-   using MeshTraitsType        = MeshTraits< MeshConfig >;
-   using InitializerType       = Initializer< MeshConfig >;
-   using DeviceType            = typename MeshTraitsType::DeviceType;
-   using GlobalIndexType       = typename MeshTraitsType::GlobalIndexType;
-   using LocalIndexType        = typename MeshTraitsType::LocalIndexType;
-   using EntityTopology        = Topologies::Polyhedron;
-   using EntityTraitsType      = typename MeshTraitsType::template EntityTraits< EntityTopology::dimension >;
-   using SubentityTraits       = typename MeshTraitsType::template SubentityTraits< EntityTopology, 1 >;
-   using SubentityTopology     = typename SubentityTraits::SubentityTopology;
-   using SeedSet               = typename MeshTraitsType::template EntityTraits< 1 >::SeedSetType;
+   using MeshType = Mesh< MeshConfig >;
+   using MeshTraitsType = MeshTraits< MeshConfig >;
+   using InitializerType = Initializer< MeshConfig >;
+   using DeviceType = typename MeshTraitsType::DeviceType;
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
+   using EntityTopology = Topologies::Polyhedron;
+   using EntityTraitsType = typename MeshTraitsType::template EntityTraits< EntityTopology::dimension >;
+   using SubentityTraits = typename MeshTraitsType::template SubentityTraits< EntityTopology, 1 >;
+   using SubentityTopology = typename SubentityTraits::SubentityTopology;
+   using SeedSet = typename MeshTraitsType::template EntityTraits< 1 >::SeedSetType;
    using FaceSubentitySeedsCreator = SubentitySeedsCreator< MeshConfig, Topologies::Polygon, DimensionTag< 1 > >;
 
 public:
    using SubentitySeed = EntitySeed< MeshConfig, SubentityTopology >;
-   
+
    template< typename FunctorType >
-   static void iterate( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex, FunctorType&& functor )
+   static void
+   iterate( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex, FunctorType&& functor )
    {
       SeedSet seedSet;
       const auto& faces = mesh.template getSubentitiesMatrix< EntityTopology::dimension, 2 >().getRow( entityIndex );
@@ -258,24 +267,33 @@ public:
 
       for( LocalIndexType i = 0; i < facesCount; i++ ) {
          GlobalIndexType faceIdx = faces.getColumnIndex( i );
-         FaceSubentitySeedsCreator::iterate( initializer, mesh, faceIdx, [&] ( SubentitySeed& seed ) {
-            const bool inserted = seedSet.insert( seed ).second;
-            if( inserted )
-               std::forward< FunctorType >( functor )( seed );
-         });
+         FaceSubentitySeedsCreator::iterate( initializer,
+                                             mesh,
+                                             faceIdx,
+                                             [ & ]( SubentitySeed& seed )
+                                             {
+                                                const bool inserted = seedSet.insert( seed ).second;
+                                                if( inserted )
+                                                   std::forward< FunctorType >( functor )( seed );
+                                             } );
       }
    }
 
-   static LocalIndexType getSubentitiesCount( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex )
+   static LocalIndexType
+   getSubentitiesCount( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex )
    {
       SeedSet seedSet;
       const auto& faces = mesh.template getSubentitiesMatrix< EntityTopology::dimension, 2 >().getRow( entityIndex );
       const LocalIndexType facesCount = mesh.template getSubentitiesCount< EntityTopology::dimension, 2 >( entityIndex );
       for( LocalIndexType i = 0; i < facesCount; i++ ) {
          GlobalIndexType faceIdx = faces.getColumnIndex( i );
-         FaceSubentitySeedsCreator::iterate( initializer, mesh, faceIdx, [&] ( SubentitySeed& seed ) {
-            seedSet.insert( seed );
-         });
+         FaceSubentitySeedsCreator::iterate( initializer,
+                                             mesh,
+                                             faceIdx,
+                                             [ & ]( SubentitySeed& seed )
+                                             {
+                                                seedSet.insert( seed );
+                                             } );
       }
 
       return seedSet.size();
@@ -285,24 +303,25 @@ public:
 template< typename MeshConfig >
 class SubentitySeedsCreator< MeshConfig, Topologies::Polyhedron, DimensionTag< 0 > >
 {
-   using MeshType              = Mesh< MeshConfig >;
-   using MeshTraitsType        = MeshTraits< MeshConfig >;
-   using InitializerType       = Initializer< MeshConfig >;
-   using DeviceType            = typename MeshTraitsType::DeviceType;
-   using GlobalIndexType       = typename MeshTraitsType::GlobalIndexType;
-   using LocalIndexType        = typename MeshTraitsType::LocalIndexType;
-   using EntityTopology        = Topologies::Polyhedron;
-   using EntityTraitsType      = typename MeshTraitsType::template EntityTraits< EntityTopology::dimension >;
-   using SubentityTraits       = typename MeshTraitsType::template SubentityTraits< EntityTopology, 0 >;
-   using SubentityTopology     = typename SubentityTraits::SubentityTopology;
-   using SeedSet               = typename MeshTraitsType::template EntityTraits< 0 >::SeedSetType;
+   using MeshType = Mesh< MeshConfig >;
+   using MeshTraitsType = MeshTraits< MeshConfig >;
+   using InitializerType = Initializer< MeshConfig >;
+   using DeviceType = typename MeshTraitsType::DeviceType;
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
+   using EntityTopology = Topologies::Polyhedron;
+   using EntityTraitsType = typename MeshTraitsType::template EntityTraits< EntityTopology::dimension >;
+   using SubentityTraits = typename MeshTraitsType::template SubentityTraits< EntityTopology, 0 >;
+   using SubentityTopology = typename SubentityTraits::SubentityTopology;
+   using SeedSet = typename MeshTraitsType::template EntityTraits< 0 >::SeedSetType;
    using FaceSubentitySeedsCreator = SubentitySeedsCreator< MeshConfig, Topologies::Polygon, DimensionTag< 0 > >;
 
 public:
    using SubentitySeed = EntitySeed< MeshConfig, SubentityTopology >;
-   
+
    template< typename FunctorType >
-   static void iterate( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex, FunctorType&& functor )
+   static void
+   iterate( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex, FunctorType&& functor )
    {
       SeedSet seedSet;
       const auto& faces = mesh.template getSubentitiesMatrix< EntityTopology::dimension, 2 >().getRow( entityIndex );
@@ -310,15 +329,20 @@ public:
 
       for( LocalIndexType i = 0; i < facesCount; i++ ) {
          GlobalIndexType faceIdx = faces.getColumnIndex( i );
-         FaceSubentitySeedsCreator::iterate( initializer, mesh, faceIdx, [&] ( SubentitySeed& seed ) {
-            const bool inserted = seedSet.insert( seed ).second;
-            if( inserted )
-               std::forward< FunctorType >( functor )( seed );
-         });
+         FaceSubentitySeedsCreator::iterate( initializer,
+                                             mesh,
+                                             faceIdx,
+                                             [ & ]( SubentitySeed& seed )
+                                             {
+                                                const bool inserted = seedSet.insert( seed ).second;
+                                                if( inserted )
+                                                   std::forward< FunctorType >( functor )( seed );
+                                             } );
       }
    }
 
-   static LocalIndexType getSubentitiesCount( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex )
+   static LocalIndexType
+   getSubentitiesCount( InitializerType& initializer, MeshType& mesh, const GlobalIndexType entityIndex )
    {
       SeedSet seedSet;
       const auto& faces = mesh.template getSubentitiesMatrix< EntityTopology::dimension, 2 >().getRow( entityIndex );
@@ -326,14 +350,18 @@ public:
 
       for( LocalIndexType i = 0; i < facesCount; i++ ) {
          GlobalIndexType faceIdx = faces.getColumnIndex( i );
-         FaceSubentitySeedsCreator::iterate( initializer, mesh, faceIdx, [&] ( SubentitySeed& seed ) {
-            seedSet.insert( seed );
-         });
+         FaceSubentitySeedsCreator::iterate( initializer,
+                                             mesh,
+                                             faceIdx,
+                                             [ & ]( SubentitySeed& seed )
+                                             {
+                                                seedSet.insert( seed );
+                                             } );
       }
 
       return seedSet.size();
    }
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/MeshDetails/layers/DualGraphLayer.h b/src/TNL/Meshes/MeshDetails/layers/DualGraphLayer.h
index 1721075dfd40822f0502f337f64803415ae720bf..0883f6dd996e62fd202986fce7de362882dbc130 100644
--- a/src/TNL/Meshes/MeshDetails/layers/DualGraphLayer.h
+++ b/src/TNL/Meshes/MeshDetails/layers/DualGraphLayer.h
@@ -13,9 +13,7 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename MeshConfig,
-          typename Device,
-          bool enabled = MeshConfig::dualGraphStorage() >
+template< typename MeshConfig, typename Device, bool enabled = MeshConfig::dualGraphStorage() >
 class DualGraphLayer
 {
 public:
@@ -37,56 +35,63 @@ public:
       operator=( other );
    }
 
-   DualGraphLayer& operator=( const DualGraphLayer& ) = default;
+   DualGraphLayer&
+   operator=( const DualGraphLayer& ) = default;
 
-   DualGraphLayer& operator=( DualGraphLayer&& ) = default;
+   DualGraphLayer&
+   operator=( DualGraphLayer&& ) = default;
 
    template< typename Device_ >
-   DualGraphLayer& operator=( const DualGraphLayer< MeshConfig, Device_ >& other )
+   DualGraphLayer&
+   operator=( const DualGraphLayer< MeshConfig, Device_ >& other )
    {
       neighborCounts = other.getNeighborCounts();
       graph = other.getDualGraph();
       return *this;
    }
 
-   bool operator==( const DualGraphLayer& other ) const
+   bool
+   operator==( const DualGraphLayer& other ) const
    {
-      return neighborCounts == other.getNeighborCounts() &&
-             graph == other.getDualGraph();
+      return neighborCounts == other.getNeighborCounts() && graph == other.getDualGraph();
    }
 
    __cuda_callable__
-   const NeighborCountsArray& getNeighborCounts() const
+   const NeighborCountsArray&
+   getNeighborCounts() const
    {
       return neighborCounts;
    }
 
    __cuda_callable__
-   NeighborCountsArray& getNeighborCounts()
+   NeighborCountsArray&
+   getNeighborCounts()
    {
       return neighborCounts;
    }
 
    __cuda_callable__
-   const DualGraph& getDualGraph() const
+   const DualGraph&
+   getDualGraph() const
    {
       return graph;
    }
 
    __cuda_callable__
-   DualGraph& getDualGraph()
+   DualGraph&
+   getDualGraph()
    {
       return graph;
    }
 
    // algorithm inspired by the CreateGraphDual function in METIS
    template< typename Mesh >
-   void initializeDualGraph( const Mesh& mesh,
-                             // when this parameter is <= 0, it will be replaced with MeshConfig::dualGraphMinCommonVertices
-                             LocalIndexType minCommon = 0 )
+   void
+   initializeDualGraph( const Mesh& mesh,
+                        // when this parameter is <= 0, it will be replaced with MeshConfig::dualGraphMinCommonVertices
+                        LocalIndexType minCommon = 0 )
    {
-      static_assert( std::is_same< MeshConfig, typename Mesh::Config >::value,
-                     "mismatched MeshConfig type" );
+      static_assert( std::is_same< MeshConfig, typename Mesh::Config >::value, "mismatched MeshConfig type" );
       static_assert( MeshConfig::superentityStorage( 0, Mesh::getMeshDimension() ),
                      "The dual graph cannot be initialized when links from vertices to cells are not stored in the mesh." );
       static_assert( MeshConfig::dualGraphMinCommonVertices >= 1,
@@ -106,7 +111,7 @@ public:
       LocalIndexArray marker( cellsCount );
       marker.setValue( 0 );
 
-      auto findNeighbors = [&] ( const GlobalIndexType k )
+      auto findNeighbors = [ & ]( const GlobalIndexType k )
       {
          const LocalIndexType subvertices = mesh.template getSubentitiesCount< Mesh::getMeshDimension(), 0 >( k );
 
@@ -133,7 +138,7 @@ public:
             const LocalIndexType neighborSubvertices = mesh.template getSubentitiesCount< Mesh::getMeshDimension(), 0 >( nk );
             const LocalIndexType overlap = marker[ nk ];
             if( overlap >= minCommon || overlap >= subvertices - 1 || overlap >= neighborSubvertices - 1 )
-              neighbors[ compacted++ ] = nk;
+               neighbors[ compacted++ ] = nk;
             marker[ nk ] = 0;
          }
 
@@ -149,10 +154,10 @@ public:
       graph.setRowCapacities( neighborCounts );
 
       // fill in neighbor indices
-      for( GlobalIndexType k = 0; k < cellsCount; k++) {
+      for( GlobalIndexType k = 0; k < cellsCount; k++ ) {
          auto row = graph.getRow( k );
          const LocalIndexType nnbrs = findNeighbors( k );
-         for( LocalIndexType j = 0; j < nnbrs; j++)
+         for( LocalIndexType j = 0; j < nnbrs; j++ )
             row.setElement( j, neighbors[ j ], true );
       }
    }
@@ -162,22 +167,22 @@ protected:
    DualGraph graph;
 };
 
-template< typename MeshConfig,
-          typename Device >
+template< typename MeshConfig, typename Device >
 class DualGraphLayer< MeshConfig, Device, false >
 {
 public:
    template< typename Device_ >
-   DualGraphLayer& operator=( const DualGraphLayer< MeshConfig, Device_ >& other )
+   DualGraphLayer&
+   operator=( const DualGraphLayer< MeshConfig, Device_ >& other )
    {
       return *this;
    }
 
    template< typename Mesh >
-   void initializeDualGraph( const Mesh& mesh,
-                             int minCommon = 0 )
+   void
+   initializeDualGraph( const Mesh& mesh, int minCommon = 0 )
    {}
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/MeshDetails/layers/EntityTags/ConfigValidator.h b/src/TNL/Meshes/MeshDetails/layers/EntityTags/ConfigValidator.h
index 96efb252eb865d1c963ef6c77b4106542f9d1d2b..9e1cc7990dc0d3afda15ad964a767a89627ffa75 100644
--- a/src/TNL/Meshes/MeshDetails/layers/EntityTags/ConfigValidator.h
+++ b/src/TNL/Meshes/MeshDetails/layers/EntityTags/ConfigValidator.h
@@ -13,42 +13,33 @@ namespace TNL {
 namespace Meshes {
 namespace EntityTags {
 
-template< typename MeshConfig,
-          int EntityDimension,
-          bool entityTagsStorage = MeshConfig::entityTagsStorage( EntityDimension ) >
+template< typename MeshConfig, int EntityDimension, bool entityTagsStorage = MeshConfig::entityTagsStorage( EntityDimension ) >
 class ConfigValidatorEntityTagsLayer
 {
    static_assert( MeshConfig::superentityStorage( MeshConfig::meshDimension - 1, MeshConfig::meshDimension ),
                   "Faces must store the cell superentity indices when any entity has boundary tags." );
-   static_assert( EntityDimension >= MeshConfig::meshDimension - 1 || MeshConfig::subentityStorage( MeshConfig::meshDimension - 1, EntityDimension ),
+   static_assert( EntityDimension >= MeshConfig::meshDimension - 1
+                     || MeshConfig::subentityStorage( MeshConfig::meshDimension - 1, EntityDimension ),
                   "Faces must store the subentity indices of the entities on which the boundary tags are stored." );
 };
 
-template< typename MeshConfig,
-          int EntityDimension >
+template< typename MeshConfig, int EntityDimension >
 class ConfigValidatorEntityTagsLayer< MeshConfig, EntityDimension, false >
-{
-};
-
+{};
 
 template< typename MeshConfig, int dimension = MeshConfig::meshDimension >
-class ConfigValidatorLayer
-   : public ConfigValidatorLayer< MeshConfig, dimension - 1 >,
-     public ConfigValidatorEntityTagsLayer< MeshConfig, dimension >
-{
-};
+class ConfigValidatorLayer : public ConfigValidatorLayer< MeshConfig, dimension - 1 >,
+                             public ConfigValidatorEntityTagsLayer< MeshConfig, dimension >
+{};
 
 template< typename MeshConfig >
 class ConfigValidatorLayer< MeshConfig, 0 >
-{
-};
+{};
 
 template< typename MeshConfig >
-class ConfigValidator
-   : public ConfigValidatorLayer< MeshConfig >
-{
-};
+class ConfigValidator : public ConfigValidatorLayer< MeshConfig >
+{};
 
-} // namespace EntityTags
-} // namespace Meshes
-} // namespace TNL
+}  // namespace EntityTags
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/MeshDetails/layers/EntityTags/Initializer.h b/src/TNL/Meshes/MeshDetails/layers/EntityTags/Initializer.h
index ba8a307b0bf77544afdfb992d1308bc3e0a60b03..14f1f049c9a2bdad409ee516fd7d487bccd5da32 100644
--- a/src/TNL/Meshes/MeshDetails/layers/EntityTags/Initializer.h
+++ b/src/TNL/Meshes/MeshDetails/layers/EntityTags/Initializer.h
@@ -21,9 +21,9 @@ namespace EntityTags {
 template< typename MeshConfig, typename Device, typename Mesh >
 class Initializer
 {
-   using DeviceType      = Device;
+   using DeviceType = Device;
    using GlobalIndexType = typename MeshConfig::GlobalIndexType;
-   using LocalIndexType  = typename MeshConfig::LocalIndexType;
+   using LocalIndexType = typename MeshConfig::LocalIndexType;
 
 protected:
    // _T is necessary to force *partial* specialization, since explicit specializations
@@ -31,8 +31,8 @@ protected:
    template< typename CurrentDimension = DimensionTag< MeshConfig::meshDimension >, typename _T = void >
    struct EntityTagsNeedInitialization
    {
-      static constexpr bool value = MeshConfig::entityTagsStorage( CurrentDimension::value ) ||
-                                    EntityTagsNeedInitialization< typename CurrentDimension::Decrement >::value;
+      static constexpr bool value = MeshConfig::entityTagsStorage( CurrentDimension::value )
+                                 || EntityTagsNeedInitialization< typename CurrentDimension::Decrement >::value;
    };
 
    template< typename _T >
@@ -52,7 +52,8 @@ protected:
       template< bool enabled = true, typename _T = void >
       struct Worker
       {
-         static void exec( Mesh& mesh )
+         static void
+         exec( Mesh& mesh )
          {
             mesh.template getEntityTagsView< Dimension >().setValue( 0 );
          }
@@ -61,11 +62,14 @@ protected:
       template< typename _T >
       struct Worker< false, _T >
       {
-         static void exec( Mesh& mesh ) {}
+         static void
+         exec( Mesh& mesh )
+         {}
       };
 
    public:
-      static void exec( Mesh& mesh )
+      static void
+      exec( Mesh& mesh )
       {
          Worker< enabled >::exec( mesh );
       }
@@ -82,7 +86,8 @@ protected:
       struct Worker
       {
          __cuda_callable__
-         static void exec( Mesh& mesh, const GlobalIndexType& faceIndex, const typename Mesh::Face& face )
+         static void
+         exec( Mesh& mesh, const GlobalIndexType& faceIndex, const typename Mesh::Face& face )
          {
             const LocalIndexType subentitiesCount = face.template getSubentitiesCount< Subdimension >();
             for( LocalIndexType i = 0; i < subentitiesCount; i++ ) {
@@ -96,12 +101,15 @@ protected:
       struct Worker< false, _T >
       {
          __cuda_callable__
-         static void exec( Mesh& mesh, const GlobalIndexType& faceIndex, const typename Mesh::Face& face ) {}
+         static void
+         exec( Mesh& mesh, const GlobalIndexType& faceIndex, const typename Mesh::Face& face )
+         {}
       };
 
    public:
       __cuda_callable__
-      static void exec( Mesh& mesh, const GlobalIndexType& faceIndex, const typename Mesh::Face& face )
+      static void
+      exec( Mesh& mesh, const GlobalIndexType& faceIndex, const typename Mesh::Face& face )
       {
          Worker< enabled >::exec( mesh, faceIndex, face );
       }
@@ -117,25 +125,24 @@ public:
    class Worker
    {
    public:
-      static void exec( Mesh& mesh )
+      static void
+      exec( Mesh& mesh )
       {
          // set entities count
          Algorithms::staticFor< int, 0, Mesh::getMeshDimension() + 1 >(
-            [&mesh] ( auto dim ) {
+            [ &mesh ]( auto dim )
+            {
                mesh.template entityTagsSetEntitiesCount< dim >( mesh.template getEntitiesCount< dim >() );
-            }
-         );
+            } );
 
          // reset entity tags
          Algorithms::staticFor< int, 0, Mesh::getMeshDimension() + 1 >(
-            [&mesh] ( auto dim ) {
+            [ &mesh ]( auto dim )
+            {
                ResetEntityTags< dim >::exec( mesh );
-            }
-         );
+            } );
 
-         auto kernel = [] __cuda_callable__
-            ( GlobalIndexType faceIndex,
-              Mesh* mesh )
+         auto kernel = [] __cuda_callable__( GlobalIndexType faceIndex, Mesh * mesh )
          {
             const auto& face = mesh->template getEntity< Mesh::getMeshDimension() - 1 >( faceIndex );
             if( face.template getSuperentitiesCount< Mesh::getMeshDimension() >() == 1 ) {
@@ -146,41 +153,43 @@ public:
                mesh->template addEntityTag< Mesh::getMeshDimension() >( cellIndex, EntityTags::BoundaryEntity );
                // initialize all subentities
                Algorithms::staticFor< int, 0, Mesh::getMeshDimension() - 1 >(
-                  [&mesh, faceIndex, &face] ( auto dim ) {
+                  [ &mesh, faceIndex, &face ]( auto dim )
+                  {
                      InitializeSubentities< dim >::exec( *mesh, faceIndex, face );
-                  }
-               );
+                  } );
             }
          };
 
          const GlobalIndexType facesCount = mesh.template getEntitiesCount< Mesh::getMeshDimension() - 1 >();
          Pointers::DevicePointer< Mesh > meshPointer( mesh );
-         Algorithms::ParallelFor< DeviceType >::exec( (GlobalIndexType) 0, facesCount,
-                                                      kernel,
-                                                      &meshPointer.template modifyData< DeviceType >() );
+         Algorithms::ParallelFor< DeviceType >::exec(
+            (GlobalIndexType) 0, facesCount, kernel, &meshPointer.template modifyData< DeviceType >() );
 
          // update entity tags
          Algorithms::staticFor< int, 0, Mesh::getMeshDimension() + 1 >(
-            [&mesh] ( auto dim ) {
+            [ &mesh ]( auto dim )
+            {
                mesh.template updateEntityTagsLayer< dim >();
-            }
-         );
+            } );
       }
    };
 
    template< typename _T >
    struct Worker< false, _T >
    {
-      static void exec( Mesh& mesh ) {}
+      static void
+      exec( Mesh& mesh )
+      {}
    };
 
 public:
-   void initLayer()
+   void
+   initLayer()
    {
-      Worker<>::exec( *static_cast<Mesh*>(this) );
+      Worker<>::exec( *static_cast< Mesh* >( this ) );
    }
 };
 
-} // namespace EntityTags
-} // namespace Meshes
-} // namespace TNL
+}  // namespace EntityTags
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/MeshDetails/layers/EntityTags/Layer.h b/src/TNL/Meshes/MeshDetails/layers/EntityTags/Layer.h
index 8533c0e9f08f998bcb945f3adecef0b04e95b23f..bca7dde795347840ea039899d29efcb45d567786 100644
--- a/src/TNL/Meshes/MeshDetails/layers/EntityTags/Layer.h
+++ b/src/TNL/Meshes/MeshDetails/layers/EntityTags/Layer.h
@@ -24,13 +24,13 @@ template< typename MeshConfig,
           bool TagStorage = WeakStorageTrait< MeshConfig, Device, DimensionTag >::entityTagsEnabled >
 class Layer
 {
-   using MeshTraitsType    = MeshTraits< MeshConfig, Device >;
+   using MeshTraitsType = MeshTraits< MeshConfig, Device >;
 
 public:
-   using GlobalIndexType     = typename MeshTraitsType::GlobalIndexType;
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
    using EntityTagsArrayType = typename MeshTraitsType::EntityTagsArrayType;
-   using TagType             = typename MeshTraitsType::EntityTagType;
-   using OrderingArray       = Containers::Array< GlobalIndexType, Device, GlobalIndexType >;
+   using TagType = typename MeshTraitsType::EntityTagType;
+   using OrderingArray = Containers::Array< GlobalIndexType, Device, GlobalIndexType >;
 
    Layer() = default;
 
@@ -42,12 +42,15 @@ public:
       operator=( other );
    }
 
-   Layer& operator=( const Layer& other ) = default;
+   Layer&
+   operator=( const Layer& other ) = default;
 
-   Layer& operator=( Layer&& other ) = default;
+   Layer&
+   operator=( Layer&& other ) = default;
 
    template< typename Device_ >
-   Layer& operator=( const Layer< MeshConfig, Device_, DimensionTag >& other )
+   Layer&
+   operator=( const Layer< MeshConfig, Device_, DimensionTag >& other )
    {
       tags = other.tags;
       boundaryIndices = other.boundaryIndices;
@@ -56,8 +59,8 @@ public:
       return *this;
    }
 
-
-   void setEntitiesCount( DimensionTag, const GlobalIndexType& entitiesCount )
+   void
+   setEntitiesCount( DimensionTag, const GlobalIndexType& entitiesCount )
    {
       tags.setSize( entitiesCount );
       ghostsOffset = entitiesCount;
@@ -76,74 +79,86 @@ public:
    }
 
    __cuda_callable__
-   TagType getEntityTag( DimensionTag, const GlobalIndexType& entityIndex ) const
+   TagType
+   getEntityTag( DimensionTag, const GlobalIndexType& entityIndex ) const
    {
       return tags[ entityIndex ];
    }
 
    __cuda_callable__
-   void addEntityTag( DimensionTag, const GlobalIndexType& entityIndex, TagType tag )
+   void
+   addEntityTag( DimensionTag, const GlobalIndexType& entityIndex, TagType tag )
    {
       tags[ entityIndex ] |= tag;
    }
 
    __cuda_callable__
-   void removeEntityTag( DimensionTag, const GlobalIndexType& entityIndex, TagType tag )
+   void
+   removeEntityTag( DimensionTag, const GlobalIndexType& entityIndex, TagType tag )
    {
       tags[ entityIndex ] ^= tag;
    }
 
    __cuda_callable__
-   bool isBoundaryEntity( DimensionTag, const GlobalIndexType& entityIndex ) const
+   bool
+   isBoundaryEntity( DimensionTag, const GlobalIndexType& entityIndex ) const
    {
       return tags[ entityIndex ] & EntityTags::BoundaryEntity;
    }
 
    __cuda_callable__
-   bool isGhostEntity( DimensionTag, const GlobalIndexType& entityIndex ) const
+   bool
+   isGhostEntity( DimensionTag, const GlobalIndexType& entityIndex ) const
    {
       return tags[ entityIndex ] & EntityTags::GhostEntity;
    }
 
-   void updateEntityTagsLayer( DimensionTag )
+   void
+   updateEntityTagsLayer( DimensionTag )
    {
       // count boundary entities - custom reduction because expression templates don't support filtering bits this way:
       //    const GlobalIndexType boundaryEntities = sum(cast< GlobalIndexType >( _tagsVector & EntityTags::BoundaryEntity ));
       // NOTE: boundary/interior entities may overlap with ghost entities, so we count all categories separately
       const auto tags_view = tags.getConstView();
-      auto is_boundary = [=] __cuda_callable__ ( GlobalIndexType entityIndex ) -> GlobalIndexType
+      auto is_boundary = [ = ] __cuda_callable__( GlobalIndexType entityIndex ) -> GlobalIndexType
       {
-         return bool(tags_view[ entityIndex ] & EntityTags::BoundaryEntity);
+         return bool( tags_view[ entityIndex ] & EntityTags::BoundaryEntity );
       };
-      auto is_ghost = [=] __cuda_callable__ ( GlobalIndexType entityIndex ) -> GlobalIndexType
+      auto is_ghost = [ = ] __cuda_callable__( GlobalIndexType entityIndex ) -> GlobalIndexType
       {
-         return bool(tags_view[ entityIndex ] & EntityTags::GhostEntity);
+         return bool( tags_view[ entityIndex ] & EntityTags::GhostEntity );
       };
-      const GlobalIndexType boundaryEntities = Algorithms::reduce< Device >( (GlobalIndexType) 0, tags.getSize(), is_boundary, std::plus<>{}, (GlobalIndexType) 0 );
-      const GlobalIndexType ghostEntities = Algorithms::reduce< Device >( (GlobalIndexType) 0, tags.getSize(), is_ghost, std::plus<>{}, (GlobalIndexType) 0 );
+      const GlobalIndexType boundaryEntities =
+         Algorithms::reduce< Device >( (GlobalIndexType) 0, tags.getSize(), is_boundary, std::plus<>{}, (GlobalIndexType) 0 );
+      const GlobalIndexType ghostEntities =
+         Algorithms::reduce< Device >( (GlobalIndexType) 0, tags.getSize(), is_ghost, std::plus<>{}, (GlobalIndexType) 0 );
 
       interiorIndices.setSize( tags.getSize() - boundaryEntities );
       boundaryIndices.setSize( boundaryEntities );
       ghostsOffset = tags.getSize() - ghostEntities;
 
       if( ! std::is_same< Device, Devices::Cuda >::value ) {
-         GlobalIndexType i = 0, b = 0;
+         GlobalIndexType i = 0;
+         GlobalIndexType b = 0;
          for( GlobalIndexType e = 0; e < tags.getSize(); e++ ) {
             if( tags[ e ] & EntityTags::BoundaryEntity )
                boundaryIndices[ b++ ] = e;
             else
                interiorIndices[ i++ ] = e;
             if( tags[ e ] & EntityTags::GhostEntity && ghostEntities > 0 && e < ghostsOffset )
-               throw std::runtime_error( "The mesh is inconsistent - ghost entities of dimension " + std::to_string(DimensionTag::value) + " are not ordered after local entities." );
+               throw std::runtime_error( "The mesh is inconsistent - ghost entities of dimension "
+                                         + std::to_string( DimensionTag::value ) + " are not ordered after local entities." );
          }
       }
       // TODO: parallelize directly on the device
       else {
-         using EntityTagsHostArray = typename EntityTagsArrayType::template Self< typename EntityTagsArrayType::ValueType, Devices::Host >;
-         using OrderingHostArray   = typename OrderingArray::template Self< typename OrderingArray::ValueType, Devices::Host >;
+         using EntityTagsHostArray =
+            typename EntityTagsArrayType::template Self< typename EntityTagsArrayType::ValueType, Devices::Host >;
+         using OrderingHostArray = typename OrderingArray::template Self< typename OrderingArray::ValueType, Devices::Host >;
 
          EntityTagsHostArray hostTags;
-         OrderingHostArray hostBoundaryIndices, hostInteriorIndices;
+         OrderingHostArray hostBoundaryIndices;
+         OrderingHostArray hostInteriorIndices;
 
          hostTags.setLike( tags );
          hostInteriorIndices.setLike( interiorIndices );
@@ -151,14 +166,16 @@ public:
 
          hostTags = tags;
 
-         GlobalIndexType i = 0, b = 0;
+         GlobalIndexType i = 0;
+         GlobalIndexType b = 0;
          for( GlobalIndexType e = 0; e < tags.getSize(); e++ ) {
             if( hostTags[ e ] & EntityTags::BoundaryEntity )
                hostBoundaryIndices[ b++ ] = e;
             else
                hostInteriorIndices[ i++ ] = e;
             if( hostTags[ e ] & EntityTags::GhostEntity && ghostEntities > 0 && e < ghostsOffset )
-               throw std::runtime_error( "The mesh is inconsistent - ghost entities of dimension " + std::to_string(DimensionTag::value) + " are not ordered after local entities." );
+               throw std::runtime_error( "The mesh is inconsistent - ghost entities of dimension "
+                                         + std::to_string( DimensionTag::value ) + " are not ordered after local entities." );
          }
 
          interiorIndices = hostInteriorIndices;
@@ -166,29 +183,34 @@ public:
       }
    }
 
-   auto getBoundaryIndices( DimensionTag ) const
+   auto
+   getBoundaryIndices( DimensionTag ) const
    {
       return boundaryIndices.getConstView();
    }
 
-   auto getInteriorIndices( DimensionTag ) const
+   auto
+   getInteriorIndices( DimensionTag ) const
    {
       return interiorIndices.getConstView();
    }
 
    __cuda_callable__
-   GlobalIndexType getGhostEntitiesCount( DimensionTag ) const
+   GlobalIndexType
+   getGhostEntitiesCount( DimensionTag ) const
    {
       return tags.getSize() - ghostsOffset;
    }
 
    __cuda_callable__
-   GlobalIndexType getGhostEntitiesOffset( DimensionTag ) const
+   GlobalIndexType
+   getGhostEntitiesOffset( DimensionTag ) const
    {
       return ghostsOffset;
    }
 
-   void print( std::ostream& str ) const
+   void
+   print( std::ostream& str ) const
    {
       str << "Boundary tags for entities of dimension " << DimensionTag::value << " are: ";
       str << tags << std::endl;
@@ -200,19 +222,24 @@ public:
       str << ghostsOffset << std::endl;
    }
 
-   bool operator==( const Layer& layer ) const
+   bool
+   operator==( const Layer& layer ) const
    {
-      TNL_ASSERT( ( tags == layer.tags && interiorIndices == layer.interiorIndices && boundaryIndices == layer.boundaryIndices && ghostsOffset == layer.ghostsOffset ) ||
-                  ( tags != layer.tags && interiorIndices != layer.interiorIndices && boundaryIndices != layer.boundaryIndices && ghostsOffset != layer.ghostsOffset ),
-                  std::cerr << "The EntityTags layer is in inconsistent state - this is probably a bug in the boundary tags initializer." << std::endl
-                            << "tags                  = " << tags << std::endl
-                            << "layer.tags            = " << layer.tags << std::endl
-                            << "interiorIndices       = " << interiorIndices << std::endl
-                            << "layer.interiorIndices = " << layer.interiorIndices << std::endl
-                            << "boundaryIndices       = " << boundaryIndices << std::endl
-                            << "layer.boundaryIndices = " << layer.boundaryIndices << std::endl
-                            << "ghostsOffset          = " << ghostsOffset << std::endl
-                            << "layer.ghostsOffset    = " << layer.ghostsOffset << std::endl; );
+      TNL_ASSERT(
+         ( tags == layer.tags && interiorIndices == layer.interiorIndices && boundaryIndices == layer.boundaryIndices
+           && ghostsOffset == layer.ghostsOffset )
+            || ( tags != layer.tags && interiorIndices != layer.interiorIndices && boundaryIndices != layer.boundaryIndices
+                 && ghostsOffset != layer.ghostsOffset ),
+         std::cerr << "The EntityTags layer is in inconsistent state - this is probably a bug in the boundary tags initializer."
+                   << std::endl
+                   << "tags                  = " << tags << std::endl
+                   << "layer.tags            = " << layer.tags << std::endl
+                   << "interiorIndices       = " << interiorIndices << std::endl
+                   << "layer.interiorIndices = " << layer.interiorIndices << std::endl
+                   << "boundaryIndices       = " << boundaryIndices << std::endl
+                   << "layer.boundaryIndices = " << layer.boundaryIndices << std::endl
+                   << "ghostsOffset          = " << ghostsOffset << std::endl
+                   << "layer.ghostsOffset    = " << layer.ghostsOffset << std::endl; );
       return tags == layer.tags;
    }
 
@@ -226,46 +253,76 @@ private:
    friend class Layer;
 };
 
-template< typename MeshConfig,
-          typename Device,
-          typename DimensionTag >
+template< typename MeshConfig, typename Device, typename DimensionTag >
 class Layer< MeshConfig, Device, DimensionTag, false >
 {
 protected:
    using GlobalIndexType = typename MeshConfig::GlobalIndexType;
-   using TagType         = typename MeshTraits< MeshConfig, Device >::EntityTagsArrayType::ValueType;
+   using TagType = typename MeshTraits< MeshConfig, Device >::EntityTagsArrayType::ValueType;
 
    Layer() = default;
    explicit Layer( const Layer& other ) = default;
    Layer( Layer&& other ) = default;
    template< typename Device_ >
-   Layer( const Layer< MeshConfig, Device_, DimensionTag >& other ) {}
-   Layer& operator=( const Layer& other ) = default;
-   Layer& operator=( Layer&& other ) = default;
+   Layer( const Layer< MeshConfig, Device_, DimensionTag >& other )
+   {}
+   Layer&
+   operator=( const Layer& other ) = default;
+   Layer&
+   operator=( Layer&& other ) = default;
    template< typename Device_ >
-   Layer& operator=( const Layer< MeshConfig, Device_, DimensionTag >& other ) { return *this; }
-
-   void setEntitiesCount( DimensionTag, const GlobalIndexType& entitiesCount ) {}
-   void getEntityTagsView( DimensionTag ) {}
-   void getEntityTag( DimensionTag, const GlobalIndexType& ) const {}
-   void addEntityTag( DimensionTag, const GlobalIndexType&, TagType ) const {}
-   void removeEntityTag( DimensionTag, const GlobalIndexType&, TagType ) const {}
-   void isBoundaryEntity( DimensionTag, const GlobalIndexType& ) const {}
-   void isGhostEntity( DimensionTag, const GlobalIndexType& ) const {}
-   void updateEntityTagsLayer( DimensionTag ) {}
-   void getBoundaryIndices( DimensionTag ) const {}
-   void getInteriorIndices( DimensionTag ) const {}
-   void getGhostEntitiesCount() const;
-   void getGhostEntitiesOffset() const;
-
-   void print( std::ostream& str ) const {}
-
-   bool operator==( const Layer& layer ) const
+   Layer&
+   operator=( const Layer< MeshConfig, Device_, DimensionTag >& other )
+   {
+      return *this;
+   }
+
+   void
+   setEntitiesCount( DimensionTag, const GlobalIndexType& entitiesCount )
+   {}
+   void
+   getEntityTagsView( DimensionTag )
+   {}
+   void
+   getEntityTag( DimensionTag, const GlobalIndexType& ) const
+   {}
+   void
+   addEntityTag( DimensionTag, const GlobalIndexType&, TagType ) const
+   {}
+   void
+   removeEntityTag( DimensionTag, const GlobalIndexType&, TagType ) const
+   {}
+   void
+   isBoundaryEntity( DimensionTag, const GlobalIndexType& ) const
+   {}
+   void
+   isGhostEntity( DimensionTag, const GlobalIndexType& ) const
+   {}
+   void
+   updateEntityTagsLayer( DimensionTag )
+   {}
+   void
+   getBoundaryIndices( DimensionTag ) const
+   {}
+   void
+   getInteriorIndices( DimensionTag ) const
+   {}
+   void
+   getGhostEntitiesCount() const;
+   void
+   getGhostEntitiesOffset() const;
+
+   void
+   print( std::ostream& str ) const
+   {}
+
+   bool
+   operator==( const Layer& layer ) const
    {
       return true;
    }
 };
 
-} // namespace EntityTags
-} // namespace Meshes
-} // namespace TNL
+}  // namespace EntityTags
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/MeshDetails/layers/EntityTags/LayerFamily.h b/src/TNL/Meshes/MeshDetails/layers/EntityTags/LayerFamily.h
index 63a48ec9d1305c9d527900ee02211e71ac6894ed..2c567757e50ea4d03259c3efddfa8528cab4843f 100644
--- a/src/TNL/Meshes/MeshDetails/layers/EntityTags/LayerFamily.h
+++ b/src/TNL/Meshes/MeshDetails/layers/EntityTags/LayerFamily.h
@@ -16,39 +16,38 @@ namespace Meshes {
 namespace EntityTags {
 
 template< typename MeshConfig, typename Device, typename Dimension = DimensionTag< 0 > >
-class LayerInheritor
-   : public Layer< MeshConfig, Device, Dimension >,
-     public LayerInheritor< MeshConfig, Device, typename Dimension::Increment >
+class LayerInheritor : public Layer< MeshConfig, Device, Dimension >,
+                       public LayerInheritor< MeshConfig, Device, typename Dimension::Increment >
 {
    using LayerType = Layer< MeshConfig, Device, Dimension >;
    using BaseType = LayerInheritor< MeshConfig, Device, typename Dimension::Increment >;
+
 protected:
-   using LayerType::setEntitiesCount;
-   using LayerType::getEntityTagsView;
-   using LayerType::getEntityTag;
    using LayerType::addEntityTag;
-   using LayerType::removeEntityTag;
-   using LayerType::isBoundaryEntity;
-   using LayerType::isGhostEntity;
-   using LayerType::updateEntityTagsLayer;
    using LayerType::getBoundaryIndices;
-   using LayerType::getInteriorIndices;
+   using LayerType::getEntityTag;
+   using LayerType::getEntityTagsView;
    using LayerType::getGhostEntitiesCount;
    using LayerType::getGhostEntitiesOffset;
+   using LayerType::getInteriorIndices;
+   using LayerType::isBoundaryEntity;
+   using LayerType::isGhostEntity;
+   using LayerType::removeEntityTag;
+   using LayerType::setEntitiesCount;
+   using LayerType::updateEntityTagsLayer;
 
-   using BaseType::setEntitiesCount;
-   using BaseType::getEntityTagsView;
-   using BaseType::getEntityTag;
    using BaseType::addEntityTag;
-   using BaseType::removeEntityTag;
-   using BaseType::isBoundaryEntity;
-   using BaseType::isGhostEntity;
-   using BaseType::updateEntityTagsLayer;
    using BaseType::getBoundaryIndices;
-   using BaseType::getInteriorIndices;
+   using BaseType::getEntityTag;
+   using BaseType::getEntityTagsView;
    using BaseType::getGhostEntitiesCount;
    using BaseType::getGhostEntitiesOffset;
-
+   using BaseType::getInteriorIndices;
+   using BaseType::isBoundaryEntity;
+   using BaseType::isGhostEntity;
+   using BaseType::removeEntityTag;
+   using BaseType::setEntitiesCount;
+   using BaseType::updateEntityTagsLayer;
 
    LayerInheritor() = default;
 
@@ -62,29 +61,32 @@ protected:
       operator=( other );
    }
 
-   LayerInheritor& operator=( const LayerInheritor& other ) = default;
+   LayerInheritor&
+   operator=( const LayerInheritor& other ) = default;
 
-   LayerInheritor& operator=( LayerInheritor&& other ) = default;
+   LayerInheritor&
+   operator=( LayerInheritor&& other ) = default;
 
    template< typename Device_ >
-   LayerInheritor& operator=( const LayerInheritor< MeshConfig, Device_, Dimension >& other )
+   LayerInheritor&
+   operator=( const LayerInheritor< MeshConfig, Device_, Dimension >& other )
    {
       LayerType::operator=( other );
       BaseType::operator=( other );
       return *this;
    }
 
-
-   void print( std::ostream& str ) const
+   void
+   print( std::ostream& str ) const
    {
       LayerType::print( str );
       BaseType::print( str );
    }
 
-   bool operator==( const LayerInheritor& layer ) const
+   bool
+   operator==( const LayerInheritor& layer ) const
    {
-      return LayerType::operator==( layer ) &&
-             BaseType::operator==( layer );
+      return LayerType::operator==( layer ) && BaseType::operator==( layer );
    }
 };
 
@@ -92,32 +94,54 @@ template< typename MeshConfig, typename Device >
 class LayerInheritor< MeshConfig, Device, DimensionTag< MeshConfig::meshDimension + 1 > >
 {
 protected:
-   void setEntitiesCount();
-   void getEntityTagsView();
-   void getEntityTag() const;
-   void addEntityTag();
-   void removeEntityTag();
-   void isBoundaryEntity() const;
-   void isGhostEntity() const;
-   void updateEntityTagsLayer();
-   void getBoundaryIndices() const;
-   void getInteriorIndices() const;
-   void getGhostEntitiesCount() const;
-   void getGhostEntitiesOffset() const;
+   void
+   setEntitiesCount();
+   void
+   getEntityTagsView();
+   void
+   getEntityTag() const;
+   void
+   addEntityTag();
+   void
+   removeEntityTag();
+   void
+   isBoundaryEntity() const;
+   void
+   isGhostEntity() const;
+   void
+   updateEntityTagsLayer();
+   void
+   getBoundaryIndices() const;
+   void
+   getInteriorIndices() const;
+   void
+   getGhostEntitiesCount() const;
+   void
+   getGhostEntitiesOffset() const;
 
    LayerInheritor() = default;
    explicit LayerInheritor( const LayerInheritor& other ) = default;
    LayerInheritor( LayerInheritor&& other ) = default;
    template< typename Device_ >
-   LayerInheritor( const LayerInheritor< MeshConfig, Device_, DimensionTag< MeshConfig::meshDimension + 1 > >& other ) {}
-   LayerInheritor& operator=( const LayerInheritor& other ) = default;
-   LayerInheritor& operator=( LayerInheritor&& other ) = default;
+   LayerInheritor( const LayerInheritor< MeshConfig, Device_, DimensionTag< MeshConfig::meshDimension + 1 > >& other )
+   {}
+   LayerInheritor&
+   operator=( const LayerInheritor& other ) = default;
+   LayerInheritor&
+   operator=( LayerInheritor&& other ) = default;
    template< typename Device_ >
-   LayerInheritor& operator=( const LayerInheritor< MeshConfig, Device_, DimensionTag< MeshConfig::meshDimension + 1 > >& other ) { return *this; }
+   LayerInheritor&
+   operator=( const LayerInheritor< MeshConfig, Device_, DimensionTag< MeshConfig::meshDimension + 1 > >& other )
+   {
+      return *this;
+   }
 
-   void print( std::ostream& str ) const {}
+   void
+   print( std::ostream& str ) const
+   {}
 
-   bool operator==( const LayerInheritor& layer ) const
+   bool
+   operator==( const LayerInheritor& layer ) const
    {
       return true;
    }
@@ -126,10 +150,9 @@ protected:
 // Note that MeshType is an incomplete type and therefore cannot be used to access
 // MeshType::Config etc. at the time of declaration of this class template.
 template< typename MeshConfig, typename Device, typename MeshType >
-class LayerFamily
-   : public ConfigValidator< MeshConfig >,
-     public Initializer< MeshConfig, Device, MeshType >,
-     public LayerInheritor< MeshConfig, Device >
+class LayerFamily : public ConfigValidator< MeshConfig >,
+                    public Initializer< MeshConfig, Device, MeshType >,
+                    public LayerInheritor< MeshConfig, Device >
 {
    using MeshTraitsType = MeshTraits< MeshConfig, Device >;
    using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
@@ -152,7 +175,8 @@ public:
    typename EntityTagsArrayType::ViewType
    getEntityTagsView()
    {
-      static_assert( WeakTrait< Dimension >::entityTagsEnabled, "You try to access entity tags which are not configured for storage." );
+      static_assert( WeakTrait< Dimension >::entityTagsEnabled,
+                     "You try to access entity tags which are not configured for storage." );
       return BaseType::getEntityTagsView( DimensionTag< Dimension >() );
    }
 
@@ -160,94 +184,115 @@ public:
    typename EntityTagsArrayType::ConstViewType
    getEntityTagsView() const
    {
-      static_assert( WeakTrait< Dimension >::entityTagsEnabled, "You try to access entity tags which are not configured for storage." );
+      static_assert( WeakTrait< Dimension >::entityTagsEnabled,
+                     "You try to access entity tags which are not configured for storage." );
       return BaseType::getEntityTagsView( DimensionTag< Dimension >() );
    }
 
    template< int Dimension >
    __cuda_callable__
-   TagType getEntityTag( const GlobalIndexType& entityIndex ) const
+   TagType
+   getEntityTag( const GlobalIndexType& entityIndex ) const
    {
-      static_assert( WeakTrait< Dimension >::entityTagsEnabled, "You try to access entity tags which are not configured for storage." );
+      static_assert( WeakTrait< Dimension >::entityTagsEnabled,
+                     "You try to access entity tags which are not configured for storage." );
       return BaseType::getEntityTag( DimensionTag< Dimension >(), entityIndex );
    }
 
    template< int Dimension >
    __cuda_callable__
-   void addEntityTag( const GlobalIndexType& entityIndex, TagType tag )
+   void
+   addEntityTag( const GlobalIndexType& entityIndex, TagType tag )
    {
-      static_assert( WeakTrait< Dimension >::entityTagsEnabled, "You try to access entity tags which are not configured for storage." );
+      static_assert( WeakTrait< Dimension >::entityTagsEnabled,
+                     "You try to access entity tags which are not configured for storage." );
       BaseType::addEntityTag( DimensionTag< Dimension >(), entityIndex, tag );
    }
 
    template< int Dimension >
    __cuda_callable__
-   void removeEntityTag( const GlobalIndexType& entityIndex, TagType tag )
+   void
+   removeEntityTag( const GlobalIndexType& entityIndex, TagType tag )
    {
-      static_assert( WeakTrait< Dimension >::entityTagsEnabled, "You try to access entity tags which are not configured for storage." );
+      static_assert( WeakTrait< Dimension >::entityTagsEnabled,
+                     "You try to access entity tags which are not configured for storage." );
       BaseType::removeEntityTag( DimensionTag< Dimension >(), entityIndex, tag );
    }
 
    template< int Dimension >
    __cuda_callable__
-   bool isBoundaryEntity( const GlobalIndexType& entityIndex ) const
+   bool
+   isBoundaryEntity( const GlobalIndexType& entityIndex ) const
    {
-      static_assert( WeakTrait< Dimension >::entityTagsEnabled, "You try to access entity tags which are not configured for storage." );
+      static_assert( WeakTrait< Dimension >::entityTagsEnabled,
+                     "You try to access entity tags which are not configured for storage." );
       return BaseType::isBoundaryEntity( DimensionTag< Dimension >(), entityIndex );
    }
 
    template< int Dimension >
    __cuda_callable__
-   bool isGhostEntity( const GlobalIndexType& entityIndex ) const
+   bool
+   isGhostEntity( const GlobalIndexType& entityIndex ) const
    {
-      static_assert( WeakTrait< Dimension >::entityTagsEnabled, "You try to access entity tags which are not configured for storage." );
+      static_assert( WeakTrait< Dimension >::entityTagsEnabled,
+                     "You try to access entity tags which are not configured for storage." );
       return BaseType::isGhostEntity( DimensionTag< Dimension >(), entityIndex );
    }
 
    template< int Dimension >
-   auto getBoundaryIndices() const
+   auto
+   getBoundaryIndices() const
    {
-      static_assert( WeakTrait< Dimension >::entityTagsEnabled, "You try to access entity tags which are not configured for storage." );
+      static_assert( WeakTrait< Dimension >::entityTagsEnabled,
+                     "You try to access entity tags which are not configured for storage." );
       return BaseType::getBoundaryIndices( DimensionTag< Dimension >() );
    }
 
    template< int Dimension >
-   auto getInteriorIndices() const
+   auto
+   getInteriorIndices() const
    {
-      static_assert( WeakTrait< Dimension >::entityTagsEnabled, "You try to access entity tags which are not configured for storage." );
+      static_assert( WeakTrait< Dimension >::entityTagsEnabled,
+                     "You try to access entity tags which are not configured for storage." );
       return BaseType::getInteriorIndices( DimensionTag< Dimension >() );
    }
 
    template< int Dimension >
    __cuda_callable__
-   GlobalIndexType getGhostEntitiesCount() const
+   GlobalIndexType
+   getGhostEntitiesCount() const
    {
-      static_assert( WeakTrait< Dimension >::entityTagsEnabled, "You try to access entity tags which are not configured for storage." );
+      static_assert( WeakTrait< Dimension >::entityTagsEnabled,
+                     "You try to access entity tags which are not configured for storage." );
       return BaseType::getGhostEntitiesCount( DimensionTag< Dimension >() );
    }
 
    template< int Dimension >
    __cuda_callable__
-   GlobalIndexType getGhostEntitiesOffset() const
+   GlobalIndexType
+   getGhostEntitiesOffset() const
    {
-      static_assert( WeakTrait< Dimension >::entityTagsEnabled, "You try to access entity tags which are not configured for storage." );
+      static_assert( WeakTrait< Dimension >::entityTagsEnabled,
+                     "You try to access entity tags which are not configured for storage." );
       return BaseType::getGhostEntitiesOffset( DimensionTag< Dimension >() );
    }
 
    template< int Dimension >
-   void updateEntityTagsLayer()
+   void
+   updateEntityTagsLayer()
    {
       BaseType::updateEntityTagsLayer( DimensionTag< Dimension >() );
    }
 
 protected:
    template< int Dimension >
-   void entityTagsSetEntitiesCount( const GlobalIndexType& entitiesCount )
+   void
+   entityTagsSetEntitiesCount( const GlobalIndexType& entitiesCount )
    {
       BaseType::setEntitiesCount( DimensionTag< Dimension >(), entitiesCount );
    }
 };
 
-} // namespace EntityTags
-} // namespace Meshes
-} // namespace TNL
+}  // namespace EntityTags
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/MeshDetails/layers/EntityTags/Traits.h b/src/TNL/Meshes/MeshDetails/layers/EntityTags/Traits.h
index c9b6b277f085ef3eea2a249fe49adf6650cb4d6c..b636c6838a96650058ca7e15ec0125b1ba051e56 100644
--- a/src/TNL/Meshes/MeshDetails/layers/EntityTags/Traits.h
+++ b/src/TNL/Meshes/MeshDetails/layers/EntityTags/Traits.h
@@ -15,15 +15,13 @@ namespace EntityTags {
 template< typename MeshConfig,
           typename Device,
           typename DimensionTag,
-          bool sensible = (DimensionTag::value <= MeshConfig::meshDimension) >
+          bool sensible = ( DimensionTag::value <= MeshConfig::meshDimension ) >
 struct WeakStorageTrait
 {
    static constexpr bool entityTagsEnabled = MeshConfig::entityTagsStorage( DimensionTag::value );
 };
 
-template< typename MeshConfig,
-          typename Device,
-          typename DimensionTag >
+template< typename MeshConfig, typename Device, typename DimensionTag >
 struct WeakStorageTrait< MeshConfig, Device, DimensionTag, false >
 {
    static constexpr bool entityTagsEnabled = false;
@@ -37,6 +35,6 @@ enum EntityTags : std::uint8_t
    GhostEntity = 2,
 };
 
-} // namespace EntityTags
-} // namespace Meshes
-} // namespace TNL
+}  // namespace EntityTags
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/MeshDetails/layers/StorageLayer.h b/src/TNL/Meshes/MeshDetails/layers/StorageLayer.h
index 6a0abe602f7fb7bb0f53a5ee6cacce9e1b31a14a..06b95fd32a56d64c6664fadd6859823439e82bcd 100644
--- a/src/TNL/Meshes/MeshDetails/layers/StorageLayer.h
+++ b/src/TNL/Meshes/MeshDetails/layers/StorageLayer.h
@@ -24,26 +24,26 @@ namespace Meshes {
 template< typename MeshConfig,
           typename Device,
           typename DimensionTag,
-          bool EntityStorage = (DimensionTag::value <= MeshConfig::meshDimension) >
+          bool EntityStorage = ( DimensionTag::value <= MeshConfig::meshDimension ) >
 class StorageLayer;
 
-
 template< typename MeshConfig, typename Device >
-class StorageLayerFamily
-   : public StorageLayer< MeshConfig, Device, DimensionTag< 0 > >,
-     public DualGraphLayer< MeshConfig, Device >
+class StorageLayerFamily : public StorageLayer< MeshConfig, Device, DimensionTag< 0 > >,
+                           public DualGraphLayer< MeshConfig, Device >
 {
    using MeshTraitsType = MeshTraits< MeshConfig, Device >;
    using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
-   using BaseType       = StorageLayer< MeshConfig, Device, DimensionTag< 0 > >;
+   using BaseType = StorageLayer< MeshConfig, Device, DimensionTag< 0 > >;
    template< int Dimension >
    using EntityTraits = typename MeshTraitsType::template EntityTraits< Dimension >;
 
    template< int Dimension, int Subdimension >
-   using SubentityTraits = typename MeshTraitsType::template SubentityTraits< typename EntityTraits< Dimension >::EntityTopology, Subdimension >;
+   using SubentityTraits =
+      typename MeshTraitsType::template SubentityTraits< typename EntityTraits< Dimension >::EntityTopology, Subdimension >;
 
    template< int Dimension, int Superdimension >
-   using SuperentityTraits = typename MeshTraitsType::template SuperentityTraits< typename EntityTraits< Dimension >::EntityTopology, Superdimension >;
+   using SuperentityTraits =
+      typename MeshTraitsType::template SuperentityTraits< typename EntityTraits< Dimension >::EntityTopology, Superdimension >;
 
 public:
    StorageLayerFamily() = default;
@@ -58,22 +58,25 @@ public:
       operator=( other );
    }
 
-   StorageLayerFamily& operator=( const StorageLayerFamily& layer ) = default;
+   StorageLayerFamily&
+   operator=( const StorageLayerFamily& layer ) = default;
 
-   StorageLayerFamily& operator=( StorageLayerFamily&& layer ) = default;
+   StorageLayerFamily&
+   operator=( StorageLayerFamily&& layer ) = default;
 
    template< typename Device_ >
-   StorageLayerFamily& operator=( const StorageLayerFamily< MeshConfig, Device_ >& layer )
+   StorageLayerFamily&
+   operator=( const StorageLayerFamily< MeshConfig, Device_ >& layer )
    {
       BaseType::operator=( layer );
       DualGraphLayer< MeshConfig, Device >::operator=( layer );
       return *this;
    }
 
-   bool operator==( const StorageLayerFamily& layer ) const
+   bool
+   operator==( const StorageLayerFamily& layer ) const
    {
-      return ( BaseType::operator==( layer ) &&
-               DualGraphLayer< MeshConfig, Device >::operator==( layer ) );
+      return ( BaseType::operator==( layer ) && DualGraphLayer< MeshConfig, Device >::operator==( layer ) );
    }
 
    template< int Dimension, int Subdimension >
@@ -82,10 +85,9 @@ public:
    {
       static_assert( Dimension > Subdimension, "Invalid combination of Dimension and Subdimension." );
       static_assert( SubentityTraits< Dimension, Subdimension >::storageEnabled,
-                     "You try to set subentitiesCounts for a combination of Dimension and Subdimension which is disabled in the mesh configuration." );
-      using BaseType = SubentityStorageLayerFamily< MeshConfig,
-                                                    Device,
-                                                    typename EntityTraits< Dimension >::EntityTopology >;
+                     "You try to set subentitiesCounts for a combination of Dimension and Subdimension which is disabled in "
+                     "the mesh configuration." );
+      using BaseType = SubentityStorageLayerFamily< MeshConfig, Device, typename EntityTraits< Dimension >::EntityTopology >;
       BaseType::template setSubentitiesCounts< Subdimension >( counts );
    }
 
@@ -97,9 +99,7 @@ public:
       static_assert( Dimension > Subdimension, "Invalid combination of Dimension and Subdimension." );
       static_assert( SubentityTraits< Dimension, Subdimension >::storageEnabled,
                      "You try to get subentities count for subentities which are disabled in the mesh configuration." );
-      using BaseType = SubentityStorageLayerFamily< MeshConfig,
-                                                    Device,
-                                                    typename EntityTraits< Dimension >::EntityTopology >;
+      using BaseType = SubentityStorageLayerFamily< MeshConfig, Device, typename EntityTraits< Dimension >::EntityTopology >;
       return BaseType::template getSubentitiesCount< Subdimension >( entityIndex );
    }
 
@@ -111,9 +111,7 @@ public:
       static_assert( Dimension > Subdimension, "Invalid combination of Dimension and Subdimension." );
       static_assert( SubentityTraits< Dimension, Subdimension >::storageEnabled,
                      "You try to get subentities matrix which is disabled in the mesh configuration." );
-      using BaseType = SubentityStorageLayerFamily< MeshConfig,
-                                                    Device,
-                                                    typename EntityTraits< Dimension >::EntityTopology >;
+      using BaseType = SubentityStorageLayerFamily< MeshConfig, Device, typename EntityTraits< Dimension >::EntityTopology >;
       return BaseType::template getSubentitiesMatrix< Subdimension >();
    }
 
@@ -125,9 +123,7 @@ public:
       static_assert( Dimension > Subdimension, "Invalid combination of Dimension and Subdimension." );
       static_assert( SubentityTraits< Dimension, Subdimension >::storageEnabled,
                      "You try to get subentities matrix which is disabled in the mesh configuration." );
-      using BaseType = SubentityStorageLayerFamily< MeshConfig,
-                                                    Device,
-                                                    typename EntityTraits< Dimension >::EntityTopology >;
+      using BaseType = SubentityStorageLayerFamily< MeshConfig, Device, typename EntityTraits< Dimension >::EntityTopology >;
       return BaseType::template getSubentitiesMatrix< Subdimension >();
    }
 
@@ -139,9 +135,7 @@ public:
       static_assert( Dimension < Superdimension, "Invalid combination of Dimension and Superdimension." );
       static_assert( SuperentityTraits< Dimension, Superdimension >::storageEnabled,
                      "You try to get superentities counts array which is disabled in the mesh configuration." );
-      using BaseType = SuperentityStorageLayerFamily< MeshConfig,
-                                                     Device,
-                                                     DimensionTag< Dimension > >;
+      using BaseType = SuperentityStorageLayerFamily< MeshConfig, Device, DimensionTag< Dimension > >;
       return BaseType::template getSuperentitiesCountsArray< Superdimension >();
    }
 
@@ -153,9 +147,7 @@ public:
       static_assert( Dimension < Superdimension, "Invalid combination of Dimension and Superdimension." );
       static_assert( SuperentityTraits< Dimension, Superdimension >::storageEnabled,
                      "You try to get superentities counts array which is disabled in the mesh configuration." );
-      using BaseType = SuperentityStorageLayerFamily< MeshConfig,
-                                                     Device,
-                                                     DimensionTag< Dimension > >;
+      using BaseType = SuperentityStorageLayerFamily< MeshConfig, Device, DimensionTag< Dimension > >;
       return BaseType::template getSuperentitiesCountsArray< Superdimension >();
    }
 
@@ -167,9 +159,7 @@ public:
       static_assert( Dimension < Superdimension, "Invalid combination of Dimension and Superdimension." );
       static_assert( SuperentityTraits< Dimension, Superdimension >::storageEnabled,
                      "You try to get superentities matrix which is disabled in the mesh configuration." );
-      using BaseType = SuperentityStorageLayerFamily< MeshConfig,
-                                                     Device,
-                                                     DimensionTag< Dimension > >;
+      using BaseType = SuperentityStorageLayerFamily< MeshConfig, Device, DimensionTag< Dimension > >;
       return BaseType::template getSuperentitiesMatrix< Superdimension >();
    }
 
@@ -181,36 +171,27 @@ public:
       static_assert( Dimension < Superdimension, "Invalid combination of Dimension and Superdimension." );
       static_assert( SuperentityTraits< Dimension, Superdimension >::storageEnabled,
                      "You try to get superentities matrix which is disabled in the mesh configuration." );
-      using BaseType = SuperentityStorageLayerFamily< MeshConfig,
-                                                     Device,
-                                                     DimensionTag< Dimension > >;
+      using BaseType = SuperentityStorageLayerFamily< MeshConfig, Device, DimensionTag< Dimension > >;
       return BaseType::template getSuperentitiesMatrix< Superdimension >();
    }
 };
 
-
-template< typename MeshConfig,
-          typename Device,
-          typename DimensionTag >
-class StorageLayer< MeshConfig,
-                    Device,
-                    DimensionTag,
-                    true >
-   : public SubentityStorageLayerFamily< MeshConfig,
-                                         Device,
-                                         typename MeshTraits< MeshConfig, Device >::template EntityTraits< DimensionTag::value >::EntityTopology >,
-     public SuperentityStorageLayerFamily< MeshConfig,
-                                           Device,
-                                           DimensionTag >,
-     public StorageLayer< MeshConfig, Device, typename DimensionTag::Increment >
+template< typename MeshConfig, typename Device, typename DimensionTag >
+class StorageLayer< MeshConfig, Device, DimensionTag, true >
+: public SubentityStorageLayerFamily<
+     MeshConfig,
+     Device,
+     typename MeshTraits< MeshConfig, Device >::template EntityTraits< DimensionTag::value >::EntityTopology >,
+  public SuperentityStorageLayerFamily< MeshConfig, Device, DimensionTag >,
+  public StorageLayer< MeshConfig, Device, typename DimensionTag::Increment >
 {
 public:
    using BaseType = StorageLayer< MeshConfig, Device, typename DimensionTag::Increment >;
-   using MeshTraitsType   = MeshTraits< MeshConfig, Device >;
-   using GlobalIndexType  = typename MeshTraitsType::GlobalIndexType;
+   using MeshTraitsType = MeshTraits< MeshConfig, Device >;
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
    using EntityTraitsType = typename MeshTraitsType::template EntityTraits< DimensionTag::value >;
-   using EntityType       = typename EntityTraitsType::EntityType;
-   using EntityTopology   = typename EntityTraitsType::EntityTopology;
+   using EntityType = typename EntityTraitsType::EntityType;
+   using EntityTopology = typename EntityTraitsType::EntityTopology;
    using SubentityStorageBaseType = SubentityStorageLayerFamily< MeshConfig, Device, EntityTopology >;
    using SuperentityStorageBaseType = SuperentityStorageLayerFamily< MeshConfig, Device, DimensionTag >;
 
@@ -224,12 +205,15 @@ public:
       operator=( other );
    }
 
-   StorageLayer& operator=( const StorageLayer& other ) = default;
+   StorageLayer&
+   operator=( const StorageLayer& other ) = default;
 
-   StorageLayer& operator=( StorageLayer&& other ) = default;
+   StorageLayer&
+   operator=( StorageLayer&& other ) = default;
 
    template< typename Device_ >
-   StorageLayer& operator=( const StorageLayer< MeshConfig, Device_, DimensionTag >& other )
+   StorageLayer&
+   operator=( const StorageLayer< MeshConfig, Device_, DimensionTag >& other )
    {
       entitiesCount = other.getEntitiesCount( DimensionTag() );
       SubentityStorageBaseType::operator=( other );
@@ -238,7 +222,8 @@ public:
       return *this;
    }
 
-   void print( std::ostream& str ) const
+   void
+   print( std::ostream& str ) const
    {
       str << "Number of entities with dimension " << DimensionTag::value << ": " << entitiesCount << std::endl;
       SubentityStorageBaseType::print( str );
@@ -247,25 +232,25 @@ public:
       BaseType::print( str );
    }
 
-   bool operator==( const StorageLayer& meshLayer ) const
+   bool
+   operator==( const StorageLayer& meshLayer ) const
    {
-      return ( entitiesCount == meshLayer.entitiesCount &&
-               SubentityStorageBaseType::operator==( meshLayer ) &&
-               SuperentityStorageBaseType::operator==( meshLayer ) &&
-               BaseType::operator==( meshLayer ) );
+      return ( entitiesCount == meshLayer.entitiesCount && SubentityStorageBaseType::operator==( meshLayer )
+               && SuperentityStorageBaseType::operator==( meshLayer ) && BaseType::operator==( meshLayer ) );
    }
 
-
    using BaseType::getEntitiesCount;
    __cuda_callable__
-   GlobalIndexType getEntitiesCount( DimensionTag ) const
+   GlobalIndexType
+   getEntitiesCount( DimensionTag ) const
    {
       return this->entitiesCount;
    }
 
 protected:
    using BaseType::setEntitiesCount;
-   void setEntitiesCount( DimensionTag, const GlobalIndexType& entitiesCount )
+   void
+   setEntitiesCount( DimensionTag, const GlobalIndexType& entitiesCount )
    {
       this->entitiesCount = entitiesCount;
    }
@@ -277,13 +262,12 @@ protected:
    friend class StorageLayer;
 };
 
-template< typename MeshConfig,
-          typename Device >
+template< typename MeshConfig, typename Device >
 class StorageLayer< MeshConfig, Device, DimensionTag< MeshConfig::meshDimension + 1 >, false >
 {
 protected:
-   using DimensionTag     = Meshes::DimensionTag< MeshConfig::meshDimension >;
-   using GlobalIndexType  = typename MeshConfig::GlobalIndexType;
+   using DimensionTag = Meshes::DimensionTag< MeshConfig::meshDimension >;
+   using GlobalIndexType = typename MeshConfig::GlobalIndexType;
 
    StorageLayer() = default;
 
@@ -292,29 +276,39 @@ protected:
    StorageLayer( StorageLayer&& other ) = default;
 
    template< typename Device_ >
-   StorageLayer( const StorageLayer< MeshConfig, Device_, DimensionTag >& other ) {}
+   StorageLayer( const StorageLayer< MeshConfig, Device_, DimensionTag >& other )
+   {}
 
-   StorageLayer& operator=( const StorageLayer& other ) = default;
+   StorageLayer&
+   operator=( const StorageLayer& other ) = default;
 
-   StorageLayer& operator=( StorageLayer&& other ) = default;
+   StorageLayer&
+   operator=( StorageLayer&& other ) = default;
 
    template< typename Device_ >
-   StorageLayer& operator=( const StorageLayer< MeshConfig, Device_, DimensionTag >& other )
+   StorageLayer&
+   operator=( const StorageLayer< MeshConfig, Device_, DimensionTag >& other )
    {
       return *this;
    }
 
+   void
+   setEntitiesCount()
+   {}
+   void
+   getEntitiesCount() const
+   {}
 
-   void setEntitiesCount() {}
-   void getEntitiesCount() const {}
-
-   void print( std::ostream& str ) const {}
+   void
+   print( std::ostream& str ) const
+   {}
 
-   bool operator==( const StorageLayer& meshLayer ) const
+   bool
+   operator==( const StorageLayer& meshLayer ) const
    {
       return true;
    }
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/MeshDetails/layers/SubentityStorageLayer.h b/src/TNL/Meshes/MeshDetails/layers/SubentityStorageLayer.h
index 669dc0530663a50789c14fedeec1bd53c271cc5b..e459908d771f1123ebfbfa3e14f6cac97a8b1287 100644
--- a/src/TNL/Meshes/MeshDetails/layers/SubentityStorageLayer.h
+++ b/src/TNL/Meshes/MeshDetails/layers/SubentityStorageLayer.h
@@ -24,15 +24,16 @@ template< typename MeshConfig,
           typename Device,
           typename EntityTopology,
           typename SubdimensionTag,
-          bool SubentityStorage = WeakSubentityStorageTrait< MeshConfig, Device, typename MeshTraits< MeshConfig, Device >::template EntityTraits< EntityTopology::dimension >::EntityTopology, SubdimensionTag >::storageEnabled,
+          bool SubentityStorage = WeakSubentityStorageTrait<
+             MeshConfig,
+             Device,
+             typename MeshTraits< MeshConfig, Device >::template EntityTraits< EntityTopology::dimension >::EntityTopology,
+             SubdimensionTag >::storageEnabled,
           bool IsDynamicTopology = Topologies::IsDynamicTopology< EntityTopology >::value >
 class SubentityStorageLayer;
 
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology >
-class SubentityStorageLayerFamily
-   : public SubentityStorageLayer< MeshConfig, Device, EntityTopology, DimensionTag< 0 > >
+template< typename MeshConfig, typename Device, typename EntityTopology >
+class SubentityStorageLayerFamily : public SubentityStorageLayer< MeshConfig, Device, EntityTopology, DimensionTag< 0 > >
 {
    using BaseType = SubentityStorageLayer< MeshConfig, Device, EntityTopology, DimensionTag< 0 > >;
    using MeshTraitsType = MeshTraits< MeshConfig, Device >;
@@ -49,7 +50,7 @@ protected:
    setSubentitiesCounts( const typename MeshTraitsType::NeighborCountsArray& counts )
    {
       static_assert( EntityTopology::dimension > Subdimension, "Invalid combination of Dimension and Subdimension." );
-      BaseType::setSubentitiesCounts( DimensionTag< Subdimension >( ), counts );
+      BaseType::setSubentitiesCounts( DimensionTag< Subdimension >(), counts );
    }
 
    template< int Subdimension >
@@ -57,7 +58,7 @@ protected:
    setSubentitiesCounts( typename MeshTraitsType::NeighborCountsArray&& counts )
    {
       static_assert( EntityTopology::dimension > Subdimension, "Invalid combination of Dimension and Subdimension." );
-      BaseType::setSubentitiesCounts( DimensionTag< Subdimension >( ), std::move( counts ) );
+      BaseType::setSubentitiesCounts( DimensionTag< Subdimension >(), std::move( counts ) );
    }
 
    template< int Subdimension >
@@ -66,7 +67,7 @@ protected:
    getSubentitiesCount( const GlobalIndexType entityIndex ) const
    {
       static_assert( EntityTopology::dimension > Subdimension, "Invalid combination of Dimension and Subdimension." );
-      return BaseType::getSubentitiesCount( DimensionTag< Subdimension >( ), entityIndex );
+      return BaseType::getSubentitiesCount( DimensionTag< Subdimension >(), entityIndex );
    }
 
    template< int Subdimension >
@@ -94,24 +95,16 @@ protected:
  *  SUBENTITY STORAGE     DYNAMIC TOPOLOGY
  *        TRUE                FALSE
  */
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology,
-          typename SubdimensionTag >
-class SubentityStorageLayer< MeshConfig,
-                             Device,
-                             EntityTopology,
-                             SubdimensionTag,
-                             true,
-                             false >
-   : public SubentityStorageLayer< MeshConfig, Device, EntityTopology, typename SubdimensionTag::Increment >
+template< typename MeshConfig, typename Device, typename EntityTopology, typename SubdimensionTag >
+class SubentityStorageLayer< MeshConfig, Device, EntityTopology, SubdimensionTag, true, false >
+: public SubentityStorageLayer< MeshConfig, Device, EntityTopology, typename SubdimensionTag::Increment >
 {
    using BaseType = SubentityStorageLayer< MeshConfig, Device, EntityTopology, typename SubdimensionTag::Increment >;
-   using MeshTraitsType      = MeshTraits< MeshConfig, Device >;
+   using MeshTraitsType = MeshTraits< MeshConfig, Device >;
 
 protected:
-   using GlobalIndexType    = typename MeshTraitsType::GlobalIndexType;
-   using LocalIndexType     = typename MeshTraitsType::LocalIndexType;
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
    using SubentityMatrixType = typename MeshTraitsType::template SubentityMatrixType< EntityTopology::dimension >;
 
    SubentityStorageLayer() = default;
@@ -126,42 +119,50 @@ protected:
       operator=( other );
    }
 
-   SubentityStorageLayer& operator=( const SubentityStorageLayer& other ) = default;
+   SubentityStorageLayer&
+   operator=( const SubentityStorageLayer& other ) = default;
 
-   SubentityStorageLayer& operator=( SubentityStorageLayer&& other ) = default;
+   SubentityStorageLayer&
+   operator=( SubentityStorageLayer&& other ) = default;
 
    template< typename Device_ >
-   SubentityStorageLayer& operator=( const SubentityStorageLayer< MeshConfig, Device_, EntityTopology, SubdimensionTag >& other )
+   SubentityStorageLayer&
+   operator=( const SubentityStorageLayer< MeshConfig, Device_, EntityTopology, SubdimensionTag >& other )
    {
       BaseType::operator=( other );
       matrix = other.matrix;
       return *this;
    }
 
-   void print( std::ostream& str ) const
+   void
+   print( std::ostream& str ) const
    {
       BaseType::print( str );
-      str << "Adjacency matrix for subentities with dimension " << SubdimensionTag::value << " of entities with dimension " << EntityTopology::dimension << " is: " << std::endl;
+      str << "Adjacency matrix for subentities with dimension " << SubdimensionTag::value << " of entities with dimension "
+          << EntityTopology::dimension << " is: " << std::endl;
       str << matrix << std::endl;
    }
 
-   bool operator==( const SubentityStorageLayer& layer ) const
+   bool
+   operator==( const SubentityStorageLayer& layer ) const
    {
-      return ( BaseType::operator==( layer ) &&
-               matrix == layer.matrix );
+      return ( BaseType::operator==( layer ) && matrix == layer.matrix );
    }
 
 protected:
    using BaseType::setSubentitiesCounts;
-   void setSubentitiesCounts( SubdimensionTag, const typename MeshTraitsType::NeighborCountsArray& counts )
+   void
+   setSubentitiesCounts( SubdimensionTag, const typename MeshTraitsType::NeighborCountsArray& counts )
    {}
 
-   void setSubentitiesCounts( SubdimensionTag, typename MeshTraitsType::NeighborCountsArray&& counts )
+   void
+   setSubentitiesCounts( SubdimensionTag, typename MeshTraitsType::NeighborCountsArray&& counts )
    {}
 
    using BaseType::getSubentitiesCount;
    __cuda_callable__
-   LocalIndexType getSubentitiesCount( SubdimensionTag, const GlobalIndexType entityIndex ) const
+   LocalIndexType
+   getSubentitiesCount( SubdimensionTag, const GlobalIndexType entityIndex ) const
    {
       using SubentityTraitsType = typename MeshTraitsType::template SubentityTraits< EntityTopology, SubdimensionTag::value >;
       return SubentityTraitsType::count;
@@ -169,13 +170,15 @@ protected:
 
    using BaseType::getSubentitiesMatrix;
    __cuda_callable__
-   SubentityMatrixType& getSubentitiesMatrix( SubdimensionTag )
+   SubentityMatrixType&
+   getSubentitiesMatrix( SubdimensionTag )
    {
       return matrix;
    }
 
    __cuda_callable__
-   const SubentityMatrixType& getSubentitiesMatrix( SubdimensionTag ) const
+   const SubentityMatrixType&
+   getSubentitiesMatrix( SubdimensionTag ) const
    {
       return matrix;
    }
@@ -184,7 +187,12 @@ private:
    SubentityMatrixType matrix;
 
    // friend class is needed for templated assignment operators
-   template< typename MeshConfig_, typename Device_, typename EntityTopology_, typename SubdimensionTag_, bool Storage_, bool dynamicTopology_ >
+   template< typename MeshConfig_,
+             typename Device_,
+             typename EntityTopology_,
+             typename SubdimensionTag_,
+             bool Storage_,
+             bool dynamicTopology_ >
    friend class SubentityStorageLayer;
 };
 
@@ -194,24 +202,16 @@ private:
  *  SUBENTITY STORAGE     DYNAMIC TOPOLOGY
  *        TRUE                  TRUE
  */
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology,
-          typename SubdimensionTag >
-class SubentityStorageLayer< MeshConfig,
-                             Device,
-                             EntityTopology,
-                             SubdimensionTag,
-                             true,
-                             true >
-   : public SubentityStorageLayer< MeshConfig, Device, EntityTopology, typename SubdimensionTag::Increment >
+template< typename MeshConfig, typename Device, typename EntityTopology, typename SubdimensionTag >
+class SubentityStorageLayer< MeshConfig, Device, EntityTopology, SubdimensionTag, true, true >
+: public SubentityStorageLayer< MeshConfig, Device, EntityTopology, typename SubdimensionTag::Increment >
 {
-   using BaseType       = SubentityStorageLayer< MeshConfig, Device, EntityTopology, typename SubdimensionTag::Increment >;
+   using BaseType = SubentityStorageLayer< MeshConfig, Device, EntityTopology, typename SubdimensionTag::Increment >;
    using MeshTraitsType = MeshTraits< MeshConfig, Device >;
 
 protected:
-   using GlobalIndexType     = typename MeshTraitsType::GlobalIndexType;
-   using LocalIndexType      = typename MeshTraitsType::LocalIndexType;
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
    using NeighborCountsArray = typename MeshTraitsType::NeighborCountsArray;
    using SubentityMatrixType = typename MeshTraitsType::template SubentityMatrixType< EntityTopology::dimension >;
 
@@ -227,12 +227,15 @@ protected:
       operator=( other );
    }
 
-   SubentityStorageLayer& operator=( const SubentityStorageLayer& other ) = default;
+   SubentityStorageLayer&
+   operator=( const SubentityStorageLayer& other ) = default;
 
-   SubentityStorageLayer& operator=( SubentityStorageLayer&& other ) = default;
+   SubentityStorageLayer&
+   operator=( SubentityStorageLayer&& other ) = default;
 
    template< typename Device_ >
-   SubentityStorageLayer& operator=( const SubentityStorageLayer< MeshConfig, Device_, EntityTopology, SubdimensionTag >& other )
+   SubentityStorageLayer&
+   operator=( const SubentityStorageLayer< MeshConfig, Device_, EntityTopology, SubdimensionTag >& other )
    {
       BaseType::operator=( other );
       subentitiesCounts = other.subentitiesCounts;
@@ -240,61 +243,69 @@ protected:
       return *this;
    }
 
-   void save( File& file ) const
+   void
+   save( File& file ) const
    {
       BaseType::save( file );
       matrix.save( file );
    }
 
-   void load( File& file )
+   void
+   load( File& file )
    {
       BaseType::load( file );
       matrix.load( file );
       matrix.getCompressedRowLengths( subentitiesCounts );
    }
 
-   void print( std::ostream& str ) const
+   void
+   print( std::ostream& str ) const
    {
       BaseType::print( str );
-      str << "Adjacency matrix for subentities with dimension " << SubdimensionTag::value << " of entities with dimension " << EntityTopology::dimension << " is: " << std::endl;
+      str << "Adjacency matrix for subentities with dimension " << SubdimensionTag::value << " of entities with dimension "
+          << EntityTopology::dimension << " is: " << std::endl;
       str << matrix << std::endl;
    }
 
-   bool operator==( const SubentityStorageLayer& layer ) const
+   bool
+   operator==( const SubentityStorageLayer& layer ) const
    {
-      return ( BaseType::operator==( layer ) &&
-               subentitiesCounts == layer.subentitiesCounts &&
-               matrix == layer.matrix );
+      return ( BaseType::operator==( layer ) && subentitiesCounts == layer.subentitiesCounts && matrix == layer.matrix );
    }
 
 protected:
    using BaseType::setSubentitiesCounts;
-   void setSubentitiesCounts( SubdimensionTag, const NeighborCountsArray& counts )
+   void
+   setSubentitiesCounts( SubdimensionTag, const NeighborCountsArray& counts )
    {
       subentitiesCounts = counts;
    }
 
-   void setSubentitiesCounts( SubdimensionTag, NeighborCountsArray&& counts )
+   void
+   setSubentitiesCounts( SubdimensionTag, NeighborCountsArray&& counts )
    {
       subentitiesCounts = std::move( counts );
    }
 
    using BaseType::getSubentitiesCount;
    __cuda_callable__
-   LocalIndexType getSubentitiesCount( SubdimensionTag, const GlobalIndexType entityIndex ) const
+   LocalIndexType
+   getSubentitiesCount( SubdimensionTag, const GlobalIndexType entityIndex ) const
    {
       return subentitiesCounts[ entityIndex ];
    }
 
    using BaseType::getSubentitiesMatrix;
    __cuda_callable__
-   SubentityMatrixType& getSubentitiesMatrix( SubdimensionTag )
+   SubentityMatrixType&
+   getSubentitiesMatrix( SubdimensionTag )
    {
       return matrix;
    }
 
    __cuda_callable__
-   const SubentityMatrixType& getSubentitiesMatrix( SubdimensionTag ) const
+   const SubentityMatrixType&
+   getSubentitiesMatrix( SubdimensionTag ) const
    {
       return matrix;
    }
@@ -304,7 +315,12 @@ private:
    SubentityMatrixType matrix;
 
    // friend class is needed for templated assignment operators
-   template< typename MeshConfig_, typename Device_, typename EntityTopology_, typename SubdimensionTag_, bool Storage_, bool dynamicTopology_ >
+   template< typename MeshConfig_,
+             typename Device_,
+             typename EntityTopology_,
+             typename SubdimensionTag_,
+             bool Storage_,
+             bool dynamicTopology_ >
    friend class SubentityStorageLayer;
 };
 
@@ -314,24 +330,18 @@ private:
  *  SUBENTITY STORAGE     DYNAMIC TOPOLOGY     TOPOLOGY     Subdimension
  *        TRUE                  TRUE           Polygon           0
  */
-template< typename MeshConfig,
-          typename Device >
-class SubentityStorageLayer< MeshConfig,
-                             Device,
-                             Topologies::Polygon,
-                             DimensionTag< 0 >,
-                             true,
-                             true >
-   : public SubentityStorageLayer< MeshConfig, Device, Topologies::Polygon, typename DimensionTag< 0 >::Increment >
+template< typename MeshConfig, typename Device >
+class SubentityStorageLayer< MeshConfig, Device, Topologies::Polygon, DimensionTag< 0 >, true, true >
+: public SubentityStorageLayer< MeshConfig, Device, Topologies::Polygon, typename DimensionTag< 0 >::Increment >
 {
    using EntityTopology = Topologies::Polygon;
    using SubdimensionTag = DimensionTag< 0 >;
-   using BaseType       = SubentityStorageLayer< MeshConfig, Device, EntityTopology, typename SubdimensionTag::Increment >;
+   using BaseType = SubentityStorageLayer< MeshConfig, Device, EntityTopology, typename SubdimensionTag::Increment >;
    using MeshTraitsType = MeshTraits< MeshConfig, Device >;
 
 protected:
-   using GlobalIndexType     = typename MeshTraitsType::GlobalIndexType;
-   using LocalIndexType      = typename MeshTraitsType::LocalIndexType;
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
    using NeighborCountsArray = typename MeshTraitsType::NeighborCountsArray;
    using SubentityMatrixType = typename MeshTraitsType::template SubentityMatrixType< EntityTopology::dimension >;
 
@@ -347,12 +357,15 @@ protected:
       operator=( other );
    }
 
-   SubentityStorageLayer& operator=( const SubentityStorageLayer& other ) = default;
+   SubentityStorageLayer&
+   operator=( const SubentityStorageLayer& other ) = default;
 
-   SubentityStorageLayer& operator=( SubentityStorageLayer&& other ) = default;
+   SubentityStorageLayer&
+   operator=( SubentityStorageLayer&& other ) = default;
 
    template< typename Device_ >
-   SubentityStorageLayer& operator=( const SubentityStorageLayer< MeshConfig, Device_, EntityTopology, SubdimensionTag >& other )
+   SubentityStorageLayer&
+   operator=( const SubentityStorageLayer< MeshConfig, Device_, EntityTopology, SubdimensionTag >& other )
    {
       BaseType::operator=( other );
       subentitiesCounts = other.subentitiesCounts;
@@ -360,55 +373,62 @@ protected:
       return *this;
    }
 
-   void print( std::ostream& str ) const
+   void
+   print( std::ostream& str ) const
    {
       BaseType::print( str );
-      str << "Adjacency matrix for subentities with dimension " << SubdimensionTag::value << " of entities with dimension " << EntityTopology::dimension << " is: " << std::endl;
+      str << "Adjacency matrix for subentities with dimension " << SubdimensionTag::value << " of entities with dimension "
+          << EntityTopology::dimension << " is: " << std::endl;
       str << matrix << std::endl;
    }
 
-   bool operator==( const SubentityStorageLayer& layer ) const
+   bool
+   operator==( const SubentityStorageLayer& layer ) const
    {
-      return ( BaseType::operator==( layer ) &&
-               subentitiesCounts == layer.subentitiesCounts &&
-               matrix == layer.matrix );
+      return ( BaseType::operator==( layer ) && subentitiesCounts == layer.subentitiesCounts && matrix == layer.matrix );
    }
 
 protected:
    using BaseType::setSubentitiesCounts;
-   void setSubentitiesCounts( SubdimensionTag, const NeighborCountsArray& counts )
+   void
+   setSubentitiesCounts( SubdimensionTag, const NeighborCountsArray& counts )
    {
       subentitiesCounts = counts;
    }
 
-   void setSubentitiesCounts( SubdimensionTag, NeighborCountsArray&& counts )
+   void
+   setSubentitiesCounts( SubdimensionTag, NeighborCountsArray&& counts )
    {
       subentitiesCounts = std::move( counts );
    }
 
    using BaseType::getSubentitiesCount;
    __cuda_callable__
-   LocalIndexType getSubentitiesCount( SubdimensionTag, const GlobalIndexType entityIndex ) const
+   LocalIndexType
+   getSubentitiesCount( SubdimensionTag, const GlobalIndexType entityIndex ) const
    {
       return subentitiesCounts[ entityIndex ];
    }
 
    // Subdimension 1 has identical subentitiesCounts as Subdimension 0
    __cuda_callable__
-   LocalIndexType getSubentitiesCount( typename SubdimensionTag::Increment, const GlobalIndexType entityIndex ) const
+   LocalIndexType
+   getSubentitiesCount( typename SubdimensionTag::Increment, const GlobalIndexType entityIndex ) const
    {
       return subentitiesCounts[ entityIndex ];
    }
 
    using BaseType::getSubentitiesMatrix;
    __cuda_callable__
-   SubentityMatrixType& getSubentitiesMatrix( SubdimensionTag )
+   SubentityMatrixType&
+   getSubentitiesMatrix( SubdimensionTag )
    {
       return matrix;
    }
 
    __cuda_callable__
-   const SubentityMatrixType& getSubentitiesMatrix( SubdimensionTag ) const
+   const SubentityMatrixType&
+   getSubentitiesMatrix( SubdimensionTag ) const
    {
       return matrix;
    }
@@ -418,7 +438,12 @@ private:
    SubentityMatrixType matrix;
 
    // friend class is needed for templated assignment operators
-   template< typename MeshConfig_, typename Device_, typename EntityTopology_, typename SubdimensionTag_, bool Storage_, bool dynamicTopology_ >
+   template< typename MeshConfig_,
+             typename Device_,
+             typename EntityTopology_,
+             typename SubdimensionTag_,
+             bool Storage_,
+             bool dynamicTopology_ >
    friend class SubentityStorageLayer;
 };
 
@@ -428,24 +453,18 @@ private:
  *  SUBENTITY STORAGE     DYNAMIC TOPOLOGY     TOPOLOGY     Subdimension
  *        TRUE                  TRUE           Polygon           1
  */
-template< typename MeshConfig,
-          typename Device >
-class SubentityStorageLayer< MeshConfig,
-                             Device,
-                             Topologies::Polygon,
-                             DimensionTag< 1 >,
-                             true,
-                             true >
-   : public SubentityStorageLayer< MeshConfig, Device, Topologies::Polygon, typename DimensionTag< 1 >::Increment >
+template< typename MeshConfig, typename Device >
+class SubentityStorageLayer< MeshConfig, Device, Topologies::Polygon, DimensionTag< 1 >, true, true >
+: public SubentityStorageLayer< MeshConfig, Device, Topologies::Polygon, typename DimensionTag< 1 >::Increment >
 {
    using EntityTopology = Topologies::Polygon;
    using SubdimensionTag = DimensionTag< 1 >;
-   using BaseType       = SubentityStorageLayer< MeshConfig, Device, EntityTopology, typename SubdimensionTag::Increment >;
+   using BaseType = SubentityStorageLayer< MeshConfig, Device, EntityTopology, typename SubdimensionTag::Increment >;
    using MeshTraitsType = MeshTraits< MeshConfig, Device >;
 
 protected:
-   using GlobalIndexType     = typename MeshTraitsType::GlobalIndexType;
-   using LocalIndexType      = typename MeshTraitsType::LocalIndexType;
+   using GlobalIndexType = typename MeshTraitsType::GlobalIndexType;
+   using LocalIndexType = typename MeshTraitsType::LocalIndexType;
    using NeighborCountsArray = typename MeshTraitsType::NeighborCountsArray;
    using SubentityMatrixType = typename MeshTraitsType::template SubentityMatrixType< EntityTopology::dimension >;
 
@@ -461,50 +480,59 @@ protected:
       operator=( other );
    }
 
-   SubentityStorageLayer& operator=( const SubentityStorageLayer& other ) = default;
+   SubentityStorageLayer&
+   operator=( const SubentityStorageLayer& other ) = default;
 
-   SubentityStorageLayer& operator=( SubentityStorageLayer&& other ) = default;
+   SubentityStorageLayer&
+   operator=( SubentityStorageLayer&& other ) = default;
 
    template< typename Device_ >
-   SubentityStorageLayer& operator=( const SubentityStorageLayer< MeshConfig, Device_, EntityTopology, SubdimensionTag >& other )
+   SubentityStorageLayer&
+   operator=( const SubentityStorageLayer< MeshConfig, Device_, EntityTopology, SubdimensionTag >& other )
    {
       BaseType::operator=( other );
       matrix = other.matrix;
       return *this;
    }
 
-   void print( std::ostream& str ) const
+   void
+   print( std::ostream& str ) const
    {
       BaseType::print( str );
-      str << "Adjacency matrix for subentities with dimension " << SubdimensionTag::value << " of entities with dimension " << EntityTopology::dimension << " is: " << std::endl;
+      str << "Adjacency matrix for subentities with dimension " << SubdimensionTag::value << " of entities with dimension "
+          << EntityTopology::dimension << " is: " << std::endl;
       str << matrix << std::endl;
    }
 
-   bool operator==( const SubentityStorageLayer& layer ) const
+   bool
+   operator==( const SubentityStorageLayer& layer ) const
    {
-      return ( BaseType::operator==( layer ) &&
-               matrix == layer.matrix );
+      return ( BaseType::operator==( layer ) && matrix == layer.matrix );
    }
 
 protected:
    using BaseType::setSubentitiesCounts;
-   void setSubentitiesCounts( SubdimensionTag, const NeighborCountsArray& counts )
+   void
+   setSubentitiesCounts( SubdimensionTag, const NeighborCountsArray& counts )
    {}
 
-   void setSubentitiesCounts( SubdimensionTag, NeighborCountsArray&& counts )
+   void
+   setSubentitiesCounts( SubdimensionTag, NeighborCountsArray&& counts )
    {}
 
    // getSubentitiesCount for subdimension 1 is defined in the specialization for subdimension 0
 
    using BaseType::getSubentitiesMatrix;
    __cuda_callable__
-   SubentityMatrixType& getSubentitiesMatrix( SubdimensionTag )
+   SubentityMatrixType&
+   getSubentitiesMatrix( SubdimensionTag )
    {
       return matrix;
    }
 
    __cuda_callable__
-   const SubentityMatrixType& getSubentitiesMatrix( SubdimensionTag ) const
+   const SubentityMatrixType&
+   getSubentitiesMatrix( SubdimensionTag ) const
    {
       return matrix;
    }
@@ -513,7 +541,12 @@ private:
    SubentityMatrixType matrix;
 
    // friend class is needed for templated assignment operators
-   template< typename MeshConfig_, typename Device_, typename EntityTopology_, typename SubdimensionTag_, bool Storage_, bool dynamicTopology_ >
+   template< typename MeshConfig_,
+             typename Device_,
+             typename EntityTopology_,
+             typename SubdimensionTag_,
+             bool Storage_,
+             bool dynamicTopology_ >
    friend class SubentityStorageLayer;
 };
 
@@ -523,31 +556,21 @@ private:
  *  SUBENTITY STORAGE     DYNAMIC TOPOLOGY
  *       FALSE               TRUE/FALSE
  */
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology,
-          typename SubdimensionTag,
-          bool dynamicTopology >
-class SubentityStorageLayer< MeshConfig,
-                             Device,
-                             EntityTopology,
-                             SubdimensionTag,
-                             false,
-                             dynamicTopology >
-   : public SubentityStorageLayer< MeshConfig, Device, EntityTopology, typename SubdimensionTag::Increment >
+template< typename MeshConfig, typename Device, typename EntityTopology, typename SubdimensionTag, bool dynamicTopology >
+class SubentityStorageLayer< MeshConfig, Device, EntityTopology, SubdimensionTag, false, dynamicTopology >
+: public SubentityStorageLayer< MeshConfig, Device, EntityTopology, typename SubdimensionTag::Increment >
 {
    using BaseType = SubentityStorageLayer< MeshConfig, Device, EntityTopology, typename SubdimensionTag::Increment >;
+
 public:
    // inherit constructors and assignment operators (including templated versions)
    using BaseType::BaseType;
    using BaseType::operator=;
 };
 
-// termination of recursive inheritance (everything is reduced to EntityStorage == false thanks to the WeakSubentityStorageTrait)
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology,
-          bool dynamicTopology >
+// termination of recursive inheritance (everything is reduced to EntityStorage == false thanks to the
+// WeakSubentityStorageTrait)
+template< typename MeshConfig, typename Device, typename EntityTopology, bool dynamicTopology >
 class SubentityStorageLayer< MeshConfig,
                              Device,
                              EntityTopology,
@@ -565,24 +588,40 @@ protected:
    explicit SubentityStorageLayer( const SubentityStorageLayer& other ) = default;
    SubentityStorageLayer( SubentityStorageLayer&& other ) = default;
    template< typename Device_ >
-   SubentityStorageLayer( const SubentityStorageLayer< MeshConfig, Device_, EntityTopology, SubdimensionTag >& other ) {}
-   SubentityStorageLayer& operator=( const SubentityStorageLayer& other ) = default;
-   SubentityStorageLayer& operator=( SubentityStorageLayer&& other ) = default;
+   SubentityStorageLayer( const SubentityStorageLayer< MeshConfig, Device_, EntityTopology, SubdimensionTag >& other )
+   {}
+   SubentityStorageLayer&
+   operator=( const SubentityStorageLayer& other ) = default;
+   SubentityStorageLayer&
+   operator=( SubentityStorageLayer&& other ) = default;
    template< typename Device_ >
-   SubentityStorageLayer& operator=( const SubentityStorageLayer< MeshConfig, Device_, EntityTopology, SubdimensionTag >& other ) { return *this; }
+   SubentityStorageLayer&
+   operator=( const SubentityStorageLayer< MeshConfig, Device_, EntityTopology, SubdimensionTag >& other )
+   {
+      return *this;
+   }
 
-   void print( std::ostream& str ) const {}
+   void
+   print( std::ostream& str ) const
+   {}
 
-   bool operator==( const SubentityStorageLayer& layer ) const
+   bool
+   operator==( const SubentityStorageLayer& layer ) const
    {
       return true;
    }
 
-   void setSubentitiesCounts( SubdimensionTag, const typename MeshTraitsType::NeighborCountsArray& );
-   void setSubentitiesCounts( SubdimensionTag, typename MeshTraitsType::NeighborCountsArray&& );
-   void getSubentitiesCount( SubdimensionTag ) {}
-   void getSubentitiesMatrix( SubdimensionTag ) {}
+   void
+   setSubentitiesCounts( SubdimensionTag, const typename MeshTraitsType::NeighborCountsArray& );
+   void
+   setSubentitiesCounts( SubdimensionTag, typename MeshTraitsType::NeighborCountsArray&& );
+   void
+   getSubentitiesCount( SubdimensionTag )
+   {}
+   void
+   getSubentitiesMatrix( SubdimensionTag )
+   {}
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/MeshDetails/layers/SuperentityStorageLayer.h b/src/TNL/Meshes/MeshDetails/layers/SuperentityStorageLayer.h
index 9461651e0ebb0ef2b56e93de0780817d2e006852..a49442296e662edfc16640ea69445cc3f5b8b04e 100644
--- a/src/TNL/Meshes/MeshDetails/layers/SuperentityStorageLayer.h
+++ b/src/TNL/Meshes/MeshDetails/layers/SuperentityStorageLayer.h
@@ -24,17 +24,19 @@ template< typename MeshConfig,
           typename Device,
           typename EntityDimensionTag,
           typename SuperdimensionTag,
-          bool SuperentityStorage = WeakSuperentityStorageTrait< MeshConfig, Device, typename MeshTraits< MeshConfig, Device >::template EntityTraits< EntityDimensionTag::value >::EntityTopology, SuperdimensionTag >::storageEnabled >
+          bool SuperentityStorage = WeakSuperentityStorageTrait<
+             MeshConfig,
+             Device,
+             typename MeshTraits< MeshConfig, Device >::template EntityTraits< EntityDimensionTag::value >::EntityTopology,
+             SuperdimensionTag >::storageEnabled >
 class SuperentityStorageLayer;
 
-template< typename MeshConfig,
-          typename Device,
-          typename EntityDimensionTag >
+template< typename MeshConfig, typename Device, typename EntityDimensionTag >
 class SuperentityStorageLayerFamily
-   : public SuperentityStorageLayer< MeshConfig,
-                                     Device,
-                                     EntityDimensionTag,
-                                     DimensionTag< MeshTraits< MeshConfig, Device >::meshDimension > >
+: public SuperentityStorageLayer< MeshConfig,
+                                  Device,
+                                  EntityDimensionTag,
+                                  DimensionTag< MeshTraits< MeshConfig, Device >::meshDimension > >
 {
    using BaseType = SuperentityStorageLayer< MeshConfig,
                                              Device,
@@ -85,12 +87,9 @@ protected:
    }
 };
 
-template< typename MeshConfig,
-          typename Device,
-          typename EntityDimensionTag,
-          typename SuperdimensionTag >
+template< typename MeshConfig, typename Device, typename EntityDimensionTag, typename SuperdimensionTag >
 class SuperentityStorageLayer< MeshConfig, Device, EntityDimensionTag, SuperdimensionTag, true >
-   : public SuperentityStorageLayer< MeshConfig, Device, EntityDimensionTag, typename SuperdimensionTag::Decrement >
+: public SuperentityStorageLayer< MeshConfig, Device, EntityDimensionTag, typename SuperdimensionTag::Decrement >
 {
    using BaseType = SuperentityStorageLayer< MeshConfig, Device, EntityDimensionTag, typename SuperdimensionTag::Decrement >;
    using MeshTraitsType = MeshTraits< MeshConfig, Device >;
@@ -111,12 +110,15 @@ protected:
       operator=( other );
    }
 
-   SuperentityStorageLayer& operator=( const SuperentityStorageLayer& other ) = default;
+   SuperentityStorageLayer&
+   operator=( const SuperentityStorageLayer& other ) = default;
 
-   SuperentityStorageLayer& operator=( SuperentityStorageLayer&& other ) = default;
+   SuperentityStorageLayer&
+   operator=( SuperentityStorageLayer&& other ) = default;
 
    template< typename Device_ >
-   SuperentityStorageLayer& operator=( const SuperentityStorageLayer< MeshConfig, Device_, EntityDimensionTag, SuperdimensionTag >& other )
+   SuperentityStorageLayer&
+   operator=( const SuperentityStorageLayer< MeshConfig, Device_, EntityDimensionTag, SuperdimensionTag >& other )
    {
       BaseType::operator=( other );
       superentitiesCounts = other.superentitiesCounts;
@@ -124,44 +126,48 @@ protected:
       return *this;
    }
 
-
-   void print( std::ostream& str ) const
+   void
+   print( std::ostream& str ) const
    {
       BaseType::print( str );
-      str << "Adjacency matrix for superentities with dimension " << SuperdimensionTag::value << " of entities with dimension " << EntityDimensionTag::value << " is: " << std::endl;
+      str << "Adjacency matrix for superentities with dimension " << SuperdimensionTag::value << " of entities with dimension "
+          << EntityDimensionTag::value << " is: " << std::endl;
       str << matrix << std::endl;
    }
 
-   bool operator==( const SuperentityStorageLayer& layer ) const
+   bool
+   operator==( const SuperentityStorageLayer& layer ) const
    {
-      return ( BaseType::operator==( layer ) &&
-               superentitiesCounts == layer.superentitiesCounts &&
-               matrix == layer.matrix );
+      return ( BaseType::operator==( layer ) && superentitiesCounts == layer.superentitiesCounts && matrix == layer.matrix );
    }
 
 protected:
    using BaseType::getSuperentitiesCountsArray;
    __cuda_callable__
-   NeighborCountsArray& getSuperentitiesCountsArray( SuperdimensionTag )
+   NeighborCountsArray&
+   getSuperentitiesCountsArray( SuperdimensionTag )
    {
       return superentitiesCounts;
    }
 
    __cuda_callable__
-   const NeighborCountsArray& getSuperentitiesCountsArray( SuperdimensionTag ) const
+   const NeighborCountsArray&
+   getSuperentitiesCountsArray( SuperdimensionTag ) const
    {
       return superentitiesCounts;
    }
 
    using BaseType::getSuperentitiesMatrix;
    __cuda_callable__
-   SuperentityMatrixType& getSuperentitiesMatrix( SuperdimensionTag )
+   SuperentityMatrixType&
+   getSuperentitiesMatrix( SuperdimensionTag )
    {
       return matrix;
    }
 
    __cuda_callable__
-   const SuperentityMatrixType& getSuperentitiesMatrix( SuperdimensionTag ) const
+   const SuperentityMatrixType&
+   getSuperentitiesMatrix( SuperdimensionTag ) const
    {
       return matrix;
    }
@@ -175,24 +181,21 @@ private:
    friend class SuperentityStorageLayer;
 };
 
-template< typename MeshConfig,
-          typename Device,
-          typename EntityDimensionTag,
-          typename SuperdimensionTag >
+template< typename MeshConfig, typename Device, typename EntityDimensionTag, typename SuperdimensionTag >
 class SuperentityStorageLayer< MeshConfig, Device, EntityDimensionTag, SuperdimensionTag, false >
-   : public SuperentityStorageLayer< MeshConfig, Device, EntityDimensionTag, typename SuperdimensionTag::Decrement >
+: public SuperentityStorageLayer< MeshConfig, Device, EntityDimensionTag, typename SuperdimensionTag::Decrement >
 {
    using BaseType = SuperentityStorageLayer< MeshConfig, Device, EntityDimensionTag, typename SuperdimensionTag::Decrement >;
+
 public:
    // inherit constructors and assignment operators (including templated versions)
    using BaseType::BaseType;
    using BaseType::operator=;
 };
 
-// termination of recursive inheritance (everything is reduced to EntityStorage == false thanks to the WeakSuperentityStorageTrait)
-template< typename MeshConfig,
-          typename Device,
-          typename EntityDimensionTag >
+// termination of recursive inheritance (everything is reduced to EntityStorage == false thanks to the
+// WeakSuperentityStorageTrait)
+template< typename MeshConfig, typename Device, typename EntityDimensionTag >
 class SuperentityStorageLayer< MeshConfig, Device, EntityDimensionTag, EntityDimensionTag, false >
 {
    using SuperdimensionTag = EntityDimensionTag;
@@ -202,23 +205,37 @@ protected:
    explicit SuperentityStorageLayer( const SuperentityStorageLayer& other ) = default;
    SuperentityStorageLayer( SuperentityStorageLayer&& other ) = default;
    template< typename Device_ >
-   SuperentityStorageLayer( const SuperentityStorageLayer< MeshConfig, Device_, EntityDimensionTag, SuperdimensionTag >& other ) {}
-   SuperentityStorageLayer& operator=( const SuperentityStorageLayer& other ) = default;
-   SuperentityStorageLayer& operator=( SuperentityStorageLayer&& other ) = default;
+   SuperentityStorageLayer( const SuperentityStorageLayer< MeshConfig, Device_, EntityDimensionTag, SuperdimensionTag >& other )
+   {}
+   SuperentityStorageLayer&
+   operator=( const SuperentityStorageLayer& other ) = default;
+   SuperentityStorageLayer&
+   operator=( SuperentityStorageLayer&& other ) = default;
    template< typename Device_ >
-   SuperentityStorageLayer& operator=( const SuperentityStorageLayer< MeshConfig, Device_, EntityDimensionTag, SuperdimensionTag >& other ) { return *this; }
+   SuperentityStorageLayer&
+   operator=( const SuperentityStorageLayer< MeshConfig, Device_, EntityDimensionTag, SuperdimensionTag >& other )
+   {
+      return *this;
+   }
 
-   void getSuperentitiesCountsArray() {}
+   void
+   getSuperentitiesCountsArray()
+   {}
 
-   void print( std::ostream& str ) const {}
+   void
+   print( std::ostream& str ) const
+   {}
 
-   bool operator==( const SuperentityStorageLayer& layer ) const
+   bool
+   operator==( const SuperentityStorageLayer& layer ) const
    {
       return true;
    }
 
-   void getSuperentitiesMatrix( SuperdimensionTag ) {}
+   void
+   getSuperentitiesMatrix( SuperdimensionTag )
+   {}
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/MeshDetails/traits/MeshEntityTraits.h b/src/TNL/Meshes/MeshDetails/traits/MeshEntityTraits.h
index f1d5ad2045e87f103431955befb33b1b78ec4b6a..195bdcbe16003f24dafd9a0c57d0c476efc0f2c7 100644
--- a/src/TNL/Meshes/MeshDetails/traits/MeshEntityTraits.h
+++ b/src/TNL/Meshes/MeshDetails/traits/MeshEntityTraits.h
@@ -23,7 +23,8 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename MeshConfig, typename Device, typename EntityTopology > class MeshEntity;
+template< typename MeshConfig, typename Device, typename EntityTopology >
+class MeshEntity;
 
 /****
  *       Mesh entity traits with specializations
@@ -31,9 +32,7 @@ template< typename MeshConfig, typename Device, typename EntityTopology > class
  *  DYNAMIC TOPOLOGY
  *       FALSE
  */
-template< typename MeshConfig,
-          typename Device,
-          int Dimension >
+template< typename MeshConfig, typename Device, int Dimension >
 class MeshEntityTraits< MeshConfig, Device, Dimension, false >
 {
    using GlobalIndexType = typename MeshConfig::GlobalIndexType;
@@ -41,16 +40,20 @@ class MeshEntityTraits< MeshConfig, Device, Dimension, false >
 public:
    static_assert( 0 <= Dimension && Dimension <= MeshConfig::meshDimension, "invalid dimension" );
 
-   using EntityTopology                = typename EntityTopologyGetter< MeshConfig, DimensionTag< Dimension > >::Topology;
-   using EntityType                    = MeshEntity< MeshConfig, Device, EntityTopology >;
-   using SeedType                      = EntitySeed< MeshConfig, EntityTopology >;
-   
-   using SeedIndexedSetType            = Containers::UnorderedIndexedSet< SeedType, GlobalIndexType, typename SeedType::HashType, typename SeedType::KeyEqual >;
-   using SeedSetType                   = std::unordered_set< typename SeedIndexedSetType::key_type, typename SeedIndexedSetType::hasher, typename SeedIndexedSetType::key_equal >;
-   using SeedMatrixType                = EntitySeedMatrix< MeshConfig, EntityTopology >;
+   using EntityTopology = typename EntityTopologyGetter< MeshConfig, DimensionTag< Dimension > >::Topology;
+   using EntityType = MeshEntity< MeshConfig, Device, EntityTopology >;
+   using SeedType = EntitySeed< MeshConfig, EntityTopology >;
+
+   using SeedIndexedSetType =
+      Containers::UnorderedIndexedSet< SeedType, GlobalIndexType, typename SeedType::HashType, typename SeedType::KeyEqual >;
+   using SeedSetType = std::unordered_set< typename SeedIndexedSetType::key_type,
+                                           typename SeedIndexedSetType::hasher,
+                                           typename SeedIndexedSetType::key_equal >;
+   using SeedMatrixType = EntitySeedMatrix< MeshConfig, EntityTopology >;
 
    // container for storing the subentity indices
-   using SubentityMatrixType = Matrices::SparseMatrix< bool, Device, GlobalIndexType, Matrices::GeneralMatrix, EllpackSegments >;
+   using SubentityMatrixType =
+      Matrices::SparseMatrix< bool, Device, GlobalIndexType, Matrices::GeneralMatrix, EllpackSegments >;
 };
 
 /****
@@ -59,9 +62,7 @@ public:
  *  DYNAMIC TOPOLOGY
  *       TRUE
  */
-template< typename MeshConfig,
-          typename Device,
-          int Dimension >
+template< typename MeshConfig, typename Device, int Dimension >
 class MeshEntityTraits< MeshConfig, Device, Dimension, true >
 {
    using GlobalIndexType = typename MeshConfig::GlobalIndexType;
@@ -69,17 +70,21 @@ class MeshEntityTraits< MeshConfig, Device, Dimension, true >
 public:
    static_assert( 0 <= Dimension && Dimension <= MeshConfig::meshDimension, "invalid dimension" );
 
-   using EntityTopology                = typename EntityTopologyGetter< MeshConfig, DimensionTag< Dimension > >::Topology;
-   using EntityType                    = MeshEntity< MeshConfig, Device, EntityTopology >;
-   using SeedType                      = EntitySeed< MeshConfig, EntityTopology >;
-   
-   using SeedIndexedSetType            = Containers::UnorderedIndexedSet< SeedType, GlobalIndexType, typename SeedType::HashType, typename SeedType::KeyEqual >;
-   using SeedSetType                   = std::unordered_set< typename SeedIndexedSetType::key_type, typename SeedIndexedSetType::hasher, typename SeedIndexedSetType::key_equal >;
-   using SeedMatrixType                = EntitySeedMatrix< MeshConfig, EntityTopology >;
+   using EntityTopology = typename EntityTopologyGetter< MeshConfig, DimensionTag< Dimension > >::Topology;
+   using EntityType = MeshEntity< MeshConfig, Device, EntityTopology >;
+   using SeedType = EntitySeed< MeshConfig, EntityTopology >;
+
+   using SeedIndexedSetType =
+      Containers::UnorderedIndexedSet< SeedType, GlobalIndexType, typename SeedType::HashType, typename SeedType::KeyEqual >;
+   using SeedSetType = std::unordered_set< typename SeedIndexedSetType::key_type,
+                                           typename SeedIndexedSetType::hasher,
+                                           typename SeedIndexedSetType::key_equal >;
+   using SeedMatrixType = EntitySeedMatrix< MeshConfig, EntityTopology >;
 
    // container for storing the subentity indices
-   using SubentityMatrixType = Matrices::SparseMatrix< bool, Device, GlobalIndexType, Matrices::GeneralMatrix, SlicedEllpackSegments >;
+   using SubentityMatrixType =
+      Matrices::SparseMatrix< bool, Device, GlobalIndexType, Matrices::GeneralMatrix, SlicedEllpackSegments >;
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/MeshDetails/traits/MeshSubentityTraits.h b/src/TNL/Meshes/MeshDetails/traits/MeshSubentityTraits.h
index a2b0c9319a54f159f09fd3f35c93ab61549540d0..7225e3e335873c2fb61344995be3ab018a7f85da 100644
--- a/src/TNL/Meshes/MeshDetails/traits/MeshSubentityTraits.h
+++ b/src/TNL/Meshes/MeshDetails/traits/MeshSubentityTraits.h
@@ -25,14 +25,11 @@ namespace Meshes {
  *  DYNAMIC TOPOLOGY
  *       FALSE
  */
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology,
-          int Dimension >
+template< typename MeshConfig, typename Device, typename EntityTopology, int Dimension >
 class MeshSubentityTraits< MeshConfig, Device, EntityTopology, Dimension, false >
 {
    using GlobalIndexType = typename MeshConfig::GlobalIndexType;
-   using LocalIndexType  = typename MeshConfig::LocalIndexType;
+   using LocalIndexType = typename MeshConfig::LocalIndexType;
 
 public:
    static_assert( 0 <= Dimension && Dimension <= MeshConfig::meshDimension, "invalid dimension" );
@@ -42,17 +39,13 @@ public:
    static constexpr int count = Topologies::Subtopology< EntityTopology, Dimension >::count;
 
    using SubentityTopology = typename MeshEntityTraits< MeshConfig, Device, Dimension >::EntityTopology;
-   using SubentityType     = typename MeshEntityTraits< MeshConfig, Device, Dimension >::EntityType;
+   using SubentityType = typename MeshEntityTraits< MeshConfig, Device, Dimension >::EntityType;
 
-   template< LocalIndexType subentityIndex,
-             LocalIndexType subentityVertexIndex >
+   template< LocalIndexType subentityIndex, LocalIndexType subentityVertexIndex >
    struct Vertex
    {
-      static constexpr int index = Topologies::SubentityVertexMap<
-                  EntityTopology,
-                  SubentityTopology,
-                  subentityIndex,
-                  subentityVertexIndex >::index;
+      static constexpr int index =
+         Topologies::SubentityVertexMap< EntityTopology, SubentityTopology, subentityIndex, subentityVertexIndex >::index;
    };
 };
 
@@ -62,14 +55,11 @@ public:
  *  DYNAMIC TOPOLOGY
  *       TRUE
  */
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology,
-          int Dimension >
+template< typename MeshConfig, typename Device, typename EntityTopology, int Dimension >
 class MeshSubentityTraits< MeshConfig, Device, EntityTopology, Dimension, true >
 {
    using GlobalIndexType = typename MeshConfig::GlobalIndexType;
-   using LocalIndexType  = typename MeshConfig::LocalIndexType;
+   using LocalIndexType = typename MeshConfig::LocalIndexType;
 
 public:
    static_assert( 0 <= Dimension && Dimension <= MeshConfig::meshDimension, "invalid dimension" );
@@ -78,8 +68,8 @@ public:
    static constexpr bool storageEnabled = MeshConfig::subentityStorage( EntityTopology::dimension, Dimension );
 
    using SubentityTopology = typename MeshEntityTraits< MeshConfig, Device, Dimension >::EntityTopology;
-   using SubentityType     = typename MeshEntityTraits< MeshConfig, Device, Dimension >::EntityType;
+   using SubentityType = typename MeshEntityTraits< MeshConfig, Device, Dimension >::EntityType;
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/MeshDetails/traits/MeshSuperentityTraits.h b/src/TNL/Meshes/MeshDetails/traits/MeshSuperentityTraits.h
index 8ef97721230c14ac99624daab7a44ebfe85e6239..2e9f243af2f477714b8408da8b274c81f59fc839 100644
--- a/src/TNL/Meshes/MeshDetails/traits/MeshSuperentityTraits.h
+++ b/src/TNL/Meshes/MeshDetails/traits/MeshSuperentityTraits.h
@@ -17,14 +17,11 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology,
-          int Dimension >
+template< typename MeshConfig, typename Device, typename EntityTopology, int Dimension >
 class MeshSuperentityTraits
 {
    using GlobalIndexType = typename MeshConfig::GlobalIndexType;
-   using LocalIndexType  = typename MeshConfig::LocalIndexType;
+   using LocalIndexType = typename MeshConfig::LocalIndexType;
 
 public:
    static_assert( 0 <= Dimension && Dimension <= MeshConfig::meshDimension, "invalid dimension" );
@@ -33,8 +30,8 @@ public:
    static constexpr bool storageEnabled = MeshConfig::superentityStorage( EntityTopology::dimension, Dimension );
 
    using SuperentityTopology = typename MeshEntityTraits< MeshConfig, Device, Dimension >::EntityTopology;
-   using SuperentityType     = typename MeshEntityTraits< MeshConfig, Device, Dimension >::EntityType;
+   using SuperentityType = typename MeshEntityTraits< MeshConfig, Device, Dimension >::EntityType;
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/MeshDetails/traits/MeshTraits.h b/src/TNL/Meshes/MeshDetails/traits/MeshTraits.h
index a93a8901db27306e81a81515d1337b7a73c082c3..825404878e36558426a09d885131af17817f24a5 100644
--- a/src/TNL/Meshes/MeshDetails/traits/MeshTraits.h
+++ b/src/TNL/Meshes/MeshDetails/traits/MeshTraits.h
@@ -26,18 +26,19 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename MeshConfig, typename Device, typename EntityTopology > class MeshEntity;
+template< typename MeshConfig, typename Device, typename EntityTopology >
+class MeshEntity;
 
 template< typename MeshConfig,
           typename EntityTopology,
           bool IsDynamicTopology = Topologies::IsDynamicTopology< EntityTopology >::value >
 class EntitySeed;
 
-template< typename MeshConfig,
-          typename DimensionTag >
+template< typename MeshConfig, typename DimensionTag >
 struct EntityTopologyGetter
 {
-   static_assert( DimensionTag::value <= MeshConfig::meshDimension, "There are no entities with dimension higher than the mesh dimension." );
+   static_assert( DimensionTag::value <= MeshConfig::meshDimension,
+                  "There are no entities with dimension higher than the mesh dimension." );
    using Topology = typename Topologies::Subtopology< typename MeshConfig::CellTopology, DimensionTag::value >::Topology;
 };
 
@@ -50,7 +51,8 @@ struct EntityTopologyGetter< MeshConfig, DimensionTag< MeshConfig::CellTopology:
 template< typename MeshConfig,
           typename Device,
           int Dimension,
-          bool IsDynamicTopology = Topologies::IsDynamicTopology< typename EntityTopologyGetter< MeshConfig, DimensionTag< Dimension > >::Topology >::value >
+          bool IsDynamicTopology = Topologies::IsDynamicTopology<
+             typename EntityTopologyGetter< MeshConfig, DimensionTag< Dimension > >::Topology >::value >
 class MeshEntityTraits;
 
 template< typename MeshConfig,
@@ -60,7 +62,8 @@ template< typename MeshConfig,
           bool IsDynamicTopology = Topologies::IsDynamicTopology< EntityTopology >::value >
 class MeshSubentityTraits;
 
-template< typename MeshConfig, typename Device, typename MeshEntity, int Superdimension > class MeshSuperentityTraits;
+template< typename MeshConfig, typename Device, typename MeshEntity, int Superdimension >
+class MeshSuperentityTraits;
 
 // helper templates (must be public because nvcc sucks, and outside of MeshTraits to avoid duplicate code generation)
 template< typename Device, typename Index, typename IndexAlocator >
@@ -68,31 +71,30 @@ using EllpackSegments = Algorithms::Segments::Ellpack< Device, Index, IndexAloca
 template< typename Device, typename Index, typename IndexAlocator >
 using SlicedEllpackSegments = Algorithms::Segments::SlicedEllpack< Device, Index, IndexAlocator >;
 
-template< typename MeshConfig,
-          typename Device = Devices::Host >
+template< typename MeshConfig, typename Device = Devices::Host >
 class MeshTraits
 {
 public:
-   static constexpr int meshDimension  = MeshConfig::CellTopology::dimension;
+   static constexpr int meshDimension = MeshConfig::CellTopology::dimension;
    static constexpr int spaceDimension = MeshConfig::spaceDimension;
 
-   using DeviceType          = Device;
-   using GlobalIndexType     = typename MeshConfig::GlobalIndexType;
-   using LocalIndexType      = typename MeshConfig::LocalIndexType;
+   using DeviceType = Device;
+   using GlobalIndexType = typename MeshConfig::GlobalIndexType;
+   using LocalIndexType = typename MeshConfig::LocalIndexType;
 
-   using CellTopology        = typename MeshConfig::CellTopology;
-   using FaceTopology        = typename Topologies::Subtopology< CellTopology, meshDimension - 1 >::Topology;
-   using CellType            = MeshEntity< MeshConfig, Device, CellTopology >;
-   using VertexType          = MeshEntity< MeshConfig, Device, Topologies::Vertex >;
-   using PointType           = Containers::StaticVector< spaceDimension, typename MeshConfig::RealType >;
-   using FaceSeedType        = EntitySeed< MeshConfig, FaceTopology >;
-   using CellSeedType        = EntitySeed< MeshConfig, CellTopology >;
-   using EntityTagType       = std::uint8_t;
+   using CellTopology = typename MeshConfig::CellTopology;
+   using FaceTopology = typename Topologies::Subtopology< CellTopology, meshDimension - 1 >::Topology;
+   using CellType = MeshEntity< MeshConfig, Device, CellTopology >;
+   using VertexType = MeshEntity< MeshConfig, Device, Topologies::Vertex >;
+   using PointType = Containers::StaticVector< spaceDimension, typename MeshConfig::RealType >;
+   using FaceSeedType = EntitySeed< MeshConfig, FaceTopology >;
+   using CellSeedType = EntitySeed< MeshConfig, CellTopology >;
+   using EntityTagType = std::uint8_t;
 
    using NeighborCountsArray = Containers::Vector< LocalIndexType, DeviceType, GlobalIndexType >;
-   using PointArrayType      = Containers::Array< PointType, DeviceType, GlobalIndexType >;
-   using FaceSeedMatrixType  = EntitySeedMatrix< MeshConfig, FaceTopology >;
-   using CellSeedMatrixType  = EntitySeedMatrix< MeshConfig, CellTopology >;
+   using PointArrayType = Containers::Array< PointType, DeviceType, GlobalIndexType >;
+   using FaceSeedMatrixType = EntitySeedMatrix< MeshConfig, FaceTopology >;
+   using CellSeedMatrixType = EntitySeedMatrix< MeshConfig, CellTopology >;
 
    using EntityTagsArrayType = Containers::Array< EntityTagType, DeviceType, GlobalIndexType >;
 
@@ -112,11 +114,12 @@ public:
    using SubentityMatrixType = typename EntityTraits< Dimension >::SubentityMatrixType;
 
    // container for storing the superentity indices
-   using SuperentityMatrixType = Matrices::SparseMatrix< bool, Device, GlobalIndexType, Matrices::GeneralMatrix, SlicedEllpackSegments >;
+   using SuperentityMatrixType =
+      Matrices::SparseMatrix< bool, Device, GlobalIndexType, Matrices::GeneralMatrix, SlicedEllpackSegments >;
 
    // container for storing the dual graph adjacency matrix
    using DualGraph = Matrices::SparseMatrix< bool, Device, GlobalIndexType, Matrices::GeneralMatrix, SlicedEllpackSegments >;
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/MeshDetails/traits/WeakStorageTraits.h b/src/TNL/Meshes/MeshDetails/traits/WeakStorageTraits.h
index 1bbe88c556b4f0e5611f4f1fc6d771e71f042b8f..590fa525296593b026bf062021b1235259689f57 100644
--- a/src/TNL/Meshes/MeshDetails/traits/WeakStorageTraits.h
+++ b/src/TNL/Meshes/MeshDetails/traits/WeakStorageTraits.h
@@ -22,40 +22,35 @@ template< typename MeshConfig,
           typename Device,
           typename EntityTopology,
           typename SubdimensionTag,
-          bool sensible = (SubdimensionTag::value < EntityTopology::dimension) >
+          bool sensible = ( SubdimensionTag::value < EntityTopology::dimension ) >
 struct WeakSubentityStorageTrait
 {
-   static constexpr bool storageEnabled = MeshTraits< MeshConfig, Device >::template SubentityTraits< EntityTopology, SubdimensionTag::value >::storageEnabled;
+   static constexpr bool storageEnabled =
+      MeshTraits< MeshConfig, Device >::template SubentityTraits< EntityTopology, SubdimensionTag::value >::storageEnabled;
 };
 
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology,
-          typename SubdimensionTag >
+template< typename MeshConfig, typename Device, typename EntityTopology, typename SubdimensionTag >
 struct WeakSubentityStorageTrait< MeshConfig, Device, EntityTopology, SubdimensionTag, false >
 {
    static constexpr bool storageEnabled = false;
 };
 
-
 template< typename MeshConfig,
           typename Device,
           typename EntityTopology,
           typename SuperdimensionTag,
-          bool sensible = (SuperdimensionTag::value > EntityTopology::dimension) >
+          bool sensible = ( SuperdimensionTag::value > EntityTopology::dimension ) >
 struct WeakSuperentityStorageTrait
 {
-   static constexpr bool storageEnabled = MeshTraits< MeshConfig, Device >::template SuperentityTraits< EntityTopology, SuperdimensionTag::value >::storageEnabled;
+   static constexpr bool storageEnabled =
+      MeshTraits< MeshConfig, Device >::template SuperentityTraits< EntityTopology, SuperdimensionTag::value >::storageEnabled;
 };
 
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology,
-          typename SuperdimensionTag >
+template< typename MeshConfig, typename Device, typename EntityTopology, typename SuperdimensionTag >
 struct WeakSuperentityStorageTrait< MeshConfig, Device, EntityTopology, SuperdimensionTag, false >
 {
    static constexpr bool storageEnabled = false;
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/MeshEntity.h b/src/TNL/Meshes/MeshEntity.h
index c433d249ceab2e8e60378aac6703c75e2bdb2d25..7107d2bc75b70c0042d0772e9ed8e7d1b253a915 100644
--- a/src/TNL/Meshes/MeshEntity.h
+++ b/src/TNL/Meshes/MeshEntity.h
@@ -17,117 +17,129 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology_ >
+template< typename MeshConfig, typename Device, typename EntityTopology_ >
 class MeshEntity
 {
-   static_assert( std::is_same< EntityTopology_, typename Mesh< MeshConfig, Device >::template EntityTraits< EntityTopology_::dimension >::EntityTopology >::value,
-                  "Specified entity topology is not compatible with the MeshConfig." );
-
-   public:
-      using MeshType        = Mesh< MeshConfig, Device >;
-      using DeviceType      = Device;
-      using EntityTopology  = EntityTopology_;
-      using GlobalIndexType = typename MeshType::GlobalIndexType;
-      using LocalIndexType  = typename MeshType::LocalIndexType;
-      using PointType       = typename MeshType::PointType;
-      using TagType         = typename MeshType::MeshTraitsType::EntityTagType;
-
-      template< int Subdimension >
-      using SubentityTraits = typename MeshType::MeshTraitsType::template SubentityTraits< EntityTopology, Subdimension >;
-
-      template< int Superdimension >
-      using SuperentityTraits = typename MeshType::MeshTraitsType::template SuperentityTraits< EntityTopology, Superdimension >;
-
-      // constructors
-      MeshEntity() = delete;
-
-      __cuda_callable__
-      MeshEntity( const MeshType& mesh, const GlobalIndexType index );
-
-      __cuda_callable__
-      MeshEntity( const MeshEntity& entity ) = default;
-
-      __cuda_callable__
-      MeshEntity& operator=( const MeshEntity& entity ) = default;
-
-      __cuda_callable__
-      bool operator==( const MeshEntity& entity ) const;
-
-      __cuda_callable__
-      bool operator!=( const MeshEntity& entity ) const;
-
-      /**
-       * \brief Returns the dimension of this mesh entity.
-       */
-      static constexpr int getEntityDimension();
-
-      /**
-       * \brief Returns a reference to the mesh that owns this mesh entity.
-       */
-      __cuda_callable__
-      const MeshType& getMesh() const;
-
-      /**
-       * \brief Returns the index of this mesh entity.
-       */
-      __cuda_callable__
-      GlobalIndexType getIndex() const;
-
-      /**
-       * \brief Returns the spatial coordinates of this vertex.
-       *
-       * Can be used only when \ref getEntityDimension returns 0.
-       */
-      __cuda_callable__
-      PointType getPoint() const;
-
-      /**
-       * \brief Returns the count of subentities of this entity.
-       */
-      template< int Subdimension >
-      __cuda_callable__
-      LocalIndexType getSubentitiesCount() const;
-
-      /**
-       * \brief Returns the global index of the subentity specified by its local index.
-       */
-      template< int Subdimension >
-      __cuda_callable__
-      GlobalIndexType getSubentityIndex( const LocalIndexType localIndex ) const;
-
-      /**
-       * \brief Returns the count of superentities of this entity.
-       */
-      template< int Superdimension >
-      __cuda_callable__
-      LocalIndexType getSuperentitiesCount() const;
-
-      /**
-       * \brief Returns the global index of the superentity specified by its local index.
-       */
-      template< int Superdimension >
-      __cuda_callable__
-      GlobalIndexType getSuperentityIndex( const LocalIndexType localIndex ) const;
-
-      /**
-       * \brief Returns the tag associated with this entity.
-       */
-      __cuda_callable__
-      TagType getTag() const;
-
-   protected:
-      const MeshType* meshPointer = nullptr;
-      GlobalIndexType index = 0;
+   static_assert(
+      std::is_same<
+         EntityTopology_,
+         typename Mesh< MeshConfig, Device >::template EntityTraits< EntityTopology_::dimension >::EntityTopology >::value,
+      "Specified entity topology is not compatible with the MeshConfig." );
+
+public:
+   using MeshType = Mesh< MeshConfig, Device >;
+   using DeviceType = Device;
+   using EntityTopology = EntityTopology_;
+   using GlobalIndexType = typename MeshType::GlobalIndexType;
+   using LocalIndexType = typename MeshType::LocalIndexType;
+   using PointType = typename MeshType::PointType;
+   using TagType = typename MeshType::MeshTraitsType::EntityTagType;
+
+   template< int Subdimension >
+   using SubentityTraits = typename MeshType::MeshTraitsType::template SubentityTraits< EntityTopology, Subdimension >;
+
+   template< int Superdimension >
+   using SuperentityTraits = typename MeshType::MeshTraitsType::template SuperentityTraits< EntityTopology, Superdimension >;
+
+   // constructors
+   MeshEntity() = delete;
+
+   __cuda_callable__
+   MeshEntity( const MeshType& mesh, GlobalIndexType index );
+
+   __cuda_callable__
+   MeshEntity( const MeshEntity& entity ) = default;
+
+   __cuda_callable__
+   MeshEntity&
+   operator=( const MeshEntity& entity ) = default;
+
+   __cuda_callable__
+   bool
+   operator==( const MeshEntity& entity ) const;
+
+   __cuda_callable__
+   bool
+   operator!=( const MeshEntity& entity ) const;
+
+   /**
+    * \brief Returns the dimension of this mesh entity.
+    */
+   static constexpr int
+   getEntityDimension();
+
+   /**
+    * \brief Returns a reference to the mesh that owns this mesh entity.
+    */
+   __cuda_callable__
+   const MeshType&
+   getMesh() const;
+
+   /**
+    * \brief Returns the index of this mesh entity.
+    */
+   __cuda_callable__
+   GlobalIndexType
+   getIndex() const;
+
+   /**
+    * \brief Returns the spatial coordinates of this vertex.
+    *
+    * Can be used only when \ref getEntityDimension returns 0.
+    */
+   __cuda_callable__
+   PointType
+   getPoint() const;
+
+   /**
+    * \brief Returns the count of subentities of this entity.
+    */
+   template< int Subdimension >
+   __cuda_callable__
+   LocalIndexType
+   getSubentitiesCount() const;
+
+   /**
+    * \brief Returns the global index of the subentity specified by its local index.
+    */
+   template< int Subdimension >
+   __cuda_callable__
+   GlobalIndexType
+   getSubentityIndex( LocalIndexType localIndex ) const;
+
+   /**
+    * \brief Returns the count of superentities of this entity.
+    */
+   template< int Superdimension >
+   __cuda_callable__
+   LocalIndexType
+   getSuperentitiesCount() const;
+
+   /**
+    * \brief Returns the global index of the superentity specified by its local index.
+    */
+   template< int Superdimension >
+   __cuda_callable__
+   GlobalIndexType
+   getSuperentityIndex( LocalIndexType localIndex ) const;
+
+   /**
+    * \brief Returns the tag associated with this entity.
+    */
+   __cuda_callable__
+   TagType
+   getTag() const;
+
+protected:
+   const MeshType* meshPointer = nullptr;
+   GlobalIndexType index = 0;
 };
 
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology >
-std::ostream& operator<<( std::ostream& str, const MeshEntity< MeshConfig, Device, EntityTopology >& entity );
+template< typename MeshConfig, typename Device, typename EntityTopology >
+std::ostream&
+operator<<( std::ostream& str, const MeshEntity< MeshConfig, Device, EntityTopology >& entity );
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/MeshEntity.hpp>
diff --git a/src/TNL/Meshes/MeshEntity.hpp b/src/TNL/Meshes/MeshEntity.hpp
index 6d0fba94c873d0c7660bab59f7dbf5f53c2e8ad5..f3b60804f4a6808b7f772470c1ed21e396c43da5 100644
--- a/src/TNL/Meshes/MeshEntity.hpp
+++ b/src/TNL/Meshes/MeshEntity.hpp
@@ -17,154 +17,115 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology >
+template< typename MeshConfig, typename Device, typename EntityTopology >
 __cuda_callable__
-MeshEntity< MeshConfig, Device, EntityTopology >::
-MeshEntity( const MeshType& mesh, const GlobalIndexType index )
-: meshPointer( &mesh ),
-  index( index )
-{
-}
+MeshEntity< MeshConfig, Device, EntityTopology >::MeshEntity( const MeshType& mesh, GlobalIndexType index )
+: meshPointer( &mesh ), index( index )
+{}
 
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology >
+template< typename MeshConfig, typename Device, typename EntityTopology >
 __cuda_callable__
 bool
-MeshEntity< MeshConfig, Device, EntityTopology >::
-operator==( const MeshEntity& entity ) const
+MeshEntity< MeshConfig, Device, EntityTopology >::operator==( const MeshEntity& entity ) const
 {
    return getIndex() == entity.getIndex();
 }
 
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology >
+template< typename MeshConfig, typename Device, typename EntityTopology >
 __cuda_callable__
 bool
-MeshEntity< MeshConfig, Device, EntityTopology >::
-operator!=( const MeshEntity& entity ) const
+MeshEntity< MeshConfig, Device, EntityTopology >::operator!=( const MeshEntity& entity ) const
 {
    return ! ( *this == entity );
 }
 
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology >
+template< typename MeshConfig, typename Device, typename EntityTopology >
 constexpr int
-MeshEntity< MeshConfig, Device, EntityTopology >::
-getEntityDimension()
+MeshEntity< MeshConfig, Device, EntityTopology >::getEntityDimension()
 {
    return EntityTopology::dimension;
 }
 
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology >
+template< typename MeshConfig, typename Device, typename EntityTopology >
 __cuda_callable__
 const Mesh< MeshConfig, Device >&
-MeshEntity< MeshConfig, Device, EntityTopology >::
-getMesh() const
+MeshEntity< MeshConfig, Device, EntityTopology >::getMesh() const
 {
    return *meshPointer;
 }
 
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology >
+template< typename MeshConfig, typename Device, typename EntityTopology >
 __cuda_callable__
 typename Mesh< MeshConfig, Device >::GlobalIndexType
-MeshEntity< MeshConfig, Device, EntityTopology >::
-getIndex() const
+MeshEntity< MeshConfig, Device, EntityTopology >::getIndex() const
 {
    return index;
 }
 
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology >
+template< typename MeshConfig, typename Device, typename EntityTopology >
 __cuda_callable__
 typename MeshEntity< MeshConfig, Device, EntityTopology >::PointType
-MeshEntity< MeshConfig, Device, EntityTopology >::
-getPoint() const
+MeshEntity< MeshConfig, Device, EntityTopology >::getPoint() const
 {
    static_assert( getEntityDimension() == 0, "getPoint() can be used only on vertices" );
    return meshPointer->getPoint( getIndex() );
 }
 
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology >
-   template< int Subdimension >
+template< typename MeshConfig, typename Device, typename EntityTopology >
+template< int Subdimension >
 __cuda_callable__
 typename MeshEntity< MeshConfig, Device, EntityTopology >::LocalIndexType
-MeshEntity< MeshConfig, Device, EntityTopology >::
-getSubentitiesCount() const
+MeshEntity< MeshConfig, Device, EntityTopology >::getSubentitiesCount() const
 {
    TNL_ASSERT_TRUE( meshPointer, "meshPointer was not set" );
    return meshPointer->template getSubentitiesCount< getEntityDimension(), Subdimension >( this->getIndex() );
 }
 
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology >
-   template< int Subdimension >
+template< typename MeshConfig, typename Device, typename EntityTopology >
+template< int Subdimension >
 __cuda_callable__
 typename MeshEntity< MeshConfig, Device, EntityTopology >::GlobalIndexType
-MeshEntity< MeshConfig, Device, EntityTopology >::
-getSubentityIndex( const LocalIndexType localIndex ) const
+MeshEntity< MeshConfig, Device, EntityTopology >::getSubentityIndex( LocalIndexType localIndex ) const
 {
    TNL_ASSERT_TRUE( meshPointer, "meshPointer was not set" );
    return meshPointer->template getSubentityIndex< getEntityDimension(), Subdimension >( this->getIndex(), localIndex );
 }
 
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology >
-   template< int Superdimension >
+template< typename MeshConfig, typename Device, typename EntityTopology >
+template< int Superdimension >
 __cuda_callable__
 typename MeshEntity< MeshConfig, Device, EntityTopology >::LocalIndexType
-MeshEntity< MeshConfig, Device, EntityTopology >::
-getSuperentitiesCount() const
+MeshEntity< MeshConfig, Device, EntityTopology >::getSuperentitiesCount() const
 {
    TNL_ASSERT_TRUE( meshPointer, "meshPointer was not set" );
    return meshPointer->template getSuperentitiesCount< getEntityDimension(), Superdimension >( this->getIndex() );
 }
 
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology >
-   template< int Superdimension >
+template< typename MeshConfig, typename Device, typename EntityTopology >
+template< int Superdimension >
 __cuda_callable__
 typename MeshEntity< MeshConfig, Device, EntityTopology >::GlobalIndexType
-MeshEntity< MeshConfig, Device, EntityTopology >::
-getSuperentityIndex( const LocalIndexType localIndex ) const
+MeshEntity< MeshConfig, Device, EntityTopology >::getSuperentityIndex( LocalIndexType localIndex ) const
 {
    TNL_ASSERT_TRUE( meshPointer, "meshPointer was not set" );
    return meshPointer->template getSuperentityIndex< getEntityDimension(), Superdimension >( this->getIndex(), localIndex );
 }
 
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology >
+template< typename MeshConfig, typename Device, typename EntityTopology >
 __cuda_callable__
 typename MeshEntity< MeshConfig, Device, EntityTopology >::TagType
-MeshEntity< MeshConfig, Device, EntityTopology >::
-getTag() const
+MeshEntity< MeshConfig, Device, EntityTopology >::getTag() const
 {
    TNL_ASSERT_TRUE( meshPointer, "meshPointer was not set" );
    return meshPointer->template getEntityTag< getEntityDimension() >( this->getIndex() );
 }
 
-template< typename MeshConfig,
-          typename Device,
-          typename EntityTopology >
-std::ostream& operator<<( std::ostream& str, const MeshEntity< MeshConfig, Device, EntityTopology >& entity )
+template< typename MeshConfig, typename Device, typename EntityTopology >
+std::ostream&
+operator<<( std::ostream& str, const MeshEntity< MeshConfig, Device, EntityTopology >& entity )
 {
-   return str << getType< decltype(entity) >() << "( <meshPointer>, " << entity.getIndex() << " )";
+   return str << getType< decltype( entity ) >() << "( <meshPointer>, " << entity.getIndex() << " )";
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/NDMetaGrid.h b/src/TNL/Meshes/NDMetaGrid.h
index 2c5e5fd5b25df458552e755ea3672670b751fc65..03c46fa76a657f8497b754624f2091dd5f3f33d5 100644
--- a/src/TNL/Meshes/NDMetaGrid.h
+++ b/src/TNL/Meshes/NDMetaGrid.h
@@ -31,33 +31,38 @@ public:
    using CoordinatesType = Containers::StaticVector< Dimension, Index >;
 
    //! \brief Returns the spatial dimension of the grid.
-   static constexpr int getMeshDimension()
+   static constexpr int
+   getMeshDimension()
    {
       return Dimension;
    }
 
    //! \brief Sets the grid dimensions/size.
-   void setDimensions( const CoordinatesType& dimensions )
+   void
+   setDimensions( const CoordinatesType& dimensions )
    {
       this->dimensions = dimensions;
    }
 
    //! \brief Returns the grid dimensions/size.
-   const CoordinatesType& getDimensions() const
+   const CoordinatesType&
+   getDimensions() const
    {
       return dimensions;
    }
 
    //! \brief Sets the origin of the grid (coordinates of the left bottom front
    //! corner).
-   void setOrigin( const PointType& origin )
+   void
+   setOrigin( const PointType& origin )
    {
       this->origin = origin;
    }
 
    //! \brief Returns the origin of the grid (coordinates of the left bottom
    //! front corner).
-   const PointType& getOrigin() const
+   const PointType&
+   getOrigin() const
    {
       return origin;
    }
@@ -65,8 +70,8 @@ public:
    //! \brief Sets the domain of the grid (i.e., the origin and
    //! proportions/length). Note that space steps are computed using the
    //! current grid dimensions.
-   void setDomain( const PointType& origin,
-                   const PointType& proportions )
+   void
+   setDomain( const PointType& origin, const PointType& proportions )
    {
       this->origin = origin;
       this->spaceSteps = proportions / dimensions;
@@ -74,13 +79,15 @@ public:
 
    //! \brief Sets the space steps of the grid, i.e. the parameters usually
    //! denoted as \e hx, \e hy, \e hz.
-   void setSpaceSteps( const PointType& spaceSteps )
+   void
+   setSpaceSteps( const PointType& spaceSteps )
    {
       this->spaceSteps = spaceSteps;
    }
 
    //! \brief Returns the space steps of the grid.
-   const PointType& getSpaceSteps() const
+   const PointType&
+   getSpaceSteps() const
    {
       return spaceSteps;
    }
@@ -93,5 +100,5 @@ protected:
    PointType spaceSteps = 0;
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Readers/FPMAReader.h b/src/TNL/Meshes/Readers/FPMAReader.h
index cba4ad18eff278d2972b1ec54465a66345259696..2078b2d7e16eefdfd3eddf5c8e00046c7026e7fc 100644
--- a/src/TNL/Meshes/Readers/FPMAReader.h
+++ b/src/TNL/Meshes/Readers/FPMAReader.h
@@ -16,17 +16,15 @@ namespace TNL {
 namespace Meshes {
 namespace Readers {
 
-class FPMAReader
-: public MeshReader
+class FPMAReader : public MeshReader
 {
 public:
    FPMAReader() = default;
 
-   FPMAReader( const std::string& fileName )
-   : MeshReader( fileName )
-   {}
+   FPMAReader( const std::string& fileName ) : MeshReader( fileName ) {}
 
-   virtual void detectMesh() override
+   virtual void
+   detectMesh() override
    {
       reset();
 
@@ -52,7 +50,7 @@ public:
       std::vector< std::int32_t > faceConnectivityArray, faceOffsetsArray;
 
       // read number of points
-      NumberOfPoints = readValue< decltype(NumberOfPoints) >( inputFile );
+      NumberOfPoints = readValue< decltype( NumberOfPoints ) >( inputFile );
       if( ! inputFile ) {
          reset();
          throw MeshReaderError( "FPMAReader", "unable to read number of points, the file may be invalid or corrupted." );
@@ -70,14 +68,16 @@ public:
             PointType aux = readValue< PointType >( inputFile );
             if( ! inputFile ) {
                reset();
-               throw MeshReaderError( "FPMAReader", "unable to read " + std::to_string(i) + "th component of the vertex number " + std::to_string(pointIndex) + "." );
+               throw MeshReaderError( "FPMAReader",
+                                      "unable to read " + std::to_string( i ) + "th component of the vertex number "
+                                         + std::to_string( pointIndex ) + "." );
             }
             pointsArray.emplace_back( aux );
          }
       }
 
       // read number of faces
-      NumberOfFaces = readValue< decltype(NumberOfFaces) >( inputFile );
+      NumberOfFaces = readValue< decltype( NumberOfFaces ) >( inputFile );
       if( ! inputFile ) {
          reset();
          throw MeshReaderError( "FPMAReader", "unable to read number of faces, the file may be invalid or corrupted." );
@@ -87,9 +87,8 @@ public:
       faceConnectivityArray.reserve( NumberOfFaces );
       faceOffsetsArray.reserve( NumberOfFaces );
       for( std::size_t faceIndex = 0; faceIndex < NumberOfFaces; faceIndex++ ) {
-
          // read number of points of a face
-         size_t numberOfFacePoints = readValue< decltype(numberOfFacePoints) >( inputFile );
+         size_t numberOfFacePoints = readValue< decltype( numberOfFacePoints ) >( inputFile );
          if( ! inputFile ) {
             reset();
             throw MeshReaderError( "FPMAReader", "unable to read enough faces, the file may be invalid or corrupted." );
@@ -97,10 +96,12 @@ public:
 
          // read points of a face
          for( std::size_t i = 0; i < numberOfFacePoints; i++ ) {
-            size_t pointIndex = readValue< decltype(pointIndex) >( inputFile );
+            size_t pointIndex = readValue< decltype( pointIndex ) >( inputFile );
             if( ! inputFile ) {
                reset();
-               throw MeshReaderError( "FPMAReader", "unable to read " + std::to_string(i) + "th component of the face number " + std::to_string(faceIndex) + "." );
+               throw MeshReaderError( "FPMAReader",
+                                      "unable to read " + std::to_string( i ) + "th component of the face number "
+                                         + std::to_string( faceIndex ) + "." );
             }
             faceConnectivityArray.emplace_back( pointIndex );
          }
@@ -109,7 +110,7 @@ public:
       }
 
       // read number of cells
-      NumberOfCells = readValue< decltype(NumberOfCells) >( inputFile );
+      NumberOfCells = readValue< decltype( NumberOfCells ) >( inputFile );
       if( ! inputFile ) {
          reset();
          throw MeshReaderError( "FPMAReader", "unable to read number of cells, the file may be invalid or corrupted." );
@@ -119,9 +120,8 @@ public:
       cellConnectivityArray.reserve( NumberOfCells );
       cellOffsetsArray.reserve( NumberOfCells );
       for( std::size_t cellIndex = 0; cellIndex < NumberOfCells; cellIndex++ ) {
-
          // read number of faces of a cell
-         size_t numberOfCellFaces = readValue< decltype(numberOfCellFaces) >( inputFile );
+         size_t numberOfCellFaces = readValue< decltype( numberOfCellFaces ) >( inputFile );
          if( ! inputFile ) {
             reset();
             throw MeshReaderError( "FPMAReader", "unable to read enough cells, the file may be invalid or corrupted." );
@@ -129,10 +129,12 @@ public:
 
          // read faces of a cell
          for( std::size_t i = 0; i < numberOfCellFaces; i++ ) {
-            std::uint32_t faceIndex = readValue< decltype(faceIndex) >( inputFile );
+            std::uint32_t faceIndex = readValue< decltype( faceIndex ) >( inputFile );
             if( ! iss ) {
                reset();
-               throw MeshReaderError( "FPMAReader", "unable to read " + std::to_string(i) + "th component of the cell number " + std::to_string(cellIndex) + "." );
+               throw MeshReaderError( "FPMAReader",
+                                      "unable to read " + std::to_string( i ) + "th component of the cell number "
+                                         + std::to_string( cellIndex ) + "." );
             }
             cellConnectivityArray.emplace_back( faceIndex );
          }
@@ -141,18 +143,20 @@ public:
       }
 
       // set the arrays to the base class
-      this->pointsArray = std::move(pointsArray);
-      this->cellConnectivityArray = std::move(cellConnectivityArray);
-      this->cellOffsetsArray = std::move(cellOffsetsArray);
-      this->faceConnectivityArray = std::move(faceConnectivityArray);
-      this->faceOffsetsArray = std::move(faceOffsetsArray);
+      this->pointsArray = std::move( pointsArray );
+      this->cellConnectivityArray = std::move( cellConnectivityArray );
+      this->cellOffsetsArray = std::move( cellOffsetsArray );
+      this->faceConnectivityArray = std::move( faceConnectivityArray );
+      this->faceOffsetsArray = std::move( faceOffsetsArray );
 
       // indicate success by setting the mesh type
       meshType = "Meshes::Mesh";
    }
+
 private:
    template< typename T >
-   T readValue( std::ifstream& ifs )
+   T
+   readValue( std::ifstream& ifs )
    {
       skipComments( ifs );
       T val;
@@ -160,18 +164,19 @@ private:
       return val;
    }
 
-   void skipComments( std::ifstream& ifs )
+   void
+   skipComments( std::ifstream& ifs )
    {
       ifs >> std::ws;
       int c = ifs.peek();
       while( c == '#' && c != EOF ) {
-         ifs.ignore( std::numeric_limits<std::streamsize>::max(), '\n' ); // skip to the next line
+         ifs.ignore( std::numeric_limits< std::streamsize >::max(), '\n' );  // skip to the next line
          ifs >> std::ws;
          c = ifs.peek();
       }
    }
 };
 
-} // namespace Readers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Readers
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Readers/MeshReader.h b/src/TNL/Meshes/Readers/MeshReader.h
index 194a5039551975ffca974123dc37f45a2df3786a..47f3df7d49d36b4641383885c8815da34a7efefd 100644
--- a/src/TNL/Meshes/Readers/MeshReader.h
+++ b/src/TNL/Meshes/Readers/MeshReader.h
@@ -9,8 +9,9 @@
 #pragma once
 
 #include <string>
+#include <utility>
 #include <vector>
-#include <mpark/variant.hpp>   // backport of std::variant from C++17
+#include <mpark/variant.hpp>  // backport of std::variant from C++17
 
 #include <TNL/Meshes/MeshBuilder.h>
 #include <TNL/Meshes/VTKTraits.h>
@@ -21,10 +22,9 @@ namespace Meshes {
 //! \brief Namespace for mesh readers.
 namespace Readers {
 
-struct MeshReaderError
-: public std::runtime_error
+struct MeshReaderError : public std::runtime_error
 {
-   MeshReaderError( std::string readerName, std::string msg )
+   MeshReaderError( const std::string& readerName, const std::string& msg )
    : std::runtime_error( readerName + " error: " + msg )
    {}
 };
@@ -45,13 +45,12 @@ public:
 
    MeshReader() = default;
 
-   MeshReader( const std::string& fileName )
-   : fileName( fileName )
-   {}
+   MeshReader( std::string fileName ) : fileName( std::move( fileName ) ) {}
 
-   virtual ~MeshReader() {}
+   virtual ~MeshReader() = default;
 
-   void setFileName( const std::string& fileName )
+   void
+   setFileName( const std::string& fileName )
    {
       reset();
       this->fileName = fileName;
@@ -63,7 +62,8 @@ public:
     * In particular, implementations should call the \ref resetBase method to
     * reset the arrays holding the intermediate mesh representation.
     */
-   virtual void reset()
+   virtual void
+   reset()
    {
       resetBase();
    }
@@ -75,7 +75,8 @@ public:
     * that the mesh representation can be loaded into the mesh object by the
     * \ref loadMesh method.
     */
-   virtual void detectMesh() = 0;
+   virtual void
+   detectMesh() = 0;
 
    /**
     * \brief Method which loads the intermediate mesh representation into a
@@ -92,7 +93,7 @@ public:
    loadMesh( MeshType& mesh )
    {
       // check that detectMesh has been called
-      if( meshType == "" )
+      if( meshType.empty() )
          detectMesh();
 
       // check if we have a grid
@@ -100,30 +101,38 @@ public:
          throw MeshReaderError( "MeshReader", "the file does not contain a structured grid, it is " + meshType );
 
       if( getMeshDimension() != mesh.getMeshDimension() )
-         throw MeshReaderError( "MeshReader", "cannot load a " + std::to_string(getMeshDimension()) + "-dimensional "
-                                              "grid into a mesh of type " + std::string(getType(mesh)) );
+         throw MeshReaderError( "MeshReader",
+                                "cannot load a " + std::to_string( getMeshDimension() )
+                                   + "-dimensional "
+                                     "grid into a mesh of type "
+                                   + std::string( getType( mesh ) ) );
 
       // check that the grid attributes were set
       if( gridExtent.size() != 6 )
-         throw MeshReaderError( "MeshReader", "gridExtent has invalid size: " + std::to_string(gridExtent.size()) + " (should be 6)" );
+         throw MeshReaderError( "MeshReader",
+                                "gridExtent has invalid size: " + std::to_string( gridExtent.size() ) + " (should be 6)" );
       if( gridOrigin.size() != 3 )
-         throw MeshReaderError( "MeshReader", "gridOrigin has invalid size: " + std::to_string(gridOrigin.size()) + " (should be 3)" );
+         throw MeshReaderError( "MeshReader",
+                                "gridOrigin has invalid size: " + std::to_string( gridOrigin.size() ) + " (should be 3)" );
       if( gridSpacing.size() != 3 )
-         throw MeshReaderError( "MeshReader", "gridSpacing has invalid size: " + std::to_string(gridSpacing.size()) + " (should be 3)" );
+         throw MeshReaderError( "MeshReader",
+                                "gridSpacing has invalid size: " + std::to_string( gridSpacing.size() ) + " (should be 3)" );
 
       // split the extent into begin and end
-      typename MeshType::CoordinatesType begin, end;
+      typename MeshType::CoordinatesType begin;
+      typename MeshType::CoordinatesType end;
       for( int i = 0; i < begin.getSize(); i++ ) {
-         begin[i] = gridExtent[2 * i];
-         end[i] = gridExtent[2 * i + 1];
+         begin[ i ] = gridExtent[ 2 * i ];
+         end[ i ] = gridExtent[ 2 * i + 1 ];
       }
-      mesh.setDimensions(end - begin);
+      mesh.setDimensions( end - begin );
 
       // transform the origin and calculate proportions
-      typename MeshType::PointType origin, proportions;
+      typename MeshType::PointType origin;
+      typename MeshType::PointType proportions;
       for( int i = 0; i < origin.getSize(); i++ ) {
-         origin[i] = gridOrigin[i] + begin[i] * gridSpacing[i];
-         proportions[i] = (end[i] - begin[i]) * gridSpacing[i];
+         origin[ i ] = gridOrigin[ i ] + begin[ i ] * gridSpacing[ i ];
+         proportions[ i ] = ( end[ i ] - begin[ i ] ) * gridSpacing[ i ];
       }
       mesh.setDomain( origin, proportions );
    }
@@ -143,7 +152,7 @@ public:
    loadMesh( MeshType& mesh )
    {
       // check that detectMesh has been called
-      if( meshType == "" )
+      if( meshType.empty() )
          detectMesh();
 
       // check if we have an unstructured mesh
@@ -152,15 +161,17 @@ public:
 
       // skip empty mesh (the cell shape is indeterminate)
       if( NumberOfPoints == 0 && NumberOfCells == 0 ) {
-         mesh = MeshType {};
+         mesh = MeshType{};
          return;
       }
 
       // check that the cell shape mathes
-      const VTK::EntityShape meshCellShape = VTK::TopologyToEntityShape< typename MeshType::template EntityTraits< MeshType::getMeshDimension() >::EntityTopology >::shape;
+      const VTK::EntityShape meshCellShape = VTK::TopologyToEntityShape<
+         typename MeshType::template EntityTraits< MeshType::getMeshDimension() >::EntityTopology >::shape;
       if( meshCellShape != cellShape )
-         throw MeshReaderError( "MeshReader", "the mesh cell shape " + VTK::getShapeName(meshCellShape) + " does not match the shape "
-                                            + "of cells used in the file (" + VTK::getShapeName(cellShape) + ")" );
+         throw MeshReaderError( "MeshReader",
+                                "the mesh cell shape " + VTK::getShapeName( meshCellShape ) + " does not match the shape "
+                                   + "of cells used in the file (" + VTK::getShapeName( cellShape ) + ")" );
 
       using MeshBuilder = MeshBuilder< MeshType >;
       using NeighborCountsArray = typename MeshBuilder::NeighborCountsArray;
@@ -172,78 +183,81 @@ public:
       meshBuilder.setEntitiesCount( NumberOfPoints, NumberOfCells, NumberOfFaces );
 
       // assign points
-      visit( [&meshBuilder](auto&& array) {
-               PointType p;
-               std::size_t i = 0;
-               for( auto c : array ) {
-                  int dim = i++ % 3;
-                  if( dim >= PointType::getSize() )
-                     continue;
-                  p[dim] = c;
-                  if( dim == PointType::getSize() - 1 )
-                     meshBuilder.setPoint( (i - 1) / 3, p );
-               }
-            },
-            pointsArray
-         );
+      visit(
+         [ &meshBuilder ]( auto&& array )
+         {
+            PointType p;
+            std::size_t i = 0;
+            for( auto c : array ) {
+               int dim = i++ % 3;
+               if( dim >= PointType::getSize() )
+                  continue;
+               p[ dim ] = c;
+               if( dim == PointType::getSize() - 1 )
+                  meshBuilder.setPoint( ( i - 1 ) / 3, p );
+            }
+         },
+         pointsArray );
 
       // assign faces
-      visit( [this, &meshBuilder](auto&& connectivity) {
-               // let's just assume that the connectivity and offsets arrays have the same type...
-               using mpark::get;
-               const auto& offsets = get< std::decay_t<decltype(connectivity)> >( faceOffsetsArray );
-
-               // Set corners counts
-               NeighborCountsArray cornersCounts( NumberOfFaces );
-               std::size_t offsetStart = 0;
-               for( std::size_t i = 0; i < NumberOfFaces; i++ ) {
-                  const std::size_t offsetEnd = offsets[ i ];
-                  cornersCounts[ i ] = offsetEnd - offsetStart;
-                  offsetStart = offsetEnd;
-               }
-               meshBuilder.setFaceCornersCounts( std::move( cornersCounts ) );
-
-               // Set corner ids
-               offsetStart = 0;
-               for( std::size_t i = 0; i < NumberOfFaces; i++ ) {
-                  FaceSeedType seed = meshBuilder.getFaceSeed( i );
-                  const std::size_t offsetEnd = offsets[ i ];
-                  for( std::size_t o = offsetStart; o < offsetEnd; o++ )
-                     seed.setCornerId( o - offsetStart, connectivity[ o ] );
-                  offsetStart = offsetEnd;
-               }
-            },
-            faceConnectivityArray
-         );
+      visit(
+         [ this, &meshBuilder ]( auto&& connectivity )
+         {
+            // let's just assume that the connectivity and offsets arrays have the same type...
+            using mpark::get;
+            const auto& offsets = get< std::decay_t< decltype( connectivity ) > >( faceOffsetsArray );
+
+            // Set corners counts
+            NeighborCountsArray cornersCounts( NumberOfFaces );
+            std::size_t offsetStart = 0;
+            for( std::size_t i = 0; i < NumberOfFaces; i++ ) {
+               const std::size_t offsetEnd = offsets[ i ];
+               cornersCounts[ i ] = offsetEnd - offsetStart;
+               offsetStart = offsetEnd;
+            }
+            meshBuilder.setFaceCornersCounts( std::move( cornersCounts ) );
+
+            // Set corner ids
+            offsetStart = 0;
+            for( std::size_t i = 0; i < NumberOfFaces; i++ ) {
+               FaceSeedType seed = meshBuilder.getFaceSeed( i );
+               const std::size_t offsetEnd = offsets[ i ];
+               for( std::size_t o = offsetStart; o < offsetEnd; o++ )
+                  seed.setCornerId( o - offsetStart, connectivity[ o ] );
+               offsetStart = offsetEnd;
+            }
+         },
+         faceConnectivityArray );
 
       // assign cells
-      visit( [this, &meshBuilder](auto&& connectivity) {
-               // let's just assume that the connectivity and offsets arrays have the same type...
-               using mpark::get;
-               const auto& offsets = get< std::decay_t<decltype(connectivity)> >( cellOffsetsArray );
-
-               // Set corners counts
-               NeighborCountsArray cornersCounts( NumberOfCells );
-               std::size_t offsetStart = 0;
-               for( std::size_t i = 0; i < NumberOfCells; i++ ) {
-                  const std::size_t offsetEnd = offsets[ i ];
-                  cornersCounts[ i ] = offsetEnd - offsetStart;
-                  offsetStart = offsetEnd;
-               }
-               meshBuilder.setCellCornersCounts( std::move( cornersCounts ) );
-
-               // Set corner ids
-               offsetStart = 0;
-               for( std::size_t i = 0; i < NumberOfCells; i++ ) {
-                  CellSeedType seed = meshBuilder.getCellSeed( i );
-                  const std::size_t offsetEnd = offsets[ i ];
-                  for( std::size_t o = offsetStart; o < offsetEnd; o++ )
-                     seed.setCornerId( o - offsetStart, connectivity[ o ] );
-                  offsetStart = offsetEnd;
-               }
-            },
-            cellConnectivityArray
-         );
+      visit(
+         [ this, &meshBuilder ]( auto&& connectivity )
+         {
+            // let's just assume that the connectivity and offsets arrays have the same type...
+            using mpark::get;
+            const auto& offsets = get< std::decay_t< decltype( connectivity ) > >( cellOffsetsArray );
+
+            // Set corners counts
+            NeighborCountsArray cornersCounts( NumberOfCells );
+            std::size_t offsetStart = 0;
+            for( std::size_t i = 0; i < NumberOfCells; i++ ) {
+               const std::size_t offsetEnd = offsets[ i ];
+               cornersCounts[ i ] = offsetEnd - offsetStart;
+               offsetStart = offsetEnd;
+            }
+            meshBuilder.setCellCornersCounts( std::move( cornersCounts ) );
+
+            // Set corner ids
+            offsetStart = 0;
+            for( std::size_t i = 0; i < NumberOfCells; i++ ) {
+               CellSeedType seed = meshBuilder.getCellSeed( i );
+               const std::size_t offsetEnd = offsets[ i ];
+               for( std::size_t o = offsetStart; o < offsetEnd; o++ )
+                  seed.setCornerId( o - offsetStart, connectivity[ o ] );
+               offsetStart = offsetEnd;
+            }
+         },
+         cellConnectivityArray );
 
       // reset arrays since they are not needed anymore
       pointsArray = faceConnectivityArray = cellConnectivityArray = faceOffsetsArray = cellOffsetsArray = typesArray = {};
@@ -259,13 +273,15 @@ public:
    virtual VariantVector
    readPointData( std::string arrayName )
    {
-      throw Exceptions::NotImplementedError( "readPointData is not implemented in the mesh reader for this specific file format." );
+      throw Exceptions::NotImplementedError(
+         "readPointData is not implemented in the mesh reader for this specific file format." );
    }
 
    virtual VariantVector
    readCellData( std::string arrayName )
    {
-      throw Exceptions::NotImplementedError( "readCellData is not implemented in the mesh reader for this specific file format." );
+      throw Exceptions::NotImplementedError(
+         "readCellData is not implemented in the mesh reader for this specific file format." );
    }
 
    std::string
@@ -357,14 +373,13 @@ protected:
 
    // intermediate representation of the unstructured mesh (matches the VTU
    // file format, other formats have to be converted)
-   VariantVector pointsArray, cellConnectivityArray, cellOffsetsArray,
-                 faceConnectivityArray, faceOffsetsArray,
-                 typesArray;
+   VariantVector pointsArray, cellConnectivityArray, cellOffsetsArray, faceConnectivityArray, faceOffsetsArray, typesArray;
 
    // string representation of each array's value type
    std::string pointsType, connectivityType, offsetsType, typesType;
 
-   void resetBase()
+   void
+   resetBase()
    {
       meshType = "";
       NumberOfPoints = NumberOfFaces = NumberOfCells = 0;
@@ -378,20 +393,22 @@ protected:
    }
 
    template< typename T >
-   void reset_std_vectors( std::vector< T >& v )
+   void
+   reset_std_vectors( std::vector< T >& v )
    {
       v.clear();
       v.shrink_to_fit();
    }
 
    template< typename T, typename... Ts >
-   void reset_std_vectors( std::vector< T >& v, std::vector< Ts >&... vs )
+   void
+   reset_std_vectors( std::vector< T >& v, std::vector< Ts >&... vs )
    {
       reset_std_vectors( v );
       reset_std_vectors( vs... );
    }
 };
 
-} // namespace Readers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Readers
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Readers/NetgenReader.h b/src/TNL/Meshes/Readers/NetgenReader.h
index 5ba43754ded2a7f12119af93101a13ce591370ad..c11f3d5eb9e662acb993fc4acce6ac979a7d8b37 100644
--- a/src/TNL/Meshes/Readers/NetgenReader.h
+++ b/src/TNL/Meshes/Readers/NetgenReader.h
@@ -22,17 +22,15 @@ namespace TNL {
 namespace Meshes {
 namespace Readers {
 
-class NetgenReader
-: public MeshReader
+class NetgenReader : public MeshReader
 {
 public:
    NetgenReader() = default;
 
-   NetgenReader( const std::string& fileName )
-   : MeshReader( fileName )
-   {}
+   NetgenReader( const std::string& fileName ) : MeshReader( fileName ) {}
 
-   virtual void detectMesh() override
+   void
+   detectMesh() override
    {
       reset();
 
@@ -62,7 +60,8 @@ public:
 
       // arrays holding the data from the file
       std::vector< double > pointsArray;
-      std::vector< std::int32_t > connectivityArray, offsetsArray;
+      std::vector< std::int32_t > connectivityArray;
+      std::vector< std::int32_t > offsetsArray;
       std::vector< std::uint8_t > typesArray;
 
       // read points
@@ -99,7 +98,7 @@ public:
       else if( meshDimension == 3 )
          cellShape = VTK::EntityShape::Tetra;
       else
-         throw MeshReaderError( "NetgenReader", "unsupported mesh dimension: " + std::to_string(meshDimension) );
+         throw MeshReaderError( "NetgenReader", "unsupported mesh dimension: " + std::to_string( meshDimension ) );
 
       // skip whitespace
       inputFile >> std::ws;
@@ -116,8 +115,10 @@ public:
       for( std::size_t cellIndex = 0; cellIndex < NumberOfCells; cellIndex++ ) {
          if( ! inputFile ) {
             reset();
-            throw MeshReaderError( "NetgenReader", "unable to read enough cells, the file may be invalid or corrupted."
-                                                   " (cellIndex = " + std::to_string(cellIndex) + ")" );
+            throw MeshReaderError( "NetgenReader",
+                                   "unable to read enough cells, the file may be invalid or corrupted."
+                                   " (cellIndex = "
+                                      + std::to_string( cellIndex ) + ")" );
          }
          getline( inputFile, line );
 
@@ -131,8 +132,10 @@ public:
             iss >> vid;
             if( ! iss ) {
                reset();
-               throw MeshReaderError( "NetgenReader", "unable to read enough cells, the file may be invalid or corrupted."
-                                                      " (cellIndex = " + std::to_string(cellIndex) + ", subvertex = " + std::to_string(v) + ")" );
+               throw MeshReaderError( "NetgenReader",
+                                      "unable to read enough cells, the file may be invalid or corrupted."
+                                      " (cellIndex = "
+                                         + std::to_string( cellIndex ) + ", subvertex = " + std::to_string( v ) + ")" );
             }
             // convert point index from 1-based to 0-based
             connectivityArray.push_back( vid - 1 );
@@ -144,16 +147,16 @@ public:
       typesArray.resize( NumberOfCells, (std::uint8_t) cellShape );
 
       // set the arrays to the base class
-      this->pointsArray = std::move(pointsArray);
-      this->cellConnectivityArray = std::move(connectivityArray);
-      this->cellOffsetsArray = std::move(offsetsArray);
-      this->typesArray = std::move(typesArray);
+      this->pointsArray = std::move( pointsArray );
+      this->cellConnectivityArray = std::move( connectivityArray );
+      this->cellOffsetsArray = std::move( offsetsArray );
+      this->typesArray = std::move( typesArray );
 
       // indicate success by setting the mesh type
       meshType = "Meshes::Mesh";
    }
 };
 
-} // namespace Readers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Readers
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Readers/PVTIReader.h b/src/TNL/Meshes/Readers/PVTIReader.h
index a56ea6766ba7e6ba1c5b21e7da20f027597a9220..44e2a3ecc07cf9a6cb674ffa32e806cec8c59e8f 100644
--- a/src/TNL/Meshes/Readers/PVTIReader.h
+++ b/src/TNL/Meshes/Readers/PVTIReader.h
@@ -19,18 +19,18 @@ namespace TNL {
 namespace Meshes {
 namespace Readers {
 
-class PVTIReader
-: public XMLVTK
+class PVTIReader : public XMLVTK
 {
    std::string
-   getSourcePath( std::string source )
+   getSourcePath( const std::string& source )
    {
       namespace fs = std::experimental::filesystem;
-      return fs::path(fileName).parent_path() / source;
+      return fs::path( fileName ).parent_path() / source;
    }
 
 #ifdef HAVE_TINYXML2
-   void readParallelImageData()
+   void
+   readParallelImageData()
    {
       using namespace tinyxml2;
 
@@ -44,7 +44,7 @@ class PVTIReader
          std::stringstream ss( extent );
          gridExtent.resize( 6, 0 );
          for( int i = 0; i < 6; i++ ) {
-            ss >> gridExtent[i];
+            ss >> gridExtent[ i ];
             // check conversion error
             if( ! ss.good() )
                throw MeshReaderError( "VTIReader", "invalid extent: not a number: " + extent );
@@ -61,7 +61,7 @@ class PVTIReader
          std::stringstream ss( origin );
          gridOrigin.resize( 3 );
          for( int i = 0; i < 3; i++ ) {
-            ss >> gridOrigin[i];
+            ss >> gridOrigin[ i ];
             // check conversion error
             if( ! ss.good() )
                throw MeshReaderError( "VTIReader", "invalid origin: not a number: " + origin );
@@ -78,12 +78,12 @@ class PVTIReader
          std::stringstream ss( spacing );
          gridSpacing.resize( 3 );
          for( int i = 0; i < 3; i++ ) {
-            ss >> gridSpacing[i];
+            ss >> gridSpacing[ i ];
             // check conversion error
             if( ! ss.good() )
                throw MeshReaderError( "VTIReader", "invalid spacing: not a number: " + spacing );
             // check negative numbers
-            if( gridSpacing[i] < 0 )
+            if( gridSpacing[ i ] < 0 )
                throw MeshReaderError( "VTIReader", "invalid spacing: negative number: " + spacing );
          }
          // check remaining characters
@@ -96,7 +96,7 @@ class PVTIReader
       // determine the grid dimension
       int dim = 0;
       for( int i = 0; i < 3; i++ )
-         if( gridSpacing[i] > 0 )
+         if( gridSpacing[ i ] > 0 )
             dim++;
          else
             break;
@@ -116,7 +116,6 @@ class PVTIReader
       // set the index type
       connectivityType = headerType;
 
-
       // read GhostLevel attribute
       ghostLevels = getAttributeInteger( datasetElement, "GhostLevel" );
       // read MinCommonVertices attribute (TNL-specific, optional)
@@ -124,9 +123,9 @@ class PVTIReader
 
       // read pieces info
       const XMLElement* piece = getChildSafe( datasetElement, "Piece" );
-      while( piece ) {
+      while( piece != nullptr ) {
          const std::string source = getAttributeString( piece, "Source" );
-         if( source != "" ) {
+         if( ! source.empty() ) {
             pieceSources.push_back( getSourcePath( source ) );
          }
          else
@@ -134,14 +133,15 @@ class PVTIReader
          // find next
          piece = piece->NextSiblingElement( "Piece" );
       }
-      if( pieceSources.size() == 0 )
+      if( pieceSources.empty() )
          throw MeshReaderError( "PVTIReader", "the file does not contain any <Piece> element." );
 
       // check that the number of pieces matches the number of MPI ranks
       const int nproc = MPI::GetSize( communicator );
       if( (int) pieceSources.size() != nproc )
-         throw MeshReaderError( "PVTIReader", "the number of subdomains does not match the number of MPI ranks ("
-                                              + std::to_string(pieceSources.size()) + " vs " + std::to_string(nproc) + ")." );
+         throw MeshReaderError( "PVTIReader",
+                                "the number of subdomains does not match the number of MPI ranks ("
+                                   + std::to_string( pieceSources.size() ) + " vs " + std::to_string( nproc ) + ")." );
 
       // read the local piece source
       const int rank = MPI::GetRank( communicator );
@@ -163,11 +163,11 @@ class PVTIReader
       // TODO: assert that all MPI ranks have the same attributes
 
       // TODO
-//      if( ghostLevels > 0 ) {
-//         // load the vtkGhostType arrays from PointData and CellData
-//         pointTags = localReader.readPointData( VTK::ghostArrayName() );
-//         cellTags = localReader.readCellData( VTK::ghostArrayName() );
-//      }
+      // if( ghostLevels > 0 ) {
+      //    // load the vtkGhostType arrays from PointData and CellData
+      //    pointTags = localReader.readPointData( VTK::ghostArrayName() );
+      //    cellTags = localReader.readCellData( VTK::ghostArrayName() );
+      // }
    }
 #endif
 
@@ -178,7 +178,8 @@ public:
    : XMLVTK( fileName ), communicator( communicator )
    {}
 
-   virtual void detectMesh() override
+   void
+   detectMesh() override
    {
 #ifdef HAVE_TINYXML2
       reset();
@@ -194,7 +195,8 @@ public:
       if( fileType == "PImageData" )
          readParallelImageData();
       else
-         throw MeshReaderError( "PVTIReader", "the reader cannot read data of the type " + fileType + ". Use a different reader if possible." );
+         throw MeshReaderError(
+            "PVTIReader", "the reader cannot read data of the type " + fileType + ". Use a different reader if possible." );
 
       // indicate success by setting the mesh type
       meshType = "Meshes::DistributedGrid";
@@ -208,7 +210,7 @@ public:
    loadMesh( MeshType& mesh )
    {
       // check that detectMesh has been called
-      if( meshType == "" )
+      if( meshType.empty() )
          detectMesh();
 
       // check if we have a distributed grid
@@ -219,7 +221,7 @@ public:
       mesh.setCommunicator( communicator );
 
       // TODO: set the domain decomposition
-//      mesh.setDomainDecomposition( decomposition );
+      // mesh.setDomainDecomposition( decomposition );
 
       // load the global grid (meshType must be faked before calling loadMesh)
       typename MeshType::GridType globalGrid;
@@ -237,32 +239,37 @@ public:
       mesh.setGhostLevels( ghostLevels );
       // check MinCommonVertices
       // TODO
-//      if( minCommonVertices > 0 && minCommonVertices != MeshType::Config::dualGraphMinCommonVertices )
-//         std::cerr << "WARNING: the mesh was decomposed with different MinCommonVertices value than the value set in the mesh configuration "
-//                      "(" << minCommonVertices << " vs " << MeshType::Config::dualGraphMinCommonVertices << ")." << std::endl;
+      // if( minCommonVertices > 0 && minCommonVertices != MeshType::Config::dualGraphMinCommonVertices )
+      //    std::cerr << "WARNING: the mesh was decomposed with different MinCommonVertices value than the value set in the "
+      //              << "mesh configuration (" << minCommonVertices << " vs " << MeshType::Config::dualGraphMinCommonVertices
+      //              << ")." << std::endl;
 
       // load the local mesh and check with the subdomain
       typename MeshType::GridType localMesh;
       localReader.loadMesh( localMesh );
       if( localMesh != mesh.getLocalMesh() ) {
          std::stringstream msg;
-         msg << "The grid from the " << MPI::GetRank( communicator ) << "-th subdomain .vti file does not match the local grid of the DistributedGrid."
-             << "\n- Grid from the .vti file:\n" << localMesh
-             << "\n- Local grid from the DistributedGrid:\n" << mesh.getLocalMesh();
+         msg << "The grid from the " << MPI::GetRank( communicator )
+             << "-th subdomain .vti file does not match the local grid of the DistributedGrid."
+             << "\n- Grid from the .vti file:\n"
+             << localMesh << "\n- Local grid from the DistributedGrid:\n"
+             << mesh.getLocalMesh();
          throw MeshReaderError( "PVTIReader", msg.str() );
       }
 
-//      using Index = typename MeshType::IndexType;
-//      const Index pointsCount = mesh.getLocalMesh().template getEntitiesCount< 0 >();
-//      const Index cellsCount = mesh.getLocalMesh().template getEntitiesCount< MeshType::getMeshDimension() >();
+      // using Index = typename MeshType::IndexType;
+      // const Index pointsCount = mesh.getLocalMesh().template getEntitiesCount< 0 >();
+      // const Index cellsCount = mesh.getLocalMesh().template getEntitiesCount< MeshType::getMeshDimension() >();
 
-/*    // TODO
+      // TODO
+      /*
       if( ghostLevels > 0 ) {
          // assign point ghost tags
          using mpark::get;
-         const std::vector<std::uint8_t> pointTags = get< std::vector<std::uint8_t> >( this->pointTags );
+         const std::vector< std::uint8_t > pointTags = get< std::vector< std::uint8_t > >( this->pointTags );
          if( (Index) pointTags.size() != pointsCount )
-            throw MeshReaderError( "PVTIReader", "the vtkGhostType array in PointData has wrong size: " + std::to_string(pointTags.size()) );
+            throw MeshReaderError(
+               "PVTIReader", "the vtkGhostType array in PointData has wrong size: " + std::to_string( pointTags.size() ) );
          mesh.vtkPointGhostTypes() = pointTags;
          for( Index i = 0; i < pointsCount; i++ )
             if( pointTags[ i ] & (std::uint8_t) VTK::PointGhostTypes::DUPLICATEPOINT )
@@ -270,9 +277,10 @@ public:
 
          // assign cell ghost tags
          using mpark::get;
-         const std::vector<std::uint8_t> cellTags = get< std::vector<std::uint8_t> >( this->cellTags );
+         const std::vector< std::uint8_t > cellTags = get< std::vector< std::uint8_t > >( this->cellTags );
          if( (Index) cellTags.size() != cellsCount )
-            throw MeshReaderError( "PVTIReader", "the vtkGhostType array in CellData has wrong size: " + std::to_string(cellTags.size()) );
+            throw MeshReaderError( "PVTIReader",
+                                   "the vtkGhostType array in CellData has wrong size: " + std::to_string( cellTags.size() ) );
          mesh.vtkCellGhostTypes() = cellTags;
          for( Index i = 0; i < cellsCount; i++ ) {
             if( cellTags[ i ] & (std::uint8_t) VTK::CellGhostTypes::DUPLICATECELL )
@@ -282,7 +290,7 @@ public:
          // reset arrays since they are not needed anymore
          this->pointTags = this->cellTags = {};
       }
-*/
+      */
    }
 
    template< typename MeshType >
@@ -292,19 +300,20 @@ public:
       throw MeshReaderError( "MeshReader", "the PVTI reader cannot be used to load a distributed unstructured mesh." );
    }
 
-   virtual VariantVector
+   VariantVector
    readPointData( std::string arrayName ) override
    {
       return localReader.readPointData( arrayName );
    }
 
-   virtual VariantVector
+   VariantVector
    readCellData( std::string arrayName ) override
    {
       return localReader.readCellData( arrayName );
    }
 
-   virtual void reset() override
+   void
+   reset() override
    {
       resetBase();
       ghostLevels = 0;
@@ -318,7 +327,7 @@ protected:
 
    int ghostLevels = 0;
    int minCommonVertices = 0;
-   std::vector<std::string> pieceSources;
+   std::vector< std::string > pieceSources;
 
    VTIReader localReader;
 
@@ -326,6 +335,6 @@ protected:
    VariantVector pointTags, cellTags;
 };
 
-} // namespace Readers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Readers
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Readers/PVTUReader.h b/src/TNL/Meshes/Readers/PVTUReader.h
index 02b807a6178ce37aabadc1dea6d0e0e7d1a053ed..83abf37d51a8af709374c1c0a23552bcecfb0cf7 100644
--- a/src/TNL/Meshes/Readers/PVTUReader.h
+++ b/src/TNL/Meshes/Readers/PVTUReader.h
@@ -19,18 +19,18 @@ namespace TNL {
 namespace Meshes {
 namespace Readers {
 
-class PVTUReader
-: public XMLVTK
+class PVTUReader : public XMLVTK
 {
    std::string
-   getSourcePath( std::string source )
+   getSourcePath( const std::string& source )
    {
       namespace fs = std::experimental::filesystem;
-      return fs::path(fileName).parent_path() / source;
+      return fs::path( fileName ).parent_path() / source;
    }
 
 #ifdef HAVE_TINYXML2
-   void readParallelUnstructuredGrid()
+   void
+   readParallelUnstructuredGrid()
    {
       using namespace tinyxml2;
 
@@ -45,14 +45,15 @@ class PVTUReader
       verifyDataArray( pointsData, "PDataArray" );
       const std::string pointsDataName = getAttributeString( pointsData, "Name" );
       if( pointsDataName != "Points" )
-         throw MeshReaderError( "PVTUReader", "the <PPoints> tag does not contain a <PDataArray> with Name=\"Points\" attribute" );
+         throw MeshReaderError( "PVTUReader",
+                                "the <PPoints> tag does not contain a <PDataArray> with Name=\"Points\" attribute" );
       pointsType = VTKDataTypes.at( getAttributeString( pointsData, "type" ) );
 
       // read pieces info
       const XMLElement* piece = getChildSafe( datasetElement, "Piece" );
-      while( piece ) {
+      while( piece != nullptr ) {
          const std::string source = getAttributeString( piece, "Source" );
-         if( source != "" ) {
+         if( ! source.empty() ) {
             pieceSources.push_back( getSourcePath( source ) );
          }
          else
@@ -60,14 +61,15 @@ class PVTUReader
          // find next
          piece = piece->NextSiblingElement( "Piece" );
       }
-      if( pieceSources.size() == 0 )
+      if( pieceSources.empty() )
          throw MeshReaderError( "PVTUReader", "the file does not contain any <Piece> element." );
 
       // check that the number of pieces matches the number of MPI ranks
       const int nproc = MPI::GetSize( communicator );
       if( (int) pieceSources.size() != nproc )
-         throw MeshReaderError( "PVTUReader", "the number of subdomains does not match the number of MPI ranks ("
-                                              + std::to_string(pieceSources.size()) + " vs " + std::to_string(nproc) + ")." );
+         throw MeshReaderError( "PVTUReader",
+                                "the number of subdomains does not match the number of MPI ranks ("
+                                   + std::to_string( pieceSources.size() ) + " vs " + std::to_string( nproc ) + ")." );
 
       // read the local piece source
       const int rank = MPI::GetRank( communicator );
@@ -103,7 +105,8 @@ public:
    : XMLVTK( fileName ), communicator( communicator )
    {}
 
-   virtual void detectMesh() override
+   void
+   detectMesh() override
    {
 #ifdef HAVE_TINYXML2
       reset();
@@ -119,7 +122,8 @@ public:
       if( fileType == "PUnstructuredGrid" )
          readParallelUnstructuredGrid();
       else
-         throw MeshReaderError( "PVTUReader", "the reader cannot read data of the type " + fileType + ". Use a different reader if possible." );
+         throw MeshReaderError(
+            "PVTUReader", "the reader cannot read data of the type " + fileType + ". Use a different reader if possible." );
 
       // indicate success by setting the mesh type
       meshType = "Meshes::DistributedMesh";
@@ -140,7 +144,7 @@ public:
    loadMesh( MeshType& mesh )
    {
       // check that detectMesh has been called
-      if( meshType == "" )
+      if( meshType.empty() )
          detectMesh();
 
       // check if we have a distributed unstructured mesh
@@ -159,15 +163,18 @@ public:
       mesh.setGhostLevels( ghostLevels );
       // check MinCommonVertices
       if( minCommonVertices > 0 && minCommonVertices != MeshType::Config::dualGraphMinCommonVertices )
-         std::cerr << "WARNING: the mesh was decomposed with different MinCommonVertices value than the value set in the mesh configuration "
-                      "(" << minCommonVertices << " vs " << MeshType::Config::dualGraphMinCommonVertices << ")." << std::endl;
+         std::cerr << "WARNING: the mesh was decomposed with different MinCommonVertices value than the value set in the mesh "
+                      "configuration "
+                      "("
+                   << minCommonVertices << " vs " << MeshType::Config::dualGraphMinCommonVertices << ")." << std::endl;
 
       if( ghostLevels > 0 ) {
          // assign point ghost tags
          using mpark::get;
-         const std::vector<std::uint8_t> pointTags = get< std::vector<std::uint8_t> >( this->pointTags );
+         const std::vector< std::uint8_t > pointTags = get< std::vector< std::uint8_t > >( this->pointTags );
          if( (Index) pointTags.size() != pointsCount )
-            throw MeshReaderError( "PVTUReader", "the vtkGhostType array in PointData has wrong size: " + std::to_string(pointTags.size()) );
+            throw MeshReaderError(
+               "PVTUReader", "the vtkGhostType array in PointData has wrong size: " + std::to_string( pointTags.size() ) );
          mesh.vtkPointGhostTypes() = pointTags;
          for( Index i = 0; i < pointsCount; i++ )
             if( pointTags[ i ] & (std::uint8_t) VTK::PointGhostTypes::DUPLICATEPOINT )
@@ -175,9 +182,10 @@ public:
 
          // assign cell ghost tags
          using mpark::get;
-         const std::vector<std::uint8_t> cellTags = get< std::vector<std::uint8_t> >( this->cellTags );
+         const std::vector< std::uint8_t > cellTags = get< std::vector< std::uint8_t > >( this->cellTags );
          if( (Index) cellTags.size() != cellsCount )
-            throw MeshReaderError( "PVTUReader", "the vtkGhostType array in CellData has wrong size: " + std::to_string(cellTags.size()) );
+            throw MeshReaderError( "PVTUReader",
+                                   "the vtkGhostType array in CellData has wrong size: " + std::to_string( cellTags.size() ) );
          mesh.vtkCellGhostTypes() = cellTags;
          for( Index i = 0; i < cellsCount; i++ ) {
             if( cellTags[ i ] & (std::uint8_t) VTK::CellGhostTypes::DUPLICATECELL )
@@ -191,20 +199,22 @@ public:
          // assign global indices
          auto& points_indices = mesh.template getGlobalIndices< 0 >();
          auto& cells_indices = mesh.template getGlobalIndices< MeshType::getMeshDimension() >();
-         auto assign_variant_vector = [] ( auto& array, const VariantVector& variant_vector, Index expectedSize )
+         auto assign_variant_vector = []( auto& array, const VariantVector& variant_vector, Index expectedSize )
          {
             using mpark::visit;
-            visit( [&array, expectedSize](auto&& vector) {
-                     if( (Index) vector.size() != expectedSize )
-                        throw MeshReaderError( "PVTUReader", "the GlobalIndex array has wrong size: " + std::to_string(vector.size())
-                                                             + " (expected " + std::to_string(expectedSize) + ")." );
-                     array.setSize( vector.size() );
-                     std::size_t idx = 0;
-                     for( auto v : vector )
-                        array[ idx++ ] = v;
-                  },
-                  variant_vector
-               );
+            visit(
+               [ &array, expectedSize ]( auto&& vector )
+               {
+                  if( (Index) vector.size() != expectedSize )
+                     throw MeshReaderError( "PVTUReader",
+                                            "the GlobalIndex array has wrong size: " + std::to_string( vector.size() )
+                                               + " (expected " + std::to_string( expectedSize ) + ")." );
+                  array.setSize( vector.size() );
+                  std::size_t idx = 0;
+                  for( auto v : vector )
+                     array[ idx++ ] = v;
+               },
+               variant_vector );
          };
          assign_variant_vector( points_indices, pointGlobalIndices, pointsCount );
          assign_variant_vector( cells_indices, cellGlobalIndices, cellsCount );
@@ -217,7 +227,7 @@ public:
       const Index minCount = MPI::reduce( TNL::min( pointsCount, cellsCount ), MPI_MIN );
       if( minCount == 0 ) {
          // split the communicator, remove the ranks which did not get a subdomain
-         const int color = (pointsCount > 0 && cellsCount > 0) ? 0 : MPI_UNDEFINED;
+         const int color = ( pointsCount > 0 && cellsCount > 0 ) ? 0 : MPI_UNDEFINED;
          const MPI_Comm subCommunicator = MPI::Comm_split( communicator, color, 0 );
 
          // set the communicator
@@ -229,19 +239,20 @@ public:
       }
    }
 
-   virtual VariantVector
+   VariantVector
    readPointData( std::string arrayName ) override
    {
       return localReader.readPointData( arrayName );
    }
 
-   virtual VariantVector
+   VariantVector
    readCellData( std::string arrayName ) override
    {
       return localReader.readCellData( arrayName );
    }
 
-   virtual void reset() override
+   void
+   reset() override
    {
       resetBase();
       ghostLevels = 0;
@@ -255,7 +266,7 @@ protected:
 
    int ghostLevels = 0;
    int minCommonVertices = 0;
-   std::vector<std::string> pieceSources;
+   std::vector< std::string > pieceSources;
 
    VTUReader localReader;
 
@@ -263,6 +274,6 @@ protected:
    VariantVector pointTags, cellTags, pointGlobalIndices, cellGlobalIndices;
 };
 
-} // namespace Readers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Readers
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Readers/VTIReader.h b/src/TNL/Meshes/Readers/VTIReader.h
index 9c211a881600abb8f81dad1d4c8d1e945f4fb0dd..5387e49cf24da6554074a17e18f93de01e544d88 100644
--- a/src/TNL/Meshes/Readers/VTIReader.h
+++ b/src/TNL/Meshes/Readers/VTIReader.h
@@ -15,11 +15,11 @@ namespace TNL {
 namespace Meshes {
 namespace Readers {
 
-class VTIReader
-: public XMLVTK
+class VTIReader : public XMLVTK
 {
 #ifdef HAVE_TINYXML2
-   void readImageData()
+   void
+   readImageData()
    {
       // read the required attributes
       const std::string extent = getAttributeString( datasetElement, "WholeExtent" );
@@ -29,20 +29,20 @@ class VTIReader
       // check the <Piece> tag
       using namespace tinyxml2;
       const XMLElement* piece = getChildSafe( datasetElement, "Piece" );
-      if( piece->NextSiblingElement( "Piece" ) )
+      if( piece->NextSiblingElement( "Piece" ) != nullptr )
          // ambiguity - throw error, we don't know which piece to parse (or all of them?)
          throw MeshReaderError( "VTIReader", "the serial ImageData file contains more than one <Piece> element" );
       const std::string pieceExtent = getAttributeString( piece, "Extent" );
       if( pieceExtent != extent )
-         throw MeshReaderError( "VTIReader", "the <Piece> element has different extent than <ImageData> ("
-                                             + pieceExtent + " vs " + extent + ")" );
+         throw MeshReaderError(
+            "VTIReader", "the <Piece> element has different extent than <ImageData> (" + pieceExtent + " vs " + extent + ")" );
 
       // parse the extent
       {
          std::stringstream ss( extent );
          gridExtent.resize( 6, 0 );
          for( int i = 0; i < 6; i++ ) {
-            ss >> gridExtent[i];
+            ss >> gridExtent[ i ];
             // check conversion error
             if( ! ss.good() )
                throw MeshReaderError( "VTIReader", "invalid extent: not a number: " + extent );
@@ -59,7 +59,7 @@ class VTIReader
          std::stringstream ss( origin );
          gridOrigin.resize( 3 );
          for( int i = 0; i < 3; i++ ) {
-            ss >> gridOrigin[i];
+            ss >> gridOrigin[ i ];
             // check conversion error
             if( ! ss.good() )
                throw MeshReaderError( "VTIReader", "invalid origin: not a number: " + origin );
@@ -76,12 +76,12 @@ class VTIReader
          std::stringstream ss( spacing );
          gridSpacing.resize( 3 );
          for( int i = 0; i < 3; i++ ) {
-            ss >> gridSpacing[i];
+            ss >> gridSpacing[ i ];
             // check conversion error
             if( ! ss.good() )
                throw MeshReaderError( "VTIReader", "invalid spacing: not a number: " + spacing );
             // check negative numbers
-            if( gridSpacing[i] < 0 )
+            if( gridSpacing[ i ] < 0 )
                throw MeshReaderError( "VTIReader", "invalid spacing: negative number: " + spacing );
          }
          // check remaining characters
@@ -94,7 +94,7 @@ class VTIReader
       // determine the grid dimension
       int dim = 0;
       for( int i = 0; i < 3; i++ )
-         if( gridSpacing[i] > 0 )
+         if( gridSpacing[ i ] > 0 )
             dim++;
          else
             break;
@@ -119,11 +119,10 @@ class VTIReader
 public:
    VTIReader() = default;
 
-   VTIReader( const std::string& fileName )
-   : XMLVTK( fileName )
-   {}
+   VTIReader( const std::string& fileName ) : XMLVTK( fileName ) {}
 
-   virtual void detectMesh() override
+   void
+   detectMesh() override
    {
 #ifdef HAVE_TINYXML2
       reset();
@@ -139,7 +138,8 @@ public:
       if( fileType == "ImageData" )
          readImageData();
       else
-         throw MeshReaderError( "VTIReader", "the reader cannot read data of the type " + fileType + ". Use a different reader if possible." );
+         throw MeshReaderError(
+            "VTIReader", "the reader cannot read data of the type " + fileType + ". Use a different reader if possible." );
 
       // indicate success by setting the mesh type
       meshType = "Meshes::Grid";
@@ -149,6 +149,6 @@ public:
    }
 };
 
-} // namespace Readers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Readers
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Readers/VTKReader.h b/src/TNL/Meshes/Readers/VTKReader.h
index 3c307afcc7c7bf54bdc42884021ed3bac8b54a8f..18cff3f20c94a362a6e7e819854df26f1eba97ed 100644
--- a/src/TNL/Meshes/Readers/VTKReader.h
+++ b/src/TNL/Meshes/Readers/VTKReader.h
@@ -21,17 +21,15 @@ namespace TNL {
 namespace Meshes {
 namespace Readers {
 
-class VTKReader
-: public MeshReader
+class VTKReader : public MeshReader
 {
 public:
    VTKReader() = default;
 
-   VTKReader( const std::string& fileName )
-   : MeshReader( fileName )
-   {}
+   VTKReader( const std::string& fileName ) : MeshReader( fileName ) {}
 
-   virtual void detectMesh() override
+   void
+   detectMesh() override
    {
       reset();
 
@@ -47,13 +45,14 @@ public:
       // parse the file, find the starting positions of all relevant sections
       findSections( inputFile );
 
-      std::string line, aux;
+      std::string line;
+      std::string aux;
       std::istringstream iss;
 
       // parse points section
-      if( ! sectionPositions.count( "POINTS" ) )
+      if( sectionPositions.count( "POINTS" ) == 0 )
          throw MeshReaderError( "VTKReader", "unable to find the POINTS section, the file may be invalid or corrupted" );
-      inputFile.seekg( sectionPositions["POINTS"] );
+      inputFile.seekg( sectionPositions[ "POINTS" ] );
       getline( inputFile, line );
       iss.clear();
       iss.str( line );
@@ -68,7 +67,8 @@ public:
 
       // arrays holding the data from the VTK file
       std::vector< double > pointsArray;
-      std::vector< std::int64_t > cellConnectivityArray, cellOffsetsArray;
+      std::vector< std::int64_t > cellConnectivityArray;
+      std::vector< std::int64_t > cellOffsetsArray;
       std::vector< std::uint8_t > typesArray;
 
       // read points
@@ -85,7 +85,9 @@ public:
             else
                aux = readValue< double >( dataFormat, inputFile );
             if( ! inputFile )
-               throw MeshReaderError( "VTKReader", "unable to read " + std::to_string(i) + "th component of the vertex number " + std::to_string(pointIndex) );
+               throw MeshReaderError( "VTKReader",
+                                      "unable to read " + std::to_string( i ) + "th component of the vertex number "
+                                         + std::to_string( pointIndex ) );
             if( aux != 0.0 )
                spaceDimension = std::max( spaceDimension, i + 1 );
             pointsArray.push_back( aux );
@@ -93,9 +95,9 @@ public:
       }
 
       // skip to the CELL_TYPES section
-      if( ! sectionPositions.count( "CELL_TYPES" ) )
+      if( sectionPositions.count( "CELL_TYPES" ) == 0 )
          throw MeshReaderError( "VTKReader", "unable to find the CELL_TYPES section, the file may be invalid or corrupted" );
-      inputFile.seekg( sectionPositions["CELL_TYPES"] );
+      inputFile.seekg( sectionPositions[ "CELL_TYPES" ] );
       getline( inputFile, line );
       iss.clear();
       iss.str( line );
@@ -113,19 +115,19 @@ public:
       }
 
       // count entities for each dimension
-      std::size_t entitiesCounts[4] = {0, 0, 0, 0};
+      std::size_t entitiesCounts[ 4 ] = { 0, 0, 0, 0 };
       for( auto c : typesArray ) {
          const int dimension = getEntityDimension( (VTK::EntityShape) c );
-         ++entitiesCounts[dimension];
+         ++entitiesCounts[ dimension ];
       }
 
       // set meshDimension
       meshDimension = 3;
-      if( entitiesCounts[3] == 0 ) {
+      if( entitiesCounts[ 3 ] == 0 ) {
          meshDimension--;
-         if( entitiesCounts[2] == 0 ) {
+         if( entitiesCounts[ 2 ] == 0 ) {
             meshDimension--;
-            if( entitiesCounts[1] == 0 )
+            if( entitiesCounts[ 1 ] == 0 )
                meshDimension--;
          }
       }
@@ -143,17 +145,18 @@ public:
 
       // set number of cells
       NumberOfCells = cellTypes.size();
-      if( NumberOfCells == 0 || NumberOfCells != entitiesCounts[meshDimension] ) {
-         const std::string msg = "invalid number of cells (" + std::to_string(NumberOfCells) + "). Counts of entities for each dimension (0,1,2,3) are: "
-                               + std::to_string(entitiesCounts[0]) + ", " + std::to_string(entitiesCounts[1]) + ", "
-                               + std::to_string(entitiesCounts[2]) + ", " + std::to_string(entitiesCounts[3]);
+      if( NumberOfCells == 0 || NumberOfCells != entitiesCounts[ meshDimension ] ) {
+         const std::string msg = "invalid number of cells (" + std::to_string( NumberOfCells )
+                               + "). Counts of entities for each dimension (0,1,2,3) are: "
+                               + std::to_string( entitiesCounts[ 0 ] ) + ", " + std::to_string( entitiesCounts[ 1 ] ) + ", "
+                               + std::to_string( entitiesCounts[ 2 ] ) + ", " + std::to_string( entitiesCounts[ 3 ] );
          throw MeshReaderError( "VTKReader", msg );
       }
 
       // validate cell types
       using PolygonShapeGroupChecker = VTK::EntityShapeGroupChecker< VTK::EntityShape::Polygon >;
       using PolyhedronShapeGroupChecker = VTK::EntityShapeGroupChecker< VTK::EntityShape::Polyhedron >;
-      cellShape = (VTK::EntityShape) cellTypes[0];
+      cellShape = (VTK::EntityShape) cellTypes[ 0 ];
 
       for( auto c : cellTypes ) {
          auto entityShape = (VTK::EntityShape) c;
@@ -165,7 +168,7 @@ public:
                cellShape = PolyhedronShapeGroupChecker::GeneralShape;
             else {
                const std::string msg = "Unsupported unstructured meshes with mixed entities: there are cells with type "
-                                     + VTK::getShapeName(cellShape) + " and " + VTK::getShapeName(entityShape) + ".";
+                                     + VTK::getShapeName( cellShape ) + " and " + VTK::getShapeName( entityShape ) + ".";
                reset();
                throw MeshReaderError( "VTKReader", msg );
             }
@@ -173,23 +176,26 @@ public:
       }
 
       // find to the CELLS section
-      if( ! sectionPositions.count( "CELLS" ) )
+      if( sectionPositions.count( "CELLS" ) == 0 )
          throw MeshReaderError( "VTKReader", "unable to find the CELLS section, the file may be invalid or corrupted" );
-      inputFile.seekg( sectionPositions["CELLS"] );
+      inputFile.seekg( sectionPositions[ "CELLS" ] );
       getline( inputFile, line );
 
       if( formatVersion == "2.0" ) {
          // read entities
          for( std::size_t entityIndex = 0; entityIndex < NumberOfEntities; entityIndex++ ) {
             if( ! inputFile )
-               throw MeshReaderError( "VTKReader", "unable to read enough cells, the file may be invalid or corrupted"
-                                                   " (entityIndex = " + std::to_string(entityIndex) + ")" );
+               throw MeshReaderError( "VTKReader",
+                                      "unable to read enough cells, the file may be invalid or corrupted"
+                                      " (entityIndex = "
+                                         + std::to_string( entityIndex ) + ")" );
 
             const VTK::EntityShape entityShape = (VTK::EntityShape) typesArray[ entityIndex ];
 
             if( entityShape == VTK::EntityShape::Polyhedron )
-               throw MeshReaderError( "VTKReader", "Reading polyhedrons from a DataFile version 2.0 is not supported. "
-                                                   "Convert the file to version 5.1 (e.g. using Paraview) and try again." );
+               throw MeshReaderError( "VTKReader",
+                                      "Reading polyhedrons from a DataFile version 2.0 is not supported. "
+                                      "Convert the file to version 5.1 (e.g. using Paraview) and try again." );
 
             if( entityShape == cellShape || PolygonShapeGroupChecker::bothBelong( cellShape, entityShape ) ) {
                // read number of subvertices
@@ -198,8 +204,10 @@ public:
                   // legacy VTK files do not support 64-bit integers, even in the BINARY format
                   const std::int32_t vid = readValue< std::int32_t >( dataFormat, inputFile );
                   if( ! inputFile )
-                     throw MeshReaderError( "VTKReader", "unable to read enough cells, the file may be invalid or corrupted"
-                                                         " (entityIndex = " + std::to_string(entityIndex) + ", subvertex = " + std::to_string(v) + ")" );
+                     throw MeshReaderError( "VTKReader",
+                                            "unable to read enough cells, the file may be invalid or corrupted"
+                                            " (entityIndex = "
+                                               + std::to_string( entityIndex ) + ", subvertex = " + std::to_string( v ) + ")" );
                   cellConnectivityArray.push_back( vid );
                }
                cellOffsetsArray.push_back( cellConnectivityArray.size() );
@@ -225,7 +233,7 @@ public:
          // find to the OFFSETS section
          if( ! sectionPositions.count( "OFFSETS" ) )
             throw MeshReaderError( "VTKReader", "unable to find the OFFSETS section, the file may be invalid or corrupted" );
-         inputFile.seekg( sectionPositions["OFFSETS"] );
+         inputFile.seekg( sectionPositions[ "OFFSETS" ] );
 
          // read all offsets into an auxiliary array
          std::vector< std::int64_t > allOffsetsArray;
@@ -243,15 +251,18 @@ public:
             else
                throw MeshReaderError( "VTKReader", "found data type which is not implemented in the reader: " + datatype );
             if( ! inputFile )
-               throw MeshReaderError( "VTKReader", "unable to read enough offsets, the file may be invalid or corrupted"
-                                                   " (entityIndex = " + std::to_string(entityIndex) + ")" );
+               throw MeshReaderError( "VTKReader",
+                                      "unable to read enough offsets, the file may be invalid or corrupted"
+                                      " (entityIndex = "
+                                         + std::to_string( entityIndex ) + ")" );
             allOffsetsArray.push_back( value );
          }
 
          // find to the CONNECTIVITY section
          if( ! sectionPositions.count( "CONNECTIVITY" ) )
-            throw MeshReaderError( "VTKReader", "unable to find the CONNECTIVITY section, the file may be invalid or corrupted" );
-         inputFile.seekg( sectionPositions["CONNECTIVITY"] );
+            throw MeshReaderError( "VTKReader",
+                                   "unable to find the CONNECTIVITY section, the file may be invalid or corrupted" );
+         inputFile.seekg( sectionPositions[ "CONNECTIVITY" ] );
 
          // get datatype
          getline( inputFile, line );
@@ -260,14 +271,17 @@ public:
          iss >> aux >> datatype;
 
          // arrays for polyhedral mesh
-         std::vector< std::int64_t > faceConnectivityArray, faceOffsetsArray;
+         std::vector< std::int64_t > faceConnectivityArray;
+         std::vector< std::int64_t > faceOffsetsArray;
          std::int64_t faceIndex = 0;
 
          // read connectivity
          for( std::size_t entityIndex = 0; entityIndex < NumberOfEntities; entityIndex++ ) {
             if( ! inputFile )
-               throw MeshReaderError( "VTKReader", "unable to read enough cells, the file may be invalid or corrupted"
-                                                   " (entityIndex = " + std::to_string(entityIndex) + ")" );
+               throw MeshReaderError( "VTKReader",
+                                      "unable to read enough cells, the file may be invalid or corrupted"
+                                      " (entityIndex = "
+                                         + std::to_string( entityIndex ) + ")" );
 
             const VTK::EntityShape entityShape = (VTK::EntityShape) typesArray[ entityIndex ];
             const std::int64_t offsetBegin = allOffsetsArray[ entityIndex ];
@@ -276,7 +290,8 @@ public:
             // TODO: Polyhedrons will require to create polygon subentity seeds from given entityShapes
             //       and add their entries to faceConnectivityArray and faceOffsetsArray.
             //       CellConnectivityArray and cellOffsetsArray will contain indices addressing created polygon subentities.
-            if( cellShape == VTK::EntityShape::Polyhedron && entityShape != cellShape && PolyhedronShapeGroupChecker::bothBelong( cellShape, entityShape ) )
+            if( cellShape == VTK::EntityShape::Polyhedron && entityShape != cellShape
+                && PolyhedronShapeGroupChecker::bothBelong( cellShape, entityShape ) )
                throw MeshReaderError( "VTKReader", "Converting a mixed mesh to polyhedral mesh is not implemented yet." );
 
             if( entityShape == cellShape && cellShape == VTK::EntityShape::Polyhedron ) {
@@ -289,10 +304,13 @@ public:
                   else if( datatype == "vtktypeint64" )
                      value = readValue< std::int64_t >( dataFormat, inputFile );
                   else
-                     throw MeshReaderError( "VTKReader", "found data type which is not implemented in the reader: " + datatype );
+                     throw MeshReaderError( "VTKReader",
+                                            "found data type which is not implemented in the reader: " + datatype );
                   if( ! inputFile )
-                     throw MeshReaderError( "VTKReader", "unable to read enough cells, the file may be invalid or corrupted"
-                                                         " (entityIndex = " + std::to_string(entityIndex) + ", subvertex = " + std::to_string(v) + ")" );
+                     throw MeshReaderError( "VTKReader",
+                                            "unable to read enough cells, the file may be invalid or corrupted"
+                                            " (entityIndex = "
+                                               + std::to_string( entityIndex ) + ", subvertex = " + std::to_string( v ) + ")" );
                   cell_connectivity.push_back( value );
                }
                // connectivity[offsetBegin : offsetEnd] describes the faces of
@@ -319,10 +337,13 @@ public:
                   else if( datatype == "vtktypeint64" )
                      vid = readValue< std::int64_t >( dataFormat, inputFile );
                   else
-                     throw MeshReaderError( "VTKReader", "found data type which is not implemented in the reader: " + datatype );
+                     throw MeshReaderError( "VTKReader",
+                                            "found data type which is not implemented in the reader: " + datatype );
                   if( ! inputFile )
-                     throw MeshReaderError( "VTKReader", "unable to read enough cells, the file may be invalid or corrupted"
-                                                         " (entityIndex = " + std::to_string(entityIndex) + ", subvertex = " + std::to_string(v) + ")" );
+                     throw MeshReaderError( "VTKReader",
+                                            "unable to read enough cells, the file may be invalid or corrupted"
+                                            " (entityIndex = "
+                                               + std::to_string( entityIndex ) + ", subvertex = " + std::to_string( v ) + ")" );
                   cellConnectivityArray.push_back( vid );
                }
                cellOffsetsArray.push_back( cellConnectivityArray.size() );
@@ -346,28 +367,29 @@ public:
       std::swap( cellTypes, typesArray );
 
       // set the arrays to the base class
-      this->pointsArray = std::move(pointsArray);
-      this->cellConnectivityArray = std::move(cellConnectivityArray);
-      this->cellOffsetsArray = std::move(cellOffsetsArray);
-      this->typesArray = std::move(typesArray);
+      this->pointsArray = std::move( pointsArray );
+      this->cellConnectivityArray = std::move( cellConnectivityArray );
+      this->cellOffsetsArray = std::move( cellOffsetsArray );
+      this->typesArray = std::move( typesArray );
 
       // indicate success by setting the mesh type
       meshType = "Meshes::Mesh";
    }
 
-   virtual VariantVector
+   VariantVector
    readPointData( std::string arrayName ) override
    {
       return readPointOrCellData( "POINT_DATA", arrayName );
    }
 
-   virtual VariantVector
+   VariantVector
    readCellData( std::string arrayName ) override
    {
       return readPointOrCellData( "CELL_DATA", arrayName );
    }
 
-   virtual void reset() override
+   void
+   reset() override
    {
       resetBase();
       dataFormat = VTK::FileFormat::ascii;
@@ -388,7 +410,8 @@ protected:
    std::int32_t points_count = 0;
    std::int32_t cells_count = 0;
 
-   void parseHeader( std::istream& str )
+   void
+   parseHeader( std::istream& str )
    {
       std::string line;
       std::istringstream iss;
@@ -432,7 +455,8 @@ protected:
       iss >> dataset;
    }
 
-   void skip_meta( std::istream& str )
+   void
+   skip_meta( std::istream& str )
    {
       // skip possible metadata
       // https://vtk.org/doc/nightly/html/IOLegacyInformationFormat.html
@@ -448,7 +472,8 @@ protected:
       }
    }
 
-   void findSections( std::istream& str )
+   void
+   findSections( std::istream& str )
    {
       while( str ) {
          // drop all whitespace (empty lines etc) before saving a position and reading a line
@@ -469,7 +494,7 @@ protected:
          iss >> name;
 
          if( name == "FIELD" ) {
-            sectionPositions.insert( {"FIELD", currentPosition} );
+            sectionPositions.insert( { "FIELD", currentPosition } );
             // parse the rest of the line: FIELD FieldData <count>
             std::string aux;
             int count = 0;
@@ -501,7 +526,7 @@ protected:
             }
          }
          else if( name == "POINTS" ) {
-            sectionPositions.insert( {"POINTS", currentPosition} );
+            sectionPositions.insert( { "POINTS", currentPosition } );
             // parse the rest of the line: POINTS <points_count> <datatype>
             std::string datatype;
             iss >> points_count >> datatype;
@@ -513,11 +538,11 @@ protected:
          }
          // METADATA is a thing since version 5.1 of the file format (or something else newer than 2.0)
          else if( name == "METADATA" ) {
-            sectionPositions.insert( {"METADATA", currentPosition} );
+            sectionPositions.insert( { "METADATA", currentPosition } );
             skip_meta( str );
          }
          else if( name == "CELLS" ) {
-            sectionPositions.insert( {"CELLS", currentPosition} );
+            sectionPositions.insert( { "CELLS", currentPosition } );
             if( formatVersion == "2.0" ) {
                // index type is not stored in legacy VTK DataFile version 2.0
                // (binary files don't support int64)
@@ -549,7 +574,7 @@ protected:
                iss >> aux >> datatype;
                if( aux != "OFFSETS" )
                   throw MeshReaderError( "VTKReader", "expected OFFSETS section, found '" + aux + "'" );
-               sectionPositions.insert( {"OFFSETS", offsetsPosition} );
+               sectionPositions.insert( { "OFFSETS", offsetsPosition } );
                if( datatype == "vtktypeint32" )
                   offsetsType = "std::int32_t";
                else if( datatype == "vtktypeint64" )
@@ -569,7 +594,7 @@ protected:
                iss >> aux >> datatype;
                if( aux != "CONNECTIVITY" )
                   throw MeshReaderError( "VTKReader", "expected CONNECTIVITY section, found '" + aux + "'" );
-               sectionPositions.insert( {"CONNECTIVITY", connectivityPosition} );
+               sectionPositions.insert( { "CONNECTIVITY", connectivityPosition } );
                if( datatype == "vtktypeint32" )
                   connectivityType = "std::int32_t";
                else if( datatype == "vtktypeint64" )
@@ -583,7 +608,7 @@ protected:
             str >> std::ws;
          }
          else if( name == "CELL_TYPES" ) {
-            sectionPositions.insert( {"CELL_TYPES", currentPosition} );
+            sectionPositions.insert( { "CELL_TYPES", currentPosition } );
             // parse the rest of the line: CELL_TYPES <count>
             std::int32_t count = 0;
             iss >> count;
@@ -596,8 +621,12 @@ protected:
          }
          else if( name == "CELL_DATA" || name == "POINT_DATA" ) {
             if( cells_count == 0 || points_count == 0 )
-               throw MeshReaderError( "VTKReader", "encountered a " + name + " section, but the mesh topology was not parsed yet "
-                                      "(cells count = " + std::to_string(cells_count) + ", points count = " + std::to_string(points_count) + ")" );
+               throw MeshReaderError( "VTKReader",
+                                      "encountered a " + name
+                                         + " section, but the mesh topology was not parsed yet "
+                                           "(cells count = "
+                                         + std::to_string( cells_count ) + ", points count = " + std::to_string( points_count )
+                                         + ")" );
 
             while( str ) {
                // drop all whitespace (empty lines etc) before saving a position and reading a line
@@ -623,7 +652,7 @@ protected:
                   continue;
                }
 
-               const std::int32_t elements = (name == "CELL_DATA") ? cells_count : points_count;
+               const std::int32_t elements = ( name == "CELL_DATA" ) ? cells_count : points_count;
 
                // scalars: 1 value per cell/point
                // vectors: 3 values per cell/point
@@ -631,12 +660,13 @@ protected:
                int values_per_element = 1;
 
                // additional metadata
-               std::string array_name, datatype;
+               std::string array_name;
+               std::string datatype;
 
                if( type == "SCALARS" ) {
                   // parse the rest of the line: SCALARS <array_name> <datatype>
                   iss >> array_name >> datatype;
-                  sectionPositions.insert( {name + "::" + array_name, currentPosition} );
+                  sectionPositions.insert( { name + "::" + array_name, currentPosition } );
                   // skip the LOOKUP_TABLE line
                   getline( str, line );
                }
@@ -644,13 +674,13 @@ protected:
                   values_per_element = 3;
                   // parse the rest of the line: VECTORS <array_name> <datatype>
                   iss >> array_name >> datatype;
-                  sectionPositions.insert( {name + "::" + array_name, currentPosition} );
+                  sectionPositions.insert( { name + "::" + array_name, currentPosition } );
                }
                else if( type == "TENSORS" ) {
                   values_per_element = 9;
                   // parse the rest of the line: TENSORS <array_name> <datatype>
                   iss >> array_name >> datatype;
-                  sectionPositions.insert( {name + "::" + array_name, currentPosition} );
+                  sectionPositions.insert( { name + "::" + array_name, currentPosition } );
                }
                else if( type == "FIELD" ) {
                   // parse the rest of the line: FIELD FieldData <count>
@@ -678,8 +708,9 @@ protected:
                      }
                      iss >> components >> tuples >> datatype;
                      if( ! iss )
-                        throw MeshReaderError( "VTKReader", "failed to extract FieldData information from line '" + line + "'" );
-                     sectionPositions.insert( {name + "::" + array_name, currentPosition} );
+                        throw MeshReaderError( "VTKReader",
+                                               "failed to extract FieldData information from line '" + line + "'" );
+                     sectionPositions.insert( { name + "::" + array_name, currentPosition } );
                      // skip the points coordinates
                      for( std::int32_t j = 0; j < components * tuples; j++ )
                         skipValue( dataFormat, str, datatype );
@@ -706,8 +737,9 @@ protected:
             }
          }
          else
-            throw MeshReaderError( "VTKReader", "parsing error: unexpected section start at byte " + std::to_string(currentPosition)
-                                    + " (section name is '" + name + "')" );
+            throw MeshReaderError( "VTKReader",
+                                   "parsing error: unexpected section start at byte " + std::to_string( currentPosition )
+                                      + " (section name is '" + name + "')" );
       }
 
       // clear errors bits on the input stream
@@ -715,24 +747,24 @@ protected:
    }
 
    VariantVector
-   readPointOrCellData( std::string sectionName, std::string arrayName )
+   readPointOrCellData( std::string sectionName, const std::string& arrayName )
    {
       std::ifstream inputFile( fileName );
       if( ! inputFile )
          throw MeshReaderError( "VTKReader", "failed to open the file '" + fileName + "'" );
 
-      std::int32_t elements = (sectionName == "CELL_DATA") ? cells_count : points_count;
+      std::int32_t elements = ( sectionName == "CELL_DATA" ) ? cells_count : points_count;
       int values_per_element = 1;
 
       sectionName += "::" + arrayName;
-      if( ! sectionPositions.count( sectionName ) ) {
+      if( sectionPositions.count( sectionName ) == 0 )
          throw MeshReaderError( "VTKReader", "array " + arrayName + " was not found in the CELL_DATA section" );
-      }
-      inputFile.seekg( sectionPositions[sectionName] );
+      inputFile.seekg( sectionPositions[ sectionName ] );
 
       // type: SCALARS, VECTORS, etc.
       // datatype: int, float, double
-      std::string type, datatype;
+      std::string type;
+      std::string datatype;
 
       // parse the metadata line
       std::string line;
@@ -773,16 +805,17 @@ protected:
    }
 
    template< typename T >
-   std::vector<T>
+   std::vector< T >
    readDataArray( std::istream& str, std::int32_t values )
    {
-      std::vector<T> vector( values );
+      std::vector< T > vector( values );
       for( std::int32_t i = 0; i < values; i++ )
-         vector[i] = readValue< T >( dataFormat, str );
+         vector[ i ] = readValue< T >( dataFormat, str );
       return vector;
    }
 
-   static void skipValue( VTK::FileFormat format, std::istream& str, std::string datatype )
+   static void
+   skipValue( VTK::FileFormat format, std::istream& str, const std::string& datatype )
    {
       if( datatype == "int" )  // implicit in vtk DataFile Version 2.0
          readValue< std::int32_t >( format, str );
@@ -799,11 +832,12 @@ protected:
    }
 
    template< typename T >
-   static T readValue( VTK::FileFormat format, std::istream& str )
+   static T
+   readValue( VTK::FileFormat format, std::istream& str )
    {
       T value;
       if( format == VTK::FileFormat::binary ) {
-         str.read( reinterpret_cast<char*>(&value), sizeof(T) );
+         str.read( reinterpret_cast< char* >( &value ), sizeof( T ) );
          // forceBigEndian = swapIfLittleEndian, i.e. here it forces a big-endian
          // value to the correct system endianness
          value = forceBigEndian( value );
@@ -815,6 +849,6 @@ protected:
    }
 };
 
-} // namespace Readers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Readers
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Readers/VTUReader.h b/src/TNL/Meshes/Readers/VTUReader.h
index c7d6c6c792fb255792e1a12260f52a8974686c00..2990e21218d6fd902af2befdd0bc7ed043aeb168 100644
--- a/src/TNL/Meshes/Readers/VTUReader.h
+++ b/src/TNL/Meshes/Readers/VTUReader.h
@@ -15,15 +15,15 @@ namespace TNL {
 namespace Meshes {
 namespace Readers {
 
-class VTUReader
-: public XMLVTK
+class VTUReader : public XMLVTK
 {
 #ifdef HAVE_TINYXML2
-   void readUnstructuredGrid()
+   void
+   readUnstructuredGrid()
    {
       using namespace tinyxml2;
       const XMLElement* piece = getChildSafe( datasetElement, "Piece" );
-      if( piece->NextSiblingElement( "Piece" ) )
+      if( piece->NextSiblingElement( "Piece" ) != nullptr )
          // ambiguity - throw error, we don't know which piece to parse (or all of them?)
          throw MeshReaderError( "VTUReader", "the serial UnstructuredGrid file contains more than one <Piece> element" );
       NumberOfPoints = getAttributeInteger( piece, "NumberOfPoints" );
@@ -55,87 +55,94 @@ class VTUReader
 
       // connectivity and offsets must have the same type
       if( connectivityType != offsetsType )
-         throw MeshReaderError( "VTUReader", "the \"connectivity\" and \"offsets\" array do not have the same type ("
-                            + connectivityType + " vs " + offsetsType + ")" );
+         throw MeshReaderError( "VTUReader",
+                                "the \"connectivity\" and \"offsets\" array do not have the same type (" + connectivityType
+                                   + " vs " + offsetsType + ")" );
       // cell types can be only uint8_t
       if( typesType != "std::uint8_t" )
          throw MeshReaderError( "VTUReader", "unsupported data type for the Name=\"types\" array" );
 
       using mpark::visit;
       // validate points
-      visit( [this](auto&& array) {
-               // check array size
-               if( array.size() != 3 * NumberOfPoints )
-                  throw MeshReaderError( "VTUReader", "invalid size of the Points data array (" + std::to_string(array.size())
-                                                      + " vs " + std::to_string(NumberOfPoints) + ")" );
-               // set spaceDimension
-               spaceDimension = 1;
-               std::size_t i = 0;
-               for( auto c : array ) {
-                  if( c != 0 ) {
-                     int dim = i % 3 + 1;
-                     spaceDimension = std::max( spaceDimension, dim );
-                  }
-                  ++i;
+      visit(
+         [ this ]( auto&& array )
+         {
+            // check array size
+            if( array.size() != 3 * NumberOfPoints )
+               throw MeshReaderError( "VTUReader",
+                                      "invalid size of the Points data array (" + std::to_string( array.size() ) + " vs "
+                                         + std::to_string( NumberOfPoints ) + ")" );
+            // set spaceDimension
+            spaceDimension = 1;
+            std::size_t i = 0;
+            for( auto c : array ) {
+               if( c != 0 ) {
+                  int dim = i % 3 + 1;
+                  spaceDimension = std::max( spaceDimension, dim );
                }
-            },
-            pointsArray
-         );
+               ++i;
+            }
+         },
+         pointsArray );
       // validate types
-      visit( [this](auto&& array) {
-               // check array size
-               if( array.size() != NumberOfCells )
-                  throw MeshReaderError( "VTUReader", "size of the types data array does not match the NumberOfCells attribute" );
-               // check empty mesh
-               if( array.size() == 0 )
-                  return;
-               cellShape = (VTK::EntityShape) array[0];
-               meshDimension = getEntityDimension( cellShape );
-               using PolygonShapeGroupChecker = VTK::EntityShapeGroupChecker< VTK::EntityShape::Polygon >;
-               using PolyhedronShapeGroupChecker = VTK::EntityShapeGroupChecker< VTK::EntityShape::Polyhedron >;
+      visit(
+         [ this ]( auto&& array )
+         {
+            // check array size
+            if( array.size() != NumberOfCells )
+               throw MeshReaderError( "VTUReader", "size of the types data array does not match the NumberOfCells attribute" );
+            // check empty mesh
+            if( array.size() == 0 )
+               return;
+            cellShape = (VTK::EntityShape) array[ 0 ];
+            meshDimension = getEntityDimension( cellShape );
+            using PolygonShapeGroupChecker = VTK::EntityShapeGroupChecker< VTK::EntityShape::Polygon >;
+            using PolyhedronShapeGroupChecker = VTK::EntityShapeGroupChecker< VTK::EntityShape::Polyhedron >;
 
-               // TODO: check only entities of the same dimension (edges, faces and cells separately)
-               for( auto c : array ) {
-                  VTK::EntityShape entityShape = (VTK::EntityShape) c;
-                  if( entityShape != cellShape ) {
-                     if( PolygonShapeGroupChecker::bothBelong( cellShape, entityShape ) )
-                        cellShape = PolygonShapeGroupChecker::GeneralShape;
-                     else if( PolyhedronShapeGroupChecker::bothBelong( cellShape, entityShape ) )
-                        cellShape = PolyhedronShapeGroupChecker::GeneralShape;
-                     else {
-                        const std::string msg = "Unsupported unstructured meshes with mixed entities: there are cells with type "
-                                              + VTK::getShapeName(cellShape) + " and " + VTK::getShapeName(entityShape) + ".";
-                        throw MeshReaderError( "VTUReader", msg );
-                     }
+            // TODO: check only entities of the same dimension (edges, faces and cells separately)
+            for( auto c : array ) {
+               VTK::EntityShape entityShape = (VTK::EntityShape) c;
+               if( entityShape != cellShape ) {
+                  if( PolygonShapeGroupChecker::bothBelong( cellShape, entityShape ) )
+                     cellShape = PolygonShapeGroupChecker::GeneralShape;
+                  else if( PolyhedronShapeGroupChecker::bothBelong( cellShape, entityShape ) )
+                     cellShape = PolyhedronShapeGroupChecker::GeneralShape;
+                  else {
+                     const std::string msg = "Unsupported unstructured meshes with mixed entities: there are cells with type "
+                                           + VTK::getShapeName( cellShape ) + " and " + VTK::getShapeName( entityShape ) + ".";
+                     throw MeshReaderError( "VTUReader", msg );
                   }
                }
-            },
-            typesArray
-         );
+            }
+         },
+         typesArray );
       // validate offsets
       std::size_t max_offset = 0;
-      visit( [this, &max_offset](auto&& array) mutable {
-               if( array.size() != NumberOfCells )
-                  throw MeshReaderError( "VTUReader", "size of the offsets data array does not match the NumberOfCells attribute" );
-               for( auto c : array ) {
-                  if( c <= (decltype(c)) max_offset )
-                     throw MeshReaderError( "VTUReader", "the offsets array is not monotonically increasing" );
-                  max_offset = c;
-               }
-            },
-            cellOffsetsArray
-         );
+      visit(
+         [ this, &max_offset ]( auto&& array ) mutable
+         {
+            if( array.size() != NumberOfCells )
+               throw MeshReaderError( "VTUReader",
+                                      "size of the offsets data array does not match the NumberOfCells attribute" );
+            for( auto c : array ) {
+               if( c <= (decltype( c )) max_offset )
+                  throw MeshReaderError( "VTUReader", "the offsets array is not monotonically increasing" );
+               max_offset = c;
+            }
+         },
+         cellOffsetsArray );
       // validate connectivity
-      visit( [this, max_offset](auto&& array) {
-               if( array.size() != max_offset )
-                  throw MeshReaderError( "VTUReader", "size of the connectivity data array does not match the offsets array" );
-               for( auto c : array ) {
-                  if( c < 0 || (std::size_t) c >= NumberOfPoints )
-                     throw MeshReaderError( "VTUReader", "connectivity index " + std::to_string(c) + " is out of range" );
-               }
-            },
-            cellConnectivityArray
-         );
+      visit(
+         [ this, max_offset ]( auto&& array )
+         {
+            if( array.size() != max_offset )
+               throw MeshReaderError( "VTUReader", "size of the connectivity data array does not match the offsets array" );
+            for( auto c : array ) {
+               if( c < 0 || (std::size_t) c >= NumberOfPoints )
+                  throw MeshReaderError( "VTUReader", "connectivity index " + std::to_string( c ) + " is out of range" );
+            }
+         },
+         cellConnectivityArray );
 
       if( cellShape == VTK::EntityShape::Polyhedron ) {
          // NOTE: the data format for polyhedral meshes in VTK files is not documented well (almost not at all).
@@ -158,72 +165,78 @@ class VTUReader
 
          // validate face offsets
          std::size_t max_offset = 0;
-         visit( [this, &max_offset](auto&& array) mutable {
-                  if( array.size() != NumberOfCells )
-                     throw MeshReaderError( "VTUReader", "size of the faceoffsets data array does not match the NumberOfCells attribute" );
-                  for( auto c : array ) {
-                     // NOTE: VTK stores -1 for cells that are not a polyhedron. We would need to populate
-                     if( c < 0 )
-                        continue;
-                     if( c <= (decltype(c)) max_offset )
-                        throw MeshReaderError( "VTUReader", "the faceoffsets array is not monotonically increasing" );
-                     max_offset = c;
-                  }
-               },
-               vtk_faceOffsetsArray
-            );
+         visit(
+            [ this, &max_offset ]( auto&& array ) mutable
+            {
+               if( array.size() != NumberOfCells )
+                  throw MeshReaderError( "VTUReader",
+                                         "size of the faceoffsets data array does not match the NumberOfCells attribute" );
+               for( auto c : array ) {
+                  // NOTE: VTK stores -1 for cells that are not a polyhedron. We would need to populate
+                  if( c < 0 )
+                     continue;
+                  if( c <= (decltype( c )) max_offset )
+                     throw MeshReaderError( "VTUReader", "the faceoffsets array is not monotonically increasing" );
+                  max_offset = c;
+               }
+            },
+            vtk_faceOffsetsArray );
          // validate faces
-         visit( [this, max_offset, &vtk_faceOffsetsArray](auto&& vtk_faces) {
-                  if( vtk_faces.size() != max_offset )
-                     throw MeshReaderError( "VTUReader", "size of the faces data array does not match the faceoffsets array" );
-                  // let's just assume that the connectivity and offsets arrays have the same type...
-                  using mpark::get;
-                  const auto& vtk_faceOffsets = get< std::decay_t<decltype(vtk_faces)> >( vtk_faceOffsetsArray );
-
-                  // We need to translate the VTK faces and faceoffsets arrays
-                  // into the format suitable for MeshReader (which uses the
-                  // format from FPMA). The data format for the faces array is:
-                  //    num_faces_cell_0,
-                  //      num_nodes_face_0, node_ind_0, node_ind_1, ..
-                  //      num_nodes_face_1, node_ind_0, node_ind_1, ..
-                  //      ...
-                  //    num_faces_cell_1,
-                  //      ...
-                  // See https://vtk.org/Wiki/VTK/Polyhedron_Support for more.
-                  std::decay_t<decltype(vtk_faces)> cellOffsets, cellConnectivity, faceOffsets, faceConnectivity;
-                  std::make_signed_t< std::size_t > cell_off_begin = 0;
-                  std::size_t faceIndex = 0;
-                  for( std::size_t cell = 0; cell < vtk_faceOffsets.size(); cell++ ) {
-                     const std::make_signed_t< std::size_t > cell_off_end = vtk_faceOffsets[ cell ];
-                     // TODO: VTK stores -1 for cells that are not a polyhedron. We would need to populate
-                     // faceOffsetsArray and faceConnectivityArray with values based on the cell topology.
-                     if( cell_off_end < 0 )
-                        throw MeshReaderError( "VTUReader", "found invalid offset in the faceoffsets array: " + std::to_string(cell_off_end) );
-                     if( static_cast< std::size_t >( cell_off_end ) > vtk_faces.size() )
-                        throw MeshReaderError( "VTUReader", "not enough face indices for cell no " + std::to_string(cell) );
-                     // faces[cell_off_begin : cell_off_end] -> face data for cell
-                     const std::size_t num_faces = vtk_faces.at( cell_off_begin++ );
-                     for( std::size_t f = 0; f < num_faces; f++ ) {
-                        const std::size_t num_vertices = vtk_faces.at( cell_off_begin++ );
-                        for( std::size_t v = 0; v < num_vertices; v++ )
-                           faceConnectivity.push_back( vtk_faces.at( cell_off_begin++ ) );
-                        faceOffsets.push_back( faceConnectivity.size() );
-                        cellConnectivity.push_back( faceIndex++ );
-                     }
-                     cellOffsets.push_back( cellConnectivity.size() );
+         visit(
+            [ this, max_offset, &vtk_faceOffsetsArray ]( auto&& vtk_faces )
+            {
+               if( vtk_faces.size() != max_offset )
+                  throw MeshReaderError( "VTUReader", "size of the faces data array does not match the faceoffsets array" );
+               // let's just assume that the connectivity and offsets arrays have the same type...
+               using mpark::get;
+               const auto& vtk_faceOffsets = get< std::decay_t< decltype( vtk_faces ) > >( vtk_faceOffsetsArray );
 
-                     if( cell_off_begin != cell_off_end )
-                        throw MeshReaderError( "VTUReader", "error while parsing the faces data array: did not reach the end offset for cell " + std::to_string(cell) );
+               // We need to translate the VTK faces and faceoffsets arrays
+               // into the format suitable for MeshReader (which uses the
+               // format from FPMA). The data format for the faces array is:
+               //    num_faces_cell_0,
+               //      num_nodes_face_0, node_ind_0, node_ind_1, ..
+               //      num_nodes_face_1, node_ind_0, node_ind_1, ..
+               //      ...
+               //    num_faces_cell_1,
+               //      ...
+               // See https://vtk.org/Wiki/VTK/Polyhedron_Support for more.
+               std::decay_t< decltype( vtk_faces ) > cellOffsets, cellConnectivity, faceOffsets, faceConnectivity;
+               std::make_signed_t< std::size_t > cell_off_begin = 0;
+               std::size_t faceIndex = 0;
+               for( std::size_t cell = 0; cell < vtk_faceOffsets.size(); cell++ ) {
+                  const std::make_signed_t< std::size_t > cell_off_end = vtk_faceOffsets[ cell ];
+                  // TODO: VTK stores -1 for cells that are not a polyhedron. We would need to populate
+                  // faceOffsetsArray and faceConnectivityArray with values based on the cell topology.
+                  if( cell_off_end < 0 )
+                     throw MeshReaderError(
+                        "VTUReader", "found invalid offset in the faceoffsets array: " + std::to_string( cell_off_end ) );
+                  if( static_cast< std::size_t >( cell_off_end ) > vtk_faces.size() )
+                     throw MeshReaderError( "VTUReader", "not enough face indices for cell no " + std::to_string( cell ) );
+                  // faces[cell_off_begin : cell_off_end] -> face data for cell
+                  const std::size_t num_faces = vtk_faces.at( cell_off_begin++ );
+                  for( std::size_t f = 0; f < num_faces; f++ ) {
+                     const std::size_t num_vertices = vtk_faces.at( cell_off_begin++ );
+                     for( std::size_t v = 0; v < num_vertices; v++ )
+                        faceConnectivity.push_back( vtk_faces.at( cell_off_begin++ ) );
+                     faceOffsets.push_back( faceConnectivity.size() );
+                     cellConnectivity.push_back( faceIndex++ );
                   }
+                  cellOffsets.push_back( cellConnectivity.size() );
 
-                  this->NumberOfFaces = faceIndex;
-                  this->cellOffsetsArray = std::move( cellOffsets );
-                  this->cellConnectivityArray = std::move( cellConnectivity );
-                  this->faceOffsetsArray = std::move( faceOffsets );
-                  this->faceConnectivityArray = std::move( faceConnectivity );
-               },
-               vtk_facesArray
-            );
+                  if( cell_off_begin != cell_off_end )
+                     throw MeshReaderError( "VTUReader",
+                                            "error while parsing the faces data array: did not reach the end offset for cell "
+                                               + std::to_string( cell ) );
+               }
+
+               this->NumberOfFaces = faceIndex;
+               this->cellOffsetsArray = std::move( cellOffsets );
+               this->cellConnectivityArray = std::move( cellConnectivity );
+               this->faceOffsetsArray = std::move( faceOffsets );
+               this->faceConnectivityArray = std::move( faceConnectivity );
+            },
+            vtk_facesArray );
       }
    }
 #endif
@@ -231,11 +244,10 @@ class VTUReader
 public:
    VTUReader() = default;
 
-   VTUReader( const std::string& fileName )
-   : XMLVTK( fileName )
-   {}
+   VTUReader( const std::string& fileName ) : XMLVTK( fileName ) {}
 
-   virtual void detectMesh() override
+   void
+   detectMesh() override
    {
 #ifdef HAVE_TINYXML2
       reset();
@@ -251,7 +263,8 @@ public:
       if( fileType == "UnstructuredGrid" )
          readUnstructuredGrid();
       else
-         throw MeshReaderError( "VTUReader", "the reader cannot read data of the type " + fileType + ". Use a different reader if possible." );
+         throw MeshReaderError(
+            "VTUReader", "the reader cannot read data of the type " + fileType + ". Use a different reader if possible." );
 
       // indicate success by setting the mesh type
       meshType = "Meshes::Mesh";
@@ -261,6 +274,6 @@ public:
    }
 };
 
-} // namespace Readers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Readers
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Readers/XMLVTK.h b/src/TNL/Meshes/Readers/XMLVTK.h
index 3fb59ae76f56c4488cea93fa2f906ac78b3ac8f4..d103be91c2114a49b43df04a7ab7a8b74edfdffe 100644
--- a/src/TNL/Meshes/Readers/XMLVTK.h
+++ b/src/TNL/Meshes/Readers/XMLVTK.h
@@ -28,70 +28,67 @@ namespace TNL {
 namespace Meshes {
 namespace Readers {
 
-static const std::map< std::string, std::string > VTKDataTypes {
-   {"Int8", "std::int8_t"},
-   {"UInt8", "std::uint8_t"},
-   {"Int16", "std::int16_t"},
-   {"UInt16", "std::uint16_t"},
-   {"Int32", "std::int32_t"},
-   {"UInt32", "std::uint32_t"},
-   {"Int64", "std::int64_t"},
-   {"UInt64", "std::uint64_t"},
-   {"Float32", "float"},
-   {"Float64", "double"}
-};
+static const std::map< std::string, std::string > VTKDataTypes{ { "Int8", "std::int8_t" },   { "UInt8", "std::uint8_t" },
+                                                                { "Int16", "std::int16_t" }, { "UInt16", "std::uint16_t" },
+                                                                { "Int32", "std::int32_t" }, { "UInt32", "std::uint32_t" },
+                                                                { "Int64", "std::int64_t" }, { "UInt64", "std::uint64_t" },
+                                                                { "Float32", "float" },      { "Float64", "double" } };
 
-class XMLVTK
-: public MeshReader
+class XMLVTK : public MeshReader
 {
-#ifdef HAVE_TINYXML2
 protected:
-   static void verifyElement( const tinyxml2::XMLElement* elem, const std::string name )
+#ifdef HAVE_TINYXML2
+   static void
+   verifyElement( const tinyxml2::XMLElement* elem, const std::string& name )
    {
-      if( ! elem )
+      if( elem == nullptr )
          throw MeshReaderError( "XMLVTK", "tag <" + name + "> not found" );
       if( elem->Name() != name )
-         throw MeshReaderError( "XMLVTK", "invalid XML format - expected a <" + name + "> element, got <" + elem->Name() + ">" );
+         throw MeshReaderError( "XMLVTK",
+                                "invalid XML format - expected a <" + name + "> element, got <" + elem->Name() + ">" );
    }
 
    static const tinyxml2::XMLElement*
-   verifyHasOnlyOneChild( const tinyxml2::XMLElement* parent, const std::string childName = "" )
+   verifyHasOnlyOneChild( const tinyxml2::XMLElement* parent, const std::string& childName = "" )
    {
       const std::string parentName = parent->Name();
       const tinyxml2::XMLElement* elem = parent->FirstChildElement();
       if( ! childName.empty() )
          verifyElement( elem, childName );
-      else if( ! elem )
+      else if( elem == nullptr )
          throw MeshReaderError( "XMLVTK", "element " + parentName + " does not contain any child" );
-      if( elem->NextSibling() )
+      if( elem->NextSibling() != nullptr )
          throw MeshReaderError( "XMLVTK", "<" + childName + "> is not the only element in <" + parentName + ">" );
       return elem;
    }
 
    static std::string
-   getAttributeString( const tinyxml2::XMLElement* elem, std::string name, std::string defaultValue = "" )
+   getAttributeString( const tinyxml2::XMLElement* elem, const std::string& name, std::string defaultValue = "" )
    {
       const char* attribute = nullptr;
       attribute = elem->Attribute( name.c_str() );
-      if( attribute )
+      if( attribute != nullptr )
          return attribute;
       if( ! defaultValue.empty() )
          return defaultValue;
-      throw MeshReaderError( "XMLVTK", "element <" + std::string(elem->Name()) + "> does not have the attribute '" + name + "'" );
+      throw MeshReaderError( "XMLVTK",
+                             "element <" + std::string( elem->Name() ) + "> does not have the attribute '" + name + "'" );
    }
 
    static std::int64_t
-   getAttributeInteger( const tinyxml2::XMLElement* elem, std::string name )
+   getAttributeInteger( const tinyxml2::XMLElement* elem, const std::string& name )
    {
       std::int64_t value;
       tinyxml2::XMLError status = elem->QueryInt64Attribute( name.c_str(), &value );
       if( status != tinyxml2::XML_SUCCESS )
-         throw MeshReaderError( "XMLVTK", "element <" + std::string(elem->Name()) + "> does not have the attribute '" + name + "' or it could not be converted to int64_t" );
+         throw MeshReaderError( "XMLVTK",
+                                "element <" + std::string( elem->Name() ) + "> does not have the attribute '" + name
+                                   + "' or it could not be converted to int64_t" );
       return value;
    }
 
    static std::int64_t
-   getAttributeInteger( const tinyxml2::XMLElement* elem, std::string name, int64_t defaultValue )
+   getAttributeInteger( const tinyxml2::XMLElement* elem, const std::string& name, int64_t defaultValue )
    {
       std::int64_t value;
       tinyxml2::XMLError status = elem->QueryInt64Attribute( name.c_str(), &value );
@@ -101,7 +98,7 @@ protected:
    }
 
    static const tinyxml2::XMLElement*
-   getChildSafe( const tinyxml2::XMLElement* parent, std::string name )
+   getChildSafe( const tinyxml2::XMLElement* parent, const std::string& name )
    {
       const tinyxml2::XMLElement* child = parent->FirstChildElement( name.c_str() );
       verifyElement( child, name );
@@ -109,10 +106,10 @@ protected:
    }
 
    static void
-   verifyDataArray( const tinyxml2::XMLElement* elem, std::string elemName = "DataArray" )
+   verifyDataArray( const tinyxml2::XMLElement* elem, const std::string& elemName = "DataArray" )
    {
       // the elemName parameter is necessary due to parallel formats using "PDataArray"
-      verifyElement( elem, elemName.c_str() );
+      verifyElement( elem, elemName );
       // verify Name
       getAttributeString( elem, "Name" );
       // verify type
@@ -127,13 +124,13 @@ protected:
       }
       // verify NumberOfComponents (optional)
       const std::string NumberOfComponents = getAttributeString( elem, "NumberOfComponents", "0" );
-      static const std::set< std::string > validNumbersOfComponents = {"0", "1", "2", "3"};
+      static const std::set< std::string > validNumbersOfComponents = { "0", "1", "2", "3" };
       if( validNumbersOfComponents.count( NumberOfComponents ) == 0 )
          throw MeshReaderError( "XMLVTK", "unsupported NumberOfComponents in " + elemName + ": " + NumberOfComponents );
    }
 
    static const tinyxml2::XMLElement*
-   getDataArrayByName( const tinyxml2::XMLElement* parent, std::string name )
+   getDataArrayByName( const tinyxml2::XMLElement* parent, const std::string& name )
    {
       const tinyxml2::XMLElement* found = nullptr;
       const tinyxml2::XMLElement* child = parent->FirstChildElement( "DataArray" );
@@ -143,17 +140,23 @@ protected:
          try {
             arrayName = getAttributeString( child, "Name" );
          }
-         catch( const MeshReaderError& ) {}
+         catch( const MeshReaderError& ) {
+         }
          if( arrayName == name ) {
             if( found == nullptr )
                found = child;
             else
-               throw MeshReaderError( "XMLVTK", "the <" + std::string(parent->Name()) + "> tag contains multiple <DataArray> tags with the Name=\"" + name + "\" attribute" );
+               throw MeshReaderError( "XMLVTK",
+                                      "the <" + std::string( parent->Name() )
+                                         + "> tag contains multiple <DataArray> tags with the Name=\"" + name
+                                         + "\" attribute" );
          }
          child = child->NextSiblingElement( "DataArray" );
       }
       if( found == nullptr )
-         throw MeshReaderError( "XMLVTK", "the <" + std::string(parent->Name()) + "> tag does not contain any <DataArray> tag with the Name=\"" + name + "\" attribute" );
+         throw MeshReaderError( "XMLVTK",
+                                "the <" + std::string( parent->Name() )
+                                   + "> tag does not contain any <DataArray> tag with the Name=\"" + name + "\" attribute" );
       verifyDataArray( found );
       return found;
    }
@@ -164,13 +167,13 @@ protected:
    {
       // handle empty array
       if( ! block )
-         return std::vector<T> {};
+         return std::vector< T >{};
 
       // creating a copy of the block is rather costly, but so is ASCII parsing
       std::stringstream ss;
       ss << block;
 
-      std::vector<T> vector;
+      std::vector< T > vector;
       while( ss ) {
          // since std::uint8_t is an alias to unsigned char, we need to parse
          // bytes into a larger type, otherwise operator>> would read it as char
@@ -189,134 +192,166 @@ protected:
    {
       // handle empty array
       if( ! block )
-         return std::vector<T> {};
+         return std::vector< T >{};
 
       // skip whitespace at the beginning
       while( *block != '\0' && std::isspace( *block ) )
          ++block;
 
-      if( compressor == "" ) {
+      if( compressor.empty() ) {
          std::size_t data_size = 0;
          const T* data_ptr = nullptr;
-         std::pair<std::size_t, std::unique_ptr<std::uint8_t[]>> decoded_data = base64::decode( block, std::strlen(block) );
+         std::pair< std::size_t, std::unique_ptr< std::uint8_t[] > > decoded_data =
+            base64::decode( block, std::strlen( block ) );
 
          // check if block size was decoded separately (so decoding stopped after block size due to padding)
-         if( decoded_data.first == sizeof(HeaderType) ) {
-            const std::size_t header_length = base64::get_encoded_length(sizeof(HeaderType));
-            const HeaderType block_size = *reinterpret_cast<const HeaderType*>(decoded_data.second.get());
-            decoded_data = base64::decode( block + header_length, base64::get_encoded_length(block_size) );
-            data_size = decoded_data.first / sizeof(T);
-            data_ptr = reinterpret_cast<const T*>(decoded_data.second.get());
+         if( decoded_data.first == sizeof( HeaderType ) ) {
+            const std::size_t header_length = base64::get_encoded_length( sizeof( HeaderType ) );
+            const HeaderType block_size = *reinterpret_cast< const HeaderType* >( decoded_data.second.get() );
+            decoded_data = base64::decode( block + header_length, base64::get_encoded_length( block_size ) );
+            data_size = decoded_data.first / sizeof( T );
+            data_ptr = reinterpret_cast< const T* >( decoded_data.second.get() );
          }
          else {
-            data_size = *reinterpret_cast<const HeaderType*>(decoded_data.second.get()) / sizeof(T);
-            data_ptr = reinterpret_cast<const T*>(decoded_data.second.get() + sizeof(HeaderType));
+            data_size = *reinterpret_cast< const HeaderType* >( decoded_data.second.get() ) / sizeof( T );
+            data_ptr = reinterpret_cast< const T* >( decoded_data.second.get() + sizeof( HeaderType ) );
          }
 
-         std::vector<T> vector( data_size );
+         std::vector< T > vector( data_size );
          for( std::size_t i = 0; i < vector.size(); i++ )
-            vector[i] = data_ptr[i];
+            vector[ i ] = data_ptr[ i ];
          return vector;
       }
       else if( compressor == "vtkZLibDataCompressor" ) {
-#ifdef HAVE_ZLIB
-         std::pair<HeaderType, std::unique_ptr<T[]>> decoded_data = decompress_block< HeaderType, T >(block);
-         std::vector<T> vector( decoded_data.first );
+   #ifdef HAVE_ZLIB
+         std::pair< HeaderType, std::unique_ptr< T[] > > decoded_data = decompress_block< HeaderType, T >( block );
+         std::vector< T > vector( decoded_data.first );
          for( std::size_t i = 0; i < vector.size(); i++ )
-            vector[i] = decoded_data.second.get()[i];
+            vector[ i ] = decoded_data.second.get()[ i ];
          return vector;
-#else
-         throw MeshReaderError( "XMLVTK", "The ZLIB compression is not available in this build. Make sure that ZLIB is "
-                                          "installed and recompile the program with -DHAVE_ZLIB." );
-#endif
+   #else
+         throw MeshReaderError( "XMLVTK",
+                                "The ZLIB compression is not available in this build. Make sure that ZLIB is "
+                                "installed and recompile the program with -DHAVE_ZLIB." );
+   #endif
       }
       else
-         throw MeshReaderError( "XMLVTK", "unsupported compressor type: " + compressor + " (only vtkZLibDataCompressor is supported)" );
+         throw MeshReaderError( "XMLVTK",
+                                "unsupported compressor type: " + compressor + " (only vtkZLibDataCompressor is supported)" );
    }
 
    template< typename T >
    VariantVector
    readBinaryBlock( const char* block ) const
    {
-      if( headerType == "std::int8_t" )          return readBinaryBlock< std::int8_t,   T >( block );
-      else if( headerType == "std::uint8_t" )    return readBinaryBlock< std::uint8_t,  T >( block );
-      else if( headerType == "std::int16_t" )    return readBinaryBlock< std::int16_t,  T >( block );
-      else if( headerType == "std::uint16_t" )   return readBinaryBlock< std::uint16_t, T >( block );
-      else if( headerType == "std::int32_t" )    return readBinaryBlock< std::int32_t,  T >( block );
-      else if( headerType == "std::uint32_t" )   return readBinaryBlock< std::uint32_t, T >( block );
-      else if( headerType == "std::int64_t" )    return readBinaryBlock< std::int64_t,  T >( block );
-      else if( headerType == "std::uint64_t" )   return readBinaryBlock< std::uint64_t, T >( block );
-      else throw MeshReaderError( "XMLVTK", "unsupported header type: " + headerType );
+      if( headerType == "std::int8_t" )
+         return readBinaryBlock< std::int8_t, T >( block );
+      else if( headerType == "std::uint8_t" )
+         return readBinaryBlock< std::uint8_t, T >( block );
+      else if( headerType == "std::int16_t" )
+         return readBinaryBlock< std::int16_t, T >( block );
+      else if( headerType == "std::uint16_t" )
+         return readBinaryBlock< std::uint16_t, T >( block );
+      else if( headerType == "std::int32_t" )
+         return readBinaryBlock< std::int32_t, T >( block );
+      else if( headerType == "std::uint32_t" )
+         return readBinaryBlock< std::uint32_t, T >( block );
+      else if( headerType == "std::int64_t" )
+         return readBinaryBlock< std::int64_t, T >( block );
+      else if( headerType == "std::uint64_t" )
+         return readBinaryBlock< std::uint64_t, T >( block );
+      else
+         throw MeshReaderError( "XMLVTK", "unsupported header type: " + headerType );
    }
 
    VariantVector
-   readDataArray( const tinyxml2::XMLElement* elem, std::string arrayName ) const
+   readDataArray( const tinyxml2::XMLElement* elem, const std::string& arrayName ) const
    {
       verifyElement( elem, "DataArray" );
       const char* block = elem->GetText();
       const std::string type = getAttributeString( elem, "type" );
       const std::string format = getAttributeString( elem, "format" );
       if( format == "ascii" ) {
-         if( type == "Int8" )          return readAsciiBlock< std::int8_t   >( block );
-         else if( type == "UInt8" )    return readAsciiBlock< std::uint8_t  >( block );
-         else if( type == "Int16" )    return readAsciiBlock< std::int16_t  >( block );
-         else if( type == "UInt16" )   return readAsciiBlock< std::uint16_t >( block );
-         else if( type == "Int32" )    return readAsciiBlock< std::int32_t  >( block );
-         else if( type == "UInt32" )   return readAsciiBlock< std::uint32_t >( block );
-         else if( type == "Int64" )    return readAsciiBlock< std::int64_t  >( block );
-         else if( type == "UInt64" )   return readAsciiBlock< std::uint64_t >( block );
-         else if( type == "Float32" )  return readAsciiBlock< float  >( block );
-         else if( type == "Float64" )  return readAsciiBlock< double >( block );
-         else throw MeshReaderError( "XMLVTK", "unsupported DataArray type: " + type );
+         if( type == "Int8" )
+            return readAsciiBlock< std::int8_t >( block );
+         else if( type == "UInt8" )
+            return readAsciiBlock< std::uint8_t >( block );
+         else if( type == "Int16" )
+            return readAsciiBlock< std::int16_t >( block );
+         else if( type == "UInt16" )
+            return readAsciiBlock< std::uint16_t >( block );
+         else if( type == "Int32" )
+            return readAsciiBlock< std::int32_t >( block );
+         else if( type == "UInt32" )
+            return readAsciiBlock< std::uint32_t >( block );
+         else if( type == "Int64" )
+            return readAsciiBlock< std::int64_t >( block );
+         else if( type == "UInt64" )
+            return readAsciiBlock< std::uint64_t >( block );
+         else if( type == "Float32" )
+            return readAsciiBlock< float >( block );
+         else if( type == "Float64" )
+            return readAsciiBlock< double >( block );
+         else
+            throw MeshReaderError( "XMLVTK", "unsupported DataArray type: " + type );
       }
       else if( format == "binary" ) {
-         if( type == "Int8" )          return readBinaryBlock< std::int8_t   >( block );
-         else if( type == "UInt8" )    return readBinaryBlock< std::uint8_t  >( block );
-         else if( type == "Int16" )    return readBinaryBlock< std::int16_t  >( block );
-         else if( type == "UInt16" )   return readBinaryBlock< std::uint16_t >( block );
-         else if( type == "Int32" )    return readBinaryBlock< std::int32_t  >( block );
-         else if( type == "UInt32" )   return readBinaryBlock< std::uint32_t >( block );
-         else if( type == "Int64" )    return readBinaryBlock< std::int64_t  >( block );
-         else if( type == "UInt64" )   return readBinaryBlock< std::uint64_t >( block );
-         else if( type == "Float32" )  return readBinaryBlock< float  >( block );
-         else if( type == "Float64" )  return readBinaryBlock< double >( block );
-         else throw MeshReaderError( "XMLVTK", "unsupported DataArray type: " + type );
+         if( type == "Int8" )
+            return readBinaryBlock< std::int8_t >( block );
+         else if( type == "UInt8" )
+            return readBinaryBlock< std::uint8_t >( block );
+         else if( type == "Int16" )
+            return readBinaryBlock< std::int16_t >( block );
+         else if( type == "UInt16" )
+            return readBinaryBlock< std::uint16_t >( block );
+         else if( type == "Int32" )
+            return readBinaryBlock< std::int32_t >( block );
+         else if( type == "UInt32" )
+            return readBinaryBlock< std::uint32_t >( block );
+         else if( type == "Int64" )
+            return readBinaryBlock< std::int64_t >( block );
+         else if( type == "UInt64" )
+            return readBinaryBlock< std::uint64_t >( block );
+         else if( type == "Float32" )
+            return readBinaryBlock< float >( block );
+         else if( type == "Float64" )
+            return readBinaryBlock< double >( block );
+         else
+            throw MeshReaderError( "XMLVTK", "unsupported DataArray type: " + type );
       }
       else
          throw MeshReaderError( "XMLVTK", "unsupported DataArray format: " + format );
    }
 
    VariantVector
-   readPointOrCellData( std::string sectionName, std::string arrayName )
+   readPointOrCellData( const std::string& sectionName, const std::string& arrayName )
    {
       const tinyxml2::XMLElement* piece = getChildSafe( datasetElement, "Piece" );
-      if( piece->NextSiblingElement( "Piece" ) )
+      if( piece->NextSiblingElement( "Piece" ) != nullptr )
          // ambiguity - throw error, we don't know which piece to parse
          throw MeshReaderError( "XMLVTK", "the dataset element <" + fileType + "> contains more than one <Piece> element" );
-      const tinyxml2::XMLElement* pointData = getChildSafe( piece, sectionName.c_str() );
-      if( pointData->NextSiblingElement( sectionName.c_str() ) )
+      const tinyxml2::XMLElement* pointData = getChildSafe( piece, sectionName );
+      if( pointData->NextSiblingElement( sectionName.c_str() ) != nullptr )
          throw MeshReaderError( "XMLVTK", "the <Piece> element contains more than one <" + sectionName + "> element" );
-      const tinyxml2::XMLElement* dataArray = getDataArrayByName( pointData, arrayName.c_str() );
-      return readDataArray( dataArray, arrayName.c_str() );
+      const tinyxml2::XMLElement* dataArray = getDataArrayByName( pointData, arrayName );
+      return readDataArray( dataArray, arrayName );
    }
 #endif
 
-protected:
    [[noreturn]] static void
    throw_no_tinyxml()
    {
-      throw std::runtime_error("The program was compiled without XML parsing. Make sure that TinyXML-2 is "
-                               "installed and recompile the program with -DHAVE_TINYXML2.");
+      throw std::runtime_error( "The program was compiled without XML parsing. Make sure that TinyXML-2 is "
+                                "installed and recompile the program with -DHAVE_TINYXML2." );
    }
 
 public:
    XMLVTK() = default;
 
-   XMLVTK( const std::string& fileName )
-   : MeshReader( fileName )
-   {}
+   XMLVTK( const std::string& fileName ) : MeshReader( fileName ) {}
 
-   void openVTKFile()
+   void
+   openVTKFile()
    {
 #ifdef HAVE_TINYXML2
       using namespace tinyxml2;
@@ -335,15 +370,17 @@ public:
       // verify root element
       const XMLElement* elem = dom.FirstChildElement();
       verifyElement( elem, "VTKFile" );
-      if( elem->NextSibling() )
+      if( elem->NextSibling() != nullptr )
          throw MeshReaderError( "XMLVTK", "<VTKFile> is not the only element in the file " + fileName );
 
       // verify byte order
-      const std::string systemByteOrder = (isLittleEndian()) ? "LittleEndian" : "BigEndian";
+      const std::string systemByteOrder = ( isLittleEndian() ) ? "LittleEndian" : "BigEndian";
       byteOrder = getAttributeString( elem, "byte_order" );
       if( byteOrder != systemByteOrder )
-         throw MeshReaderError( "XMLVTK", "incompatible byte_order: " + byteOrder + " (the system is " + systemByteOrder + " and the conversion "
-                                          "from BigEndian to LittleEndian or vice versa is not implemented yet)" );
+         throw MeshReaderError( "XMLVTK",
+                                "incompatible byte_order: " + byteOrder + " (the system is " + systemByteOrder
+                                   + " and the conversion "
+                                     "from BigEndian to LittleEndian or vice versa is not implemented yet)" );
 
       // verify header type
       headerType = getAttributeString( elem, "header_type", "UInt32" );
@@ -355,8 +392,9 @@ public:
       compressor = getAttributeString( elem, "compressor", "<none>" );
       if( compressor == "<none>" )
          compressor = "";
-      if( compressor != "" && compressor != "vtkZLibDataCompressor" )
-         throw MeshReaderError( "XMLVTK", "unsupported compressor type: " + compressor + " (only vtkZLibDataCompressor is supported)" );
+      if( ! compressor.empty() && compressor != "vtkZLibDataCompressor" )
+         throw MeshReaderError( "XMLVTK",
+                                "unsupported compressor type: " + compressor + " (only vtkZLibDataCompressor is supported)" );
 
       // get file type and the corresponding XML element
       fileType = getAttributeString( elem, "type" );
@@ -366,7 +404,7 @@ public:
 #endif
    }
 
-   virtual VariantVector
+   VariantVector
    readPointData( std::string arrayName ) override
    {
 #ifdef HAVE_TINYXML2
@@ -376,7 +414,7 @@ public:
 #endif
    }
 
-   virtual VariantVector
+   VariantVector
    readCellData( std::string arrayName ) override
    {
 #ifdef HAVE_TINYXML2
@@ -386,7 +424,8 @@ public:
 #endif
    }
 
-   virtual void reset() override
+   void
+   reset() override
    {
       resetBase();
       fileType = "";
@@ -413,6 +452,6 @@ protected:
 #endif
 };
 
-} // namespace Readers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Readers
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Readers/getMeshReader.h b/src/TNL/Meshes/Readers/getMeshReader.h
index 4f40af41583f77b8b4e30028637234e1e21e282e..d64734eaeff6bd7775db09ff0578856c0622fa37 100644
--- a/src/TNL/Meshes/Readers/getMeshReader.h
+++ b/src/TNL/Meshes/Readers/getMeshReader.h
@@ -24,16 +24,15 @@ namespace Meshes {
 namespace Readers {
 
 inline std::shared_ptr< MeshReader >
-getMeshReader( const std::string& fileName,
-               const std::string& fileFormat )
+getMeshReader( const std::string& fileName, const std::string& fileFormat )
 {
    namespace fs = std::experimental::filesystem;
    std::string format = fileFormat;
    if( format == "auto" ) {
-      format = fs::path(fileName).extension();
+      format = fs::path( fileName ).extension();
       if( format.length() > 0 )
          // remove dot from the extension
-         format = format.substr(1);
+         format = format.substr( 1 );
    }
 
    if( format == "ng" )
@@ -59,6 +58,6 @@ getMeshReader( const std::string& fileName,
    return nullptr;
 }
 
-} // namespace Readers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Readers
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Topologies/Edge.h b/src/TNL/Meshes/Topologies/Edge.h
index 211e4c0b966c0ba1e85a5a035c7fa374ed144036..ac3a890aa5c642f9b67860ab5d0d9b4f5a328e45 100644
--- a/src/TNL/Meshes/Topologies/Edge.h
+++ b/src/TNL/Meshes/Topologies/Edge.h
@@ -24,15 +24,14 @@ struct Edge
    static constexpr int dimension = 1;
 };
 
-
 template<>
 struct Subtopology< Edge, 0 >
 {
-   typedef Vertex Topology;
+   using Topology = Vertex;
 
    static constexpr int count = 2;
 };
 
-} // namespace Topologies
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Topologies
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Topologies/Hexahedron.h b/src/TNL/Meshes/Topologies/Hexahedron.h
index 6ad2e6236b838f551b9d0eac7ce41f744796dd73..0987abbf206b906c1cfb6171b28e45506a3d2da0 100644
--- a/src/TNL/Meshes/Topologies/Hexahedron.h
+++ b/src/TNL/Meshes/Topologies/Hexahedron.h
@@ -26,7 +26,7 @@ struct Hexahedron
 template<>
 struct Subtopology< Hexahedron, 0 >
 {
-   typedef Vertex Topology;
+   using Topology = Vertex;
 
    static constexpr int count = 8;
 };
@@ -34,7 +34,7 @@ struct Subtopology< Hexahedron, 0 >
 template<>
 struct Subtopology< Hexahedron, 1 >
 {
-   typedef Edge Topology;
+   using Topology = Edge;
 
    static constexpr int count = 12;
 };
@@ -42,7 +42,7 @@ struct Subtopology< Hexahedron, 1 >
 template<>
 struct Subtopology< Hexahedron, 2 >
 {
-   typedef Quadrangle Topology;
+   using Topology = Quadrangle;
 
    static constexpr int count = 6;
 };
@@ -104,73 +104,264 @@ struct Subtopology< Hexahedron, 2 >
  *
  */
 
-template<> struct SubentityVertexMap< Hexahedron, Edge,  0, 0> { static constexpr int index = 0; };
-template<> struct SubentityVertexMap< Hexahedron, Edge,  0, 1> { static constexpr int index = 1; };
-
-template<> struct SubentityVertexMap< Hexahedron, Edge,  1, 0> { static constexpr int index = 1; };
-template<> struct SubentityVertexMap< Hexahedron, Edge,  1, 1> { static constexpr int index = 2; };
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 0, 0 >
+{
+   static constexpr int index = 0;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 0, 1 >
+{
+   static constexpr int index = 1;
+};
 
-template<> struct SubentityVertexMap< Hexahedron, Edge,  2, 0> { static constexpr int index = 2; };
-template<> struct SubentityVertexMap< Hexahedron, Edge,  2, 1> { static constexpr int index = 3; };
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 1, 0 >
+{
+   static constexpr int index = 1;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 1, 1 >
+{
+   static constexpr int index = 2;
+};
 
-template<> struct SubentityVertexMap< Hexahedron, Edge,  3, 0> { static constexpr int index = 3; };
-template<> struct SubentityVertexMap< Hexahedron, Edge,  3, 1> { static constexpr int index = 0; };
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 2, 0 >
+{
+   static constexpr int index = 2;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 2, 1 >
+{
+   static constexpr int index = 3;
+};
 
-template<> struct SubentityVertexMap< Hexahedron, Edge,  4, 0> { static constexpr int index = 0; };
-template<> struct SubentityVertexMap< Hexahedron, Edge,  4, 1> { static constexpr int index = 4; };
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 3, 0 >
+{
+   static constexpr int index = 3;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 3, 1 >
+{
+   static constexpr int index = 0;
+};
 
-template<> struct SubentityVertexMap< Hexahedron, Edge,  5, 0> { static constexpr int index = 1; };
-template<> struct SubentityVertexMap< Hexahedron, Edge,  5, 1> { static constexpr int index = 5; };
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 4, 0 >
+{
+   static constexpr int index = 0;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 4, 1 >
+{
+   static constexpr int index = 4;
+};
 
-template<> struct SubentityVertexMap< Hexahedron, Edge,  6, 0> { static constexpr int index = 2; };
-template<> struct SubentityVertexMap< Hexahedron, Edge,  6, 1> { static constexpr int index = 6; };
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 5, 0 >
+{
+   static constexpr int index = 1;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 5, 1 >
+{
+   static constexpr int index = 5;
+};
 
-template<> struct SubentityVertexMap< Hexahedron, Edge,  7, 0> { static constexpr int index = 3; };
-template<> struct SubentityVertexMap< Hexahedron, Edge,  7, 1> { static constexpr int index = 7; };
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 6, 0 >
+{
+   static constexpr int index = 2;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 6, 1 >
+{
+   static constexpr int index = 6;
+};
 
-template<> struct SubentityVertexMap< Hexahedron, Edge,  8, 0> { static constexpr int index = 4; };
-template<> struct SubentityVertexMap< Hexahedron, Edge,  8, 1> { static constexpr int index = 5; };
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 7, 0 >
+{
+   static constexpr int index = 3;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 7, 1 >
+{
+   static constexpr int index = 7;
+};
 
-template<> struct SubentityVertexMap< Hexahedron, Edge,  9, 0> { static constexpr int index = 5; };
-template<> struct SubentityVertexMap< Hexahedron, Edge,  9, 1> { static constexpr int index = 6; };
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 8, 0 >
+{
+   static constexpr int index = 4;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 8, 1 >
+{
+   static constexpr int index = 5;
+};
 
-template<> struct SubentityVertexMap< Hexahedron, Edge, 10, 0> { static constexpr int index = 6; };
-template<> struct SubentityVertexMap< Hexahedron, Edge, 10, 1> { static constexpr int index = 7; };
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 9, 0 >
+{
+   static constexpr int index = 5;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 9, 1 >
+{
+   static constexpr int index = 6;
+};
 
-template<> struct SubentityVertexMap< Hexahedron, Edge, 11, 0> { static constexpr int index = 7; };
-template<> struct SubentityVertexMap< Hexahedron, Edge, 11, 1> { static constexpr int index = 4; };
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 10, 0 >
+{
+   static constexpr int index = 6;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 10, 1 >
+{
+   static constexpr int index = 7;
+};
 
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 11, 0 >
+{
+   static constexpr int index = 7;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Edge, 11, 1 >
+{
+   static constexpr int index = 4;
+};
 
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 0, 0> { static constexpr int index = 0; };
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 0, 1> { static constexpr int index = 1; };
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 0, 2> { static constexpr int index = 2; };
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 0, 3> { static constexpr int index = 3; };
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 0, 0 >
+{
+   static constexpr int index = 0;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 0, 1 >
+{
+   static constexpr int index = 1;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 0, 2 >
+{
+   static constexpr int index = 2;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 0, 3 >
+{
+   static constexpr int index = 3;
+};
 
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 1, 0> { static constexpr int index = 0; };
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 1, 1> { static constexpr int index = 1; };
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 1, 2> { static constexpr int index = 5; };
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 1, 3> { static constexpr int index = 4; };
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 1, 0 >
+{
+   static constexpr int index = 0;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 1, 1 >
+{
+   static constexpr int index = 1;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 1, 2 >
+{
+   static constexpr int index = 5;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 1, 3 >
+{
+   static constexpr int index = 4;
+};
 
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 2, 0> { static constexpr int index = 1; };
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 2, 1> { static constexpr int index = 2; };
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 2, 2> { static constexpr int index = 6; };
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 2, 3> { static constexpr int index = 5; };
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 2, 0 >
+{
+   static constexpr int index = 1;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 2, 1 >
+{
+   static constexpr int index = 2;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 2, 2 >
+{
+   static constexpr int index = 6;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 2, 3 >
+{
+   static constexpr int index = 5;
+};
 
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 3, 0> { static constexpr int index = 2; };
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 3, 1> { static constexpr int index = 3; };
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 3, 2> { static constexpr int index = 7; };
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 3, 3> { static constexpr int index = 6; };
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 3, 0 >
+{
+   static constexpr int index = 2;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 3, 1 >
+{
+   static constexpr int index = 3;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 3, 2 >
+{
+   static constexpr int index = 7;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 3, 3 >
+{
+   static constexpr int index = 6;
+};
 
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 4, 0> { static constexpr int index = 3; };
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 4, 1> { static constexpr int index = 0; };
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 4, 2> { static constexpr int index = 4; };
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 4, 3> { static constexpr int index = 7; };
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 4, 0 >
+{
+   static constexpr int index = 3;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 4, 1 >
+{
+   static constexpr int index = 0;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 4, 2 >
+{
+   static constexpr int index = 4;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 4, 3 >
+{
+   static constexpr int index = 7;
+};
 
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 5, 0> { static constexpr int index = 4; };
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 5, 1> { static constexpr int index = 5; };
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 5, 2> { static constexpr int index = 6; };
-template<> struct SubentityVertexMap< Hexahedron, Quadrangle, 5, 3> { static constexpr int index = 7; };
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 5, 0 >
+{
+   static constexpr int index = 4;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 5, 1 >
+{
+   static constexpr int index = 5;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 5, 2 >
+{
+   static constexpr int index = 6;
+};
+template<>
+struct SubentityVertexMap< Hexahedron, Quadrangle, 5, 3 >
+{
+   static constexpr int index = 7;
+};
 
-} // namespace Topologies
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Topologies
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Topologies/IsDynamicTopology.h b/src/TNL/Meshes/Topologies/IsDynamicTopology.h
index 9c1b91b41615fc28ebac72e553e0b7d7619df157..a07c056a21efe357153d852bffc1afee9df63cf4 100644
--- a/src/TNL/Meshes/Topologies/IsDynamicTopology.h
+++ b/src/TNL/Meshes/Topologies/IsDynamicTopology.h
@@ -15,13 +15,14 @@ namespace Meshes {
 namespace Topologies {
 
 /**
- * \brief Type trait for checking if Topology has at least one missing Subtopology< Topology, D > >::count for all D from Topology::dimension - 1 to 0
+ * \brief Type trait for checking if Topology has at least one missing Subtopology< Topology, D > >::count for all D from
+ * Topology::dimension - 1 to 0
  */
 template< typename Topology, int D = Topology::dimension >
 struct IsDynamicTopology
 {
-   static constexpr bool value = ! HasCountMember< Subtopology< Topology, D - 1 > >::value ||
-                                   IsDynamicTopology< Topology, D - 1 >::value;
+   static constexpr bool value =
+      ! HasCountMember< Subtopology< Topology, D - 1 > >::value || IsDynamicTopology< Topology, D - 1 >::value;
 };
 
 /**
@@ -40,6 +41,6 @@ struct IsDynamicTopology< Topology, 1 >
    static constexpr bool value = ! HasCountMember< Subtopology< Topology, 0 > >::value;
 };
 
-} // namespace Topologies
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Topologies
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Topologies/Polygon.h b/src/TNL/Meshes/Topologies/Polygon.h
index 10aed7fdb615e807c4dc097ae515351442f82e7d..b1223a011695684c02b2d7e0d3877ba0e6b03ce7 100644
--- a/src/TNL/Meshes/Topologies/Polygon.h
+++ b/src/TNL/Meshes/Topologies/Polygon.h
@@ -29,6 +29,6 @@ struct Subtopology< Polygon, 1 >
    typedef Edge Topology;
 };
 
-} // namespace Topologies
-} // namespace Meshes
-} // namespace TNL
\ No newline at end of file
+}  // namespace Topologies
+}  // namespace Meshes
+}  // namespace TNL
\ No newline at end of file
diff --git a/src/TNL/Meshes/Topologies/Polyhedron.h b/src/TNL/Meshes/Topologies/Polyhedron.h
index 98b7b9af8eecdd7de7dcad213a4bd597d55c034b..754db02496f5bd7c733c4b667ae63dfe14301936 100644
--- a/src/TNL/Meshes/Topologies/Polyhedron.h
+++ b/src/TNL/Meshes/Topologies/Polyhedron.h
@@ -35,6 +35,6 @@ struct Subtopology< Polyhedron, 2 >
    typedef Polygon Topology;
 };
 
-} // namespace Topologies
-} // namespace Meshes
-} // namespace TNL
\ No newline at end of file
+}  // namespace Topologies
+}  // namespace Meshes
+}  // namespace TNL
\ No newline at end of file
diff --git a/src/TNL/Meshes/Topologies/Pyramid.h b/src/TNL/Meshes/Topologies/Pyramid.h
index 49768d67f4f9f6b1149888d3a2ecb5d16a1926af..0f22fc0771d81b1d599244ab0d1aad3e3fea35b8 100644
--- a/src/TNL/Meshes/Topologies/Pyramid.h
+++ b/src/TNL/Meshes/Topologies/Pyramid.h
@@ -18,7 +18,6 @@ struct Pyramid
    static constexpr int dimension = 3;
 };
 
-
 template<>
 struct Subtopology< Pyramid, 0 >
 {
@@ -43,82 +42,209 @@ struct Subtopology< Pyramid, 2 >
    static constexpr int count = 5;
 };
 
+template<>
+struct SubentityVertexMap< Pyramid, Edge, 0, 0 >
+{
+   static constexpr int index = 0;
+};
+template<>
+struct SubentityVertexMap< Pyramid, Edge, 0, 1 >
+{
+   static constexpr int index = 1;
+};
 
-template<> struct SubentityVertexMap< Pyramid, Edge, 0, 0> { static constexpr int index = 0; };
-template<> struct SubentityVertexMap< Pyramid, Edge, 0, 1> { static constexpr int index = 1; };
-
-template<> struct SubentityVertexMap< Pyramid, Edge, 1, 0> { static constexpr int index = 1; };
-template<> struct SubentityVertexMap< Pyramid, Edge, 1, 1> { static constexpr int index = 2; };
+template<>
+struct SubentityVertexMap< Pyramid, Edge, 1, 0 >
+{
+   static constexpr int index = 1;
+};
+template<>
+struct SubentityVertexMap< Pyramid, Edge, 1, 1 >
+{
+   static constexpr int index = 2;
+};
 
-template<> struct SubentityVertexMap< Pyramid, Edge, 2, 0> { static constexpr int index = 2; };
-template<> struct SubentityVertexMap< Pyramid, Edge, 2, 1> { static constexpr int index = 3; };
+template<>
+struct SubentityVertexMap< Pyramid, Edge, 2, 0 >
+{
+   static constexpr int index = 2;
+};
+template<>
+struct SubentityVertexMap< Pyramid, Edge, 2, 1 >
+{
+   static constexpr int index = 3;
+};
 
-template<> struct SubentityVertexMap< Pyramid, Edge, 3, 0> { static constexpr int index = 3; };
-template<> struct SubentityVertexMap< Pyramid, Edge, 3, 1> { static constexpr int index = 0; };
+template<>
+struct SubentityVertexMap< Pyramid, Edge, 3, 0 >
+{
+   static constexpr int index = 3;
+};
+template<>
+struct SubentityVertexMap< Pyramid, Edge, 3, 1 >
+{
+   static constexpr int index = 0;
+};
 
-template<> struct SubentityVertexMap< Pyramid, Edge, 4, 0> { static constexpr int index = 0; };
-template<> struct SubentityVertexMap< Pyramid, Edge, 4, 1> { static constexpr int index = 4; };
+template<>
+struct SubentityVertexMap< Pyramid, Edge, 4, 0 >
+{
+   static constexpr int index = 0;
+};
+template<>
+struct SubentityVertexMap< Pyramid, Edge, 4, 1 >
+{
+   static constexpr int index = 4;
+};
 
-template<> struct SubentityVertexMap< Pyramid, Edge, 5, 0> { static constexpr int index = 1; };
-template<> struct SubentityVertexMap< Pyramid, Edge, 5, 1> { static constexpr int index = 4; };
+template<>
+struct SubentityVertexMap< Pyramid, Edge, 5, 0 >
+{
+   static constexpr int index = 1;
+};
+template<>
+struct SubentityVertexMap< Pyramid, Edge, 5, 1 >
+{
+   static constexpr int index = 4;
+};
 
-template<> struct SubentityVertexMap< Pyramid, Edge, 6, 0> { static constexpr int index = 2; };
-template<> struct SubentityVertexMap< Pyramid, Edge, 6, 1> { static constexpr int index = 4; };
+template<>
+struct SubentityVertexMap< Pyramid, Edge, 6, 0 >
+{
+   static constexpr int index = 2;
+};
+template<>
+struct SubentityVertexMap< Pyramid, Edge, 6, 1 >
+{
+   static constexpr int index = 4;
+};
 
-template<> struct SubentityVertexMap< Pyramid, Edge, 7, 0> { static constexpr int index = 3; };
-template<> struct SubentityVertexMap< Pyramid, Edge, 7, 1> { static constexpr int index = 4; };
+template<>
+struct SubentityVertexMap< Pyramid, Edge, 7, 0 >
+{
+   static constexpr int index = 3;
+};
+template<>
+struct SubentityVertexMap< Pyramid, Edge, 7, 1 >
+{
+   static constexpr int index = 4;
+};
 
-template <>
+template<>
 struct SubentityVertexCount< Pyramid, Polygon, 0 >
 {
    static constexpr int count = 4;
 };
 
-template<> struct SubentityVertexMap< Pyramid, Polygon, 0, 0> { static constexpr int index = 0; };
-template<> struct SubentityVertexMap< Pyramid, Polygon, 0, 1> { static constexpr int index = 1; };
-template<> struct SubentityVertexMap< Pyramid, Polygon, 0, 2> { static constexpr int index = 2; };
-template<> struct SubentityVertexMap< Pyramid, Polygon, 0, 3> { static constexpr int index = 3; };
+template<>
+struct SubentityVertexMap< Pyramid, Polygon, 0, 0 >
+{
+   static constexpr int index = 0;
+};
+template<>
+struct SubentityVertexMap< Pyramid, Polygon, 0, 1 >
+{
+   static constexpr int index = 1;
+};
+template<>
+struct SubentityVertexMap< Pyramid, Polygon, 0, 2 >
+{
+   static constexpr int index = 2;
+};
+template<>
+struct SubentityVertexMap< Pyramid, Polygon, 0, 3 >
+{
+   static constexpr int index = 3;
+};
 
-template <>
+template<>
 struct SubentityVertexCount< Pyramid, Polygon, 1 >
 {
    static constexpr int count = 3;
 };
 
-template<> struct SubentityVertexMap< Pyramid, Polygon, 1, 0> { static constexpr int index = 0; };
-template<> struct SubentityVertexMap< Pyramid, Polygon, 1, 1> { static constexpr int index = 1; };
-template<> struct SubentityVertexMap< Pyramid, Polygon, 1, 2> { static constexpr int index = 4; };
+template<>
+struct SubentityVertexMap< Pyramid, Polygon, 1, 0 >
+{
+   static constexpr int index = 0;
+};
+template<>
+struct SubentityVertexMap< Pyramid, Polygon, 1, 1 >
+{
+   static constexpr int index = 1;
+};
+template<>
+struct SubentityVertexMap< Pyramid, Polygon, 1, 2 >
+{
+   static constexpr int index = 4;
+};
 
-template <>
+template<>
 struct SubentityVertexCount< Pyramid, Polygon, 2 >
 {
    static constexpr int count = 3;
 };
 
-template<> struct SubentityVertexMap< Pyramid, Polygon, 2, 0> { static constexpr int index = 1; };
-template<> struct SubentityVertexMap< Pyramid, Polygon, 2, 1> { static constexpr int index = 2; };
-template<> struct SubentityVertexMap< Pyramid, Polygon, 2, 2> { static constexpr int index = 4; };
+template<>
+struct SubentityVertexMap< Pyramid, Polygon, 2, 0 >
+{
+   static constexpr int index = 1;
+};
+template<>
+struct SubentityVertexMap< Pyramid, Polygon, 2, 1 >
+{
+   static constexpr int index = 2;
+};
+template<>
+struct SubentityVertexMap< Pyramid, Polygon, 2, 2 >
+{
+   static constexpr int index = 4;
+};
 
-template <>
+template<>
 struct SubentityVertexCount< Pyramid, Polygon, 3 >
 {
    static constexpr int count = 3;
 };
 
-template<> struct SubentityVertexMap< Pyramid, Polygon, 3, 0> { static constexpr int index = 2; };
-template<> struct SubentityVertexMap< Pyramid, Polygon, 3, 1> { static constexpr int index = 3; };
-template<> struct SubentityVertexMap< Pyramid, Polygon, 3, 2> { static constexpr int index = 4; };
+template<>
+struct SubentityVertexMap< Pyramid, Polygon, 3, 0 >
+{
+   static constexpr int index = 2;
+};
+template<>
+struct SubentityVertexMap< Pyramid, Polygon, 3, 1 >
+{
+   static constexpr int index = 3;
+};
+template<>
+struct SubentityVertexMap< Pyramid, Polygon, 3, 2 >
+{
+   static constexpr int index = 4;
+};
 
-template <>
+template<>
 struct SubentityVertexCount< Pyramid, Polygon, 4 >
 {
    static constexpr int count = 3;
 };
 
-template<> struct SubentityVertexMap< Pyramid, Polygon, 4, 0> { static constexpr int index = 3; };
-template<> struct SubentityVertexMap< Pyramid, Polygon, 4, 1> { static constexpr int index = 0; };
-template<> struct SubentityVertexMap< Pyramid, Polygon, 4, 2> { static constexpr int index = 4; };
+template<>
+struct SubentityVertexMap< Pyramid, Polygon, 4, 0 >
+{
+   static constexpr int index = 3;
+};
+template<>
+struct SubentityVertexMap< Pyramid, Polygon, 4, 1 >
+{
+   static constexpr int index = 0;
+};
+template<>
+struct SubentityVertexMap< Pyramid, Polygon, 4, 2 >
+{
+   static constexpr int index = 4;
+};
 
-} // namespace Topologies
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Topologies
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Topologies/Quadrangle.h b/src/TNL/Meshes/Topologies/Quadrangle.h
index eef9b3b1a149fc093e5aa08e0e763fed69526a41..6a5f0222cf2e3c74b87e0707b4943ba7b83a9e95 100644
--- a/src/TNL/Meshes/Topologies/Quadrangle.h
+++ b/src/TNL/Meshes/Topologies/Quadrangle.h
@@ -23,11 +23,10 @@ struct Quadrangle
    static constexpr int dimension = 2;
 };
 
-
 template<>
 struct Subtopology< Quadrangle, 0 >
 {
-   typedef Vertex Topology;
+   using Topology = Vertex;
 
    static constexpr int count = 4;
 };
@@ -35,12 +34,11 @@ struct Subtopology< Quadrangle, 0 >
 template<>
 struct Subtopology< Quadrangle, 1 >
 {
-   typedef Edge Topology;
+   using Topology = Edge;
 
    static constexpr int count = 4;
 };
 
-
 /****
  * Indexing of the vertices follows the VTK file format
  *
@@ -68,18 +66,50 @@ struct Subtopology< Quadrangle, 1 >
  *
  */
 
-template<> struct SubentityVertexMap< Quadrangle, Edge, 0, 0> { static constexpr int index = 0; };
-template<> struct SubentityVertexMap< Quadrangle, Edge, 0, 1> { static constexpr int index = 1; };
+template<>
+struct SubentityVertexMap< Quadrangle, Edge, 0, 0 >
+{
+   static constexpr int index = 0;
+};
+template<>
+struct SubentityVertexMap< Quadrangle, Edge, 0, 1 >
+{
+   static constexpr int index = 1;
+};
 
-template<> struct SubentityVertexMap< Quadrangle, Edge, 1, 0> { static constexpr int index = 1; };
-template<> struct SubentityVertexMap< Quadrangle, Edge, 1, 1> { static constexpr int index = 2; };
+template<>
+struct SubentityVertexMap< Quadrangle, Edge, 1, 0 >
+{
+   static constexpr int index = 1;
+};
+template<>
+struct SubentityVertexMap< Quadrangle, Edge, 1, 1 >
+{
+   static constexpr int index = 2;
+};
 
-template<> struct SubentityVertexMap< Quadrangle, Edge, 2, 0> { static constexpr int index = 2; };
-template<> struct SubentityVertexMap< Quadrangle, Edge, 2, 1> { static constexpr int index = 3; };
+template<>
+struct SubentityVertexMap< Quadrangle, Edge, 2, 0 >
+{
+   static constexpr int index = 2;
+};
+template<>
+struct SubentityVertexMap< Quadrangle, Edge, 2, 1 >
+{
+   static constexpr int index = 3;
+};
 
-template<> struct SubentityVertexMap< Quadrangle, Edge, 3, 0> { static constexpr int index = 3; };
-template<> struct SubentityVertexMap< Quadrangle, Edge, 3, 1> { static constexpr int index = 0; };
+template<>
+struct SubentityVertexMap< Quadrangle, Edge, 3, 0 >
+{
+   static constexpr int index = 3;
+};
+template<>
+struct SubentityVertexMap< Quadrangle, Edge, 3, 1 >
+{
+   static constexpr int index = 0;
+};
 
-} // namespace Topologies
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Topologies
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Topologies/Simplex.h b/src/TNL/Meshes/Topologies/Simplex.h
index 1f2ca11459bbb40118a15e1429da3833c9cba961..4aee3a9f314010b319209d58e8890cfa109e6a48 100644
--- a/src/TNL/Meshes/Topologies/Simplex.h
+++ b/src/TNL/Meshes/Topologies/Simplex.h
@@ -10,7 +10,6 @@
  * Zabka Vitezslav, zabkav@gmail.com
  */
 
-
 #pragma once
 
 #include <TNL/Meshes/Topologies/SubentityVertexMap.h>
@@ -27,169 +26,155 @@ struct Simplex
 };
 
 namespace SimplexDetails {
-   template< unsigned int n, unsigned int k >
-   class NumCombinations;
+template< unsigned int n, unsigned int k >
+class NumCombinations;
 
-   template<unsigned int n, unsigned int k, unsigned int combinationIndex, unsigned int valueIndex>
-   class CombinationValue;
-}
+template< unsigned int n, unsigned int k, unsigned int combinationIndex, unsigned int valueIndex >
+class CombinationValue;
+}  // namespace SimplexDetails
 
-template< int dimension,
-          int subtopologyDim >
+template< int dimension, int subtopologyDim >
 class Subtopology< Simplex< dimension >, subtopologyDim >
 {
    static_assert( 0 < subtopologyDim && subtopologyDim < dimension, "invalid subtopology dimension" );
 
    static constexpr int topologyVertexCount = Subtopology< Simplex< dimension >, 0 >::count;
-   static constexpr int subtopologyVertexCount = Subtopology< Simplex< subtopologyDim >, 0>::count;
+   static constexpr int subtopologyVertexCount = Subtopology< Simplex< subtopologyDim >, 0 >::count;
 
-   public:
-      typedef Simplex< subtopologyDim > Topology;
+public:
+   using Topology = Simplex< subtopologyDim >;
 
-      static constexpr int count = SimplexDetails::NumCombinations< topologyVertexCount, subtopologyVertexCount >::value;
+   static constexpr int count = SimplexDetails::NumCombinations< topologyVertexCount, subtopologyVertexCount >::value;
 };
 
 template< int dimension >
 class Subtopology< Simplex< dimension >, 0 >
 {
-   static_assert(0 < dimension, "invalid dimension");
+   static_assert( 0 < dimension, "invalid dimension" );
 
-   public:
-      typedef Vertex Topology;
+public:
+   using Topology = Vertex;
 
-      static constexpr int count = dimension + 1;
+   static constexpr int count = dimension + 1;
 };
 
-
-template< int dimension,
-          typename Subtopology,
-          int subtopologyIndex,
-          int vertexIndex >
+template< int dimension, typename Subtopology, int subtopologyIndex, int vertexIndex >
 struct SubentityVertexMap< Simplex< dimension >, Subtopology, subtopologyIndex, vertexIndex >
 {
-   private:
-      static constexpr int subtopologyCount = Topologies::Subtopology< Simplex< dimension >, Subtopology::dimension >::count;
-      static constexpr int topologyVertexCount = Topologies::Subtopology< Simplex< dimension >, 0 >::count;
-      static constexpr int subtopologyVertexCount = Topologies::Subtopology< Subtopology, 0 >::count;
-
-      static_assert(1 < dimension, "subtopology vertex can be specified for topologies of dimension 2 or higher");
-      static_assert(0 <= subtopologyIndex && subtopologyIndex < subtopologyCount, "invalid subtopology index");
-      static_assert(0 <= vertexIndex && vertexIndex < subtopologyVertexCount, "invalid subtopology vertex index");
-
-   public:
-      static constexpr int index = SimplexDetails::CombinationValue< topologyVertexCount, subtopologyVertexCount, subtopologyIndex, vertexIndex>::value;
+private:
+   static constexpr int subtopologyCount = Topologies::Subtopology< Simplex< dimension >, Subtopology::dimension >::count;
+   static constexpr int topologyVertexCount = Topologies::Subtopology< Simplex< dimension >, 0 >::count;
+   static constexpr int subtopologyVertexCount = Topologies::Subtopology< Subtopology, 0 >::count;
+
+   static_assert( 1 < dimension, "subtopology vertex can be specified for topologies of dimension 2 or higher" );
+   static_assert( 0 <= subtopologyIndex && subtopologyIndex < subtopologyCount, "invalid subtopology index" );
+   static_assert( 0 <= vertexIndex && vertexIndex < subtopologyVertexCount, "invalid subtopology vertex index" );
+
+public:
+   static constexpr int index =
+      SimplexDetails::CombinationValue< topologyVertexCount, subtopologyVertexCount, subtopologyIndex, vertexIndex >::value;
 };
 
 template< unsigned int n, unsigned int k >
 class NumCombinations
 {
-   static_assert(0 < k && k < n, "invalid argument");
+   static_assert( 0 < k && k < n, "invalid argument" );
 
-   public:
-      static constexpr unsigned int value = NumCombinations< n - 1, k - 1 >::value + NumCombinations< n - 1, k >::value;
+public:
+   static constexpr unsigned int value = NumCombinations< n - 1, k - 1 >::value + NumCombinations< n - 1, k >::value;
 };
 
-
 namespace SimplexDetails {
 
 // Nummber of combinations (n choose k)
 template< unsigned int n >
 class NumCombinations< n, 0 >
 {
-   static_assert(0 <= n, "invalid argument");
+   static_assert( 0 <= n, "invalid argument" );
 
-   public:
-      static constexpr unsigned int value = 1;
+public:
+   static constexpr unsigned int value = 1;
 };
 
 template< unsigned int n >
 class NumCombinations< n, n >
 {
-   static_assert(0 < n, "invalid argument");
+   static_assert( 0 < n, "invalid argument" );
 
-   public:
-      static constexpr unsigned int value = 1;
+public:
+   static constexpr unsigned int value = 1;
 };
 
 //     Compile-time generation of combinations
-// Combinations are generated in lexicographical order. The following example shows generation of 2-combinations from set {0, 1, 2}:
+// Combinations are generated in lexicographical order. The following example shows generation of 2-combinations from set {0, 1,
+// 2}:
 //   0, 1  <->  CombinationValue<3, 2, 0, 0>::VALUE, CombinationValue<3, 2, 0, 1>::VALUE
 //   0, 2  <->  CombinationValue<3, 2, 1, 0>::VALUE, CombinationValue<3, 2, 1, 1>::VALUE
 //   1, 2  <->  CombinationValue<3, 2, 2, 0>::VALUE, CombinationValue<3, 2, 2, 1>::VALUE
-template< unsigned int n,
-          unsigned int k,
-          unsigned int combinationIndex >
+template< unsigned int n, unsigned int k, unsigned int combinationIndex >
 class CombinationIncrement;
 
-template< unsigned int n,
-          unsigned int k,
-          unsigned int combinationIndex,
-          unsigned int valueIndex >
+template< unsigned int n, unsigned int k, unsigned int combinationIndex, unsigned int valueIndex >
 class CombinationValue
 {
    static_assert( combinationIndex < NumCombinations< n, k >::value, "invalid combination index" );
    static_assert( valueIndex < k, "invalid value index" );
 
-   static constexpr unsigned int incrementValueIndex = CombinationIncrement< n, k, combinationIndex - 1>::valueIndex;
+   static constexpr unsigned int incrementValueIndex = CombinationIncrement< n, k, combinationIndex - 1 >::valueIndex;
 
-   public:
-      static constexpr unsigned int value = ( valueIndex < incrementValueIndex ? CombinationValue< n, k, combinationIndex - 1, valueIndex >::value :
-                                          CombinationValue< n, k, combinationIndex - 1, incrementValueIndex >::value +
-                                          valueIndex - incrementValueIndex + 1);
+public:
+   static constexpr unsigned int value =
+      ( valueIndex < incrementValueIndex ? CombinationValue< n, k, combinationIndex - 1, valueIndex >::value
+                                         : CombinationValue< n, k, combinationIndex - 1, incrementValueIndex >::value
+                                              + valueIndex - incrementValueIndex + 1 );
 };
 
-template< unsigned int n,
-          unsigned int k,
-          unsigned int valueIndex >
+template< unsigned int n, unsigned int k, unsigned int valueIndex >
 class CombinationValue< n, k, 0, valueIndex >
 {
    static_assert( valueIndex < k, "invalid value index" );
 
    static constexpr unsigned int incrementValueIndex = CombinationIncrement< n, k, 0 >::valueIndex;
 
-   public:
-      static constexpr unsigned int value = valueIndex;
+public:
+   static constexpr unsigned int value = valueIndex;
 };
 
-// The CombinationIncrement class determines value index of the particular combination which will be incremented when generating the next combination
-template< unsigned int n,
-          unsigned int k,
-          unsigned int combinationIndex,
-          unsigned int valueIndex_ >
+// The CombinationIncrement class determines value index of the particular combination which will be incremented when generating
+// the next combination
+template< unsigned int n, unsigned int k, unsigned int combinationIndex, unsigned int valueIndex_ >
 class CombinationIncrementImpl
 {
    static_assert( combinationIndex < NumCombinations< n, k >::value - 1, "nothing to increment" );
 
-   static constexpr bool incrementPossible = ( CombinationValue< n, k, combinationIndex, valueIndex_ >::value + k - valueIndex_ < n );
+   static constexpr bool incrementPossible =
+      ( CombinationValue< n, k, combinationIndex, valueIndex_ >::value + k - valueIndex_ < n );
 
-   public:
-      static constexpr int valueIndex = ( incrementPossible ? valueIndex_ : CombinationIncrementImpl< n, k, combinationIndex, valueIndex_ - 1 >::valueIndex );
+public:
+   static constexpr int valueIndex =
+      ( incrementPossible ? valueIndex_ : CombinationIncrementImpl< n, k, combinationIndex, valueIndex_ - 1 >::valueIndex );
 };
 
-template< unsigned int n,
-          unsigned int k,
-          unsigned int combinationIndex >
+template< unsigned int n, unsigned int k, unsigned int combinationIndex >
 class CombinationIncrementImpl< n, k, combinationIndex, 0 >
 {
-   static_assert( combinationIndex < NumCombinations<n, k>::value - 1, "nothing to increment" );
+   static_assert( combinationIndex < NumCombinations< n, k >::value - 1, "nothing to increment" );
 
-   public:
-      static constexpr int valueIndex = 0;
+public:
+   static constexpr int valueIndex = 0;
 };
 
-template< unsigned int n,
-          unsigned int k,
-          unsigned int combinationIndex >
+template< unsigned int n, unsigned int k, unsigned int combinationIndex >
 class CombinationIncrement
 {
    static_assert( combinationIndex < NumCombinations< n, k >::value - 1, "nothing to increment" );
 
-   public:
-      static constexpr unsigned int valueIndex = CombinationIncrementImpl< n, k, combinationIndex, k - 1 >::valueIndex;
+public:
+   static constexpr unsigned int valueIndex = CombinationIncrementImpl< n, k, combinationIndex, k - 1 >::valueIndex;
 };
 
-} // namespace SimplexDetails
+}  // namespace SimplexDetails
 
-} // namespace Topologies
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Topologies
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Topologies/SubentityVertexCount.h b/src/TNL/Meshes/Topologies/SubentityVertexCount.h
index e7a211500a8f100ecf0ab0e74074d5be8f952c29..f5e28360af096aaaa0c234942561333bcf6db831 100644
--- a/src/TNL/Meshes/Topologies/SubentityVertexCount.h
+++ b/src/TNL/Meshes/Topologies/SubentityVertexCount.h
@@ -9,17 +9,15 @@
 #include <TNL/Meshes/Topologies/SubentityVertexMap.h>
 
 namespace TNL {
-namespace Meshes{
+namespace Meshes {
 namespace Topologies {
 
-template< typename EntityTopology,
-          typename SubentityTopology,
-          int SubentityIndex >
+template< typename EntityTopology, typename SubentityTopology, int SubentityIndex >
 struct SubentityVertexCount
 {
    static constexpr int count = Subtopology< SubentityTopology, 0 >::count;
 };
 
-} // namespace Topologies
-} // namespace Meshes
-} // namespace TNL
\ No newline at end of file
+}  // namespace Topologies
+}  // namespace Meshes
+}  // namespace TNL
\ No newline at end of file
diff --git a/src/TNL/Meshes/Topologies/SubentityVertexMap.h b/src/TNL/Meshes/Topologies/SubentityVertexMap.h
index fe5046e75c2c90cdd56494c7e7bf3738508b3df0..6aadca54cf115229b994c4e880a4905e516f084a 100644
--- a/src/TNL/Meshes/Topologies/SubentityVertexMap.h
+++ b/src/TNL/Meshes/Topologies/SubentityVertexMap.h
@@ -13,23 +13,17 @@
 #pragma once
 
 namespace TNL {
-namespace Meshes{
+namespace Meshes {
 namespace Topologies {
 
-template< typename EntityTopology,
-          int SubentityDimension >
+template< typename EntityTopology, int SubentityDimension >
 struct Subtopology
-{
-};
+{};
 
-template< typename EntityTopology,
-          typename SubentityTopology,
-          int SubentityIndex,
-          int SubentityVertexIndex >
+template< typename EntityTopology, typename SubentityTopology, int SubentityIndex, int SubentityVertexIndex >
 struct SubentityVertexMap
-{
-};
+{};
 
-} // namespace Topologies
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Topologies
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Topologies/Tetrahedron.h b/src/TNL/Meshes/Topologies/Tetrahedron.h
index 01224ba6271147c36ab05d7c38c8504d16d8dedd..1bb8ed7122d93def989a5c02908f62277e702a48 100644
--- a/src/TNL/Meshes/Topologies/Tetrahedron.h
+++ b/src/TNL/Meshes/Topologies/Tetrahedron.h
@@ -26,7 +26,7 @@ struct Tetrahedron
 template<>
 struct Subtopology< Tetrahedron, 0 >
 {
-   typedef Vertex Topology;
+   using Topology = Vertex;
 
    static constexpr int count = 4;
 };
@@ -34,7 +34,7 @@ struct Subtopology< Tetrahedron, 0 >
 template<>
 struct Subtopology< Tetrahedron, 1 >
 {
-   typedef Edge Topology;
+   using Topology = Edge;
 
    static constexpr int count = 6;
 };
@@ -42,48 +42,142 @@ struct Subtopology< Tetrahedron, 1 >
 template<>
 struct Subtopology< Tetrahedron, 2 >
 {
-   typedef Triangle Topology;
+   using Topology = Triangle;
 
    static constexpr int count = 4;
 };
 
+template<>
+struct SubentityVertexMap< Tetrahedron, Edge, 0, 0 >
+{
+   static constexpr int index = 1;
+};
+template<>
+struct SubentityVertexMap< Tetrahedron, Edge, 0, 1 >
+{
+   static constexpr int index = 2;
+};
 
-template<> struct SubentityVertexMap< Tetrahedron, Edge, 0, 0> { static constexpr int index = 1; };
-template<> struct SubentityVertexMap< Tetrahedron, Edge, 0, 1> { static constexpr int index = 2; };
-
-template<> struct SubentityVertexMap< Tetrahedron, Edge, 1, 0> { static constexpr int index = 2; };
-template<> struct SubentityVertexMap< Tetrahedron, Edge, 1, 1> { static constexpr int index = 0; };
-
-template<> struct SubentityVertexMap< Tetrahedron, Edge, 2, 0> { static constexpr int index = 0; };
-template<> struct SubentityVertexMap< Tetrahedron, Edge, 2, 1> { static constexpr int index = 1; };
+template<>
+struct SubentityVertexMap< Tetrahedron, Edge, 1, 0 >
+{
+   static constexpr int index = 2;
+};
+template<>
+struct SubentityVertexMap< Tetrahedron, Edge, 1, 1 >
+{
+   static constexpr int index = 0;
+};
 
-template<> struct SubentityVertexMap< Tetrahedron, Edge, 3, 0> { static constexpr int index = 0; };
-template<> struct SubentityVertexMap< Tetrahedron, Edge, 3, 1> { static constexpr int index = 3; };
+template<>
+struct SubentityVertexMap< Tetrahedron, Edge, 2, 0 >
+{
+   static constexpr int index = 0;
+};
+template<>
+struct SubentityVertexMap< Tetrahedron, Edge, 2, 1 >
+{
+   static constexpr int index = 1;
+};
 
-template<> struct SubentityVertexMap< Tetrahedron, Edge, 4, 0> { static constexpr int index = 1; };
-template<> struct SubentityVertexMap< Tetrahedron, Edge, 4, 1> { static constexpr int index = 3; };
+template<>
+struct SubentityVertexMap< Tetrahedron, Edge, 3, 0 >
+{
+   static constexpr int index = 0;
+};
+template<>
+struct SubentityVertexMap< Tetrahedron, Edge, 3, 1 >
+{
+   static constexpr int index = 3;
+};
 
-template<> struct SubentityVertexMap< Tetrahedron, Edge, 5, 0> { static constexpr int index = 2; };
-template<> struct SubentityVertexMap< Tetrahedron, Edge, 5, 1> { static constexpr int index = 3; };
+template<>
+struct SubentityVertexMap< Tetrahedron, Edge, 4, 0 >
+{
+   static constexpr int index = 1;
+};
+template<>
+struct SubentityVertexMap< Tetrahedron, Edge, 4, 1 >
+{
+   static constexpr int index = 3;
+};
 
+template<>
+struct SubentityVertexMap< Tetrahedron, Edge, 5, 0 >
+{
+   static constexpr int index = 2;
+};
+template<>
+struct SubentityVertexMap< Tetrahedron, Edge, 5, 1 >
+{
+   static constexpr int index = 3;
+};
 
 // i-th subvertex is the opposite vertex of i-th subface
-template<> struct SubentityVertexMap< Tetrahedron, Triangle, 0, 0> { static constexpr int index = 1; };
-template<> struct SubentityVertexMap< Tetrahedron, Triangle, 0, 1> { static constexpr int index = 2; };
-template<> struct SubentityVertexMap< Tetrahedron, Triangle, 0, 2> { static constexpr int index = 3; };
+template<>
+struct SubentityVertexMap< Tetrahedron, Triangle, 0, 0 >
+{
+   static constexpr int index = 1;
+};
+template<>
+struct SubentityVertexMap< Tetrahedron, Triangle, 0, 1 >
+{
+   static constexpr int index = 2;
+};
+template<>
+struct SubentityVertexMap< Tetrahedron, Triangle, 0, 2 >
+{
+   static constexpr int index = 3;
+};
 
-template<> struct SubentityVertexMap< Tetrahedron, Triangle, 1, 0> { static constexpr int index = 2; };
-template<> struct SubentityVertexMap< Tetrahedron, Triangle, 1, 1> { static constexpr int index = 0; };
-template<> struct SubentityVertexMap< Tetrahedron, Triangle, 1, 2> { static constexpr int index = 3; };
+template<>
+struct SubentityVertexMap< Tetrahedron, Triangle, 1, 0 >
+{
+   static constexpr int index = 2;
+};
+template<>
+struct SubentityVertexMap< Tetrahedron, Triangle, 1, 1 >
+{
+   static constexpr int index = 0;
+};
+template<>
+struct SubentityVertexMap< Tetrahedron, Triangle, 1, 2 >
+{
+   static constexpr int index = 3;
+};
 
-template<> struct SubentityVertexMap< Tetrahedron, Triangle, 2, 0> { static constexpr int index = 0; };
-template<> struct SubentityVertexMap< Tetrahedron, Triangle, 2, 1> { static constexpr int index = 1; };
-template<> struct SubentityVertexMap< Tetrahedron, Triangle, 2, 2> { static constexpr int index = 3; };
+template<>
+struct SubentityVertexMap< Tetrahedron, Triangle, 2, 0 >
+{
+   static constexpr int index = 0;
+};
+template<>
+struct SubentityVertexMap< Tetrahedron, Triangle, 2, 1 >
+{
+   static constexpr int index = 1;
+};
+template<>
+struct SubentityVertexMap< Tetrahedron, Triangle, 2, 2 >
+{
+   static constexpr int index = 3;
+};
 
-template<> struct SubentityVertexMap< Tetrahedron, Triangle, 3, 0> { static constexpr int index = 0; };
-template<> struct SubentityVertexMap< Tetrahedron, Triangle, 3, 1> { static constexpr int index = 1; };
-template<> struct SubentityVertexMap< Tetrahedron, Triangle, 3, 2> { static constexpr int index = 2; };
+template<>
+struct SubentityVertexMap< Tetrahedron, Triangle, 3, 0 >
+{
+   static constexpr int index = 0;
+};
+template<>
+struct SubentityVertexMap< Tetrahedron, Triangle, 3, 1 >
+{
+   static constexpr int index = 1;
+};
+template<>
+struct SubentityVertexMap< Tetrahedron, Triangle, 3, 2 >
+{
+   static constexpr int index = 2;
+};
 
-} // namespace Topologies
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Topologies
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Topologies/Triangle.h b/src/TNL/Meshes/Topologies/Triangle.h
index 9d392a852b17580fd63c872bbbf0b63f84233053..3948d98137b7a89f088bd9dab0a8199c1d441a32 100644
--- a/src/TNL/Meshes/Topologies/Triangle.h
+++ b/src/TNL/Meshes/Topologies/Triangle.h
@@ -23,11 +23,10 @@ struct Triangle
    static constexpr int dimension = 2;
 };
 
-
 template<>
 struct Subtopology< Triangle, 0 >
 {
-   typedef Vertex Topology;
+   using Topology = Vertex;
 
    static constexpr int count = 3;
 };
@@ -35,21 +34,44 @@ struct Subtopology< Triangle, 0 >
 template<>
 struct Subtopology< Triangle, 1 >
 {
-   typedef Edge Topology;
+   using Topology = Edge;
 
    static constexpr int count = 3;
 };
 
+template<>
+struct SubentityVertexMap< Triangle, Edge, 0, 0 >
+{
+   static constexpr int index = 1;
+};
+template<>
+struct SubentityVertexMap< Triangle, Edge, 0, 1 >
+{
+   static constexpr int index = 2;
+};
 
-template<> struct SubentityVertexMap< Triangle, Edge, 0, 0> { static constexpr int index = 1; };
-template<> struct SubentityVertexMap< Triangle, Edge, 0, 1> { static constexpr int index = 2; };
-
-template<> struct SubentityVertexMap< Triangle, Edge, 1, 0> { static constexpr int index = 2; };
-template<> struct SubentityVertexMap< Triangle, Edge, 1, 1> { static constexpr int index = 0; };
+template<>
+struct SubentityVertexMap< Triangle, Edge, 1, 0 >
+{
+   static constexpr int index = 2;
+};
+template<>
+struct SubentityVertexMap< Triangle, Edge, 1, 1 >
+{
+   static constexpr int index = 0;
+};
 
-template<> struct SubentityVertexMap< Triangle, Edge, 2, 0> { static constexpr int index = 0; };
-template<> struct SubentityVertexMap< Triangle, Edge, 2, 1> { static constexpr int index = 1; };
+template<>
+struct SubentityVertexMap< Triangle, Edge, 2, 0 >
+{
+   static constexpr int index = 0;
+};
+template<>
+struct SubentityVertexMap< Triangle, Edge, 2, 1 >
+{
+   static constexpr int index = 1;
+};
 
-} // namespace Topologies
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Topologies
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Topologies/Vertex.h b/src/TNL/Meshes/Topologies/Vertex.h
index 0340fffd21e75c1060d2586234336053f72df320..bb75eb50d0806d98df7ff0e87e70b9b08df6ca85 100644
--- a/src/TNL/Meshes/Topologies/Vertex.h
+++ b/src/TNL/Meshes/Topologies/Vertex.h
@@ -21,6 +21,6 @@ struct Vertex
    static constexpr int dimension = 0;
 };
 
-} // namespace Topologies
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Topologies
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Topologies/Wedge.h b/src/TNL/Meshes/Topologies/Wedge.h
index d8513b587be1c3af5845ecf15d16e3e03d44e09f..2e3006308bf26483786edeb448498c63642a4f0f 100644
--- a/src/TNL/Meshes/Topologies/Wedge.h
+++ b/src/TNL/Meshes/Topologies/Wedge.h
@@ -18,7 +18,6 @@ struct Wedge
    static constexpr int dimension = 3;
 };
 
-
 template<>
 struct Subtopology< Wedge, 0 >
 {
@@ -43,87 +42,230 @@ struct Subtopology< Wedge, 2 >
    static constexpr int count = 5;
 };
 
-template<> struct SubentityVertexMap< Wedge, Edge, 0, 0> { static constexpr int index = 0; };
-template<> struct SubentityVertexMap< Wedge, Edge, 0, 1> { static constexpr int index = 1; };
-
-template<> struct SubentityVertexMap< Wedge, Edge, 1, 0> { static constexpr int index = 1; };
-template<> struct SubentityVertexMap< Wedge, Edge, 1, 1> { static constexpr int index = 2; };
+template<>
+struct SubentityVertexMap< Wedge, Edge, 0, 0 >
+{
+   static constexpr int index = 0;
+};
+template<>
+struct SubentityVertexMap< Wedge, Edge, 0, 1 >
+{
+   static constexpr int index = 1;
+};
 
-template<> struct SubentityVertexMap< Wedge, Edge, 2, 0> { static constexpr int index = 2; };
-template<> struct SubentityVertexMap< Wedge, Edge, 2, 1> { static constexpr int index = 0; };
+template<>
+struct SubentityVertexMap< Wedge, Edge, 1, 0 >
+{
+   static constexpr int index = 1;
+};
+template<>
+struct SubentityVertexMap< Wedge, Edge, 1, 1 >
+{
+   static constexpr int index = 2;
+};
 
-template<> struct SubentityVertexMap< Wedge, Edge, 3, 0> { static constexpr int index = 3; };
-template<> struct SubentityVertexMap< Wedge, Edge, 3, 1> { static constexpr int index = 4; };
+template<>
+struct SubentityVertexMap< Wedge, Edge, 2, 0 >
+{
+   static constexpr int index = 2;
+};
+template<>
+struct SubentityVertexMap< Wedge, Edge, 2, 1 >
+{
+   static constexpr int index = 0;
+};
 
-template<> struct SubentityVertexMap< Wedge, Edge, 4, 0> { static constexpr int index = 4; };
-template<> struct SubentityVertexMap< Wedge, Edge, 4, 1> { static constexpr int index = 5; };
+template<>
+struct SubentityVertexMap< Wedge, Edge, 3, 0 >
+{
+   static constexpr int index = 3;
+};
+template<>
+struct SubentityVertexMap< Wedge, Edge, 3, 1 >
+{
+   static constexpr int index = 4;
+};
 
-template<> struct SubentityVertexMap< Wedge, Edge, 5, 0> { static constexpr int index = 5; };
-template<> struct SubentityVertexMap< Wedge, Edge, 5, 1> { static constexpr int index = 3; };
+template<>
+struct SubentityVertexMap< Wedge, Edge, 4, 0 >
+{
+   static constexpr int index = 4;
+};
+template<>
+struct SubentityVertexMap< Wedge, Edge, 4, 1 >
+{
+   static constexpr int index = 5;
+};
 
-template<> struct SubentityVertexMap< Wedge, Edge, 6, 0> { static constexpr int index = 3; };
-template<> struct SubentityVertexMap< Wedge, Edge, 6, 1> { static constexpr int index = 0; };
+template<>
+struct SubentityVertexMap< Wedge, Edge, 5, 0 >
+{
+   static constexpr int index = 5;
+};
+template<>
+struct SubentityVertexMap< Wedge, Edge, 5, 1 >
+{
+   static constexpr int index = 3;
+};
 
-template<> struct SubentityVertexMap< Wedge, Edge, 7, 0> { static constexpr int index = 5; };
-template<> struct SubentityVertexMap< Wedge, Edge, 7, 1> { static constexpr int index = 2; };
+template<>
+struct SubentityVertexMap< Wedge, Edge, 6, 0 >
+{
+   static constexpr int index = 3;
+};
+template<>
+struct SubentityVertexMap< Wedge, Edge, 6, 1 >
+{
+   static constexpr int index = 0;
+};
 
-template<> struct SubentityVertexMap< Wedge, Edge, 8, 0> { static constexpr int index = 4; };
-template<> struct SubentityVertexMap< Wedge, Edge, 8, 1> { static constexpr int index = 1; };
+template<>
+struct SubentityVertexMap< Wedge, Edge, 7, 0 >
+{
+   static constexpr int index = 5;
+};
+template<>
+struct SubentityVertexMap< Wedge, Edge, 7, 1 >
+{
+   static constexpr int index = 2;
+};
 
+template<>
+struct SubentityVertexMap< Wedge, Edge, 8, 0 >
+{
+   static constexpr int index = 4;
+};
+template<>
+struct SubentityVertexMap< Wedge, Edge, 8, 1 >
+{
+   static constexpr int index = 1;
+};
 
-template <>
+template<>
 struct SubentityVertexCount< Wedge, Polygon, 0 >
 {
    static constexpr int count = 3;
 };
 
-template<> struct SubentityVertexMap< Wedge, Polygon, 0, 0> { static constexpr int index = 0; };
-template<> struct SubentityVertexMap< Wedge, Polygon, 0, 1> { static constexpr int index = 1; };
-template<> struct SubentityVertexMap< Wedge, Polygon, 0, 2> { static constexpr int index = 2; };
+template<>
+struct SubentityVertexMap< Wedge, Polygon, 0, 0 >
+{
+   static constexpr int index = 0;
+};
+template<>
+struct SubentityVertexMap< Wedge, Polygon, 0, 1 >
+{
+   static constexpr int index = 1;
+};
+template<>
+struct SubentityVertexMap< Wedge, Polygon, 0, 2 >
+{
+   static constexpr int index = 2;
+};
 
-template <>
+template<>
 struct SubentityVertexCount< Wedge, Polygon, 1 >
 {
    static constexpr int count = 3;
 };
 
-template<> struct SubentityVertexMap< Wedge, Polygon, 1, 0> { static constexpr int index = 3; };
-template<> struct SubentityVertexMap< Wedge, Polygon, 1, 1> { static constexpr int index = 4; };
-template<> struct SubentityVertexMap< Wedge, Polygon, 1, 2> { static constexpr int index = 5; };
+template<>
+struct SubentityVertexMap< Wedge, Polygon, 1, 0 >
+{
+   static constexpr int index = 3;
+};
+template<>
+struct SubentityVertexMap< Wedge, Polygon, 1, 1 >
+{
+   static constexpr int index = 4;
+};
+template<>
+struct SubentityVertexMap< Wedge, Polygon, 1, 2 >
+{
+   static constexpr int index = 5;
+};
 
-template <>
+template<>
 struct SubentityVertexCount< Wedge, Polygon, 2 >
 {
    static constexpr int count = 4;
 };
 
-template<> struct SubentityVertexMap< Wedge, Polygon, 2, 0> { static constexpr int index = 3; };
-template<> struct SubentityVertexMap< Wedge, Polygon, 2, 1> { static constexpr int index = 0; };
-template<> struct SubentityVertexMap< Wedge, Polygon, 2, 2> { static constexpr int index = 2; };
-template<> struct SubentityVertexMap< Wedge, Polygon, 2, 3> { static constexpr int index = 5; };
+template<>
+struct SubentityVertexMap< Wedge, Polygon, 2, 0 >
+{
+   static constexpr int index = 3;
+};
+template<>
+struct SubentityVertexMap< Wedge, Polygon, 2, 1 >
+{
+   static constexpr int index = 0;
+};
+template<>
+struct SubentityVertexMap< Wedge, Polygon, 2, 2 >
+{
+   static constexpr int index = 2;
+};
+template<>
+struct SubentityVertexMap< Wedge, Polygon, 2, 3 >
+{
+   static constexpr int index = 5;
+};
 
-template <>
+template<>
 struct SubentityVertexCount< Wedge, Polygon, 3 >
 {
    static constexpr int count = 4;
 };
 
-template<> struct SubentityVertexMap< Wedge, Polygon, 3, 0> { static constexpr int index = 4; };
-template<> struct SubentityVertexMap< Wedge, Polygon, 3, 1> { static constexpr int index = 1; };
-template<> struct SubentityVertexMap< Wedge, Polygon, 3, 2> { static constexpr int index = 2; };
-template<> struct SubentityVertexMap< Wedge, Polygon, 3, 3> { static constexpr int index = 5; };
+template<>
+struct SubentityVertexMap< Wedge, Polygon, 3, 0 >
+{
+   static constexpr int index = 4;
+};
+template<>
+struct SubentityVertexMap< Wedge, Polygon, 3, 1 >
+{
+   static constexpr int index = 1;
+};
+template<>
+struct SubentityVertexMap< Wedge, Polygon, 3, 2 >
+{
+   static constexpr int index = 2;
+};
+template<>
+struct SubentityVertexMap< Wedge, Polygon, 3, 3 >
+{
+   static constexpr int index = 5;
+};
 
-template <>
+template<>
 struct SubentityVertexCount< Wedge, Polygon, 4 >
 {
    static constexpr int count = 4;
 };
 
-template<> struct SubentityVertexMap< Wedge, Polygon, 4, 0> { static constexpr int index = 3; };
-template<> struct SubentityVertexMap< Wedge, Polygon, 4, 1> { static constexpr int index = 0; };
-template<> struct SubentityVertexMap< Wedge, Polygon, 4, 2> { static constexpr int index = 1; };
-template<> struct SubentityVertexMap< Wedge, Polygon, 4, 3> { static constexpr int index = 4; };
+template<>
+struct SubentityVertexMap< Wedge, Polygon, 4, 0 >
+{
+   static constexpr int index = 3;
+};
+template<>
+struct SubentityVertexMap< Wedge, Polygon, 4, 1 >
+{
+   static constexpr int index = 0;
+};
+template<>
+struct SubentityVertexMap< Wedge, Polygon, 4, 2 >
+{
+   static constexpr int index = 1;
+};
+template<>
+struct SubentityVertexMap< Wedge, Polygon, 4, 3 >
+{
+   static constexpr int index = 4;
+};
 
-} // namespace Topologies
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Topologies
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Traits.h b/src/TNL/Meshes/Traits.h
index 50add6df6cf4d9f145482dfebd4f487b8638227d..6974b848ce90dfb58208f4cc1d6738830c3de98f 100644
--- a/src/TNL/Meshes/Traits.h
+++ b/src/TNL/Meshes/Traits.h
@@ -15,30 +15,20 @@ namespace TNL {
 namespace Meshes {
 
 template< typename T >
-class isGrid
-: public std::false_type
+class isGrid : public std::false_type
 {};
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index >
-class isGrid< Grid< Dimension, Real, Device, Index > >
-: public std::true_type
+template< int Dimension, typename Real, typename Device, typename Index >
+class isGrid< Grid< Dimension, Real, Device, Index > > : public std::true_type
 {};
 
 template< typename T >
-class isDistributedGrid
-: public std::false_type
+class isDistributedGrid : public std::false_type
 {};
 
-template< int Dimension,
-          typename Real,
-          typename Device,
-          typename Index >
-class isDistributedGrid< DistributedMeshes::DistributedMesh< Grid< Dimension, Real, Device, Index > > >
-: public std::true_type
+template< int Dimension, typename Real, typename Device, typename Index >
+class isDistributedGrid< DistributedMeshes::DistributedMesh< Grid< Dimension, Real, Device, Index > > > : public std::true_type
 {};
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Traverser.h b/src/TNL/Meshes/Traverser.h
index f3dab89a449762b372062ea418ee84968a969a30..f1aa1887c3dbe7199a7e728f052f8329dc9872cd 100644
--- a/src/TNL/Meshes/Traverser.h
+++ b/src/TNL/Meshes/Traverser.h
@@ -24,34 +24,29 @@ public:
    using DeviceType = typename MeshType::DeviceType;
    using GlobalIndexType = typename MeshType::GlobalIndexType;
 
-   template< typename EntitiesProcessor,
-             typename UserData >
-   void processBoundaryEntities( const MeshPointer& meshPointer,
-                                 UserData userData ) const;
-
-   template< typename EntitiesProcessor,
-             typename UserData >
-   void processInteriorEntities( const MeshPointer& meshPointer,
-                                 UserData userData ) const;
-
-   template< typename EntitiesProcessor,
-             typename UserData >
-   void processAllEntities( const MeshPointer& meshPointer,
-                            UserData userData ) const;
-
-   template< typename EntitiesProcessor,
-             typename UserData >
-   void processGhostEntities( const MeshPointer& meshPointer,
-                              UserData userData ) const;
-
-   template< typename EntitiesProcessor,
-             typename UserData >
-   void processLocalEntities( const MeshPointer& meshPointer,
-                              UserData userData ) const;
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processBoundaryEntities( const MeshPointer& meshPointer, UserData userData ) const;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processInteriorEntities( const MeshPointer& meshPointer, UserData userData ) const;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processAllEntities( const MeshPointer& meshPointer, UserData userData ) const;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processGhostEntities( const MeshPointer& meshPointer, UserData userData ) const;
+
+   template< typename EntitiesProcessor, typename UserData >
+   void
+   processLocalEntities( const MeshPointer& meshPointer, UserData userData ) const;
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/Traverser.hpp>
 #include <TNL/Meshes/GridDetails/Traverser_Grid1D.h>
diff --git a/src/TNL/Meshes/Traverser.hpp b/src/TNL/Meshes/Traverser.hpp
index dc3f14e6861fdd483be97413e1e4d01e5a1a4046..2d4c503d81d2b1f5bb1463d12f1045d24ac80611 100644
--- a/src/TNL/Meshes/Traverser.hpp
+++ b/src/TNL/Meshes/Traverser.hpp
@@ -12,22 +12,15 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename Mesh,
-          typename MeshEntity,
-          int EntitiesDimension >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Mesh, typename MeshEntity, int EntitiesDimension >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Mesh, MeshEntity, EntitiesDimension >::
-processBoundaryEntities( const MeshPointer& meshPointer,
-                         UserData userData ) const
+Traverser< Mesh, MeshEntity, EntitiesDimension >::processBoundaryEntities( const MeshPointer& meshPointer,
+                                                                           UserData userData ) const
 {
    const auto boundaryIndices = meshPointer->template getBoundaryIndices< MeshEntity::getEntityDimension() >();
    const GlobalIndexType entitiesCount = boundaryIndices.getSize();
-   auto kernel = [boundaryIndices] __cuda_callable__
-      ( const GlobalIndexType i,
-        const Mesh* mesh,
-        UserData userData )
+   auto kernel = [ boundaryIndices ] __cuda_callable__( const GlobalIndexType i, const Mesh* mesh, UserData userData )
    {
       const GlobalIndexType entityIndex = boundaryIndices[ i ];
       const auto entity = mesh->template getEntity< MeshEntity::getEntityDimension() >( entityIndex );
@@ -35,28 +28,18 @@ processBoundaryEntities( const MeshPointer& meshPointer,
    };
    Pointers::synchronizeSmartPointersOnDevice< DeviceType >();
    Algorithms::ParallelFor< DeviceType >::exec(
-         (GlobalIndexType) 0, entitiesCount,
-         kernel,
-         &meshPointer.template getData< DeviceType >(),
-         userData );
+      (GlobalIndexType) 0, entitiesCount, kernel, &meshPointer.template getData< DeviceType >(), userData );
 }
 
-template< typename Mesh,
-          typename MeshEntity,
-          int EntitiesDimension >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Mesh, typename MeshEntity, int EntitiesDimension >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Mesh, MeshEntity, EntitiesDimension >::
-processInteriorEntities( const MeshPointer& meshPointer,
-                         UserData userData ) const
+Traverser< Mesh, MeshEntity, EntitiesDimension >::processInteriorEntities( const MeshPointer& meshPointer,
+                                                                           UserData userData ) const
 {
    const auto interiorIndices = meshPointer->template getInteriorIndices< MeshEntity::getEntityDimension() >();
    const GlobalIndexType entitiesCount = interiorIndices.getSize();
-   auto kernel = [interiorIndices] __cuda_callable__
-      ( const GlobalIndexType i,
-        const Mesh* mesh,
-        UserData userData )
+   auto kernel = [ interiorIndices ] __cuda_callable__( const GlobalIndexType i, const Mesh* mesh, UserData userData )
    {
       const GlobalIndexType entityIndex = interiorIndices[ i ];
       const auto entity = mesh->template getEntity< MeshEntity::getEntityDimension() >( entityIndex );
@@ -64,93 +47,59 @@ processInteriorEntities( const MeshPointer& meshPointer,
    };
    Pointers::synchronizeSmartPointersOnDevice< DeviceType >();
    Algorithms::ParallelFor< DeviceType >::exec(
-         (GlobalIndexType) 0, entitiesCount,
-         kernel,
-         &meshPointer.template getData< DeviceType >(),
-         userData );
+      (GlobalIndexType) 0, entitiesCount, kernel, &meshPointer.template getData< DeviceType >(), userData );
 }
 
-template< typename Mesh,
-          typename MeshEntity,
-          int EntitiesDimension >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Mesh, typename MeshEntity, int EntitiesDimension >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Mesh, MeshEntity, EntitiesDimension >::
-processAllEntities( const MeshPointer& meshPointer,
-                    UserData userData ) const
+Traverser< Mesh, MeshEntity, EntitiesDimension >::processAllEntities( const MeshPointer& meshPointer, UserData userData ) const
 {
    const GlobalIndexType entitiesCount = meshPointer->template getEntitiesCount< MeshEntity::getEntityDimension() >();
-   auto kernel = [] __cuda_callable__
-      ( const GlobalIndexType entityIndex,
-        const Mesh* mesh,
-        UserData userData )
+   auto kernel = [] __cuda_callable__( const GlobalIndexType entityIndex, const Mesh* mesh, UserData userData )
    {
       const auto entity = mesh->template getEntity< MeshEntity::getEntityDimension() >( entityIndex );
       EntitiesProcessor::processEntity( *mesh, userData, entity );
    };
    Pointers::synchronizeSmartPointersOnDevice< DeviceType >();
    Algorithms::ParallelFor< DeviceType >::exec(
-         (GlobalIndexType) 0, entitiesCount,
-         kernel,
-         &meshPointer.template getData< DeviceType >(),
-         userData );
+      (GlobalIndexType) 0, entitiesCount, kernel, &meshPointer.template getData< DeviceType >(), userData );
 }
 
-template< typename Mesh,
-          typename MeshEntity,
-          int EntitiesDimension >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Mesh, typename MeshEntity, int EntitiesDimension >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Mesh, MeshEntity, EntitiesDimension >::
-processGhostEntities( const MeshPointer& meshPointer,
-                       UserData userData ) const
+Traverser< Mesh, MeshEntity, EntitiesDimension >::processGhostEntities( const MeshPointer& meshPointer,
+                                                                        UserData userData ) const
 {
    const GlobalIndexType ghostsOffset = meshPointer->template getGhostEntitiesOffset< MeshEntity::getEntityDimension() >();
    const GlobalIndexType entitiesCount = meshPointer->template getEntitiesCount< MeshEntity::getEntityDimension() >();
-   auto kernel = [] __cuda_callable__
-      ( const GlobalIndexType entityIndex,
-        const Mesh* mesh,
-        UserData userData )
+   auto kernel = [] __cuda_callable__( const GlobalIndexType entityIndex, const Mesh* mesh, UserData userData )
    {
       const auto entity = mesh->template getEntity< MeshEntity::getEntityDimension() >( entityIndex );
       EntitiesProcessor::processEntity( *mesh, userData, entity );
    };
    Pointers::synchronizeSmartPointersOnDevice< DeviceType >();
    Algorithms::ParallelFor< DeviceType >::exec(
-         ghostsOffset, entitiesCount,
-         kernel,
-         &meshPointer.template getData< DeviceType >(),
-         userData );
+      ghostsOffset, entitiesCount, kernel, &meshPointer.template getData< DeviceType >(), userData );
 }
 
-template< typename Mesh,
-          typename MeshEntity,
-          int EntitiesDimension >
-   template< typename EntitiesProcessor,
-             typename UserData >
+template< typename Mesh, typename MeshEntity, int EntitiesDimension >
+template< typename EntitiesProcessor, typename UserData >
 void
-Traverser< Mesh, MeshEntity, EntitiesDimension >::
-processLocalEntities( const MeshPointer& meshPointer,
-                      UserData userData ) const
+Traverser< Mesh, MeshEntity, EntitiesDimension >::processLocalEntities( const MeshPointer& meshPointer,
+                                                                        UserData userData ) const
 {
    const GlobalIndexType ghostsOffset = meshPointer->template getGhostEntitiesOffset< MeshEntity::getEntityDimension() >();
-   auto kernel = [] __cuda_callable__
-      ( const GlobalIndexType entityIndex,
-        const Mesh* mesh,
-        UserData userData )
+   auto kernel = [] __cuda_callable__( const GlobalIndexType entityIndex, const Mesh* mesh, UserData userData )
    {
       const auto entity = mesh->template getEntity< MeshEntity::getEntityDimension() >( entityIndex );
       EntitiesProcessor::processEntity( *mesh, userData, entity );
    };
    Pointers::synchronizeSmartPointersOnDevice< DeviceType >();
    Algorithms::ParallelFor< DeviceType >::exec(
-         (GlobalIndexType) 0, ghostsOffset,
-         kernel,
-         &meshPointer.template getData< DeviceType >(),
-         userData );
+      (GlobalIndexType) 0, ghostsOffset, kernel, &meshPointer.template getData< DeviceType >(), userData );
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/TypeResolver/BuildConfigTags.h b/src/TNL/Meshes/TypeResolver/BuildConfigTags.h
index 4ee614a1de51b65fecb4e8e49ba101debfcec0b4..7c20b53ef255cffa102238caeff95640a2feda25 100644
--- a/src/TNL/Meshes/TypeResolver/BuildConfigTags.h
+++ b/src/TNL/Meshes/TypeResolver/BuildConfigTags.h
@@ -31,80 +31,179 @@ namespace BuildConfigTags {
 // Configuration for structured grids
 
 // 1, 2, and 3 dimensions are enabled by default
-template< typename ConfigTag, int Dimension > struct GridDimensionTag { static constexpr bool enabled = Dimension > 0 && Dimension <= 3; };
+template< typename ConfigTag, int Dimension >
+struct GridDimensionTag
+{
+   static constexpr bool enabled = Dimension > 0 && Dimension <= 3;
+};
 
 // Grids are enabled only for the `float` and `double` real types by default.
-template< typename ConfigTag, typename Real > struct GridRealTag { static constexpr bool enabled = false; };
-template< typename ConfigTag > struct GridRealTag< ConfigTag, float > { static constexpr bool enabled = true; };
-template< typename ConfigTag > struct GridRealTag< ConfigTag, double > { static constexpr bool enabled = true; };
+template< typename ConfigTag, typename Real >
+struct GridRealTag
+{
+   static constexpr bool enabled = false;
+};
+template< typename ConfigTag >
+struct GridRealTag< ConfigTag, float >
+{
+   static constexpr bool enabled = true;
+};
+template< typename ConfigTag >
+struct GridRealTag< ConfigTag, double >
+{
+   static constexpr bool enabled = true;
+};
 
 // Grids are enabled on all available devices by default.
-template< typename ConfigTag, typename Device > struct GridDeviceTag { static constexpr bool enabled = true; };
+template< typename ConfigTag, typename Device >
+struct GridDeviceTag
+{
+   static constexpr bool enabled = true;
+};
 #ifndef HAVE_CUDA
-template< typename ConfigTag > struct GridDeviceTag< ConfigTag, Devices::Cuda > { static constexpr bool enabled = false; };
+template< typename ConfigTag >
+struct GridDeviceTag< ConfigTag, Devices::Cuda >
+{
+   static constexpr bool enabled = false;
+};
 #endif
 
 // Grids are enabled only for the `int` and `long int` index types by default.
-template< typename ConfigTag, typename Index > struct GridIndexTag { static constexpr bool enabled = false; };
-template< typename ConfigTag > struct GridIndexTag< ConfigTag, int > { static constexpr bool enabled = true; };
-template< typename ConfigTag > struct GridIndexTag< ConfigTag, long int > { static constexpr bool enabled = true; };
+template< typename ConfigTag, typename Index >
+struct GridIndexTag
+{
+   static constexpr bool enabled = false;
+};
+template< typename ConfigTag >
+struct GridIndexTag< ConfigTag, int >
+{
+   static constexpr bool enabled = true;
+};
+template< typename ConfigTag >
+struct GridIndexTag< ConfigTag, long int >
+{
+   static constexpr bool enabled = true;
+};
 
 // The Grid is enabled for allowed dimensions and Real, Device and Index types.
 //
 // By specializing this tag you can enable or disable custom combinations of
 // the grid template parameters. The default configuration is identical to the
 // individual per-type tags.
-template< typename ConfigTag, typename MeshType > struct GridTag { static constexpr bool enabled = false; };
+template< typename ConfigTag, typename MeshType >
+struct GridTag
+{
+   static constexpr bool enabled = false;
+};
 
 template< typename ConfigTag, int Dimension, typename Real, typename Device, typename Index >
 struct GridTag< ConfigTag, Grid< Dimension, Real, Device, Index > >
 {
-   static constexpr bool enabled = GridDimensionTag< ConfigTag, Dimension >::enabled  &&
-                    GridRealTag< ConfigTag, Real >::enabled &&
-                    GridDeviceTag< ConfigTag, Device >::enabled &&
-                    GridIndexTag< ConfigTag, Index >::enabled;
+   static constexpr bool enabled = GridDimensionTag< ConfigTag, Dimension >::enabled && GridRealTag< ConfigTag, Real >::enabled
+                                && GridDeviceTag< ConfigTag, Device >::enabled && GridIndexTag< ConfigTag, Index >::enabled;
 };
 
-
 // Configuration for unstructured meshes
 
 // Meshes are enabled on all available devices by default.
-template< typename ConfigTag, typename Device > struct MeshDeviceTag { static constexpr bool enabled = false; };
-template< typename ConfigTag > struct MeshDeviceTag< ConfigTag, Devices::Host > { static constexpr bool enabled = true; };
+template< typename ConfigTag, typename Device >
+struct MeshDeviceTag
+{
+   static constexpr bool enabled = false;
+};
+template< typename ConfigTag >
+struct MeshDeviceTag< ConfigTag, Devices::Host >
+{
+   static constexpr bool enabled = true;
+};
 #ifdef HAVE_CUDA
-template< typename ConfigTag > struct MeshDeviceTag< ConfigTag, Devices::Cuda > { static constexpr bool enabled = true; };
+template< typename ConfigTag >
+struct MeshDeviceTag< ConfigTag, Devices::Cuda >
+{
+   static constexpr bool enabled = true;
+};
 #endif
 
 // All available cell topologies are disabled by default.
-template< typename ConfigTag, typename CellTopology > struct MeshCellTopologyTag { static constexpr bool enabled = false; };
-//template< typename ConfigTag > struct MeshCellTopologyTag< ConfigTag, Topologies::Edge > { static constexpr bool enabled = true; };
-//template< typename ConfigTag > struct MeshCellTopologyTag< ConfigTag, Topologies::Triangle > { static constexpr bool enabled = true; };
-//template< typename ConfigTag > struct MeshCellTopologyTag< ConfigTag, Topologies::Quadrangle > { static constexpr bool enabled = true; };
-//template< typename ConfigTag > struct MeshCellTopologyTag< ConfigTag, Topologies::Tetrahedron > { static constexpr bool enabled = true; };
-//template< typename ConfigTag > struct MeshCellTopologyTag< ConfigTag, Topologies::Hexahedron > { static constexpr bool enabled = true; };
-//template< typename ConfigTag > struct MeshCellTopologyTag< ConfigTag, Topologies::Polygon > { static constexpr bool enabled = true; };
-//template< typename ConfigTag > struct MeshCellTopologyTag< ConfigTag, Topologies::Wedge > { static constexpr bool enabled = true; };
-//template< typename ConfigTag > struct MeshCellTopologyTag< ConfigTag, Topologies::Pyramid > { static constexpr bool enabled = true; };
-//template< typename ConfigTag > struct MeshCellTopologyTag< ConfigTag, Topologies::Polyhedron > { static constexpr bool enabled = true; };
+template< typename ConfigTag, typename CellTopology >
+struct MeshCellTopologyTag
+{
+   static constexpr bool enabled = false;
+};
+// template< typename ConfigTag >
+// struct MeshCellTopologyTag< ConfigTag, Topologies::Edge > { static constexpr bool enabled = true; };
+// template< typename ConfigTag >
+// struct MeshCellTopologyTag< ConfigTag, Topologies::Triangle > { static constexpr bool enabled = true; };
+// template< typename ConfigTag >
+// struct MeshCellTopologyTag< ConfigTag, Topologies::Quadrangle > { static constexpr bool enabled = true; };
+// template< typename ConfigTag >
+// struct MeshCellTopologyTag< ConfigTag, Topologies::Tetrahedron > { static constexpr bool enabled = true; };
+// template< typename ConfigTag >
+// struct MeshCellTopologyTag< ConfigTag, Topologies::Hexahedron > { static constexpr bool enabled = true; };
+// template< typename ConfigTag >
+// struct MeshCellTopologyTag< ConfigTag, Topologies::Polygon > { static constexpr bool enabled = true; };
+// template< typename ConfigTag >
+// struct MeshCellTopologyTag< ConfigTag, Topologies::Wedge > { static constexpr bool enabled = true; };
+// template< typename ConfigTag >
+// struct MeshCellTopologyTag< ConfigTag, Topologies::Pyramid > { static constexpr bool enabled = true; };
+// template< typename ConfigTag >
+// struct MeshCellTopologyTag< ConfigTag, Topologies::Polyhedron > { static constexpr bool enabled = true; };
 // TODO: Simplex has not been tested yet
-//template< typename ConfigTag > struct MeshCellTopologyTag< ConfigTag, Topologies::Simplex > { static constexpr bool enabled = true; };
+// template< typename ConfigTag >
+// struct MeshCellTopologyTag< ConfigTag, Topologies::Simplex > { static constexpr bool enabled = true; };
 
 // All sensible space dimensions are enabled by default.
-template< typename ConfigTag, typename CellTopology, int SpaceDimension > struct MeshSpaceDimensionTag { static constexpr bool enabled = SpaceDimension >= CellTopology::dimension && SpaceDimension <= 3; };
+template< typename ConfigTag, typename CellTopology, int SpaceDimension >
+struct MeshSpaceDimensionTag
+{
+   static constexpr bool enabled = SpaceDimension >= CellTopology::dimension && SpaceDimension <= 3;
+};
 
 // Meshes are enabled only for the `float` and `double` real types by default.
-template< typename ConfigTag, typename Real > struct MeshRealTag { static constexpr bool enabled = false; };
-template< typename ConfigTag > struct MeshRealTag< ConfigTag, float > { static constexpr bool enabled = true; };
-template< typename ConfigTag > struct MeshRealTag< ConfigTag, double > { static constexpr bool enabled = true; };
+template< typename ConfigTag, typename Real >
+struct MeshRealTag
+{
+   static constexpr bool enabled = false;
+};
+template< typename ConfigTag >
+struct MeshRealTag< ConfigTag, float >
+{
+   static constexpr bool enabled = true;
+};
+template< typename ConfigTag >
+struct MeshRealTag< ConfigTag, double >
+{
+   static constexpr bool enabled = true;
+};
 
 // Meshes are enabled only for the `int` and `long int` global index types by default.
-template< typename ConfigTag, typename GlobalIndex > struct MeshGlobalIndexTag { static constexpr bool enabled = false; };
-template< typename ConfigTag > struct MeshGlobalIndexTag< ConfigTag, int > { static constexpr bool enabled = true; };
-template< typename ConfigTag > struct MeshGlobalIndexTag< ConfigTag, long int > { static constexpr bool enabled = true; };
+template< typename ConfigTag, typename GlobalIndex >
+struct MeshGlobalIndexTag
+{
+   static constexpr bool enabled = false;
+};
+template< typename ConfigTag >
+struct MeshGlobalIndexTag< ConfigTag, int >
+{
+   static constexpr bool enabled = true;
+};
+template< typename ConfigTag >
+struct MeshGlobalIndexTag< ConfigTag, long int >
+{
+   static constexpr bool enabled = true;
+};
 
 // Meshes are enabled only for the `short int` local index type by default.
-template< typename ConfigTag, typename LocalIndex > struct MeshLocalIndexTag { static constexpr bool enabled = false; };
-template< typename ConfigTag > struct MeshLocalIndexTag< ConfigTag, short int > { static constexpr bool enabled = true; };
+template< typename ConfigTag, typename LocalIndex >
+struct MeshLocalIndexTag
+{
+   static constexpr bool enabled = false;
+};
+template< typename ConfigTag >
+struct MeshLocalIndexTag< ConfigTag, short int >
+{
+   static constexpr bool enabled = true;
+};
 
 // Config tag specifying the MeshConfig to use.
 template< typename ConfigTag >
@@ -126,22 +225,28 @@ struct MeshConfigTemplateTag
 //       at the time of template specializations, so something like this does
 //       not work:
 //
-//          struct MeshTag< ConfigTag,
-//                      Mesh< typename MeshConfigTemplateTag< ConfigTag >::
-//                         template MeshConfig< CellTopology, SpaceDimension, Real, GlobalIndex, LocalIndex > > >
+// struct MeshTag< ConfigTag, Mesh< typename MeshConfigTemplateTag< ConfigTag >::
+//    template MeshConfig< CellTopology, SpaceDimension, Real, GlobalIndex, LocalIndex > > >
 //
-template< typename ConfigTag, typename Device, typename CellTopology, int SpaceDimension, typename Real, typename GlobalIndex, typename LocalIndex >
+template< typename ConfigTag,
+          typename Device,
+          typename CellTopology,
+          int SpaceDimension,
+          typename Real,
+          typename GlobalIndex,
+          typename LocalIndex >
 struct MeshTag
 {
-   static constexpr bool enabled =
-            MeshDeviceTag< ConfigTag, Device >::enabled &&
-            MeshCellTopologyTag< ConfigTag, CellTopology >::enabled &&
-            MeshSpaceDimensionTag< ConfigTag, CellTopology, SpaceDimension >::enabled &&
-            MeshRealTag< ConfigTag, Real >::enabled &&
-            MeshGlobalIndexTag< ConfigTag, GlobalIndex >::enabled &&
-            MeshLocalIndexTag< ConfigTag, LocalIndex >::enabled;
+   // clang-format off
+   static constexpr bool enabled = MeshDeviceTag< ConfigTag, Device >::enabled
+                                && MeshCellTopologyTag< ConfigTag, CellTopology >::enabled
+                                && MeshSpaceDimensionTag< ConfigTag, CellTopology, SpaceDimension >::enabled
+                                && MeshRealTag< ConfigTag, Real >::enabled
+                                && MeshGlobalIndexTag< ConfigTag, GlobalIndex >::enabled
+                                && MeshLocalIndexTag< ConfigTag, LocalIndex >::enabled;
+   // clang-format on
 };
 
-} // namespace BuildConfigTags
-} // namespace Meshes
-} // namespace TNL
+}  // namespace BuildConfigTags
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/TypeResolver/GridTypeResolver.h b/src/TNL/Meshes/TypeResolver/GridTypeResolver.h
index 123841b3d5488fe482979050f7eefaf2b35f2439..b278b706964cf25b52082cbe689ab46280107bf4 100644
--- a/src/TNL/Meshes/TypeResolver/GridTypeResolver.h
+++ b/src/TNL/Meshes/TypeResolver/GridTypeResolver.h
@@ -13,48 +13,54 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename ConfigTag,
-          typename Device >
+template< typename ConfigTag, typename Device >
 class GridTypeResolver
 {
 public:
-
    template< typename Reader, typename Functor >
-   static bool run( Reader& reader, Functor&& functor );
+   static bool
+   run( Reader& reader, Functor&& functor );
 
 protected:
    template< typename Reader, typename Functor >
    struct detail
    {
-      static bool resolveGridDimension( Reader& reader, Functor&& functor );
+      static bool
+      resolveGridDimension( Reader& reader, Functor&& functor );
 
       // NOTE: We could disable the grids only by the GridTag, but doing the
       //       resolution for all subtypes is more flexible and also pretty
       //       good optimization of compilation times.
 
       // Overload for disabled grid dimensions
-      template< int MeshDimension,
-                typename = typename std::enable_if< ! BuildConfigTags::GridDimensionTag< ConfigTag, MeshDimension >::enabled >::type,
-                typename = void >
-      static bool resolveReal( Reader& reader, Functor&& functor );
+      template<
+         int MeshDimension,
+         typename = typename std::enable_if< ! BuildConfigTags::GridDimensionTag< ConfigTag, MeshDimension >::enabled >::type,
+         typename = void >
+      static bool
+      resolveReal( Reader& reader, Functor&& functor );
 
       // Overload for enabled grid dimensions
-      template< int MeshDimension,
-                typename = typename std::enable_if< BuildConfigTags::GridDimensionTag< ConfigTag, MeshDimension >::enabled >::type >
-      static bool resolveReal( Reader& reader, Functor&& functor );
+      template<
+         int MeshDimension,
+         typename = typename std::enable_if< BuildConfigTags::GridDimensionTag< ConfigTag, MeshDimension >::enabled >::type >
+      static bool
+      resolveReal( Reader& reader, Functor&& functor );
 
       // Overload for disabled real types
       template< int MeshDimension,
                 typename Real,
                 typename = typename std::enable_if< ! BuildConfigTags::GridRealTag< ConfigTag, Real >::enabled >::type,
                 typename = void >
-      static bool resolveIndex( Reader& reader, Functor&& functor );
+      static bool
+      resolveIndex( Reader& reader, Functor&& functor );
 
       // Overload for enabled real types
       template< int MeshDimension,
                 typename Real,
                 typename = typename std::enable_if< BuildConfigTags::GridRealTag< ConfigTag, Real >::enabled >::type >
-      static bool resolveIndex( Reader& reader, Functor&& functor );
+      static bool
+      resolveIndex( Reader& reader, Functor&& functor );
 
       // Overload for disabled index types
       template< int MeshDimension,
@@ -62,29 +68,33 @@ protected:
                 typename Index,
                 typename = typename std::enable_if< ! BuildConfigTags::GridIndexTag< ConfigTag, Index >::enabled >::type,
                 typename = void >
-      static bool resolveGridType( Reader& reader, Functor&& functor );
+      static bool
+      resolveGridType( Reader& reader, Functor&& functor );
 
       // Overload for enabled index types
       template< int MeshDimension,
                 typename Real,
                 typename Index,
                 typename = typename std::enable_if< BuildConfigTags::GridIndexTag< ConfigTag, Index >::enabled >::type >
-      static bool resolveGridType( Reader& reader, Functor&& functor );
+      static bool
+      resolveGridType( Reader& reader, Functor&& functor );
 
       // Overload for disabled grid types
       template< typename GridType,
                 typename = typename std::enable_if< ! BuildConfigTags::GridTag< ConfigTag, GridType >::enabled >::type,
                 typename = void >
-      static bool resolveTerminate( Reader& reader, Functor&& functor );
+      static bool
+      resolveTerminate( Reader& reader, Functor&& functor );
 
       // Overload for enabled grid types
       template< typename GridType,
                 typename = typename std::enable_if< BuildConfigTags::GridTag< ConfigTag, GridType >::enabled >::type >
-      static bool resolveTerminate( Reader& reader, Functor&& functor );
+      static bool
+      resolveTerminate( Reader& reader, Functor&& functor );
    };
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/TypeResolver/GridTypeResolver.hpp>
diff --git a/src/TNL/Meshes/TypeResolver/GridTypeResolver.hpp b/src/TNL/Meshes/TypeResolver/GridTypeResolver.hpp
index 3f830208993d6afb8fe0c3226732fbdf7e400ff6..821777ec57561cae36fab65398df603f65d269d3 100644
--- a/src/TNL/Meshes/TypeResolver/GridTypeResolver.hpp
+++ b/src/TNL/Meshes/TypeResolver/GridTypeResolver.hpp
@@ -14,171 +14,122 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
 bool
-GridTypeResolver< ConfigTag, Device >::
-run( Reader& reader, Functor&& functor )
+GridTypeResolver< ConfigTag, Device >::run( Reader& reader, Functor&& functor )
 {
-   return detail< Reader, Functor >::resolveGridDimension( reader, std::forward<Functor>(functor) );
+   return detail< Reader, Functor >::resolveGridDimension( reader, std::forward< Functor >( functor ) );
 }
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
 bool
-GridTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::
-resolveGridDimension( Reader& reader, Functor&& functor )
+GridTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::resolveGridDimension( Reader& reader, Functor&& functor )
 {
    if( reader.getMeshDimension() == 1 )
-      return resolveReal< 1 >( reader, std::forward<Functor>(functor) );
+      return resolveReal< 1 >( reader, std::forward< Functor >( functor ) );
    if( reader.getMeshDimension() == 2 )
-      return resolveReal< 2 >( reader, std::forward<Functor>(functor) );
+      return resolveReal< 2 >( reader, std::forward< Functor >( functor ) );
    if( reader.getMeshDimension() == 3 )
-      return resolveReal< 3 >( reader, std::forward<Functor>(functor) );
+      return resolveReal< 3 >( reader, std::forward< Functor >( functor ) );
    std::cerr << "Unsupported mesh dimension: " << reader.getMeshDimension() << std::endl;
    return false;
 }
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
-      template< int MeshDimension,
-                typename, typename >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
+template< int MeshDimension, typename, typename >
 bool
-GridTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::
-resolveReal( Reader& reader, Functor&& functor )
+GridTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::resolveReal( Reader& reader, Functor&& functor )
 {
    std::cerr << "The grid dimension " << MeshDimension << " is disabled in the build configuration." << std::endl;
    return false;
 }
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
-      template< int MeshDimension,
-                typename >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
+template< int MeshDimension, typename >
 bool
-GridTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::
-resolveReal( Reader& reader, Functor&& functor )
+GridTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::resolveReal( Reader& reader, Functor&& functor )
 {
    if( reader.getRealType() == "float" )
-      return resolveIndex< MeshDimension, float >( reader, std::forward<Functor>(functor) );
+      return resolveIndex< MeshDimension, float >( reader, std::forward< Functor >( functor ) );
    if( reader.getRealType() == "double" )
-      return resolveIndex< MeshDimension, double >( reader, std::forward<Functor>(functor) );
+      return resolveIndex< MeshDimension, double >( reader, std::forward< Functor >( functor ) );
    if( reader.getRealType() == "long double" )
-      return resolveIndex< MeshDimension, long double >( reader, std::forward<Functor>(functor) );
+      return resolveIndex< MeshDimension, long double >( reader, std::forward< Functor >( functor ) );
    std::cerr << "Unsupported real type: " << reader.getRealType() << std::endl;
    return false;
 }
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
-      template< int MeshDimension,
-                typename Real,
-                typename, typename >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
+template< int MeshDimension, typename Real, typename, typename >
 bool
-GridTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::
-resolveIndex( Reader& reader, Functor&& functor )
+GridTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::resolveIndex( Reader& reader, Functor&& functor )
 {
    std::cerr << "The grid real type " << getType< Real >() << " is disabled in the build configuration." << std::endl;
    return false;
 }
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
-      template< int MeshDimension,
-                typename Real,
-                typename >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
+template< int MeshDimension, typename Real, typename >
 bool
-GridTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::
-resolveIndex( Reader& reader, Functor&& functor )
+GridTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::resolveIndex( Reader& reader, Functor&& functor )
 {
-   if( reader.getGlobalIndexType() == "short" ||
-       reader.getGlobalIndexType() == "short int" ||
-       reader.getGlobalIndexType() == "std::int16_t" ||
-       reader.getGlobalIndexType() == "std::uint16_t" )
-      return resolveGridType< MeshDimension, Real, short int >( reader, std::forward<Functor>(functor) );
-   if( reader.getGlobalIndexType() == "int" ||
-       reader.getGlobalIndexType() == "std::int32_t" ||
-       reader.getGlobalIndexType() == "std::uint32_t" )
-      return resolveGridType< MeshDimension, Real, int >( reader, std::forward<Functor>(functor) );
-   if( reader.getGlobalIndexType() == "long" ||
-       reader.getGlobalIndexType() == "long int" ||
-       reader.getGlobalIndexType() == "std::int64_t" ||
-       reader.getGlobalIndexType() == "std::uint64_t" )
-      return resolveGridType< MeshDimension, Real, long int >( reader, std::forward<Functor>(functor) );
+   if( reader.getGlobalIndexType() == "short" || reader.getGlobalIndexType() == "short int"
+       || reader.getGlobalIndexType() == "std::int16_t" || reader.getGlobalIndexType() == "std::uint16_t" )
+      return resolveGridType< MeshDimension, Real, short int >( reader, std::forward< Functor >( functor ) );
+   if( reader.getGlobalIndexType() == "int" || reader.getGlobalIndexType() == "std::int32_t"
+       || reader.getGlobalIndexType() == "std::uint32_t" )
+      return resolveGridType< MeshDimension, Real, int >( reader, std::forward< Functor >( functor ) );
+   if( reader.getGlobalIndexType() == "long" || reader.getGlobalIndexType() == "long int"
+       || reader.getGlobalIndexType() == "std::int64_t" || reader.getGlobalIndexType() == "std::uint64_t" )
+      return resolveGridType< MeshDimension, Real, long int >( reader, std::forward< Functor >( functor ) );
    std::cerr << "Unsupported index type: " << reader.getRealType() << std::endl;
    return false;
 }
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
-      template< int MeshDimension,
-                typename Real,
-                typename Index,
-                typename, typename >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
+template< int MeshDimension, typename Real, typename Index, typename, typename >
 bool
-GridTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::
-resolveGridType( Reader& reader, Functor&& functor )
+GridTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::resolveGridType( Reader& reader, Functor&& functor )
 {
    std::cerr << "The grid index type " << getType< Index >() << " is disabled in the build configuration." << std::endl;
    return false;
 }
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
-      template< int MeshDimension,
-                typename Real,
-                typename Index,
-                typename >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
+template< int MeshDimension, typename Real, typename Index, typename >
 bool
-GridTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::
-resolveGridType( Reader& reader, Functor&& functor )
+GridTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::resolveGridType( Reader& reader, Functor&& functor )
 {
    using GridType = Meshes::Grid< MeshDimension, Real, Device, Index >;
-   return resolveTerminate< GridType >( reader, std::forward<Functor>(functor) );
+   return resolveTerminate< GridType >( reader, std::forward< Functor >( functor ) );
 }
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
-      template< typename GridType,
-                typename, typename >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
+template< typename GridType, typename, typename >
 bool
-GridTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::
-resolveTerminate( Reader& reader, Functor&& functor )
+GridTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::resolveTerminate( Reader& reader, Functor&& functor )
 {
    std::cerr << "The mesh type " << TNL::getType< GridType >() << " is disabled in the build configuration." << std::endl;
    return false;
 }
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
-      template< typename GridType,
-                typename >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
+template< typename GridType, typename >
 bool
-GridTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::
-resolveTerminate( Reader& reader, Functor&& functor )
+GridTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::resolveTerminate( Reader& reader, Functor&& functor )
 {
-   return std::forward<Functor>(functor)( reader, GridType{} );
+   return std::forward< Functor >( functor )( reader, GridType{} );
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/TypeResolver/MeshTypeResolver.h b/src/TNL/Meshes/TypeResolver/MeshTypeResolver.h
index 002205466b4aabc16bf3e8cd312f183851c0cf3b..e5293ce7d190aa648854130439f7d20eba51618a 100644
--- a/src/TNL/Meshes/TypeResolver/MeshTypeResolver.h
+++ b/src/TNL/Meshes/TypeResolver/MeshTypeResolver.h
@@ -13,48 +13,56 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename ConfigTag,
-          typename Device >
+template< typename ConfigTag, typename Device >
 class MeshTypeResolver
 {
 public:
-
    template< typename Reader, typename Functor >
-   static bool run( Reader& reader, Functor&& functor );
+   static bool
+   run( Reader& reader, Functor&& functor );
 
 protected:
    template< typename Reader, typename Functor >
    struct detail
    {
-      static bool resolveCellTopology( Reader& reader, Functor&& functor );
+      static bool
+      resolveCellTopology( Reader& reader, Functor&& functor );
 
       // NOTE: We could disable the meshes only by the MeshTag, but doing the
       //       resolution for all subtypes is more flexible and also pretty
       //       good optimization of compilation times.
 
       // Overload for disabled cell topologies
-      template< typename CellTopology,
-                typename = typename std::enable_if< ! BuildConfigTags::MeshCellTopologyTag< ConfigTag, CellTopology >::enabled >::type,
-                typename = void >
-      static bool resolveSpaceDimension( Reader& reader, Functor&& functor );
+      template<
+         typename CellTopology,
+         typename = typename std::enable_if< ! BuildConfigTags::MeshCellTopologyTag< ConfigTag, CellTopology >::enabled >::type,
+         typename = void >
+      static bool
+      resolveSpaceDimension( Reader& reader, Functor&& functor );
 
       // Overload for enabled cell topologies
-      template< typename CellTopology,
-                typename = typename std::enable_if< BuildConfigTags::MeshCellTopologyTag< ConfigTag, CellTopology >::enabled >::type >
-      static bool resolveSpaceDimension( Reader& reader, Functor&& functor );
+      template<
+         typename CellTopology,
+         typename = typename std::enable_if< BuildConfigTags::MeshCellTopologyTag< ConfigTag, CellTopology >::enabled >::type >
+      static bool
+      resolveSpaceDimension( Reader& reader, Functor&& functor );
 
       // Overload for disabled space dimensions
       template< typename CellTopology,
                 int SpaceDimension,
-                typename = typename std::enable_if< ! BuildConfigTags::MeshSpaceDimensionTag< ConfigTag, CellTopology, SpaceDimension >::enabled >::type,
+                typename = typename std::enable_if<
+                   ! BuildConfigTags::MeshSpaceDimensionTag< ConfigTag, CellTopology, SpaceDimension >::enabled >::type,
                 typename = void >
-      static bool resolveReal( Reader& reader, Functor&& functor );
+      static bool
+      resolveReal( Reader& reader, Functor&& functor );
 
       // Overload for enabled space dimensions
       template< typename CellTopology,
                 int SpaceDimension,
-                typename = typename std::enable_if< BuildConfigTags::MeshSpaceDimensionTag< ConfigTag, CellTopology, SpaceDimension >::enabled >::type >
-      static bool resolveReal( Reader& reader, Functor&& functor );
+                typename = typename std::enable_if<
+                   BuildConfigTags::MeshSpaceDimensionTag< ConfigTag, CellTopology, SpaceDimension >::enabled >::type >
+      static bool
+      resolveReal( Reader& reader, Functor&& functor );
 
       // Overload for disabled real types
       template< typename CellTopology,
@@ -62,81 +70,93 @@ protected:
                 typename Real,
                 typename = typename std::enable_if< ! BuildConfigTags::MeshRealTag< ConfigTag, Real >::enabled >::type,
                 typename = void >
-      static bool resolveGlobalIndex( Reader& reader, Functor&& functor );
+      static bool
+      resolveGlobalIndex( Reader& reader, Functor&& functor );
 
       // Overload for enabled real types
       template< typename CellTopology,
                 int SpaceDimension,
                 typename Real,
                 typename = typename std::enable_if< BuildConfigTags::MeshRealTag< ConfigTag, Real >::enabled >::type >
-      static bool resolveGlobalIndex( Reader& reader, Functor&& functor );
+      static bool
+      resolveGlobalIndex( Reader& reader, Functor&& functor );
 
       // Overload for disabled global index types
-      template< typename CellTopology,
-                int SpaceDimension,
-                typename Real,
-                typename GlobalIndex,
-                typename = typename std::enable_if< ! BuildConfigTags::MeshGlobalIndexTag< ConfigTag, GlobalIndex >::enabled >::type,
-                typename = void >
-      static bool resolveLocalIndex( Reader& reader, Functor&& functor );
+      template<
+         typename CellTopology,
+         int SpaceDimension,
+         typename Real,
+         typename GlobalIndex,
+         typename = typename std::enable_if< ! BuildConfigTags::MeshGlobalIndexTag< ConfigTag, GlobalIndex >::enabled >::type,
+         typename = void >
+      static bool
+      resolveLocalIndex( Reader& reader, Functor&& functor );
 
       // Overload for enabled global index types
-      template< typename CellTopology,
-                int SpaceDimension,
-                typename Real,
-                typename GlobalIndex,
-                typename = typename std::enable_if< BuildConfigTags::MeshGlobalIndexTag< ConfigTag, GlobalIndex >::enabled >::type >
-      static bool resolveLocalIndex( Reader& reader, Functor&& functor );
+      template<
+         typename CellTopology,
+         int SpaceDimension,
+         typename Real,
+         typename GlobalIndex,
+         typename = typename std::enable_if< BuildConfigTags::MeshGlobalIndexTag< ConfigTag, GlobalIndex >::enabled >::type >
+      static bool
+      resolveLocalIndex( Reader& reader, Functor&& functor );
 
       // Overload for disabled local index types
-      template< typename CellTopology,
-                int SpaceDimension,
-                typename Real,
-                typename GlobalIndex,
-                typename LocalIndex,
-                typename = typename std::enable_if< ! BuildConfigTags::MeshLocalIndexTag< ConfigTag, LocalIndex >::enabled >::type,
-                typename = void >
-      static bool resolveMeshType( Reader& reader, Functor&& functor );
+      template<
+         typename CellTopology,
+         int SpaceDimension,
+         typename Real,
+         typename GlobalIndex,
+         typename LocalIndex,
+         typename = typename std::enable_if< ! BuildConfigTags::MeshLocalIndexTag< ConfigTag, LocalIndex >::enabled >::type,
+         typename = void >
+      static bool
+      resolveMeshType( Reader& reader, Functor&& functor );
 
       // Overload for enabled local index types
-      template< typename CellTopology,
-                int SpaceDimension,
-                typename Real,
-                typename GlobalIndex,
-                typename LocalIndex,
-                typename = typename std::enable_if< BuildConfigTags::MeshLocalIndexTag< ConfigTag, LocalIndex >::enabled >::type >
-      static bool resolveMeshType( Reader& reader, Functor&& functor );
+      template<
+         typename CellTopology,
+         int SpaceDimension,
+         typename Real,
+         typename GlobalIndex,
+         typename LocalIndex,
+         typename = typename std::enable_if< BuildConfigTags::MeshLocalIndexTag< ConfigTag, LocalIndex >::enabled >::type >
+      static bool
+      resolveMeshType( Reader& reader, Functor&& functor );
 
       // Overload for disabled mesh types
       template< typename MeshConfig,
-                typename = typename std::enable_if< ! BuildConfigTags::MeshDeviceTag< ConfigTag, Device >::enabled ||
-                                                    ! BuildConfigTags::MeshTag< ConfigTag,
-                                                                                Device,
-                                                                                typename MeshConfig::CellTopology,
-                                                                                MeshConfig::spaceDimension,
-                                                                                typename MeshConfig::RealType,
-                                                                                typename MeshConfig::GlobalIndexType,
-                                                                                typename MeshConfig::LocalIndexType
-                                                                              >::enabled >::type,
+                typename = typename std::enable_if<
+                   ! BuildConfigTags::MeshDeviceTag< ConfigTag, Device >::enabled
+                   || ! BuildConfigTags::MeshTag< ConfigTag,
+                                                  Device,
+                                                  typename MeshConfig::CellTopology,
+                                                  MeshConfig::spaceDimension,
+                                                  typename MeshConfig::RealType,
+                                                  typename MeshConfig::GlobalIndexType,
+                                                  typename MeshConfig::LocalIndexType >::enabled >::type,
                 typename = void >
-      static bool resolveTerminate( Reader& reader, Functor&& functor );
+      static bool
+      resolveTerminate( Reader& reader, Functor&& functor );
 
       // Overload for enabled mesh types
       template< typename MeshConfig,
-                typename = typename std::enable_if< BuildConfigTags::MeshDeviceTag< ConfigTag, Device >::enabled &&
-                                                    BuildConfigTags::MeshTag< ConfigTag,
-                                                                              Device,
-                                                                              typename MeshConfig::CellTopology,
-                                                                              MeshConfig::spaceDimension,
-                                                                              typename MeshConfig::RealType,
-                                                                              typename MeshConfig::GlobalIndexType,
-                                                                              typename MeshConfig::LocalIndexType
-                                                                            >::enabled >::type >
-      static bool resolveTerminate( Reader& reader, Functor&& functor );
+                typename = typename std::enable_if<
+                   BuildConfigTags::MeshDeviceTag< ConfigTag, Device >::enabled
+                   && BuildConfigTags::MeshTag< ConfigTag,
+                                                Device,
+                                                typename MeshConfig::CellTopology,
+                                                MeshConfig::spaceDimension,
+                                                typename MeshConfig::RealType,
+                                                typename MeshConfig::GlobalIndexType,
+                                                typename MeshConfig::LocalIndexType >::enabled >::type >
+      static bool
+      resolveTerminate( Reader& reader, Functor&& functor );
    };
 };
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/TypeResolver/MeshTypeResolver.hpp>
diff --git a/src/TNL/Meshes/TypeResolver/MeshTypeResolver.hpp b/src/TNL/Meshes/TypeResolver/MeshTypeResolver.hpp
index a41fffdfb62637b3aafc923fff9c561c05a75642..d96b87605c21b67853dd7eb1060928b403ac7fe5 100644
--- a/src/TNL/Meshes/TypeResolver/MeshTypeResolver.hpp
+++ b/src/TNL/Meshes/TypeResolver/MeshTypeResolver.hpp
@@ -15,284 +15,210 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
 bool
-MeshTypeResolver< ConfigTag, Device >::
-run( Reader& reader, Functor&& functor )
+MeshTypeResolver< ConfigTag, Device >::run( Reader& reader, Functor&& functor )
 {
-   return detail< Reader, Functor >::resolveCellTopology( reader, std::forward<Functor>(functor) );
+   return detail< Reader, Functor >::resolveCellTopology( reader, std::forward< Functor >( functor ) );
 }
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
 bool
-MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::
-resolveCellTopology( Reader& reader, Functor&& functor )
+MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::resolveCellTopology( Reader& reader, Functor&& functor )
 {
-   switch( reader.getCellShape() )
-   {
+   switch( reader.getCellShape() ) {
       case VTK::EntityShape::Line:
-         return resolveSpaceDimension< Topologies::Edge >( reader, std::forward<Functor>(functor) );
+         return resolveSpaceDimension< Topologies::Edge >( reader, std::forward< Functor >( functor ) );
       case VTK::EntityShape::Triangle:
-         return resolveSpaceDimension< Topologies::Triangle >( reader, std::forward<Functor>(functor) );
+         return resolveSpaceDimension< Topologies::Triangle >( reader, std::forward< Functor >( functor ) );
       case VTK::EntityShape::Quad:
-         return resolveSpaceDimension< Topologies::Quadrangle >( reader, std::forward<Functor>(functor) );
+         return resolveSpaceDimension< Topologies::Quadrangle >( reader, std::forward< Functor >( functor ) );
       case VTK::EntityShape::Tetra:
-         return resolveSpaceDimension< Topologies::Tetrahedron >( reader, std::forward<Functor>(functor) );
+         return resolveSpaceDimension< Topologies::Tetrahedron >( reader, std::forward< Functor >( functor ) );
       case VTK::EntityShape::Hexahedron:
-         return resolveSpaceDimension< Topologies::Hexahedron >( reader, std::forward<Functor>(functor) );
+         return resolveSpaceDimension< Topologies::Hexahedron >( reader, std::forward< Functor >( functor ) );
       case VTK::EntityShape::Polygon:
-         return resolveSpaceDimension< Topologies::Polygon >( reader, std::forward<Functor>(functor) );
+         return resolveSpaceDimension< Topologies::Polygon >( reader, std::forward< Functor >( functor ) );
       case VTK::EntityShape::Wedge:
-         return resolveSpaceDimension< Topologies::Wedge >( reader, std::forward<Functor>(functor) );
+         return resolveSpaceDimension< Topologies::Wedge >( reader, std::forward< Functor >( functor ) );
       case VTK::EntityShape::Pyramid:
-         return resolveSpaceDimension< Topologies::Pyramid >( reader, std::forward<Functor>(functor) );
+         return resolveSpaceDimension< Topologies::Pyramid >( reader, std::forward< Functor >( functor ) );
       case VTK::EntityShape::Polyhedron:
-         return resolveSpaceDimension< Topologies::Polyhedron >( reader, std::forward<Functor>(functor) );
+         return resolveSpaceDimension< Topologies::Polyhedron >( reader, std::forward< Functor >( functor ) );
       default:
          std::cerr << "unsupported cell topology: " << VTK::getShapeName( reader.getCellShape() ) << std::endl;
          return false;
    }
 }
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
-      template< typename CellTopology,
-                typename, typename >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
+template< typename CellTopology, typename, typename >
 bool
-MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::
-resolveSpaceDimension( Reader& reader, Functor&& functor )
+MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::resolveSpaceDimension( Reader& reader, Functor&& functor )
 {
    std::cerr << "The cell topology " << getType< CellTopology >() << " is disabled in the build configuration." << std::endl;
    return false;
 }
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
-      template< typename CellTopology,
-                typename >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
+template< typename CellTopology, typename >
 bool
-MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::
-resolveSpaceDimension( Reader& reader, Functor&& functor )
+MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::resolveSpaceDimension( Reader& reader, Functor&& functor )
 {
-   switch( reader.getSpaceDimension() )
-   {
+   switch( reader.getSpaceDimension() ) {
       case 1:
-         return resolveReal< CellTopology, 1 >( reader, std::forward<Functor>(functor) );
+         return resolveReal< CellTopology, 1 >( reader, std::forward< Functor >( functor ) );
       case 2:
-         return resolveReal< CellTopology, 2 >( reader, std::forward<Functor>(functor) );
+         return resolveReal< CellTopology, 2 >( reader, std::forward< Functor >( functor ) );
       case 3:
-         return resolveReal< CellTopology, 3 >( reader, std::forward<Functor>(functor) );
+         return resolveReal< CellTopology, 3 >( reader, std::forward< Functor >( functor ) );
       default:
          std::cerr << "unsupported space dimension: " << reader.getSpaceDimension() << std::endl;
          return false;
    }
 }
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
-      template< typename CellTopology,
-                int SpaceDimension,
-                typename, typename >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
+template< typename CellTopology, int SpaceDimension, typename, typename >
 bool
-MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::
-resolveReal( Reader& reader, Functor&& functor )
+MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::resolveReal( Reader& reader, Functor&& functor )
 {
-   std::cerr << "The combination of space dimension (" << SpaceDimension
-             << ") and mesh dimension (" << CellTopology::dimension
+   std::cerr << "The combination of space dimension (" << SpaceDimension << ") and mesh dimension (" << CellTopology::dimension
              << ") is either invalid or disabled in the build configuration." << std::endl;
    return false;
 }
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
-      template< typename CellTopology,
-                int SpaceDimension,
-                typename >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
+template< typename CellTopology, int SpaceDimension, typename >
 bool
-MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::
-resolveReal( Reader& reader, Functor&& functor )
+MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::resolveReal( Reader& reader, Functor&& functor )
 {
    if( reader.getRealType() == "float" )
-      return resolveGlobalIndex< CellTopology, SpaceDimension, float >( reader, std::forward<Functor>(functor) );
+      return resolveGlobalIndex< CellTopology, SpaceDimension, float >( reader, std::forward< Functor >( functor ) );
    if( reader.getRealType() == "double" )
-      return resolveGlobalIndex< CellTopology, SpaceDimension, double >( reader, std::forward<Functor>(functor) );
+      return resolveGlobalIndex< CellTopology, SpaceDimension, double >( reader, std::forward< Functor >( functor ) );
    if( reader.getRealType() == "long double" )
-      return resolveGlobalIndex< CellTopology, SpaceDimension, long double >( reader, std::forward<Functor>(functor) );
+      return resolveGlobalIndex< CellTopology, SpaceDimension, long double >( reader, std::forward< Functor >( functor ) );
    std::cerr << "Unsupported real type: " << reader.getRealType() << std::endl;
    return false;
 }
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
-      template< typename CellTopology,
-                int SpaceDimension,
-                typename Real,
-                typename, typename >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
+template< typename CellTopology, int SpaceDimension, typename Real, typename, typename >
 bool
-MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::
-resolveGlobalIndex( Reader& reader, Functor&& functor )
+MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::resolveGlobalIndex( Reader& reader, Functor&& functor )
 {
    std::cerr << "The mesh real type " << getType< Real >() << " is disabled in the build configuration." << std::endl;
    return false;
 }
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
-      template< typename CellTopology,
-                int SpaceDimension,
-                typename Real,
-                typename >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
+template< typename CellTopology, int SpaceDimension, typename Real, typename >
 bool
-MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::
-resolveGlobalIndex( Reader& reader, Functor&& functor )
+MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::resolveGlobalIndex( Reader& reader, Functor&& functor )
 {
-   if( reader.getGlobalIndexType() == "short" ||
-       reader.getGlobalIndexType() == "short int" ||
-       reader.getGlobalIndexType() == "std::int16_t" ||
-       reader.getGlobalIndexType() == "std::uint16_t" )
-      return resolveLocalIndex< CellTopology, SpaceDimension, Real, short int >( reader, std::forward<Functor>(functor) );
-   if( reader.getGlobalIndexType() == "int" ||
-       reader.getGlobalIndexType() == "std::int32_t" ||
-       reader.getGlobalIndexType() == "std::uint32_t" )
-      return resolveLocalIndex< CellTopology, SpaceDimension, Real, int >( reader, std::forward<Functor>(functor) );
-   if( reader.getGlobalIndexType() == "long" ||
-       reader.getGlobalIndexType() == "long int" ||
-       reader.getGlobalIndexType() == "std::int64_t" ||
-       reader.getGlobalIndexType() == "std::uint64_t" )
-      return resolveLocalIndex< CellTopology, SpaceDimension, Real, long int >( reader, std::forward<Functor>(functor) );
+   if( reader.getGlobalIndexType() == "short" || reader.getGlobalIndexType() == "short int"
+       || reader.getGlobalIndexType() == "std::int16_t" || reader.getGlobalIndexType() == "std::uint16_t" )
+      return resolveLocalIndex< CellTopology, SpaceDimension, Real, short int >( reader, std::forward< Functor >( functor ) );
+   if( reader.getGlobalIndexType() == "int" || reader.getGlobalIndexType() == "std::int32_t"
+       || reader.getGlobalIndexType() == "std::uint32_t" )
+      return resolveLocalIndex< CellTopology, SpaceDimension, Real, int >( reader, std::forward< Functor >( functor ) );
+   if( reader.getGlobalIndexType() == "long" || reader.getGlobalIndexType() == "long int"
+       || reader.getGlobalIndexType() == "std::int64_t" || reader.getGlobalIndexType() == "std::uint64_t" )
+      return resolveLocalIndex< CellTopology, SpaceDimension, Real, long int >( reader, std::forward< Functor >( functor ) );
    std::cerr << "Unsupported global index type: " << reader.getGlobalIndexType() << std::endl;
    return false;
 }
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
-      template< typename CellTopology,
-                int SpaceDimension,
-                typename Real,
-                typename GlobalIndex,
-                typename, typename >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
+template< typename CellTopology, int SpaceDimension, typename Real, typename GlobalIndex, typename, typename >
 bool
-MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::
-resolveLocalIndex( Reader& reader, Functor&& functor )
+MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::resolveLocalIndex( Reader& reader, Functor&& functor )
 {
-   std::cerr << "The mesh global index type " << getType< GlobalIndex >() << " is disabled in the build configuration." << std::endl;
+   std::cerr << "The mesh global index type " << getType< GlobalIndex >() << " is disabled in the build configuration."
+             << std::endl;
    return false;
 }
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
-      template< typename CellTopology,
-                int SpaceDimension,
-                typename Real,
-                typename GlobalIndex,
-                typename >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
+template< typename CellTopology, int SpaceDimension, typename Real, typename GlobalIndex, typename >
 bool
-MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::
-resolveLocalIndex( Reader& reader, Functor&& functor )
+MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::resolveLocalIndex( Reader& reader, Functor&& functor )
 {
-   if( reader.getLocalIndexType() == "short" ||
-       reader.getLocalIndexType() == "short int" ||
-       reader.getLocalIndexType() == "std::int16_t" ||
-       reader.getLocalIndexType() == "std::uint16_t" )
-      return resolveMeshType< CellTopology, SpaceDimension, Real, GlobalIndex, short int >( reader, std::forward<Functor>(functor) );
-   if( reader.getLocalIndexType() == "int" ||
-       reader.getLocalIndexType() == "std::int32_t" ||
-       reader.getLocalIndexType() == "std::uint32_t" )
-      return resolveMeshType< CellTopology, SpaceDimension, Real, GlobalIndex, int >( reader, std::forward<Functor>(functor) );
-   if( reader.getLocalIndexType() == "long" ||
-       reader.getLocalIndexType() == "long int" ||
-       reader.getLocalIndexType() == "std::int64_t" ||
-       reader.getLocalIndexType() == "std::uint64_t" )
-      return resolveMeshType< CellTopology, SpaceDimension, Real, GlobalIndex, long int >( reader, std::forward<Functor>(functor) );
+   if( reader.getLocalIndexType() == "short" || reader.getLocalIndexType() == "short int"
+       || reader.getLocalIndexType() == "std::int16_t" || reader.getLocalIndexType() == "std::uint16_t" )
+      return resolveMeshType< CellTopology, SpaceDimension, Real, GlobalIndex, short int >(
+         reader, std::forward< Functor >( functor ) );
+   if( reader.getLocalIndexType() == "int" || reader.getLocalIndexType() == "std::int32_t"
+       || reader.getLocalIndexType() == "std::uint32_t" )
+      return resolveMeshType< CellTopology, SpaceDimension, Real, GlobalIndex, int >( reader,
+                                                                                      std::forward< Functor >( functor ) );
+   if( reader.getLocalIndexType() == "long" || reader.getLocalIndexType() == "long int"
+       || reader.getLocalIndexType() == "std::int64_t" || reader.getLocalIndexType() == "std::uint64_t" )
+      return resolveMeshType< CellTopology, SpaceDimension, Real, GlobalIndex, long int >( reader,
+                                                                                           std::forward< Functor >( functor ) );
    std::cerr << "Unsupported local index type: " << reader.getLocalIndexType() << std::endl;
    return false;
 }
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
-      template< typename CellTopology,
-                int SpaceDimension,
-                typename Real,
-                typename GlobalIndex,
-                typename LocalIndex,
-                typename, typename >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
+template< typename CellTopology,
+          int SpaceDimension,
+          typename Real,
+          typename GlobalIndex,
+          typename LocalIndex,
+          typename,
+          typename >
 bool
-MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::
-resolveMeshType( Reader& reader, Functor&& functor )
+MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::resolveMeshType( Reader& reader, Functor&& functor )
 {
-   std::cerr << "The mesh local index type " << getType< LocalIndex >() << " is disabled in the build configuration." << std::endl;
+   std::cerr << "The mesh local index type " << getType< LocalIndex >() << " is disabled in the build configuration."
+             << std::endl;
    return false;
 }
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
-      template< typename CellTopology,
-                int SpaceDimension,
-                typename Real,
-                typename GlobalIndex,
-                typename LocalIndex,
-                typename >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
+template< typename CellTopology, int SpaceDimension, typename Real, typename GlobalIndex, typename LocalIndex, typename >
 bool
-MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::
-resolveMeshType( Reader& reader, Functor&& functor )
+MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::resolveMeshType( Reader& reader, Functor&& functor )
 {
-   using MeshConfig = typename BuildConfigTags::MeshConfigTemplateTag< ConfigTag >::template MeshConfig< CellTopology, SpaceDimension, Real, GlobalIndex, LocalIndex >;
-   return resolveTerminate< MeshConfig >( reader, std::forward<Functor>(functor) );
+   using MeshConfig = typename BuildConfigTags::MeshConfigTemplateTag<
+      ConfigTag >::template MeshConfig< CellTopology, SpaceDimension, Real, GlobalIndex, LocalIndex >;
+   return resolveTerminate< MeshConfig >( reader, std::forward< Functor >( functor ) );
 }
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
-      template< typename MeshConfig,
-                typename, typename >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
+template< typename MeshConfig, typename, typename >
 bool
-MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::
-resolveTerminate( Reader& reader, Functor&& functor )
+MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::resolveTerminate( Reader& reader, Functor&& functor )
 {
-   std::cerr << "The mesh config type " << getType< MeshConfig >() << " is disabled in the build configuration for device " << getType< Device >() << "." << std::endl;
+   std::cerr << "The mesh config type " << getType< MeshConfig >() << " is disabled in the build configuration for device "
+             << getType< Device >() << "." << std::endl;
    return false;
 }
 
-template< typename ConfigTag,
-          typename Device >
-   template< typename Reader,
-             typename Functor >
-      template< typename MeshConfig,
-                typename >
+template< typename ConfigTag, typename Device >
+template< typename Reader, typename Functor >
+template< typename MeshConfig, typename >
 bool
-MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::
-resolveTerminate( Reader& reader, Functor&& functor )
+MeshTypeResolver< ConfigTag, Device >::detail< Reader, Functor >::resolveTerminate( Reader& reader, Functor&& functor )
 {
    using MeshType = Meshes::Mesh< MeshConfig, Device >;
-   return std::forward<Functor>(functor)( reader, MeshType{} );
+   return std::forward< Functor >( functor )( reader, MeshType{} );
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/TypeResolver/resolveDistributedMeshType.h b/src/TNL/Meshes/TypeResolver/resolveDistributedMeshType.h
index 342435eaa42a44b1f2b0eaa05b27f7807357d861..fd427f4378444a6b5156649651f72d00b2a9db16 100644
--- a/src/TNL/Meshes/TypeResolver/resolveDistributedMeshType.h
+++ b/src/TNL/Meshes/TypeResolver/resolveDistributedMeshType.h
@@ -13,21 +13,13 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename ConfigTag,
-          typename Device,
-          typename Functor >
+template< typename ConfigTag, typename Device, typename Functor >
 bool
-resolveDistributedMeshType( Functor&& functor,
-                            const std::string& fileName,
-                            const std::string& fileFormat = "auto" );
+resolveDistributedMeshType( Functor&& functor, const std::string& fileName, const std::string& fileFormat = "auto" );
 
-template< typename ConfigTag,
-          typename Device,
-          typename Functor >
+template< typename ConfigTag, typename Device, typename Functor >
 bool
-resolveAndLoadDistributedMesh( Functor&& functor,
-                               const std::string& fileName,
-                               const std::string& fileFormat = "auto" );
+resolveAndLoadDistributedMesh( Functor&& functor, const std::string& fileName, const std::string& fileFormat = "auto" );
 
 template< typename Mesh >
 bool
@@ -35,7 +27,7 @@ loadDistributedMesh( DistributedMeshes::DistributedMesh< Mesh >& distributedMesh
                      const std::string& fileName,
                      const std::string& fileFormat = "auto" );
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/TypeResolver/resolveDistributedMeshType.hpp>
diff --git a/src/TNL/Meshes/TypeResolver/resolveDistributedMeshType.hpp b/src/TNL/Meshes/TypeResolver/resolveDistributedMeshType.hpp
index ac2ba2fa0ed7674d1a8c9192b56075bfece63041..8c95d7232fd3ce11c98807de84e7be06eabba09f 100644
--- a/src/TNL/Meshes/TypeResolver/resolveDistributedMeshType.hpp
+++ b/src/TNL/Meshes/TypeResolver/resolveDistributedMeshType.hpp
@@ -14,43 +14,35 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename ConfigTag,
-          typename Device,
-          typename Functor >
+template< typename ConfigTag, typename Device, typename Functor >
 bool
-resolveDistributedMeshType( Functor&& functor,
-                            const std::string& fileName,
-                            const std::string& fileFormat )
+resolveDistributedMeshType( Functor&& functor, const std::string& fileName, const std::string& fileFormat )
 {
    std::cout << "Detecting distributed mesh from file " << fileName << " ..." << std::endl;
 
-   auto wrapper = [&functor] ( Readers::MeshReader& reader, auto&& localMesh )
+   auto wrapper = [ &functor ]( Readers::MeshReader& reader, auto&& localMesh )
    {
-      using LocalMesh = std::decay_t< decltype(localMesh) >;
+      using LocalMesh = std::decay_t< decltype( localMesh ) >;
       using DistributedMesh = DistributedMeshes::DistributedMesh< LocalMesh >;
-      return std::forward<Functor>(functor)( reader, DistributedMesh{ std::move(localMesh) } );
+      return std::forward< Functor >( functor )( reader, DistributedMesh{ std::move( localMesh ) } );
    };
 
    return resolveMeshType< ConfigTag, Device >( wrapper, fileName, fileFormat );
 }
 
-template< typename ConfigTag,
-          typename Device,
-          typename Functor >
+template< typename ConfigTag, typename Device, typename Functor >
 bool
-resolveAndLoadDistributedMesh( Functor&& functor,
-                               const std::string& fileName,
-                               const std::string& fileFormat )
+resolveAndLoadDistributedMesh( Functor&& functor, const std::string& fileName, const std::string& fileFormat )
 {
-   auto wrapper = [&]( Readers::MeshReader& reader, auto&& mesh ) -> bool
+   auto wrapper = [ & ]( Readers::MeshReader& reader, auto&& mesh ) -> bool
    {
-      using MeshType = std::decay_t< decltype(mesh) >;
+      using MeshType = std::decay_t< decltype( mesh ) >;
       std::cout << "Loading a mesh from the file " << fileName << " ..." << std::endl;
       try {
          if( reader.getMeshType() == "Meshes::DistributedMesh" )
-            dynamic_cast<Readers::PVTUReader&>(reader).loadMesh( mesh );
+            dynamic_cast< Readers::PVTUReader& >( reader ).loadMesh( mesh );
          else if( reader.getMeshType() == "Meshes::DistributedGrid" )
-            dynamic_cast<Readers::PVTIReader&>(reader).loadMesh( mesh );
+            dynamic_cast< Readers::PVTIReader& >( reader ).loadMesh( mesh );
          else
             throw std::runtime_error( "Unknown type of a distributed mesh: " + reader.getMeshType() );
       }
@@ -58,7 +50,7 @@ resolveAndLoadDistributedMesh( Functor&& functor,
          std::cerr << "Failed to load the mesh from the file " << fileName << ". The error is:\n" << e.what() << std::endl;
          return false;
       }
-      return functor( reader, std::forward<MeshType>(mesh) );
+      return functor( reader, std::forward< MeshType >( mesh ) );
    };
    return resolveDistributedMeshType< ConfigTag, Device >( wrapper, fileName, fileFormat );
 }
@@ -72,10 +64,10 @@ loadDistributedMesh( DistributedMeshes::DistributedMesh< Mesh >& distributedMesh
    namespace fs = std::experimental::filesystem;
    std::string format = fileFormat;
    if( format == "auto" ) {
-      format = fs::path(fileName).extension();
+      format = fs::path( fileName ).extension();
       if( format.length() > 0 )
          // remove dot from the extension
-         format = format.substr(1);
+         format = format.substr( 1 );
    }
 
    if( format == "pvtu" ) {
@@ -98,5 +90,5 @@ loadDistributedMesh( DistributedMeshes::DistributedMesh< Mesh >& distributedMesh
    }
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/TypeResolver/resolveMeshType.h b/src/TNL/Meshes/TypeResolver/resolveMeshType.h
index ebbf638fd1f90613400ab634a4822351d0f22d69..6f9975f9378a4fe9522c96ea8736b8615db7e085 100644
--- a/src/TNL/Meshes/TypeResolver/resolveMeshType.h
+++ b/src/TNL/Meshes/TypeResolver/resolveMeshType.h
@@ -30,9 +30,7 @@ namespace Meshes {
  * auto functor = [] ( auto& reader, auto&& mesh ) -> bool {};
  * \endcode
  */
-template< typename ConfigTag,
-          typename Device,
-          typename Functor >
+template< typename ConfigTag, typename Device, typename Functor >
 bool
 resolveMeshType( Functor&& functor,
                  const std::string& fileName,
@@ -55,9 +53,7 @@ resolveMeshType( Functor&& functor,
  * return functor( reader, mesh );
  * \endcode
  */
-template< typename ConfigTag,
-          typename Device,
-          typename Functor >
+template< typename ConfigTag, typename Device, typename Functor >
 bool
 resolveAndLoadMesh( Functor&& functor,
                     const std::string& fileName,
@@ -75,17 +71,13 @@ resolveAndLoadMesh( Functor&& functor,
  */
 template< typename Mesh >
 bool
-loadMesh( Mesh& mesh,
-          const std::string& fileName,
-          const std::string& fileFormat = "auto" );
+loadMesh( Mesh& mesh, const std::string& fileName, const std::string& fileFormat = "auto" );
 
 template< typename MeshConfig >
 bool
-loadMesh( Mesh< MeshConfig, Devices::Cuda >& mesh,
-          const std::string& fileName,
-          const std::string& fileFormat = "auto" );
+loadMesh( Mesh< MeshConfig, Devices::Cuda >& mesh, const std::string& fileName, const std::string& fileFormat = "auto" );
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/TypeResolver/resolveMeshType.hpp>
diff --git a/src/TNL/Meshes/TypeResolver/resolveMeshType.hpp b/src/TNL/Meshes/TypeResolver/resolveMeshType.hpp
index 9b732570404098b4707b518e084877750951bc35..adbff9fd163ebf4dd35428e759bb4dc6721fb17a 100644
--- a/src/TNL/Meshes/TypeResolver/resolveMeshType.hpp
+++ b/src/TNL/Meshes/TypeResolver/resolveMeshType.hpp
@@ -16,9 +16,7 @@
 namespace TNL {
 namespace Meshes {
 
-template< typename ConfigTag,
-          typename Device,
-          typename Functor >
+template< typename ConfigTag, typename Device, typename Functor >
 bool
 resolveMeshType( Functor&& functor,
                  const std::string& fileName,
@@ -49,9 +47,7 @@ resolveMeshType( Functor&& functor,
    }
 }
 
-template< typename ConfigTag,
-          typename Device,
-          typename Functor >
+template< typename ConfigTag, typename Device, typename Functor >
 bool
 resolveAndLoadMesh( Functor&& functor,
                     const std::string& fileName,
@@ -59,9 +55,9 @@ resolveAndLoadMesh( Functor&& functor,
                     const std::string& realType,
                     const std::string& globalIndexType )
 {
-   auto wrapper = [&]( auto& reader, auto&& mesh ) -> bool
+   auto wrapper = [ & ]( auto& reader, auto&& mesh ) -> bool
    {
-      using MeshType = std::decay_t< decltype(mesh) >;
+      using MeshType = std::decay_t< decltype( mesh ) >;
       std::cout << "Loading a mesh from the file " << fileName << " ..." << std::endl;
       try {
          reader.loadMesh( mesh );
@@ -70,16 +66,14 @@ resolveAndLoadMesh( Functor&& functor,
          std::cerr << "Failed to load the mesh from the file " << fileName << ". The error is:\n" << e.what() << std::endl;
          return false;
       }
-      return functor( reader, std::forward<MeshType>(mesh) );
+      return functor( reader, std::forward< MeshType >( mesh ) );
    };
    return resolveMeshType< ConfigTag, Device >( wrapper, fileName, fileFormat, realType, globalIndexType );
 }
 
 template< typename Mesh >
 bool
-loadMesh( Mesh& mesh,
-          const std::string& fileName,
-          const std::string& fileFormat )
+loadMesh( Mesh& mesh, const std::string& fileName, const std::string& fileFormat )
 {
    std::cout << "Loading a mesh from the file " << fileName << " ..." << std::endl;
 
@@ -100,9 +94,7 @@ loadMesh( Mesh& mesh,
 
 template< typename MeshConfig >
 bool
-loadMesh( Mesh< MeshConfig, Devices::Cuda >& mesh,
-          const std::string& fileName,
-          const std::string& fileFormat )
+loadMesh( Mesh< MeshConfig, Devices::Cuda >& mesh, const std::string& fileName, const std::string& fileFormat )
 {
    Mesh< MeshConfig, Devices::Host > hostMesh;
    if( ! loadMesh( hostMesh, fileName, fileFormat ) )
@@ -111,5 +103,5 @@ loadMesh( Mesh< MeshConfig, Devices::Cuda >& mesh,
    return true;
 }
 
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/VTKTraits.h b/src/TNL/Meshes/VTKTraits.h
index d32160c6a5685487ba9722d85d3ddf597bdd032c..2e88731a64226446e3573f0ba81a10d5d42b1ef6 100644
--- a/src/TNL/Meshes/VTKTraits.h
+++ b/src/TNL/Meshes/VTKTraits.h
@@ -25,8 +25,7 @@ namespace Meshes {
 namespace VTK {
 
 // VTK file formats
-enum class FileFormat
-: std::uint8_t
+enum class FileFormat : std::uint8_t
 {
    ascii,
    binary,
@@ -34,16 +33,14 @@ enum class FileFormat
 };
 
 // VTK data types
-enum class DataType
-: std::uint8_t
+enum class DataType : std::uint8_t
 {
    CellData,
    PointData
 };
 
 // VTK entity shapes
-enum class EntityShape
-: std::uint8_t
+enum class EntityShape : std::uint8_t
 {
    Vertex = 1,
    PolyVertex = 2,
@@ -64,10 +61,10 @@ enum class EntityShape
    Polyhedron = 42
 };
 
-inline std::string getShapeName( EntityShape shape )
+inline std::string
+getShapeName( EntityShape shape )
 {
-   switch( shape )
-   {
+   switch( shape ) {
       case EntityShape::Vertex:
          return "Vertex";
       case EntityShape::PolyVertex:
@@ -106,44 +103,103 @@ inline std::string getShapeName( EntityShape shape )
    return "<unknown entity shape>";
 }
 
-inline int getEntityDimension( EntityShape shape )
-{
-   switch( shape )
-   {
-      case EntityShape::Vertex:         return 0;
-      case EntityShape::PolyVertex:     return 0;
-      case EntityShape::Line:           return 1;
-      case EntityShape::PolyLine:       return 1;
-      case EntityShape::Triangle:       return 2;
-      case EntityShape::TriangleStrip:  return 2;
-      case EntityShape::Polygon:        return 2;
-      case EntityShape::Pixel:          return 2;
-      case EntityShape::Quad:           return 2;
-      case EntityShape::Tetra:          return 3;
-      case EntityShape::Voxel:          return 3;
-      case EntityShape::Hexahedron:     return 3;
-      case EntityShape::Wedge:          return 3;
-      case EntityShape::Pyramid:        return 3;
-      case EntityShape::PentagonalPrism:return 3;
-      case EntityShape::HexagonalPrism: return 3;
-      case EntityShape::Polyhedron:     return 3;
+inline int
+getEntityDimension( EntityShape shape )
+{
+   switch( shape ) {
+      case EntityShape::Vertex:
+         return 0;
+      case EntityShape::PolyVertex:
+         return 0;
+      case EntityShape::Line:
+         return 1;
+      case EntityShape::PolyLine:
+         return 1;
+      case EntityShape::Triangle:
+         return 2;
+      case EntityShape::TriangleStrip:
+         return 2;
+      case EntityShape::Polygon:
+         return 2;
+      case EntityShape::Pixel:
+         return 2;
+      case EntityShape::Quad:
+         return 2;
+      case EntityShape::Tetra:
+         return 3;
+      case EntityShape::Voxel:
+         return 3;
+      case EntityShape::Hexahedron:
+         return 3;
+      case EntityShape::Wedge:
+         return 3;
+      case EntityShape::Pyramid:
+         return 3;
+      case EntityShape::PentagonalPrism:
+         return 3;
+      case EntityShape::HexagonalPrism:
+         return 3;
+      case EntityShape::Polyhedron:
+         return 3;
    }
    // this can actually happen when an invalid uint8_t value is converted to EntityShape
-   throw std::runtime_error( "VTK::getEntityDimension: invalid entity shape value " + std::to_string(int(shape)) );
+   throw std::runtime_error( "VTK::getEntityDimension: invalid entity shape value " + std::to_string( int( shape ) ) );
 }
 
 // static mapping of TNL entity topologies to EntityShape
-template< typename Topology > struct TopologyToEntityShape {};
-template<> struct TopologyToEntityShape< Topologies::Vertex >      { static constexpr EntityShape shape = EntityShape::Vertex;     };
-template<> struct TopologyToEntityShape< Topologies::Edge >        { static constexpr EntityShape shape = EntityShape::Line;       };
-template<> struct TopologyToEntityShape< Topologies::Triangle >    { static constexpr EntityShape shape = EntityShape::Triangle;   };
-template<> struct TopologyToEntityShape< Topologies::Polygon >     { static constexpr EntityShape shape = EntityShape::Polygon;    };
-template<> struct TopologyToEntityShape< Topologies::Quadrangle >  { static constexpr EntityShape shape = EntityShape::Quad;       };
-template<> struct TopologyToEntityShape< Topologies::Tetrahedron > { static constexpr EntityShape shape = EntityShape::Tetra;      };
-template<> struct TopologyToEntityShape< Topologies::Hexahedron >  { static constexpr EntityShape shape = EntityShape::Hexahedron; };
-template<> struct TopologyToEntityShape< Topologies::Wedge >       { static constexpr EntityShape shape = EntityShape::Wedge;      };
-template<> struct TopologyToEntityShape< Topologies::Pyramid >     { static constexpr EntityShape shape = EntityShape::Pyramid;    };
-template<> struct TopologyToEntityShape< Topologies::Polyhedron >  { static constexpr EntityShape shape = EntityShape::Polyhedron; };
+template< typename Topology >
+struct TopologyToEntityShape
+{};
+template<>
+struct TopologyToEntityShape< Topologies::Vertex >
+{
+   static constexpr EntityShape shape = EntityShape::Vertex;
+};
+template<>
+struct TopologyToEntityShape< Topologies::Edge >
+{
+   static constexpr EntityShape shape = EntityShape::Line;
+};
+template<>
+struct TopologyToEntityShape< Topologies::Triangle >
+{
+   static constexpr EntityShape shape = EntityShape::Triangle;
+};
+template<>
+struct TopologyToEntityShape< Topologies::Polygon >
+{
+   static constexpr EntityShape shape = EntityShape::Polygon;
+};
+template<>
+struct TopologyToEntityShape< Topologies::Quadrangle >
+{
+   static constexpr EntityShape shape = EntityShape::Quad;
+};
+template<>
+struct TopologyToEntityShape< Topologies::Tetrahedron >
+{
+   static constexpr EntityShape shape = EntityShape::Tetra;
+};
+template<>
+struct TopologyToEntityShape< Topologies::Hexahedron >
+{
+   static constexpr EntityShape shape = EntityShape::Hexahedron;
+};
+template<>
+struct TopologyToEntityShape< Topologies::Wedge >
+{
+   static constexpr EntityShape shape = EntityShape::Wedge;
+};
+template<>
+struct TopologyToEntityShape< Topologies::Pyramid >
+{
+   static constexpr EntityShape shape = EntityShape::Pyramid;
+};
+template<>
+struct TopologyToEntityShape< Topologies::Polyhedron >
+{
+   static constexpr EntityShape shape = EntityShape::Polyhedron;
+};
 
 // mapping used in VTKWriter
 template< typename GridEntity >
@@ -154,24 +210,63 @@ private:
    static_assert( dim >= 0 && dim <= 3, "unexpected dimension of the grid entity" );
 
 public:
-   static constexpr EntityShape shape =
-      (dim == 0) ? EntityShape::Vertex :
-      (dim == 1) ? EntityShape::Line :
-      (dim == 2) ? EntityShape::Pixel :
-                   EntityShape::Voxel;
+   static constexpr EntityShape shape = ( dim == 0 ) ? EntityShape::Vertex
+                                      : ( dim == 1 ) ? EntityShape::Line
+                                      : ( dim == 2 ) ? EntityShape::Pixel
+                                                     : EntityShape::Voxel;
 };
 
 // type names used in the VTK library (for the XML formats)
-inline std::string getTypeName( std::int8_t ) { return "Int8"; }
-inline std::string getTypeName( std::uint8_t ) { return "UInt8"; }
-inline std::string getTypeName( std::int16_t ) { return "Int16"; }
-inline std::string getTypeName( std::uint16_t ) { return "UInt16"; }
-inline std::string getTypeName( std::int32_t ) { return "Int32"; }
-inline std::string getTypeName( std::uint32_t ) { return "UInt32"; }
-inline std::string getTypeName( std::int64_t ) { return "Int64"; }
-inline std::string getTypeName( std::uint64_t ) { return "UInt64"; }
-inline std::string getTypeName( float ) { return "Float32"; }
-inline std::string getTypeName( double ) { return "Float64"; }
+inline std::string
+getTypeName( std::int8_t )
+{
+   return "Int8";
+}
+inline std::string
+getTypeName( std::uint8_t )
+{
+   return "UInt8";
+}
+inline std::string
+getTypeName( std::int16_t )
+{
+   return "Int16";
+}
+inline std::string
+getTypeName( std::uint16_t )
+{
+   return "UInt16";
+}
+inline std::string
+getTypeName( std::int32_t )
+{
+   return "Int32";
+}
+inline std::string
+getTypeName( std::uint32_t )
+{
+   return "UInt32";
+}
+inline std::string
+getTypeName( std::int64_t )
+{
+   return "Int64";
+}
+inline std::string
+getTypeName( std::uint64_t )
+{
+   return "UInt64";
+}
+inline std::string
+getTypeName( float )
+{
+   return "Float32";
+}
+inline std::string
+getTypeName( double )
+{
+   return "Float64";
+}
 
 /**
  * Ghost points and ghost cells
@@ -179,22 +274,21 @@ inline std::string getTypeName( double ) { return "Float64"; }
  * The following bit fields are consistent with the corresponding VTK enums [1], which in turn
  * are consistent with VisIt ghost zones specification [2].
  *
- * - [1] https://github.com/Kitware/VTK/blob/060f626b8df0b8144ec8f10c41f936b712c0330b/Common/DataModel/vtkDataSetAttributes.h#L118-L138
+ * - [1]
+ * https://github.com/Kitware/VTK/blob/060f626b8df0b8144ec8f10c41f936b712c0330b/Common/DataModel/vtkDataSetAttributes.h#L118-L138
  * - [2] http://www.visitusers.org/index.php?title=Representing_ghost_data
  */
-enum class CellGhostTypes
-: std::uint8_t
+enum class CellGhostTypes : std::uint8_t
 {
-   DUPLICATECELL = 1,        // the cell is present on multiple processors
-   HIGHCONNECTIVITYCELL = 2, // the cell has more neighbors than in a regular mesh
-   LOWCONNECTIVITYCELL = 4,  // the cell has less neighbors than in a regular mesh
-   REFINEDCELL = 8,          // other cells are present that refines it
-   EXTERIORCELL = 16,        // the cell is on the exterior of the data set
-   HIDDENCELL = 32           // the cell is needed to maintain connectivity, but the data values should be ignored
+   DUPLICATECELL = 1,         // the cell is present on multiple processors
+   HIGHCONNECTIVITYCELL = 2,  // the cell has more neighbors than in a regular mesh
+   LOWCONNECTIVITYCELL = 4,   // the cell has less neighbors than in a regular mesh
+   REFINEDCELL = 8,           // other cells are present that refines it
+   EXTERIORCELL = 16,         // the cell is on the exterior of the data set
+   HIDDENCELL = 32            // the cell is needed to maintain connectivity, but the data values should be ignored
 };
 
-enum class PointGhostTypes
-: std::uint8_t
+enum class PointGhostTypes : std::uint8_t
 {
    DUPLICATEPOINT = 1,  // the cell is present on multiple processors
    HIDDENPOINT = 2      // the point is needed to maintain connectivity, but the data values should be ignored
@@ -206,11 +300,12 @@ enum class PointGhostTypes
  *
  * For details, see https://blog.kitware.com/ghost-and-blanking-visibility-changes/
  */
-inline const char* ghostArrayName()
+inline const char*
+ghostArrayName()
 {
    return "vtkGhostType";
 }
 
-} // namespace VTK
-} // namespace Meshes
-} // namespace TNL
+}  // namespace VTK
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Writers/AsymptoteWriter.h b/src/TNL/Meshes/Writers/AsymptoteWriter.h
index da7566bc12554aa7420beea3c07ba6e729b6d89a..0f20e470f4395c2d8bd5d2a6855552738ed91f8d 100644
--- a/src/TNL/Meshes/Writers/AsymptoteWriter.h
+++ b/src/TNL/Meshes/Writers/AsymptoteWriter.h
@@ -19,7 +19,8 @@ class AsymptoteWriter
    static_assert( Mesh::getMeshDimension() <= 3, "The Asymptote format supports only 1D, 2D and 3D meshes." );
 
 public:
-   static void writeAllEntities( const Mesh& mesh, std::ostream& str )
+   static void
+   writeAllEntities( const Mesh& mesh, std::ostream& str )
    {
       throw Exceptions::NotImplementedError();
    }
@@ -33,45 +34,39 @@ class AsymptoteWriter< Grid< 2, Real, Device, Index > >
    using PointType = typename Mesh::PointType;
 
 public:
-   static void writeAllEntities( const Mesh& mesh, std::ostream& str )
+   static void
+   writeAllEntities( const Mesh& mesh, std::ostream& str )
    {
-      str << "size( "
-          << mesh.getProportions(). x() << "cm , "
-          << mesh.getProportions(). y() << "cm );"
-          << std::endl << std::endl;
+      str << "size( " << mesh.getProportions().x() << "cm , " << mesh.getProportions().y() << "cm );" << std::endl << std::endl;
       typename Mesh::Vertex vertex( mesh );
       CoordinatesType& vertexCoordinates = vertex.getCoordinates();
       PointType v;
-      for( Index j = 0; j < mesh.dimensions. y(); j ++ )
-      {
+      for( Index j = 0; j < mesh.dimensions.y(); j++ ) {
          str << "draw( ";
          vertexCoordinates.x() = 0;
          vertexCoordinates.y() = j;
          v = vertex.getCenter();
-         str << "( " << v. x() << ", " << v. y() << " )";
-         for( Index i = 0; i < mesh.dimensions. x(); i ++ )
-         {
+         str << "( " << v.x() << ", " << v.y() << " )";
+         for( Index i = 0; i < mesh.dimensions.x(); i++ ) {
             vertexCoordinates.x() = i + 1;
             vertexCoordinates.y() = j;
             v = vertex.getCenter();
-            str << "--( " << v. x() << ", " << v. y() << " )";
+            str << "--( " << v.x() << ", " << v.y() << " )";
          }
          str << " );" << std::endl;
       }
       str << std::endl;
-      for( Index i = 0; i < mesh.dimensions. x(); i ++ )
-      {
+      for( Index i = 0; i < mesh.dimensions.x(); i++ ) {
          str << "draw( ";
          vertexCoordinates.x() = i;
          vertexCoordinates.y() = 0;
          v = vertex.getCenter();
-         str << "( " << v. x() << ", " << v. y() << " )";
-         for( Index j = 0; j < mesh.dimensions. y(); j ++ )
-         {
+         str << "( " << v.x() << ", " << v.y() << " )";
+         for( Index j = 0; j < mesh.dimensions.y(); j++ ) {
             vertexCoordinates.x() = i;
             vertexCoordinates.y() = j + 1;
             v = vertex.getCenter();
-            str << "--( " << v. x() << ", " << v. y() << " )";
+            str << "--( " << v.x() << ", " << v.y() << " )";
          }
          str << " );" << std::endl;
       }
@@ -80,19 +75,17 @@ public:
       typename Mesh::Cell cell( mesh );
       CoordinatesType& cellCoordinates = cell.getCoordinates();
       const Real cellMeasure = mesh.getSpaceSteps().x() * mesh.getSpaceSteps().y();
-      for( Index i = 0; i < mesh.dimensions. x(); i ++ )
-         for( Index j = 0; j < mesh.dimensions. y(); j ++ )
-         {
+      for( Index i = 0; i < mesh.dimensions.x(); i++ )
+         for( Index j = 0; j < mesh.dimensions.y(); j++ ) {
             cellCoordinates.x() = i;
             cellCoordinates.y() = j;
             v = vertex.getCenter();
             str << "label( scale(0.33) * Label( \"$" << std::setprecision( 3 ) << cellMeasure << std::setprecision( 8 )
-                << "$\" ), ( " << v. x() << ", " << v. y() << " ), S );" << std::endl;
+                << "$\" ), ( " << v.x() << ", " << v.y() << " ), S );" << std::endl;
          }
 
-      for( Index i = 0; i < mesh.dimensions. x(); i ++ )
-         for( Index j = 0; j < mesh.dimensions. y(); j ++ )
-         {
+      for( Index i = 0; i < mesh.dimensions.x(); i++ )
+         for( Index j = 0; j < mesh.dimensions.y(); j++ ) {
             PointType v1, v2, c;
 
             /****
@@ -143,6 +136,6 @@ public:
    }
 };
 
-} // namespace Writers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Writers
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Writers/FPMAWriter.h b/src/TNL/Meshes/Writers/FPMAWriter.h
index 3e37d50749e761f39491acf5f23c1a46fb738f58..f4d7cf9948621f680746158ade1c82cd697e261a 100644
--- a/src/TNL/Meshes/Writers/FPMAWriter.h
+++ b/src/TNL/Meshes/Writers/FPMAWriter.h
@@ -16,14 +16,16 @@ namespace Writers {
 
 namespace details {
 
-template< typename Mesh, int EntityDimension, int SubDimension > struct MeshEntitiesFPMAWriter;
+template< typename Mesh, int EntityDimension, int SubDimension >
+struct MeshEntitiesFPMAWriter;
 
-} // namespace details
+}  // namespace details
 
 template< typename Mesh >
 class FPMAWriter
 {
-   static_assert( std::is_same< typename Mesh::Cell::EntityTopology, Topologies::Polyhedron >::value, "The FPMA format supports polyhedral meshes." );
+   static_assert( std::is_same< typename Mesh::Cell::EntityTopology, Topologies::Polyhedron >::value,
+                  "The FPMA format supports polyhedral meshes." );
 
    template< int EntityDimension, int SubDimension >
    using EntitiesWriter = details::MeshEntitiesFPMAWriter< Mesh, EntityDimension, SubDimension >;
@@ -33,30 +35,29 @@ public:
 
    FPMAWriter() = delete;
 
-   FPMAWriter( std::ostream& str )
-   : str(str.rdbuf())
-   {
-   }
+   FPMAWriter( std::ostream& str ) : str( str.rdbuf() ) {}
 
-   void writeEntities( const Mesh& mesh );
+   void
+   writeEntities( const Mesh& mesh );
 
 protected:
-   void writePoints( const Mesh& mesh );
+   void
+   writePoints( const Mesh& mesh );
 
    std::ostream str;
 
    // number of cells written to the file
-   //IndexType cellsCount = 0;
+   // IndexType cellsCount = 0;
 
    // number of faces written to the file
-   //IndexType facesCount = 0;
+   // IndexType facesCount = 0;
 
    // number of points written to the file
-   //IndexType pointsCount = 0;
+   // IndexType pointsCount = 0;
 };
 
-} // namespace Writers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Writers
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/Writers/FPMAWriter.hpp>
diff --git a/src/TNL/Meshes/Writers/FPMAWriter.hpp b/src/TNL/Meshes/Writers/FPMAWriter.hpp
index 304fddbe13cd9c5618dbae4f70b2fc7f0cd32acb..16c916f2d0473ccf8db78f2b188c8f9963a2aec3 100644
--- a/src/TNL/Meshes/Writers/FPMAWriter.hpp
+++ b/src/TNL/Meshes/Writers/FPMAWriter.hpp
@@ -30,12 +30,11 @@ writeReal( std::ostream& str, const Real value )
    str << value << ' ';
 }
 
-template< typename Mesh,
-          int EntityDimension, 
-          int SubDimension >
+template< typename Mesh, int EntityDimension, int SubDimension >
 struct MeshEntitiesFPMAWriter
 {
-   static void exec( const Mesh& mesh, std::ostream& str )
+   static void
+   exec( const Mesh& mesh, std::ostream& str )
    {
       using Index = typename Mesh::GlobalIndexType;
 
@@ -52,7 +51,7 @@ struct MeshEntitiesFPMAWriter
    }
 };
 
-} // namespace details
+}  // namespace details
 
 template< typename Mesh >
 void
@@ -63,7 +62,6 @@ FPMAWriter< Mesh >::writeEntities( const Mesh& mesh )
    EntitiesWriter< 3, 2 >::exec( mesh, str );
 }
 
-
 template< typename Mesh >
 void
 FPMAWriter< Mesh >::writePoints( const Mesh& mesh )
@@ -78,6 +76,6 @@ FPMAWriter< Mesh >::writePoints( const Mesh& mesh )
    }
 }
 
-} // namespace Writers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Writers
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Writers/NetgenWriter.h b/src/TNL/Meshes/Writers/NetgenWriter.h
index 13a24efa896a136292719f51d56c9eba0ec0cfcd..a3da8dcf2547ed86a7af2bb049444a99ce0b49b6 100644
--- a/src/TNL/Meshes/Writers/NetgenWriter.h
+++ b/src/TNL/Meshes/Writers/NetgenWriter.h
@@ -28,15 +28,15 @@ class NetgenWriter
    static constexpr int meshDimension = Mesh::getMeshDimension();
 
 public:
-   static void writeMesh( const Mesh& mesh, std::ostream& str )
+   static void
+   writeMesh( const Mesh& mesh, std::ostream& str )
    {
       str << std::setprecision( 6 );
       str << std::fixed;
 
       const GlobalIndexType numberOfVertices = mesh.template getEntitiesCount< typename Mesh::Vertex >();
       str << numberOfVertices << std::endl;
-      for( GlobalIndexType i = 0; i < numberOfVertices; i++ )
-      {
+      for( GlobalIndexType i = 0; i < numberOfVertices; i++ ) {
          const PointType& point = mesh.template getEntity< typename Mesh::Vertex >( i ).getPoint();
          str << " ";
          for( int d = 0; d < meshDimension; d++ )
@@ -46,13 +46,10 @@ public:
 
       const GlobalIndexType numberOfCells = mesh.template getEntitiesCount< typename Mesh::Cell >();
       str << numberOfCells << std::endl;
-      for( GlobalIndexType cellIdx = 0; cellIdx < numberOfCells; cellIdx++ )
-      {
+      for( GlobalIndexType cellIdx = 0; cellIdx < numberOfCells; cellIdx++ ) {
          const Cell& cell = mesh.template getEntity< typename Mesh::Cell >( cellIdx );
          str << "   1";
-         for( int cellVertexIdx = 0;
-              cellVertexIdx < meshDimension + 1;
-              cellVertexIdx++ )
+         for( int cellVertexIdx = 0; cellVertexIdx < meshDimension + 1; cellVertexIdx++ )
             // note: Netgen has 1-based indices
             str << " " << cell.template getSubentityIndex< 0 >( cellVertexIdx ) + 1;
          str << "\n";
@@ -60,6 +57,6 @@ public:
    }
 };
 
-} // namespace Writers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Writers
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Writers/PVTIWriter.h b/src/TNL/Meshes/Writers/PVTIWriter.h
index a5919b95b54f0b7a6b38b3f1799f26c3ba74aea4..63f08a030b0d523851007de3e4e9e49d2e2dc8d3 100644
--- a/src/TNL/Meshes/Writers/PVTIWriter.h
+++ b/src/TNL/Meshes/Writers/PVTIWriter.h
@@ -21,67 +21,71 @@ class PVTIWriter
 {
    static_assert( Grid::getMeshDimension() <= 3, "The VTK format supports only 1D, 2D and 3D meshes." );
 
-//   using HeaderType = std::uint64_t;
+   //   using HeaderType = std::uint64_t;
    // LOL, VTK does not support signed header types (but the GridTypeResolver maps unsigned types to signed, so we are good)
    using HeaderType = std::make_unsigned_t< typename Grid::GlobalIndexType >;
-public:
 
+public:
    PVTIWriter() = delete;
 
    PVTIWriter( std::ostream& str, VTK::FileFormat format = VTK::FileFormat::zlib_compressed )
-   : str(str.rdbuf()), format(format)
+   : str( str.rdbuf() ), format( format )
    {}
 
    // If desired, cycle and time of the simulation can put into the file. This follows the instructions at
    // http://www.visitusers.org/index.php?title=Time_and_Cycle_in_VTK_files
-   void writeMetadata( std::int32_t cycle = -1, double time = -1 );
+   void
+   writeMetadata( std::int32_t cycle = -1, double time = -1 );
 
-   void writeImageData( const DistributedMeshes::DistributedMesh< Grid >& distributedMesh );
+   void
+   writeImageData( const DistributedMeshes::DistributedMesh< Grid >& distributedMesh );
 
-   void writeImageData( const Grid& globalGrid,
-                        const unsigned GhostLevel = 0,
-                        const unsigned MinCommonVertices = 0 );
+   void
+   writeImageData( const Grid& globalGrid, unsigned GhostLevel = 0, unsigned MinCommonVertices = 0 );
 
    // Only for compatibility with VTUWriter - calls writeImageData, the EntityDimension is unused
    template< int EntityDimension = Grid::getMeshDimension() >
-   void writeEntities( const DistributedMeshes::DistributedMesh< Grid >& distributedMesh );
+   void
+   writeEntities( const DistributedMeshes::DistributedMesh< Grid >& distributedMesh );
 
    // Only for compatibility with VTUWriter - calls writeImageData, the EntityDimension is unused
    template< int EntityDimension = Grid::getMeshDimension() >
-   void writeEntities( const Grid& grid,
-                       const unsigned GhostLevel = 0,
-                       const unsigned MinCommonVertices = 0 );
+   void
+   writeEntities( const Grid& grid, unsigned GhostLevel = 0, unsigned MinCommonVertices = 0 );
 
    template< typename ValueType >
-   void writePPointData( const std::string& name,
-                         const int numberOfComponents = 1 );
+   void
+   writePPointData( const std::string& name, int numberOfComponents = 1 );
 
    template< typename ValueType >
-   void writePCellData( const std::string& name,
-                        const int numberOfComponents = 1 );
+   void
+   writePCellData( const std::string& name, int numberOfComponents = 1 );
 
    template< typename ValueType >
-   void writePDataArray( const std::string& name,
-                         const int numberOfComponents = 1 );
+   void
+   writePDataArray( const std::string& name, int numberOfComponents = 1 );
 
    // add a single piece and return its source path
    // (useful for sequential writing, e.g. from tnl-decompose-grid)
-   std::string addPiece( const std::string& mainFileName,
-                         const unsigned subdomainIndex,
-                         const typename Grid::CoordinatesType& globalBegin,
-                         const typename Grid::CoordinatesType& globalEnd );
+   std::string
+   addPiece( const std::string& mainFileName,
+             unsigned subdomainIndex,
+             const typename Grid::CoordinatesType& globalBegin,
+             const typename Grid::CoordinatesType& globalEnd );
 
    // add all pieces and return the source path for the current rank
    // (useful for parallel writing)
-   std::string addPiece( const std::string& mainFileName,
-                         const DistributedMeshes::DistributedMesh< Grid >& distributedMesh );
+   std::string
+   addPiece( const std::string& mainFileName, const DistributedMeshes::DistributedMesh< Grid >& distributedMesh );
 
    ~PVTIWriter();
 
 protected:
-   void writeHeader();
+   void
+   writeHeader();
 
-   void writeFooter();
+   void
+   writeFooter();
 
    std::ostream str;
 
@@ -106,14 +110,18 @@ protected:
    bool pPointDataOpen = false;
    bool pPointDataClosed = false;
 
-   void openPCellData();
-   void closePCellData();
-   void openPPointData();
-   void closePPointData();
+   void
+   openPCellData();
+   void
+   closePCellData();
+   void
+   openPPointData();
+   void
+   closePPointData();
 };
 
-} // namespace Writers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Writers
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/Writers/PVTIWriter.hpp>
diff --git a/src/TNL/Meshes/Writers/PVTIWriter.hpp b/src/TNL/Meshes/Writers/PVTIWriter.hpp
index 5e1c2bea44b595dc397abce8c08d086c30b437c9..6a24705cb12c07a36ab6be40ba749c078c92ed55 100644
--- a/src/TNL/Meshes/Writers/PVTIWriter.hpp
+++ b/src/TNL/Meshes/Writers/PVTIWriter.hpp
@@ -23,19 +23,20 @@ PVTIWriter< Grid >::writeMetadata( int cycle, double time )
    if( ! vtkfileOpen )
       writeHeader();
    if( pImageDataOpen )
-      throw std::logic_error("The <PImageData> tag is already open, but writeMetadata should be called before writeImageData.");
+      throw std::logic_error(
+         "The <PImageData> tag is already open, but writeMetadata should be called before writeImageData." );
 
    if( cycle >= 0 || time >= 0 )
       metadata << "<FieldData>\n";
 
    if( cycle >= 0 ) {
-      metadata << "<DataArray type=\"Int32\" Name=\"CYCLE\" NumberOfTuples=\"1\" format=\"ascii\">"
-          << cycle << "</DataArray>\n";
+      metadata << "<DataArray type=\"Int32\" Name=\"CYCLE\" NumberOfTuples=\"1\" format=\"ascii\">" << cycle
+               << "</DataArray>\n";
    }
    if( time >= 0 ) {
       metadata.precision( std::numeric_limits< double >::digits10 );
-      metadata << "<DataArray type=\"Float64\" Name=\"TIME\" NumberOfTuples=\"1\" format=\"ascii\">"
-          << time << "</DataArray>\n";
+      metadata << "<DataArray type=\"Float64\" Name=\"TIME\" NumberOfTuples=\"1\" format=\"ascii\">" << time
+               << "</DataArray>\n";
    }
 
    if( cycle >= 0 || time >= 0 )
@@ -46,21 +47,22 @@ template< typename Grid >
 void
 PVTIWriter< Grid >::writeImageData( const DistributedMeshes::DistributedMesh< Grid >& distributedGrid )
 {
-   writeImageData( distributedGrid.getGlobalGrid(), distributedGrid.getGhostLevels() ); // TODO: ..., Grid::Config::dualGraphMinCommonVertices );
+   writeImageData( distributedGrid.getGlobalGrid(),
+                   distributedGrid.getGhostLevels() );  // TODO: ..., Grid::Config::dualGraphMinCommonVertices );
 }
 
 template< typename Grid >
 void
-PVTIWriter< Grid >::writeImageData( const Grid& globalGrid,
-                                    const unsigned GhostLevel,
-                                    const unsigned MinCommonVertices )
+PVTIWriter< Grid >::writeImageData( const Grid& globalGrid, const unsigned GhostLevel, const unsigned MinCommonVertices )
 {
    if( ! vtkfileOpen )
       writeHeader();
    if( pImageDataOpen )
-      throw std::logic_error("The <PImageData> tag is already open.");
+      throw std::logic_error( "The <PImageData> tag is already open." );
 
-   std::stringstream extent, origin, spacing;
+   std::stringstream extent;
+   std::stringstream origin;
+   std::stringstream spacing;
 
    auto dims = globalGrid.getDimensions();
    for( int j = 0; j < dims.getSize(); j++ )
@@ -101,7 +103,7 @@ PVTIWriter< Grid >::writeImageData( const Grid& globalGrid,
 }
 
 template< typename Grid >
-   template< int EntityDimension >
+template< int EntityDimension >
 void
 PVTIWriter< Grid >::writeEntities( const DistributedMeshes::DistributedMesh< Grid >& distributedMesh )
 {
@@ -109,47 +111,42 @@ PVTIWriter< Grid >::writeEntities( const DistributedMeshes::DistributedMesh< Gri
 }
 
 template< typename Grid >
-   template< int EntityDimension >
+template< int EntityDimension >
 void
-PVTIWriter< Grid >::writeEntities( const Grid& grid,
-                                   const unsigned GhostLevel,
-                                   const unsigned MinCommonVertices )
+PVTIWriter< Grid >::writeEntities( const Grid& grid, const unsigned GhostLevel, const unsigned MinCommonVertices )
 {
    writeImageData( grid, GhostLevel, MinCommonVertices );
 }
 
 template< typename Grid >
-   template< typename ValueType >
+template< typename ValueType >
 void
-PVTIWriter< Grid >::writePPointData( const std::string& name,
-                                     const int numberOfComponents )
+PVTIWriter< Grid >::writePPointData( const std::string& name, const int numberOfComponents )
 {
    if( ! vtkfileOpen )
-      throw std::logic_error("The VTKFile has not been opened yet - call writeEntities first.");
+      throw std::logic_error( "The VTKFile has not been opened yet - call writeEntities first." );
    openPPointData();
    writePDataArray< ValueType >( name, numberOfComponents );
 }
 
 template< typename Grid >
-   template< typename ValueType >
+template< typename ValueType >
 void
-PVTIWriter< Grid >::writePCellData( const std::string& name,
-                                    const int numberOfComponents )
+PVTIWriter< Grid >::writePCellData( const std::string& name, const int numberOfComponents )
 {
    if( ! vtkfileOpen )
-      throw std::logic_error("The VTKFile has not been opened yet - call writeEntities first.");
+      throw std::logic_error( "The VTKFile has not been opened yet - call writeEntities first." );
    openPCellData();
    writePDataArray< ValueType >( name, numberOfComponents );
 }
 
 template< typename Grid >
-   template< typename ValueType >
+template< typename ValueType >
 void
-PVTIWriter< Grid >::writePDataArray( const std::string& name,
-                                     const int numberOfComponents )
+PVTIWriter< Grid >::writePDataArray( const std::string& name, const int numberOfComponents )
 {
    if( numberOfComponents != 0 && numberOfComponents != 1 && numberOfComponents != 3 )
-      throw std::logic_error("Unsupported numberOfComponents parameter: " + std::to_string(numberOfComponents));
+      throw std::logic_error( "Unsupported numberOfComponents parameter: " + std::to_string( numberOfComponents ) );
 
    str << "<PDataArray type=\"" << VTK::getTypeName( ValueType{} ) << "\" ";
    str << "Name=\"" << name << "\" ";
@@ -169,8 +166,8 @@ PVTIWriter< Grid >::addPiece( const std::string& mainFileName,
    const fs::path mainPath = mainFileName;
    const fs::path basename = mainPath.stem();
    if( mainPath.extension() != ".pvti" )
-      throw std::logic_error("The mainFileName parameter must be the name of the "
-                             ".pvti file (i.e., it must have the .pvti suffix).");
+      throw std::logic_error( "The mainFileName parameter must be the name of the "
+                              ".pvti file (i.e., it must have the .pvti suffix)." );
 
    // close PCellData and PPointData sections
    closePCellData();
@@ -179,7 +176,7 @@ PVTIWriter< Grid >::addPiece( const std::string& mainFileName,
    // prepare the extent
    std::stringstream extent;
    for( int j = 0; j < Grid::getMeshDimension(); j++ )
-      extent << globalBegin[ j ] <<  " " << globalEnd[ j ] << " ";
+      extent << globalBegin[ j ] << " " << globalEnd[ j ] << " ";
    // VTK knows only 3D grids
    for( int j = Grid::getMeshDimension(); j < 3; j++ )
       extent << "0 0 ";
@@ -189,7 +186,7 @@ PVTIWriter< Grid >::addPiece( const std::string& mainFileName,
    fs::create_directory( subdirectory );
 
    // write <Piece> tag
-   const std::string subfile = "subdomain." + std::to_string(subdomainIndex) + ".vti";
+   const std::string subfile = "subdomain." + std::to_string( subdomainIndex ) + ".vti";
    const std::string source = basename / subfile;
    str << "<Piece Extent=\"" << extent.str() << "\" Source=\"" << source << "\"/>\n";
 
@@ -204,7 +201,8 @@ PVTIWriter< Grid >::addPiece( const std::string& mainFileName,
 {
    const MPI_Comm communicator = distributedMesh.getCommunicator();
    const typename Grid::CoordinatesType& globalBegin = distributedMesh.getGlobalBegin() - distributedMesh.getLowerOverlap();
-   const typename Grid::CoordinatesType& globalEnd = globalBegin + distributedMesh.getLocalSize() + distributedMesh.getUpperOverlap();
+   const typename Grid::CoordinatesType& globalEnd =
+      globalBegin + distributedMesh.getLocalSize() + distributedMesh.getUpperOverlap();
 
    // exchange globalBegin and globalEnd among the ranks
    const int nproc = MPI::GetSize( communicator );
@@ -217,10 +215,18 @@ PVTIWriter< Grid >::addPiece( const std::string& mainFileName,
    typename Grid::CoordinatesType globalBegins[ nproc ];
    typename Grid::CoordinatesType globalEnds[ nproc ];
    // NOTE: exchanging general data types does not work with MPI
-   //MPI::Alltoall( beginsForScatter, 1, globalBegins, 1, communicator );
-   //MPI::Alltoall( endsForScatter, 1, globalEnds, 1, communicator );
-   MPI::Alltoall( (char*) beginsForScatter, sizeof(typename Grid::CoordinatesType), (char*) globalBegins, sizeof(typename Grid::CoordinatesType), communicator );
-   MPI::Alltoall( (char*) endsForScatter, sizeof(typename Grid::CoordinatesType), (char*) globalEnds, sizeof(typename Grid::CoordinatesType), communicator );
+   // MPI::Alltoall( beginsForScatter, 1, globalBegins, 1, communicator );
+   // MPI::Alltoall( endsForScatter, 1, globalEnds, 1, communicator );
+   MPI::Alltoall( (char*) beginsForScatter,
+                  sizeof( typename Grid::CoordinatesType ),
+                  (char*) globalBegins,
+                  sizeof( typename Grid::CoordinatesType ),
+                  communicator );
+   MPI::Alltoall( (char*) endsForScatter,
+                  sizeof( typename Grid::CoordinatesType ),
+                  (char*) globalEnds,
+                  sizeof( typename Grid::CoordinatesType ),
+                  communicator );
 
    // add pieces for all ranks, return the source for the current rank
    std::string source;
@@ -274,7 +280,7 @@ void
 PVTIWriter< Grid >::openPCellData()
 {
    if( pCellDataClosed )
-      throw std::logic_error("The <PCellData> tag has already been closed.");
+      throw std::logic_error( "The <PCellData> tag has already been closed." );
    closePPointData();
    if( ! pCellDataOpen ) {
       str << "<PCellData>\n";
@@ -298,7 +304,7 @@ void
 PVTIWriter< Grid >::openPPointData()
 {
    if( pPointDataClosed )
-      throw std::logic_error("The <PPointData> tag has already been closed.");
+      throw std::logic_error( "The <PPointData> tag has already been closed." );
    closePCellData();
    if( ! pPointDataOpen ) {
       str << "<PPointData>\n";
@@ -317,6 +323,6 @@ PVTIWriter< Grid >::closePPointData()
    }
 }
 
-} // namespace Writers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Writers
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Writers/PVTUWriter.h b/src/TNL/Meshes/Writers/PVTUWriter.h
index 4cfcfdc92b9cb68611715b3f804b73e43a1a9c4f..c2837304ce592209ca7dee303f44675de9e4e7cd 100644
--- a/src/TNL/Meshes/Writers/PVTUWriter.h
+++ b/src/TNL/Meshes/Writers/PVTUWriter.h
@@ -20,57 +20,60 @@ template< typename Mesh >
 class PVTUWriter
 {
    using HeaderType = std::uint64_t;
-public:
 
+public:
    PVTUWriter() = delete;
 
    PVTUWriter( std::ostream& str, VTK::FileFormat format = VTK::FileFormat::zlib_compressed )
-   : str(str.rdbuf()), format(format)
+   : str( str.rdbuf() ), format( format )
    {}
 
    // If desired, cycle and time of the simulation can put into the file. This follows the instructions at
    // http://www.visitusers.org/index.php?title=Time_and_Cycle_in_VTK_files
-   void writeMetadata( std::int32_t cycle = -1, double time = -1 );
+   void
+   writeMetadata( std::int32_t cycle = -1, double time = -1 );
 
    template< int EntityDimension = Mesh::getMeshDimension() >
-   void writeEntities( const DistributedMeshes::DistributedMesh< Mesh >& distributedMesh );
+   void
+   writeEntities( const DistributedMeshes::DistributedMesh< Mesh >& distributedMesh );
 
    template< int EntityDimension = Mesh::getMeshDimension() >
-   void writeEntities( const Mesh& mesh,
-                       const unsigned GhostLevel = 0,
-                       const unsigned MinCommonVertices = 0 );
+   void
+   writeEntities( const Mesh& mesh, unsigned GhostLevel = 0, unsigned MinCommonVertices = 0 );
 
    template< typename ValueType >
-   void writePPointData( const std::string& name,
-                         const int numberOfComponents = 1 );
+   void
+   writePPointData( const std::string& name, int numberOfComponents = 1 );
 
    template< typename ValueType >
-   void writePCellData( const std::string& name,
-                        const int numberOfComponents = 1 );
+   void
+   writePCellData( const std::string& name, int numberOfComponents = 1 );
 
    template< typename ValueType >
-   void writePDataArray( const std::string& name,
-                         const int numberOfComponents = 1 );
+   void
+   writePDataArray( const std::string& name, int numberOfComponents = 1 );
 
    // add a single piece and return its source path
    // (useful for sequential writing, e.g. from tnl-decompose-mesh)
-   std::string addPiece( const std::string& mainFileName,
-                         const unsigned subdomainIndex );
+   std::string
+   addPiece( const std::string& mainFileName, unsigned subdomainIndex );
 
    // add all pieces and return the source path for the current rank
    // (useful for parallel writing)
-   std::string addPiece( const std::string& mainFileName,
-                         const MPI_Comm communicator );
+   std::string
+   addPiece( const std::string& mainFileName, MPI_Comm communicator );
 
    ~PVTUWriter();
 
 protected:
-   void writeHeader( const unsigned GhostLevel = 0,
-                     const unsigned MinCommonVertices = 0 );
+   void
+   writeHeader( unsigned GhostLevel = 0, unsigned MinCommonVertices = 0 );
 
-   void writePoints( const Mesh& mesh );
+   void
+   writePoints( const Mesh& mesh );
 
-   void writeFooter();
+   void
+   writeFooter();
 
    std::ostream str;
 
@@ -87,14 +90,18 @@ protected:
    bool pPointDataOpen = false;
    bool pPointDataClosed = false;
 
-   void openPCellData();
-   void closePCellData();
-   void openPPointData();
-   void closePPointData();
+   void
+   openPCellData();
+   void
+   closePCellData();
+   void
+   openPPointData();
+   void
+   closePPointData();
 };
 
-} // namespace Writers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Writers
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/Writers/PVTUWriter.hpp>
diff --git a/src/TNL/Meshes/Writers/PVTUWriter.hpp b/src/TNL/Meshes/Writers/PVTUWriter.hpp
index 8f6cb29d11c0d751e7cbb3bbf3c95c154722d3c2..81924ffb15b84f4c9eec96962d2fcd1a816502f8 100644
--- a/src/TNL/Meshes/Writers/PVTUWriter.hpp
+++ b/src/TNL/Meshes/Writers/PVTUWriter.hpp
@@ -21,19 +21,18 @@ void
 PVTUWriter< Mesh >::writeMetadata( int cycle, double time )
 {
    if( ! vtkfileOpen )
-      throw std::logic_error("writeMetadata has to be called after writeEntities in case of the PVTU format, otherwise header attributes would be left unset." );
+      throw std::logic_error( "writeMetadata has to be called after writeEntities in case of the PVTU format, otherwise header "
+                              "attributes would be left unset." );
 
    if( cycle >= 0 || time >= 0 )
       str << "<FieldData>\n";
 
    if( cycle >= 0 ) {
-      str << "<DataArray type=\"Int32\" Name=\"CYCLE\" NumberOfTuples=\"1\" format=\"ascii\">"
-          << cycle << "</DataArray>\n";
+      str << "<DataArray type=\"Int32\" Name=\"CYCLE\" NumberOfTuples=\"1\" format=\"ascii\">" << cycle << "</DataArray>\n";
    }
    if( time >= 0 ) {
       str.precision( std::numeric_limits< double >::digits10 );
-      str << "<DataArray type=\"Float64\" Name=\"TIME\" NumberOfTuples=\"1\" format=\"ascii\">"
-          << time << "</DataArray>\n";
+      str << "<DataArray type=\"Float64\" Name=\"TIME\" NumberOfTuples=\"1\" format=\"ascii\">" << time << "</DataArray>\n";
    }
 
    if( cycle >= 0 || time >= 0 )
@@ -41,19 +40,18 @@ PVTUWriter< Mesh >::writeMetadata( int cycle, double time )
 }
 
 template< typename Mesh >
-   template< int EntityDimension >
+template< int EntityDimension >
 void
 PVTUWriter< Mesh >::writeEntities( const DistributedMeshes::DistributedMesh< Mesh >& distributedMesh )
 {
-   writeEntities< EntityDimension >( distributedMesh.getLocalMesh(), distributedMesh.getGhostLevels(), Mesh::Config::dualGraphMinCommonVertices );
+   writeEntities< EntityDimension >(
+      distributedMesh.getLocalMesh(), distributedMesh.getGhostLevels(), Mesh::Config::dualGraphMinCommonVertices );
 }
 
 template< typename Mesh >
-   template< int EntityDimension >
+template< int EntityDimension >
 void
-PVTUWriter< Mesh >::writeEntities( const Mesh& mesh,
-                                   const unsigned GhostLevel,
-                                   const unsigned MinCommonVertices )
+PVTUWriter< Mesh >::writeEntities( const Mesh& mesh, const unsigned GhostLevel, const unsigned MinCommonVertices )
 {
    if( ! vtkfileOpen )
       writeHeader( GhostLevel, MinCommonVertices );
@@ -63,37 +61,34 @@ PVTUWriter< Mesh >::writeEntities( const Mesh& mesh,
 }
 
 template< typename Mesh >
-   template< typename ValueType >
+template< typename ValueType >
 void
-PVTUWriter< Mesh >::writePPointData( const std::string& name,
-                                     const int numberOfComponents )
+PVTUWriter< Mesh >::writePPointData( const std::string& name, const int numberOfComponents )
 {
    if( ! vtkfileOpen )
-      throw std::logic_error("The VTKFile has not been opened yet - call writeEntities first.");
+      throw std::logic_error( "The VTKFile has not been opened yet - call writeEntities first." );
    openPPointData();
    writePDataArray< ValueType >( name, numberOfComponents );
 }
 
 template< typename Mesh >
-   template< typename ValueType >
+template< typename ValueType >
 void
-PVTUWriter< Mesh >::writePCellData( const std::string& name,
-                                    const int numberOfComponents )
+PVTUWriter< Mesh >::writePCellData( const std::string& name, const int numberOfComponents )
 {
    if( ! vtkfileOpen )
-      throw std::logic_error("The VTKFile has not been opened yet - call writeEntities first.");
+      throw std::logic_error( "The VTKFile has not been opened yet - call writeEntities first." );
    openPCellData();
    writePDataArray< ValueType >( name, numberOfComponents );
 }
 
 template< typename Mesh >
-   template< typename ValueType >
+template< typename ValueType >
 void
-PVTUWriter< Mesh >::writePDataArray( const std::string& name,
-                                     const int numberOfComponents )
+PVTUWriter< Mesh >::writePDataArray( const std::string& name, const int numberOfComponents )
 {
    if( numberOfComponents != 0 && numberOfComponents != 1 && numberOfComponents != 3 )
-      throw std::logic_error("Unsupported numberOfComponents parameter: " + std::to_string(numberOfComponents));
+      throw std::logic_error( "Unsupported numberOfComponents parameter: " + std::to_string( numberOfComponents ) );
 
    str << "<PDataArray type=\"" << VTK::getTypeName( ValueType{} ) << "\" ";
    str << "Name=\"" << name << "\" ";
@@ -102,8 +97,7 @@ PVTUWriter< Mesh >::writePDataArray( const std::string& name,
 
 template< typename Mesh >
 std::string
-PVTUWriter< Mesh >::addPiece( const std::string& mainFileName,
-                              const unsigned subdomainIndex )
+PVTUWriter< Mesh >::addPiece( const std::string& mainFileName, const unsigned subdomainIndex )
 {
    namespace fs = std::experimental::filesystem;
 
@@ -111,8 +105,8 @@ PVTUWriter< Mesh >::addPiece( const std::string& mainFileName,
    const fs::path mainPath = mainFileName;
    const fs::path basename = mainPath.stem();
    if( mainPath.extension() != ".pvtu" )
-      throw std::logic_error("The mainFileName parameter must be the name of the "
-                             ".pvtu file (i.e., it must have the .pvtu suffix).");
+      throw std::logic_error( "The mainFileName parameter must be the name of the "
+                              ".pvtu file (i.e., it must have the .pvtu suffix)." );
 
    // close PCellData and PPointData sections
    closePCellData();
@@ -123,7 +117,7 @@ PVTUWriter< Mesh >::addPiece( const std::string& mainFileName,
    fs::create_directory( subdirectory );
 
    // write <Piece> tag
-   const std::string subfile = "subdomain." + std::to_string(subdomainIndex) + ".vtu";
+   const std::string subfile = "subdomain." + std::to_string( subdomainIndex ) + ".vtu";
    const std::string source = basename / subfile;
    str << "<Piece Source=\"" << source << "\"/>\n";
 
@@ -133,8 +127,7 @@ PVTUWriter< Mesh >::addPiece( const std::string& mainFileName,
 
 template< typename Mesh >
 std::string
-PVTUWriter< Mesh >::addPiece( const std::string& mainFileName,
-                              const MPI_Comm communicator )
+PVTUWriter< Mesh >::addPiece( const std::string& mainFileName, const MPI_Comm communicator )
 {
    std::string source;
    for( int i = 0; i < MPI::GetSize( communicator ); i++ ) {
@@ -147,8 +140,7 @@ PVTUWriter< Mesh >::addPiece( const std::string& mainFileName,
 
 template< typename Mesh >
 void
-PVTUWriter< Mesh >::writeHeader( const unsigned GhostLevel,
-                                 const unsigned MinCommonVertices )
+PVTUWriter< Mesh >::writeHeader( const unsigned GhostLevel, const unsigned MinCommonVertices )
 {
    str << "<?xml version=\"1.0\"?>\n";
    str << "<VTKFile type=\"PUnstructuredGrid\" version=\"1.0\"";
@@ -201,7 +193,7 @@ void
 PVTUWriter< Mesh >::openPCellData()
 {
    if( pCellDataClosed )
-      throw std::logic_error("The <PCellData> tag has already been closed.");
+      throw std::logic_error( "The <PCellData> tag has already been closed." );
    closePPointData();
    if( ! pCellDataOpen ) {
       str << "<PCellData>\n";
@@ -225,7 +217,7 @@ void
 PVTUWriter< Mesh >::openPPointData()
 {
    if( pPointDataClosed )
-      throw std::logic_error("The <PPointData> tag has already been closed.");
+      throw std::logic_error( "The <PPointData> tag has already been closed." );
    closePCellData();
    if( ! pPointDataOpen ) {
       str << "<PPointData>\n";
@@ -244,6 +236,6 @@ PVTUWriter< Mesh >::closePPointData()
    }
 }
 
-} // namespace Writers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Writers
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Writers/VTIWriter.h b/src/TNL/Meshes/Writers/VTIWriter.h
index 1537bbf4930afddbfd2157bb2843a8d520ad2a35..c1cda1dbb4eb158230a311d7bb34f62f3975b33a 100644
--- a/src/TNL/Meshes/Writers/VTIWriter.h
+++ b/src/TNL/Meshes/Writers/VTIWriter.h
@@ -23,54 +23,57 @@ class VTIWriter
 {
    static_assert( Mesh::getMeshDimension() <= 3, "The VTK format supports only 1D, 2D and 3D meshes." );
 
-//   using HeaderType = std::uint64_t;
+   //   using HeaderType = std::uint64_t;
    // LOL, VTK does not support signed header types (but the GridTypeResolver maps unsigned types to signed, so we are good)
    using HeaderType = std::make_unsigned_t< typename Mesh::GlobalIndexType >;
-public:
 
+public:
    VTIWriter() = delete;
 
    VTIWriter( std::ostream& str, VTK::FileFormat format = VTK::FileFormat::zlib_compressed )
-   : str(str.rdbuf()), format(format)
+   : str( str.rdbuf() ), format( format )
    {}
 
    // If desired, cycle and time of the simulation can put into the file. This follows the instructions at
    // http://www.visitusers.org/index.php?title=Time_and_Cycle_in_VTK_files
-   void writeMetadata( std::int32_t cycle = -1, double time = -1 );
+   void
+   writeMetadata( std::int32_t cycle = -1, double time = -1 );
 
    // low-level writing method (used also when writing a subdomain for a PVTI dataset)
-   void writeImageData( const typename Mesh::PointType& origin,
-                        const typename Mesh::CoordinatesType& begin,
-                        const typename Mesh::CoordinatesType& end,
-                        const typename Mesh::PointType& spaceSteps );
+   void
+   writeImageData( const typename Mesh::PointType& origin,
+                   const typename Mesh::CoordinatesType& begin,
+                   const typename Mesh::CoordinatesType& end,
+                   const typename Mesh::PointType& spaceSteps );
 
-   void writeImageData( const Mesh& mesh );
+   void
+   writeImageData( const Mesh& mesh );
 
    // Only for compatibility with VTUWriter - calls writeImageData, the EntityDimension is unused
    template< int EntityDimension = Mesh::getMeshDimension() >
-   void writeEntities( const Mesh& mesh );
+   void
+   writeEntities( const Mesh& mesh );
 
    template< typename Array >
-   void writePointData( const Array& array,
-                        const std::string& name,
-                        const int numberOfComponents = 1 );
+   void
+   writePointData( const Array& array, const std::string& name, int numberOfComponents = 1 );
 
    template< typename Array >
-   void writeCellData( const Array& array,
-                       const std::string& name,
-                       const int numberOfComponents = 1 );
+   void
+   writeCellData( const Array& array, const std::string& name, int numberOfComponents = 1 );
 
    template< typename Array >
-   void writeDataArray( const Array& array,
-                        const std::string& name,
-                        const int numberOfComponents = 1 );
+   void
+   writeDataArray( const Array& array, const std::string& name, int numberOfComponents = 1 );
 
    ~VTIWriter();
 
 protected:
-   void writeHeader();
+   void
+   writeHeader();
 
-   void writeFooter();
+   void
+   writeFooter();
 
    std::ostream str;
 
@@ -104,16 +107,21 @@ protected:
    bool pointDataOpen = false;
    bool pointDataClosed = false;
 
-   void openCellData();
-   void closeCellData();
-   void openPointData();
-   void closePointData();
-
-   void closePiece();
+   void
+   openCellData();
+   void
+   closeCellData();
+   void
+   openPointData();
+   void
+   closePointData();
+
+   void
+   closePiece();
 };
 
-} // namespace Writers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Writers
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/Writers/VTIWriter.hpp>
diff --git a/src/TNL/Meshes/Writers/VTIWriter.hpp b/src/TNL/Meshes/Writers/VTIWriter.hpp
index d477006d7b7d45bedf14eb49bf45937624c43763..362e7b24336c77ea51e70d28885f161ed2f60a91 100644
--- a/src/TNL/Meshes/Writers/VTIWriter.hpp
+++ b/src/TNL/Meshes/Writers/VTIWriter.hpp
@@ -30,19 +30,20 @@ VTIWriter< Mesh >::writeMetadata( int cycle, double time )
    if( ! vtkfileOpen )
       writeHeader();
    if( imageDataOpen )
-      throw std::logic_error("The <ImageData> tag is already open, but writeMetadata should be called before writeImageData.");
+      throw std::logic_error(
+         "The <ImageData> tag is already open, but writeMetadata should be called before writeImageData." );
 
    if( cycle >= 0 || time >= 0 )
       metadata << "<FieldData>\n";
 
    if( cycle >= 0 ) {
-      metadata << "<DataArray type=\"Int32\" Name=\"CYCLE\" NumberOfTuples=\"1\" format=\"ascii\">"
-               << cycle << "</DataArray>\n";
+      metadata << "<DataArray type=\"Int32\" Name=\"CYCLE\" NumberOfTuples=\"1\" format=\"ascii\">" << cycle
+               << "</DataArray>\n";
    }
    if( time >= 0 ) {
       metadata.precision( std::numeric_limits< double >::digits10 );
-      metadata << "<DataArray type=\"Float64\" Name=\"TIME\" NumberOfTuples=\"1\" format=\"ascii\">"
-               << time << "</DataArray>\n";
+      metadata << "<DataArray type=\"Float64\" Name=\"TIME\" NumberOfTuples=\"1\" format=\"ascii\">" << time
+               << "</DataArray>\n";
    }
 
    if( cycle >= 0 || time >= 0 )
@@ -59,12 +60,14 @@ VTIWriter< Mesh >::writeImageData( const typename Mesh::PointType& gridOrigin,
    if( ! vtkfileOpen )
       writeHeader();
    if( imageDataOpen )
-      throw std::logic_error("The <ImageData> tag is already open.");
+      throw std::logic_error( "The <ImageData> tag is already open." );
 
-   std::stringstream extent, origin, spacing;
+   std::stringstream extent;
+   std::stringstream origin;
+   std::stringstream spacing;
 
    for( int j = 0; j < Mesh::getMeshDimension(); j++ )
-      extent << begin[ j ] <<  " " << end[ j ] << " ";
+      extent << begin[ j ] << " " << end[ j ] << " ";
    // VTK knows only 3D grids
    for( int j = Mesh::getMeshDimension(); j < 3; j++ )
       extent << "0 0 ";
@@ -81,7 +84,8 @@ VTIWriter< Mesh >::writeImageData( const typename Mesh::PointType& gridOrigin,
    for( int j = Mesh::getMeshDimension(); j < 3; j++ )
       spacing << 0 << " ";
 
-   str << "<ImageData WholeExtent=\"" << extent.str() << "\" Origin=\"" << origin.str() << "\" Spacing=\"" << spacing.str() << "\">\n";
+   str << "<ImageData WholeExtent=\"" << extent.str() << "\" Origin=\"" << origin.str() << "\" Spacing=\"" << spacing.str()
+       << "\">\n";
    imageDataOpen = true;
 
    str << "<Piece Extent=\"" << extent.str() << "\">\n";
@@ -106,7 +110,7 @@ VTIWriter< Mesh >::writeImageData( const Mesh& mesh )
 }
 
 template< typename Mesh >
-   template< int EntityDimension >
+template< int EntityDimension >
 void
 VTIWriter< Mesh >::writeEntities( const Mesh& mesh )
 {
@@ -114,48 +118,42 @@ VTIWriter< Mesh >::writeEntities( const Mesh& mesh )
 }
 
 template< typename Mesh >
-   template< typename Array >
+template< typename Array >
 void
-VTIWriter< Mesh >::writePointData( const Array& array,
-                                   const std::string& name,
-                                   const int numberOfComponents )
+VTIWriter< Mesh >::writePointData( const Array& array, const std::string& name, const int numberOfComponents )
 {
    if( ! pieceOpen )
-      throw std::logic_error("The <Piece> tag has not been opened yet - call writeEntities first.");
-   if( array.getSize() / numberOfComponents != typename Array::IndexType(pointsCount) )
-      throw std::length_error("Mismatched array size for <PointData> section: " + std::to_string(array.getSize())
-                              + " (there are " + std::to_string(pointsCount) + " points in the file)");
+      throw std::logic_error( "The <Piece> tag has not been opened yet - call writeEntities first." );
+   if( array.getSize() / numberOfComponents != typename Array::IndexType( pointsCount ) )
+      throw std::length_error( "Mismatched array size for <PointData> section: " + std::to_string( array.getSize() )
+                               + " (there are " + std::to_string( pointsCount ) + " points in the file)" );
    openPointData();
    writeDataArray( array, name, numberOfComponents );
 }
 
 template< typename Mesh >
-   template< typename Array >
+template< typename Array >
 void
-VTIWriter< Mesh >::writeCellData( const Array& array,
-                                  const std::string& name,
-                                  const int numberOfComponents )
+VTIWriter< Mesh >::writeCellData( const Array& array, const std::string& name, const int numberOfComponents )
 {
    if( ! pieceOpen )
-      throw std::logic_error("The <Piece> tag has not been opened yet - call writeEntities first.");
-   if( array.getSize() / numberOfComponents != typename Array::IndexType(cellsCount) )
-      throw std::length_error("Mismatched array size for <CellData> section: " + std::to_string(array.getSize())
-                              + " (there are " + std::to_string(cellsCount) + " cells in the file)");
+      throw std::logic_error( "The <Piece> tag has not been opened yet - call writeEntities first." );
+   if( array.getSize() / numberOfComponents != typename Array::IndexType( cellsCount ) )
+      throw std::length_error( "Mismatched array size for <CellData> section: " + std::to_string( array.getSize() )
+                               + " (there are " + std::to_string( cellsCount ) + " cells in the file)" );
    openCellData();
    writeDataArray( array, name, numberOfComponents );
 }
 
 template< typename Mesh >
-   template< typename Array >
+template< typename Array >
 void
-VTIWriter< Mesh >::writeDataArray( const Array& array,
-                                   const std::string& name,
-                                   const int numberOfComponents )
+VTIWriter< Mesh >::writeDataArray( const Array& array, const std::string& name, const int numberOfComponents )
 {
    // use a host buffer if direct access to the array elements is not possible
-   if( std::is_same< typename Array::DeviceType, Devices::Cuda >::value )
-   {
-      using HostArray = typename Array::template Self< std::remove_const_t< typename Array::ValueType >, Devices::Host, typename Array::IndexType >;
+   if( std::is_same< typename Array::DeviceType, Devices::Cuda >::value ) {
+      using HostArray = typename Array::
+         template Self< std::remove_const_t< typename Array::ValueType >, Devices::Host, typename Array::IndexType >;
       HostArray hostBuffer;
       hostBuffer = array;
       writeDataArray( hostBuffer, name, numberOfComponents );
@@ -163,24 +161,23 @@ VTIWriter< Mesh >::writeDataArray( const Array& array,
    }
 
    if( numberOfComponents != 0 && numberOfComponents != 1 && numberOfComponents != 3 )
-      throw std::logic_error("Unsupported numberOfComponents parameter: " + std::to_string(numberOfComponents));
+      throw std::logic_error( "Unsupported numberOfComponents parameter: " + std::to_string( numberOfComponents ) );
 
    // write DataArray header
-   str << "<DataArray type=\"" << VTK::getTypeName( array[0] ) << "\"";
+   str << "<DataArray type=\"" << VTK::getTypeName( array[ 0 ] ) << "\"";
    str << " Name=\"" << name << "\"";
    if( numberOfComponents > 0 )
       str << " NumberOfComponents=\"" << numberOfComponents << "\"";
-   str << " format=\"" << ((format == VTK::FileFormat::ascii) ? "ascii" : "binary") << "\">\n";
+   str << " format=\"" << ( ( format == VTK::FileFormat::ascii ) ? "ascii" : "binary" ) << "\">\n";
 
-   switch( format )
-   {
+   switch( format ) {
       case VTK::FileFormat::ascii:
          str.precision( std::numeric_limits< typename Array::ValueType >::digits10 );
          for( typename Array::IndexType i = 0; i < array.getSize(); i++ )
             // If Array::ValueType is uint8_t, it might be a typedef for unsigned char, which
             // would be normally printed as char rather than a number. Hence, we use the trick
             // with unary operator+, see https://stackoverflow.com/a/28414758
-            str << +array[i] << " ";
+            str << +array[ i ] << " ";
          str << "\n";
          break;
       case VTK::FileFormat::zlib_compressed:
@@ -241,7 +238,7 @@ void
 VTIWriter< Mesh >::openCellData()
 {
    if( cellDataClosed )
-      throw std::logic_error("The <CellData> tag has already been closed in the current <Piece> section.");
+      throw std::logic_error( "The <CellData> tag has already been closed in the current <Piece> section." );
    closePointData();
    if( ! cellDataOpen ) {
       str << "<CellData>\n";
@@ -265,7 +262,7 @@ void
 VTIWriter< Mesh >::openPointData()
 {
    if( pointDataClosed )
-      throw std::logic_error("The <PointData> tag has already been closed in the current <Piece> section.");
+      throw std::logic_error( "The <PointData> tag has already been closed in the current <Piece> section." );
    closeCellData();
    if( ! pointDataOpen ) {
       str << "<PointData>\n";
@@ -300,6 +297,6 @@ VTIWriter< Mesh >::closePiece()
    }
 }
 
-} // namespace Writers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Writers
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Writers/VTKWriter.h b/src/TNL/Meshes/Writers/VTKWriter.h
index 3a7eed9161fa54f15a18fa2cd2408a5cb2775ab7..576a8a321cc4d8e4b0d62a973929f7eb9f9c9f91 100644
--- a/src/TNL/Meshes/Writers/VTKWriter.h
+++ b/src/TNL/Meshes/Writers/VTKWriter.h
@@ -20,45 +20,44 @@ class VTKWriter
 {
    static_assert( Mesh::getMeshDimension() <= 3, "The VTK format supports only 1D, 2D and 3D meshes." );
    // TODO: check also space dimension when grids allow it
-//   static_assert( Mesh::getSpaceDimension() <= 3, "The VTK format supports only 1D, 2D and 3D meshes." );
+   //   static_assert( Mesh::getSpaceDimension() <= 3, "The VTK format supports only 1D, 2D and 3D meshes." );
 
 public:
-
    VTKWriter() = delete;
 
-   VTKWriter( std::ostream& str, VTK::FileFormat format = VTK::FileFormat::binary )
-   : str(str.rdbuf()), format(format)
+   VTKWriter( std::ostream& str, VTK::FileFormat format = VTK::FileFormat::binary ) : str( str.rdbuf() ), format( format )
    {
       if( format != VTK::FileFormat::ascii && format != VTK::FileFormat::binary )
-         throw std::domain_error("The Legacy VTK file formats support only ASCII and BINARY formats.");
+         throw std::domain_error( "The Legacy VTK file formats support only ASCII and BINARY formats." );
    }
 
    // If desired, cycle and time of the simulation can put into the file. This follows the instructions at
    // http://www.visitusers.org/index.php?title=Time_and_Cycle_in_VTK_files
-   void writeMetadata( std::int32_t cycle = -1, double time = -1 );
+   void
+   writeMetadata( std::int32_t cycle = -1, double time = -1 );
 
    template< int EntityDimension = Mesh::getMeshDimension() >
-   void writeEntities( const Mesh& mesh );
+   void
+   writeEntities( const Mesh& mesh );
 
    template< typename Array >
-   void writePointData( const Array& array,
-                        const std::string& name,
-                        const int numberOfComponents = 1 );
+   void
+   writePointData( const Array& array, const std::string& name, int numberOfComponents = 1 );
 
    template< typename Array >
-   void writeCellData( const Array& array,
-                       const std::string& name,
-                       const int numberOfComponents = 1 );
+   void
+   writeCellData( const Array& array, const std::string& name, int numberOfComponents = 1 );
 
    template< typename Array >
-   void writeDataArray( const Array& array,
-                        const std::string& name,
-                        const int numberOfComponents = 1 );
+   void
+   writeDataArray( const Array& array, const std::string& name, int numberOfComponents = 1 );
 
 protected:
-   void writePoints( const Mesh& mesh );
+   void
+   writePoints( const Mesh& mesh );
 
-   void writeHeader();
+   void
+   writeHeader();
 
    std::ostream str;
 
@@ -81,8 +80,8 @@ protected:
    VTK::DataType currentSection = VTK::DataType::CellData;
 };
 
-} // namespace Writers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Writers
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/Writers/VTKWriter.hpp>
diff --git a/src/TNL/Meshes/Writers/VTKWriter.hpp b/src/TNL/Meshes/Writers/VTKWriter.hpp
index 1de7c0236ef7406ee87e21585ba21405cd9383a6..5a3b2f7f0256d523345f23a07b8bb92dfe119ee2 100644
--- a/src/TNL/Meshes/Writers/VTKWriter.hpp
+++ b/src/TNL/Meshes/Writers/VTKWriter.hpp
@@ -44,7 +44,7 @@ VTKWriter< Mesh >::writeMetadata( int cycle, double time )
 }
 
 template< typename Mesh >
-   template< int EntityDimension >
+template< int EntityDimension >
 void
 VTKWriter< Mesh >::writeEntities( const Mesh& mesh )
 {
@@ -70,19 +70,17 @@ VTKWriter< Mesh >::writeEntities( const Mesh& mesh )
 }
 
 template< typename Mesh >
-   template< typename Array >
+template< typename Array >
 void
-VTKWriter< Mesh >::writePointData( const Array& array,
-                                   const std::string& name,
-                                   const int numberOfComponents )
+VTKWriter< Mesh >::writePointData( const Array& array, const std::string& name, const int numberOfComponents )
 {
-   if( array.getSize() / numberOfComponents != typename Array::IndexType(pointsCount) )
-      throw std::length_error("Mismatched array size for POINT_DATA section: " + std::to_string(array.getSize())
-                              + " (there are " + std::to_string(pointsCount) + " points in the file)");
+   if( array.getSize() / numberOfComponents != typename Array::IndexType( pointsCount ) )
+      throw std::length_error( "Mismatched array size for POINT_DATA section: " + std::to_string( array.getSize() )
+                               + " (there are " + std::to_string( pointsCount ) + " points in the file)" );
 
    // check that we won't start the section second time
    if( currentSection != VTK::DataType::PointData && cellDataArrays * pointDataArrays != 0 )
-      throw std::logic_error("The requested data section is not the current section and it has already been written.");
+      throw std::logic_error( "The requested data section is not the current section and it has already been written." );
    currentSection = VTK::DataType::PointData;
 
    // start the appropriate section if necessary
@@ -94,19 +92,17 @@ VTKWriter< Mesh >::writePointData( const Array& array,
 }
 
 template< typename Mesh >
-   template< typename Array >
+template< typename Array >
 void
-VTKWriter< Mesh >::writeCellData( const Array& array,
-                                  const std::string& name,
-                                  const int numberOfComponents )
+VTKWriter< Mesh >::writeCellData( const Array& array, const std::string& name, const int numberOfComponents )
 {
-   if( array.getSize() / numberOfComponents != typename Array::IndexType(cellsCount) )
-      throw std::length_error("Mismatched array size for CELL_DATA section: " + std::to_string(array.getSize())
-                              + " (there are " + std::to_string(cellsCount) + " cells in the file)");
+   if( array.getSize() / numberOfComponents != typename Array::IndexType( cellsCount ) )
+      throw std::length_error( "Mismatched array size for CELL_DATA section: " + std::to_string( array.getSize() )
+                               + " (there are " + std::to_string( cellsCount ) + " cells in the file)" );
 
    // check that we won't start the section second time
    if( currentSection != VTK::DataType::CellData && cellDataArrays * pointDataArrays != 0 )
-      throw std::logic_error("The requested data section is not the current section and it has already been written.");
+      throw std::logic_error( "The requested data section is not the current section and it has already been written." );
    currentSection = VTK::DataType::CellData;
 
    // start the appropriate section if necessary
@@ -118,16 +114,14 @@ VTKWriter< Mesh >::writeCellData( const Array& array,
 }
 
 template< typename Mesh >
-   template< typename Array >
+template< typename Array >
 void
-VTKWriter< Mesh >::writeDataArray( const Array& array,
-                                   const std::string& name,
-                                   const int numberOfComponents )
+VTKWriter< Mesh >::writeDataArray( const Array& array, const std::string& name, const int numberOfComponents )
 {
    // use a host buffer if direct access to the array elements is not possible
-   if( std::is_same< typename Array::DeviceType, Devices::Cuda >::value )
-   {
-      using HostArray = typename Array::template Self< std::remove_const_t< typename Array::ValueType >, Devices::Host, typename Array::IndexType >;
+   if( std::is_same< typename Array::DeviceType, Devices::Cuda >::value ) {
+      using HostArray = typename Array::
+         template Self< std::remove_const_t< typename Array::ValueType >, Devices::Host, typename Array::IndexType >;
       HostArray hostBuffer;
       hostBuffer = array;
       writeDataArray( hostBuffer, name, numberOfComponents );
@@ -135,7 +129,7 @@ VTKWriter< Mesh >::writeDataArray( const Array& array,
    }
 
    if( numberOfComponents != 1 && numberOfComponents != 3 )
-      throw std::logic_error("Unsupported numberOfComponents parameter: " + std::to_string(numberOfComponents));
+      throw std::logic_error( "Unsupported numberOfComponents parameter: " + std::to_string( numberOfComponents ) );
 
    // write DataArray header
    if( numberOfComponents == 1 ) {
@@ -148,7 +142,7 @@ VTKWriter< Mesh >::writeDataArray( const Array& array,
 
    using detail::writeValue;
    for( typename Array::IndexType i = 0; i < array.getSize(); i++ ) {
-      writeValue( format, str, array[i] );
+      writeValue( format, str, array[ i ] );
       if( format == VTK::FileFormat::ascii )
          str << "\n";
    }
@@ -180,11 +174,10 @@ VTKWriter< Mesh >::writeHeader()
 {
    str << "# vtk DataFile Version 5.1\n"
        << "TNL DATA\n"
-       << ((format == VTK::FileFormat::ascii) ? "ASCII\n" : "BINARY\n")
-       << "DATASET UNSTRUCTURED_GRID\n";
+       << ( ( format == VTK::FileFormat::ascii ) ? "ASCII\n" : "BINARY\n" ) << "DATASET UNSTRUCTURED_GRID\n";
    headerWritten = true;
 }
 
-} // namespace Writers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Writers
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Writers/VTUWriter.h b/src/TNL/Meshes/Writers/VTUWriter.h
index e185b8e1f0221cdac5113a6eca24777d5657de5f..c9ee657fef29b75390a21ea52cc80ed0beed7a0c 100644
--- a/src/TNL/Meshes/Writers/VTUWriter.h
+++ b/src/TNL/Meshes/Writers/VTUWriter.h
@@ -21,47 +21,49 @@ class VTUWriter
 {
    static_assert( Mesh::getMeshDimension() <= 3, "The VTK format supports only 1D, 2D and 3D meshes." );
    // TODO: check also space dimension when grids allow it
-//   static_assert( Mesh::getSpaceDimension() <= 3, "The VTK format supports only 1D, 2D and 3D meshes." );
+   //   static_assert( Mesh::getSpaceDimension() <= 3, "The VTK format supports only 1D, 2D and 3D meshes." );
 
    using HeaderType = std::uint64_t;
-public:
 
+public:
    VTUWriter() = delete;
 
    VTUWriter( std::ostream& str, VTK::FileFormat format = VTK::FileFormat::zlib_compressed )
-   : str(str.rdbuf()), format(format)
+   : str( str.rdbuf() ), format( format )
    {}
 
    // If desired, cycle and time of the simulation can put into the file. This follows the instructions at
    // http://www.visitusers.org/index.php?title=Time_and_Cycle_in_VTK_files
-   void writeMetadata( std::int32_t cycle = -1, double time = -1 );
+   void
+   writeMetadata( std::int32_t cycle = -1, double time = -1 );
 
    template< int EntityDimension = Mesh::getMeshDimension() >
-   void writeEntities( const Mesh& mesh );
+   void
+   writeEntities( const Mesh& mesh );
 
    template< typename Array >
-   void writePointData( const Array& array,
-                        const std::string& name,
-                        const int numberOfComponents = 1 );
+   void
+   writePointData( const Array& array, const std::string& name, int numberOfComponents = 1 );
 
    template< typename Array >
-   void writeCellData( const Array& array,
-                       const std::string& name,
-                       const int numberOfComponents = 1 );
+   void
+   writeCellData( const Array& array, const std::string& name, int numberOfComponents = 1 );
 
    template< typename Array >
-   void writeDataArray( const Array& array,
-                        const std::string& name,
-                        const int numberOfComponents = 1 );
+   void
+   writeDataArray( const Array& array, const std::string& name, int numberOfComponents = 1 );
 
    ~VTUWriter();
 
 protected:
-   void writePoints( const Mesh& mesh );
+   void
+   writePoints( const Mesh& mesh );
 
-   void writeHeader();
+   void
+   writeHeader();
 
-   void writeFooter();
+   void
+   writeFooter();
 
    std::ostream str;
 
@@ -87,16 +89,21 @@ protected:
    bool pointDataOpen = false;
    bool pointDataClosed = false;
 
-   void openCellData();
-   void closeCellData();
-   void openPointData();
-   void closePointData();
-
-   void closePiece();
+   void
+   openCellData();
+   void
+   closeCellData();
+   void
+   openPointData();
+   void
+   closePointData();
+
+   void
+   closePiece();
 };
 
-} // namespace Writers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Writers
+}  // namespace Meshes
+}  // namespace TNL
 
 #include <TNL/Meshes/Writers/VTUWriter.hpp>
diff --git a/src/TNL/Meshes/Writers/VTUWriter.hpp b/src/TNL/Meshes/Writers/VTUWriter.hpp
index 528aa0eb0032c2a0160272a49a5d7b55984ac488..6a945dc337254f7709312aef1facb9ded115625d 100644
--- a/src/TNL/Meshes/Writers/VTUWriter.hpp
+++ b/src/TNL/Meshes/Writers/VTUWriter.hpp
@@ -35,13 +35,11 @@ VTUWriter< Mesh >::writeMetadata( int cycle, double time )
       str << "<FieldData>\n";
 
    if( cycle >= 0 ) {
-      str << "<DataArray type=\"Int32\" Name=\"CYCLE\" NumberOfTuples=\"1\" format=\"ascii\">"
-          << cycle << "</DataArray>\n";
+      str << "<DataArray type=\"Int32\" Name=\"CYCLE\" NumberOfTuples=\"1\" format=\"ascii\">" << cycle << "</DataArray>\n";
    }
    if( time >= 0 ) {
       str.precision( std::numeric_limits< double >::digits10 );
-      str << "<DataArray type=\"Float64\" Name=\"TIME\" NumberOfTuples=\"1\" format=\"ascii\">"
-          << time << "</DataArray>\n";
+      str << "<DataArray type=\"Float64\" Name=\"TIME\" NumberOfTuples=\"1\" format=\"ascii\">" << time << "</DataArray>\n";
    }
 
    if( cycle >= 0 || time >= 0 )
@@ -49,7 +47,7 @@ VTUWriter< Mesh >::writeMetadata( int cycle, double time )
 }
 
 template< typename Mesh >
-   template< int EntityDimension >
+template< int EntityDimension >
 void
 VTUWriter< Mesh >::writeEntities( const Mesh& mesh )
 {
@@ -69,7 +67,8 @@ VTUWriter< Mesh >::writeEntities( const Mesh& mesh )
 
    // collect all data before writing
    using IndexType = typename Mesh::GlobalIndexType;
-   std::vector< IndexType > connectivity, offsets;
+   std::vector< IndexType > connectivity;
+   std::vector< IndexType > offsets;
    std::vector< std::uint8_t > types;
    detail::MeshEntitiesVTUCollector< Mesh, EntityDimension >::exec( mesh, connectivity, offsets, types );
 
@@ -89,48 +88,42 @@ VTUWriter< Mesh >::writeEntities( const Mesh& mesh )
 }
 
 template< typename Mesh >
-   template< typename Array >
+template< typename Array >
 void
-VTUWriter< Mesh >::writePointData( const Array& array,
-                                   const std::string& name,
-                                   const int numberOfComponents )
+VTUWriter< Mesh >::writePointData( const Array& array, const std::string& name, const int numberOfComponents )
 {
    if( ! pieceOpen )
-      throw std::logic_error("The <Piece> tag has not been opened yet - call writeEntities first.");
-   if( array.getSize() / numberOfComponents != typename Array::IndexType(pointsCount) )
-      throw std::length_error("Mismatched array size for <PointData> section: " + std::to_string(array.getSize())
-                              + " (there are " + std::to_string(pointsCount) + " points in the file)");
+      throw std::logic_error( "The <Piece> tag has not been opened yet - call writeEntities first." );
+   if( array.getSize() / numberOfComponents != typename Array::IndexType( pointsCount ) )
+      throw std::length_error( "Mismatched array size for <PointData> section: " + std::to_string( array.getSize() )
+                               + " (there are " + std::to_string( pointsCount ) + " points in the file)" );
    openPointData();
    writeDataArray( array, name, numberOfComponents );
 }
 
 template< typename Mesh >
-   template< typename Array >
+template< typename Array >
 void
-VTUWriter< Mesh >::writeCellData( const Array& array,
-                                  const std::string& name,
-                                  const int numberOfComponents )
+VTUWriter< Mesh >::writeCellData( const Array& array, const std::string& name, const int numberOfComponents )
 {
    if( ! pieceOpen )
-      throw std::logic_error("The <Piece> tag has not been opened yet - call writeEntities first.");
-   if( array.getSize() / numberOfComponents != typename Array::IndexType(cellsCount) )
-      throw std::length_error("Mismatched array size for <CellData> section: " + std::to_string(array.getSize())
-                              + " (there are " + std::to_string(cellsCount) + " cells in the file)");
+      throw std::logic_error( "The <Piece> tag has not been opened yet - call writeEntities first." );
+   if( array.getSize() / numberOfComponents != typename Array::IndexType( cellsCount ) )
+      throw std::length_error( "Mismatched array size for <CellData> section: " + std::to_string( array.getSize() )
+                               + " (there are " + std::to_string( cellsCount ) + " cells in the file)" );
    openCellData();
    writeDataArray( array, name, numberOfComponents );
 }
 
 template< typename Mesh >
-   template< typename Array >
+template< typename Array >
 void
-VTUWriter< Mesh >::writeDataArray( const Array& array,
-                                   const std::string& name,
-                                   const int numberOfComponents )
+VTUWriter< Mesh >::writeDataArray( const Array& array, const std::string& name, const int numberOfComponents )
 {
    // use a host buffer if direct access to the array elements is not possible
-   if( std::is_same< typename Array::DeviceType, Devices::Cuda >::value )
-   {
-      using HostArray = typename Array::template Self< std::remove_const_t< typename Array::ValueType >, Devices::Host, typename Array::IndexType >;
+   if( std::is_same< typename Array::DeviceType, Devices::Cuda >::value ) {
+      using HostArray = typename Array::
+         template Self< std::remove_const_t< typename Array::ValueType >, Devices::Host, typename Array::IndexType >;
       HostArray hostBuffer;
       hostBuffer = array;
       writeDataArray( hostBuffer, name, numberOfComponents );
@@ -138,25 +131,24 @@ VTUWriter< Mesh >::writeDataArray( const Array& array,
    }
 
    if( numberOfComponents != 0 && numberOfComponents != 1 && numberOfComponents != 3 )
-      throw std::logic_error("Unsupported numberOfComponents parameter: " + std::to_string(numberOfComponents));
+      throw std::logic_error( "Unsupported numberOfComponents parameter: " + std::to_string( numberOfComponents ) );
 
    // write DataArray header
-   using ValueType = decltype(array[0]);
+   using ValueType = decltype( array[ 0 ] );
    str << "<DataArray type=\"" << VTK::getTypeName( ValueType{} ) << "\"";
    str << " Name=\"" << name << "\"";
    if( numberOfComponents > 0 )
       str << " NumberOfComponents=\"" << numberOfComponents << "\"";
-   str << " format=\"" << ((format == VTK::FileFormat::ascii) ? "ascii" : "binary") << "\">\n";
+   str << " format=\"" << ( ( format == VTK::FileFormat::ascii ) ? "ascii" : "binary" ) << "\">\n";
 
-   switch( format )
-   {
+   switch( format ) {
       case VTK::FileFormat::ascii:
          str.precision( std::numeric_limits< typename Array::ValueType >::digits10 );
          for( typename Array::IndexType i = 0; i < array.getSize(); i++ )
             // If Array::ValueType is uint8_t, it might be a typedef for unsigned char, which
             // would be normally printed as char rather than a number. Hence, we use the trick
             // with unary operator+, see https://stackoverflow.com/a/28414758
-            str << +array[i] << " ";
+            str << +array[ i ] << " ";
          str << "\n";
          break;
       case VTK::FileFormat::zlib_compressed:
@@ -242,7 +234,7 @@ void
 VTUWriter< Mesh >::openCellData()
 {
    if( cellDataClosed )
-      throw std::logic_error("The <CellData> tag has already been closed in the current <Piece> section.");
+      throw std::logic_error( "The <CellData> tag has already been closed in the current <Piece> section." );
    closePointData();
    if( ! cellDataOpen ) {
       str << "<CellData>\n";
@@ -266,7 +258,7 @@ void
 VTUWriter< Mesh >::openPointData()
 {
    if( pointDataClosed )
-      throw std::logic_error("The <PointData> tag has already been closed in the current <Piece> section.");
+      throw std::logic_error( "The <PointData> tag has already been closed in the current <Piece> section." );
    closeCellData();
    if( ! pointDataOpen ) {
       str << "<PointData>\n";
@@ -301,6 +293,6 @@ VTUWriter< Mesh >::closePiece()
    }
 }
 
-} // namespace Writers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace Writers
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Writers/detail/VTKMeshEntitiesWriter.h b/src/TNL/Meshes/Writers/detail/VTKMeshEntitiesWriter.h
index e96ed4f1566c322a131716b18e15c2fb88e3923b..faafaf39b819042aaf8e454c5cdc222dcaf27cdb 100644
--- a/src/TNL/Meshes/Writers/detail/VTKMeshEntitiesWriter.h
+++ b/src/TNL/Meshes/Writers/detail/VTKMeshEntitiesWriter.h
@@ -25,7 +25,7 @@ writeValue( VTK::FileFormat format, std::ostream& str, T value )
 {
    if( format == VTK::FileFormat::binary ) {
       value = forceBigEndian( value );
-      str.write( reinterpret_cast<const char*>(&value), sizeof(T) );
+      str.write( reinterpret_cast< const char* >( &value ), sizeof( T ) );
    }
    else {
       // precision affects only floating-point types, not integers
@@ -34,16 +34,14 @@ writeValue( VTK::FileFormat format, std::ostream& str, T value )
    }
 }
 
-
 // TODO: specialization for disabled entities
 // Unstructured meshes, entities
-template< typename Mesh,
-          int EntityDimension,
-          typename EntityType = typename Mesh::template EntityType< EntityDimension > >
+template< typename Mesh, int EntityDimension, typename EntityType = typename Mesh::template EntityType< EntityDimension > >
 struct VTKMeshEntitiesWriter
 {
    template< typename Index >
-   static void writeOffsets( const Mesh& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeOffsets( const Mesh& mesh, std::ostream& str, VTK::FileFormat format )
    {
       Index offset = 0;
       writeValue< Index >( format, str, offset );
@@ -60,7 +58,8 @@ struct VTKMeshEntitiesWriter
    }
 
    template< typename Index >
-   static void writeConnectivity( const Mesh& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeConnectivity( const Mesh& mesh, std::ostream& str, VTK::FileFormat format )
    {
       const Index entitiesCount = mesh.template getEntitiesCount< EntityType >();
       for( Index i = 0; i < entitiesCount; i++ ) {
@@ -79,7 +78,8 @@ template< typename Mesh >
 struct VTKMeshEntitiesWriter< Mesh, 3, MeshEntity< typename Mesh::Config, typename Mesh::DeviceType, Topologies::Polyhedron > >
 {
    template< typename Index >
-   static void writeOffsets( const Mesh& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeOffsets( const Mesh& mesh, std::ostream& str, VTK::FileFormat format )
    {
       Index offset = 0;
       writeValue< Index >( format, str, offset );
@@ -104,7 +104,8 @@ struct VTKMeshEntitiesWriter< Mesh, 3, MeshEntity< typename Mesh::Config, typena
    }
 
    template< typename Index >
-   static void writeConnectivity( const Mesh& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeConnectivity( const Mesh& mesh, std::ostream& str, VTK::FileFormat format )
    {
       const Index entitiesCount = mesh.template getEntitiesCount< 3 >();
       for( Index i = 0; i < entitiesCount; i++ ) {
@@ -132,7 +133,8 @@ template< typename Mesh >
 struct VTKMeshEntitiesWriter< Mesh, 0, MeshEntity< typename Mesh::Config, typename Mesh::DeviceType, Topologies::Vertex > >
 {
    template< typename Index >
-   static void writeOffsets( const Mesh& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeOffsets( const Mesh& mesh, std::ostream& str, VTK::FileFormat format )
    {
       using EntityType = typename Mesh::template EntityType< 0 >;
 
@@ -148,7 +150,8 @@ struct VTKMeshEntitiesWriter< Mesh, 0, MeshEntity< typename Mesh::Config, typena
    }
 
    template< typename Index >
-   static void writeConnectivity( const Mesh& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeConnectivity( const Mesh& mesh, std::ostream& str, VTK::FileFormat format )
    {
       using EntityType = typename Mesh::template EntityType< 0 >;
 
@@ -162,15 +165,14 @@ struct VTKMeshEntitiesWriter< Mesh, 0, MeshEntity< typename Mesh::Config, typena
 };
 
 // 1D grids, cells
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex >
+template< typename MeshReal, typename Device, typename MeshIndex >
 struct VTKMeshEntitiesWriter< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 1 >
 {
    using MeshType = Meshes::Grid< 1, MeshReal, Device, MeshIndex >;
 
    template< typename Index >
-   static void writeOffsets( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeOffsets( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
    {
       Index offset = 0;
       writeValue< Index >( format, str, offset );
@@ -185,11 +187,12 @@ struct VTKMeshEntitiesWriter< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 1
    }
 
    template< typename Index >
-   static void writeConnectivity( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeConnectivity( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
    {
       for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ ) {
          writeValue< Index >( format, str, i );
-         writeValue< Index >( format, str, i+1 );
+         writeValue< Index >( format, str, i + 1 );
          if( format == VTK::FileFormat::ascii )
             str << "\n";
       }
@@ -197,15 +200,14 @@ struct VTKMeshEntitiesWriter< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 1
 };
 
 // 1D grids, vertices
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex >
+template< typename MeshReal, typename Device, typename MeshIndex >
 struct VTKMeshEntitiesWriter< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 0 >
 {
    using MeshType = Meshes::Grid< 1, MeshReal, Device, MeshIndex >;
 
    template< typename Index >
-   static void writeOffsets( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeOffsets( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
    {
       Index offset = 0;
       writeValue< Index >( format, str, offset );
@@ -218,7 +220,8 @@ struct VTKMeshEntitiesWriter< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 0
    }
 
    template< typename Index >
-   static void writeConnectivity( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeConnectivity( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
    {
       for( MeshIndex i = 0; i < mesh.getDimensions().x() + 1; i++ ) {
          writeValue< Index >( format, str, i );
@@ -229,15 +232,14 @@ struct VTKMeshEntitiesWriter< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 0
 };
 
 // 2D grids, cells
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex >
+template< typename MeshReal, typename Device, typename MeshIndex >
 struct VTKMeshEntitiesWriter< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 2 >
 {
    using MeshType = Meshes::Grid< 2, MeshReal, Device, MeshIndex >;
 
    template< typename Index >
-   static void writeOffsets( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeOffsets( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
    {
       Index offset = 0;
       writeValue< Index >( format, str, offset );
@@ -253,31 +255,30 @@ struct VTKMeshEntitiesWriter< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 2
    }
 
    template< typename Index >
-   static void writeConnectivity( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeConnectivity( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
    {
       for( MeshIndex j = 0; j < mesh.getDimensions().y(); j++ )
-      for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ )
-      {
-         writeValue< Index >( format, str, j * ( mesh.getDimensions().x() + 1 ) + i );
-         writeValue< Index >( format, str, j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         writeValue< Index >( format, str, (j+1) * ( mesh.getDimensions().x() + 1 ) + i );
-         writeValue< Index >( format, str, (j+1) * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         if( format == VTK::FileFormat::ascii )
-            str << "\n";
-      }
+         for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ ) {
+            writeValue< Index >( format, str, j * ( mesh.getDimensions().x() + 1 ) + i );
+            writeValue< Index >( format, str, j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+            writeValue< Index >( format, str, ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i );
+            writeValue< Index >( format, str, ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+            if( format == VTK::FileFormat::ascii )
+               str << "\n";
+         }
    }
 };
 
 // 2D grids, faces
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex >
+template< typename MeshReal, typename Device, typename MeshIndex >
 struct VTKMeshEntitiesWriter< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 1 >
 {
    using MeshType = Meshes::Grid< 2, MeshReal, Device, MeshIndex >;
 
    template< typename Index >
-   static void writeOffsets( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeOffsets( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
    {
       Index offset = 0;
       writeValue< Index >( format, str, offset );
@@ -288,7 +289,7 @@ struct VTKMeshEntitiesWriter< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 1
             writeValue< Index >( format, str, offset );
          }
 
-      for( MeshIndex j = 0; j < (mesh.getDimensions().y()+1); j++ )
+      for( MeshIndex j = 0; j < ( mesh.getDimensions().y() + 1 ); j++ )
          for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ ) {
             offset += 2;
             writeValue< Index >( format, str, offset );
@@ -299,38 +300,36 @@ struct VTKMeshEntitiesWriter< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 1
    }
 
    template< typename Index >
-   static void writeConnectivity( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeConnectivity( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
    {
       for( MeshIndex j = 0; j < mesh.getDimensions().y(); j++ )
-      for( MeshIndex i = 0; i < ( mesh.getDimensions().x() + 1 ); i++ )
-      {
-         writeValue< Index >( format, str, j * ( mesh.getDimensions().x() + 1 ) + i );
-         writeValue< Index >( format, str, (j+1) * ( mesh.getDimensions().x() + 1 ) + i );
-         if( format == VTK::FileFormat::ascii )
-            str << "\n";
-      }
+         for( MeshIndex i = 0; i < ( mesh.getDimensions().x() + 1 ); i++ ) {
+            writeValue< Index >( format, str, j * ( mesh.getDimensions().x() + 1 ) + i );
+            writeValue< Index >( format, str, ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i );
+            if( format == VTK::FileFormat::ascii )
+               str << "\n";
+         }
 
-      for( MeshIndex j = 0; j < (mesh.getDimensions().y()+1); j++ )
-      for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ )
-      {
-         writeValue< Index >( format, str, j * ( mesh.getDimensions().x() + 1 ) + i );
-         writeValue< Index >( format, str, j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         if( format == VTK::FileFormat::ascii )
-            str << "\n";
-      }
+      for( MeshIndex j = 0; j < ( mesh.getDimensions().y() + 1 ); j++ )
+         for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ ) {
+            writeValue< Index >( format, str, j * ( mesh.getDimensions().x() + 1 ) + i );
+            writeValue< Index >( format, str, j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+            if( format == VTK::FileFormat::ascii )
+               str << "\n";
+         }
    }
 };
 
 // 2D grids, vertices
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex >
+template< typename MeshReal, typename Device, typename MeshIndex >
 struct VTKMeshEntitiesWriter< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 0 >
 {
    using MeshType = Meshes::Grid< 2, MeshReal, Device, MeshIndex >;
 
    template< typename Index >
-   static void writeOffsets( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeOffsets( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
    {
       Index offset = 0;
       writeValue< Index >( format, str, offset );
@@ -344,28 +343,27 @@ struct VTKMeshEntitiesWriter< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 0
    }
 
    template< typename Index >
-   static void writeConnectivity( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeConnectivity( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
    {
       for( MeshIndex j = 0; j < ( mesh.getDimensions().y() + 1 ); j++ )
-      for( MeshIndex i = 0; i < ( mesh.getDimensions().x() + 1 ); i++ )
-      {
-         writeValue< Index >( format, str, j * mesh.getDimensions().x() + i );
-         if( format == VTK::FileFormat::ascii )
-            str << "\n";
-      }
+         for( MeshIndex i = 0; i < ( mesh.getDimensions().x() + 1 ); i++ ) {
+            writeValue< Index >( format, str, j * mesh.getDimensions().x() + i );
+            if( format == VTK::FileFormat::ascii )
+               str << "\n";
+         }
    }
 };
 
 // 3D grids, cells
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex >
+template< typename MeshReal, typename Device, typename MeshIndex >
 struct VTKMeshEntitiesWriter< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 3 >
 {
    using MeshType = Meshes::Grid< 3, MeshReal, Device, MeshIndex >;
 
    template< typename Index >
-   static void writeOffsets( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeOffsets( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
    {
       Index offset = 0;
       writeValue< Index >( format, str, offset );
@@ -382,36 +380,59 @@ struct VTKMeshEntitiesWriter< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 3
    }
 
    template< typename Index >
-   static void writeConnectivity( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeConnectivity( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
    {
       for( MeshIndex k = 0; k < mesh.getDimensions().z(); k++ )
-      for( MeshIndex j = 0; j < mesh.getDimensions().y(); j++ )
-      for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ )
-      {
-         writeValue< Index >( format, str, k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         writeValue< Index >( format, str, k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         writeValue< Index >( format, str, k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i );
-         writeValue< Index >( format, str, k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         writeValue< Index >( format, str, (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         writeValue< Index >( format, str, (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         writeValue< Index >( format, str, (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i );
-         writeValue< Index >( format, str, (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         if( format == VTK::FileFormat::ascii )
-            str << "\n";
-      }
+         for( MeshIndex j = 0; j < mesh.getDimensions().y(); j++ )
+            for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ ) {
+               writeValue< Index >( format,
+                                    str,
+                                    k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               writeValue< Index >( format,
+                                    str,
+                                    k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+               writeValue< Index >( format,
+                                    str,
+                                    k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i );
+               writeValue< Index >( format,
+                                    str,
+                                    k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+               writeValue< Index >( format,
+                                    str,
+                                    ( k + 1 ) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               writeValue< Index >( format,
+                                    str,
+                                    ( k + 1 ) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+               writeValue< Index >( format,
+                                    str,
+                                    ( k + 1 ) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i );
+               writeValue< Index >( format,
+                                    str,
+                                    ( k + 1 ) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+               if( format == VTK::FileFormat::ascii )
+                  str << "\n";
+            }
    }
 };
 
 // 3D grids, faces
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex >
+template< typename MeshReal, typename Device, typename MeshIndex >
 struct VTKMeshEntitiesWriter< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 2 >
 {
    using MeshType = Meshes::Grid< 3, MeshReal, Device, MeshIndex >;
 
    template< typename Index >
-   static void writeOffsets( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeOffsets( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
    {
       Index offset = 0;
       writeValue< Index >( format, str, offset );
@@ -442,56 +463,89 @@ struct VTKMeshEntitiesWriter< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 2
    }
 
    template< typename Index >
-   static void writeConnectivity( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeConnectivity( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
    {
       for( MeshIndex k = 0; k < mesh.getDimensions().z(); k++ )
-      for( MeshIndex j = 0; j < mesh.getDimensions().y(); j++ )
-      for( MeshIndex i = 0; i <= mesh.getDimensions().x(); i++ )
-      {
-         writeValue< Index >( format, str, k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         writeValue< Index >( format, str, k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i );
-         writeValue< Index >( format, str, (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         writeValue< Index >( format, str, (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i );
-         if( format == VTK::FileFormat::ascii )
-            str << "\n";
-      }
+         for( MeshIndex j = 0; j < mesh.getDimensions().y(); j++ )
+            for( MeshIndex i = 0; i <= mesh.getDimensions().x(); i++ ) {
+               writeValue< Index >( format,
+                                    str,
+                                    k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               writeValue< Index >( format,
+                                    str,
+                                    k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i );
+               writeValue< Index >( format,
+                                    str,
+                                    ( k + 1 ) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               writeValue< Index >( format,
+                                    str,
+                                    ( k + 1 ) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i );
+               if( format == VTK::FileFormat::ascii )
+                  str << "\n";
+            }
 
       for( MeshIndex k = 0; k < mesh.getDimensions().z(); k++ )
-      for( MeshIndex j = 0; j <= mesh.getDimensions().y(); j++ )
-      for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ )
-      {
-         writeValue< Index >( format, str, k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         writeValue< Index >( format, str, k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         writeValue< Index >( format, str, (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         writeValue< Index >( format, str, (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         if( format == VTK::FileFormat::ascii )
-            str << "\n";
-      }
+         for( MeshIndex j = 0; j <= mesh.getDimensions().y(); j++ )
+            for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ ) {
+               writeValue< Index >( format,
+                                    str,
+                                    k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               writeValue< Index >( format,
+                                    str,
+                                    k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+               writeValue< Index >( format,
+                                    str,
+                                    ( k + 1 ) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               writeValue< Index >( format,
+                                    str,
+                                    ( k + 1 ) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+               if( format == VTK::FileFormat::ascii )
+                  str << "\n";
+            }
 
       for( MeshIndex k = 0; k <= mesh.getDimensions().z(); k++ )
-      for( MeshIndex j = 0; j < mesh.getDimensions().y(); j++ )
-      for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ )
-      {
-         writeValue< Index >( format, str, k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         writeValue< Index >( format, str, k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         writeValue< Index >( format, str, k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i );
-         writeValue< Index >( format, str, k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         if( format == VTK::FileFormat::ascii )
-            str << "\n";
-      }
+         for( MeshIndex j = 0; j < mesh.getDimensions().y(); j++ )
+            for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ ) {
+               writeValue< Index >( format,
+                                    str,
+                                    k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               writeValue< Index >( format,
+                                    str,
+                                    k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+               writeValue< Index >( format,
+                                    str,
+                                    k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i );
+               writeValue< Index >( format,
+                                    str,
+                                    k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+               if( format == VTK::FileFormat::ascii )
+                  str << "\n";
+            }
    }
 };
 
 // 3D grids, edges
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex >
+template< typename MeshReal, typename Device, typename MeshIndex >
 struct VTKMeshEntitiesWriter< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 1 >
 {
    using MeshType = Meshes::Grid< 3, MeshReal, Device, MeshIndex >;
 
    template< typename Index >
-   static void writeOffsets( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeOffsets( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
    {
       Index offset = 0;
       writeValue< Index >( format, str, offset );
@@ -522,50 +576,65 @@ struct VTKMeshEntitiesWriter< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 1
    }
 
    template< typename Index >
-   static void writeConnectivity( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeConnectivity( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
    {
       for( MeshIndex k = 0; k <= mesh.getDimensions().z(); k++ )
-      for( MeshIndex j = 0; j <= mesh.getDimensions().y(); j++ )
-      for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ )
-      {
-         writeValue< Index >( format, str, k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         writeValue< Index >( format, str, k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         if( format == VTK::FileFormat::ascii )
-            str << "\n";
-      }
+         for( MeshIndex j = 0; j <= mesh.getDimensions().y(); j++ )
+            for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ ) {
+               writeValue< Index >( format,
+                                    str,
+                                    k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               writeValue< Index >( format,
+                                    str,
+                                    k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+               if( format == VTK::FileFormat::ascii )
+                  str << "\n";
+            }
 
       for( MeshIndex k = 0; k <= mesh.getDimensions().z(); k++ )
-      for( MeshIndex j = 0; j < mesh.getDimensions().y(); j++ )
-      for( MeshIndex i = 0; i <= mesh.getDimensions().x(); i++ )
-      {
-         writeValue< Index >( format, str, k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         writeValue< Index >( format, str, k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i );
-         if( format == VTK::FileFormat::ascii )
-            str << "\n";
-      }
+         for( MeshIndex j = 0; j < mesh.getDimensions().y(); j++ )
+            for( MeshIndex i = 0; i <= mesh.getDimensions().x(); i++ ) {
+               writeValue< Index >( format,
+                                    str,
+                                    k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               writeValue< Index >( format,
+                                    str,
+                                    k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i );
+               if( format == VTK::FileFormat::ascii )
+                  str << "\n";
+            }
 
       for( MeshIndex k = 0; k < mesh.getDimensions().z(); k++ )
-      for( MeshIndex j = 0; j <= mesh.getDimensions().y(); j++ )
-      for( MeshIndex i = 0; i <= mesh.getDimensions().x(); i++ )
-      {
-         writeValue< Index >( format, str, k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         writeValue< Index >( format, str, (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         if( format == VTK::FileFormat::ascii )
-            str << "\n";
-      }
+         for( MeshIndex j = 0; j <= mesh.getDimensions().y(); j++ )
+            for( MeshIndex i = 0; i <= mesh.getDimensions().x(); i++ ) {
+               writeValue< Index >( format,
+                                    str,
+                                    k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               writeValue< Index >( format,
+                                    str,
+                                    ( k + 1 ) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               if( format == VTK::FileFormat::ascii )
+                  str << "\n";
+            }
    }
 };
 
 // 3D grids, vertices
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex >
+template< typename MeshReal, typename Device, typename MeshIndex >
 struct VTKMeshEntitiesWriter< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 0 >
 {
    using MeshType = Meshes::Grid< 3, MeshReal, Device, MeshIndex >;
 
    template< typename Index >
-   static void writeOffsets( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeOffsets( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
    {
       Index offset = 0;
       writeValue< Index >( format, str, offset );
@@ -580,25 +649,28 @@ struct VTKMeshEntitiesWriter< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 0
    }
 
    template< typename Index >
-   static void writeConnectivity( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   writeConnectivity( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
    {
       for( MeshIndex k = 0; k < ( mesh.getDimensions().z() + 1 ); k++ )
-      for( MeshIndex j = 0; j < ( mesh.getDimensions().y() + 1 ); j++ )
-      for( MeshIndex i = 0; i < ( mesh.getDimensions().x() + 1 ); i++ )
-      {
-         writeValue< Index >( format, str, k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         if( format == VTK::FileFormat::ascii )
-            str << "\n";
-      }
+         for( MeshIndex j = 0; j < ( mesh.getDimensions().y() + 1 ); j++ )
+            for( MeshIndex i = 0; i < ( mesh.getDimensions().x() + 1 ); i++ ) {
+               writeValue< Index >( format,
+                                    str,
+                                    k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               if( format == VTK::FileFormat::ascii )
+                  str << "\n";
+            }
    }
 };
 
-
 // TODO: specialization for disabled entities
 template< typename Mesh, int EntityDimension >
 struct VTKMeshEntityTypesWriter
 {
-   static void exec( const Mesh& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   exec( const Mesh& mesh, std::ostream& str, VTK::FileFormat format )
    {
       using EntityType = typename Mesh::template EntityType< EntityDimension >;
       using Index = typename Mesh::GlobalIndexType;
@@ -613,16 +685,13 @@ struct VTKMeshEntityTypesWriter
    }
 };
 
-template< int Dimension,
-          typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          int EntityDimension >
+template< int Dimension, typename MeshReal, typename Device, typename MeshIndex, int EntityDimension >
 struct VTKMeshEntityTypesWriter< Grid< Dimension, MeshReal, Device, MeshIndex >, EntityDimension >
 {
    using MeshType = Grid< Dimension, MeshReal, Device, MeshIndex >;
 
-   static void exec( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
+   static void
+   exec( const MeshType& mesh, std::ostream& str, VTK::FileFormat format )
    {
       using EntityType = typename MeshType::template EntityType< EntityDimension >;
 
@@ -636,7 +705,7 @@ struct VTKMeshEntityTypesWriter< Grid< Dimension, MeshReal, Device, MeshIndex >,
    }
 };
 
-} // namespace detail
-} // namespace Writers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace detail
+}  // namespace Writers
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Writers/detail/VTKOffsetsCountGetter.h b/src/TNL/Meshes/Writers/detail/VTKOffsetsCountGetter.h
index 224c53912772f5f89ed11708947c9a8d5f60b67c..c108a1ea7ae57a08c5ee37803c6eac83e4f009a4 100644
--- a/src/TNL/Meshes/Writers/detail/VTKOffsetsCountGetter.h
+++ b/src/TNL/Meshes/Writers/detail/VTKOffsetsCountGetter.h
@@ -13,14 +13,13 @@ namespace Meshes {
 namespace Writers {
 namespace detail {
 
-template< typename Mesh,
-          int EntityDimension,
-          typename EntityType = typename Mesh::template EntityType< EntityDimension > >
+template< typename Mesh, int EntityDimension, typename EntityType = typename Mesh::template EntityType< EntityDimension > >
 struct VTKOffsetsCountGetter
 {
    using IndexType = typename Mesh::GlobalIndexType;
 
-   static IndexType getOffsetsCount( const Mesh& mesh )
+   static IndexType
+   getOffsetsCount( const Mesh& mesh )
    {
       const IndexType entitiesCount = mesh.template getEntitiesCount< EntityType >();
       const IndexType verticesPerEntity = VerticesPerEntity< EntityType >::count;
@@ -29,11 +28,14 @@ struct VTKOffsetsCountGetter
 };
 
 template< typename Mesh, int EntityDimension >
-struct VTKOffsetsCountGetter< Mesh, EntityDimension, MeshEntity< typename Mesh::Config, typename Mesh::DeviceType, Topologies::Polygon > >
+struct VTKOffsetsCountGetter< Mesh,
+                              EntityDimension,
+                              MeshEntity< typename Mesh::Config, typename Mesh::DeviceType, Topologies::Polygon > >
 {
    using IndexType = typename Mesh::GlobalIndexType;
 
-   static IndexType getOffsetsCount( const Mesh& mesh )
+   static IndexType
+   getOffsetsCount( const Mesh& mesh )
    {
       const IndexType entitiesCount = mesh.template getEntitiesCount< EntityDimension >();
       IndexType offsetsCount = 0;
@@ -44,11 +46,14 @@ struct VTKOffsetsCountGetter< Mesh, EntityDimension, MeshEntity< typename Mesh::
 };
 
 template< typename Mesh, int EntityDimension >
-struct VTKOffsetsCountGetter< Mesh, EntityDimension, MeshEntity< typename Mesh::Config, typename Mesh::DeviceType, Topologies::Polyhedron > >
+struct VTKOffsetsCountGetter< Mesh,
+                              EntityDimension,
+                              MeshEntity< typename Mesh::Config, typename Mesh::DeviceType, Topologies::Polyhedron > >
 {
    using IndexType = typename Mesh::GlobalIndexType;
 
-   static IndexType getOffsetsCount( const Mesh& mesh )
+   static IndexType
+   getOffsetsCount( const Mesh& mesh )
    {
       const IndexType entitiesCount = mesh.template getEntitiesCount< EntityDimension >();
       IndexType offsetsCount = 0;
@@ -68,7 +73,7 @@ struct VTKOffsetsCountGetter< Mesh, EntityDimension, MeshEntity< typename Mesh::
    }
 };
 
-} // namespace detail
-} // namespace Writers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace detail
+}  // namespace Writers
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Writers/detail/VTUMeshEntitiesCollector.h b/src/TNL/Meshes/Writers/detail/VTUMeshEntitiesCollector.h
index 45e51d945d9beeb2ebd9dcbc792c24e1f170bdd6..dec7536f961d6b9b1d7cff102893ca14798cb03f 100644
--- a/src/TNL/Meshes/Writers/detail/VTUMeshEntitiesCollector.h
+++ b/src/TNL/Meshes/Writers/detail/VTUMeshEntitiesCollector.h
@@ -19,10 +19,11 @@ namespace detail {
 template< typename Mesh, int EntityDimension >
 struct MeshEntitiesVTUCollector
 {
-   static void exec( const Mesh& mesh,
-                     std::vector< typename Mesh::GlobalIndexType > & connectivity,
-                     std::vector< typename Mesh::GlobalIndexType > & offsets,
-                     std::vector< std::uint8_t > & types )
+   static void
+   exec( const Mesh& mesh,
+         std::vector< typename Mesh::GlobalIndexType >& connectivity,
+         std::vector< typename Mesh::GlobalIndexType >& offsets,
+         std::vector< std::uint8_t >& types )
    {
       using EntityType = typename Mesh::template EntityType< EntityDimension >;
       using Index = typename Mesh::GlobalIndexType;
@@ -44,10 +45,11 @@ struct MeshEntitiesVTUCollector
 template< typename Mesh >
 struct MeshEntitiesVTUCollector< Mesh, 0 >
 {
-   static void exec( const Mesh& mesh,
-                     std::vector< typename Mesh::GlobalIndexType > & connectivity,
-                     std::vector< typename Mesh::GlobalIndexType > & offsets,
-                     std::vector< std::uint8_t > & types )
+   static void
+   exec( const Mesh& mesh,
+         std::vector< typename Mesh::GlobalIndexType >& connectivity,
+         std::vector< typename Mesh::GlobalIndexType >& offsets,
+         std::vector< std::uint8_t >& types )
    {
       using EntityType = typename Mesh::template EntityType< 0 >;
       using Index = typename Mesh::GlobalIndexType;
@@ -63,23 +65,21 @@ struct MeshEntitiesVTUCollector< Mesh, 0 >
 };
 
 // 1D grids, cells
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex >
+template< typename MeshReal, typename Device, typename MeshIndex >
 struct MeshEntitiesVTUCollector< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 1 >
 {
    using Mesh = Meshes::Grid< 1, MeshReal, Device, MeshIndex >;
    using Entity = typename Mesh::template EntityType< 1 >;
 
-   static void exec( const Mesh& mesh,
-                     std::vector< typename Mesh::GlobalIndexType > & connectivity,
-                     std::vector< typename Mesh::GlobalIndexType > & offsets,
-                     std::vector< std::uint8_t > & types )
+   static void
+   exec( const Mesh& mesh,
+         std::vector< typename Mesh::GlobalIndexType >& connectivity,
+         std::vector< typename Mesh::GlobalIndexType >& offsets,
+         std::vector< std::uint8_t >& types )
    {
-      for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ )
-      {
+      for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ ) {
          connectivity.push_back( i );
-         connectivity.push_back( i+1 );
+         connectivity.push_back( i + 1 );
          offsets.push_back( connectivity.size() );
          types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
       }
@@ -87,21 +87,19 @@ struct MeshEntitiesVTUCollector< Meshes::Grid< 1, MeshReal, Device, MeshIndex >,
 };
 
 // 1D grids, vertices
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex >
+template< typename MeshReal, typename Device, typename MeshIndex >
 struct MeshEntitiesVTUCollector< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 0 >
 {
    using Mesh = Meshes::Grid< 1, MeshReal, Device, MeshIndex >;
    using Entity = typename Mesh::template EntityType< 0 >;
 
-   static void exec( const Mesh& mesh,
-                     std::vector< typename Mesh::GlobalIndexType > & connectivity,
-                     std::vector< typename Mesh::GlobalIndexType > & offsets,
-                     std::vector< std::uint8_t > & types )
+   static void
+   exec( const Mesh& mesh,
+         std::vector< typename Mesh::GlobalIndexType >& connectivity,
+         std::vector< typename Mesh::GlobalIndexType >& offsets,
+         std::vector< std::uint8_t >& types )
    {
-      for( MeshIndex i = 0; i < mesh.getDimensions().x() + 1; i++ )
-      {
+      for( MeshIndex i = 0; i < mesh.getDimensions().x() + 1; i++ ) {
          connectivity.push_back( i );
          offsets.push_back( connectivity.size() );
          types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
@@ -110,246 +108,254 @@ struct MeshEntitiesVTUCollector< Meshes::Grid< 1, MeshReal, Device, MeshIndex >,
 };
 
 // 2D grids, cells
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex >
+template< typename MeshReal, typename Device, typename MeshIndex >
 struct MeshEntitiesVTUCollector< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 2 >
 {
    using Mesh = Meshes::Grid< 2, MeshReal, Device, MeshIndex >;
    using Entity = typename Mesh::template EntityType< 2 >;
 
-   static void exec( const Mesh& mesh,
-                     std::vector< typename Mesh::GlobalIndexType > & connectivity,
-                     std::vector< typename Mesh::GlobalIndexType > & offsets,
-                     std::vector< std::uint8_t > & types )
+   static void
+   exec( const Mesh& mesh,
+         std::vector< typename Mesh::GlobalIndexType >& connectivity,
+         std::vector< typename Mesh::GlobalIndexType >& offsets,
+         std::vector< std::uint8_t >& types )
    {
       for( MeshIndex j = 0; j < mesh.getDimensions().y(); j++ )
-      for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ )
-      {
-         connectivity.push_back( j * ( mesh.getDimensions().x() + 1 ) + i );
-         connectivity.push_back( j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         connectivity.push_back( (j+1) * ( mesh.getDimensions().x() + 1 ) + i );
-         connectivity.push_back( (j+1) * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         offsets.push_back( connectivity.size() );
-         types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
-      }
+         for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ ) {
+            connectivity.push_back( j * ( mesh.getDimensions().x() + 1 ) + i );
+            connectivity.push_back( j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+            connectivity.push_back( ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i );
+            connectivity.push_back( ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+            offsets.push_back( connectivity.size() );
+            types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
+         }
    }
 };
 
 // 2D grids, faces
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex >
+template< typename MeshReal, typename Device, typename MeshIndex >
 struct MeshEntitiesVTUCollector< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 1 >
 {
    using Mesh = Meshes::Grid< 2, MeshReal, Device, MeshIndex >;
    using Entity = typename Mesh::template EntityType< 1 >;
 
-   static void exec( const Mesh& mesh,
-                     std::vector< typename Mesh::GlobalIndexType > & connectivity,
-                     std::vector< typename Mesh::GlobalIndexType > & offsets,
-                     std::vector< std::uint8_t > & types )
+   static void
+   exec( const Mesh& mesh,
+         std::vector< typename Mesh::GlobalIndexType >& connectivity,
+         std::vector< typename Mesh::GlobalIndexType >& offsets,
+         std::vector< std::uint8_t >& types )
    {
       for( MeshIndex j = 0; j < mesh.getDimensions().y(); j++ )
-      for( MeshIndex i = 0; i < (mesh.getDimensions().x() + 1); i++ )
-      {
-         connectivity.push_back( j * ( mesh.getDimensions().x() + 1 ) + i );
-         connectivity.push_back( (j+1) * ( mesh.getDimensions().x() + 1 ) + i );
-         offsets.push_back( connectivity.size() );
-         types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
-      }
+         for( MeshIndex i = 0; i < ( mesh.getDimensions().x() + 1 ); i++ ) {
+            connectivity.push_back( j * ( mesh.getDimensions().x() + 1 ) + i );
+            connectivity.push_back( ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i );
+            offsets.push_back( connectivity.size() );
+            types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
+         }
 
-      for( MeshIndex j = 0; j < (mesh.getDimensions().y() + 1); j++ )
-      for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ )
-      {
-         connectivity.push_back( j * ( mesh.getDimensions().x() + 1 ) + i );
-         connectivity.push_back( j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         offsets.push_back( connectivity.size() );
-         types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
-      }
+      for( MeshIndex j = 0; j < ( mesh.getDimensions().y() + 1 ); j++ )
+         for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ ) {
+            connectivity.push_back( j * ( mesh.getDimensions().x() + 1 ) + i );
+            connectivity.push_back( j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+            offsets.push_back( connectivity.size() );
+            types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
+         }
    }
 };
 
 // 2D grids, vertices
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex >
+template< typename MeshReal, typename Device, typename MeshIndex >
 struct MeshEntitiesVTUCollector< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 0 >
 {
    using Mesh = Meshes::Grid< 2, MeshReal, Device, MeshIndex >;
    using Entity = typename Mesh::template EntityType< 0 >;
 
-   static void exec( const Mesh& mesh,
-                     std::vector< typename Mesh::GlobalIndexType > & connectivity,
-                     std::vector< typename Mesh::GlobalIndexType > & offsets,
-                     std::vector< std::uint8_t > & types )
+   static void
+   exec( const Mesh& mesh,
+         std::vector< typename Mesh::GlobalIndexType >& connectivity,
+         std::vector< typename Mesh::GlobalIndexType >& offsets,
+         std::vector< std::uint8_t >& types )
    {
       for( MeshIndex j = 0; j < ( mesh.getDimensions().y() + 1 ); j++ )
-      for( MeshIndex i = 0; i < ( mesh.getDimensions().x() + 1 ); i++ )
-      {
-         connectivity.push_back( j * mesh.getDimensions().x() + i );
-         offsets.push_back( connectivity.size() );
-         types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
-      }
+         for( MeshIndex i = 0; i < ( mesh.getDimensions().x() + 1 ); i++ ) {
+            connectivity.push_back( j * mesh.getDimensions().x() + i );
+            offsets.push_back( connectivity.size() );
+            types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
+         }
    }
 };
 
 // 3D grids, cells
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex >
+template< typename MeshReal, typename Device, typename MeshIndex >
 struct MeshEntitiesVTUCollector< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 3 >
 {
    using Mesh = Meshes::Grid< 3, MeshReal, Device, MeshIndex >;
    using Entity = typename Mesh::template EntityType< 3 >;
 
-   static void exec( const Mesh& mesh,
-                     std::vector< typename Mesh::GlobalIndexType > & connectivity,
-                     std::vector< typename Mesh::GlobalIndexType > & offsets,
-                     std::vector< std::uint8_t > & types )
+   static void
+   exec( const Mesh& mesh,
+         std::vector< typename Mesh::GlobalIndexType >& connectivity,
+         std::vector< typename Mesh::GlobalIndexType >& offsets,
+         std::vector< std::uint8_t >& types )
    {
       for( MeshIndex k = 0; k < mesh.getDimensions().z(); k++ )
-      for( MeshIndex j = 0; j < mesh.getDimensions().y(); j++ )
-      for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ )
-      {
-         connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i );
-         connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         connectivity.push_back( (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         connectivity.push_back( (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         connectivity.push_back( (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i );
-         connectivity.push_back( (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         offsets.push_back( connectivity.size() );
-         types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
-      }
+         for( MeshIndex j = 0; j < mesh.getDimensions().y(); j++ )
+            for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ ) {
+               connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+               connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i );
+               connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+               connectivity.push_back( ( k + 1 ) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               connectivity.push_back( ( k + 1 ) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+               connectivity.push_back( ( k + 1 ) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i );
+               connectivity.push_back( ( k + 1 ) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+               offsets.push_back( connectivity.size() );
+               types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
+            }
    }
 };
 
 // 3D grids, faces
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex >
+template< typename MeshReal, typename Device, typename MeshIndex >
 struct MeshEntitiesVTUCollector< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 2 >
 {
    using Mesh = Meshes::Grid< 3, MeshReal, Device, MeshIndex >;
    using Entity = typename Mesh::template EntityType< 2 >;
 
-   static void exec( const Mesh& mesh,
-                     std::vector< typename Mesh::GlobalIndexType > & connectivity,
-                     std::vector< typename Mesh::GlobalIndexType > & offsets,
-                     std::vector< std::uint8_t > & types )
+   static void
+   exec( const Mesh& mesh,
+         std::vector< typename Mesh::GlobalIndexType >& connectivity,
+         std::vector< typename Mesh::GlobalIndexType >& offsets,
+         std::vector< std::uint8_t >& types )
    {
       for( MeshIndex k = 0; k < mesh.getDimensions().z(); k++ )
-      for( MeshIndex j = 0; j < mesh.getDimensions().y(); j++ )
-      for( MeshIndex i = 0; i <= mesh.getDimensions().x(); i++ )
-      {
-         connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i );
-         connectivity.push_back( (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         connectivity.push_back( (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i );
-         offsets.push_back( connectivity.size() );
-         types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
-      }
+         for( MeshIndex j = 0; j < mesh.getDimensions().y(); j++ )
+            for( MeshIndex i = 0; i <= mesh.getDimensions().x(); i++ ) {
+               connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i );
+               connectivity.push_back( ( k + 1 ) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               connectivity.push_back( ( k + 1 ) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i );
+               offsets.push_back( connectivity.size() );
+               types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
+            }
 
       for( MeshIndex k = 0; k < mesh.getDimensions().z(); k++ )
-      for( MeshIndex j = 0; j <= mesh.getDimensions().y(); j++ )
-      for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ )
-      {
-         connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         connectivity.push_back( (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         connectivity.push_back( (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         offsets.push_back( connectivity.size() );
-         types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
-      }
+         for( MeshIndex j = 0; j <= mesh.getDimensions().y(); j++ )
+            for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ ) {
+               connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+               connectivity.push_back( ( k + 1 ) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               connectivity.push_back( ( k + 1 ) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+               offsets.push_back( connectivity.size() );
+               types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
+            }
 
       for( MeshIndex k = 0; k <= mesh.getDimensions().z(); k++ )
-      for( MeshIndex j = 0; j < mesh.getDimensions().y(); j++ )
-      for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ )
-      {
-         connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i );
-         connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         offsets.push_back( connectivity.size() );
-         types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
-      }
+         for( MeshIndex j = 0; j < mesh.getDimensions().y(); j++ )
+            for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ ) {
+               connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+               connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i );
+               connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+               offsets.push_back( connectivity.size() );
+               types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
+            }
    }
 };
 
 // 3D grids, edges
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex >
+template< typename MeshReal, typename Device, typename MeshIndex >
 struct MeshEntitiesVTUCollector< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 1 >
 {
    using Mesh = Meshes::Grid< 3, MeshReal, Device, MeshIndex >;
    using Entity = typename Mesh::template EntityType< 1 >;
 
-   static void exec( const Mesh& mesh,
-                     std::vector< typename Mesh::GlobalIndexType > & connectivity,
-                     std::vector< typename Mesh::GlobalIndexType > & offsets,
-                     std::vector< std::uint8_t > & types )
+   static void
+   exec( const Mesh& mesh,
+         std::vector< typename Mesh::GlobalIndexType >& connectivity,
+         std::vector< typename Mesh::GlobalIndexType >& offsets,
+         std::vector< std::uint8_t >& types )
    {
       for( MeshIndex k = 0; k <= mesh.getDimensions().z(); k++ )
-      for( MeshIndex j = 0; j <= mesh.getDimensions().y(); j++ )
-      for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ )
-      {
-         connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
-         offsets.push_back( connectivity.size() );
-         types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
-      }
+         for( MeshIndex j = 0; j <= mesh.getDimensions().y(); j++ )
+            for( MeshIndex i = 0; i < mesh.getDimensions().x(); i++ ) {
+               connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i + 1 );
+               offsets.push_back( connectivity.size() );
+               types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
+            }
 
       for( MeshIndex k = 0; k <= mesh.getDimensions().z(); k++ )
-      for( MeshIndex j = 0; j < mesh.getDimensions().y(); j++ )
-      for( MeshIndex i = 0; i <= mesh.getDimensions().x(); i++ )
-      {
-         connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + (j+1) * ( mesh.getDimensions().x() + 1 ) + i );
-         offsets.push_back( connectivity.size() );
-         types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
-      }
+         for( MeshIndex j = 0; j < mesh.getDimensions().y(); j++ )
+            for( MeshIndex i = 0; i <= mesh.getDimensions().x(); i++ ) {
+               connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + ( j + 1 ) * ( mesh.getDimensions().x() + 1 ) + i );
+               offsets.push_back( connectivity.size() );
+               types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
+            }
 
       for( MeshIndex k = 0; k < mesh.getDimensions().z(); k++ )
-      for( MeshIndex j = 0; j <= mesh.getDimensions().y(); j++ )
-      for( MeshIndex i = 0; i <= mesh.getDimensions().x(); i++ )
-      {
-         connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         connectivity.push_back( (k+1) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         offsets.push_back( connectivity.size() );
-         types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
-      }
+         for( MeshIndex j = 0; j <= mesh.getDimensions().y(); j++ )
+            for( MeshIndex i = 0; i <= mesh.getDimensions().x(); i++ ) {
+               connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               connectivity.push_back( ( k + 1 ) * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               offsets.push_back( connectivity.size() );
+               types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
+            }
    }
 };
 
 // 3D grids, vertices
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex >
+template< typename MeshReal, typename Device, typename MeshIndex >
 struct MeshEntitiesVTUCollector< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 0 >
 {
    using Mesh = Meshes::Grid< 3, MeshReal, Device, MeshIndex >;
    using Entity = typename Mesh::template EntityType< 0 >;
 
-   static void exec( const Mesh& mesh,
-                     std::vector< typename Mesh::GlobalIndexType > & connectivity,
-                     std::vector< typename Mesh::GlobalIndexType > & offsets,
-                     std::vector< std::uint8_t > & types )
+   static void
+   exec( const Mesh& mesh,
+         std::vector< typename Mesh::GlobalIndexType >& connectivity,
+         std::vector< typename Mesh::GlobalIndexType >& offsets,
+         std::vector< std::uint8_t >& types )
    {
       for( MeshIndex k = 0; k < ( mesh.getDimensions().z() + 1 ); k++ )
-      for( MeshIndex j = 0; j < ( mesh.getDimensions().y() + 1 ); j++ )
-      for( MeshIndex i = 0; i < ( mesh.getDimensions().x() + 1 ); i++ )
-      {
-         connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 ) + j * ( mesh.getDimensions().x() + 1 ) + i );
-         offsets.push_back( connectivity.size() );
-         types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
-      }
+         for( MeshIndex j = 0; j < ( mesh.getDimensions().y() + 1 ); j++ )
+            for( MeshIndex i = 0; i < ( mesh.getDimensions().x() + 1 ); i++ ) {
+               connectivity.push_back( k * ( mesh.getDimensions().y() + 1 ) * ( mesh.getDimensions().x() + 1 )
+                                       + j * ( mesh.getDimensions().x() + 1 ) + i );
+               offsets.push_back( connectivity.size() );
+               types.push_back( (std::uint8_t) VTK::GridEntityShape< Entity >::shape );
+            }
    }
 };
 
-} // namespace detail
-} // namespace Writers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace detail
+}  // namespace Writers
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Writers/detail/VTUPolyhedralFacesWriter.h b/src/TNL/Meshes/Writers/detail/VTUPolyhedralFacesWriter.h
index 810285cc22df69afdab27cd378432d25f1fdea7f..807c9e0d53eb8856b4a02a83887c4ebeddd13d29 100644
--- a/src/TNL/Meshes/Writers/detail/VTUPolyhedralFacesWriter.h
+++ b/src/TNL/Meshes/Writers/detail/VTUPolyhedralFacesWriter.h
@@ -39,7 +39,8 @@ struct VTUPolyhedralFacesWriter
          const IndexType num_faces = mesh.template getSubentitiesCount< M::getMeshDimension(), M::getMeshDimension() - 1 >( c );
          faces.push_back( num_faces );
          for( IndexType f = 0; f < num_faces; f++ ) {
-            const auto& face = mesh.template getEntity< M::getMeshDimension() - 1 >( mesh.template getSubentityIndex< M::getMeshDimension(), M::getMeshDimension() - 1 >( c, f ) );
+            const auto& face = mesh.template getEntity< M::getMeshDimension() - 1 >(
+               mesh.template getSubentityIndex< M::getMeshDimension(), M::getMeshDimension() - 1 >( c, f ) );
             const IndexType num_vertices = face.template getSubentitiesCount< 0 >();
             faces.push_back( num_vertices );
             for( IndexType v = 0; v < num_vertices; v++ ) {
@@ -61,18 +62,16 @@ struct VTUPolyhedralFacesWriter
 };
 
 // specialization for grids
-template< int Dimension,
-          typename MeshReal,
-          typename Device,
-          typename MeshIndex >
+template< int Dimension, typename MeshReal, typename Device, typename MeshIndex >
 struct VTUPolyhedralFacesWriter< Meshes::Grid< Dimension, MeshReal, Device, MeshIndex > >
 {
    template< typename W, typename M >
-   static void exec( W& writer, const M& mesh )
+   static void
+   exec( W& writer, const M& mesh )
    {}
 };
 
-} // namespace detail
-} // namespace Writers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace detail
+}  // namespace Writers
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Meshes/Writers/detail/VerticesPerEntity.h b/src/TNL/Meshes/Writers/detail/VerticesPerEntity.h
index b52e6680e3515021b2e2873f65c340ada176a3c0..61e2190526dc42fa9b117f458e03bf49defb04e8 100644
--- a/src/TNL/Meshes/Writers/detail/VerticesPerEntity.h
+++ b/src/TNL/Meshes/Writers/detail/VerticesPerEntity.h
@@ -15,15 +15,14 @@ namespace Writers {
 namespace detail {
 
 template< typename T, typename Enable = void >
-struct has_entity_topology : std::false_type {};
+struct has_entity_topology : std::false_type
+{};
 
 template< typename T >
-struct has_entity_topology< T, typename enable_if_type< typename T::EntityTopology >::type >
-: std::true_type
+struct has_entity_topology< T, typename enable_if_type< typename T::EntityTopology >::type > : std::true_type
 {};
 
-template< typename Entity,
-          bool _is_mesh_entity = has_entity_topology< Entity >::value >
+template< typename Entity, bool _is_mesh_entity = has_entity_topology< Entity >::value >
 struct VerticesPerEntity
 {
    static constexpr int count = Topologies::Subtopology< typename Entity::EntityTopology, 0 >::count;
@@ -43,14 +42,10 @@ private:
    static_assert( dim >= 0 && dim <= 3, "unexpected dimension of the grid entity" );
 
 public:
-   static constexpr int count =
-      (dim == 0) ? 1 :
-      (dim == 1) ? 2 :
-      (dim == 2) ? 4 :
-                   8;
+   static constexpr int count = ( dim == 0 ) ? 1 : ( dim == 1 ) ? 2 : ( dim == 2 ) ? 4 : 8;
 };
 
-} // namespace detail
-} // namespace Writers
-} // namespace Meshes
-} // namespace TNL
+}  // namespace detail
+}  // namespace Writers
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Object.h b/src/TNL/Object.h
index 0f8e57461387580b920ebef0a172f1bb8de1b0b0..f6022ff1fd0a44f7a78149ddbf7b6bfa6309fa5b 100644
--- a/src/TNL/Object.h
+++ b/src/TNL/Object.h
@@ -34,71 +34,76 @@ namespace TNL {
  */
 class Object
 {
-   public:
-
-      /**
-       * \brief Static serialization type getter.
-       *
-       * Objects in TNL are saved as in a device independent manner. This method
-       * is supposed to return the object type but with the device type replaced
-       * by Devices::Host. For example \c Array< double, Devices::Cuda > is
-       * saved as \c Array< double, Devices::Host >.
-       */
-      static String getSerializationType();
-
-      /***
-       * \brief Virtual serialization type getter.
-       *
-       * Objects in TNL are saved as in a device independent manner. This method
-       * is supposed to return the object type but with the device type replaced
-       * by Devices::Host. For example \c Array< double, Devices::Cuda > is
-       * saved as \c Array< double, Devices::Host >.
-       */
-      virtual String getSerializationTypeVirtual() const;
-
-      /**
-       * \brief Method for saving the object to a file as a binary data.
-       *
-       * Throws \ref Exceptions::FileSerializationError if the object cannot be saved.
-       *
-       * \param file Name of file object.
-       */
-      virtual void save( File& file ) const;
-
-      /**
-       * \brief Method for restoring the object from a file.
-       *
-       * Throws \ref Exceptions::FileDeserializationError if the object cannot be loaded.
-       *
-       * \param file Name of file object.
-       */
-      virtual void load( File& file );
-
-      /**
-       * \brief Method for saving the object to a file as a binary data.
-       *
-       * Throws \ref Exceptions::FileSerializationError if the object cannot be saved.
-       *
-       * \param fileName String defining the name of a file.
-       */
-      void save( const String& fileName ) const;
-
-      /**
-       * \brief Method for restoring the object from a file.
-       *
-       * Throws \ref Exceptions::FileDeserializationError if the object cannot be loaded.
-       *
-       * \param fileName String defining the name of a file.
-       */
-      void load( const String& fileName );
-
-      /**
-       * \brief Destructor.
-       *
-       * Since it is not defined as \ref __cuda_callable__, objects inherited
-       * from Object should not be created in CUDA kernels.
-       */
-      virtual ~Object() = default;
+public:
+   /**
+    * \brief Static serialization type getter.
+    *
+    * Objects in TNL are saved as in a device independent manner. This method
+    * is supposed to return the object type but with the device type replaced
+    * by Devices::Host. For example \c Array< double, Devices::Cuda > is
+    * saved as \c Array< double, Devices::Host >.
+    */
+   static std::string
+   getSerializationType();
+
+   /***
+    * \brief Virtual serialization type getter.
+    *
+    * Objects in TNL are saved as in a device independent manner. This method
+    * is supposed to return the object type but with the device type replaced
+    * by Devices::Host. For example \c Array< double, Devices::Cuda > is
+    * saved as \c Array< double, Devices::Host >.
+    */
+   virtual std::string
+   getSerializationTypeVirtual() const;
+
+   /**
+    * \brief Method for saving the object to a file as a binary data.
+    *
+    * Throws \ref Exceptions::FileSerializationError if the object cannot be saved.
+    *
+    * \param file Name of file object.
+    */
+   virtual void
+   save( File& file ) const;
+
+   /**
+    * \brief Method for restoring the object from a file.
+    *
+    * Throws \ref Exceptions::FileDeserializationError if the object cannot be loaded.
+    *
+    * \param file Name of file object.
+    */
+   virtual void
+   load( File& file );
+
+   /**
+    * \brief Method for saving the object to a file as a binary data.
+    *
+    * Throws \ref Exceptions::FileSerializationError if the object cannot be saved.
+    *
+    * \param fileName String defining the name of a file.
+    */
+   void
+   save( const String& fileName ) const;
+
+   /**
+    * \brief Method for restoring the object from a file.
+    *
+    * Throws \ref Exceptions::FileDeserializationError if the object cannot be loaded.
+    *
+    * \param fileName String defining the name of a file.
+    */
+   void
+   load( const String& fileName );
+
+   /**
+    * \brief Destructor.
+    *
+    * Since it is not defined as \ref __cuda_callable__, objects inherited
+    * from Object should not be created in CUDA kernels.
+    */
+   virtual ~Object() = default;
 };
 
 /**
@@ -109,7 +114,8 @@ class Object
  * @param file is file where the object is stored
  * @return string with the object type
  */
-String getObjectType( File& file );
+String
+getObjectType( File& file );
 
 /**
  * \brief Does the same as \ref getObjectType but with a \e fileName parameter instead of file.
@@ -119,7 +125,8 @@ String getObjectType( File& file );
  * @param fileName name of a file where the object is stored
  * @return string with the object type
  */
-String getObjectType( const String& fileName );
+String
+getObjectType( const String& fileName );
 
 /**
  * \brief Parses the object type
@@ -144,8 +151,9 @@ parseObjectType( const String& objectType );
  * @param file is the file where the object will be saved
  * @param type is the object type to be saved
  */
-void saveObjectType( File& file, const String& type );
+void
+saveObjectType( File& file, const String& type );
 
-} // namespace TNL
+}  // namespace TNL
 
 #include <TNL/Object.hpp>
diff --git a/src/TNL/Object.hpp b/src/TNL/Object.hpp
index 44ddbdb8c9125643c82e8e2a6a7cb896dd15ea3d..876b17d8faaf64d07b2d9d640e2219e44141fdd2 100644
--- a/src/TNL/Object.hpp
+++ b/src/TNL/Object.hpp
@@ -16,55 +16,66 @@ namespace TNL {
 
 static constexpr char magic_number[] = "TNLMN";
 
-inline String Object::getSerializationType()
+inline std::string
+Object::getSerializationType()
 {
-   return String( "Object" );
+   return "Object";
 }
 
-inline String Object::getSerializationTypeVirtual() const
+inline std::string
+Object::getSerializationTypeVirtual() const
 {
    return this->getSerializationType();
 }
 
-inline void Object::save( File& file ) const
+inline void
+Object::save( File& file ) const
 {
    file.save( magic_number, strlen( magic_number ) );
    file << this->getSerializationTypeVirtual();
 }
 
-inline void Object::load( File& file )
+inline void
+Object::load( File& file )
 {
-   const String objectType = getObjectType( file );
+   const std::string objectType = getObjectType( file );
    if( objectType != this->getSerializationTypeVirtual() )
-      throw Exceptions::FileDeserializationError( file.getFileName(), "object type does not match (expected " + this->getSerializationTypeVirtual() + ", found " + objectType + ")." );
+      throw Exceptions::FileDeserializationError( file.getFileName(),
+                                                  "object type does not match (expected " + this->getSerializationTypeVirtual()
+                                                     + ", found " + objectType + ")." );
 }
 
-inline void Object::save( const String& fileName ) const
+inline void
+Object::save( const String& fileName ) const
 {
    File file;
    file.open( fileName, std::ios_base::out );
    this->save( file );
 }
 
-inline void Object::load( const String& fileName )
+inline void
+Object::load( const String& fileName )
 {
    File file;
    file.open( fileName, std::ios_base::in );
    this->load( file );
 }
 
-inline String getObjectType( File& file )
+inline String
+getObjectType( File& file )
 {
    char mn[ 10 ];
    String type;
    file.load( mn, strlen( magic_number ) );
    if( strncmp( mn, magic_number, 5 ) != 0 )
-      throw Exceptions::FileDeserializationError( file.getFileName(), "wrong magic number - file is not in a TNL-compatible format." );
+      throw Exceptions::FileDeserializationError( file.getFileName(),
+                                                  "wrong magic number - file is not in a TNL-compatible format." );
    file >> type;
    return type;
 }
 
-inline String getObjectType( const String& fileName )
+inline String
+getObjectType( const String& fileName )
 {
    File binaryFile;
    binaryFile.open( fileName, std::ios_base::in );
@@ -97,24 +108,21 @@ parseObjectType( const String& objectType )
    int templateBrackets( 0 );
    String buffer( "" );
 
-   while( i < objectTypeLength )
-   {
+   while( i < objectTypeLength ) {
       if( objectType[ i ] == '<' )
          templateBrackets++;
-      if( ! templateBrackets )
-      {
-         if( objectType[ i ] == ',' ||
-             objectType[ i ] == '>' )
-         {
-            if( buffer != "" )
-            {
+      if( templateBrackets == 0 ) {
+         if( objectType[ i ] == ',' || objectType[ i ] == '>' ) {
+            if( ! buffer.empty() ) {
                parsedObjectType.push_back( buffer.strip( ' ' ) );
                buffer.clear();
             }
          }
-         else buffer += objectType[ i ];
+         else
+            buffer += objectType[ i ];
       }
-      else buffer += objectType[ i ];
+      else
+         buffer += objectType[ i ];
       if( objectType[ i ] == '>' )
          templateBrackets--;
       i++;
@@ -123,10 +131,11 @@ parseObjectType( const String& objectType )
    return parsedObjectType;
 }
 
-inline void saveObjectType( File& file, const String& type )
+inline void
+saveObjectType( File& file, const String& type )
 {
    file.save( magic_number, strlen( magic_number ) );
    file << type;
 }
 
-} // namespace TNL
+}  // namespace TNL
diff --git a/src/TNL/Operators/Advection/LaxFridrichs.h b/src/TNL/Operators/Advection/LaxFridrichs.h
index b8c5bfafa18c1e870cba62386325bebc41ae010e..0c8819ddfc1007dc66d87827ffe44fbad95a5025 100644
--- a/src/TNL/Operators/Advection/LaxFridrichs.h
+++ b/src/TNL/Operators/Advection/LaxFridrichs.h
@@ -13,305 +13,295 @@
 #include <TNL/Pointers/SharedPointer.h>
 
 namespace TNL {
-   namespace Operators {
-      namespace Advection {
-   
+namespace Operators {
+namespace Advection {
 
 template< typename Mesh,
           typename Real = typename Mesh::RealType,
           typename Index = typename Mesh::IndexType,
           typename VelocityFunction = Functions::MeshFunction< Mesh > >
 class LaxFridrichs
-{
-};
+{};
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index,
-          typename VelocityFunction >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index, typename VelocityFunction >
 class LaxFridrichs< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, VelocityFunction >
 {
-   public:
-      
-      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
-      typedef Pointers::SharedPointer<  MeshType > MeshPointer;
-      static const int Dimension = MeshType::getMeshDimension();
-      typedef typename MeshType::CoordinatesType CoordinatesType;
-      typedef Real RealType;
-      typedef Device DeviceType;
-      typedef Index IndexType;
-      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
-      typedef VelocityFunction VelocityFunctionType;
-      typedef Functions::VectorField< Dimension, VelocityFunctionType > VelocityFieldType;
-      typedef Pointers::SharedPointer<  VelocityFieldType, DeviceType > VelocityFieldPointer;
-      
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" )
-      {
-         config.addEntry< double >( prefix + "numerical-viscosity", "Value of artificial (numerical) viscosity in the Lax-Fridrichs scheme", 1.0 );
-      }
-      
-      LaxFridrichs()
-         : artificialViscosity( 1.0 ) {}
-      
-      LaxFridrichs( const VelocityFieldPointer& velocityField )
-         : artificialViscosity( 1.0 ), velocityField( velocityField ) {}
-      
-      bool setup( const MeshPointer& meshPointer,
-                  const Config::ParameterContainer& parameters,
-                  const String& prefix = "" )
-      {
-         this->artificialViscosity = parameters.getParameter< double >( prefix + "numerical-viscosity" );
-         return true;
-      }
-
-      void setViscosity(const Real& artificalViscosity)
-      {
-         this->artificialViscosity = artificalViscosity;
-      }
-      
-      void setTau(const Real& tau)
-      {
-          this->tau = tau;
-      };
-
-      void setVelocityField( const VelocityFieldPointer& velocityField )
-      {
-         this->velocityField = velocityField;
-      }
-      
-      const VelocityFieldPointer& getVelocityField() const
-      {
-         return this->velocityField;
-      }
-      
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      Real operator()( const MeshFunction& u,
-                       const MeshEntity& entity,
-                       const RealType& time = 0.0 ) const
-      {
-         static_assert( MeshEntity::getEntityDimension() == 1, "Wrong mesh entity dimensions." ); 
-         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 = neighborEntities.template getEntityIndex< 1 >(); 
-         const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); 
-         typedef Functions::FunctionAdapter< MeshType, VelocityFunctionType > FunctionAdapter;
-         return ( 0.5 / this->tau ) * this->artificialViscosity * ( u[ west ]- 2.0 * u[ center ] + u[ east ] ) -
-                FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 0 ], entity, time ) * ( u[ east ] - u[ west ] ) * hxInverse * 0.5;
-      }
-      
-   protected:
-            
-      RealType tau;
-      
-      RealType artificialViscosity;
-      
-      VelocityFieldPointer velocityField;
+public:
+   typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
+   typedef Pointers::SharedPointer< MeshType > MeshPointer;
+   static const int Dimension = MeshType::getMeshDimension();
+   typedef typename MeshType::CoordinatesType CoordinatesType;
+   typedef Real RealType;
+   typedef Device DeviceType;
+   typedef Index IndexType;
+   typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+   typedef VelocityFunction VelocityFunctionType;
+   typedef Functions::VectorField< Dimension, VelocityFunctionType > VelocityFieldType;
+   typedef Pointers::SharedPointer< VelocityFieldType, DeviceType > VelocityFieldPointer;
+
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" )
+   {
+      config.addEntry< double >(
+         prefix + "numerical-viscosity", "Value of artificial (numerical) viscosity in the Lax-Fridrichs scheme", 1.0 );
+   }
+
+   LaxFridrichs() : artificialViscosity( 1.0 ) {}
+
+   LaxFridrichs( const VelocityFieldPointer& velocityField ) : artificialViscosity( 1.0 ), velocityField( velocityField ) {}
+
+   bool
+   setup( const MeshPointer& meshPointer, const Config::ParameterContainer& parameters, const String& prefix = "" )
+   {
+      this->artificialViscosity = parameters.getParameter< double >( prefix + "numerical-viscosity" );
+      return true;
+   }
+
+   void
+   setViscosity( const Real& artificalViscosity )
+   {
+      this->artificialViscosity = artificalViscosity;
+   }
+
+   void
+   setTau( const Real& tau )
+   {
+      this->tau = tau;
+   };
+
+   void
+   setVelocityField( const VelocityFieldPointer& velocityField )
+   {
+      this->velocityField = velocityField;
+   }
+
+   const VelocityFieldPointer&
+   getVelocityField() const
+   {
+      return this->velocityField;
+   }
+
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const RealType& time = 0.0 ) const
+   {
+      static_assert( MeshEntity::getEntityDimension() == 1, "Wrong mesh entity dimensions." );
+      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 = neighborEntities.template getEntityIndex< 1 >();
+      const IndexType& west = neighborEntities.template getEntityIndex< -1 >();
+      typedef Functions::FunctionAdapter< MeshType, VelocityFunctionType > FunctionAdapter;
+      return ( 0.5 / this->tau ) * this->artificialViscosity * ( u[ west ] - 2.0 * u[ center ] + u[ east ] )
+           - FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 0 ], entity, time )
+                * ( u[ east ] - u[ west ] ) * hxInverse * 0.5;
+   }
+
+protected:
+   RealType tau;
+
+   RealType artificialViscosity;
+
+   VelocityFieldPointer velocityField;
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index,
-          typename VelocityFunction >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index, typename VelocityFunction >
 class LaxFridrichs< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, VelocityFunction >
 {
-   public:
-      
-      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
-      typedef Pointers::SharedPointer<  MeshType > MeshPointer;
-      static const int Dimension = MeshType::getMeshDimension();
-      typedef typename MeshType::CoordinatesType CoordinatesType;
-      typedef Real RealType;
-      typedef Device DeviceType;
-      typedef Index IndexType;
-      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
-      typedef VelocityFunction VelocityFunctionType;
-      typedef Functions::VectorField< Dimension, VelocityFunctionType > VelocityFieldType;
-      typedef Pointers::SharedPointer<  VelocityFieldType, DeviceType > VelocityFieldPointer;
-      
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" )
-      {
-         config.addEntry< double >( prefix + "numerical-viscosity", "Value of artificial (numerical) viscosity in the Lax-Fridrichs scheme", 1.0 );
-      }      
-      
-      LaxFridrichs()
-         : artificialViscosity( 1.0 ) {}
-
-      LaxFridrichs( const VelocityFieldPointer& velocityField )
-         : artificialViscosity( 1.0 ), velocityField( velocityField ) {}      
-      
-      bool setup( const MeshPointer& meshPointer,
-                  const Config::ParameterContainer& parameters,
-                  const String& prefix = "" )
-      {
-         this->artificialViscosity = parameters.getParameter< double >( prefix + "numerical-viscosity" );
-         return true;
-      }
-
-      void setViscosity(const Real& artificalViscosity)
-      {
-         this->artificialViscosity = artificalViscosity;
-      }
-      
-      void setTau(const Real& tau)
-      {
-          this->tau = tau;
-      };
-
-      void setVelocityField( const VelocityFieldPointer& velocityField )
-      {
-         this->velocityField = velocityField;
-      }
-      
-      const VelocityFieldPointer& getVelocityField() const
-      {
-         return this->velocityField;
-      }
-      
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      Real operator()( const MeshFunction& u,
-                       const MeshEntity& entity,
-                       const RealType& time = 0.0 ) const
-      {
-         static_assert( MeshEntity::getEntityDimension() == 2, "Wrong mesh entity dimensions." ); 
-         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  = 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 >(); 
-         
-         typedef Functions::FunctionAdapter< MeshType, VelocityFunctionType > FunctionAdapter;
-         return ( 0.25 / this->tau ) * this->artificialViscosity * ( u[ west ] + u[ east ] + u[ north ] + u[ south ] - 4.0 * u[ center ] ) -
-                0.5 * ( FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 0 ], entity, time ) * ( u[ east ] - u[ west ] ) * hxInverse +
-                        FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 1 ], entity, time ) * ( u[ north ] - u[ south ] ) * hyInverse );         
-      }
-      
-   protected:
-            
-      RealType tau;
-      
-      RealType artificialViscosity;
-      
-      VelocityFieldPointer velocityField;
+public:
+   typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+   typedef Pointers::SharedPointer< MeshType > MeshPointer;
+   static const int Dimension = MeshType::getMeshDimension();
+   typedef typename MeshType::CoordinatesType CoordinatesType;
+   typedef Real RealType;
+   typedef Device DeviceType;
+   typedef Index IndexType;
+   typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+   typedef VelocityFunction VelocityFunctionType;
+   typedef Functions::VectorField< Dimension, VelocityFunctionType > VelocityFieldType;
+   typedef Pointers::SharedPointer< VelocityFieldType, DeviceType > VelocityFieldPointer;
+
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" )
+   {
+      config.addEntry< double >(
+         prefix + "numerical-viscosity", "Value of artificial (numerical) viscosity in the Lax-Fridrichs scheme", 1.0 );
+   }
+
+   LaxFridrichs() : artificialViscosity( 1.0 ) {}
+
+   LaxFridrichs( const VelocityFieldPointer& velocityField ) : artificialViscosity( 1.0 ), velocityField( velocityField ) {}
+
+   bool
+   setup( const MeshPointer& meshPointer, const Config::ParameterContainer& parameters, const String& prefix = "" )
+   {
+      this->artificialViscosity = parameters.getParameter< double >( prefix + "numerical-viscosity" );
+      return true;
+   }
+
+   void
+   setViscosity( const Real& artificalViscosity )
+   {
+      this->artificialViscosity = artificalViscosity;
+   }
+
+   void
+   setTau( const Real& tau )
+   {
+      this->tau = tau;
+   };
+
+   void
+   setVelocityField( const VelocityFieldPointer& velocityField )
+   {
+      this->velocityField = velocityField;
+   }
+
+   const VelocityFieldPointer&
+   getVelocityField() const
+   {
+      return this->velocityField;
+   }
+
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const RealType& time = 0.0 ) const
+   {
+      static_assert( MeshEntity::getEntityDimension() == 2, "Wrong mesh entity dimensions." );
+      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 = 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 >();
+
+      typedef Functions::FunctionAdapter< MeshType, VelocityFunctionType > FunctionAdapter;
+      return ( 0.25 / this->tau ) * this->artificialViscosity
+              * ( u[ west ] + u[ east ] + u[ north ] + u[ south ] - 4.0 * u[ center ] )
+           - 0.5
+                * ( FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 0 ], entity, time )
+                       * ( u[ east ] - u[ west ] ) * hxInverse
+                    + FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 1 ], entity, time )
+                         * ( u[ north ] - u[ south ] ) * hyInverse );
+   }
+
+protected:
+   RealType tau;
+
+   RealType artificialViscosity;
+
+   VelocityFieldPointer velocityField;
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index,
-          typename VelocityFunction >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index, typename VelocityFunction >
 class LaxFridrichs< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, VelocityFunction >
 {
-   public:
-      
-      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
-      typedef Pointers::SharedPointer<  MeshType > MeshPointer;
-      static const int Dimension = MeshType::getMeshDimension();
-      typedef typename MeshType::CoordinatesType CoordinatesType;
-      typedef Real RealType;
-      typedef Device DeviceType;
-      typedef Index IndexType;
-      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
-      typedef VelocityFunction VelocityFunctionType;
-      typedef Functions::VectorField< Dimension, VelocityFunctionType > VelocityFieldType;
-      typedef Pointers::SharedPointer<  VelocityFieldType, DeviceType > VelocityFieldPointer;
-      
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" )
-      {
-         config.addEntry< double >( prefix + "numerical-viscosity", "Value of artificial (numerical) viscosity in the Lax-Fridrichs scheme", 1.0 );
-      }      
-      
-      LaxFridrichs()
-         : artificialViscosity( 1.0 ) {}
-
-      LaxFridrichs( const VelocityFieldPointer& velocityField )
-         : artificialViscosity( 1.0 ), velocityField( velocityField ) {}
-            
-      bool setup( const MeshPointer& meshPointer,
-                  const Config::ParameterContainer& parameters,
-                  const String& prefix = "" )
-      {
-         this->artificialViscosity = parameters.getParameter< double >( prefix + "numerical-viscosity" );
-         return true;
-      }
-
-      void setViscosity(const Real& artificalViscosity)
-      {
-         this->artificialViscosity = artificalViscosity;
-      }
-      
-      void setTau(const Real& tau)
-      {
-          this->tau = tau;
-      };
-
-      void setVelocityField( const VelocityFieldPointer& velocityField )
-      {
-         this->velocityField = velocityField;
-      }
-      
-      const VelocityFieldPointer& getVelocityField() const
-      {
-         return this->velocityField;
-      }
-      
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      Real operator()( const MeshFunction& u,
-                       const MeshEntity& entity,
-                       const RealType& time = 0.0 ) const
-      {
-         static_assert( MeshEntity::getEntityDimension() == 3, "Wrong mesh entity dimensions." ); 
-         static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); 
-         const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); 
-
-         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1,  0,  0 >(); 
-         const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts<  0, -1,  0 >(); 
-         const RealType& hzInverse = entity.getMesh().template getSpaceStepsProducts<  0,  0, -1 >(); 
-         const IndexType& center = entity.getIndex();
-         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 >(); 
-         
-         typedef Functions::FunctionAdapter< MeshType, VelocityFunctionType > FunctionAdapter;
-         return ( 0.25 / this->tau ) * this->artificialViscosity * ( u[ west ] + u[ east ] + u[ north ] + u[ south ] + u[ up ] + u[ down ] - 6.0 * u[ center ] ) -
-                0.5 * ( FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 0 ], entity, time ) * ( u[ east ] - u[ west ] ) * hxInverse +
-                        FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 1 ], entity, time ) * ( u[ north ] - u[ south ] ) * hyInverse +
-                        FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 2 ], entity, time ) * ( u[ up ] - u[ down ] ) * hzInverse );         
-      }
-      
-   protected:
-            
-      RealType tau;
-      
-      RealType artificialViscosity;
-      
-      VelocityFieldPointer velocityField;
+public:
+   typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+   typedef Pointers::SharedPointer< MeshType > MeshPointer;
+   static const int Dimension = MeshType::getMeshDimension();
+   typedef typename MeshType::CoordinatesType CoordinatesType;
+   typedef Real RealType;
+   typedef Device DeviceType;
+   typedef Index IndexType;
+   typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+   typedef VelocityFunction VelocityFunctionType;
+   typedef Functions::VectorField< Dimension, VelocityFunctionType > VelocityFieldType;
+   typedef Pointers::SharedPointer< VelocityFieldType, DeviceType > VelocityFieldPointer;
+
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" )
+   {
+      config.addEntry< double >(
+         prefix + "numerical-viscosity", "Value of artificial (numerical) viscosity in the Lax-Fridrichs scheme", 1.0 );
+   }
+
+   LaxFridrichs() : artificialViscosity( 1.0 ) {}
+
+   LaxFridrichs( const VelocityFieldPointer& velocityField ) : artificialViscosity( 1.0 ), velocityField( velocityField ) {}
+
+   bool
+   setup( const MeshPointer& meshPointer, const Config::ParameterContainer& parameters, const String& prefix = "" )
+   {
+      this->artificialViscosity = parameters.getParameter< double >( prefix + "numerical-viscosity" );
+      return true;
+   }
+
+   void
+   setViscosity( const Real& artificalViscosity )
+   {
+      this->artificialViscosity = artificalViscosity;
+   }
+
+   void
+   setTau( const Real& tau )
+   {
+      this->tau = tau;
+   };
+
+   void
+   setVelocityField( const VelocityFieldPointer& velocityField )
+   {
+      this->velocityField = velocityField;
+   }
+
+   const VelocityFieldPointer&
+   getVelocityField() const
+   {
+      return this->velocityField;
+   }
+
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const RealType& time = 0.0 ) const
+   {
+      static_assert( MeshEntity::getEntityDimension() == 3, "Wrong mesh entity dimensions." );
+      static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" );
+      const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities();
+
+      const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0, 0 >();
+      const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1, 0 >();
+      const RealType& hzInverse = entity.getMesh().template getSpaceStepsProducts< 0, 0, -1 >();
+      const IndexType& center = entity.getIndex();
+      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 >();
+
+      typedef Functions::FunctionAdapter< MeshType, VelocityFunctionType > FunctionAdapter;
+      return ( 0.25 / this->tau ) * this->artificialViscosity
+              * ( u[ west ] + u[ east ] + u[ north ] + u[ south ] + u[ up ] + u[ down ] - 6.0 * u[ center ] )
+           - 0.5
+                * ( FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 0 ], entity, time )
+                       * ( u[ east ] - u[ west ] ) * hxInverse
+                    + FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 1 ], entity, time )
+                         * ( u[ north ] - u[ south ] ) * hyInverse
+                    + FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 2 ], entity, time )
+                         * ( u[ up ] - u[ down ] ) * hzInverse );
+   }
+
+protected:
+   RealType tau;
+
+   RealType artificialViscosity;
+
+   VelocityFieldPointer velocityField;
 };
 
-      }// namespace Advection
-   } // namepsace Operators
-} // namespace TNL
+}  // namespace Advection
+}  // namespace Operators
+}  // namespace TNL
 
-#endif	/* LaxFridrichs_H */
+#endif /* LaxFridrichs_H */
diff --git a/src/TNL/Operators/Advection/Upwind.h b/src/TNL/Operators/Advection/Upwind.h
index e262595d2997f0a5671396a8ce8cf4356c23b67b..3c6eb59ed8e271f97abf1e1a8450b89d9681859f 100644
--- a/src/TNL/Operators/Advection/Upwind.h
+++ b/src/TNL/Operators/Advection/Upwind.h
@@ -13,316 +13,297 @@
 #include <TNL/Pointers/SharedPointer.h>
 
 namespace TNL {
-   namespace Operators {
-      namespace Advection {
-   
+namespace Operators {
+namespace Advection {
 
 template< typename Mesh,
           typename Real = typename Mesh::RealType,
           typename Index = typename Mesh::IndexType,
           typename VelocityFunction = Functions::MeshFunction< Mesh > >
 class Upwind
-{
-};
+{};
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index,
-          typename VelocityFunction >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index, typename VelocityFunction >
 class Upwind< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, VelocityFunction >
 {
-   public:
-      
-      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
-      typedef Pointers::SharedPointer< MeshType > MeshPointer;
-      static const int Dimensions = MeshType::getMeshDimension();
-      typedef typename MeshType::CoordinatesType CoordinatesType;
-      typedef Real RealType;
-      typedef Device DeviceType;
-      typedef Index IndexType;
-      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
-      typedef VelocityFunction VelocityFunctionType;
-      typedef Functions::VectorField< Dimensions, VelocityFunctionType > VelocityFieldType;
-      typedef Pointers::SharedPointer< VelocityFieldType, DeviceType > VelocityFieldPointer;
-      
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" )
-      {
-         config.addEntry< double >( prefix + "numerical-viscosity", "Value of artificial (numerical) viscosity in the Lax-Fridrichs scheme", 1.0 );
-      }
-      
-      Upwind()
-         : artificialViscosity( 1.0 ) {}
-      
-      Upwind( const VelocityFieldPointer& velocityField )
-         : artificialViscosity( 1.0 ), velocityField( velocityField ) {}
-      
-      bool setup( const MeshPointer& meshPointer,
-                  const Config::ParameterContainer& parameters,
-                  const String& prefix = "" )
-      {
-         this->artificialViscosity = parameters.getParameter< double >( prefix + "numerical-viscosity" );
-         return true;
-      }
-
-      void setViscosity(const Real& artificalViscosity)
-      {
-         this->artificialViscosity = artificalViscosity;
-      }
-      
-      void setTau(const Real& tau)
-      {
-          this->tau = tau;
-      };
-
-      void setVelocityField( const VelocityFieldPointer& velocityField )
-      {
-         this->velocityField = velocityField;
-      }
-      
-      const VelocityFieldPointer& getVelocityField() const
-      {
-         return this->velocityField;
-      }
-      
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      Real operator()( const MeshFunction& u,
-                       const MeshEntity& entity,
-                       const RealType& time = 0.0 ) const
-      {
-         static_assert( MeshEntity::getEntityDimension() == 1, "Wrong mesh entity dimensions." ); 
-         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 = neighborEntities.template getEntityIndex< 1 >(); 
-         const IndexType& west = neighborEntities.template getEntityIndex< -1 >(); 
-         typedef Functions::FunctionAdapter< MeshType, VelocityFunctionType > FunctionAdapter;
-         const RealType& speedX = FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 0 ], entity, time );
-         return ( - 0.5 * ( speedX + std::abs(speedX) ) * ( u[ center ] - u[ west ] ) * hxInverse ) 
-                - ( 0.5 * ( speedX - std::abs(speedX) ) * ( u[ east ] - u[ center ] ) * hxInverse ) ;
-      }
-      
-   protected:
-            
-      RealType tau;
-      
-      RealType artificialViscosity;
-      
-      VelocityFieldPointer velocityField;
+public:
+   typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
+   typedef Pointers::SharedPointer< MeshType > MeshPointer;
+   static const int Dimensions = MeshType::getMeshDimension();
+   typedef typename MeshType::CoordinatesType CoordinatesType;
+   typedef Real RealType;
+   typedef Device DeviceType;
+   typedef Index IndexType;
+   typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+   typedef VelocityFunction VelocityFunctionType;
+   typedef Functions::VectorField< Dimensions, VelocityFunctionType > VelocityFieldType;
+   typedef Pointers::SharedPointer< VelocityFieldType, DeviceType > VelocityFieldPointer;
+
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" )
+   {
+      config.addEntry< double >(
+         prefix + "numerical-viscosity", "Value of artificial (numerical) viscosity in the Lax-Fridrichs scheme", 1.0 );
+   }
+
+   Upwind() : artificialViscosity( 1.0 ) {}
+
+   Upwind( const VelocityFieldPointer& velocityField ) : artificialViscosity( 1.0 ), velocityField( velocityField ) {}
+
+   bool
+   setup( const MeshPointer& meshPointer, const Config::ParameterContainer& parameters, const String& prefix = "" )
+   {
+      this->artificialViscosity = parameters.getParameter< double >( prefix + "numerical-viscosity" );
+      return true;
+   }
+
+   void
+   setViscosity( const Real& artificalViscosity )
+   {
+      this->artificialViscosity = artificalViscosity;
+   }
+
+   void
+   setTau( const Real& tau )
+   {
+      this->tau = tau;
+   };
+
+   void
+   setVelocityField( const VelocityFieldPointer& velocityField )
+   {
+      this->velocityField = velocityField;
+   }
+
+   const VelocityFieldPointer&
+   getVelocityField() const
+   {
+      return this->velocityField;
+   }
+
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const RealType& time = 0.0 ) const
+   {
+      static_assert( MeshEntity::getEntityDimension() == 1, "Wrong mesh entity dimensions." );
+      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 = neighborEntities.template getEntityIndex< 1 >();
+      const IndexType& west = neighborEntities.template getEntityIndex< -1 >();
+      typedef Functions::FunctionAdapter< MeshType, VelocityFunctionType > FunctionAdapter;
+      const RealType& speedX =
+         FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 0 ], entity, time );
+      return ( -0.5 * ( speedX + std::abs( speedX ) ) * ( u[ center ] - u[ west ] ) * hxInverse )
+           - ( 0.5 * ( speedX - std::abs( speedX ) ) * ( u[ east ] - u[ center ] ) * hxInverse );
+   }
+
+protected:
+   RealType tau;
+
+   RealType artificialViscosity;
+
+   VelocityFieldPointer velocityField;
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index,
-          typename VelocityFunction >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index, typename VelocityFunction >
 class Upwind< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, VelocityFunction >
 {
-   public:
-      
-      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
-      typedef Pointers::SharedPointer< MeshType > MeshPointer;
-      static const int Dimensions = MeshType::getMeshDimension();
-      typedef typename MeshType::CoordinatesType CoordinatesType;
-      typedef Real RealType;
-      typedef Device DeviceType;
-      typedef Index IndexType;
-      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
-      typedef VelocityFunction VelocityFunctionType;
-      typedef Functions::VectorField< Dimensions, VelocityFunctionType > VelocityFieldType;
-      typedef Pointers::SharedPointer< VelocityFieldType, DeviceType > VelocityFieldPointer;
-      
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" )
-      {
-         config.addEntry< double >( prefix + "numerical-viscosity", "Value of artificial (numerical) viscosity in the Lax-Fridrichs scheme", 1.0 );
-      }      
-      
-      Upwind()
-         : artificialViscosity( 1.0 ) {}
-
-      Upwind( const VelocityFieldPointer& velocityField )
-         : artificialViscosity( 1.0 ), velocityField( velocityField ) {}      
-      
-      bool setup( const MeshPointer& meshPointer,
-                  const Config::ParameterContainer& parameters,
-                  const String& prefix = "" )
-      {
-         this->artificialViscosity = parameters.getParameter< double >( prefix + "numerical-viscosity" );
-         return true;
-      }
-
-      void setViscosity(const Real& artificalViscosity)
-      {
-         this->artificialViscosity = artificalViscosity;
-      }
-      
-      void setTau(const Real& tau)
-      {
-          this->tau = tau;
-      };
-
-      void setVelocityField( const VelocityFieldPointer& velocityField )
-      {
-         this->velocityField = velocityField;
-      }
-      
-      const VelocityFieldPointer& getVelocityField() const
-      {
-         return this->velocityField;
-      }
-      
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      Real operator()( const MeshFunction& u,
-                       const MeshEntity& entity,
-                       const RealType& time = 0.0 ) const
-      {
-         static_assert( MeshEntity::getEntityDimension() == 2, "Wrong mesh entity dimensions." ); 
-         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  = 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 >(); 
-         typedef Functions::FunctionAdapter< MeshType, VelocityFunctionType > FunctionAdapter;
-         const RealType& speedX = FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 0 ]);
-         const RealType& speedY = FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 1 ]);
-         
-         typedef Functions::FunctionAdapter< MeshType, VelocityFunctionType > FunctionAdapter;
-         return ( - 0.5 * ( speedX + std::abs(speedX) ) * ( u[ center ] - u[ west ] ) * hxInverse ) 
-                - ( 0.5 * ( speedX - std::abs(speedX) ) * ( u[ east ] - u[ center ] ) * hxInverse )
-                - ( 0.5 * ( speedY + std::abs(speedY) ) * ( u[ center ] - u[ south ] ) * hyInverse )
-                - ( 0.5 * ( speedY - std::abs(speedY) ) * ( u[ north ] - u[ center ] ) * hyInverse );     
-      }
-      
-   protected:
-            
-      RealType tau;
-      
-      RealType artificialViscosity;
-      
-      VelocityFieldPointer velocityField;
+public:
+   typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+   typedef Pointers::SharedPointer< MeshType > MeshPointer;
+   static const int Dimensions = MeshType::getMeshDimension();
+   typedef typename MeshType::CoordinatesType CoordinatesType;
+   typedef Real RealType;
+   typedef Device DeviceType;
+   typedef Index IndexType;
+   typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+   typedef VelocityFunction VelocityFunctionType;
+   typedef Functions::VectorField< Dimensions, VelocityFunctionType > VelocityFieldType;
+   typedef Pointers::SharedPointer< VelocityFieldType, DeviceType > VelocityFieldPointer;
+
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" )
+   {
+      config.addEntry< double >(
+         prefix + "numerical-viscosity", "Value of artificial (numerical) viscosity in the Lax-Fridrichs scheme", 1.0 );
+   }
+
+   Upwind() : artificialViscosity( 1.0 ) {}
+
+   Upwind( const VelocityFieldPointer& velocityField ) : artificialViscosity( 1.0 ), velocityField( velocityField ) {}
+
+   bool
+   setup( const MeshPointer& meshPointer, const Config::ParameterContainer& parameters, const String& prefix = "" )
+   {
+      this->artificialViscosity = parameters.getParameter< double >( prefix + "numerical-viscosity" );
+      return true;
+   }
+
+   void
+   setViscosity( const Real& artificalViscosity )
+   {
+      this->artificialViscosity = artificalViscosity;
+   }
+
+   void
+   setTau( const Real& tau )
+   {
+      this->tau = tau;
+   };
+
+   void
+   setVelocityField( const VelocityFieldPointer& velocityField )
+   {
+      this->velocityField = velocityField;
+   }
+
+   const VelocityFieldPointer&
+   getVelocityField() const
+   {
+      return this->velocityField;
+   }
+
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const RealType& time = 0.0 ) const
+   {
+      static_assert( MeshEntity::getEntityDimension() == 2, "Wrong mesh entity dimensions." );
+      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 = 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 >();
+      typedef Functions::FunctionAdapter< MeshType, VelocityFunctionType > FunctionAdapter;
+      const RealType& speedX = FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 0 ] );
+      const RealType& speedY = FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 1 ] );
+
+      typedef Functions::FunctionAdapter< MeshType, VelocityFunctionType > FunctionAdapter;
+      return ( -0.5 * ( speedX + std::abs( speedX ) ) * ( u[ center ] - u[ west ] ) * hxInverse )
+           - ( 0.5 * ( speedX - std::abs( speedX ) ) * ( u[ east ] - u[ center ] ) * hxInverse )
+           - ( 0.5 * ( speedY + std::abs( speedY ) ) * ( u[ center ] - u[ south ] ) * hyInverse )
+           - ( 0.5 * ( speedY - std::abs( speedY ) ) * ( u[ north ] - u[ center ] ) * hyInverse );
+   }
+
+protected:
+   RealType tau;
+
+   RealType artificialViscosity;
+
+   VelocityFieldPointer velocityField;
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index,
-          typename VelocityFunction >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index, typename VelocityFunction >
 class Upwind< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, VelocityFunction >
 {
-   public:
-      
-      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
-      typedef Pointers::SharedPointer< MeshType > MeshPointer;
-      static const int Dimensions = MeshType::getMeshDimension();
-      typedef typename MeshType::CoordinatesType CoordinatesType;
-      typedef Real RealType;
-      typedef Device DeviceType;
-      typedef Index IndexType;
-      typedef Functions::MeshFunction< MeshType > MeshFunctionType;
-      typedef VelocityFunction VelocityFunctionType;
-      typedef Functions::VectorField< Dimensions, VelocityFunctionType > VelocityFieldType;
-      typedef Pointers::SharedPointer< VelocityFieldType, DeviceType > VelocityFieldPointer;
-      
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" )
-      {
-         config.addEntry< double >( prefix + "numerical-viscosity", "Value of artificial (numerical) viscosity in the Lax-Fridrichs scheme", 1.0 );
-      }      
-      
-      Upwind()
-         : artificialViscosity( 1.0 ) {}
-
-      Upwind( const VelocityFieldPointer& velocityField )
-         : artificialViscosity( 1.0 ), velocityField( velocityField ) {}
-            
-      bool setup( const MeshPointer& meshPointer,
-                  const Config::ParameterContainer& parameters,
-                  const String& prefix = "" )
-      {
-         this->artificialViscosity = parameters.getParameter< double >( prefix + "numerical-viscosity" );
-         return true;
-      }
-
-      void setViscosity(const Real& artificalViscosity)
-      {
-         this->artificialViscosity = artificalViscosity;
-      }
-      
-      void setTau(const Real& tau)
-      {
-          this->tau = tau;
-      };
-
-      void setVelocityField( const VelocityFieldPointer& velocityField )
-      {
-         this->velocityField = velocityField;
-      }
-      
-      const VelocityFieldPointer& getVelocityField() const
-      {
-         return this->velocityField;
-      }
-      
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      Real operator()( const MeshFunction& u,
-                       const MeshEntity& entity,
-                       const RealType& time = 0.0 ) const
-      {
-         static_assert( MeshEntity::getEntityDimension() == 3, "Wrong mesh entity dimensions." ); 
-         static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" ); 
-         const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); 
-
-         const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1,  0,  0 >(); 
-         const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts<  0, -1,  0 >(); 
-         const RealType& hzInverse = entity.getMesh().template getSpaceStepsProducts<  0,  0, -1 >(); 
-         const IndexType& center = entity.getIndex();
-         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 >();
-         typedef Functions::FunctionAdapter< MeshType, VelocityFunctionType > FunctionAdapter;
-         const RealType& speedX = FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 0 ]);
-         const RealType& speedY = FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 1 ]);
-         const RealType& speedZ = FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 2 ]); 
-         
-         typedef Functions::FunctionAdapter< MeshType, VelocityFunctionType > FunctionAdapter;
-         return ( - 0.5 * ( speedX + std::abs(speedX) ) * ( u[ center ] - u[ west ] ) * hxInverse ) 
-                - ( 0.5 * ( speedX - std::abs(speedX) ) * ( u[ east ] - u[ center ] ) * hxInverse )
-                - ( 0.5 * ( speedY + std::abs(speedY) ) * ( u[ center ] - u[ south ] ) * hyInverse )
-                - ( 0.5 * ( speedY - std::abs(speedY) ) * ( u[ north ] - u[ center ] ) * hyInverse )
-                - ( 0.5 * ( speedZ + std::abs(speedZ) ) * ( u[ center ] - u[ down ] ) * hyInverse )
-                - ( 0.5 * ( speedZ - std::abs(speedZ) ) * ( u[ up ] - u[ center ] ) * hyInverse );    
-      }
-      
-   protected:
-            
-      RealType tau;
-      
-      RealType artificialViscosity;
-      
-      VelocityFieldPointer velocityField;
+public:
+   typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+   typedef Pointers::SharedPointer< MeshType > MeshPointer;
+   static const int Dimensions = MeshType::getMeshDimension();
+   typedef typename MeshType::CoordinatesType CoordinatesType;
+   typedef Real RealType;
+   typedef Device DeviceType;
+   typedef Index IndexType;
+   typedef Functions::MeshFunction< MeshType > MeshFunctionType;
+   typedef VelocityFunction VelocityFunctionType;
+   typedef Functions::VectorField< Dimensions, VelocityFunctionType > VelocityFieldType;
+   typedef Pointers::SharedPointer< VelocityFieldType, DeviceType > VelocityFieldPointer;
+
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" )
+   {
+      config.addEntry< double >(
+         prefix + "numerical-viscosity", "Value of artificial (numerical) viscosity in the Lax-Fridrichs scheme", 1.0 );
+   }
+
+   Upwind() : artificialViscosity( 1.0 ) {}
+
+   Upwind( const VelocityFieldPointer& velocityField ) : artificialViscosity( 1.0 ), velocityField( velocityField ) {}
+
+   bool
+   setup( const MeshPointer& meshPointer, const Config::ParameterContainer& parameters, const String& prefix = "" )
+   {
+      this->artificialViscosity = parameters.getParameter< double >( prefix + "numerical-viscosity" );
+      return true;
+   }
+
+   void
+   setViscosity( const Real& artificalViscosity )
+   {
+      this->artificialViscosity = artificalViscosity;
+   }
+
+   void
+   setTau( const Real& tau )
+   {
+      this->tau = tau;
+   };
+
+   void
+   setVelocityField( const VelocityFieldPointer& velocityField )
+   {
+      this->velocityField = velocityField;
+   }
+
+   const VelocityFieldPointer&
+   getVelocityField() const
+   {
+      return this->velocityField;
+   }
+
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const RealType& time = 0.0 ) const
+   {
+      static_assert( MeshEntity::getEntityDimension() == 3, "Wrong mesh entity dimensions." );
+      static_assert( MeshFunction::getEntitiesDimension() == 3, "Wrong preimage function" );
+      const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities();
+
+      const RealType& hxInverse = entity.getMesh().template getSpaceStepsProducts< -1, 0, 0 >();
+      const RealType& hyInverse = entity.getMesh().template getSpaceStepsProducts< 0, -1, 0 >();
+      const RealType& hzInverse = entity.getMesh().template getSpaceStepsProducts< 0, 0, -1 >();
+      const IndexType& center = entity.getIndex();
+      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 >();
+      typedef Functions::FunctionAdapter< MeshType, VelocityFunctionType > FunctionAdapter;
+      const RealType& speedX = FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 0 ] );
+      const RealType& speedY = FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 1 ] );
+      const RealType& speedZ = FunctionAdapter::getValue( this->velocityField.template getData< DeviceType >()[ 2 ] );
+
+      typedef Functions::FunctionAdapter< MeshType, VelocityFunctionType > FunctionAdapter;
+      return ( -0.5 * ( speedX + std::abs( speedX ) ) * ( u[ center ] - u[ west ] ) * hxInverse )
+           - ( 0.5 * ( speedX - std::abs( speedX ) ) * ( u[ east ] - u[ center ] ) * hxInverse )
+           - ( 0.5 * ( speedY + std::abs( speedY ) ) * ( u[ center ] - u[ south ] ) * hyInverse )
+           - ( 0.5 * ( speedY - std::abs( speedY ) ) * ( u[ north ] - u[ center ] ) * hyInverse )
+           - ( 0.5 * ( speedZ + std::abs( speedZ ) ) * ( u[ center ] - u[ down ] ) * hyInverse )
+           - ( 0.5 * ( speedZ - std::abs( speedZ ) ) * ( u[ up ] - u[ center ] ) * hyInverse );
+   }
+
+protected:
+   RealType tau;
+
+   RealType artificialViscosity;
+
+   VelocityFieldPointer velocityField;
 };
 
-      }// namespace Advection
-   } // namepsace Operators
-} // namespace TNL
+}  // namespace Advection
+}  // namespace Operators
+}  // namespace TNL
 
-#endif	/* Upwind_H */
+#endif /* Upwind_H */
diff --git a/src/TNL/Operators/Analytic/Heaviside.h b/src/TNL/Operators/Analytic/Heaviside.h
index 02bce9194181f944321f2c42b2d27963fccfa8ea..25f94d300e1cafb637d2ea146bcd1f18ec00a62d 100644
--- a/src/TNL/Operators/Analytic/Heaviside.h
+++ b/src/TNL/Operators/Analytic/Heaviside.h
@@ -13,67 +13,57 @@
 
 namespace TNL {
 namespace Operators {
-namespace Analytic {   
-   
-   
-template< int Dimensions,
-          typename Real = double >
+namespace Analytic {
+
+template< int Dimensions, typename Real = double >
 class Heaviside : public Functions::Domain< Dimensions, Functions::SpaceDomain >
 {
-   public:
-      
-      typedef Real RealType;
-      typedef Containers::StaticVector< Dimensions, 
-                                        RealType > PointType;
-      
-      Heaviside() : multiplicator( 1.0 ) {}
-      
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" )
-      {
-         config.addEntry< double >( prefix + "multiplicator", "Outer multiplicator of the Heaviside operator - -1.0 turns the function graph upside/down.", 1.0 );
-      }      
-      
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" )
-      {
-         this->multiplicator = parameters.getParameter< double >( prefix + "multiplicator" );
-         return true;
-      };
-      
-      
-      template< typename Function >
-      __cuda_callable__
-      RealType operator()( const Function& function,
-                           const PointType& vertex,
-                           const RealType& time = 0 ) const
-      {
-         const RealType aux = function( vertex, time );
-         if( aux > 0.0 )
-            return 1.0;
-         return 0.0;
-      }
-      
-      template< typename Function,
-                int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const Function& function,
-                                     const PointType& vertex,
-                                     const RealType& time = 0 ) const
-      {
-         if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 )
-            return this->operator()( function, vertex, time );
-         return 0.0;
-      }
-      
-   protected:
-      
-      RealType multiplicator;
-      
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< Dimensions, RealType >;
+
+   Heaviside() : multiplicator( 1.0 ) {}
+
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" )
+   {
+      config.addEntry< double >( prefix + "multiplicator",
+                                 "Outer multiplicator of the Heaviside operator - -1.0 turns the function graph upside/down.",
+                                 1.0 );
+   }
+
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" )
+   {
+      this->multiplicator = parameters.getParameter< double >( prefix + "multiplicator" );
+      return true;
+   };
+
+   template< typename Function >
+   __cuda_callable__
+   RealType
+   operator()( const Function& function, const PointType& vertex, const RealType& time = 0 ) const
+   {
+      const RealType aux = function( vertex, time );
+      if( aux > 0.0 )
+         return 1.0;
+      return 0.0;
+   }
+
+   template< typename Function, int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const Function& function, const PointType& vertex, const RealType& time = 0 ) const
+   {
+      if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 )
+         return this->operator()( function, vertex, time );
+      return 0.0;
+   }
+
+protected:
+   RealType multiplicator;
 };
 
-} // namespace Analytic
-} // namespace Operators
-} // namespace TNL
\ No newline at end of file
+}  // namespace Analytic
+}  // namespace Operators
+}  // namespace TNL
\ No newline at end of file
diff --git a/src/TNL/Operators/Analytic/Identity.h b/src/TNL/Operators/Analytic/Identity.h
index d7997fca3d2f5d29ec1c7454cd7e8f49dda4ec52..f3e188c209f6693ca1ca1b8ad409f9586c274eb7 100644
--- a/src/TNL/Operators/Analytic/Identity.h
+++ b/src/TNL/Operators/Analytic/Identity.h
@@ -12,47 +12,38 @@
 
 namespace TNL {
 namespace Operators {
-namespace Analytic {   
-   
-   
+namespace Analytic {
+
 template< int Dimensions, typename Real >
 class Identity : public Functions::Domain< Dimensions, Functions::SpaceDomain >
 {
-   public:
-      
-      typedef Real RealType;
-      typedef Containers::StaticVector< Dimensions, RealType > PointType;
-      
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" )
-      {
-         return true;
-      };
-      
-      
-      template< typename Function >
-      __cuda_callable__
-      RealType operator()( const Function& function,
-                           const PointType& vertex,
-                           const RealType& time = 0 ) const
-      {
-         return function( vertex, time );
-      }
-      
-      template< typename Function,
-                int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const Function& function,
-                                     const PointType& vertex,
-                                     const RealType& time = 0 ) const
-      {
-         return function.template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
-      }
-      
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< Dimensions, RealType >;
+
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" )
+   {
+      return true;
+   };
+
+   template< typename Function >
+   __cuda_callable__
+   RealType
+   operator()( const Function& function, const PointType& vertex, const RealType& time = 0 ) const
+   {
+      return function( vertex, time );
+   }
+
+   template< typename Function, int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const Function& function, const PointType& vertex, const RealType& time = 0 ) const
+   {
+      return function.template getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time );
+   }
 };
 
-} // namespace Analytic
-} // namespace Operators
-} // namespace TNL
+}  // namespace Analytic
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/Analytic/Rotation.h b/src/TNL/Operators/Analytic/Rotation.h
index d005f552d6b088cb0661ba90b2f3f1317fcf6fba..d7c71246ba3e31c748ade64787518d7fc58c93f3 100644
--- a/src/TNL/Operators/Analytic/Rotation.h
+++ b/src/TNL/Operators/Analytic/Rotation.h
@@ -10,68 +10,60 @@
 #include <TNL/Devices/Cuda.h>
 #include <TNL/Config/ParameterContainer.h>
 
-
 namespace TNL {
 namespace Operators {
-namespace Analytic {   
-   
+namespace Analytic {
+
+// TODO: Implement RotationXY, RotationXZ and RotationYZ in all dimensions.
+//       Where it does not make sense, the operator does nothing.
 
-// TODO: Implement RotationXY, RotationXZ and RotationYZ in all dimensions. 
-//       Where it does not make sense, the operator does nothing.   
-   
-template< typename Real,
-          int Dimensions >
+template< typename Real, int Dimensions >
 class RotationBase
 {
-   public:
-      typedef Real RealType;
-      typedef Containers::StaticVector< Dimenions, RealType > PointType;
-      
-      RotationBase() : center( 0.0 ) {};
-      
-      void setCenter( const PointType& center )
-      {
-         this->center = center;
-      }
-      
-      __cuda_callable__
-      const PointType& getCenter() const
-      {
-         return this->center;
-      }
-      
-   protected:
-      
-      PointType center;
+public:
+   typedef Real RealType;
+   typedef Containers::StaticVector< Dimenions, RealType > PointType;
+
+   RotationBase() : center( 0.0 ){};
+
+   void
+   setCenter( const PointType& center )
+   {
+      this->center = center;
+   }
+
+   __cuda_callable__
+   const PointType&
+   getCenter() const
+   {
+      return this->center;
+   }
+
+protected:
+   PointType center;
 };
-   
-template< typename Function,
-          int Dimensions = Function::getDomainDimenions() >
+
+template< typename Function, int Dimensions = Function::getDomainDimenions() >
 class Rotation;
 
 template< typename Function, 1 >
-class Rotation: public Functions::Domain< Function::getDomainDimenions(), 
-                                          Function::getDomainType() >
+class Rotation : public Functions::Domain< Function::getDomainDimenions(), Function::getDomainType() >
 {
-   public:
-      
-      typedef typename Function::RealType RealType;
-      typedef Containers::StaticVector< Function::getDomainDimenions(), 
-                                        RealType > PointType;
-      
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" ){};
-      
-      
-      __cuda_callable__
-      RealType operator()( const Function& function,
-                           const PointType& vertex,
-                           const RealType& time = 0 ) const
-      {
-         return function( vertex, time );
-      }
+public:
+   typedef typename Function::RealType RealType;
+   typedef Containers::StaticVector< Function::getDomainDimenions(), RealType > PointType;
+
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" ){};
+
+   __cuda_callable__
+   RealType
+   operator()( const Function& function, const PointType& vertex, const RealType& time = 0 ) const
+   {
+      return function( vertex, time );
+   }
 };
 
-} // namespace Analytic
-} // namespace Operators
-} // namespace TNL
+}  // namespace Analytic
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/Analytic/Shift.h b/src/TNL/Operators/Analytic/Shift.h
index 179a01e89181f15c276d4a85a43102c730f95f29..aacfe3d01a9a8e5203b4eae2d5569da7d12c3e9d 100644
--- a/src/TNL/Operators/Analytic/Shift.h
+++ b/src/TNL/Operators/Analytic/Shift.h
@@ -15,73 +15,65 @@ namespace TNL {
 namespace Operators {
 namespace Analytic {
 
-
 template< int Dimensions, typename Real >
 class Shift : public Functions::Domain< Dimensions, Functions::SpaceDomain >
 {
-   public:
-
-      typedef Real RealType;
-      typedef Containers::StaticVector< Dimensions, RealType > PointType;
-
-
-      Shift() : shift( 0.0 ) {};
-
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" )
-      {
-         config.addEntry< double >( prefix + "shift-x", "x-coordinate of the shift vector.", 0.0 );
-         config.addEntry< double >( prefix + "shift-y", "y-coordinate of the shift vector.", 0.0 );
-         config.addEntry< double >( prefix + "shift-z", "z-coordinate of the shift vector.", 0.0 );
-      }
-
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" )
-      {
-         this->shift = parameters.template getXyz< PointType >( prefix + "shift" );
-         return true;
-      }
-
-      void setShift( const PointType& shift )
-      {
-         this->shift = shift;
-      }
-
-      __cuda_callable__
-      const PointType& getShift() const
-      {
-         return this->shift;
-      }
-
-      template< typename Function >
-      __cuda_callable__
-      RealType operator()( const Function& function,
-                           const PointType& vertex,
-                           const RealType& time = 0 ) const
-      {
-         return function( vertex - this->shift, time );
-      }
-
-      template< typename Function,
-                int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const Function& function,
-                                     const PointType& vertex,
-                                     const RealType& time = 0 ) const
-      {
-         if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 )
-            return this->operator()( function, vertex - this->shift, time );
-         // TODO: implement the rest
-      }
-
-
-   protected:
-
-      PointType shift;
+public:
+   typedef Real RealType;
+   typedef Containers::StaticVector< Dimensions, RealType > PointType;
+
+   Shift() : shift( 0.0 ){};
+
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" )
+   {
+      config.addEntry< double >( prefix + "shift-x", "x-coordinate of the shift vector.", 0.0 );
+      config.addEntry< double >( prefix + "shift-y", "y-coordinate of the shift vector.", 0.0 );
+      config.addEntry< double >( prefix + "shift-z", "z-coordinate of the shift vector.", 0.0 );
+   }
+
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" )
+   {
+      this->shift = parameters.template getXyz< PointType >( prefix + "shift" );
+      return true;
+   }
+
+   void
+   setShift( const PointType& shift )
+   {
+      this->shift = shift;
+   }
+
+   __cuda_callable__
+   const PointType&
+   getShift() const
+   {
+      return this->shift;
+   }
+
+   template< typename Function >
+   __cuda_callable__
+   RealType
+   operator()( const Function& function, const PointType& vertex, const RealType& time = 0 ) const
+   {
+      return function( vertex - this->shift, time );
+   }
+
+   template< typename Function, int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const Function& function, const PointType& vertex, const RealType& time = 0 ) const
+   {
+      if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 )
+         return this->operator()( function, vertex - this->shift, time );
+      // TODO: implement the rest
+   }
+
+protected:
+   PointType shift;
 };
 
-} // namespace Analytic
-} // namespace Operators
-} // namespace TNL
+}  // namespace Analytic
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/Analytic/Sign.h b/src/TNL/Operators/Analytic/Sign.h
index f659d3f3029541ef0510bc3929ddeee6b4e84c6e..5b7e7b99f74b515ae1f6a1180da79a1ad8bbc6c1 100644
--- a/src/TNL/Operators/Analytic/Sign.h
+++ b/src/TNL/Operators/Analytic/Sign.h
@@ -12,105 +12,97 @@
 
 namespace TNL {
 namespace Operators {
-namespace Analytic {   
-   
-   
-template< int Dimensions,
-          typename Real >
+namespace Analytic {
+
+template< int Dimensions, typename Real >
 class Sign : public Functions::Domain< Dimensions, Functions::SpaceDomain >
 {
-   public:
-      
-      typedef Real RealType;
-      typedef Containers::StaticVector< Dimensions, RealType > PointType;
-      
-      Sign()
-         : positiveValue( 1.0 ),
-           negativeValue( -1.0 ),
-           zeroValue( 0.0 ) {}
-      
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" )
-      {
-         config.addEntry< double >( prefix + "positive-value", "Value returned for positive argument.", 1.0 );
-         config.addEntry< double >( prefix + "negative-value", "Value returned for negative argument.", -1.0 );
-         config.addEntry< double >( prefix + "zero-value", "Value returned for zero argument.", 0.0 );
-      }
-      
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" )
-      {
-         this->positiveValue = parameters.getParameter< double >( prefix + "positive-value" );
-         this->negativeValue = parameters.getParameter< double >( prefix + "negative-value" );
-         this->zeroValue = parameters.getParameter< double >( prefix + "zero-value" );
-         return true;
-      };      
-      
-      void setPositiveValue( const RealType& value )
-      {
-         this->positiveValue = value;
-      }
-      
-      const RealType& getPositiveValue() const
-      {
+public:
+   typedef Real RealType;
+   typedef Containers::StaticVector< Dimensions, RealType > PointType;
+
+   Sign() : positiveValue( 1.0 ), negativeValue( -1.0 ), zeroValue( 0.0 ) {}
+
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" )
+   {
+      config.addEntry< double >( prefix + "positive-value", "Value returned for positive argument.", 1.0 );
+      config.addEntry< double >( prefix + "negative-value", "Value returned for negative argument.", -1.0 );
+      config.addEntry< double >( prefix + "zero-value", "Value returned for zero argument.", 0.0 );
+   }
+
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" )
+   {
+      this->positiveValue = parameters.getParameter< double >( prefix + "positive-value" );
+      this->negativeValue = parameters.getParameter< double >( prefix + "negative-value" );
+      this->zeroValue = parameters.getParameter< double >( prefix + "zero-value" );
+      return true;
+   };
+
+   void
+   setPositiveValue( const RealType& value )
+   {
+      this->positiveValue = value;
+   }
+
+   const RealType&
+   getPositiveValue() const
+   {
+      return this->positiveValue;
+   }
+
+   void
+   setNegativeValue( const RealType& value )
+   {
+      this->negativeValue = value;
+   }
+
+   const RealType&
+   getNegativeValue() const
+   {
+      return this->negativeValue;
+   }
+
+   void
+   setZeroValue( const RealType& value )
+   {
+      this->zeroValue = value;
+   }
+
+   const RealType&
+   getZeroValue() const
+   {
+      return this->zeroValue;
+   }
+
+   template< typename Function >
+   __cuda_callable__
+   RealType
+   operator()( const Function& function, const PointType& vertex, const RealType& time = 0 ) const
+   {
+      const RealType aux = function( vertex, time );
+      if( aux > 0.0 )
          return this->positiveValue;
-      }
-      
-      void setNegativeValue( const RealType& value )
-      {
-         this->negativeValue = value;
-      }
-      
-      const RealType& getNegativeValue() const
-      {
+      else if( aux < 0.0 )
          return this->negativeValue;
-      }
-      
-      void setZeroValue( const RealType& value )
-      {
-         this->zeroValue = value;
-      }
-      
-      const RealType& getZeroValue() const
-      {
-         return this->zeroValue;
-      }
-      
-      template< typename Function >
-      __cuda_callable__
-      RealType operator()( const Function& function,
-                           const PointType& vertex,
-                           const RealType& time = 0 ) const
-      {
-         const RealType aux = function( vertex, time );
-         if( aux > 0.0 )
-            return this->positiveValue;
-         else
-            if( aux < 0.0 )
-               return this->negativeValue;
-         return this->zeroValue;         
-      }
-      
-      template< typename Function,
-                int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const Function& function,
-                                     const PointType& vertex,
-                                     const RealType& time = 0 ) const
-      {
-         if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 )
-            return this->operator()( function, vertex, time );
-         return 0.0;
-      }
-      
-   protected:
-      
-      RealType positiveValue, negativeValue, zeroValue;
-      
+      return this->zeroValue;
+   }
+
+   template< typename Function, int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const Function& function, const PointType& vertex, const RealType& time = 0 ) const
+   {
+      if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 )
+         return this->operator()( function, vertex, time );
+      return 0.0;
+   }
+
+protected:
+   RealType positiveValue, negativeValue, zeroValue;
 };
 
-} // namespace Analytic
-} // namespace Operators
-} // namespace TNL
+}  // namespace Analytic
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/Analytic/SmoothHeaviside.h b/src/TNL/Operators/Analytic/SmoothHeaviside.h
index 1389675034e9956eed81bfb2b4ceffd35cd80f61..a12185386faa92d5a84d3a0274b505c21afa1177 100644
--- a/src/TNL/Operators/Analytic/SmoothHeaviside.h
+++ b/src/TNL/Operators/Analytic/SmoothHeaviside.h
@@ -12,76 +12,67 @@
 
 namespace TNL {
 namespace Operators {
-namespace Analytic {   
-   
-   
-template< int Dimensions,
-          typename Real = double >
+namespace Analytic {
+
+template< int Dimensions, typename Real = double >
 class SmoothHeaviside : public Functions::Domain< Dimensions, Functions::SpaceDomain >
 {
-   public:
-      
-      typedef Real RealType;
-      typedef Containers::StaticVector< Dimensions, 
-                                        RealType > PointType;
-      
-      SmoothHeaviside() : sharpness( 1.0 ) {}
-      
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" )
-      {
-         config.addEntry< double >( prefix + "sharpness", "sharpness of smoothening", 1.0 );
-      }
+public:
+   using RealType = Real;
+   using PointType = Containers::StaticVector< Dimensions, RealType >;
+
+   SmoothHeaviside() : sharpness( 1.0 ) {}
+
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" )
+   {
+      config.addEntry< double >( prefix + "sharpness", "sharpness of smoothening", 1.0 );
+   }
+
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" )
+   {
+      this->sharpness = parameters.getParameter< double >( prefix + "sharpness" );
+      return true;
+   }
+
+   void
+   setSharpness( const RealType& sharpness )
+   {
+      this->sharpness = sharpness;
+   }
+
+   __cuda_callable__
+   const RealType
+   getShaprness() const
+   {
+      return this->sharpness;
+   }
+
+   template< typename Function >
+   __cuda_callable__
+   RealType
+   operator()( const Function& function, const PointType& vertex, const RealType& time = 0 ) const
+   {
+      const RealType aux = function( vertex, time );
+      return 1.0 / ( 1.0 + std::exp( -2.0 * sharpness * aux ) );
+   }
 
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" )
-      {
-         this->sharpness = parameters.getParameter< double >( prefix + "sharpness" );
-         return true;
-      }
-      
-      
-      void setSharpness( const RealType& sharpness )
-      {
-         this->sharpness = sharpness;
-      }
-      
-      __cuda_callable__
-      const RealType getShaprness() const
-      {
-         return this->sharpness;
-      }
-      
-      template< typename Function >
-      __cuda_callable__
-      RealType operator()( const Function& function,
-                           const PointType& vertex,
-                           const RealType& time = 0 ) const
-      {
-         const RealType aux = function( vertex, time );
-         return 1.0 / ( 1.0 + std::exp( -2.0 * sharpness * aux ) );
-      }
-      
-      template< typename Function,
-                int XDiffOrder = 0,
-                int YDiffOrder = 0,
-                int ZDiffOrder = 0 >
-      __cuda_callable__
-      RealType getPartialDerivative( const Function& function,
-                                     const PointType& vertex,
-                                     const RealType& time = 0 ) const
-      {
-         if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 )
-            return this->operator()( function, vertex, time );
-         return 0.0;
-         // TODO: implement the rest
-      }
-      
-   protected:
+   template< typename Function, int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0 >
+   __cuda_callable__
+   RealType
+   getPartialDerivative( const Function& function, const PointType& vertex, const RealType& time = 0 ) const
+   {
+      if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 )
+         return this->operator()( function, vertex, time );
+      return 0.0;
+      // TODO: implement the rest
+   }
 
-      RealType sharpness;
+protected:
+   RealType sharpness;
 };
 
-} // namespace Analytic
-} // namespace Operators
-} // namespace TNL
+}  // namespace Analytic
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/DirichletBoundaryConditions.h b/src/TNL/Operators/DirichletBoundaryConditions.h
index ae162c5cdfb491587d981f989899729ece38ead4..3d72741da01292357b5cc482d9c795db366e57c3 100644
--- a/src/TNL/Operators/DirichletBoundaryConditions.h
+++ b/src/TNL/Operators/DirichletBoundaryConditions.h
@@ -20,109 +20,102 @@ template< typename Mesh,
           typename Real = typename Mesh::RealType,
           typename Index = typename Mesh::GlobalIndexType >
 class DirichletBoundaryConditions
-: public Operator< Mesh,
-                   Functions::MeshBoundaryDomain,
-                   MeshEntitiesDimension,
-                   MeshEntitiesDimension,
-                   Real,
-                   Index >
+: public Operator< Mesh, Functions::MeshBoundaryDomain, MeshEntitiesDimension, MeshEntitiesDimension, Real, Index >
 {
-   public:
-
-      typedef Mesh MeshType;
-      typedef Function FunctionType;
-      typedef Real RealType;
-      typedef typename MeshType::DeviceType DeviceType;
-      typedef Index IndexType;
-      
-      typedef Pointers::SharedPointer<  Mesh > MeshPointer;
-      typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
-      typedef typename MeshType::PointType PointType;
-
-      static constexpr int getMeshDimension() { return MeshType::getMeshDimension(); }
-
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" )
-      {
-         Function::configSetup( config, prefix );
-      }
- 
-      bool setup( const MeshPointer& meshPointer,
-                  const Config::ParameterContainer& parameters,
-                  const String& prefix = "" )
-      {
-         return Functions::FunctionAdapter< MeshType, FunctionType >::template setup< MeshPointer >( this->function, meshPointer, parameters, prefix );
-      }
-
-      void setFunction( const Function& function )
-      {
-         this->function = function;
-      }
-
-      Function& getFunction()
-      {
-         return this->function;
-      }
- 
-      const Function& getFunction() const
-      {
-         return this->function;
-      }
-
-      template< typename EntityType,
-                typename MeshFunction >
-      __cuda_callable__
-      const RealType operator()( const MeshFunction& u,
-                                 const EntityType& entity,
-                                 const RealType& time = 0 ) const
-      {
-         //static_assert( EntityType::getDimension() == MeshEntitiesDimension, "Wrong mesh entity dimension." );
-         return Functions::FunctionAdapter< MeshType, Function >::template getValue( this->function, entity, time );
-      }
-
-      template< typename EntityType >
-      __cuda_callable__
-      IndexType getLinearSystemRowLength( const MeshType& mesh,
-                                          const IndexType& index,
-                                          const EntityType& entity ) const
-      {
-         return 1;
-      }
-
-      template< typename PreimageFunction,
-                typename MeshEntity,
-                typename Matrix,
-                typename Vector >
-      __cuda_callable__
-      void setMatrixElements( const PreimageFunction& u,
-                              const MeshEntity& entity,
-                              const RealType& time,
-                              const RealType& tau,
-                              Matrix& matrix,
-                              Vector& b ) const
-      {
-         auto matrixRow = matrix.getRow( entity.getIndex() );
-         const IndexType& index = entity.getIndex();
-         matrixRow.setElement( 0, index, 1.0 );
-         b[ index ] = Functions::FunctionAdapter< MeshType, Function >::getValue( this->function, entity, time );
-      }
- 
-
-   protected:
-
-      Function function;
- 
-   //static_assert( Device::DeviceType == Function::Device::DeviceType );
+public:
+   using MeshType = Mesh;
+   using FunctionType = Function;
+   using RealType = Real;
+   using DeviceType = typename MeshType::DeviceType;
+   using IndexType = Index;
+
+   using MeshPointer = Pointers::SharedPointer< Mesh >;
+   using DofVectorType = Containers::Vector< RealType, DeviceType, IndexType >;
+   using PointType = typename MeshType::PointType;
+
+   static constexpr int
+   getMeshDimension()
+   {
+      return MeshType::getMeshDimension();
+   }
+
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" )
+   {
+      Function::configSetup( config, prefix );
+   }
+
+   bool
+   setup( const MeshPointer& meshPointer, const Config::ParameterContainer& parameters, const String& prefix = "" )
+   {
+      return Functions::FunctionAdapter< MeshType, FunctionType >::template setup< MeshPointer >(
+         this->function, meshPointer, parameters, prefix );
+   }
+
+   void
+   setFunction( const Function& function )
+   {
+      this->function = function;
+   }
+
+   Function&
+   getFunction()
+   {
+      return this->function;
+   }
+
+   const Function&
+   getFunction() const
+   {
+      return this->function;
+   }
+
+   template< typename EntityType, typename MeshFunction >
+   __cuda_callable__
+   const RealType
+   operator()( const MeshFunction& u, const EntityType& entity, const RealType& time = 0 ) const
+   {
+      // static_assert( EntityType::getDimension() == MeshEntitiesDimension, "Wrong mesh entity dimension." );
+      return Functions::FunctionAdapter< MeshType, Function >::template getValue( this->function, entity, time );
+   }
+
+   template< typename EntityType >
+   __cuda_callable__
+   IndexType
+   getLinearSystemRowLength( const MeshType& mesh, const IndexType& index, const EntityType& entity ) const
+   {
+      return 1;
+   }
+
+   template< typename PreimageFunction, typename MeshEntity, typename Matrix, typename Vector >
+   __cuda_callable__
+   void
+   setMatrixElements( const PreimageFunction& u,
+                      const MeshEntity& entity,
+                      const RealType& time,
+                      const RealType& tau,
+                      Matrix& matrix,
+                      Vector& b ) const
+   {
+      auto matrixRow = matrix.getRow( entity.getIndex() );
+      const IndexType& index = entity.getIndex();
+      matrixRow.setElement( 0, index, 1.0 );
+      b[ index ] = Functions::FunctionAdapter< MeshType, Function >::getValue( this->function, entity, time );
+   }
+
+protected:
+   Function function;
+
+   // static_assert( Device::DeviceType == Function::Device::DeviceType );
 };
 
-
-template< typename Mesh,
-          typename Function >
-std::ostream& operator << ( std::ostream& str, const DirichletBoundaryConditions< Mesh, Function >& bc )
+template< typename Mesh, typename Function >
+std::ostream&
+operator<<( std::ostream& str, const DirichletBoundaryConditions< Mesh, Function >& bc )
 {
    str << "Dirichlet boundary conditions: vector = " << bc.getVector();
    return str;
 }
 
-} // namespace Operators
-} // namespace TNL
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/ExactFunctionInverseOperator.h b/src/TNL/Operators/ExactFunctionInverseOperator.h
index 40f1aebde341749538c0f1370c3054ba75f837f3..eb549440db3f69e4383bc7634eec93b3acffbdd2 100644
--- a/src/TNL/Operators/ExactFunctionInverseOperator.h
+++ b/src/TNL/Operators/ExactFunctionInverseOperator.h
@@ -14,74 +14,66 @@
 namespace TNL {
 namespace Operators {
 
-template< int Dimension,
-          typename InnerOperator= ExactIdentityOperator< Dimension > >
-class ExactFunctionInverseOperator
-   : public Functions::Domain< Dimension, Functions::SpaceDomain >
+template< int Dimension, typename InnerOperator = ExactIdentityOperator< Dimension > >
+class ExactFunctionInverseOperator : public Functions::Domain< Dimension, Functions::SpaceDomain >
 {
-   public:
- 
-      InnerOperator& getInnerOperator()
-      {
-         return this->innerOperator;
-      }
- 
-      const InnerOperator& getInnerOperator() const
-      {
-         return this->innerOperator;
-      }
+public:
+   InnerOperator&
+   getInnerOperator()
+   {
+      return this->innerOperator;
+   }
+
+   const InnerOperator&
+   getInnerOperator() const
+   {
+      return this->innerOperator;
+   }
+
+   template< typename Function >
+   __cuda_callable__
+   typename Function::RealType
+   operator()( const Function& function,
+               const typename Function::PointType& v,
+               const typename Function::RealType& time = 0.0 ) const
+   {
+      typedef typename Function::RealType RealType;
+      return 1.0 / innerOperator( function, v, time );
+   }
 
-      template< typename Function >
-      __cuda_callable__
-      typename Function::RealType
-         operator()( const Function& function,
-                     const typename Function::PointType& v,
-                     const typename Function::RealType& time = 0.0 ) const
-      {
-         typedef typename Function::RealType RealType;
-         return 1.0 / innerOperator( function, v, time );
+   template< typename Function, int XDerivative = 0, int YDerivative = 0, int ZDerivative = 0 >
+   __cuda_callable__
+   typename Function::RealType
+   getPartialDerivative( const Function& function,
+                         const typename Function::PointType& v,
+                         const typename Function::RealType& time = 0.0 ) const
+   {
+      static_assert( XDerivative >= 0 && YDerivative >= 0 && ZDerivative >= 0,
+                     "Partial derivative must be non-negative integer." );
+      static_assert( XDerivative + YDerivative + ZDerivative < 2,
+                     "Partial derivative of higher order then 1 are not implemented yet." );
+      typedef typename Function::RealType RealType;
+
+      if( XDerivative == 1 ) {
+         const RealType f = innerOperator( function, v, time );
+         const RealType f_x = innerOperator.template getPartialDerivative< Function, 1, 0, 0 >( function, v, time );
+         return -f_x / ( f * f );
       }
- 
-      template< typename Function,
-                int XDerivative = 0,
-                int YDerivative = 0,
-                int ZDerivative = 0 >
-      __cuda_callable__
-      typename Function::RealType
-         getPartialDerivative( const Function& function,
-                               const typename Function::PointType& v,
-                               const typename Function::RealType& time = 0.0 ) const
-      {
-         static_assert( XDerivative >= 0 && YDerivative >= 0 && ZDerivative >= 0,
-            "Partial derivative must be non-negative integer." );
-         static_assert( XDerivative + YDerivative + ZDerivative < 2, "Partial derivative of higher order then 1 are not implemented yet." );
-         typedef typename Function::RealType RealType;
- 
-         if( XDerivative == 1 )
-         {
-            const RealType f = innerOperator( function, v, time );
-            const RealType f_x = innerOperator.template getPartialDerivative< Function, 1, 0, 0 >( function, v, time );
-            return -f_x / ( f * f );
-         }
-         if( YDerivative == 1 )
-         {
-            const RealType f = innerOperator( function, v, time );
-            const RealType f_y = innerOperator.template getPartialDerivative< Function, 0, 1, 0 >( function, v, time );
-            return -f_y / ( f * f );
-         }
-         if( ZDerivative == 1 )
-         {
-            const RealType f = innerOperator( function, v, time );
-            const RealType f_z = innerOperator.template getPartialDerivative< Function, 0, 0, 1 >( function, v, time );
-            return -f_z / ( f * f );
-         }
+      if( YDerivative == 1 ) {
+         const RealType f = innerOperator( function, v, time );
+         const RealType f_y = innerOperator.template getPartialDerivative< Function, 0, 1, 0 >( function, v, time );
+         return -f_y / ( f * f );
       }
- 
-   protected:
- 
-      InnerOperator innerOperator;
-};
+      if( ZDerivative == 1 ) {
+         const RealType f = innerOperator( function, v, time );
+         const RealType f_z = innerOperator.template getPartialDerivative< Function, 0, 0, 1 >( function, v, time );
+         return -f_z / ( f * f );
+      }
+   }
 
-} // namespace Operators
-} // namespace TNL
+protected:
+   InnerOperator innerOperator;
+};
 
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/ExactIdentityOperator.h b/src/TNL/Operators/ExactIdentityOperator.h
index 66231564d91a69cca6037a9e94a2b337a637b304..be53c27c7af3c126543a3e266d1e9c15e965ddff 100644
--- a/src/TNL/Operators/ExactIdentityOperator.h
+++ b/src/TNL/Operators/ExactIdentityOperator.h
@@ -14,38 +14,32 @@ namespace TNL {
 namespace Operators {
 
 template< int Dimension >
-class ExactIdentityOperator
-   : public Functions::Domain< Dimension, Functions::SpaceDomain >
+class ExactIdentityOperator : public Functions::Domain< Dimension, Functions::SpaceDomain >
 {
-   public:
- 
-      template< typename Function >
-      __cuda_callable__
-      typename Function::RealType
-         operator()( const Function& function,
-                     const typename Function::PointType& v,
-                     const typename Function::RealType& time = 0.0 ) const
-      {
-         return function( v, time );
-      }
- 
-      template< typename Function,
-                int XDerivative = 0,
-                int YDerivative = 0,
-                int ZDerivative = 0 >
-      __cuda_callable__
-      typename Function::RealType
-         getPartialDerivative( const Function& function,
-                               const typename Function::PointType& v,
-                               const typename Function::RealType& time = 0.0 ) const
-      {
-         static_assert( XDerivative >= 0 && YDerivative >= 0 && ZDerivative >= 0,
-            "Partial derivative must be non-negative integer." );
- 
-         return function.template getPartialDerivative< XDerivative, YDerivative, ZDerivative >( v, time );
-      }
-};
+public:
+   template< typename Function >
+   __cuda_callable__
+   typename Function::RealType
+   operator()( const Function& function,
+               const typename Function::PointType& v,
+               const typename Function::RealType& time = 0.0 ) const
+   {
+      return function( v, time );
+   }
+
+   template< typename Function, int XDerivative = 0, int YDerivative = 0, int ZDerivative = 0 >
+   __cuda_callable__
+   typename Function::RealType
+   getPartialDerivative( const Function& function,
+                         const typename Function::PointType& v,
+                         const typename Function::RealType& time = 0.0 ) const
+   {
+      static_assert( XDerivative >= 0 && YDerivative >= 0 && ZDerivative >= 0,
+                     "Partial derivative must be non-negative integer." );
 
-} // namespace Operators
-} // namespace TNL
+      return function.template getPartialDerivative< XDerivative, YDerivative, ZDerivative >( v, time );
+   }
+};
 
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/ExactOperatorComposition.h b/src/TNL/Operators/ExactOperatorComposition.h
index 4606424af237bf885f61ee85ba12ee054f5037ec..8cac3ee3308b7fbf597ee0c2eb64405c62375e03 100644
--- a/src/TNL/Operators/ExactOperatorComposition.h
+++ b/src/TNL/Operators/ExactOperatorComposition.h
@@ -9,28 +9,25 @@
 namespace TNL {
 namespace Operators {
 
-template< typename OuterOperator,
-          typename InnerOperator >
+template< typename OuterOperator, typename InnerOperator >
 class ExactOperatorComposition
 {
-   public:
- 
-      template< typename Function >
-      __cuda_callable__ inline
-      typename Function::RealType operator()( const Function& function,
-                                              const typename Function::PointType& v,
-                                              const typename Function::RealType& time = 0.0 ) const
-      {
-         return OuterOperator( innerOperator( function, v, time), v, time );
-      }
- 
-   protected:
- 
-      InnerOperator innerOperator;
- 
-      OuterOperator outerOperator;
-};
+public:
+   template< typename Function >
+   __cuda_callable__
+   inline typename Function::RealType
+   operator()( const Function& function,
+               const typename Function::PointType& v,
+               const typename Function::RealType& time = 0.0 ) const
+   {
+      return OuterOperator( innerOperator( function, v, time ), v, time );
+   }
+
+protected:
+   InnerOperator innerOperator;
 
-} // namespace Operators
-} // namespace TNL
+   OuterOperator outerOperator;
+};
 
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/FiniteDifferences.h b/src/TNL/Operators/FiniteDifferences.h
index 6a5ec474219d17e322ceb6b0a9a306b0dc3afcc8..2b54ca010a1e94ca919e0717c4c8ee69f39df03b 100644
--- a/src/TNL/Operators/FiniteDifferences.h
+++ b/src/TNL/Operators/FiniteDifferences.h
@@ -13,21 +13,18 @@ namespace Operators {
 
 template< typename Grid >
 class FiniteDifferences
-{
-};
+{};
 
 template< typename Real, typename Device, typename Index >
 class FiniteDifferences< Meshes::Grid< 1, Real, Device, Index > >
 {
-   public:
-
-   typedef Real RealType;
-   typedef Device DeviceType;
-   typedef Index IndexType;
-   typedef Meshes::Grid< 1, Real, Device, Index > GridType;
-   //typedef typename GridType::CoordinatesType CoordinatesType;
-   typedef typename GridType::Cell CellType;
-
+public:
+   using RealType = Real;
+   using DeviceType = Device;
+   using IndexType = Index;
+   using GridType = Meshes::Grid< 1, Real, Device, Index >;
+   // typedef typename GridType::CoordinatesType CoordinatesType;
+   using CellType = typename GridType::Cell;
 
    template< typename GridFunction,
              int XDifferenceOrder,
@@ -36,9 +33,8 @@ class FiniteDifferences< Meshes::Grid< 1, Real, Device, Index > >
              int XDifferenceDirection = 0,
              int YDifferenceDirection = 0,
              int ZDifferenceDirection = 0 >
-   static RealType getDifference( const GridType& grid,
-                                  const GridFunction& inFunction,
-                                  GridFunction& outFunction );
+   static RealType
+   getDifference( const GridType& grid, const GridFunction& inFunction, GridFunction& outFunction );
 
    template< typename GridFunction,
              int XDifferenceOrder,
@@ -47,23 +43,20 @@ class FiniteDifferences< Meshes::Grid< 1, Real, Device, Index > >
              int XDifferenceDirection = 0,
              int YDifferenceDirection = 0,
              int ZDifferenceDirection = 0 >
-   static RealType getDifference( const GridType& grid,
-                                  const CellType& cell,
-                                  const GridFunction& function );
+   static RealType
+   getDifference( const GridType& grid, const CellType& cell, const GridFunction& function );
 };
 
 template< typename Real, typename Device, typename Index >
 class FiniteDifferences< Meshes::Grid< 2, Real, Device, Index > >
 {
-   public:
-
-   typedef Real RealType;
-   typedef Device DeviceType;
-   typedef Index IndexType;
-   typedef Meshes::Grid< 2, Real, Device, Index > GridType;
-   //typedef typename GridType::CoordinatesType CoordinatesType;
-   typedef typename GridType::Cell CellType;
-
+public:
+   using RealType = Real;
+   using DeviceType = Device;
+   using IndexType = Index;
+   using GridType = Meshes::Grid< 2, Real, Device, Index >;
+   // typedef typename GridType::CoordinatesType CoordinatesType;
+   using CellType = typename GridType::Cell;
 
    template< typename GridFunction,
              int XDifferenceOrder,
@@ -72,9 +65,8 @@ class FiniteDifferences< Meshes::Grid< 2, Real, Device, Index > >
              int XDifferenceDirection = 0,
              int YDifferenceDirection = 0,
              int ZDifferenceDirection = 0 >
-   static RealType getDifference( const GridType& grid,
-                                  const GridFunction& inFunction,
-                                  GridFunction& outFunction );
+   static RealType
+   getDifference( const GridType& grid, const GridFunction& inFunction, GridFunction& outFunction );
 
    template< typename GridFunction,
              int XDifferenceOrder,
@@ -83,22 +75,20 @@ class FiniteDifferences< Meshes::Grid< 2, Real, Device, Index > >
              int XDifferenceDirection = 0,
              int YDifferenceDirection = 0,
              int ZDifferenceDirection = 0 >
-   static RealType getDifference( const GridType& grid,
-                                  const CellType& cell,
-                                  const GridFunction& function );
+   static RealType
+   getDifference( const GridType& grid, const CellType& cell, const GridFunction& function );
 };
 
 template< typename Real, typename Device, typename Index >
 class FiniteDifferences< Meshes::Grid< 3, Real, Device, Index > >
 {
-   public:
-
-   typedef Real RealType;
-   typedef Device DeviceType;
-   typedef Index IndexType;
-   typedef Meshes::Grid< 3, Real, Device, Index > GridType;
-   //typedef typename GridType::CoordinatesType CoordinatesType;
-   typedef typename GridType::Cell CellType;
+public:
+   using RealType = Real;
+   using DeviceType = Device;
+   using IndexType = Index;
+   using GridType = Meshes::Grid< 3, Real, Device, Index >;
+   // typedef typename GridType::CoordinatesType CoordinatesType;
+   using CellType = typename GridType::Cell;
 
    template< typename GridFunction,
              int XDifferenceOrder,
@@ -107,9 +97,8 @@ class FiniteDifferences< Meshes::Grid< 3, Real, Device, Index > >
              int XDifferenceDirection = 0,
              int YDifferenceDirection = 0,
              int ZDifferenceDirection = 0 >
-   static RealType getDifference( const GridType& grid,
-                                  const GridFunction& inFunction,
-                                  GridFunction& outFunction );
+   static RealType
+   getDifference( const GridType& grid, const GridFunction& inFunction, GridFunction& outFunction );
 
    template< typename GridFunction,
              int XDifferenceOrder,
@@ -118,12 +107,11 @@ class FiniteDifferences< Meshes::Grid< 3, Real, Device, Index > >
              int XDifferenceDirection = 0,
              int YDifferenceDirection = 0,
              int ZDifferenceDirection = 0 >
-   static RealType getDifference( const GridType& grid,
-                                  const CellType& cell,
-                                  const GridFunction& function );
+   static RealType
+   getDifference( const GridType& grid, const CellType& cell, const GridFunction& function );
 };
 
-} // namespace Operators
-} // namespace TNL
+}  // namespace Operators
+}  // namespace TNL
 
 #include <TNL/Operators/FiniteDifferences_impl.h>
diff --git a/src/TNL/Operators/FiniteDifferences_impl.h b/src/TNL/Operators/FiniteDifferences_impl.h
index 6bf4391f43151e2c11325c1e6e442251dfb76e8c..98e175ed44bd9af877bdfe81fed996b23daa8078 100644
--- a/src/TNL/Operators/FiniteDifferences_impl.h
+++ b/src/TNL/Operators/FiniteDifferences_impl.h
@@ -12,16 +12,17 @@ namespace TNL {
 namespace Operators {
 
 template< typename Real, typename Device, typename Index >
-   template< typename GridFunction,
-             int XDifferenceOrder,
-             int YDifferenceOrder,
-             int ZDifferenceOrder,
-             int XDifferenceDirection,
-             int YDifferenceDirection,
-             int ZDifferenceDirection >
-Real FiniteDifferences< Meshes::Grid< 1, Real, Device, Index > >::getDifference( const GridType& grid,
-                                                                               const GridFunction& inFunction,
-                                                                               GridFunction& outFunction )
+template< typename GridFunction,
+          int XDifferenceOrder,
+          int YDifferenceOrder,
+          int ZDifferenceOrder,
+          int XDifferenceDirection,
+          int YDifferenceDirection,
+          int ZDifferenceDirection >
+Real
+FiniteDifferences< Meshes::Grid< 1, Real, Device, Index > >::getDifference( const GridType& grid,
+                                                                            const GridFunction& inFunction,
+                                                                            GridFunction& outFunction )
 {
    IndexType iBegin, iEnd;
    if( XDifferenceDirection == 0 || XDifferenceDirection == 1 )
@@ -34,53 +35,48 @@ Real FiniteDifferences< Meshes::Grid< 1, Real, Device, Index > >::getDifference(
       iEnd = grid.getDimensions().x();
 
    typename GridType::Cell cell( grid );
-   for( cell.getCoordinates().x() = iBegin;
-        cell.getCoordinates().x() < iEnd;
-        cell.getCoordinates().x()++ )
-   {
-      outFunction[ grid.getEntityIndex( cell ) ] =
-               getDifference< GridFunction,
-                              XDifferenceOrder,
-                              YDifferenceOrder,
-                              ZDifferenceOrder,
-                              XDifferenceDirection,
-                              YDifferenceDirection,
-                              ZDifferenceDirection >( grid, cell, inFunction );
+   for( cell.getCoordinates().x() = iBegin; cell.getCoordinates().x() < iEnd; cell.getCoordinates().x()++ ) {
+      outFunction[ grid.getEntityIndex( cell ) ] = getDifference< GridFunction,
+                                                                  XDifferenceOrder,
+                                                                  YDifferenceOrder,
+                                                                  ZDifferenceOrder,
+                                                                  XDifferenceDirection,
+                                                                  YDifferenceDirection,
+                                                                  ZDifferenceDirection >( grid, cell, inFunction );
    }
 }
 
 template< typename Real, typename Device, typename Index >
-   template< typename GridFunction,
-             int XDifferenceOrder,
-             int YDifferenceOrder,
-             int ZDifferenceOrder,
-             int XDifferenceDirection,
-             int YDifferenceDirection,
-             int ZDifferenceDirection >
-Real FiniteDifferences< Meshes::Grid< 1, Real, Device, Index > >::getDifference( const GridType& grid,
-                                                                               const CellType& cell,
-                                                                               const GridFunction& function )
+template< typename GridFunction,
+          int XDifferenceOrder,
+          int YDifferenceOrder,
+          int ZDifferenceOrder,
+          int XDifferenceDirection,
+          int YDifferenceDirection,
+          int ZDifferenceDirection >
+Real
+FiniteDifferences< Meshes::Grid< 1, Real, Device, Index > >::getDifference( const GridType& grid,
+                                                                            const CellType& cell,
+                                                                            const GridFunction& function )
 {
-
    if( YDifferenceOrder > 0 || ZDifferenceOrder > 0 )
       return 0.0;
    const RealType hx = grid.getSpaceSteps().x();
    auto neighborEntities = cell.getNeighborEntities();
    IndexType cellIndex = grid.getEntityIndex( cell );
-   if( XDifferenceOrder == 1 )
-   {
+   if( XDifferenceOrder == 1 ) {
       if( XDifferenceDirection == 0 )
-         return ( function[ neighborEntities.template getEntityIndex< 1 >() ] -
-                  function[ neighborEntities.template getEntityIndex< -1 >() ] ) / ( 2.0 * hx );
+         return ( function[ neighborEntities.template getEntityIndex< 1 >() ]
+                  - function[ neighborEntities.template getEntityIndex< -1 >() ] )
+              / ( 2.0 * hx );
       else
-         return ( function[ neighborEntities.template getEntityIndex< XDifferenceDirection >() ] -
-                  function[ cellIndex ] ) / ( XDifferenceDirection * hx );
+         return ( function[ neighborEntities.template getEntityIndex< XDifferenceDirection >() ] - function[ cellIndex ] )
+              / ( XDifferenceDirection * hx );
    }
-   if( XDifferenceOrder == 2 )
-   {
-      return ( function[ neighborEntities.template getEntityIndex< 1 >() ] -
-               2.0 * function[ cellIndex ] +
-               function[ neighborEntities.template getEntityIndex< -1 >() ] ) / (  hx * hx );
+   if( XDifferenceOrder == 2 ) {
+      return ( function[ neighborEntities.template getEntityIndex< 1 >() ] - 2.0 * function[ cellIndex ]
+               + function[ neighborEntities.template getEntityIndex< -1 >() ] )
+           / ( hx * hx );
    }
 }
 
@@ -89,64 +85,60 @@ Real FiniteDifferences< Meshes::Grid< 1, Real, Device, Index > >::getDifference(
  */
 
 template< typename Real, typename Device, typename Index >
-   template< typename GridFunction,
-             int XDifferenceOrder,
-             int YDifferenceOrder,
-             int ZDifferenceOrder,
-             int XDifferenceDirection,
-             int YDifferenceDirection,
-             int ZDifferenceDirection >
-Real FiniteDifferences< Meshes::Grid< 2, Real, Device, Index > >::getDifference( const GridType& grid,
-                                                                               const GridFunction& inFunction,
-                                                                               GridFunction& outFunction )
-{
-
-}
+template< typename GridFunction,
+          int XDifferenceOrder,
+          int YDifferenceOrder,
+          int ZDifferenceOrder,
+          int XDifferenceDirection,
+          int YDifferenceDirection,
+          int ZDifferenceDirection >
+Real
+FiniteDifferences< Meshes::Grid< 2, Real, Device, Index > >::getDifference( const GridType& grid,
+                                                                            const GridFunction& inFunction,
+                                                                            GridFunction& outFunction )
+{}
 
 template< typename Real, typename Device, typename Index >
-   template< typename GridFunction,
-             int XDifferenceOrder,
-             int YDifferenceOrder,
-             int ZDifferenceOrder,
-             int XDifferenceDirection,
-             int YDifferenceDirection,
-             int ZDifferenceDirection >
-Real FiniteDifferences< Meshes::Grid< 2, Real, Device, Index > >::getDifference( const GridType& grid,
-                                                                               const CellType& cell,
-                                                                               const GridFunction& function )
+template< typename GridFunction,
+          int XDifferenceOrder,
+          int YDifferenceOrder,
+          int ZDifferenceOrder,
+          int XDifferenceDirection,
+          int YDifferenceDirection,
+          int ZDifferenceDirection >
+Real
+FiniteDifferences< Meshes::Grid< 2, Real, Device, Index > >::getDifference( const GridType& grid,
+                                                                            const CellType& cell,
+                                                                            const GridFunction& function )
 {
    if( ZDifferenceOrder > 0 )
       return 0.0;
    auto neighborEntities = cell.getNeighborEntities();
    IndexType cellIndex = grid.getEntityIndex( cell );
-   if( XDifferenceOrder == 1 )
-   {
+   if( XDifferenceOrder == 1 ) {
       const RealType hx = grid.getSpaceSteps().x();
-      return ( function[ neighborEntities.template getEntityIndex< XDifferenceDirection, 0 >( cellIndex ) ] -
-               function[ cellIndex ] ) / ( XDifferenceDirection * hx );
+      return ( function[ neighborEntities.template getEntityIndex< XDifferenceDirection, 0 >( cellIndex ) ]
+               - function[ cellIndex ] )
+           / ( XDifferenceDirection * hx );
    }
-   if( XDifferenceOrder == 2 )
-   {
+   if( XDifferenceOrder == 2 ) {
       const RealType hx = grid.getSpaceSteps().x();
-      return ( function[ neighborEntities.template getEntityIndex< 1, 0 >( cellIndex ) ] -
-               2.0 * function[ cellIndex ] +
-               function[ neighborEntities.template getEntityIndex< -1, 0 >( cellIndex ) ] ) / (  hx * hx );
+      return ( function[ neighborEntities.template getEntityIndex< 1, 0 >( cellIndex ) ] - 2.0 * function[ cellIndex ]
+               + function[ neighborEntities.template getEntityIndex< -1, 0 >( cellIndex ) ] )
+           / ( hx * hx );
    }
-   if( YDifferenceOrder == 1 )
-   {
+   if( YDifferenceOrder == 1 ) {
       const RealType hy = grid.getSpaceSteps().y();
-      return ( function[ neighborEntities.template getEntityIndex< 0, YDifferenceDirection >( cellIndex ) ] -
-               function[ cellIndex ] ) / ( YDifferenceDirection * hy );
+      return ( function[ neighborEntities.template getEntityIndex< 0, YDifferenceDirection >( cellIndex ) ]
+               - function[ cellIndex ] )
+           / ( YDifferenceDirection * hy );
    }
-   if( YDifferenceOrder == 2 )
-   {
+   if( YDifferenceOrder == 2 ) {
       const RealType hy = grid.getSpaceSteps().y();
-      return ( function[ neighborEntities.template getEntityIndex< 0, 1 >( cellIndex ) ] -
-               2.0 * function[ cellIndex ] +
-               function[ neighborEntities.template getEntityIndex< 0, -1 >( cellIndex ) ] ) / (  hy * hy );
+      return ( function[ neighborEntities.template getEntityIndex< 0, 1 >( cellIndex ) ] - 2.0 * function[ cellIndex ]
+               + function[ neighborEntities.template getEntityIndex< 0, -1 >( cellIndex ) ] )
+           / ( hy * hy );
    }
-
-
 }
 
 /****
@@ -154,79 +146,74 @@ Real FiniteDifferences< Meshes::Grid< 2, Real, Device, Index > >::getDifference(
  */
 
 template< typename Real, typename Device, typename Index >
-   template< typename GridFunction,
-             int XDifferenceOrder,
-             int YDifferenceOrder,
-             int ZDifferenceOrder,
-             int XDifferenceDirection,
-             int YDifferenceDirection,
-             int ZDifferenceDirection >
-Real FiniteDifferences< Meshes::Grid< 3, Real, Device, Index > >::getDifference( const GridType& grid,
-                                                                               const GridFunction& inFunction,
-                                                                               GridFunction& outFunction )
-{
-
-}
+template< typename GridFunction,
+          int XDifferenceOrder,
+          int YDifferenceOrder,
+          int ZDifferenceOrder,
+          int XDifferenceDirection,
+          int YDifferenceDirection,
+          int ZDifferenceDirection >
+Real
+FiniteDifferences< Meshes::Grid< 3, Real, Device, Index > >::getDifference( const GridType& grid,
+                                                                            const GridFunction& inFunction,
+                                                                            GridFunction& outFunction )
+{}
 
 template< typename Real, typename Device, typename Index >
-   template< typename GridFunction,
-             int XDifferenceOrder,
-             int YDifferenceOrder,
-             int ZDifferenceOrder,
-             int XDifferenceDirection,
-             int YDifferenceDirection,
-             int ZDifferenceDirection >
-Real FiniteDifferences< Meshes::Grid< 3, Real, Device, Index > >::getDifference( const GridType& grid,
-                                                                               const CellType& cell,
-                                                                               const GridFunction& function )
+template< typename GridFunction,
+          int XDifferenceOrder,
+          int YDifferenceOrder,
+          int ZDifferenceOrder,
+          int XDifferenceDirection,
+          int YDifferenceDirection,
+          int ZDifferenceDirection >
+Real
+FiniteDifferences< Meshes::Grid< 3, Real, Device, Index > >::getDifference( const GridType& grid,
+                                                                            const CellType& cell,
+                                                                            const GridFunction& function )
 {
    auto neighborEntities = cell.getNeighborEntities();
    IndexType cellIndex = grid.getEntityIndex( cell );
 
-   if( XDifferenceOrder == 1 )
-   {
+   if( XDifferenceOrder == 1 ) {
       const RealType hx = grid.getSpaceSteps().x();
-      return ( function[ neighborEntities.template getEntityIndex< XDifferenceDirection, 0, 0 >( cellIndex ) ] -
-               function[ cellIndex ] ) / ( XDifferenceDirection * hx );
+      return ( function[ neighborEntities.template getEntityIndex< XDifferenceDirection, 0, 0 >( cellIndex ) ]
+               - function[ cellIndex ] )
+           / ( XDifferenceDirection * hx );
    }
-   if( XDifferenceOrder == 2 )
-   {
+   if( XDifferenceOrder == 2 ) {
       const RealType hx = grid.getSpaceSteps().x();
-      return ( function[ neighborEntities.template getEntityIndex< 1, 0, 0 >( cellIndex ) ] -
-               2.0 * function[ cellIndex ] +
-               function[ neighborEntities.template getEntityIndex< -1, 0, 0 >( cellIndex ) ] ) / (  hx * hx );
+      return ( function[ neighborEntities.template getEntityIndex< 1, 0, 0 >( cellIndex ) ] - 2.0 * function[ cellIndex ]
+               + function[ neighborEntities.template getEntityIndex< -1, 0, 0 >( cellIndex ) ] )
+           / ( hx * hx );
    }
-   if( YDifferenceOrder == 1 )
-   {
+   if( YDifferenceOrder == 1 ) {
       const RealType hy = grid.getSpaceSteps().y();
-      return ( function[ neighborEntities.template getEntityIndex< 0, YDifferenceDirection, 0 >( cellIndex ) ] -
-               function[ cellIndex ] ) / ( YDifferenceDirection * hy );
+      return ( function[ neighborEntities.template getEntityIndex< 0, YDifferenceDirection, 0 >( cellIndex ) ]
+               - function[ cellIndex ] )
+           / ( YDifferenceDirection * hy );
    }
-   if( YDifferenceOrder == 2 )
-   {
+   if( YDifferenceOrder == 2 ) {
       const RealType hy = grid.getSpaceSteps().y();
-      return ( function[ neighborEntities.template getEntityIndex< 0, 1, 0 >( cellIndex ) ] -
-               2.0 * function[ cellIndex ] +
-               function[ neighborEntities.template getEntityIndex< 0, -1, 0 >( cellIndex ) ] ) / (  hy * hy );
+      return ( function[ neighborEntities.template getEntityIndex< 0, 1, 0 >( cellIndex ) ] - 2.0 * function[ cellIndex ]
+               + function[ neighborEntities.template getEntityIndex< 0, -1, 0 >( cellIndex ) ] )
+           / ( hy * hy );
    }
-   if( ZDifferenceOrder == 1 )
-   {
+   if( ZDifferenceOrder == 1 ) {
       const RealType hz = grid.getSpaceSteps().z();
-      return ( function[ neighborEntities.template getEntityIndex< 0, 0, ZDifferenceDirection >( cellIndex ) ] -
-               function[ cellIndex ] ) / ( ZDifferenceDirection * hz );
+      return ( function[ neighborEntities.template getEntityIndex< 0, 0, ZDifferenceDirection >( cellIndex ) ]
+               - function[ cellIndex ] )
+           / ( ZDifferenceDirection * hz );
    }
-   if( ZDifferenceOrder == 2 )
-   {
+   if( ZDifferenceOrder == 2 ) {
       const RealType hz = grid.getSpaceSteps().z();
-      return ( function[ neighborEntities.template getEntityIndex< 0, 0, 1 >( cellIndex ) ] -
-               2.0 * function[ cellIndex ] +
-               function[ neighborEntities.template getEntityIndex< 0, 0, -1 >( cellIndex ) ] ) / (  hz * hz );
+      return ( function[ neighborEntities.template getEntityIndex< 0, 0, 1 >( cellIndex ) ] - 2.0 * function[ cellIndex ]
+               + function[ neighborEntities.template getEntityIndex< 0, 0, -1 >( cellIndex ) ] )
+           / ( hz * hz );
    }
-
-
 }
 
-} // namespace Operators
-} // namespace TNL
+}  // namespace Operators
+}  // namespace TNL
 
 #include <TNL/Operators/FiniteDifferences_impl.h>
\ No newline at end of file
diff --git a/src/TNL/Operators/FunctionInverseOperator.h b/src/TNL/Operators/FunctionInverseOperator.h
index e90e3b6546f1863c588a6ffcc5119fd4c28cabfe..6f37119b27e118fc416bd57382cfcdfc0ab56105 100644
--- a/src/TNL/Operators/FunctionInverseOperator.h
+++ b/src/TNL/Operators/FunctionInverseOperator.h
@@ -14,42 +14,38 @@ namespace TNL {
 namespace Operators {
 
 template< typename OperatorT >
-class FunctionInverseOperator
-: public Operator< typename OperatorT::MeshType,
-                      OperatorT::getDomainType(),
-                      OperatorT::getPreimageEntitiesDimension(),
-                      OperatorT::getImageEntitiesDimension(),
-                      typename OperatorT::RealType,
-                      typename OperatorT::IndexType >
+class FunctionInverseOperator : public Operator< typename OperatorT::MeshType,
+                                                 OperatorT::getDomainType(),
+                                                 OperatorT::getPreimageEntitiesDimension(),
+                                                 OperatorT::getImageEntitiesDimension(),
+                                                 typename OperatorT::RealType,
+                                                 typename OperatorT::IndexType >
 {
-   public:
- 
-      typedef OperatorT OperatorType;
-      typedef typename OperatorType::RealType RealType;
-      typedef typename OperatorType::IndexType IndexType;
-      typedef FunctionInverseOperator ExactOperatorType;
- 
-      FunctionInverseOperator( const OperatorType& operator_ )
-      : operator_( operator_ ) {};
- 
-      const OperatorType& getOperator() const { return this->operator_; }
- 
-      template< typename MeshFunction,
-                typename MeshEntity >
-      __cuda_callable__
-      typename MeshFunction::RealType
-      operator()( const MeshFunction& u,
-                  const MeshEntity& entity,
-                  const typename MeshFunction::RealType& time = 0.0 ) const
-      {
-         return 1.0 / operator_( u, entity, time );
-      }
- 
-   protected:
- 
-      const OperatorType& operator_;
-};
+public:
+   typedef OperatorT OperatorType;
+   typedef typename OperatorType::RealType RealType;
+   typedef typename OperatorType::IndexType IndexType;
+   typedef FunctionInverseOperator ExactOperatorType;
+
+   FunctionInverseOperator( const OperatorType& operator_ ) : operator_( operator_ ){};
+
+   const OperatorType&
+   getOperator() const
+   {
+      return this->operator_;
+   }
 
-} // namespace Operators
-} // namespace TNL
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   typename MeshFunction::RealType
+   operator()( const MeshFunction& u, const MeshEntity& entity, const typename MeshFunction::RealType& time = 0.0 ) const
+   {
+      return 1.0 / operator_( u, entity, time );
+   }
+
+protected:
+   const OperatorType& operator_;
+};
 
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/IdentityOperator.h b/src/TNL/Operators/IdentityOperator.h
index 2c205baa753240e05b4e2fee9a21ccf832d4d367..767ea19c6d53a0cf990cbc5e65cec94ae43eef13 100644
--- a/src/TNL/Operators/IdentityOperator.h
+++ b/src/TNL/Operators/IdentityOperator.h
@@ -12,36 +12,28 @@ namespace TNL {
 namespace Operators {
 
 template< typename MeshFunction >
-class IdentityOperator
-   : public Domain< MeshFunction::getMeshDimension(), MeshFunction::getDomainType() >
+class IdentityOperator : public Domain< MeshFunction::getMeshDimension(), MeshFunction::getDomainType() >
 {
-   public:
- 
-      typedef typename MeshFunction::MeshType MeshType;
-      typedef typename MeshFunction::RealType RealType;
-      typedef typename MeshFunction::IndexType IndexType;
- 
-      OperatorComposition( const MeshFunction& meshFunction )
-      : meshFunction( meshFunction ) {};
- 
-      template< typename MeshEntity >
-      __cuda_callable__
-      RealType operator()(
-         const MeshFunction& function,
-         const MeshEntity& meshEntity,
-         const RealType& time = 0 ) const
-      {
-         static_assert( MeshFunction::getMeshDimension() == InnerOperator::getDimension(),
-            "Mesh function and operator have both different number of dimensions." );
-         return this->meshFunction( meshEntity, time );
-      }
- 
- 
-   protected:
- 
-      const MeshFunction& meshFunction;
-};
+public:
+   typedef typename MeshFunction::MeshType MeshType;
+   typedef typename MeshFunction::RealType RealType;
+   typedef typename MeshFunction::IndexType IndexType;
+
+   OperatorComposition( const MeshFunction& meshFunction ) : meshFunction( meshFunction ){};
 
-} // namespace Operators
-} // namespace TNL
+   template< typename MeshEntity >
+   __cuda_callable__
+   RealType
+   operator()( const MeshFunction& function, const MeshEntity& meshEntity, const RealType& time = 0 ) const
+   {
+      static_assert( MeshFunction::getMeshDimension() == InnerOperator::getDimension(),
+                     "Mesh function and operator have both different number of dimensions." );
+      return this->meshFunction( meshEntity, time );
+   }
+
+protected:
+   const MeshFunction& meshFunction;
+};
 
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/NeumannBoundaryConditions.h b/src/TNL/Operators/NeumannBoundaryConditions.h
index 38aca151af81dbd0e8a7b374f06c4b7d9cbb857d..8f5e11f2e19caf60c5fcb52e245dd616a78d3cfe 100644
--- a/src/TNL/Operators/NeumannBoundaryConditions.h
+++ b/src/TNL/Operators/NeumannBoundaryConditions.h
@@ -4,7 +4,6 @@
 //
 // SPDX-License-Identifier: MIT
 
-
 #pragma once
 
 #include <TNL/Functions/FunctionAdapter.h>
@@ -17,9 +16,7 @@ template< typename Mesh,
           typename Real = typename Mesh::RealType,
           typename Index = typename Mesh::GlobalIndexType >
 class NeumannBoundaryConditions
-{
-
-};
+{};
 
 /****
  * Base
@@ -27,421 +24,361 @@ class NeumannBoundaryConditions
 template< typename Function >
 class NeumannBoundaryConditionsBase
 {
-   public:
-      
-      typedef Function FunctionType;
-      
-      static void configSetup( const Config::ConfigDescription& config,
-                               const String& prefix = "" )
-      {
-         Function::configSetup( config, prefix );
-      }
-      
-      template< typename MeshPointer >
-      bool setup( const MeshPointer& meshPointer, 
-                  const Config::ParameterContainer& parameters,
-                  const String& prefix = "" )
-      {
-         return Functions::FunctionAdapter< typename MeshPointer::ObjectType, FunctionType >::setup( this->function, meshPointer, parameters, prefix );
-      }
+public:
+   using FunctionType = Function;
 
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" )
-      {
-         Function::configSetup( config, prefix );
-      };
+   static void
+   configSetup( const Config::ConfigDescription& config, const String& prefix = "" )
+   {
+      Function::configSetup( config, prefix );
+   }
 
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" )
-      {
-          return this->function.setup( parameters, prefix );
-      };
+   template< typename MeshPointer >
+   bool
+   setup( const MeshPointer& meshPointer, const Config::ParameterContainer& parameters, const String& prefix = "" )
+   {
+      return Functions::FunctionAdapter< typename MeshPointer::ObjectType, FunctionType >::setup(
+         this->function, meshPointer, parameters, prefix );
+   }
 
-      void setFunction( const FunctionType& function )
-      {
-         this->function = function;
-      };
-      
-      FunctionType& getFunction()
-      {
-         return this->function;
-      }
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" )
+   {
+      Function::configSetup( config, prefix );
+   };
 
-      const FunctionType& getFunction() const
-      {
-         return this->function;
-      };
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" )
+   {
+      return this->function.setup( parameters, prefix );
+   };
+
+   void
+   setFunction( const FunctionType& function )
+   {
+      this->function = function;
+   };
 
-   protected:
+   FunctionType&
+   getFunction()
+   {
+      return this->function;
+   }
 
-      FunctionType function;
+   const FunctionType&
+   getFunction() const
+   {
+      return this->function;
+   };
 
+protected:
+   FunctionType function;
 };
 
 /****
  * 1D grid
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Function,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Function, typename Real, typename Index >
 class NeumannBoundaryConditions< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Function, Real, Index >
-   : public NeumannBoundaryConditionsBase< Function >,
-     public Operator< Meshes::Grid< 1, MeshReal, Device, MeshIndex >,
-                         Functions::MeshBoundaryDomain,
-                         1, 1,
-                         Real,
-                         Index >
+: public NeumannBoundaryConditionsBase< Function >,
+  public Operator< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Functions::MeshBoundaryDomain, 1, 1, Real, Index >
 {
-   public:
-
-   typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
-   typedef Real RealType;
-   typedef Device DeviceType;
-   typedef Index IndexType;
-
-   typedef Function FunctionType;
-   typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
-   typedef Containers::StaticVector< 1, RealType > PointType;
-   typedef typename MeshType::CoordinatesType CoordinatesType;
-   typedef NeumannBoundaryConditionsBase< Function > BaseType;
-
-   template< typename EntityType,
-             typename MeshFunction >
+public:
+   using MeshType = Meshes::Grid< 1, MeshReal, Device, MeshIndex >;
+   using RealType = Real;
+   using DeviceType = Device;
+   using IndexType = Index;
+
+   using FunctionType = Function;
+   using DofVectorType = Containers::Vector< RealType, DeviceType, IndexType >;
+   using PointType = Containers::StaticVector< 1, RealType >;
+   using CoordinatesType = typename MeshType::CoordinatesType;
+   using BaseType = NeumannBoundaryConditionsBase< Function >;
+
+   template< typename EntityType, typename MeshFunction >
    __cuda_callable__
-   const RealType operator()( const MeshFunction& u,
-                              const EntityType& entity,   
-                              const RealType& time = 0 ) const
+   const RealType
+   operator()( const MeshFunction& u, const EntityType& entity, const RealType& time = 0 ) const
    {
-      //const MeshType& mesh = entity.getMesh();
+      // const MeshType& mesh = entity.getMesh();
       const auto& neighborEntities = entity.getNeighborEntities();
-      //const IndexType& index = entity.getIndex();
+      // const IndexType& index = entity.getIndex();
       if( entity.getCoordinates().x() == 0 )
-         return u[ neighborEntities.template getEntityIndex< 1 >() ] + entity.getMesh().getSpaceSteps().x() * 
-            Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
+         return u[ neighborEntities.template getEntityIndex< 1 >() ]
+              + entity.getMesh().getSpaceSteps().x()
+                   * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
       else
-         return u[ neighborEntities.template getEntityIndex< -1 >() ] + entity.getMesh().getSpaceSteps().x() * 
-            Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );   
-
+         return u[ neighborEntities.template getEntityIndex< -1 >() ]
+              + entity.getMesh().getSpaceSteps().x()
+                   * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
    }
 
-
    template< typename EntityType >
    __cuda_callable__
-   Index getLinearSystemRowLength( const MeshType& mesh,
-                                   const IndexType& index,
-                                   const EntityType& entity ) const
+   Index
+   getLinearSystemRowLength( const MeshType& mesh, const IndexType& index, const EntityType& entity ) const
    {
       return 2;
    }
 
-      template< typename PreimageFunction,
-                typename MeshEntity,
-                typename Matrix,
-                typename Vector >
-      __cuda_callable__
-      void setMatrixElements( const PreimageFunction& u,
-                                     const MeshEntity& entity,
-                                     const RealType& time,
-                                     const RealType& tau,
-                                     Matrix& matrix,
-                                     Vector& b ) const
-      {
-         const auto& neighborEntities = entity.getNeighborEntities();
-         const IndexType& index = entity.getIndex();
-         auto matrixRow = matrix.getRow( index );
-         if( entity.getCoordinates().x() == 0 )
-         {
-            matrixRow.setElement( 0, index, 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, 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 );
-         }         
+   template< typename PreimageFunction, typename MeshEntity, typename Matrix, typename Vector >
+   __cuda_callable__
+   void
+   setMatrixElements( const PreimageFunction& u,
+                      const MeshEntity& entity,
+                      const RealType& time,
+                      const RealType& tau,
+                      Matrix& matrix,
+                      Vector& b ) const
+   {
+      const auto& neighborEntities = entity.getNeighborEntities();
+      const IndexType& index = entity.getIndex();
+      auto matrixRow = matrix.getRow( index );
+      if( entity.getCoordinates().x() == 0 ) {
+         matrixRow.setElement( 0, index, 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, 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 );
       }
+   }
 };
 
 /****
  * 2D grid
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Function,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Function, typename Real, typename Index >
 class NeumannBoundaryConditions< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Function, Real, Index >
-   : public NeumannBoundaryConditionsBase< Function >,
-     public Operator< Meshes::Grid< 2, MeshReal, Device, MeshIndex >,
-                         Functions::MeshBoundaryDomain,
-                         2, 2,
-                         Real,
-                         Index >
+: public NeumannBoundaryConditionsBase< Function >,
+  public Operator< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Functions::MeshBoundaryDomain, 2, 2, Real, Index >
 
 {
-   public:
-
-      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
-      typedef Real RealType;
-      typedef Device DeviceType;
-      typedef Index IndexType;
-
-      typedef Function FunctionType;
-      typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
-      typedef Containers::StaticVector< 2, RealType > PointType;
-      typedef typename MeshType::CoordinatesType CoordinatesType;
-      typedef NeumannBoundaryConditionsBase< Function > BaseType;
-
-
-      template< typename EntityType,
-                typename MeshFunction >
-      __cuda_callable__
-      const RealType operator()( const MeshFunction& u,
-                                 const EntityType& entity,                            
-                                 const RealType& time = 0 ) const
-      {
-         //const MeshType& mesh = entity.getMesh();
-         const auto& neighborEntities = entity.getNeighborEntities();
-         //const IndexType& index = entity.getIndex();
-         if( entity.getCoordinates().x() == 0 )
-         {
-            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[ 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[ 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[ neighborEntities.template getEntityIndex< 0, -1 >() ] + entity.getMesh().getSpaceSteps().y() *
-               Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
-         }         
+public:
+   using MeshType = Meshes::Grid< 2, MeshReal, Device, MeshIndex >;
+   using RealType = Real;
+   using DeviceType = Device;
+   using IndexType = Index;
+
+   using FunctionType = Function;
+   using DofVectorType = Containers::Vector< RealType, DeviceType, IndexType >;
+   using PointType = Containers::StaticVector< 2, RealType >;
+   using CoordinatesType = typename MeshType::CoordinatesType;
+   using BaseType = NeumannBoundaryConditionsBase< Function >;
+
+   template< typename EntityType, typename MeshFunction >
+   __cuda_callable__
+   const RealType
+   operator()( const MeshFunction& u, const EntityType& entity, const RealType& time = 0 ) const
+   {
+      // const MeshType& mesh = entity.getMesh();
+      const auto& neighborEntities = entity.getNeighborEntities();
+      // const IndexType& index = entity.getIndex();
+      if( entity.getCoordinates().x() == 0 ) {
+         return u[ neighborEntities.template getEntityIndex< 1, 0 >() ]
+              + entity.getMesh().getSpaceSteps().x()
+                   * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
       }
-
-      template< typename EntityType >
-      __cuda_callable__
-      Index getLinearSystemRowLength( const MeshType& mesh,
-                                      const IndexType& index,
-                                      const EntityType& entity ) const
+      if( entity.getCoordinates().x() == entity.getMesh().getDimensions().x() - 1 ) {
+         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[ 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 2;
+         return u[ neighborEntities.template getEntityIndex< 0, -1 >() ]
+              + entity.getMesh().getSpaceSteps().y()
+                   * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
       }
+   }
 
-      template< typename PreimageFunction,
-                typename MeshEntity,
-                typename Matrix,
-                typename Vector >
-      __cuda_callable__
-      void setMatrixElements( const PreimageFunction& u,
-                              const MeshEntity& entity,
-                              const RealType& time,
-                              const RealType& tau,
-                              Matrix& matrix,
-                              Vector& b ) const
-      {
-         const auto& neighborEntities = entity.getNeighborEntities();
-         const IndexType& index = entity.getIndex();
-         auto matrixRow = matrix.getRow( index );
-         if( entity.getCoordinates().x() == 0 )
-         {
-            matrixRow.setElement( 0, index,                                                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, 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 );
-         }
-         if( entity.getCoordinates().y() == 0 )
-         {
-            matrixRow.setElement( 0, index,                                                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, 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 );
-         }         
+   template< typename EntityType >
+   __cuda_callable__
+   Index
+   getLinearSystemRowLength( const MeshType& mesh, const IndexType& index, const EntityType& entity ) const
+   {
+      return 2;
+   }
+
+   template< typename PreimageFunction, typename MeshEntity, typename Matrix, typename Vector >
+   __cuda_callable__
+   void
+   setMatrixElements( const PreimageFunction& u,
+                      const MeshEntity& entity,
+                      const RealType& time,
+                      const RealType& tau,
+                      Matrix& matrix,
+                      Vector& b ) const
+   {
+      const auto& neighborEntities = entity.getNeighborEntities();
+      const IndexType& index = entity.getIndex();
+      auto matrixRow = matrix.getRow( index );
+      if( entity.getCoordinates().x() == 0 ) {
+         matrixRow.setElement( 0, index, 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, 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 );
+      }
+      if( entity.getCoordinates().y() == 0 ) {
+         matrixRow.setElement( 0, index, 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, 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 );
+      }
+   }
 };
 
 /****
  * 3D grid
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Function,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Function, typename Real, typename Index >
 class NeumannBoundaryConditions< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Function, Real, Index >
-   : public NeumannBoundaryConditionsBase< Function >,
-     public Operator< Meshes::Grid< 3, MeshReal, Device, MeshIndex >,
-                         Functions::MeshBoundaryDomain,
-                         3, 3,
-                         Real,
-                         Index >
+: public NeumannBoundaryConditionsBase< Function >,
+  public Operator< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Functions::MeshBoundaryDomain, 3, 3, Real, Index >
 {
-   public:
-
-      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
-      typedef Real RealType;
-      typedef Device DeviceType;
-      typedef Index IndexType;
-
-      typedef Function FunctionType;
-      typedef Containers::Vector< RealType, DeviceType, IndexType> DofVectorType;
-      typedef Containers::StaticVector< 3, RealType > PointType;
-      typedef typename MeshType::CoordinatesType CoordinatesType;
-      typedef NeumannBoundaryConditionsBase< Function > BaseType;   
-
-      template< typename EntityType,
-                typename MeshFunction >
-      __cuda_callable__
-      const RealType operator()( const MeshFunction& u,
-                                 const EntityType& entity,
-                                 const RealType& time = 0 ) const
+public:
+   using MeshType = Meshes::Grid< 3, MeshReal, Device, MeshIndex >;
+   using RealType = Real;
+   using DeviceType = Device;
+   using IndexType = Index;
+
+   using FunctionType = Function;
+   using DofVectorType = Containers::Vector< RealType, DeviceType, IndexType >;
+   using PointType = Containers::StaticVector< 3, RealType >;
+   using CoordinatesType = typename MeshType::CoordinatesType;
+   using BaseType = NeumannBoundaryConditionsBase< Function >;
+
+   template< typename EntityType, typename MeshFunction >
+   __cuda_callable__
+   const RealType
+   operator()( const MeshFunction& u, const EntityType& entity, const RealType& time = 0 ) const
+   {
+      // const MeshType& mesh = entity.getMesh();
+      const auto& neighborEntities = entity.getNeighborEntities();
+      // const IndexType& index = entity.getIndex();
+      if( entity.getCoordinates().x() == 0 ) {
+         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[ 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[ 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[ 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[ 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 )
       {
-         //const MeshType& mesh = entity.getMesh();
-         const auto& neighborEntities = entity.getNeighborEntities();
-         //const IndexType& index = entity.getIndex();
-         if( entity.getCoordinates().x() == 0 )
-         {
-            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[ 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[ 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[ 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[ 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[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] + entity.getMesh().getSpaceSteps().z() *
-               Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
-         }   
+         return u[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ]
+              + entity.getMesh().getSpaceSteps().z()
+                   * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time );
       }
+   }
 
+   template< typename EntityType >
+   __cuda_callable__
+   Index
+   getLinearSystemRowLength( const MeshType& mesh, const IndexType& index, const EntityType& entity ) const
+   {
+      return 2;
+   }
 
-      template< typename EntityType >
-      __cuda_callable__
-      Index getLinearSystemRowLength( const MeshType& mesh,
-                                      const IndexType& index,
-                                      const EntityType& entity ) const
-      {
-         return 2;
+   template< typename PreimageFunction, typename MeshEntity, typename Matrix, typename Vector >
+   __cuda_callable__
+   void
+   setMatrixElements( const PreimageFunction& u,
+                      const MeshEntity& entity,
+                      const RealType& time,
+                      const RealType& tau,
+                      Matrix& matrix,
+                      Vector& b ) const
+   {
+      const auto& neighborEntities = entity.getNeighborEntities();
+      const IndexType& index = entity.getIndex();
+      auto matrixRow = matrix.getRow( index );
+      if( entity.getCoordinates().x() == 0 ) {
+         matrixRow.setElement( 0, index, 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 );
       }
-
-      template< typename PreimageFunction,
-                typename MeshEntity,
-                typename Matrix,
-                typename Vector >
-      __cuda_callable__
-      void setMatrixElements( const PreimageFunction& u,
-                                     const MeshEntity& entity,
-                                     const RealType& time,
-                                     const RealType& tau,
-                                     Matrix& matrix,
-                                     Vector& b ) const
-      {
-         const auto& neighborEntities = entity.getNeighborEntities();
-         const IndexType& index = entity.getIndex();
-         auto matrixRow = matrix.getRow( index );
-         if( entity.getCoordinates().x() == 0 )
-         {
-            matrixRow.setElement( 0, index,                                                   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, 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 );
-         }
-         if( entity.getCoordinates().y() == 0 )
-         {
-            matrixRow.setElement( 0, index,                                                   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, 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 );
-         }
-         if( entity.getCoordinates().z() == 0 )
-         {
-            matrixRow.setElement( 0, index,                                                   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, 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 );
-         }
+      if( entity.getCoordinates().x() == entity.getMesh().getDimensions().x() - 1 ) {
+         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 );
+      }
+      if( entity.getCoordinates().y() == 0 ) {
+         matrixRow.setElement( 0, index, 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, 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 );
       }
+      if( entity.getCoordinates().z() == 0 ) {
+         matrixRow.setElement( 0, index, 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, 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 );
+      }
+   }
 };
 
-template< typename Mesh,
-          typename Function,
-          typename Real,
-          typename Index >
-std::ostream& operator << ( std::ostream& str, const NeumannBoundaryConditions< Mesh, Function, Real, Index >& bc )
+template< typename Mesh, typename Function, typename Real, typename Index >
+std::ostream&
+operator<<( std::ostream& str, const NeumannBoundaryConditions< Mesh, Function, Real, Index >& bc )
 {
    str << "Neumann boundary conditions: function = " << bc.getFunction();
    return str;
 }
 
-} // namespace Operators
-} // namespace TNL
-
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/Operator.h b/src/TNL/Operators/Operator.h
index a6a7ab2293587cd6983a3ec49949ae9c61304950..9949eccb40839688f88c46c753143f568b970dc3 100644
--- a/src/TNL/Operators/Operator.h
+++ b/src/TNL/Operators/Operator.h
@@ -19,28 +19,48 @@ template< typename Mesh,
           typename Index = typename Mesh::GlobalIndexType >
 class Operator : public Functions::Domain< Mesh::getMeshDimension(), DomainType >
 {
-   public:
- 
-      typedef Mesh MeshType;
-      typedef typename MeshType::RealType MeshRealType;
-      typedef typename MeshType::DeviceType DeviceType;
-      typedef typename MeshType::GlobalIndexType MeshIndexType;
-      typedef Real RealType;
-      typedef Index IndexType;
-      typedef void ExactOperatorType;
- 
-      constexpr static int getMeshDimension() { return MeshType::getMeshDimension(); }
-      constexpr static int getPreimageEntitiesDimension() { return PreimageEntitiesDimension; }
-      constexpr static int getImageEntitiesDimension() { return ImageEntitiesDimension; }
- 
-      bool refresh( const RealType& time = 0.0 ) { return true; }
- 
-      bool deepRefresh( const RealType& time = 0.0 ) { return true; }
- 
-      template< typename MeshFunction >
-      void setPreimageFunction( const MeshFunction& f ){}
-};
+public:
+   using MeshType = Mesh;
+   using MeshRealType = typename MeshType::RealType;
+   using DeviceType = typename MeshType::DeviceType;
+   using MeshIndexType = typename MeshType::GlobalIndexType;
+   using RealType = Real;
+   using IndexType = Index;
+   using ExactOperatorType = void;
+
+   constexpr static int
+   getMeshDimension()
+   {
+      return MeshType::getMeshDimension();
+   }
+   constexpr static int
+   getPreimageEntitiesDimension()
+   {
+      return PreimageEntitiesDimension;
+   }
+   constexpr static int
+   getImageEntitiesDimension()
+   {
+      return ImageEntitiesDimension;
+   }
+
+   bool
+   refresh( const RealType& time = 0.0 )
+   {
+      return true;
+   }
 
-} // namespace Operators
-} // namespace TNL
+   bool
+   deepRefresh( const RealType& time = 0.0 )
+   {
+      return true;
+   }
+
+   template< typename MeshFunction >
+   void
+   setPreimageFunction( const MeshFunction& f )
+   {}
+};
 
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/OperatorComposition.h b/src/TNL/Operators/OperatorComposition.h
index 8771dd388808bff409b6ddba48930cec252a9985..ce22f9ab6eee56949392b84c9d45f8dd51897a2e 100644
--- a/src/TNL/Operators/OperatorComposition.h
+++ b/src/TNL/Operators/OperatorComposition.h
@@ -22,171 +22,190 @@ namespace Operators {
  * omitted in this case.
  */
 
-template< typename OuterOperator,
-          typename InnerOperator,
-          typename InnerBoundaryConditions = void >
-class OperatorComposition
-   : public Operator< typename InnerOperator::MeshType,
-                         InnerOperator::getDomainType(),
-                         InnerOperator::getPreimageEntitiesDimension(),
-                         OuterOperator::getImageEntitiesDimension(),
-                         typename InnerOperator::RealType,
-                         typename OuterOperator::IndexType >
+template< typename OuterOperator, typename InnerOperator, typename InnerBoundaryConditions = void >
+class OperatorComposition : public Operator< typename InnerOperator::MeshType,
+                                             InnerOperator::getDomainType(),
+                                             InnerOperator::getPreimageEntitiesDimension(),
+                                             OuterOperator::getImageEntitiesDimension(),
+                                             typename InnerOperator::RealType,
+                                             typename OuterOperator::IndexType >
 {
-      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::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;
-      typedef typename InnerOperator::IndexType IndexType;
-      typedef ExactOperatorComposition< typename OuterOperator::ExactOperatorType,
-                                           typename InnerOperator::ExactOperatorType > ExactOperatorType;
-      typedef Pointers::SharedPointer<  MeshType > MeshPointer;
-      
-      static constexpr int getPreimageEntitiesDimension() { return InnerOperator::getImageEntitiesDimension(); };
-      static constexpr int getImageEntitiesDimension() { return OuterOperator::getImageEntitiesDimension(); };
- 
-      OperatorComposition( OuterOperator& outerOperator,
-                              InnerOperator& innerOperator,
-                              const InnerBoundaryConditions& innerBoundaryConditions,
-                              const MeshPointer& mesh )
-      : outerOperator( outerOperator ),
-        innerOperatorFunction( innerOperator, innerBoundaryConditions, mesh ){};
- 
-      void setPreimageFunction( const PreimageFunctionType& preimageFunction )
-      {
-         this->innerOperatorFunction.setPreimageFunction( preimageFunction );
-      }
- 
-      PreimageFunctionType& getPreimageFunction()
-      {
-         return this->innerOperatorFunction.getPreimageFunction();
-      }
-
-      const PreimageFunctionType& getPreimageFunction() const
-      {
-         return this->innerOperatorFunction.getPreimageFunction();
-      }
- 
-      InnerOperator& getInnerOperator() { return this->innerOperatorFunction.getOperator(); }
- 
-      const InnerOperator& getInnerOperator() const { return this->innerOperatorFunction.getOperator(); }
- 
-      OuterOperator& getOuterOperator() { return this->outerOperator(); };
- 
-      const OuterOperator& getOuterOperator() const { return this->outerOperator(); };
- 
-      bool refresh( const RealType& time = 0.0 )
-      {
-         return this->innerOperatorFunction.refresh( time );
-      }
- 
-      bool deepRefresh( const RealType& time = 0.0 )
-      {
-         return this->innerOperatorFunction.deepRefresh( time );
-      }
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      RealType operator()(
-         const MeshFunction& function,
-         const MeshEntity& meshEntity,
-         const RealType& time = 0.0 ) const
-      {
-         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 );
-      }
- 
-   protected:
- 
-      OuterOperator& outerOperator;
- 
-      InnerOperatorFunction innerOperatorFunction;
+   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::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;
+   typedef typename InnerOperator::IndexType IndexType;
+   typedef ExactOperatorComposition< typename OuterOperator::ExactOperatorType, typename InnerOperator::ExactOperatorType >
+      ExactOperatorType;
+   typedef Pointers::SharedPointer< MeshType > MeshPointer;
+
+   static constexpr int
+   getPreimageEntitiesDimension()
+   {
+      return InnerOperator::getImageEntitiesDimension();
+   };
+   static constexpr int
+   getImageEntitiesDimension()
+   {
+      return OuterOperator::getImageEntitiesDimension();
+   };
+
+   OperatorComposition( OuterOperator& outerOperator,
+                        InnerOperator& innerOperator,
+                        const InnerBoundaryConditions& innerBoundaryConditions,
+                        const MeshPointer& mesh )
+   : outerOperator( outerOperator ), innerOperatorFunction( innerOperator, innerBoundaryConditions, mesh ){};
+
+   void
+   setPreimageFunction( const PreimageFunctionType& preimageFunction )
+   {
+      this->innerOperatorFunction.setPreimageFunction( preimageFunction );
+   }
+
+   PreimageFunctionType&
+   getPreimageFunction()
+   {
+      return this->innerOperatorFunction.getPreimageFunction();
+   }
+
+   const PreimageFunctionType&
+   getPreimageFunction() const
+   {
+      return this->innerOperatorFunction.getPreimageFunction();
+   }
+
+   InnerOperator&
+   getInnerOperator()
+   {
+      return this->innerOperatorFunction.getOperator();
+   }
+
+   const InnerOperator&
+   getInnerOperator() const
+   {
+      return this->innerOperatorFunction.getOperator();
+   }
+
+   OuterOperator&
+   getOuterOperator()
+   {
+      return this->outerOperator();
+   };
+
+   const OuterOperator&
+   getOuterOperator() const
+   {
+      return this->outerOperator();
+   };
+
+   bool
+   refresh( const RealType& time = 0.0 )
+   {
+      return this->innerOperatorFunction.refresh( time );
+   }
+
+   bool
+   deepRefresh( const RealType& time = 0.0 )
+   {
+      return this->innerOperatorFunction.deepRefresh( time );
+   }
+
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   RealType
+   operator()( const MeshFunction& function, const MeshEntity& meshEntity, const RealType& time = 0.0 ) const
+   {
+      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 );
+   }
+
+protected:
+   OuterOperator& outerOperator;
+
+   InnerOperatorFunction innerOperatorFunction;
 };
 
-template< typename OuterOperator,
-          typename InnerOperator >
+template< typename OuterOperator, typename InnerOperator >
 class OperatorComposition< OuterOperator, InnerOperator, void >
-   : public Functions::Domain< InnerOperator::getDimension(), 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::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;
-      typedef typename InnerOperator::IndexType IndexType;
-      typedef Pointers::SharedPointer<  MeshType > MeshPointer;
-      
-      OperatorComposition( const OuterOperator& outerOperator,
-                              InnerOperator& innerOperator,
-                              const MeshPointer& mesh )
-      : outerOperator( outerOperator ),
-        innerOperatorFunction( innerOperator, mesh ){};
- 
-      void setPreimageFunction( PreimageFunctionType& preimageFunction )
-      {
-         this->innerOperatorFunction.setPreimageFunction( preimageFunction );
-      }
- 
-      PreimageFunctionType& getPreimageFunction()
-      {
-         return this->innerOperatorFunction.getPreimageFunction();
-      }
-
-      const PreimageFunctionType& getPreimageFunction() const
-      {
-         return this->innerOperatorFunction.getPreimageFunction();
-      }
- 
-      bool refresh( const RealType& time = 0.0 )
-      {
-         return this->innerOperatorFunction.refresh( time );
-         /*MeshFunction< MeshType, MeshType::getMeshDimension() - 1 > f( this->innerOperatorFunction.getMesh() );
-         f = this->innerOperatorFunction;
-         this->innerOperatorFunction.getPreimageFunction().write( "preimageFunction", "gnuplot" );
-         f.write( "innerFunction", "gnuplot" );
-         return true;*/
-      }
- 
-      bool deepRefresh( const RealType& time = 0.0 )
-      {
-         return this->innerOperatorFunction.deepRefresh( time );
-         /*this->innerOperatorFunction.write( "innerFunction", "gnuplot" );
-          return true;*/
-      }
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      RealType operator()(
-         const MeshFunction& function,
-         const MeshEntity& meshEntity,
-         const RealType& time = 0.0 ) const
-      {
-         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 );
-      }
- 
-   protected:
- 
-      const OuterOperator& outerOperator;
- 
-      InnerOperatorFunction innerOperatorFunction;
-};
+   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::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;
+   typedef typename InnerOperator::IndexType IndexType;
+   typedef Pointers::SharedPointer< MeshType > MeshPointer;
+
+   OperatorComposition( const OuterOperator& outerOperator, InnerOperator& innerOperator, const MeshPointer& mesh )
+   : outerOperator( outerOperator ), innerOperatorFunction( innerOperator, mesh ){};
+
+   void
+   setPreimageFunction( PreimageFunctionType& preimageFunction )
+   {
+      this->innerOperatorFunction.setPreimageFunction( preimageFunction );
+   }
+
+   PreimageFunctionType&
+   getPreimageFunction()
+   {
+      return this->innerOperatorFunction.getPreimageFunction();
+   }
 
-} // namespace Operators
-} // namespace TNL
+   const PreimageFunctionType&
+   getPreimageFunction() const
+   {
+      return this->innerOperatorFunction.getPreimageFunction();
+   }
+
+   bool
+   refresh( const RealType& time = 0.0 )
+   {
+      return this->innerOperatorFunction.refresh( time );
+      /*MeshFunction< MeshType, MeshType::getMeshDimension() - 1 > f( this->innerOperatorFunction.getMesh() );
+      f = this->innerOperatorFunction;
+      this->innerOperatorFunction.getPreimageFunction().write( "preimageFunction", "gnuplot" );
+      f.write( "innerFunction", "gnuplot" );
+      return true;*/
+   }
+
+   bool
+   deepRefresh( const RealType& time = 0.0 )
+   {
+      return this->innerOperatorFunction.deepRefresh( time );
+      /*this->innerOperatorFunction.write( "innerFunction", "gnuplot" );
+       return true;*/
+   }
+
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   RealType
+   operator()( const MeshFunction& function, const MeshEntity& meshEntity, const RealType& time = 0.0 ) const
+   {
+      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 );
+   }
+
+protected:
+   const OuterOperator& outerOperator;
+
+   InnerOperatorFunction innerOperatorFunction;
+};
 
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/diffusion/ExactLinearDiffusion.h b/src/TNL/Operators/diffusion/ExactLinearDiffusion.h
index cf28fc1eb73e7b17a080a1c4cd76f57ebd4ba093..2c364f25dad363311613773a7cab14adf79772e5 100644
--- a/src/TNL/Operators/diffusion/ExactLinearDiffusion.h
+++ b/src/TNL/Operators/diffusion/ExactLinearDiffusion.h
@@ -15,7 +15,7 @@
 #include <TNL/Functions/Domain.h>
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
 template< int Dimension >
 class ExactLinearDiffusion
@@ -24,46 +24,46 @@ class ExactLinearDiffusion
 template<>
 class ExactLinearDiffusion< 1 > : public Functions::Domain< 1, Functions::SpaceDomain >
 {
-   public:
+public:
+   static const int Dimension = 1;
 
-      static const int Dimension = 1;
- 
-      template< typename Function >
-      __cuda_callable__ inline
-      typename Function::RealType operator()( const Function& function,
-                                              const typename Function::PointType& v,
-                                              const typename Function::RealType& time = 0.0 ) const;
+   template< typename Function >
+   __cuda_callable__
+   inline typename Function::RealType
+   operator()( const Function& function,
+               const typename Function::PointType& v,
+               const typename Function::RealType& time = 0.0 ) const;
 };
 
 template<>
 class ExactLinearDiffusion< 2 > : public Functions::Domain< 2, Functions::SpaceDomain >
 {
-   public:
- 
-      static const int Dimension = 2;
+public:
+   static const int Dimension = 2;
 
-      template< typename Function >
-      __cuda_callable__ inline
-      typename Function::RealType operator()( const Function& function,
-                                              const typename Function::PointType& v,
-                                              const typename Function::RealType& time = 0.0 ) const;
+   template< typename Function >
+   __cuda_callable__
+   inline typename Function::RealType
+   operator()( const Function& function,
+               const typename Function::PointType& v,
+               const typename Function::RealType& time = 0.0 ) const;
 };
 
 template<>
 class ExactLinearDiffusion< 3 > : public Functions::Domain< 3 >
 {
-   public:
- 
-      static const int Dimension = 3;
+public:
+   static const int Dimension = 3;
 
-      template< typename Function >
-      __cuda_callable__ inline
-      typename Function::RealType operator()( const Function& function,
-                                              const typename Function::PointType& v,
-                                              const typename Function::RealType& time = 0.0 ) const;
+   template< typename Function >
+   __cuda_callable__
+   inline typename Function::RealType
+   operator()( const Function& function,
+               const typename Function::PointType& v,
+               const typename Function::RealType& time = 0.0 ) const;
 };
 
-} // namespace Operators
-} // namespace TNL
+}  // namespace Operators
+}  // namespace TNL
 
 #include <TNL/Operators/diffusion/ExactLinearDiffusion_impl.h>
diff --git a/src/TNL/Operators/diffusion/ExactLinearDiffusion_impl.h b/src/TNL/Operators/diffusion/ExactLinearDiffusion_impl.h
index a7b102b77ede5595cde1810244cfbb43b162ce01..3ffc0793fa5e502e1cd8a22572b8db3401fafe46 100644
--- a/src/TNL/Operators/diffusion/ExactLinearDiffusion_impl.h
+++ b/src/TNL/Operators/diffusion/ExactLinearDiffusion_impl.h
@@ -16,41 +16,37 @@ namespace TNL {
 namespace Operators {
 
 template< typename Function >
-__cuda_callable__ inline
-typename Function::RealType
-ExactLinearDiffusion< 1 >::
-operator()( const Function& function,
-            const typename Function::PointType& v,
-            const typename Function::RealType& time ) const
+__cuda_callable__
+inline typename Function::RealType
+ExactLinearDiffusion< 1 >::operator()( const Function& function,
+                                       const typename Function::PointType& v,
+                                       const typename Function::RealType& time ) const
 {
    return function.template getPartialDerivative< 2, 0, 0 >( v, time );
 }
 
 template< typename Function >
-__cuda_callable__ inline
-typename Function::RealType
-ExactLinearDiffusion< 2 >::
-operator()( const Function& function,
-            const typename Function::PointType& v,
-          const typename Function::RealType& time ) const
+__cuda_callable__
+inline typename Function::RealType
+ExactLinearDiffusion< 2 >::operator()( const Function& function,
+                                       const typename Function::PointType& v,
+                                       const typename Function::RealType& time ) const
 {
-   return function.template getPartialDerivative< 2, 0, 0 >( v, time ) +
-          function.template getPartialDerivative< 0, 2, 0 >( v, time );
+   return function.template getPartialDerivative< 2, 0, 0 >( v, time )
+        + function.template getPartialDerivative< 0, 2, 0 >( v, time );
 }
 
 template< typename Function >
-__cuda_callable__ inline
-typename Function::RealType
-ExactLinearDiffusion< 3 >::
-operator()( const Function& function,
-            const typename Function::PointType& v,
-            const typename Function::RealType& time ) const
+__cuda_callable__
+inline typename Function::RealType
+ExactLinearDiffusion< 3 >::operator()( const Function& function,
+                                       const typename Function::PointType& v,
+                                       const typename Function::RealType& time ) const
 {
-   return function.template getPartialDerivative< 2, 0, 0 >( v, time ) +
-          function.template getPartialDerivative< 0, 2, 0 >( v, time ) +
-          function.template getPartialDerivative< 0, 0, 2 >( v, time );
-
+   return function.template getPartialDerivative< 2, 0, 0 >( v, time )
+        + function.template getPartialDerivative< 0, 2, 0 >( v, time )
+        + function.template getPartialDerivative< 0, 0, 2 >( v, time );
 }
 
-} // namespace Operators
-} // namespace TNL
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/diffusion/ExactMeanCurvature.h b/src/TNL/Operators/diffusion/ExactMeanCurvature.h
index 8136568de429af11927083b881559d7237e3c3e3..aa1028ad26142834de4e49207fa5d0ad67ac5b3c 100644
--- a/src/TNL/Operators/diffusion/ExactMeanCurvature.h
+++ b/src/TNL/Operators/diffusion/ExactMeanCurvature.h
@@ -17,72 +17,61 @@
 #include <TNL/Operators/geometric/ExactGradientNorm.h>
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
-template< int Dimension,
-          typename InnerOperator = ExactIdentityOperator< Dimension > >
-class ExactMeanCurvature
-: public Functions::Domain< Dimension, Functions::SpaceDomain >
+template< int Dimension, typename InnerOperator = ExactIdentityOperator< Dimension > >
+class ExactMeanCurvature : public Functions::Domain< Dimension, Functions::SpaceDomain >
 {
-   public:
- 
-      typedef ExactGradientNorm< Dimension > ExactGradientNormType;
-      typedef ExactFunctionInverseOperator< Dimension, ExactGradientNormType > FunctionInverse;
-      typedef ExactNonlinearDiffusion< Dimension, FunctionInverse > NonlinearDiffusion;
- 
-      template< typename Real >
-      void setRegularizationEpsilon( const Real& eps)
-      {
-         nonlinearDiffusion.getNonlinearity().getInnerOperator().setRegularizationEpsilon( eps );
+public:
+   typedef ExactGradientNorm< Dimension > ExactGradientNormType;
+   typedef ExactFunctionInverseOperator< Dimension, ExactGradientNormType > FunctionInverse;
+   typedef ExactNonlinearDiffusion< Dimension, FunctionInverse > NonlinearDiffusion;
+
+   template< typename Real >
+   void
+   setRegularizationEpsilon( const Real& eps )
+   {
+      nonlinearDiffusion.getNonlinearity().getInnerOperator().setRegularizationEpsilon( eps );
+   }
+
+   template< typename Function >
+   __cuda_callable__
+   typename Function::RealType
+   operator()( const Function& function,
+               const typename Function::PointType& v,
+               const typename Function::RealType& time = 0.0 ) const
+   {
+      return this->nonlinearDiffusion( function, v, time );
+   }
+
+   template< typename Function, int XDerivative = 0, int YDerivative = 0, int ZDerivative = 0 >
+   __cuda_callable__
+   typename Function::RealType
+   getPartialDerivative( const Function& function,
+                         const typename Function::PointType& v,
+                         const typename Function::RealType& time = 0.0 ) const
+   {
+      static_assert( XDerivative >= 0 && YDerivative >= 0 && ZDerivative >= 0,
+                     "Partial derivative must be non-negative integer." );
+      static_assert( XDerivative + YDerivative + ZDerivative < 1,
+                     "Partial derivative of higher order then 1 are not implemented yet." );
+      typedef typename Function::RealType RealType;
+
+      if( XDerivative == 1 ) {
       }
- 
-      template< typename Function >
-      __cuda_callable__
-      typename Function::RealType
-         operator()( const Function& function,
-                     const typename Function::PointType& v,
-                     const typename Function::RealType& time = 0.0 ) const
-      {
-         return this->nonlinearDiffusion( function, v, time );
+      if( YDerivative == 1 ) {
       }
- 
-      template< typename Function,
-                int XDerivative = 0,
-                int YDerivative = 0,
-                int ZDerivative = 0 >
-      __cuda_callable__
-      typename Function::RealType
-         getPartialDerivative( const Function& function,
-                               const typename Function::PointType& v,
-                               const typename Function::RealType& time = 0.0 ) const
-      {
-         static_assert( XDerivative >= 0 && YDerivative >= 0 && ZDerivative >= 0,
-            "Partial derivative must be non-negative integer." );
-         static_assert( XDerivative + YDerivative + ZDerivative < 1, "Partial derivative of higher order then 1 are not implemented yet." );
-         typedef typename Function::RealType RealType;
- 
-         if( XDerivative == 1 )
-         {
-         }
-         if( YDerivative == 1 )
-         {
-         }
-         if( ZDerivative == 1 )
-         {
-         }
+      if( ZDerivative == 1 ) {
       }
- 
- 
-   protected:
- 
-      ExactGradientNormType gradientNorm;
- 
-      FunctionInverse functionInverse;
- 
-      NonlinearDiffusion nonlinearDiffusion;
- 
-};
+   }
+
+protected:
+   ExactGradientNormType gradientNorm;
 
-} // namespace Operators
-} // namespace TNL
+   FunctionInverse functionInverse;
+
+   NonlinearDiffusion nonlinearDiffusion;
+};
 
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/diffusion/ExactNonlinearDiffusion.h b/src/TNL/Operators/diffusion/ExactNonlinearDiffusion.h
index 7cd2d4a4d82db2426687f7beb50685cf5be9204a..540490cca69f4d97f2ceca04b3867382b96b3e87 100644
--- a/src/TNL/Operators/diffusion/ExactNonlinearDiffusion.h
+++ b/src/TNL/Operators/diffusion/ExactNonlinearDiffusion.h
@@ -15,176 +15,170 @@
 #include <TNL/Functions/Domain.h>
 #include <TNL/Operators/ExactIdentityOperator.h>
 
-
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
-template<  int Dimension,
-           typename Nonlinearity,
-           typename InnerOperator = ExactIdentityOperator< Dimension > >
+template< int Dimension, typename Nonlinearity, typename InnerOperator = ExactIdentityOperator< Dimension > >
 class ExactNonlinearDiffusion
 {};
 
-
-template< typename Nonlinearity,
-          typename InnerOperator >
-class ExactNonlinearDiffusion< 1, Nonlinearity, InnerOperator >
-   : public Functions::Domain< 1, Functions::SpaceDomain >
+template< typename Nonlinearity, typename InnerOperator >
+class ExactNonlinearDiffusion< 1, Nonlinearity, InnerOperator > : public Functions::Domain< 1, Functions::SpaceDomain >
 {
-   public:
-
-      Nonlinearity& getNonlinearity()
-      {
-         return this->nonlinearity;
-      }
- 
-      const Nonlinearity& getNonlinearity() const
-      {
-         return this->nonlinearity;
-      }
- 
-      InnerOperator& getInnerOperator()
-      {
-         return this->innerOperator;
-      }
- 
-      const InnerOperator& getInnerOperator() const
-      {
-         return this->innerOperator;
-      }
- 
-      template< typename Function >
-      __cuda_callable__
-      typename Function::RealType
-      operator()( const Function& function,
-                  const typename Function::PointType& v,
-                  const typename Function::RealType& time = 0.0 ) const
-      {
-         typedef typename Function::RealType RealType;
-         const RealType u_x = innerOperator.template getPartialDerivative< Function, 1, 0, 0 >( function, v, time );
-         const RealType u_xx = innerOperator.template getPartialDerivative< Function, 2, 0, 0 >( function, v, time );
-         const RealType g = nonlinearity( function, v, time );
-         const RealType g_x = nonlinearity.template getPartialDerivative< Function, 1, 0, 0 >( function, v, time );
-         return u_xx * g + u_x * g_x;
-      }
- 
-      protected:
- 
-         Nonlinearity nonlinearity;
-
-         InnerOperator innerOperator;
+public:
+   Nonlinearity&
+   getNonlinearity()
+   {
+      return this->nonlinearity;
+   }
+
+   const Nonlinearity&
+   getNonlinearity() const
+   {
+      return this->nonlinearity;
+   }
+
+   InnerOperator&
+   getInnerOperator()
+   {
+      return this->innerOperator;
+   }
+
+   const InnerOperator&
+   getInnerOperator() const
+   {
+      return this->innerOperator;
+   }
+
+   template< typename Function >
+   __cuda_callable__
+   typename Function::RealType
+   operator()( const Function& function,
+               const typename Function::PointType& v,
+               const typename Function::RealType& time = 0.0 ) const
+   {
+      typedef typename Function::RealType RealType;
+      const RealType u_x = innerOperator.template getPartialDerivative< Function, 1, 0, 0 >( function, v, time );
+      const RealType u_xx = innerOperator.template getPartialDerivative< Function, 2, 0, 0 >( function, v, time );
+      const RealType g = nonlinearity( function, v, time );
+      const RealType g_x = nonlinearity.template getPartialDerivative< Function, 1, 0, 0 >( function, v, time );
+      return u_xx * g + u_x * g_x;
+   }
+
+protected:
+   Nonlinearity nonlinearity;
+
+   InnerOperator innerOperator;
 };
 
-template< typename Nonlinearity,
-          typename InnerOperator >
-class ExactNonlinearDiffusion< 2, Nonlinearity, InnerOperator >
-   : public Functions::Domain< 2, Functions::SpaceDomain >
+template< typename Nonlinearity, typename InnerOperator >
+class ExactNonlinearDiffusion< 2, Nonlinearity, InnerOperator > : public Functions::Domain< 2, Functions::SpaceDomain >
 {
-   public:
- 
-      Nonlinearity& getNonlinearity()
-      {
-         return this->nonlinearity;
-      }
- 
-      const Nonlinearity& getNonlinearity() const
-      {
-         return this->nonlinearity;
-      }
- 
-      InnerOperator& getInnerOperator()
-      {
-         return this->innerOperator;
-      }
- 
-      const InnerOperator& getInnerOperator() const
-      {
-         return this->innerOperator;
-      }
-
-      template< typename Function >
-      __cuda_callable__
-      typename Function::RealType
-      operator()( const Function& function,
-                  const typename Function::PointType& v,
-                  const typename Function::RealType& time = 0.0 ) const
-      {
-         typedef typename Function::RealType RealType;
-         const RealType u_x  = innerOperator.template getPartialDerivative< Function, 1, 0, 0 >( function, v, time );
-         const RealType u_y  = innerOperator.template getPartialDerivative< Function, 0, 1, 0 >( function, v, time );
-         const RealType u_xx = innerOperator.template getPartialDerivative< Function, 2, 0, 0 >( function, v, time );
-         const RealType u_yy = innerOperator.template getPartialDerivative< Function, 0, 2, 0 >( function, v, time );
-         const RealType g   = nonlinearity( function, v, time );
-         const RealType g_x = nonlinearity.template getPartialDerivative< Function, 1, 0, 0 >( function, v, time );
-         const RealType g_y = nonlinearity.template getPartialDerivative< Function, 0, 1, 0 >( function, v, time );
-
-         return  ( u_xx + u_yy ) * g + g_x * u_x + g_y * u_y;
-      }
-
-      protected:
- 
-         Nonlinearity nonlinearity;
- 
-         InnerOperator innerOperator;
- 
+public:
+   Nonlinearity&
+   getNonlinearity()
+   {
+      return this->nonlinearity;
+   }
+
+   const Nonlinearity&
+   getNonlinearity() const
+   {
+      return this->nonlinearity;
+   }
+
+   InnerOperator&
+   getInnerOperator()
+   {
+      return this->innerOperator;
+   }
+
+   const InnerOperator&
+   getInnerOperator() const
+   {
+      return this->innerOperator;
+   }
+
+   template< typename Function >
+   __cuda_callable__
+   typename Function::RealType
+   operator()( const Function& function,
+               const typename Function::PointType& v,
+               const typename Function::RealType& time = 0.0 ) const
+   {
+      typedef typename Function::RealType RealType;
+      const RealType u_x = innerOperator.template getPartialDerivative< Function, 1, 0, 0 >( function, v, time );
+      const RealType u_y = innerOperator.template getPartialDerivative< Function, 0, 1, 0 >( function, v, time );
+      const RealType u_xx = innerOperator.template getPartialDerivative< Function, 2, 0, 0 >( function, v, time );
+      const RealType u_yy = innerOperator.template getPartialDerivative< Function, 0, 2, 0 >( function, v, time );
+      const RealType g = nonlinearity( function, v, time );
+      const RealType g_x = nonlinearity.template getPartialDerivative< Function, 1, 0, 0 >( function, v, time );
+      const RealType g_y = nonlinearity.template getPartialDerivative< Function, 0, 1, 0 >( function, v, time );
+
+      return ( u_xx + u_yy ) * g + g_x * u_x + g_y * u_y;
+   }
+
+protected:
+   Nonlinearity nonlinearity;
+
+   InnerOperator innerOperator;
 };
 
-template< typename Nonlinearity,
-          typename InnerOperator  >
-class ExactNonlinearDiffusion< 3, Nonlinearity, InnerOperator >
-   : public Functions::Domain< 3, Functions::SpaceDomain >
+template< typename Nonlinearity, typename InnerOperator >
+class ExactNonlinearDiffusion< 3, Nonlinearity, InnerOperator > : public Functions::Domain< 3, Functions::SpaceDomain >
 {
-   public:
- 
-      Nonlinearity& getNonlinearity()
-      {
-         return this->nonlinearity;
-      }
- 
-      const Nonlinearity& getNonlinearity() const
-      {
-         return this->nonlinearity;
-      }
- 
-      InnerOperator& getInnerOperator()
-      {
-         return this->innerOperator;
-      }
- 
-      const InnerOperator& getInnerOperator() const
-      {
-         return this->innerOperator;
-      }
- 
-      template< typename Function >
-      __cuda_callable__
-      typename Function::RealType
-      operator()( const Function& function,
-                  const typename Function::PointType& v,
-                  const typename Function::RealType& time = 0.0 ) const
-      {
-         typedef typename Function::RealType RealType;
-         const RealType u_x  = innerOperator.template getPartialDerivative< Function, 1, 0, 0 >( function, v, time );
-         const RealType u_y  = innerOperator.template getPartialDerivative< Function, 0, 1, 0 >( function, v, time );
-         const RealType u_z  = innerOperator.template getPartialDerivative< Function, 0, 0, 1 >( function, v, time );
-         const RealType u_xx = innerOperator.template getPartialDerivative< Function, 2, 0, 0 >( function, v, time );
-         const RealType u_yy = innerOperator.template getPartialDerivative< Function, 0, 2, 0 >( function, v, time );
-         const RealType u_zz = innerOperator.template getPartialDerivative< Function, 0, 0, 2 >( function, v, time );
-         const RealType g   = nonlinearity( function, v, time ) ;
-         const RealType g_x = nonlinearity.template getPartialDerivative< Function, 1, 0, 0 >( function, v, time );
-         const RealType g_y = nonlinearity.template getPartialDerivative< Function, 0, 1, 0 >( function, v, time );
-         const RealType g_z = nonlinearity.template getPartialDerivative< Function, 0, 0, 1 >( function, v, time );
-
-         return ( u_xx + u_yy + u_zz ) * g + g_x * u_x + g_y * u_y + g_z * u_z;
-      }
- 
-      protected:
- 
-         Nonlinearity nonlinearity;
- 
-         InnerOperator innerOperator;
+public:
+   Nonlinearity&
+   getNonlinearity()
+   {
+      return this->nonlinearity;
+   }
+
+   const Nonlinearity&
+   getNonlinearity() const
+   {
+      return this->nonlinearity;
+   }
+
+   InnerOperator&
+   getInnerOperator()
+   {
+      return this->innerOperator;
+   }
+
+   const InnerOperator&
+   getInnerOperator() const
+   {
+      return this->innerOperator;
+   }
+
+   template< typename Function >
+   __cuda_callable__
+   typename Function::RealType
+   operator()( const Function& function,
+               const typename Function::PointType& v,
+               const typename Function::RealType& time = 0.0 ) const
+   {
+      typedef typename Function::RealType RealType;
+      const RealType u_x = innerOperator.template getPartialDerivative< Function, 1, 0, 0 >( function, v, time );
+      const RealType u_y = innerOperator.template getPartialDerivative< Function, 0, 1, 0 >( function, v, time );
+      const RealType u_z = innerOperator.template getPartialDerivative< Function, 0, 0, 1 >( function, v, time );
+      const RealType u_xx = innerOperator.template getPartialDerivative< Function, 2, 0, 0 >( function, v, time );
+      const RealType u_yy = innerOperator.template getPartialDerivative< Function, 0, 2, 0 >( function, v, time );
+      const RealType u_zz = innerOperator.template getPartialDerivative< Function, 0, 0, 2 >( function, v, time );
+      const RealType g = nonlinearity( function, v, time );
+      const RealType g_x = nonlinearity.template getPartialDerivative< Function, 1, 0, 0 >( function, v, time );
+      const RealType g_y = nonlinearity.template getPartialDerivative< Function, 0, 1, 0 >( function, v, time );
+      const RealType g_z = nonlinearity.template getPartialDerivative< Function, 0, 0, 1 >( function, v, time );
+
+      return ( u_xx + u_yy + u_zz ) * g + g_x * u_x + g_y * u_y + g_z * u_z;
+   }
+
+protected:
+   Nonlinearity nonlinearity;
+
+   InnerOperator innerOperator;
 };
 
-} // namespace Operators
-} // namespace TNL
-
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/diffusion/FiniteVolumeNonlinearOperator.h b/src/TNL/Operators/diffusion/FiniteVolumeNonlinearOperator.h
index c24ceec4a23a7bb6e495589e5bce5e0f00420f45..9c92820ef6de6b53676f8d085c3cde02e4e74fba 100644
--- a/src/TNL/Operators/diffusion/FiniteVolumeNonlinearOperator.h
+++ b/src/TNL/Operators/diffusion/FiniteVolumeNonlinearOperator.h
@@ -20,25 +20,16 @@ namespace Operators {
 
 template< typename Mesh,
           typename NonlinearDiffusionOperator,
-	  typename OperatorQ,
+          typename OperatorQ,
           typename Real = typename Mesh::RealType,
           typename Index = typename Mesh::GlobalIndexType >
 class FiniteVolumeNonlinearOperator
-{
- 
-};
-
+{};
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index,
-          typename OperatorQ >
-class FiniteVolumeNonlinearOperator< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index, typename OperatorQ >
+class FiniteVolumeNonlinearOperator< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >
 {
-   public: 
-   
+public:
    typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
@@ -46,101 +37,73 @@ class FiniteVolumeNonlinearOperator< Meshes::Grid< 1,MeshReal, Device, MeshIndex
    typedef Index IndexType;
    typedef OperatorQ OperatorQType;
 
-   template< typename MeshEntity,
-             typename Vector >
+   template< typename MeshEntity, typename Vector >
    __cuda_callable__
-   Real operator()( const MeshEntity& entity,
-                    const Vector& u,
-                    const RealType& time) const;
-   
+   Real
+   operator()( const MeshEntity& entity, const Vector& u, const RealType& time ) const;
+
    template< typename MeshEntity >
    __cuda_callable__
-   Index getLinearSystemRowLength( const MeshType& mesh,
-                                   const IndexType& index,
-                                   const MeshEntity& entity ) const;
-
-   template< typename MeshEntity,
-             typename MeshFunction,
-             typename Vector,
-             typename Matrix >
+   Index
+   getLinearSystemRowLength( const MeshType& mesh, const IndexType& index, const MeshEntity& entity ) const;
+
+   template< typename MeshEntity, typename MeshFunction, typename Vector, typename Matrix >
    __cuda_callable__
-      void setMatrixElements( const RealType& time,
-                               const RealType& tau,
-                               const MeshType& mesh,
-                               const IndexType& index,
-                               const MeshEntity& entity,
-                               const MeshFunction& u,
-                               Vector& b,
-                               Matrix& matrix ) const;
-   
-   public:
-   
+   void
+   setMatrixElements( const RealType& time,
+                      const RealType& tau,
+                      const MeshType& mesh,
+                      const IndexType& index,
+                      const MeshEntity& entity,
+                      const MeshFunction& u,
+                      Vector& b,
+                      Matrix& matrix ) const;
+
+public:
    OperatorQ operatorQ;
 };
 
-
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index,
-          typename OperatorQ >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index, typename OperatorQ >
 class FiniteVolumeNonlinearOperator< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >
 {
-   public: 
-   
+public:
    typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
    typedef Device DeviceType;
    typedef Index IndexType;
    typedef OperatorQ OperatorQType;
-   
 
-   template< typename MeshEntity,
-             typename Vector >
+   template< typename MeshEntity, typename Vector >
    __cuda_callable__
-   Real operator()( const MeshEntity& entity,
-                    const Vector& u,
-                    const RealType& time) const;
-   
-   
+   Real
+   operator()( const MeshEntity& entity, const Vector& u, const RealType& time ) const;
+
    template< typename MeshEntity >
    __cuda_callable__
-   Index getLinearSystemRowLength( const MeshType& mesh,
-                                   const IndexType& index,
-                                   const MeshEntity& entity ) const;
-
-   template< typename MeshEntity,
-             typename MeshFunction,
-             typename Vector,
-             typename Matrix >
+   Index
+   getLinearSystemRowLength( const MeshType& mesh, const IndexType& index, const MeshEntity& entity ) const;
+
+   template< typename MeshEntity, typename MeshFunction, typename Vector, typename Matrix >
    __cuda_callable__
-      void setMatrixElements( const RealType& time,
-                               const RealType& tau,
-                               const MeshType& mesh,
-                               const IndexType& index,
-                               const MeshEntity& entity,
-                               const MeshFunction& u,
-                               Vector& b,
-                               Matrix& matrix ) const;
-   
-   public:
-   
+   void
+   setMatrixElements( const RealType& time,
+                      const RealType& tau,
+                      const MeshType& mesh,
+                      const IndexType& index,
+                      const MeshEntity& entity,
+                      const MeshFunction& u,
+                      Vector& b,
+                      Matrix& matrix ) const;
+
+public:
    OperatorQ operatorQ;
 };
 
-
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index,
-          typename OperatorQ >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index, typename OperatorQ >
 class FiniteVolumeNonlinearOperator< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >
 {
-   public: 
-   
+public:
    typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
@@ -148,39 +111,33 @@ class FiniteVolumeNonlinearOperator< Meshes::Grid< 3, MeshReal, Device, MeshInde
    typedef Index IndexType;
    typedef OperatorQ OperatorQType;
 
-   template< typename MeshEntity, 
-             typename Vector >
+   template< typename MeshEntity, typename Vector >
    __cuda_callable__
-   Real operator()( const MeshEntity& entity,
-                    const Vector& u,
-                    const RealType& time) const;
-   
+   Real
+   operator()( const MeshEntity& entity, const Vector& u, const RealType& time ) const;
+
    template< typename MeshEntity >
    __cuda_callable__
-   Index getLinearSystemRowLength( const MeshType& mesh,
-                                   const IndexType& index,
-                                   const MeshEntity& entity ) const;
-
-   template< typename MeshEntity,
-             typename MeshFunction,
-             typename Vector,
-             typename Matrix >
+   Index
+   getLinearSystemRowLength( const MeshType& mesh, const IndexType& index, const MeshEntity& entity ) const;
+
+   template< typename MeshEntity, typename MeshFunction, typename Vector, typename Matrix >
    __cuda_callable__
-      void setMatrixElements( const RealType& time,
-                               const RealType& tau,
-                               const MeshType& mesh,
-                               const IndexType& index,
-                               const MeshEntity& entity,
-                               const MeshFunction& u,
-                               Vector& b,
-                               Matrix& matrix ) const;
-   
-   public:
-   
+   void
+   setMatrixElements( const RealType& time,
+                      const RealType& tau,
+                      const MeshType& mesh,
+                      const IndexType& index,
+                      const MeshEntity& entity,
+                      const MeshFunction& u,
+                      Vector& b,
+                      Matrix& matrix ) const;
+
+public:
    OperatorQ operatorQ;
 };
 
-} // namespace Operators
-} // namespace TNL
+}  // namespace Operators
+}  // namespace TNL
 
 #include "FiniteVolumeNonlinearOperator_impl.h"
diff --git a/src/TNL/Operators/diffusion/FiniteVolumeNonlinearOperator_impl.h b/src/TNL/Operators/diffusion/FiniteVolumeNonlinearOperator_impl.h
index 5c990ed41c3d6a86866a81ba048dd2e2117c6f9e..58f580ec4fd39e8194448e93380fe3ca42061840 100644
--- a/src/TNL/Operators/diffusion/FiniteVolumeNonlinearOperator_impl.h
+++ b/src/TNL/Operators/diffusion/FiniteVolumeNonlinearOperator_impl.h
@@ -16,257 +16,199 @@
 #include <TNL/Meshes/Grid.h>
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index,
-          typename OperatorQ >
-template< typename MeshEntity,
-          typename Vector >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index, typename OperatorQ >
+template< typename MeshEntity, typename Vector >
 __cuda_callable__
 Real
-FiniteVolumeNonlinearOperator< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >::
-operator()( const MeshEntity& entity,
-          const Vector& u,
-          const Real& time ) const
+FiniteVolumeNonlinearOperator< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >::operator()(
+   const MeshEntity& entity,
+   const Vector& u,
+   const Real& time ) const
 {
    return 0.0;
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index,
-          typename OperatorQ >
-   template< typename MeshEntity >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index, typename OperatorQ >
+template< typename MeshEntity >
 __cuda_callable__
 Index
 FiniteVolumeNonlinearOperator< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >::
-getLinearSystemRowLength( const MeshType& mesh,
-                          const IndexType& index,
-                          const MeshEntity& entity ) const
+   getLinearSystemRowLength( const MeshType& mesh, const IndexType& index, const MeshEntity& entity ) const
 {
    return 1;
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index,
-          typename OperatorQ >
-template< typename MeshEntity,
-          typename MeshFunction,
-          typename Vector,
-          typename Matrix >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index, typename OperatorQ >
+template< typename MeshEntity, typename MeshFunction, typename Vector, typename Matrix >
 __cuda_callable__
 void
-FiniteVolumeNonlinearOperator< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >::
-setMatrixElements( const RealType& time,
-                    const RealType& tau,
-                    const MeshType& mesh,
-                    const IndexType& index,
-                    const MeshEntity& entity,
-                    const MeshFunction& u,
-                    Vector& b,
-                    Matrix& matrix ) const
+FiniteVolumeNonlinearOperator< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >::setMatrixElements(
+   const RealType& time,
+   const RealType& tau,
+   const MeshType& mesh,
+   const IndexType& index,
+   const MeshEntity& entity,
+   const MeshFunction& u,
+   Vector& b,
+   Matrix& matrix ) const
 {
    typename Matrix::MatrixRow matrixRow = matrix.getRow( index );
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index,
-          typename OperatorQ >
-template< typename MeshEntity,
-          typename Vector >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index, typename OperatorQ >
+template< typename MeshEntity, typename Vector >
 __cuda_callable__
 Real
-FiniteVolumeNonlinearOperator< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >::
-operator()( const MeshEntity& entity,
-            const Vector& u,
-            const Real& time ) const
+FiniteVolumeNonlinearOperator< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >::operator()(
+   const MeshEntity& entity,
+   const Vector& u,
+   const Real& time ) const
 {
-   const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities();      
+   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[ 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) );
+   return operatorQ( entity, u, time )
+        * ( ( 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,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index,
-          typename OperatorQ >
-   template< typename MeshEntity >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index, typename OperatorQ >
+template< typename MeshEntity >
 __cuda_callable__
 Index
 FiniteVolumeNonlinearOperator< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >::
-getLinearSystemRowLength( const MeshType& mesh,
-                          const IndexType& index,
-                          const MeshEntity& entity ) const
+   getLinearSystemRowLength( const MeshType& mesh, const IndexType& index, const MeshEntity& entity ) const
 {
    return 5;
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index,
-          typename OperatorQ >
-template< typename MeshEntity, 
-          typename MeshFunction,
-          typename Vector,
-          typename Matrix >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index, typename OperatorQ >
+template< typename MeshEntity, typename MeshFunction, typename Vector, typename Matrix >
 __cuda_callable__
 void
-FiniteVolumeNonlinearOperator< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >::
-setMatrixElements( const RealType& time,
-                    const RealType& tau,
-                    const MeshType& mesh,
-                    const IndexType& index,
-                    const MeshEntity& entity,
-                    const MeshFunction& u,
-                    Vector& b,
-                    Matrix& matrix ) const
+FiniteVolumeNonlinearOperator< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >::setMatrixElements(
+   const RealType& time,
+   const RealType& tau,
+   const MeshType& mesh,
+   const IndexType& index,
+   const MeshEntity& entity,
+   const MeshFunction& u,
+   Vector& b,
+   Matrix& matrix ) const
 {
    typename Matrix::MatrixRow matrixRow = matrix.getRow( index );
    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 >() / 
-                       operatorQ.operator()( entity, u, time, -1 );
-   const RealType cCoef = tau * operatorQ.operator()( entity, u, time ) * ( mesh.template getSpaceStepsProducts< -2, 0 >() / 
-                       operatorQ.operator()( entity, u, time, 1 ) + mesh.template getSpaceStepsProducts< 0, -2 >() / 
-                       operatorQ.operator()( entity, u, time, 0, 1 )
-                       + mesh.template getSpaceStepsProducts< -2, 0 >() / operatorQ.operator()( entity, u, time, -1 ) + 
-                       mesh.template getSpaceStepsProducts< 0, -2 >() / operatorQ.operator()( entity, u, time, 0, -1 ) );
-   const RealType dCoef = - tau * operatorQ.operator()( entity, u, time ) * mesh.template getSpaceStepsProducts< -2, 0 >() / 
-                       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, neighborEntities.template getEntityIndex<  0, -1 >(), aCoef );
-   matrixRow.setElement( 1, neighborEntities.template getEntityIndex< -1,  0 >(), bCoef );
-   matrixRow.setElement( 2, entity.getIndex(),                                     cCoef );
-   matrixRow.setElement( 3, neighborEntities.template getEntityIndex<  1,  0 >(), dCoef );
-   matrixRow.setElement( 4, neighborEntities.template getEntityIndex<  0,  1 >(), eCoef );
+   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 >()
+                        / operatorQ.operator()( entity, u, time, -1 );
+   const RealType cCoef = tau * operatorQ.operator()( entity, u, time )
+                        * ( mesh.template getSpaceStepsProducts< -2, 0 >() / operatorQ.operator()( entity, u, time, 1 )
+                            + mesh.template getSpaceStepsProducts< 0, -2 >() / operatorQ.operator()( entity, u, time, 0, 1 )
+                            + mesh.template getSpaceStepsProducts< -2, 0 >() / operatorQ.operator()( entity, u, time, -1 )
+                            + mesh.template getSpaceStepsProducts< 0, -2 >() / operatorQ.operator()( entity, u, time, 0, -1 ) );
+   const RealType dCoef = -tau * operatorQ.operator()( entity, u, time ) * mesh.template getSpaceStepsProducts< -2, 0 >()
+                        / 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, neighborEntities.template getEntityIndex< 0, -1 >(), aCoef );
+   matrixRow.setElement( 1, neighborEntities.template getEntityIndex< -1, 0 >(), bCoef );
+   matrixRow.setElement( 2, entity.getIndex(), cCoef );
+   matrixRow.setElement( 3, neighborEntities.template getEntityIndex< 1, 0 >(), dCoef );
+   matrixRow.setElement( 4, neighborEntities.template getEntityIndex< 0, 1 >(), eCoef );
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index,
-          typename OperatorQ >
-template< typename MeshEntity,
-          typename Vector >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index, typename OperatorQ >
+template< typename MeshEntity, typename Vector >
 __cuda_callable__
 Real
-FiniteVolumeNonlinearOperator< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >::
-operator()( const MeshEntity& entity,
-            const Vector& u,
-            const Real& time ) const
+FiniteVolumeNonlinearOperator< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >::operator()(
+   const MeshEntity& entity,
+   const Vector& u,
+   const Real& time ) const
 {
    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[ neighborEntities.template getEntityIndex< 1,0,0 >() ] - u[ cellIndex ]) 
-          * mesh.template getSpaceStepsProducts< -2, 0, 0 >() / operatorQ( entity, u, time, 1 )
-          + ( u[ neighborEntities.template getEntityIndex< 0,1,0 >() ] - u[ cellIndex ]) * mesh.template getSpaceStepsProducts< 0, -2, 0 >()/
-          operatorQ( entity, u, time, 0, 1 ) 
-          + ( u[ neighborEntities.template getEntityIndex< 0,0,1 >() ] - u[ cellIndex ]) * mesh.template getSpaceStepsProducts< 0, 0, -2 >()/
-          operatorQ( entity, u, time, 0, 0, 1 ) 
-          - ( - u[ neighborEntities.template getEntityIndex< -1,0,0 >() ]  + u[ cellIndex ]) 
-          * mesh.template getSpaceStepsProducts< -2, 0, 0 >() / operatorQ( entity, u, time, -1)
-          -( - u[ neighborEntities.template getEntityIndex< 0,-1,0 >() ] + u[ cellIndex ]) * mesh.template getSpaceStepsProducts< 0, -2, 0 >()
-          /operatorQ( entity, u, time, 0, -1) 
-          -( - u[ neighborEntities.template getEntityIndex< 0,0,-1 >() ] + u[ cellIndex ]) * mesh.template getSpaceStepsProducts< 0, 0, -2 >()
-          /operatorQ( entity, u, time, 0, 0, -1) );
+   return operatorQ( entity, u, time )
+        * ( ( u[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ] - u[ cellIndex ] )
+               * mesh.template getSpaceStepsProducts< -2, 0, 0 >() / operatorQ( entity, u, time, 1 )
+            + ( u[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ] - u[ cellIndex ] )
+                 * mesh.template getSpaceStepsProducts< 0, -2, 0 >() / operatorQ( entity, u, time, 0, 1 )
+            + ( u[ neighborEntities.template getEntityIndex< 0, 0, 1 >() ] - u[ cellIndex ] )
+                 * mesh.template getSpaceStepsProducts< 0, 0, -2 >() / operatorQ( entity, u, time, 0, 0, 1 )
+            - ( -u[ neighborEntities.template getEntityIndex< -1, 0, 0 >() ] + u[ cellIndex ] )
+                 * mesh.template getSpaceStepsProducts< -2, 0, 0 >() / operatorQ( entity, u, time, -1 )
+            - ( -u[ neighborEntities.template getEntityIndex< 0, -1, 0 >() ] + u[ cellIndex ] )
+                 * mesh.template getSpaceStepsProducts< 0, -2, 0 >() / operatorQ( entity, u, time, 0, -1 )
+            - ( -u[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] + u[ cellIndex ] )
+                 * mesh.template getSpaceStepsProducts< 0, 0, -2 >() / operatorQ( entity, u, time, 0, 0, -1 ) );
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index,
-          typename OperatorQ >
-   template< typename MeshEntity >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index, typename OperatorQ >
+template< typename MeshEntity >
 __cuda_callable__
 Index
 FiniteVolumeNonlinearOperator< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >::
-getLinearSystemRowLength( const MeshType& mesh,
-                          const IndexType& index,
-                          const MeshEntity& entity ) const
+   getLinearSystemRowLength( const MeshType& mesh, const IndexType& index, const MeshEntity& entity ) const
 {
    return 7;
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index,
-          typename OperatorQ >
-template< typename MeshEntity,
-          typename MeshFunction,
-          typename Vector,
-          typename Matrix >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index, typename OperatorQ >
+template< typename MeshEntity, typename MeshFunction, typename Vector, typename Matrix >
 #ifdef HAVE_CUDA
 __cuda_callable__
 #endif
 void
-FiniteVolumeNonlinearOperator< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >::
-setMatrixElements( const RealType& time,
-                    const RealType& tau,
-                    const MeshType& mesh,
-                    const IndexType& index,
-                    const MeshEntity& entity,
-                    const MeshFunction& u,
-                    Vector& b,
-                    Matrix& matrix ) const
+FiniteVolumeNonlinearOperator< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, OperatorQ, Real, Index >::setMatrixElements(
+   const RealType& time,
+   const RealType& tau,
+   const MeshType& mesh,
+   const IndexType& index,
+   const MeshEntity& entity,
+   const MeshFunction& u,
+   Vector& b,
+   Matrix& matrix ) const
 {
    typename Matrix::MatrixRow matrixRow = matrix.getRow( index );
    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 ) * 
-                       mesh.template getSpaceStepsProducts< 0, -2, 0 >() / operatorQ.operator()( entity, u, time, 0, -1, 0 );
-   const RealType cCoef = - tau * operatorQ( entity, u, time ) * 
-                       mesh.template getSpaceStepsProducts< -2, 0, 0 >() / operatorQ.operator()( entity, u, time, -1, 0, 0 );
-   const RealType dCoef = tau * operatorQ( entity, u, time ) * ( 
-                       mesh.template getSpaceStepsProducts< -2, 0, 0 >() / operatorQ.operator()( entity, u, time, 1, 0, 0 ) + 
-                       mesh.template getSpaceStepsProducts< 0, -2, 0 >() / operatorQ.operator()( entity, u, time, 0, 1, 0 ) +
-                       mesh.template getSpaceStepsProducts< 0, 0, -2 >() / operatorQ.operator()( entity, u, time, 0, 0, 1 ) + 
-                       mesh.template getSpaceStepsProducts< -2, 0, 0 >() / operatorQ.operator()( entity, u, time, -1, 0, 0 ) +
-                       mesh.template getSpaceStepsProducts< 0, -2, 0 >() / operatorQ.operator()( entity, u, time, 0, -1, 0 ) + 
-                       mesh.template getSpaceStepsProducts< 0, 0, -2 >() / operatorQ.operator()( entity, u, time, 0, 0, -1 ) );
-   const RealType eCoef = - tau * operatorQ.operator()( entity, u, time ) *
-                       mesh.template getSpaceStepsProducts< -2, 0, 0 >() / operatorQ.operator()( entity, u, time, 1, 0, 0 );
-   const RealType fCoef = - tau * operatorQ.operator()( entity, u, 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, 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, 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 );
+   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 ) * mesh.template getSpaceStepsProducts< 0, -2, 0 >()
+                        / operatorQ.operator()( entity, u, time, 0, -1, 0 );
+   const RealType cCoef = -tau * operatorQ( entity, u, time ) * mesh.template getSpaceStepsProducts< -2, 0, 0 >()
+                        / operatorQ.operator()( entity, u, time, -1, 0, 0 );
+   const RealType dCoef =
+      tau * operatorQ( entity, u, time )
+      * ( mesh.template getSpaceStepsProducts< -2, 0, 0 >() / operatorQ.operator()( entity, u, time, 1, 0, 0 )
+          + mesh.template getSpaceStepsProducts< 0, -2, 0 >() / operatorQ.operator()( entity, u, time, 0, 1, 0 )
+          + mesh.template getSpaceStepsProducts< 0, 0, -2 >() / operatorQ.operator()( entity, u, time, 0, 0, 1 )
+          + mesh.template getSpaceStepsProducts< -2, 0, 0 >() / operatorQ.operator()( entity, u, time, -1, 0, 0 )
+          + mesh.template getSpaceStepsProducts< 0, -2, 0 >() / operatorQ.operator()( entity, u, time, 0, -1, 0 )
+          + mesh.template getSpaceStepsProducts< 0, 0, -2 >() / operatorQ.operator()( entity, u, time, 0, 0, -1 ) );
+   const RealType eCoef = -tau * operatorQ.operator()( entity, u, time ) * mesh.template getSpaceStepsProducts< -2, 0, 0 >()
+                        / operatorQ.operator()( entity, u, time, 1, 0, 0 );
+   const RealType fCoef = -tau * operatorQ.operator()( entity, u, 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, 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, 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
-} // namespace TNL
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/diffusion/LinearDiffusion.h b/src/TNL/Operators/diffusion/LinearDiffusion.h
index b4311621218828bc811788c51f6a2d7f0c03378a..00294382f2cc363ac5555304d66d640f287ddc7e 100644
--- a/src/TNL/Operators/diffusion/LinearDiffusion.h
+++ b/src/TNL/Operators/diffusion/LinearDiffusion.h
@@ -19,163 +19,136 @@
 #include <TNL/Operators/diffusion/ExactLinearDiffusion.h>
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
-template< typename Mesh,
-          typename Real = typename Mesh::RealType,
-          typename Index = typename Mesh::GlobalIndexType >
+template< typename Mesh, typename Real = typename Mesh::RealType, typename Index = typename Mesh::GlobalIndexType >
 class LinearDiffusion
-{
- 
-};
-
+{};
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class LinearDiffusion< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real, Index >
-: public Operator< Meshes::Grid< 1, MeshReal, Device, MeshIndex >,
-                      Functions::MeshInteriorDomain, 1, 1, Real, Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class LinearDiffusion< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+: public Operator< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Functions::MeshInteriorDomain, 1, 1, Real, Index >
 {
-   public:
- 
-      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
-      typedef typename MeshType::CoordinatesType CoordinatesType;
-      typedef Real RealType;
-      typedef Device DeviceType;
-      typedef Index IndexType;
-      typedef ExactLinearDiffusion< 1 > ExactOperatorType;
- 
-      static const int Dimension = MeshType::getMeshDimension();
- 
-      static constexpr int getMeshDimension() { return Dimension; }
-
-      template< typename PreimageFunction,
-                typename MeshEntity >
-      __cuda_callable__
-      inline Real operator()( const PreimageFunction& u,
-                              const MeshEntity& entity,
-                              const RealType& time = 0.0 ) const;
-
-      template< typename MeshEntity >
-      __cuda_callable__
-      inline Index getLinearSystemRowLength( const MeshType& mesh,
-                                             const IndexType& index,
-                                             const MeshEntity& entity ) const;
-
-      template< typename PreimageFunction,
-                typename MeshEntity,
-                typename Matrix,
-                typename Vector >
-      __cuda_callable__
-      inline void setMatrixElements( const PreimageFunction& u,
-                                     const MeshEntity& entity,
-                                     const RealType& time,
-                                     const RealType& tau,
-                                     Matrix& matrix,
-                                     Vector& b ) const;
+public:
+   typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
+   typedef typename MeshType::CoordinatesType CoordinatesType;
+   typedef Real RealType;
+   typedef Device DeviceType;
+   typedef Index IndexType;
+   typedef ExactLinearDiffusion< 1 > ExactOperatorType;
+
+   static const int Dimension = MeshType::getMeshDimension();
+
+   static constexpr int
+   getMeshDimension()
+   {
+      return Dimension;
+   }
+
+   template< typename PreimageFunction, typename MeshEntity >
+   __cuda_callable__
+   inline Real
+   operator()( const PreimageFunction& u, const MeshEntity& entity, const RealType& time = 0.0 ) const;
+
+   template< typename MeshEntity >
+   __cuda_callable__
+   inline Index
+   getLinearSystemRowLength( const MeshType& mesh, const IndexType& index, const MeshEntity& entity ) const;
+
+   template< typename PreimageFunction, typename MeshEntity, typename Matrix, typename Vector >
+   __cuda_callable__
+   inline void
+   setMatrixElements( const PreimageFunction& u,
+                      const MeshEntity& entity,
+                      const RealType& time,
+                      const RealType& tau,
+                      Matrix& matrix,
+                      Vector& b ) const;
 };
 
-
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 class LinearDiffusion< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
-: public Operator< Meshes::Grid< 2, MeshReal, Device, MeshIndex >,
-                      Functions::MeshInteriorDomain, 2, 2, Real, Index >
+: public Operator< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Functions::MeshInteriorDomain, 2, 2, Real, Index >
 {
-   public:
- 
-      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
-      typedef typename MeshType::CoordinatesType CoordinatesType;
-      typedef Real RealType;
-      typedef Device DeviceType;
-      typedef Index IndexType;
-      typedef ExactLinearDiffusion< 2 > ExactOperatorType;
- 
-      static const int Dimension = MeshType::getMeshDimension();
- 
-      static constexpr int getMeshDimension() { return Dimension; }
-
-      template< typename PreimageFunction, typename EntityType >
-      __cuda_callable__
-      inline Real operator()( const PreimageFunction& u,
-                              const EntityType& entity,
-                              const Real& time = 0.0 ) const;
-
-      template< typename EntityType >
-      __cuda_callable__
-      inline Index getLinearSystemRowLength( const MeshType& mesh,
-                                             const IndexType& index,
-                                             const EntityType& entity ) const;
- 
-      template< typename PreimageFunction,
-                typename MeshEntity,
-                typename Matrix,
-                typename Vector >
-      __cuda_callable__
-      inline void setMatrixElements( const PreimageFunction& u,
-                                     const MeshEntity& entity,
-                                     const RealType& time,
-                                     const RealType& tau,
-                                     Matrix& matrix,
-                                     Vector& b ) const;
+public:
+   typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+   typedef typename MeshType::CoordinatesType CoordinatesType;
+   typedef Real RealType;
+   typedef Device DeviceType;
+   typedef Index IndexType;
+   typedef ExactLinearDiffusion< 2 > ExactOperatorType;
+
+   static const int Dimension = MeshType::getMeshDimension();
+
+   static constexpr int
+   getMeshDimension()
+   {
+      return Dimension;
+   }
+
+   template< typename PreimageFunction, typename EntityType >
+   __cuda_callable__
+   inline Real
+   operator()( const PreimageFunction& u, const EntityType& entity, const Real& time = 0.0 ) const;
+
+   template< typename EntityType >
+   __cuda_callable__
+   inline Index
+   getLinearSystemRowLength( const MeshType& mesh, const IndexType& index, const EntityType& entity ) const;
+
+   template< typename PreimageFunction, typename MeshEntity, typename Matrix, typename Vector >
+   __cuda_callable__
+   inline void
+   setMatrixElements( const PreimageFunction& u,
+                      const MeshEntity& entity,
+                      const RealType& time,
+                      const RealType& tau,
+                      Matrix& matrix,
+                      Vector& b ) const;
 };
 
-
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 class LinearDiffusion< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >
-: public Operator< Meshes::Grid< 3, MeshReal, Device, MeshIndex >,
-                      Functions::MeshInteriorDomain, 3, 3, Real, Index >
+: public Operator< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Functions::MeshInteriorDomain, 3, 3, Real, Index >
 {
-   public:
- 
-      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
-      typedef typename MeshType::CoordinatesType CoordinatesType;
-      typedef Real RealType;
-      typedef Device DeviceType;
-      typedef Index IndexType;
-      typedef ExactLinearDiffusion< 3 > ExactOperatorType;
-
-      static const int Dimension = MeshType::getMeshDimension();
- 
-      static constexpr int getMeshDimension() { return Dimension; }
-
-      template< typename PreimageFunction,
-                typename EntityType >
-      __cuda_callable__
-      inline Real operator()( const PreimageFunction& u,
-                              const EntityType& entity,
-                              const Real& time = 0.0 ) const;
-
-      template< typename EntityType >
-      __cuda_callable__
-      inline Index getLinearSystemRowLength( const MeshType& mesh,
-                                             const IndexType& index,
-                                             const EntityType& entity ) const;
-
-      template< typename PreimageFunction,
-                typename MeshEntity,
-                typename Matrix,
-                typename Vector >
-      __cuda_callable__
-      inline void setMatrixElements( const PreimageFunction& u,
-                                     const MeshEntity& entity,
-                                     const RealType& time,
-                                     const RealType& tau,
-                                     Matrix& matrix,
-                                     Vector& b ) const;
+public:
+   typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+   typedef typename MeshType::CoordinatesType CoordinatesType;
+   typedef Real RealType;
+   typedef Device DeviceType;
+   typedef Index IndexType;
+   typedef ExactLinearDiffusion< 3 > ExactOperatorType;
+
+   static const int Dimension = MeshType::getMeshDimension();
+
+   static constexpr int
+   getMeshDimension()
+   {
+      return Dimension;
+   }
+
+   template< typename PreimageFunction, typename EntityType >
+   __cuda_callable__
+   inline Real
+   operator()( const PreimageFunction& u, const EntityType& entity, const Real& time = 0.0 ) const;
+
+   template< typename EntityType >
+   __cuda_callable__
+   inline Index
+   getLinearSystemRowLength( const MeshType& mesh, const IndexType& index, const EntityType& entity ) const;
+
+   template< typename PreimageFunction, typename MeshEntity, typename Matrix, typename Vector >
+   __cuda_callable__
+   inline void
+   setMatrixElements( const PreimageFunction& u,
+                      const MeshEntity& entity,
+                      const RealType& time,
+                      const RealType& tau,
+                      Matrix& matrix,
+                      Vector& b ) const;
 };
 
-} // namespace Operators
-} // namespace TNL
+}  // namespace Operators
+}  // namespace TNL
 
 #include <TNL/Operators/diffusion/LinearDiffusion_impl.h>
diff --git a/src/TNL/Operators/diffusion/LinearDiffusion_impl.h b/src/TNL/Operators/diffusion/LinearDiffusion_impl.h
index 20ccc172399a0efd9615e3da107d80f52119a487..34bce826afb5ecbc0de8bc24f679df863052d077 100644
--- a/src/TNL/Operators/diffusion/LinearDiffusion_impl.h
+++ b/src/TNL/Operators/diffusion/LinearDiffusion_impl.h
@@ -16,68 +16,47 @@
 #include <TNL/Meshes/Grid.h>
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-template< typename PreimageFunction,
-          typename MeshEntity >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+template< typename PreimageFunction, typename MeshEntity >
 __cuda_callable__
-inline
-Real
-LinearDiffusion< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
-operator()( const PreimageFunction& u,
-            const MeshEntity& entity,
-            const Real& time ) const
+inline Real
+LinearDiffusion< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::operator()( const PreimageFunction& u,
+                                                                                            const MeshEntity& entity,
+                                                                                            const Real& time ) const
 {
    static_assert( MeshEntity::getEntityDimension() == 1, "Wrong mesh entity dimensions." );
    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[ neighborEntities.template getEntityIndex< -1 >() ]
-            - 2.0 * u[ entity.getIndex() ]
-            + u[ neighborEntities.template getEntityIndex< 1 >() ] ) * hxSquareInverse;
+   const RealType& hxSquareInverse = entity.getMesh().template getSpaceStepsProducts< -2 >();
+   return ( u[ neighborEntities.template getEntityIndex< -1 >() ] - 2.0 * u[ entity.getIndex() ]
+            + u[ neighborEntities.template getEntityIndex< 1 >() ] )
+        * hxSquareInverse;
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-   template< typename MeshEntity >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+template< typename MeshEntity >
 __cuda_callable__
-inline
-Index
-LinearDiffusion< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
-getLinearSystemRowLength( const MeshType& mesh,
-                          const IndexType& index,
-                          const MeshEntity& entity ) const
+inline Index
+LinearDiffusion< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::getLinearSystemRowLength(
+   const MeshType& mesh,
+   const IndexType& index,
+   const MeshEntity& entity ) const
 {
    return 3;
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-   template< typename PreimageFunction,
-             typename MeshEntity,
-             typename Matrix,
-             typename Vector >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+template< typename PreimageFunction, typename MeshEntity, typename Matrix, typename Vector >
 __cuda_callable__
-inline
-void
-LinearDiffusion< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
-setMatrixElements( const PreimageFunction& u,
-                   const MeshEntity& entity,
-                   const RealType& time,
-                   const RealType& tau,
-                   Matrix& matrix,
-                   Vector& b ) const
+inline void
+LinearDiffusion< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::setMatrixElements( const PreimageFunction& u,
+                                                                                                   const MeshEntity& entity,
+                                                                                                   const RealType& time,
+                                                                                                   const RealType& tau,
+                                                                                                   Matrix& matrix,
+                                                                                                   Vector& b ) const
 {
    static_assert( MeshEntity::getEntityDimension() == 1, "Wrong mesh entity dimensions." );
    static_assert( PreimageFunction::getEntitiesDimension() == 1, "Wrong preimage function" );
@@ -85,75 +64,53 @@ setMatrixElements( const PreimageFunction& u,
    const IndexType& index = entity.getIndex();
    auto matrixRow = matrix.getRow( index );
    const RealType lambdaX = tau * entity.getMesh().template getSpaceStepsProducts< -2 >();
-   matrixRow.setElement( 0, neighborEntities.template getEntityIndex< -1 >(),      - lambdaX );
-   matrixRow.setElement( 1, index,                                              2.0 * lambdaX );
-   matrixRow.setElement( 2, neighborEntities.template getEntityIndex< 1 >(),       - lambdaX );
+   matrixRow.setElement( 0, neighborEntities.template getEntityIndex< -1 >(), -lambdaX );
+   matrixRow.setElement( 1, index, 2.0 * lambdaX );
+   matrixRow.setElement( 2, neighborEntities.template getEntityIndex< 1 >(), -lambdaX );
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-   template< typename EntityType >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+template< typename EntityType >
 __cuda_callable__
-inline
-Index
-LinearDiffusion< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
-getLinearSystemRowLength( const MeshType& mesh,
-                          const IndexType& index,
-                          const EntityType& entity ) const
+inline Index
+LinearDiffusion< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::getLinearSystemRowLength(
+   const MeshType& mesh,
+   const IndexType& index,
+   const EntityType& entity ) const
 {
    return 5;
 }
 
-
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-template< typename PreimageFunction,
-          typename EntityType >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+template< typename PreimageFunction, typename EntityType >
 __cuda_callable__
-inline
-Real
-LinearDiffusion< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
-operator()( const PreimageFunction& u,
-            const EntityType& entity,
-            const Real& time ) const
+inline Real
+LinearDiffusion< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::operator()( const PreimageFunction& u,
+                                                                                            const EntityType& entity,
+                                                                                            const Real& time ) const
 {
    static_assert( EntityType::getEntityDimension() == 2, "Wrong mesh entity dimensions." );
    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[ 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 );
+   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 );
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-   template< typename PreimageFunction,
-             typename MeshEntity,
-             typename Matrix,
-             typename Vector >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+template< typename PreimageFunction, typename MeshEntity, typename Matrix, typename Vector >
 __cuda_callable__
-inline
-void
-LinearDiffusion< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
-setMatrixElements( const PreimageFunction& u,
-                   const MeshEntity& entity,
-                   const RealType& time,
-                   const RealType& tau,
-                   Matrix& matrix,
-                   Vector& b ) const
+inline void
+LinearDiffusion< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::setMatrixElements( const PreimageFunction& u,
+                                                                                                   const MeshEntity& entity,
+                                                                                                   const RealType& time,
+                                                                                                   const RealType& tau,
+                                                                                                   Matrix& matrix,
+                                                                                                   Vector& b ) const
 {
    static_assert( MeshEntity::getEntityDimension() == 2, "Wrong mesh entity dimensions." );
    static_assert( PreimageFunction::getEntitiesDimension() == 2, "Wrong preimage function" );
@@ -164,77 +121,59 @@ setMatrixElements( const PreimageFunction& u,
    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, neighborEntities.template getEntityIndex< 1, 0 >(),   -lambdaX );
-   matrixRow.setElement( 4, neighborEntities.template getEntityIndex< 0, 1 >(),   -lambdaY );
+   matrixRow.setElement( 2, index, 2.0 * ( lambdaX + lambdaY ) );
+   matrixRow.setElement( 3, neighborEntities.template getEntityIndex< 1, 0 >(), -lambdaX );
+   matrixRow.setElement( 4, neighborEntities.template getEntityIndex< 0, 1 >(), -lambdaY );
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-template< typename PreimageFunction,
-          typename EntityType >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+template< typename PreimageFunction, typename EntityType >
 __cuda_callable__
-inline
-Real
-LinearDiffusion< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
-operator()( const PreimageFunction& u,
-            const EntityType& entity,
-            const Real& time ) const
+inline Real
+LinearDiffusion< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::operator()( const PreimageFunction& u,
+                                                                                            const EntityType& entity,
+                                                                                            const Real& time ) const
 {
    static_assert( EntityType::getEntityDimension() == 3, "Wrong mesh entity dimensions." );
    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[ 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 );
+   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[ 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 );
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-   template< typename EntityType >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+template< typename EntityType >
 __cuda_callable__
-inline
-Index
-LinearDiffusion< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
-getLinearSystemRowLength( const MeshType& mesh,
-                          const IndexType& index,
-                          const EntityType& entity ) const
+inline Index
+LinearDiffusion< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::getLinearSystemRowLength(
+   const MeshType& mesh,
+   const IndexType& index,
+   const EntityType& entity ) const
 {
    return 7;
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-   template< typename PreimageFunction,
-             typename MeshEntity,
-             typename Matrix,
-             typename Vector >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+template< typename PreimageFunction, typename MeshEntity, typename Matrix, typename Vector >
 __cuda_callable__
-inline
-void
-LinearDiffusion< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
-setMatrixElements( const PreimageFunction& u,
-                   const MeshEntity& entity,
-                   const RealType& time,
-                   const RealType& tau,
-                   Matrix& matrix,
-                   Vector& b ) const
+inline void
+LinearDiffusion< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::setMatrixElements( const PreimageFunction& u,
+                                                                                                   const MeshEntity& entity,
+                                                                                                   const RealType& time,
+                                                                                                   const RealType& tau,
+                                                                                                   Matrix& matrix,
+                                                                                                   Vector& b ) const
 {
    static_assert( MeshEntity::getEntityDimension() == 3, "Wrong mesh entity dimensions." );
    static_assert( PreimageFunction::getEntitiesDimension() == 3, "Wrong preimage function" );
@@ -247,11 +186,11 @@ setMatrixElements( const PreimageFunction& u,
    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, 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 );
+   matrixRow.setElement( 3, index, 2.0 * ( lambdaX + lambdaY + 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
-} // namespace TNL
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/diffusion/NonlinearDiffusion_impl.h b/src/TNL/Operators/diffusion/NonlinearDiffusion_impl.h
index 786f7555dae28442b20e75208e18c3dcdade5b04..f23ad4e42ac4f890f799867308eb6703a1b9a0d3 100644
--- a/src/TNL/Operators/diffusion/NonlinearDiffusion_impl.h
+++ b/src/TNL/Operators/diffusion/NonlinearDiffusion_impl.h
@@ -15,7 +15,6 @@
  * Szekely Ondrej, ondra.szekely@gmail.com
  */
 
-
 namespace TNL {
 namespace Operators {
 
@@ -25,16 +24,15 @@ template< typename MeshReal,
           typename Real,
           typename Index,
           typename NonlinearDiffusionOperator >
-template< typename MeshEntity,
-          typename Vector >
+template< typename MeshEntity, typename Vector >
 __cuda_callable__
 Real
-NonlinearDiffusion< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, NonlinearDiffusionOperator, Real, Index >::
-operator()( const MeshEntity& entity,
-            const Vector& u,
-            const Real& time ) const
+NonlinearDiffusion< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, NonlinearDiffusionOperator, Real, Index >::operator()(
+   const MeshEntity& entity,
+   const Vector& u,
+   const Real& time ) const
 {
-    return nonlinearDiffusionOperator( u, entity, time );
+   return nonlinearDiffusionOperator( u, entity, time );
 }
 
 template< typename MeshReal,
@@ -43,13 +41,11 @@ template< typename MeshReal,
           typename Real,
           typename Index,
           typename NonlinearDiffusionOperator >
-   template< typename MeshEntity >          
+template< typename MeshEntity >
 __cuda_callable__
 Index
 NonlinearDiffusion< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, NonlinearDiffusionOperator, Real, Index >::
-getLinearSystemRowLength( const MeshType& mesh,
-                          const IndexType& index,
-                          const MeshEntity& entity ) const
+   getLinearSystemRowLength( const MeshType& mesh, const IndexType& index, const MeshEntity& entity ) const
 {
    return nonlinearDiffusionOperator.getLinearSystemRowLength( mesh, index, entity );
 }
@@ -60,23 +56,20 @@ template< typename MeshReal,
           typename Real,
           typename Index,
           typename NonlinearDiffusionOperator >
-template< typename MeshEntity,
-          typename MeshFunction,
-          typename Vector,           
-          typename Matrix >
+template< typename MeshEntity, typename MeshFunction, typename Vector, typename Matrix >
 __cuda_callable__
 void
 NonlinearDiffusion< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, NonlinearDiffusionOperator, Real, Index >::
-setMatrixElements( const RealType& time,
-                    const RealType& tau,
-                    const MeshType& mesh,
-                    const IndexType& index,
-                    const MeshEntity& entity,
-                    const MeshFunction& u,
-                    Vector& b,
-                    Matrix& matrix ) const
+   setMatrixElements( const RealType& time,
+                      const RealType& tau,
+                      const MeshType& mesh,
+                      const IndexType& index,
+                      const MeshEntity& entity,
+                      const MeshFunction& u,
+                      Vector& b,
+                      Matrix& matrix ) const
 {
-    nonlinearDiffusionOperator.setMatrixElements( time, tau, mesh, index, entity, u, b, matrix );
+   nonlinearDiffusionOperator.setMatrixElements( time, tau, mesh, index, entity, u, b, matrix );
 }
 
 template< typename MeshReal,
@@ -85,31 +78,28 @@ template< typename MeshReal,
           typename Real,
           typename Index,
           typename NonlinearDiffusionOperator >
-template< typename MeshEntity,
-          typename Vector >
+template< typename MeshEntity, typename Vector >
 __cuda_callable__
 Real
-NonlinearDiffusion< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, NonlinearDiffusionOperator, Real, Index >::
-operator()( const MeshEntity& entity,
-            const Vector& u,
-            const Real& time ) const
+NonlinearDiffusion< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, NonlinearDiffusionOperator, Real, Index >::operator()(
+   const MeshEntity& entity,
+   const Vector& u,
+   const Real& time ) const
 {
-    return nonlinearDiffusionOperator( u, entity, time );
+   return nonlinearDiffusionOperator( u, entity, time );
 }
-       
+
 template< typename MeshReal,
           typename Device,
           typename MeshIndex,
           typename Real,
           typename Index,
           typename NonlinearDiffusionOperator >
-   template< typename MeshEntity >
+template< typename MeshEntity >
 __cuda_callable__
 Index
 NonlinearDiffusion< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, NonlinearDiffusionOperator, Real, Index >::
-getLinearSystemRowLength( const MeshType& mesh,
-                          const IndexType& index,
-                          const MeshEntity& entity ) const
+   getLinearSystemRowLength( const MeshType& mesh, const IndexType& index, const MeshEntity& entity ) const
 {
    return nonlinearDiffusionOperator.getLinearSystemRowLength( mesh, index, entity );
 }
@@ -120,23 +110,20 @@ template< typename MeshReal,
           typename Real,
           typename Index,
           typename NonlinearDiffusionOperator >
-template< typename MeshEntity,
-          typename MeshFunction,
-          typename Vector,           
-          typename Matrix >
+template< typename MeshEntity, typename MeshFunction, typename Vector, typename Matrix >
 __cuda_callable__
 void
 NonlinearDiffusion< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, NonlinearDiffusionOperator, Real, Index >::
-setMatrixElements( const RealType& time,
-                    const RealType& tau,
-                    const MeshType& mesh,
-                    const IndexType& index,
-                    const MeshEntity& entity,
-                    const MeshFunction& u,
-                    Vector& b,
-                    Matrix& matrix ) const
+   setMatrixElements( const RealType& time,
+                      const RealType& tau,
+                      const MeshType& mesh,
+                      const IndexType& index,
+                      const MeshEntity& entity,
+                      const MeshFunction& u,
+                      Vector& b,
+                      Matrix& matrix ) const
 {
-    nonlinearDiffusionOperator.setMatrixElements( time, tau, mesh, index, entity, u, b, matrix );
+   nonlinearDiffusionOperator.setMatrixElements( time, tau, mesh, index, entity, u, b, matrix );
 }
 
 template< typename MeshReal,
@@ -145,16 +132,15 @@ template< typename MeshReal,
           typename Real,
           typename Index,
           typename NonlinearDiffusionOperator >
-template< typename MeshEntity,
-          typename Vector >
+template< typename MeshEntity, typename Vector >
 __cuda_callable__
 Real
-NonlinearDiffusion< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, NonlinearDiffusionOperator, Real, Index >::
-operator()( const MeshEntity& entity,
-            const Vector& u,
-            const Real& time ) const
+NonlinearDiffusion< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, NonlinearDiffusionOperator, Real, Index >::operator()(
+   const MeshEntity& entity,
+   const Vector& u,
+   const Real& time ) const
 {
-    return nonlinearDiffusionOperator( u, entity, time );
+   return nonlinearDiffusionOperator( u, entity, time );
 }
 
 template< typename MeshReal,
@@ -163,13 +149,11 @@ template< typename MeshReal,
           typename Real,
           typename Index,
           typename NonlinearDiffusionOperator >
-   template< typename MeshEntity >
+template< typename MeshEntity >
 __cuda_callable__
 Index
 NonlinearDiffusion< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, NonlinearDiffusionOperator, Real, Index >::
-getLinearSystemRowLength( const MeshType& mesh,
-                          const IndexType& index,
-                          const MeshEntity& entity ) const
+   getLinearSystemRowLength( const MeshType& mesh, const IndexType& index, const MeshEntity& entity ) const
 {
    return nonlinearDiffusionOperator.getLinearSystemRowLength( mesh, index, entity );
 }
@@ -180,24 +164,21 @@ template< typename MeshReal,
           typename Real,
           typename Index,
           typename NonlinearDiffusionOperator >
-template< typename MeshEntity,
-          typename MeshFunction,
-          typename Vector,          
-          typename Matrix >
+template< typename MeshEntity, typename MeshFunction, typename Vector, typename Matrix >
 __cuda_callable__
 void
 NonlinearDiffusion< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, NonlinearDiffusionOperator, Real, Index >::
-setMatrixElements( const RealType& time,
-                    const RealType& tau,
-                    const MeshType& mesh,
-                    const IndexType& index,
-                    const MeshEntity& entity,
-                    const MeshFunction& u,
-                    Vector& b,
-                    Matrix& matrix ) const
+   setMatrixElements( const RealType& time,
+                      const RealType& tau,
+                      const MeshType& mesh,
+                      const IndexType& index,
+                      const MeshEntity& entity,
+                      const MeshFunction& u,
+                      Vector& b,
+                      Matrix& matrix ) const
 {
-    nonlinearDiffusionOperator.setMatrixElements( time, tau, mesh, index, entity, u, b, matrix );
+   nonlinearDiffusionOperator.setMatrixElements( time, tau, mesh, index, entity, u, b, matrix );
 }
 
-} // namespace Operators
-} // namespace TNL
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/diffusion/OneSidedMeanCurvature.h b/src/TNL/Operators/diffusion/OneSidedMeanCurvature.h
index 930c139331e35fbf669615c513b1d27db5a95a07..ec5a5de17df5edca170c34ad87fbf0c6777899a7 100644
--- a/src/TNL/Operators/diffusion/OneSidedMeanCurvature.h
+++ b/src/TNL/Operators/diffusion/OneSidedMeanCurvature.h
@@ -22,103 +22,104 @@
 #include <TNL/Operators/diffusion/ExactMeanCurvature.h>
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
 template< typename Mesh,
           typename Real = typename Mesh::RealType,
           typename Index = typename Mesh::GlobalIndexType,
           bool EvaluateNonlinearityOnFly = false >
 class OneSidedMeanCurvature
-   : public Operator< Mesh, Functions::MeshInteriorDomain, Mesh::getMeshDimension(), Mesh::getMeshDimension(), Real, Index >
+: public Operator< Mesh, Functions::MeshInteriorDomain, Mesh::getMeshDimension(), Mesh::getMeshDimension(), Real, Index >
 {
-   public:
- 
-      typedef Mesh MeshType;
-      typedef Pointers::SharedPointer<  MeshType > MeshPointer;
-      typedef Real RealType;
-      typedef Index IndexType;
-      typedef FDMGradientNorm< MeshType, ForwardFiniteDifference, RealType, IndexType > GradientNorm;
-      typedef FunctionInverseOperator< GradientNorm > NonlinearityOperator;
-      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::getMeshDimension(), RealType > ExactOperatorType;
-      
-      OneSidedMeanCurvature( const MeshPointer& meshPointer )
-      : nonlinearityOperator( gradientNorm ),
-        nonlinearity( nonlinearityOperator, nonlinearityBoundaryConditions, meshPointer ),
-        nonlinearDiffusion( nonlinearity ){}
- 
-      void setRegularizationEpsilon( const RealType& eps )
-      {
-         this->gradientNorm.setEps( eps );
-      }
- 
-      void setPreimageFunction( typename Nonlinearity::PreimageFunctionType& preimageFunction )
-      {
-         this->nonlinearity.setPreimageFunction( preimageFunction );
-      }
- 
-      bool refresh( const RealType& time = 0.0 )
-      {
-         return this->nonlinearity.refresh( time );
-      }
- 
-      bool deepRefresh( const RealType& time = 0.0 )
-      {
-         return this->nonlinearity.deepRefresh( time );
-      }
- 
-      template< typename MeshFunction,
-                typename MeshEntity >
-      __cuda_callable__
-      Real operator()( const MeshFunction& u,
-                       const MeshEntity& entity,
-                       const RealType& time = 0.0 ) const
-      {
-         return this->nonlinearDiffusion( u, entity, time );
-      }
-
-      template< typename MeshEntity >
-      __cuda_callable__
-      Index getLinearSystemRowLength( const MeshType& mesh,
-                                      const IndexType& index,
-                                      const MeshEntity& entity ) const
-      {
-         return this->nonlinearDiffusion.getLinearSystemRowLength( mesh, index, entity );
-      }
-
-      template< typename MeshEntity,
-                typename MeshFunction,
-                typename Vector,
-                typename Matrix >
-      __cuda_callable__
-      void setMatrixElements( const RealType& time,
-                               const RealType& tau,
-                               const MeshType& mesh,
-                               const IndexType& index,
-                               const MeshEntity& entity,
-                               const MeshFunction& u,
-                               Vector& b,
-                               Matrix& matrix ) const
-      {
-         this->nonlinearDiffusion.setMatrixElements( time, tau, mesh, index, entity, u, b, matrix );
-      }
- 
-   protected:
- 
-      NonlinearityBoundaryConditions nonlinearityBoundaryConditions;
- 
-      GradientNorm gradientNorm;
-
-      NonlinearityOperator nonlinearityOperator;
- 
-      Nonlinearity nonlinearity;
- 
-      NonlinearDiffusion nonlinearDiffusion;
+public:
+   typedef Mesh MeshType;
+   typedef Pointers::SharedPointer< MeshType > MeshPointer;
+   typedef Real RealType;
+   typedef Index IndexType;
+   typedef FDMGradientNorm< MeshType, ForwardFiniteDifference, RealType, IndexType > GradientNorm;
+   typedef FunctionInverseOperator< GradientNorm > NonlinearityOperator;
+   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::getMeshDimension(), RealType > ExactOperatorType;
+
+   OneSidedMeanCurvature( const MeshPointer& meshPointer )
+   : nonlinearityOperator( gradientNorm ), nonlinearity( nonlinearityOperator, nonlinearityBoundaryConditions, meshPointer ),
+     nonlinearDiffusion( nonlinearity )
+   {}
+
+   void
+   setRegularizationEpsilon( const RealType& eps )
+   {
+      this->gradientNorm.setEps( eps );
+   }
+
+   void
+   setPreimageFunction( typename Nonlinearity::PreimageFunctionType& preimageFunction )
+   {
+      this->nonlinearity.setPreimageFunction( preimageFunction );
+   }
+
+   bool
+   refresh( const RealType& time = 0.0 )
+   {
+      return this->nonlinearity.refresh( time );
+   }
+
+   bool
+   deepRefresh( const RealType& time = 0.0 )
+   {
+      return this->nonlinearity.deepRefresh( time );
+   }
+
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const RealType& time = 0.0 ) const
+   {
+      return this->nonlinearDiffusion( u, entity, time );
+   }
+
+   template< typename MeshEntity >
+   __cuda_callable__
+   Index
+   getLinearSystemRowLength( const MeshType& mesh, const IndexType& index, const MeshEntity& entity ) const
+   {
+      return this->nonlinearDiffusion.getLinearSystemRowLength( mesh, index, entity );
+   }
+
+   template< typename MeshEntity, typename MeshFunction, typename Vector, typename Matrix >
+   __cuda_callable__
+   void
+   setMatrixElements( const RealType& time,
+                      const RealType& tau,
+                      const MeshType& mesh,
+                      const IndexType& index,
+                      const MeshEntity& entity,
+                      const MeshFunction& u,
+                      Vector& b,
+                      Matrix& matrix ) const
+   {
+      this->nonlinearDiffusion.setMatrixElements( time, tau, mesh, index, entity, u, b, matrix );
+   }
+
+protected:
+   NonlinearityBoundaryConditions nonlinearityBoundaryConditions;
+
+   GradientNorm gradientNorm;
+
+   NonlinearityOperator nonlinearityOperator;
+
+   Nonlinearity nonlinearity;
+
+   NonlinearDiffusion nonlinearDiffusion;
 };
 
-} // namespace Operators
-} // namespace TNL
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/diffusion/OneSidedNonlinearDiffusion.h b/src/TNL/Operators/diffusion/OneSidedNonlinearDiffusion.h
index 66cbf383229a288541e031e6e4e1c6419edf42c1..674220f5b51c95c0ed066526337adb0620462b94 100644
--- a/src/TNL/Operators/diffusion/OneSidedNonlinearDiffusion.h
+++ b/src/TNL/Operators/diffusion/OneSidedNonlinearDiffusion.h
@@ -17,319 +17,276 @@
 #include <TNL/Operators/diffusion/ExactNonlinearDiffusion.h>
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
 template< typename Mesh,
           typename Nonlinearity,
           typename Real = typename Mesh::RealType,
           typename Index = typename Mesh::GlobalIndexType >
 class OneSidedNonlinearDiffusion
-{
-};
+{};
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Nonlinearity,
-          typename Real,
-          typename Index >
-class OneSidedNonlinearDiffusion< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Nonlinearity, Real, Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Nonlinearity, typename Real, typename Index >
+class OneSidedNonlinearDiffusion< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Nonlinearity, Real, Index >
 {
-   public:
- 
-      typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
-      typedef typename MeshType::CoordinatesType CoordinatesType;
-      typedef Real RealType;
-      typedef Device DeviceType;
-      typedef Index IndexType;
-      typedef Nonlinearity NonlinearityType;
-      typedef typename MeshType::template MeshEntity< MeshType::getMeshDimension() > CellType;
-      typedef ExactNonlinearDiffusion< MeshType::getMeshDimension(), typename Nonlinearity::ExactOperatorType, Real > ExactOperatorType;
+public:
+   typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
+   typedef typename MeshType::CoordinatesType CoordinatesType;
+   typedef Real RealType;
+   typedef Device DeviceType;
+   typedef Index IndexType;
+   typedef Nonlinearity NonlinearityType;
+   typedef typename MeshType::template MeshEntity< MeshType::getMeshDimension() > CellType;
+   typedef ExactNonlinearDiffusion< MeshType::getMeshDimension(), typename Nonlinearity::ExactOperatorType, Real >
+      ExactOperatorType;
 
-      OneSidedNonlinearDiffusion( const Nonlinearity& nonlinearity )
-      : nonlinearity( nonlinearity ){}
+   OneSidedNonlinearDiffusion( const Nonlinearity& nonlinearity ) : nonlinearity( nonlinearity ) {}
 
-      template< typename MeshFunction,
-                typename MeshEntity >
-      __cuda_callable__
-      Real operator()( const MeshFunction& u,
-                       const MeshEntity& entity,
-                       const RealType& time = 0.0 ) const
-      {
-         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 = 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 ] );
-         return ( u_x_f * this->nonlinearity[ center ] -
-                  u_x_b * this->nonlinearity[ west ] ) * hx_div;
- 
-      }
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const RealType& time = 0.0 ) const
+   {
+      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 = 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 ] );
+      return ( u_x_f * this->nonlinearity[ center ] - u_x_b * this->nonlinearity[ west ] ) * hx_div;
+   }
 
-      template< typename MeshEntity >
-      __cuda_callable__
-      Index getLinearSystemRowLength( const MeshType& mesh,
-                                      const IndexType& index,
-                                      const MeshEntity& entity ) const
-      {
-         return 3;
-      }
+   template< typename MeshEntity >
+   __cuda_callable__
+   Index
+   getLinearSystemRowLength( const MeshType& mesh, const IndexType& index, const MeshEntity& entity ) const
+   {
+      return 3;
+   }
 
-      template< typename PreimageFunction,
-                typename MeshEntity,
-                typename Matrix,
-                typename Vector >
-      __cuda_callable__
-      inline void setMatrixElements( const PreimageFunction& u,
-                                     const MeshEntity& entity,
-                                     const RealType& time,
-                                     const RealType& tau,
-                                     Matrix& matrix,
-                                     Vector& b ) const
-      {
-         typename Matrix::MatrixRow matrixRow = matrix.getRow( index );
-         const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities();
-         const IndexType& center = entity.getIndex();
-         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 ];
-         const RealType aCoef = -lambda_x * nonlinearity_west;
-         const RealType bCoef = lambda_x * ( nonlinearity_center + nonlinearity_west );
-         const RealType cCoef = -lambda_x * nonlinearity_center;
-         matrixRow.setElement( 0, west,   aCoef );
-         matrixRow.setElement( 1, center, bCoef );
-         matrixRow.setElement( 2, east,   cCoef );
-      }
+   template< typename PreimageFunction, typename MeshEntity, typename Matrix, typename Vector >
+   __cuda_callable__
+   inline void
+   setMatrixElements( const PreimageFunction& u,
+                      const MeshEntity& entity,
+                      const RealType& time,
+                      const RealType& tau,
+                      Matrix& matrix,
+                      Vector& b ) const
+   {
+      typename Matrix::MatrixRow matrixRow = matrix.getRow( index );
+      const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities();
+      const IndexType& center = entity.getIndex();
+      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 ];
+      const RealType aCoef = -lambda_x * nonlinearity_west;
+      const RealType bCoef = lambda_x * ( nonlinearity_center + nonlinearity_west );
+      const RealType cCoef = -lambda_x * nonlinearity_center;
+      matrixRow.setElement( 0, west, aCoef );
+      matrixRow.setElement( 1, center, bCoef );
+      matrixRow.setElement( 2, east, cCoef );
+   }
 
-   public:
- 
-      const Nonlinearity& nonlinearity;
+public:
+   const Nonlinearity& nonlinearity;
 };
 
-
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Nonlinearity,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Nonlinearity, typename Real, typename Index >
 class OneSidedNonlinearDiffusion< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Nonlinearity, Real, Index >
 {
-   public:
- 
-      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
-      typedef typename MeshType::CoordinatesType CoordinatesType;
-      typedef Real RealType;
-      typedef Device DeviceType;
-      typedef Index IndexType;
-      typedef Nonlinearity NonlinearityType;
-      typedef ExactNonlinearDiffusion< MeshType::getMeshDimension(), typename Nonlinearity::ExactOperatorType, Real > ExactOperatorType;
+public:
+   typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+   typedef typename MeshType::CoordinatesType CoordinatesType;
+   typedef Real RealType;
+   typedef Device DeviceType;
+   typedef Index IndexType;
+   typedef Nonlinearity NonlinearityType;
+   typedef ExactNonlinearDiffusion< MeshType::getMeshDimension(), typename Nonlinearity::ExactOperatorType, Real >
+      ExactOperatorType;
 
-      OneSidedNonlinearDiffusion( const Nonlinearity& nonlinearity )
-      : nonlinearity( nonlinearity ){}
+   OneSidedNonlinearDiffusion( const Nonlinearity& nonlinearity ) : nonlinearity( nonlinearity ) {}
 
-      template< typename MeshFunction,
-                typename MeshEntity >
-      __cuda_callable__
-      Real operator()( const MeshFunction& u,
-                       const MeshEntity& entity,
-                       const RealType& time = 0.0 ) const
-      {
-         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 = 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 ] );
-         const RealType u_y_f = ( u[ north ] - u_c );
-         const RealType u_y_b = ( u_c - u[ south ] );
- 
-         const RealType& nonlinearity_center = this->nonlinearity[ center ];
-         return ( u_x_f * nonlinearity_center - u_x_b * this->nonlinearity[ west ] ) * hx_div +
-                ( u_y_f * nonlinearity_center - u_y_b * this->nonlinearity[ south ] ) * hy_div;
-      }
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const RealType& time = 0.0 ) const
+   {
+      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 = 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 ] );
+      const RealType u_y_f = ( u[ north ] - u_c );
+      const RealType u_y_b = ( u_c - u[ south ] );
 
-      template< typename MeshEntity >
-      __cuda_callable__
-      Index getLinearSystemRowLength( const MeshType& mesh,
-                                      const IndexType& index,
-                                      const MeshEntity& entity ) const
-      {
-         return 5;
-      }
+      const RealType& nonlinearity_center = this->nonlinearity[ center ];
+      return ( u_x_f * nonlinearity_center - u_x_b * this->nonlinearity[ west ] ) * hx_div
+           + ( u_y_f * nonlinearity_center - u_y_b * this->nonlinearity[ south ] ) * hy_div;
+   }
 
-      template< typename PreimageFunction,
-                typename MeshEntity,
-                typename Matrix,
-                typename Vector >
-      __cuda_callable__
-      inline void setMatrixElements( const PreimageFunction& u,
-                                     const MeshEntity& entity,
-                                     const RealType& time,
-                                     const RealType& tau,
-                                     Matrix& matrix,
-                                     Vector& b ) const
-      {
-         typename Matrix::MatrixRow matrixRow = matrix.getRow( index );
-         const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities();
-         const IndexType& center = entity.getIndex();
-         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 ];
-         const RealType& nonlinearity_west = this->nonlinearity[ west ];
-         const RealType& nonlinearity_south = this->nonlinearity[ south ];
-         const RealType aCoef = -lambda_y * nonlinearity_south;
-         const RealType bCoef = -lambda_x * nonlinearity_west;
-         const RealType cCoef = lambda_x * ( nonlinearity_center + nonlinearity_west ) +
-                                lambda_y * ( nonlinearity_center + nonlinearity_south );
-         const RealType dCoef = -lambda_x * nonlinearity_center;
-         const RealType eCoef = -lambda_y * nonlinearity_center;
-         matrixRow.setElement( 0, south,  aCoef );
-         matrixRow.setElement( 1, west,   bCoef );
-         matrixRow.setElement( 2, center, cCoef );
-         matrixRow.setElement( 3, east,   dCoef );
-         matrixRow.setElement( 4, north,  eCoef );
-      }
- 
-   public:
- 
-      const Nonlinearity& nonlinearity;
-};
+   template< typename MeshEntity >
+   __cuda_callable__
+   Index
+   getLinearSystemRowLength( const MeshType& mesh, const IndexType& index, const MeshEntity& entity ) const
+   {
+      return 5;
+   }
 
+   template< typename PreimageFunction, typename MeshEntity, typename Matrix, typename Vector >
+   __cuda_callable__
+   inline void
+   setMatrixElements( const PreimageFunction& u,
+                      const MeshEntity& entity,
+                      const RealType& time,
+                      const RealType& tau,
+                      Matrix& matrix,
+                      Vector& b ) const
+   {
+      typename Matrix::MatrixRow matrixRow = matrix.getRow( index );
+      const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities();
+      const IndexType& center = entity.getIndex();
+      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 ];
+      const RealType& nonlinearity_west = this->nonlinearity[ west ];
+      const RealType& nonlinearity_south = this->nonlinearity[ south ];
+      const RealType aCoef = -lambda_y * nonlinearity_south;
+      const RealType bCoef = -lambda_x * nonlinearity_west;
+      const RealType cCoef =
+         lambda_x * ( nonlinearity_center + nonlinearity_west ) + lambda_y * ( nonlinearity_center + nonlinearity_south );
+      const RealType dCoef = -lambda_x * nonlinearity_center;
+      const RealType eCoef = -lambda_y * nonlinearity_center;
+      matrixRow.setElement( 0, south, aCoef );
+      matrixRow.setElement( 1, west, bCoef );
+      matrixRow.setElement( 2, center, cCoef );
+      matrixRow.setElement( 3, east, dCoef );
+      matrixRow.setElement( 4, north, eCoef );
+   }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Nonlinearity,
-          typename Real,
-          typename Index >
+public:
+   const Nonlinearity& nonlinearity;
+};
+
+template< typename MeshReal, typename Device, typename MeshIndex, typename Nonlinearity, typename Real, typename Index >
 class OneSidedNonlinearDiffusion< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Nonlinearity, Real, Index >
 {
-   public:
- 
-      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
-      typedef typename MeshType::CoordinatesType CoordinatesType;
-      typedef Real RealType;
-      typedef Device DeviceType;
-      typedef Index IndexType;
-      typedef Nonlinearity NonlinearityType;
-      typedef ExactNonlinearDiffusion< MeshType::getMeshDimension(), typename Nonlinearity::ExactOperatorType, Real > ExactOperatorType;
+public:
+   typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+   typedef typename MeshType::CoordinatesType CoordinatesType;
+   typedef Real RealType;
+   typedef Device DeviceType;
+   typedef Index IndexType;
+   typedef Nonlinearity NonlinearityType;
+   typedef ExactNonlinearDiffusion< MeshType::getMeshDimension(), typename Nonlinearity::ExactOperatorType, Real >
+      ExactOperatorType;
+
+   OneSidedNonlinearDiffusion( const Nonlinearity& nonlinearity ) : nonlinearity( nonlinearity ) {}
+
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const RealType& time = 0.0 ) const
+   {
+      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 = 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 );
+      const RealType u_x_b = ( u_c - u[ west ] );
+      const RealType u_y_f = ( u[ north ] - u_c );
+      const RealType u_y_b = ( u_c - u[ south ] );
+      const RealType u_z_f = ( u[ up ] - u_c );
+      const RealType u_z_b = ( u_c - u[ down ] );
+
+      const RealType& nonlinearity_center = this->nonlinearity[ center ];
+      return ( u_x_f * nonlinearity_center - u_x_b * this->nonlinearity[ west ] ) * hx_div
+           + ( u_y_f * nonlinearity_center - u_y_b * this->nonlinearity[ south ] ) * hx_div
+           + ( u_z_f * nonlinearity_center - u_z_b * this->nonlinearity[ down ] ) * hz_div;
+   }
 
-      OneSidedNonlinearDiffusion( const Nonlinearity& nonlinearity )
-      : nonlinearity( nonlinearity ){}
+   template< typename MeshEntity >
+   __cuda_callable__
+   Index
+   getLinearSystemRowLength( const MeshType& mesh, const IndexType& index, const MeshEntity& entity ) const
+   {
+      return 7;
+   }
 
-      template< typename MeshFunction,
-                typename MeshEntity >
-      __cuda_callable__
-      Real operator()( const MeshFunction& u,
-                       const MeshEntity& entity,
-                       const RealType& time = 0.0 ) const
-      {
-         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  = 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 );
-         const RealType u_x_b = ( u_c - u[ west ] );
-         const RealType u_y_f = ( u[ north ] - u_c );
-         const RealType u_y_b = ( u_c - u[ south ] );
-         const RealType u_z_f = ( u[ up ] - u_c );
-         const RealType u_z_b = ( u_c - u[ down ] );
- 
-         const RealType& nonlinearity_center = this->nonlinearity[ center ];
-         return ( u_x_f * nonlinearity_center - u_x_b * this->nonlinearity[ west ] ) * hx_div +
-                ( u_y_f * nonlinearity_center - u_y_b * this->nonlinearity[ south ] ) * hx_div +
-                ( u_z_f * nonlinearity_center - u_z_b * this->nonlinearity[ down ] ) * hz_div;
- 
-      }
+   template< typename PreimageFunction, typename MeshEntity, typename Matrix, typename Vector >
+   __cuda_callable__
+   inline void
+   setMatrixElements( const PreimageFunction& u,
+                      const MeshEntity& entity,
+                      const RealType& time,
+                      const RealType& tau,
+                      Matrix& matrix,
+                      Vector& b ) const
+   {
+      typename Matrix::MatrixRow matrixRow = matrix.getRow( index );
+      const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities();
+      const IndexType& center = entity.getIndex();
+      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 >();
 
-      template< typename MeshEntity >
-      __cuda_callable__
-      Index getLinearSystemRowLength( const MeshType& mesh,
-                                      const IndexType& index,
-                                      const MeshEntity& entity ) const
-      {
-         return 7;
-      }
+      const RealType lambda_x = tau * entity.getMesh().template getSpaceStepsProducts< -2, 0, 0 >();
+      const RealType lambda_y = tau * entity.getMesh().template getSpaceStepsProducts< 0, -2, 0 >();
+      const RealType lambda_z = tau * entity.getMesh().template getSpaceStepsProducts< 0, 0, -2 >();
+      const RealType& nonlinearity_center = this->nonlinearity[ center ];
+      const RealType& nonlinearity_west = this->nonlinearity[ west ];
+      const RealType& nonlinearity_south = this->nonlinearity[ south ];
+      const RealType& nonlinearity_down = this->nonlinearity[ down ];
+      const RealType aCoef = -lambda_z * nonlinearity_down;
+      const RealType bCoef = -lambda_y * nonlinearity_south;
+      const RealType cCoef = -lambda_x * nonlinearity_west;
+      const RealType dCoef = lambda_x * ( nonlinearity_center + nonlinearity_west )
+                           + lambda_y * ( nonlinearity_center + nonlinearity_south )
+                           + lambda_z * ( nonlinearity_center + nonlinearity_down );
+      const RealType eCoef = -lambda_x * nonlinearity_center;
+      const RealType fCoef = -lambda_y * nonlinearity_center;
+      const RealType gCoef = -lambda_z * nonlinearity_center;
+      matrixRow.setElement( 0, down, aCoef );
+      matrixRow.setElement( 1, south, bCoef );
+      matrixRow.setElement( 2, west, cCoef );
+      matrixRow.setElement( 3, center, dCoef );
+      matrixRow.setElement( 4, east, eCoef );
+      matrixRow.setElement( 5, north, fCoef );
+      matrixRow.setElement( 5, up, gCoef );
+   }
 
-      template< typename PreimageFunction,
-                typename MeshEntity,
-                typename Matrix,
-                typename Vector >
-      __cuda_callable__
-      inline void setMatrixElements( const PreimageFunction& u,
-                                     const MeshEntity& entity,
-                                     const RealType& time,
-                                     const RealType& tau,
-                                     Matrix& matrix,
-                                     Vector& b ) const
-      {
-         typename Matrix::MatrixRow matrixRow = matrix.getRow( index );
-         const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities();
-         const IndexType& center = entity.getIndex();
-         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 >();
-         const RealType lambda_y = tau * entity.getMesh().template getSpaceStepsProducts<  0, -2,  0 >();
-         const RealType lambda_z = tau * entity.getMesh().template getSpaceStepsProducts<  0,  0, -2 >();
-         const RealType& nonlinearity_center = this->nonlinearity[ center ];
-         const RealType& nonlinearity_west   = this->nonlinearity[ west ];
-         const RealType& nonlinearity_south  = this->nonlinearity[ south ];
-         const RealType& nonlinearity_down   = this->nonlinearity[ down ];
-         const RealType aCoef = -lambda_z * nonlinearity_down;
-         const RealType bCoef = -lambda_y * nonlinearity_south;
-         const RealType cCoef = -lambda_x * nonlinearity_west;
-         const RealType dCoef = lambda_x * ( nonlinearity_center + nonlinearity_west ) +
-                                lambda_y * ( nonlinearity_center + nonlinearity_south ) +
-                                lambda_z * ( nonlinearity_center + nonlinearity_down );
-         const RealType eCoef = -lambda_x * nonlinearity_center;
-         const RealType fCoef = -lambda_y * nonlinearity_center;
-         const RealType gCoef = -lambda_z * nonlinearity_center;
-         matrixRow.setElement( 0, down,   aCoef );
-         matrixRow.setElement( 1, south,  bCoef );
-         matrixRow.setElement( 2, west,   cCoef );
-         matrixRow.setElement( 3, center, dCoef );
-         matrixRow.setElement( 4, east,   eCoef );
-         matrixRow.setElement( 5, north,  fCoef );
-         matrixRow.setElement( 5, up,     gCoef );
-      }
- 
-   public:
- 
-      const Nonlinearity& nonlinearity;
+public:
+   const Nonlinearity& nonlinearity;
 };
 
-} // namespace Operators
-} // namespace TNL
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/euler/fvm/LaxFridrichs.h b/src/TNL/Operators/euler/fvm/LaxFridrichs.h
index f3f1f4fdd6de3f1f674f3935a72460ef724aa5a1..348f473d6ea2cbd5770cf9b905ae6410ad9b4f3a 100644
--- a/src/TNL/Operators/euler/fvm/LaxFridrichs.h
+++ b/src/TNL/Operators/euler/fvm/LaxFridrichs.h
@@ -12,72 +12,80 @@
 #include <TNL/Operators/gradient/tnlCentralFDMGradient.h>
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
-template< typename Mesh,
-          typename PressureGradient = tnlCentralFDMGradient< Mesh > >
+template< typename Mesh, typename PressureGradient = tnlCentralFDMGradient< Mesh > >
 class LaxFridrichs
-{
-};
+{};
 
 template< typename Real,
           typename Device,
           typename Index,
           typename PressureGradient,
-          template< int, typename, typename, typename > class GridGeometry >
+          template< int, typename, typename, typename >
+          class GridGeometry >
 class LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient >
 {
-   public:
-
+public:
    typedef Meshes::Grid< 2, Real, Device, Index, GridGeometry > MeshType;
    typedef Real RealType;
    typedef Device DeviceType;
    typedef Index IndexType;
-   typedef typename MeshType :: PointType PointType;
-   typedef typename MeshType :: CoordinatesType CoordinatesType;
+   typedef typename MeshType ::PointType PointType;
+   typedef typename MeshType ::CoordinatesType CoordinatesType;
 
    LaxFridrichs();
 
-   void getExplicitUpdate( const IndexType centralVolume,
-                        RealType& rho_t,
-                        RealType& rho_u1_t,
-                        RealType& rho_u2_t,
-                        const RealType& tau ) const;
+   void
+   getExplicitUpdate( const IndexType centralVolume,
+                      RealType& rho_t,
+                      RealType& rho_u1_t,
+                      RealType& rho_u2_t,
+                      const RealType& tau ) const;
 
-   void getExplicitUpdate( const IndexType centralVolume,
-                        RealType& rho_t,
-                        RealType& rho_u1_t,
-                        RealType& rho_u2_t,
-                        RealType& e_t,
-                        const RealType& tau ) const;
+   void
+   getExplicitUpdate( const IndexType centralVolume,
+                      RealType& rho_t,
+                      RealType& rho_u1_t,
+                      RealType& rho_u2_t,
+                      RealType& e_t,
+                      const RealType& tau ) const;
 
-   void setRegularization( const RealType& epsilon );
+   void
+   setRegularization( const RealType& epsilon );
 
-   void setViscosityCoefficient( const RealType& v );
+   void
+   setViscosityCoefficient( const RealType& v );
 
-   void bindMesh( const MeshType& mesh );
+   void
+   bindMesh( const MeshType& mesh );
 
-   const MeshType& getMesh() const;
+   const MeshType&
+   getMesh() const;
 
    template< typename Vector >
-   void setRho( Vector& rho ); // TODO: add const
+   void
+   setRho( Vector& rho );  // TODO: add const
 
    template< typename Vector >
-   void setRhoU1( Vector& rho_u1 ); // TODO: add const
+   void
+   setRhoU1( Vector& rho_u1 );  // TODO: add const
 
    template< typename Vector >
-   void setRhoU2( Vector& rho_u2 ); // TODO: add const
+   void
+   setRhoU2( Vector& rho_u2 );  // TODO: add const
 
    template< typename Vector >
-   void setE( Vector& e ); // TODO: add const
-
+   void
+   setE( Vector& e );  // TODO: add const
 
    template< typename Vector >
-   void setPressureGradient( Vector& grad_p ); // TODO: add const
-
-   protected:
+   void
+   setPressureGradient( Vector& grad_p );  // TODO: add const
 
-   RealType regularize( const RealType& r ) const;
+protected:
+   RealType
+   regularize( const RealType& r ) const;
 
    RealType regularizeEps, viscosityCoefficient;
 
@@ -88,65 +96,70 @@ class LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, Pressu
    SharedVector< RealType, DeviceType, IndexType > rho, rho_u1, rho_u2, e;
 };
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename PressureGradient >
+template< typename Real, typename Device, typename Index, typename PressureGradient >
 class LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient >
 {
-   public:
-
+public:
    typedef Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry > MeshType;
    typedef Real RealType;
    typedef Device DeviceType;
    typedef Index IndexType;
-   typedef typename MeshType :: PointType PointType;
-   typedef typename MeshType :: CoordinatesType CoordinatesType;
+   typedef typename MeshType ::PointType PointType;
+   typedef typename MeshType ::CoordinatesType CoordinatesType;
 
    LaxFridrichs();
 
-   void getExplicitUpdate( const IndexType centralVolume,
-                        RealType& rho_t,
-                        RealType& rho_u1_t,
-                        RealType& rho_u2_t,
-                        const RealType& tau ) const;
+   void
+   getExplicitUpdate( const IndexType centralVolume,
+                      RealType& rho_t,
+                      RealType& rho_u1_t,
+                      RealType& rho_u2_t,
+                      const RealType& tau ) const;
 
-   void getExplicitUpdate( const IndexType centralVolume,
-                        RealType& rho_t,
-                        RealType& rho_u1_t,
-                        RealType& rho_u2_t,
-                        RealType& e_t,
-                        const RealType& tau ) const;
+   void
+   getExplicitUpdate( const IndexType centralVolume,
+                      RealType& rho_t,
+                      RealType& rho_u1_t,
+                      RealType& rho_u2_t,
+                      RealType& e_t,
+                      const RealType& tau ) const;
 
-   void setRegularization( const RealType& epsilon );
+   void
+   setRegularization( const RealType& epsilon );
 
-   void setViscosityCoefficient( const RealType& v );
+   void
+   setViscosityCoefficient( const RealType& v );
 
-   void bindMesh( const MeshType& mesh );
+   void
+   bindMesh( const MeshType& mesh );
 
    template< typename Vector >
-   void setRho( Vector& rho ); // TODO: add const
+   void
+   setRho( Vector& rho );  // TODO: add const
 
    template< typename Vector >
-   void setRhoU1( Vector& rho_u1 ); // TODO: add const
+   void
+   setRhoU1( Vector& rho_u1 );  // TODO: add const
 
    template< typename Vector >
-   void setRhoU2( Vector& rho_u2 ); // TODO: add const
+   void
+   setRhoU2( Vector& rho_u2 );  // TODO: add const
 
    template< typename Vector >
-   void setE( Vector& e ); // TODO: add const
+   void
+   setE( Vector& e );  // TODO: add const
 
    template< typename Vector >
-   void setP( Vector& p ); // TODO: add const
-
-
+   void
+   setP( Vector& p );  // TODO: add const
 
    template< typename Vector >
-   void setPressureGradient( Vector& grad_p ); // TODO: add const
-
-   protected:
+   void
+   setPressureGradient( Vector& grad_p );  // TODO: add const
 
-   RealType regularize( const RealType& r ) const;
+protected:
+   RealType
+   regularize( const RealType& r ) const;
 
    RealType regularizeEps, viscosityCoefficient;
 
@@ -157,7 +170,7 @@ class LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeomet
    SharedVector< RealType, DeviceType, IndexType > rho, rho_u1, rho_u2, energy, p;
 };
 
-} // namespace Operators
-} // namespace TNL
+}  // namespace Operators
+}  // namespace TNL
 
 #include <TNL/implementation/operators/euler/fvm/LaxFridrichs_impl.h>
diff --git a/src/TNL/Operators/euler/fvm/LaxFridrichs_impl.h b/src/TNL/Operators/euler/fvm/LaxFridrichs_impl.h
index 602ee16a7ea0d2af94dd960ccc31fa6da5efdb48..a6ff612618cec5cd82d79d6cf413ca1fb7304c9f 100644
--- a/src/TNL/Operators/euler/fvm/LaxFridrichs_impl.h
+++ b/src/TNL/Operators/euler/fvm/LaxFridrichs_impl.h
@@ -7,28 +7,26 @@
 #pragma once
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
 template< typename Real,
           typename Device,
           typename Index,
           typename PressureGradient,
-          template< int, typename, typename, typename > class GridGeometry >
-LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >,
-                 PressureGradient > :: LaxFridrichs()
-: regularizeEps( 0.0 ),
-  viscosityCoefficient( 1.0 ),
-  mesh( 0 ),
-  pressureGradient( 0 )
-{
-}
+          template< int, typename, typename, typename >
+          class GridGeometry >
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient >::LaxFridrichs()
+: regularizeEps( 0.0 ), viscosityCoefficient( 1.0 ), mesh( 0 ), pressureGradient( 0 )
+{}
 
 template< typename Real,
           typename Device,
           typename Index,
           typename PressureGradient,
-          template< int, typename, typename, typename > class GridGeometry >
-void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient  >::bindMesh( const MeshType& mesh )
+          template< int, typename, typename, typename >
+          class GridGeometry >
+void
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient >::bindMesh( const MeshType& mesh )
 {
    this->mesh = &mesh;
 }
@@ -37,19 +35,23 @@ template< typename Real,
           typename Device,
           typename Index,
           typename PressureGradient,
-          template< int, typename, typename, typename > class GridGeometry >
-const typename LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient  >::MeshType&
-   LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient  >::getMesh() const
+          template< int, typename, typename, typename >
+          class GridGeometry >
+const typename LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient >::MeshType&
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient >::getMesh() const
 {
-   return * this->mesh;
+   return *this->mesh;
 }
 
 template< typename Real,
           typename Device,
           typename Index,
           typename PressureGradient,
-          template< int, typename, typename, typename > class GridGeometry >
-void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient  > :: setRegularization( const RealType& epsilon )
+          template< int, typename, typename, typename >
+          class GridGeometry >
+void
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient >::setRegularization(
+   const RealType& epsilon )
 {
    this->regularizeEps = epsilon;
 }
@@ -58,8 +60,11 @@ template< typename Real,
           typename Device,
           typename Index,
           typename PressureGradient,
-          template< int, typename, typename, typename > class GridGeometry >
-void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient  > :: setViscosityCoefficient( const RealType& v )
+          template< int, typename, typename, typename >
+          class GridGeometry >
+void
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient >::setViscosityCoefficient(
+   const RealType& v )
 {
    this->viscosityCoefficient = v;
 }
@@ -68,9 +73,11 @@ template< typename Real,
           typename Device,
           typename Index,
           typename PressureGradient,
-          template< int, typename, typename, typename > class GridGeometry >
-   template< typename Vector >
-void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient  > :: setRho( Vector& rho )
+          template< int, typename, typename, typename >
+          class GridGeometry >
+template< typename Vector >
+void
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient >::setRho( Vector& rho )
 {
    this->rho.bind( rho );
 }
@@ -79,31 +86,37 @@ template< typename Real,
           typename Device,
           typename Index,
           typename PressureGradient,
-          template< int, typename, typename, typename > class GridGeometry >
-   template< typename Vector >
-void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient  > :: setRhoU1( Vector& rho_u1 )
+          template< int, typename, typename, typename >
+          class GridGeometry >
+template< typename Vector >
+void
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient >::setRhoU1( Vector& rho_u1 )
 {
-   this->rho_u1. bind( rho_u1 );
+   this->rho_u1.bind( rho_u1 );
 }
 
 template< typename Real,
           typename Device,
           typename Index,
           typename PressureGradient,
-          template< int, typename, typename, typename > class GridGeometry >
-   template< typename Vector >
-void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient  > :: setRhoU2( Vector& rho_u2 )
+          template< int, typename, typename, typename >
+          class GridGeometry >
+template< typename Vector >
+void
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient >::setRhoU2( Vector& rho_u2 )
 {
-   this->rho_u2. bind( rho_u2 );
+   this->rho_u2.bind( rho_u2 );
 }
 
 template< typename Real,
           typename Device,
           typename Index,
           typename PressureGradient,
-          template< int, typename, typename, typename > class GridGeometry >
-   template< typename Vector >
-void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient  > :: setE( Vector& e )
+          template< int, typename, typename, typename >
+          class GridGeometry >
+template< typename Vector >
+void
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient >::setE( Vector& e )
 {
    this->e.bind( e );
 }
@@ -112,9 +125,11 @@ template< typename Real,
           typename Device,
           typename Index,
           typename PressureGradient,
-          template< int, typename, typename, typename > class GridGeometry >
-   template< typename Vector >
-void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient  > :: setPressureGradient( Vector& grad_p )
+          template< int, typename, typename, typename >
+          class GridGeometry >
+template< typename Vector >
+void
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient >::setPressureGradient( Vector& grad_p )
 {
    this->pressureGradient = &grad_p;
 }
@@ -123,21 +138,24 @@ template< typename Real,
           typename Device,
           typename Index,
           typename PressureGradient,
-          template< int, typename, typename, typename > class GridGeometry >
-void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient  > :: getExplicitUpdate( const IndexType centralVolume,
-                                                                                                              RealType& rho_t,
-                                                                                                              RealType& rho_u1_t,
-                                                                                                              RealType& rho_u2_t,
-                                                                                                              const RealType& tau ) const
+          template< int, typename, typename, typename >
+          class GridGeometry >
+void
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient >::getExplicitUpdate(
+   const IndexType centralVolume,
+   RealType& rho_t,
+   RealType& rho_u1_t,
+   RealType& rho_u2_t,
+   const RealType& tau ) const
 {
    TNL_ASSERT_TRUE( mesh, "No mesh has been binded with the Lax-Fridrichs scheme." );
    TNL_ASSERT_TRUE( pressureGradient, "No pressure gradient was set in the the Lax-Fridrichs scheme." )
 
    const IndexType& c = centralVolume;
-   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 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 ] );
@@ -154,30 +172,30 @@ void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, Pressur
     * 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 );
+   this->mesh->getElementCoordinates( c, c_coordinates );
    e_coordinates = n_coordinates = w_coordinates = s_coordinates = c_coordinates;
-   e_coordinates. x() ++;
-   w_coordinates. x() --;
-   n_coordinates. y() ++;
-   s_coordinates. y() --;
+   e_coordinates.x()++;
+   w_coordinates.x()--;
+   n_coordinates.y()++;
+   s_coordinates.y()--;
 
    /****
     * Get the volumes measure
     */
-   const RealType mu_D_c = this->mesh -> getElementMeasure( c_coordinates );
-   const RealType mu_D_e = this->mesh -> getElementMeasure( e_coordinates );
-   const RealType mu_D_n = this->mesh -> getElementMeasure( n_coordinates );
-   const RealType mu_D_w = this->mesh -> getElementMeasure( w_coordinates );
-   const RealType mu_D_s = this->mesh -> getElementMeasure( s_coordinates );
+   const RealType mu_D_c = this->mesh->getElementMeasure( c_coordinates );
+   const RealType mu_D_e = this->mesh->getElementMeasure( e_coordinates );
+   const RealType mu_D_n = this->mesh->getElementMeasure( n_coordinates );
+   const RealType mu_D_w = this->mesh->getElementMeasure( w_coordinates );
+   const RealType mu_D_s = this->mesh->getElementMeasure( s_coordinates );
 
    /****
     * Get the edge normals
     */
    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 );
-   this->mesh -> template getEdgeNormal<  0, -1 >( c_coordinates, 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 );
+   this->mesh->template getEdgeNormal< 0, -1 >( c_coordinates, s_normal );
 
    /****
     * Compute the fluxes
@@ -213,56 +231,51 @@ void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, Pressur
     * Compute the pressure gradient
     */
    PointType grad_p;
-   pressureGradient -> getGradient( c, grad_p );
+   pressureGradient->getGradient( c, grad_p );
 
    /****
     * rho_t + ( rho u_1 )_x + ( rho u_2 )_y =  0
     */
-   rho_t = - 1.0 / mu_D_c * ( rho_f_e * e_normal. x() + rho_g_e * e_normal. y() +
-                              rho_f_n * n_normal. x() + rho_g_n * n_normal. y() +
-                              rho_f_w * w_normal. x() + rho_g_w * w_normal. y() +
-                              rho_f_s * s_normal. x() + rho_g_s * s_normal. y() )
-           + this->viscosityCoefficient * 1.0 / ( 8.0 * tau ) * mu_D_c *
-                            ( ( mu_D_c + mu_D_e ) * ( rho[ e ] - rho[ c ] ) +
-                              ( mu_D_c + mu_D_n ) * ( rho[ n ] - rho[ c ] ) +
-                              ( mu_D_c + mu_D_w ) * ( rho[ w ] - rho[ c ] ) +
-                              ( mu_D_c + mu_D_s ) * ( rho[ s ] - rho[ c ] ) );
+   rho_t = -1.0 / mu_D_c
+            * ( rho_f_e * e_normal.x() + rho_g_e * e_normal.y() + rho_f_n * n_normal.x() + rho_g_n * n_normal.y()
+                + rho_f_w * w_normal.x() + rho_g_w * w_normal.y() + rho_f_s * s_normal.x() + rho_g_s * s_normal.y() )
+         + this->viscosityCoefficient * 1.0 / ( 8.0 * tau ) * mu_D_c
+              * ( ( mu_D_c + mu_D_e ) * ( rho[ e ] - rho[ c ] ) + ( mu_D_c + mu_D_n ) * ( rho[ n ] - rho[ c ] )
+                  + ( mu_D_c + mu_D_w ) * ( rho[ w ] - rho[ c ] ) + ( mu_D_c + mu_D_s ) * ( rho[ s ] - rho[ c ] ) );
 
    /****
     * ( rho * u1 )_t + ( rho * u1 * u1 )_x + ( rho * u1 * u2 )_y - p_x =  0
     */
-   rho_u1_t = - 1.0 / mu_D_c * ( rho_u1_f_e * e_normal. x() + rho_u1_g_e * e_normal. y() +
-                                 rho_u1_f_n * n_normal. x() + rho_u1_g_n * n_normal. y() +
-                                 rho_u1_f_w * w_normal. x() + rho_u1_g_w * w_normal. y() +
-                                 rho_u1_f_s * s_normal. x() + rho_u1_g_s * s_normal. y() )
-              + this->viscosityCoefficient * 1.0 / ( 8.0 * tau ) * mu_D_c *
-                               ( ( mu_D_c + mu_D_e ) * ( rho_u1[ e ] - rho_u1[ c ] ) +
-                                 ( mu_D_c + mu_D_n ) * ( rho_u1[ n ] - rho_u1[ c ] ) +
-                                 ( mu_D_c + mu_D_w ) * ( rho_u1[ w ] - rho_u1[ c ] ) +
-                                 ( mu_D_c + mu_D_s ) * ( rho_u1[ s ] - rho_u1[ c ] ) )
-                                 - grad_p. x();
+   rho_u1_t =
+      -1.0 / mu_D_c
+         * ( rho_u1_f_e * e_normal.x() + rho_u1_g_e * e_normal.y() + rho_u1_f_n * n_normal.x() + rho_u1_g_n * n_normal.y()
+             + rho_u1_f_w * w_normal.x() + rho_u1_g_w * w_normal.y() + rho_u1_f_s * s_normal.x() + rho_u1_g_s * s_normal.y() )
+      + this->viscosityCoefficient * 1.0 / ( 8.0 * tau ) * mu_D_c
+           * ( ( mu_D_c + mu_D_e ) * ( rho_u1[ e ] - rho_u1[ c ] ) + ( mu_D_c + mu_D_n ) * ( rho_u1[ n ] - rho_u1[ c ] )
+               + ( mu_D_c + mu_D_w ) * ( rho_u1[ w ] - rho_u1[ c ] ) + ( mu_D_c + mu_D_s ) * ( rho_u1[ s ] - rho_u1[ c ] ) )
+      - grad_p.x();
 
    /****
     * ( rho * u2 )_t + ( rho * u2 * u1 )_x + ( rho * u2 * u2 )_y - p_y =  0
     */
-   rho_u2_t = - 1.0 / mu_D_c * ( rho_u2_f_e * e_normal. x() + rho_u2_g_e * e_normal. y() +
-                                 rho_u2_f_n * n_normal. x() + rho_u2_g_n * n_normal. y() +
-                                 rho_u2_f_w * w_normal. x() + rho_u2_g_w * w_normal. y() +
-                                 rho_u2_f_s * s_normal. x() + rho_u2_g_s * s_normal. y() )
-              + this->viscosityCoefficient * 1.0 / ( 8.0 * tau ) * mu_D_c *
-                               ( ( mu_D_c + mu_D_e ) * ( rho_u2[ e ] - rho_u2[ c ] ) +
-                                 ( mu_D_c + mu_D_n ) * ( rho_u2[ n ] - rho_u2[ c ] ) +
-                                 ( mu_D_c + mu_D_w ) * ( rho_u2[ w ] - rho_u2[ c ] ) +
-                                 ( mu_D_c + mu_D_s ) * ( rho_u2[ s ] - rho_u2[ c ] ) )
-                                 - grad_p. y();
+   rho_u2_t =
+      -1.0 / mu_D_c
+         * ( rho_u2_f_e * e_normal.x() + rho_u2_g_e * e_normal.y() + rho_u2_f_n * n_normal.x() + rho_u2_g_n * n_normal.y()
+             + rho_u2_f_w * w_normal.x() + rho_u2_g_w * w_normal.y() + rho_u2_f_s * s_normal.x() + rho_u2_g_s * s_normal.y() )
+      + this->viscosityCoefficient * 1.0 / ( 8.0 * tau ) * mu_D_c
+           * ( ( mu_D_c + mu_D_e ) * ( rho_u2[ e ] - rho_u2[ c ] ) + ( mu_D_c + mu_D_n ) * ( rho_u2[ n ] - rho_u2[ c ] )
+               + ( mu_D_c + mu_D_w ) * ( rho_u2[ w ] - rho_u2[ c ] ) + ( mu_D_c + mu_D_s ) * ( rho_u2[ s ] - rho_u2[ c ] ) )
+      - grad_p.y();
 }
 
 template< typename Real,
           typename Device,
           typename Index,
           typename PressureGradient,
-          template< int, typename, typename, typename > class GridGeometry >
-Real LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient  > :: regularize( const Real& r ) const
+          template< int, typename, typename, typename >
+          class GridGeometry >
+Real
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, PressureGradient >::regularize( const Real& r ) const
 {
    return r + ( ( r >= 0 ) - ( r < 0 ) ) * this->regularizeEps;
 }
@@ -271,129 +284,106 @@ Real LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, GridGeometry >, Pressur
  * Specialization for the grids with no deformations (Identical grid geometry)
  */
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename PressureGradient >
-LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >,
-                 PressureGradient > :: LaxFridrichs()
-: regularizeEps( 1.0e-5 ),
-  viscosityCoefficient( 1.0 ),
-  mesh( 0 ),
-  pressureGradient( 0 )
-{
-}
+template< typename Real, typename Device, typename Index, typename PressureGradient >
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient >::LaxFridrichs()
+: regularizeEps( 1.0e-5 ), viscosityCoefficient( 1.0 ), mesh( 0 ), pressureGradient( 0 )
+{}
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename PressureGradient >
-void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient  > :: bindMesh( const MeshType& mesh )
+template< typename Real, typename Device, typename Index, typename PressureGradient >
+void
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient >::bindMesh(
+   const MeshType& mesh )
 {
    this->mesh = &mesh;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename PressureGradient >
-void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient  > :: setRegularization( const RealType& epsilon )
+template< typename Real, typename Device, typename Index, typename PressureGradient >
+void
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient >::setRegularization(
+   const RealType& epsilon )
 {
    this->regularizeEps = epsilon;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename PressureGradient >
-void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient  > :: setViscosityCoefficient( const RealType& v )
+template< typename Real, typename Device, typename Index, typename PressureGradient >
+void
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient >::setViscosityCoefficient(
+   const RealType& v )
 {
    this->viscosityCoefficient = v;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename PressureGradient >
-   template< typename Vector >
-void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient  > :: setRho( Vector& rho )
+template< typename Real, typename Device, typename Index, typename PressureGradient >
+template< typename Vector >
+void
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient >::setRho( Vector& rho )
 {
-   this->rho. bind( rho );
+   this->rho.bind( rho );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename PressureGradient >
-   template< typename Vector >
-void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient  > :: setRhoU1( Vector& rho_u1 )
+template< typename Real, typename Device, typename Index, typename PressureGradient >
+template< typename Vector >
+void
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient >::setRhoU1( Vector& rho_u1 )
 {
-   this->rho_u1. bind( rho_u1 );
+   this->rho_u1.bind( rho_u1 );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename PressureGradient >
-   template< typename Vector >
-void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient  > :: setRhoU2( Vector& rho_u2 )
+template< typename Real, typename Device, typename Index, typename PressureGradient >
+template< typename Vector >
+void
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient >::setRhoU2( Vector& rho_u2 )
 {
-   this->rho_u2. bind( rho_u2 );
+   this->rho_u2.bind( rho_u2 );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename PressureGradient >
-   template< typename Vector >
-void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient  > :: setE( Vector& e )
+template< typename Real, typename Device, typename Index, typename PressureGradient >
+template< typename Vector >
+void
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient >::setE( Vector& e )
 {
    this->energy.bind( e );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename PressureGradient >
-   template< typename Vector >
-void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient  > :: setP( Vector& p )
+template< typename Real, typename Device, typename Index, typename PressureGradient >
+template< typename Vector >
+void
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient >::setP( Vector& p )
 {
    this->p.bind( p );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename PressureGradient >
-   template< typename Vector >
-void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient  > :: setPressureGradient( Vector& grad_p )
+template< typename Real, typename Device, typename Index, typename PressureGradient >
+template< typename Vector >
+void
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient >::setPressureGradient(
+   Vector& grad_p )
 {
    this->pressureGradient = &grad_p;
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename PressureGradient >
-void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient  > :: getExplicitUpdate( const IndexType centralVolume,
-                                                                                                                          RealType& rho_t,
-                                                                                                                          RealType& rho_u1_t,
-                                                                                                                          RealType& rho_u2_t,
-                                                                                                                          const RealType& tau ) const
+template< typename Real, typename Device, typename Index, typename PressureGradient >
+void
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient >::getExplicitUpdate(
+   const IndexType centralVolume,
+   RealType& rho_t,
+   RealType& rho_u1_t,
+   RealType& rho_u2_t,
+   const RealType& tau ) const
 {
    TNL_ASSERT_TRUE( mesh, "No mesh has been binded with the Lax-Fridrichs scheme." );
    TNL_ASSERT_TRUE( pressureGradient, "No pressure gradient was set in the the Lax-Fridrichs scheme." )
 
-   const IndexType& xSize = this->mesh -> getDimensions(). x();
-   const IndexType& ySize = this->mesh -> getDimensions(). y();
-   const RealType hx = this->mesh -> getParametricStep(). x();
-   const RealType hy = this->mesh -> getParametricStep(). y();
+   const IndexType& xSize = this->mesh->getDimensions().x();
+   const IndexType& ySize = this->mesh->getDimensions().y();
+   const RealType hx = this->mesh->getParametricStep().x();
+   const RealType hy = this->mesh->getParametricStep().y();
 
    const IndexType& c = centralVolume;
-   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 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
@@ -403,55 +393,53 @@ void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometr
    const RealType u2_n = rho_u2[ n ] / regularize( rho[ n ] );
    const RealType u2_s = rho_u2[ s ] / regularize( rho[ s ] );
    rho_t = this->viscosityCoefficient / tau * 0.25 * ( rho[ e ] + rho[ w ] + rho[ s ] + rho[ n ] - 4.0 * rho[ c ] )
-               - ( rho[ e ] * u1_e - rho[ w ] * u1_w ) / ( 2.0 * hx )
-               - ( rho[ n ] * u2_n - rho[ s ] * u2_s ) / ( 2.0 * hy );
+         - ( rho[ e ] * u1_e - rho[ w ] * u1_w ) / ( 2.0 * hx ) - ( rho[ n ] * u2_n - rho[ s ] * u2_s ) / ( 2.0 * hy );
 
    /****
     * Compute the pressure gradient
     */
    PointType grad_p;
-   pressureGradient -> getGradient( c, grad_p );
+   pressureGradient->getGradient( c, grad_p );
 
    /****
     * ( rho * u1 )_t + ( rho * u1 * u1 )_x + ( rho * u1 * u2 )_y - p_x =  0
     */
-   rho_u1_t = this->viscosityCoefficient / tau * 0.25 * ( rho_u1[ e ] + rho_u1[ w ] + rho_u1[ s ] + rho_u1[ n ] - 4.0 * rho_u1[ c ] )
-                   - ( rho_u1[ e ] * u1_e - rho_u1[ w ] * u1_w ) / ( 2.0 * hx )
-                   - ( rho_u1[ n ] * u2_n - rho_u1[ s ] * u2_s ) / ( 2.0 * hy )
-                   - grad_p. x();
+   rho_u1_t =
+      this->viscosityCoefficient / tau * 0.25 * ( rho_u1[ e ] + rho_u1[ w ] + rho_u1[ s ] + rho_u1[ n ] - 4.0 * rho_u1[ c ] )
+      - ( rho_u1[ e ] * u1_e - rho_u1[ w ] * u1_w ) / ( 2.0 * hx ) - ( rho_u1[ n ] * u2_n - rho_u1[ s ] * u2_s ) / ( 2.0 * hy )
+      - grad_p.x();
    /****
     * ( rho * u2 )_t + ( rho * u2 * u1 )_x + ( rho * u2 * u2 )_y - p_y =  0
     */
-   rho_u2_t = this->viscosityCoefficient / tau * 0.25 * ( rho_u2[ e ] + rho_u2[ w ] + rho_u2[ s ] + rho_u2[ n ] - 4.0 * rho_u2[ c ] )
-                   - ( rho_u2[ e ] * u1_e - rho_u2[ w ] * u1_w ) / ( 2.0 * hx )
-                   - ( rho_u2[ n ] * u2_n - rho_u2[ s ] * u2_s ) / ( 2.0 * hy )
-                   - grad_p. y();
+   rho_u2_t =
+      this->viscosityCoefficient / tau * 0.25 * ( rho_u2[ e ] + rho_u2[ w ] + rho_u2[ s ] + rho_u2[ n ] - 4.0 * rho_u2[ c ] )
+      - ( rho_u2[ e ] * u1_e - rho_u2[ w ] * u1_w ) / ( 2.0 * hx ) - ( rho_u2[ n ] * u2_n - rho_u2[ s ] * u2_s ) / ( 2.0 * hy )
+      - grad_p.y();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename PressureGradient >
-void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient  > :: getExplicitUpdate( const IndexType centralVolume,
-                                                                                                                          RealType& rho_t,
-                                                                                                                          RealType& rho_u1_t,
-                                                                                                                          RealType& rho_u2_t,
-                                                                                                                          RealType& e_t,
-                                                                                                                          const RealType& tau ) const
+template< typename Real, typename Device, typename Index, typename PressureGradient >
+void
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient >::getExplicitUpdate(
+   const IndexType centralVolume,
+   RealType& rho_t,
+   RealType& rho_u1_t,
+   RealType& rho_u2_t,
+   RealType& e_t,
+   const RealType& tau ) const
 {
    TNL_ASSERT_TRUE( mesh, "No mesh has been binded with the Lax-Fridrichs scheme." );
    TNL_ASSERT_TRUE( pressureGradient, "No pressure gradient was set in the the Lax-Fridrichs scheme." )
 
-   const IndexType& xSize = this->mesh -> getDimensions(). x();
-   const IndexType& ySize = this->mesh -> getDimensions(). y();
-   const RealType hx = this->mesh -> getParametricStep(). x();
-   const RealType hy = this->mesh -> getParametricStep(). y();
+   const IndexType& xSize = this->mesh->getDimensions().x();
+   const IndexType& ySize = this->mesh->getDimensions().y();
+   const RealType hx = this->mesh->getParametricStep().x();
+   const RealType hy = this->mesh->getParametricStep().y();
 
    const IndexType& c = centralVolume;
-   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 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
@@ -461,47 +449,44 @@ void LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometr
    const RealType u2_n = rho_u2[ n ] / regularize( rho[ n ] );
    const RealType u2_s = rho_u2[ s ] / regularize( rho[ s ] );
    rho_t = this->viscosityCoefficient / tau * 0.25 * ( rho[ e ] + rho[ w ] + rho[ s ] + rho[ n ] - 4.0 * rho[ c ] )
-               - ( rho[ e ] * u1_e - rho[ w ] * u1_w ) / ( 2.0 * hx )
-               - ( rho[ n ] * u2_n - rho[ s ] * u2_s ) / ( 2.0 * hy );
+         - ( rho[ e ] * u1_e - rho[ w ] * u1_w ) / ( 2.0 * hx ) - ( rho[ n ] * u2_n - rho[ s ] * u2_s ) / ( 2.0 * hy );
 
    /****
     * Compute the pressure gradient
     */
    PointType grad_p;
-   pressureGradient -> getGradient( c, grad_p );
+   pressureGradient->getGradient( c, grad_p );
 
    /****
     * ( rho * u1 )_t + ( rho * u1 * u1 )_x + ( rho * u1 * u2 )_y - p_x =  0
     */
-   rho_u1_t = this->viscosityCoefficient / tau * 0.25 * ( rho_u1[ e ] + rho_u1[ w ] + rho_u1[ s ] + rho_u1[ n ] - 4.0 * rho_u1[ c ] )
-                   - ( rho_u1[ e ] * u1_e - rho_u1[ w ] * u1_w ) / ( 2.0 * hx )
-                   - ( rho_u1[ n ] * u2_n - rho_u1[ s ] * u2_s ) / ( 2.0 * hy )
-                   - grad_p. x();
+   rho_u1_t =
+      this->viscosityCoefficient / tau * 0.25 * ( rho_u1[ e ] + rho_u1[ w ] + rho_u1[ s ] + rho_u1[ n ] - 4.0 * rho_u1[ c ] )
+      - ( rho_u1[ e ] * u1_e - rho_u1[ w ] * u1_w ) / ( 2.0 * hx ) - ( rho_u1[ n ] * u2_n - rho_u1[ s ] * u2_s ) / ( 2.0 * hy )
+      - grad_p.x();
    /****
     * ( rho * u2 )_t + ( rho * u2 * u1 )_x + ( rho * u2 * u2 )_y - p_y =  0
     */
-   rho_u2_t = this->viscosityCoefficient / tau * 0.25 * ( rho_u2[ e ] + rho_u2[ w ] + rho_u2[ s ] + rho_u2[ n ] - 4.0 * rho_u2[ c ] )
-                   - ( rho_u2[ e ] * u1_e - rho_u2[ w ] * u1_w ) / ( 2.0 * hx )
-                   - ( rho_u2[ n ] * u2_n - rho_u2[ s ] * u2_s ) / ( 2.0 * hy )
-                   - grad_p. y();
+   rho_u2_t =
+      this->viscosityCoefficient / tau * 0.25 * ( rho_u2[ e ] + rho_u2[ w ] + rho_u2[ s ] + rho_u2[ n ] - 4.0 * rho_u2[ c ] )
+      - ( rho_u2[ e ] * u1_e - rho_u2[ w ] * u1_w ) / ( 2.0 * hx ) - ( rho_u2[ n ] * u2_n - rho_u2[ s ] * u2_s ) / ( 2.0 * hy )
+      - grad_p.y();
 
    /****
     * e_t + ( ( e + p ) * u )_x + ( ( e + p ) * v )_y = 0
     */
    e_t = this->viscosityCoefficient / tau * 0.25 * ( energy[ e ] + energy[ w ] + energy[ s ] + energy[ n ] - 4.0 * energy[ c ] )
-              - ( ( energy[ e ] + p[ e ] ) * u1_e - ( energy[ w ] + p[ w ] ) * u1_w ) / ( 2.0 * hx )
-              - ( ( energy[ n ] + p[ n ] ) * u2_n - ( energy[ s ] + p[ s ] ) * u2_s ) / ( 2.0 * hy );
+       - ( ( energy[ e ] + p[ e ] ) * u1_e - ( energy[ w ] + p[ w ] ) * u1_w ) / ( 2.0 * hx )
+       - ( ( energy[ n ] + p[ n ] ) * u2_n - ( energy[ s ] + p[ s ] ) * u2_s ) / ( 2.0 * hy );
 }
 
-
-template< typename Real,
-          typename Device,
-          typename Index,
-          typename PressureGradient >
-Real LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient  > :: regularize( const Real& r ) const
+template< typename Real, typename Device, typename Index, typename PressureGradient >
+Real
+LaxFridrichs< Meshes::Grid< 2, Real, Device, Index, tnlIdenticalGridGeometry >, PressureGradient >::regularize(
+   const Real& r ) const
 {
    return r + ( ( r >= 0 ) - ( r < 0 ) ) * this->regularizeEps;
 }
 
-} // namespace Operators
-} // namespace TNL
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/fdm/BackwardFiniteDifference.h b/src/TNL/Operators/fdm/BackwardFiniteDifference.h
index faa8268e539b95e2f085a5142e5e75a3138f5118..b2b1dde25f01bd338f203dface9d4e6555953de9 100644
--- a/src/TNL/Operators/fdm/BackwardFiniteDifference.h
+++ b/src/TNL/Operators/fdm/BackwardFiniteDifference.h
@@ -11,7 +11,7 @@
 #include <TNL/Operators/Operator.h>
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
 template< typename Mesh,
           int Xdifference = 0,
@@ -20,8 +20,7 @@ template< typename Mesh,
           typename RealType = typename Mesh::RealType,
           typename IndexType = typename Mesh::GlobalIndexType >
 class BackwardFiniteDifference
-{
-};
+{};
 
 template< int Dimension,
           typename MeshReal,
@@ -32,44 +31,53 @@ template< int Dimension,
           int ZDifference,
           typename Real,
           typename 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 >
+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< Dimension, MeshReal, MeshDevice, MeshIndex > MeshType;
-      typedef Real RealType;
-      typedef MeshDevice DeviceType;
-      typedef Index IndexType;
-      typedef ExactDifference< Dimension, XDifference, YDifference, ZDifference > ExactOperatorType;
- 
-      static constexpr int getMeshDimension() { return Dimension; }
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      inline Real operator()( const MeshFunction& u,
-                              const MeshEntity& entity,
-                              const RealType& time = 0.0 ) const
-      {
-         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 );
-         const int ZDirection = -1 * ( ZDifference != 0 );
-         return FiniteDifferences<
-            MeshType,
-            Real,
-            Index,
-            XDifference,
-            YDifference,
-            ZDifference,
-            XDirection,
-            YDirection,
-            ZDirection >::getValue( u, entity );
-      };
-};
+public:
+   typedef Meshes::Grid< Dimension, MeshReal, MeshDevice, MeshIndex > MeshType;
+   typedef Real RealType;
+   typedef MeshDevice DeviceType;
+   typedef Index IndexType;
+   typedef ExactDifference< Dimension, XDifference, YDifference, ZDifference > ExactOperatorType;
 
-} // namespace Operators
-} // namespace TNL
+   static constexpr int
+   getMeshDimension()
+   {
+      return Dimension;
+   }
+
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   inline Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const RealType& time = 0.0 ) const
+   {
+      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 );
+      const int ZDirection = -1 * ( ZDifference != 0 );
+      return FiniteDifferences< MeshType,
+                                Real,
+                                Index,
+                                XDifference,
+                                YDifference,
+                                ZDifference,
+                                XDirection,
+                                YDirection,
+                                ZDirection >::getValue( u, entity );
+   };
+};
 
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/fdm/CentralFiniteDifference.h b/src/TNL/Operators/fdm/CentralFiniteDifference.h
index 8a74ca9004c234d243d1ea9d15da50182f571845..9d2d79cca67b035f3d93dd4e0482245a3243942e 100644
--- a/src/TNL/Operators/fdm/CentralFiniteDifference.h
+++ b/src/TNL/Operators/fdm/CentralFiniteDifference.h
@@ -11,7 +11,7 @@
 #include <TNL/Operators/Operator.h>
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
 template< typename Mesh,
           int Xdifference = 0,
@@ -20,8 +20,7 @@ template< typename Mesh,
           typename RealType = typename Mesh::RealType,
           typename IndexType = typename Mesh::GlobalIndexType >
 class CentralFiniteDifference
-{
-};
+{};
 
 template< int Dimension,
           typename MeshReal,
@@ -32,32 +31,38 @@ template< int Dimension,
           int ZDifference,
           typename Real,
           typename 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 >
+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< Dimension, MeshReal, MeshDevice, MeshIndex > MeshType;
-      typedef Real RealType;
-      typedef MeshDevice DeviceType;
-      typedef Index IndexType;
-      typedef ExactDifference< Dimension, XDifference, YDifference, ZDifference > ExactOperatorType;
- 
-      //static constexpr int getMeshDimension() { return Dimension; }
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      inline Real operator()( const MeshFunction& u,
-                              const MeshEntity& entity,
-                              const RealType& time = 0.0 ) const
-      {
-         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 );
-      };
-};
+public:
+   typedef Meshes::Grid< Dimension, MeshReal, MeshDevice, MeshIndex > MeshType;
+   typedef Real RealType;
+   typedef MeshDevice DeviceType;
+   typedef Index IndexType;
+   typedef ExactDifference< Dimension, XDifference, YDifference, ZDifference > ExactOperatorType;
 
-} // namespace Operators
-} // namespace TNL
+   // static constexpr int getMeshDimension() { return Dimension; }
+
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   inline Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const RealType& time = 0.0 ) const
+   {
+      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 );
+   };
+};
 
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/fdm/ExactDifference.h b/src/TNL/Operators/fdm/ExactDifference.h
index d5cd1caf41ba204fb6e8be641308b3ac3580ed62..b0b192c70150cb6c38e470c0baada8d5259aa4ab 100644
--- a/src/TNL/Operators/fdm/ExactDifference.h
+++ b/src/TNL/Operators/fdm/ExactDifference.h
@@ -7,33 +7,22 @@
 #pragma once
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
-template< int Dimension,
-          int XDerivative,
-          int YDerivative,
-          int ZDerivative >
-class ExactDifference
-   : public Functions::Domain< Dimension, Functions::SpaceDomain >
+template< int Dimension, int XDerivative, int YDerivative, int ZDerivative >
+class ExactDifference : public Functions::Domain< Dimension, Functions::SpaceDomain >
 {
-   public:
- 
-      template< typename Function >
-      __cuda_callable__
-      typename Function::RealType operator()(
-         const Function& function,
-         const typename Function::PointType& vertex,
-         const typename Function::RealType& time = 0 ) const
-      {
-         return function.template getPartialDerivative<
-            XDerivative,
-            YDerivative,
-            ZDerivative >(
-            vertex,
-            time );
-      }
+public:
+   template< typename Function >
+   __cuda_callable__
+   typename Function::RealType
+   operator()( const Function& function,
+               const typename Function::PointType& vertex,
+               const typename Function::RealType& time = 0 ) const
+   {
+      return function.template getPartialDerivative< XDerivative, YDerivative, ZDerivative >( vertex, time );
+   }
 };
 
-} // namespace Operators
-} // namespace TNL
-
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/fdm/FiniteDifferences.h b/src/TNL/Operators/fdm/FiniteDifferences.h
index 8273b5460def3b64365a3d5c07051af1dfbb1acc..1cce1d9641b67b3f263a63107a18fa9f993af21b 100644
--- a/src/TNL/Operators/fdm/FiniteDifferences.h
+++ b/src/TNL/Operators/fdm/FiniteDifferences.h
@@ -7,7 +7,7 @@
 #pragma once
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
 template< typename Mesh,
           typename Real,
@@ -19,13 +19,11 @@ template< typename Mesh,
           int YDirection,
           int ZDirection >
 class FiniteDifferences
-{
-};
+{};
 
-} // namespace Operators
-} // namespace TNL
+}  // namespace Operators
+}  // namespace TNL
 
 #include <TNL/Operators/fdm/FiniteDifferences_1D.h>
 #include <TNL/Operators/fdm/FiniteDifferences_2D.h>
 #include <TNL/Operators/fdm/FiniteDifferences_3D.h>
-
diff --git a/src/TNL/Operators/fdm/FiniteDifferences_1D.h b/src/TNL/Operators/fdm/FiniteDifferences_1D.h
index 9382a67d352682d768019781c906b00dc19ff017..966a6ae1c89c39d88b1708554f4ed5fe86606007 100644
--- a/src/TNL/Operators/fdm/FiniteDifferences_1D.h
+++ b/src/TNL/Operators/fdm/FiniteDifferences_1D.h
@@ -7,7 +7,7 @@
 #pragma once
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
 /***
  * Default implementation for case when one differentiate with respect
@@ -24,186 +24,143 @@ template< typename MeshReal,
           int XDirection,
           int YDirection,
           int ZDirection >
-class FiniteDifferences<
-   Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index,
-   XDifference, YDifference, ZDifference,
-   XDirection, YDirection, ZDirection >
+class FiniteDifferences< Meshes::Grid< 1, MeshReal, Device, MeshIndex >,
+                         Real,
+                         Index,
+                         XDifference,
+                         YDifference,
+                         ZDifference,
+                         XDirection,
+                         YDirection,
+                         ZDirection >
 {
    static_assert( YDifference != 0 || ZDifference != 0,
-      "You try to use default finite difference with 'wrong' template parameters. It means that required finite difference was not implmented yet." );
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         return 0.0;
-      }
+                  "You try to use default finite difference with 'wrong' template parameters. It means that required finite "
+                  "difference was not implmented yet." );
+
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      return 0.0;
+   }
 };
 
 /****
  * 1st order forward difference
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index,
-   1, 0, 0,
-   1, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 1, 0, 0, 1, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< 1 >()] - u_c ) * hxDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 1 >() ] - u_c ) * hxDiv;
+   }
 };
 
 /****
  * 1st order backward difference
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index,
-   1, 0, 0,
-   -1, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 1, 0, 0, -1, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< -1 >()] ) * hxDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< -1 >() ] ) * hxDiv;
+   }
 };
 
 /****
  * 1st order central difference
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index,
-   1, 0, 0,
-   0, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 1, 0, 0, 0, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities();
-         const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1 >();
-         return ( u[ neighborEntities.template getEntityIndex< 1 >() ] -
-                  u[ neighborEntities.template getEntityIndex< -1 >() ] ) * ( 0.5 * hxDiv );
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities();
+      const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1 >();
+      return ( u[ neighborEntities.template getEntityIndex< 1 >() ] - u[ neighborEntities.template getEntityIndex< -1 >() ] )
+           * ( 0.5 * hxDiv );
+   }
 };
 
 /****
  * 2nd order central difference
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index,
-   2, 0, 0,
-   1, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 2, 0, 0, 1, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< 2 >() ] -
-                  2.0 * u_c +
-                  u[ neighborEntities.template getEntityIndex< 1 >() ] ) * hxSquareDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 2 >() ] - 2.0 * u_c
+               + u[ neighborEntities.template getEntityIndex< 1 >() ] )
+           * hxSquareDiv;
+   }
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index,
-   2, 0, 0,
-   -1, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 2, 0, 0, -1, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< -2 >() ] -
-                  2.0 * u_c +
-                  u[ neighborEntities.template getEntityIndex< -1 >() ] ) * hxSquareDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< -2 >() ] - 2.0 * u_c
+               + u[ neighborEntities.template getEntityIndex< -1 >() ] )
+           * hxSquareDiv;
+   }
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index,
-   2, 0, 0,
-   0, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 2, 0, 0, 0, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< 1 >() ] -
-                  2.0 * u_c +
-                  u[ neighborEntities.template getEntityIndex< -1 >() ] ) * hxSquareDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 1 >() ] - 2.0 * u_c
+               + u[ neighborEntities.template getEntityIndex< -1 >() ] )
+           * hxSquareDiv;
+   }
 };
 
-} // namespace Operators
-} // namespace TNL
-
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/fdm/FiniteDifferences_2D.h b/src/TNL/Operators/fdm/FiniteDifferences_2D.h
index a10f064ac7191f298dbe724a87d992e92a43b3fa..a547b221ea91df05ce92287cfe5e0a3ab9e70106 100644
--- a/src/TNL/Operators/fdm/FiniteDifferences_2D.h
+++ b/src/TNL/Operators/fdm/FiniteDifferences_2D.h
@@ -7,7 +7,7 @@
 #pragma once
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
 /***
  * Default implementation for case when one differentiate with respect
@@ -24,337 +24,247 @@ template< typename MeshReal,
           int XDirection,
           int YDirection,
           int ZDirection >
-class FiniteDifferences<
-   Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index,
-   XDifference, YDifference, ZDifference,
-   XDirection, YDirection, ZDirection >
+class FiniteDifferences< Meshes::Grid< 2, MeshReal, Device, MeshIndex >,
+                         Real,
+                         Index,
+                         XDifference,
+                         YDifference,
+                         ZDifference,
+                         XDirection,
+                         YDirection,
+                         ZDirection >
 {
    static_assert( ZDifference != 0,
-      "You try to use default finite difference with 'wrong' template parameters. It means that required finite difference was not implmented yet." );
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         return 0.0;
-      }
+                  "You try to use default finite difference with 'wrong' template parameters. It means that required finite "
+                  "difference was not implmented yet." );
+
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      return 0.0;
+   }
 };
 
 /****
  * 1st order forward difference
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index,
-   1, 0, 0,
-   1, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 1, 0, 0, 1, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< 1, 0 >()] - u_c ) * hxDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 1, 0 >() ] - u_c ) * hxDiv;
+   }
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index,
-   0, 1, 0,
-   0, 1, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 0, 1, 0, 0, 1, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< 0, 1 >()] - u_c ) * hyDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 0, 1 >() ] - u_c ) * hyDiv;
+   }
 };
 
 /****
  * 1st order backward difference
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index,
-   1, 0, 0,
-   -1, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 1, 0, 0, -1, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< -1, 0 >()] ) * hxDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< -1, 0 >() ] ) * hxDiv;
+   }
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index,
-   0,  1, 0,
-   0, -1, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 0, 1, 0, 0, -1, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< 0, -1 >()] ) * hyDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 0, -1 >() ] ) * hyDiv;
+   }
 };
 
 /****
  * 1st order central difference
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index,
-   1, 0, 0,
-   0, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 1, 0, 0, 0, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities();
-         const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1, 0 >();
-         return ( u[ neighborEntities.template getEntityIndex< 1, 0 >() ] -
-                  u[ neighborEntities.template getEntityIndex< -1, 0 >() ] ) * ( 0.5 * hxDiv );
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities();
+      const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1, 0 >();
+      return ( u[ neighborEntities.template getEntityIndex< 1, 0 >() ]
+               - u[ neighborEntities.template getEntityIndex< -1, 0 >() ] )
+           * ( 0.5 * hxDiv );
+   }
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index,
-   0, 1, 0,
-   0, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 0, 1, 0, 0, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities();
-         const Real& hyDiv = entity.getMesh().template getSpaceStepsProducts< 0, -1 >();
-         return ( u[ neighborEntities.template getEntityIndex< 0,  1 >() ] -
-                  u[ neighborEntities.template getEntityIndex< 0, -1 >() ] ) * ( 0.5 * hyDiv );
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities();
+      const Real& hyDiv = entity.getMesh().template getSpaceStepsProducts< 0, -1 >();
+      return ( u[ neighborEntities.template getEntityIndex< 0, 1 >() ]
+               - u[ neighborEntities.template getEntityIndex< 0, -1 >() ] )
+           * ( 0.5 * hyDiv );
+   }
 };
 
-
 /****
  * 2nd order central difference
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index,
-   2, 0, 0,
-   1, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 2, 0, 0, 1, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< 2, 0 >() ] -
-                  2.0 * u_c +
-                  u[ neighborEntities.template getEntityIndex< 1, 0 >() ] ) * hxSquareDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 2, 0 >() ] - 2.0 * u_c
+               + u[ neighborEntities.template getEntityIndex< 1, 0 >() ] )
+           * hxSquareDiv;
+   }
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index,
-   2, 0, 0,
-   -1, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 2, 0, 0, -1, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< -2, 0 >() ] -
-                  2.0 * u_c +
-                  u[ neighborEntities.template getEntityIndex< -1, 0 >() ] ) * hxSquareDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< -2, 0 >() ] - 2.0 * u_c
+               + u[ neighborEntities.template getEntityIndex< -1, 0 >() ] )
+           * hxSquareDiv;
+   }
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index,
-   2, 0, 0,
-   0, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 2, 0, 0, 0, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex<  1, 0 >() ] -
-                  2.0 * u_c +
-                  u[ neighborEntities.template getEntityIndex< -1, 0 >() ] ) * hxSquareDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 1, 0 >() ] - 2.0 * u_c
+               + u[ neighborEntities.template getEntityIndex< -1, 0 >() ] )
+           * hxSquareDiv;
+   }
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index,
-   0, 2, 0,
-   0 ,1, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 0, 2, 0, 0, 1, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< 0, 2 >() ] -
-                  2.0 * u_c +
-                  u[ neighborEntities.template getEntityIndex< 0, 1 >() ] ) * hxSquareDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 0, 2 >() ] - 2.0 * u_c
+               + u[ neighborEntities.template getEntityIndex< 0, 1 >() ] )
+           * hxSquareDiv;
+   }
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index,
-   0,  2, 0,
-   0, -1, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 0, 2, 0, 0, -1, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< 0, -2 >() ] -
-                  2.0 * u_c +
-                  u[ neighborEntities.template getEntityIndex< 0, -1 >() ] ) * hxSquareDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 0, -2 >() ] - 2.0 * u_c
+               + u[ neighborEntities.template getEntityIndex< 0, -1 >() ] )
+           * hxSquareDiv;
+   }
 };
 
-
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index,
-   0, 2, 0,
-   0, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 0, 2, 0, 0, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< 0,  1 >() ] -
-                  2.0 * u_c +
-                  u[ neighborEntities.template getEntityIndex< 0, -1 >() ] ) * hySquareDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 0, 1 >() ] - 2.0 * u_c
+               + u[ neighborEntities.template getEntityIndex< 0, -1 >() ] )
+           * hySquareDiv;
+   }
 };
 
-} // namespace Operators
-} // namespace TNL
\ No newline at end of file
+}  // namespace Operators
+}  // namespace TNL
\ No newline at end of file
diff --git a/src/TNL/Operators/fdm/FiniteDifferences_3D.h b/src/TNL/Operators/fdm/FiniteDifferences_3D.h
index a10c902b416639f928d89671fb322696dc9415cd..960f9e1304c7f8895d6103aac3568d9a08c0209f 100644
--- a/src/TNL/Operators/fdm/FiniteDifferences_3D.h
+++ b/src/TNL/Operators/fdm/FiniteDifferences_3D.h
@@ -7,470 +7,328 @@
 #pragma once
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
 /****
  * 1st order forward difference
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index,
-   1, 0, 0,
-   1, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 1, 0, 0, 1, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< 1, 0, 0 >()] - u_c ) * hxDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ] - u_c ) * hxDiv;
+   }
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index,
-   0, 1, 0,
-   0, 1, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 0, 1, 0, 0, 1, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< 0, 1, 0 >()] - u_c ) * hyDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ] - u_c ) * hyDiv;
+   }
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index,
-   0, 0, 1,
-   0, 0, 1 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 0, 0, 1, 0, 0, 1 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< 0, 0, 1 >()] - u_c ) * hzDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 0, 0, 1 >() ] - u_c ) * hzDiv;
+   }
 };
 
 /****
  * 1st order backward difference
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index,
-   1, 0, 0,
-   -1, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 1, 0, 0, -1, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< -1, 0, 0 >()] ) * hxDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< -1, 0, 0 >() ] ) * hxDiv;
+   }
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index,
-   0,  1, 0,
-   0, -1, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 0, 1, 0, 0, -1, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< 0, -1, 0 >()] ) * hyDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 0, -1, 0 >() ] ) * hyDiv;
+   }
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index,
-   0, 0,  1,
-   0, 0, -1 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 0, 0, 1, 0, 0, -1 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< 0, 0, -1 >()] ) * hzDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] ) * hzDiv;
+   }
 };
 
 /****
  * 1st order central difference
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index,
-   1, 0, 0,
-   0, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 1, 0, 0, 0, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities();
-         const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1, 0, 0 >();
-         return ( u[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ] -
-                  u[ neighborEntities.template getEntityIndex< -1, 0, 0 >() ] ) * ( 0.5 * hxDiv );
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities();
+      const Real& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1, 0, 0 >();
+      return ( u[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ]
+               - u[ neighborEntities.template getEntityIndex< -1, 0, 0 >() ] )
+           * ( 0.5 * hxDiv );
+   }
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index,
-   0, 1, 0,
-   0, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 0, 1, 0, 0, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities();
-         const Real& hyDiv = entity.getMesh().template getSpaceStepsProducts< 0, -1, 0 >();
-         return ( u[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ] -
-                  u[ neighborEntities.template getEntityIndex< 0, -1, 0 >() ] ) * ( 0.5 * hyDiv );
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities();
+      const Real& hyDiv = entity.getMesh().template getSpaceStepsProducts< 0, -1, 0 >();
+      return ( u[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ]
+               - u[ neighborEntities.template getEntityIndex< 0, -1, 0 >() ] )
+           * ( 0.5 * hyDiv );
+   }
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index,
-   0, 0, 1,
-   0, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 0, 0, 1, 0, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities();
-         const Real& hzDiv = entity.getMesh().template getSpaceStepsProducts< 0, 0, -1 >();
-         return ( u[ neighborEntities.template getEntityIndex< 0, 0, 1 >() ] -
-                  u[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] ) * ( 0.5 * hzDiv );
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities();
+      const Real& hzDiv = entity.getMesh().template getSpaceStepsProducts< 0, 0, -1 >();
+      return ( u[ neighborEntities.template getEntityIndex< 0, 0, 1 >() ]
+               - u[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] )
+           * ( 0.5 * hzDiv );
+   }
 };
 
 /****
  * 2nd order central difference
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index,
-   2, 0, 0,
-   1, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 2, 0, 0, 1, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< 2, 0, 0 >() ] -
-                  2.0 * u_c +
-                  u[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ] ) * hxSquareDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 2, 0, 0 >() ] - 2.0 * u_c
+               + u[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ] )
+           * hxSquareDiv;
+   }
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index,
-   2, 0, 0,
-   -1, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 2, 0, 0, -1, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< -2, 0, 0 >() ] -
-                  2.0 * u_c +
-                  u[ neighborEntities.template getEntityIndex< -1, 0, 0 >() ] ) * hxSquareDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< -2, 0, 0 >() ] - 2.0 * u_c
+               + u[ neighborEntities.template getEntityIndex< -1, 0, 0 >() ] )
+           * hxSquareDiv;
+   }
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index,
-   2, 0, 0,
-   0, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 2, 0, 0, 0, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex<  1, 0, 0 >() ] -
-                  2.0 * u_c +
-                  u[ neighborEntities.template getEntityIndex< -1, 0, 0 >() ] ) * hxSquareDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ] - 2.0 * u_c
+               + u[ neighborEntities.template getEntityIndex< -1, 0, 0 >() ] )
+           * hxSquareDiv;
+   }
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index,
-   0, 2, 0,
-   0, 1, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 0, 2, 0, 0, 1, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< 0, 2, 0 >() ] -
-                  2.0 * u_c +
-                  u[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ] ) * hxSquareDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 0, 2, 0 >() ] - 2.0 * u_c
+               + u[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ] )
+           * hxSquareDiv;
+   }
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index,
-   0,  2, 0,
-   0, -1, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 0, 2, 0, 0, -1, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< 0, -2, 0 >() ] -
-                  2.0 * u_c +
-                  u[ neighborEntities.template getEntityIndex< 0, -1, 0 >() ] ) * hxSquareDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 0, -2, 0 >() ] - 2.0 * u_c
+               + u[ neighborEntities.template getEntityIndex< 0, -1, 0 >() ] )
+           * hxSquareDiv;
+   }
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index,
-   0, 2, 0,
-   0, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 0, 2, 0, 0, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< 0,  1, 0 >() ] -
-                  2.0 * u_c +
-                  u[ neighborEntities.template getEntityIndex< 0, -1, 0 >() ] ) * hySquareDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ] - 2.0 * u_c
+               + u[ neighborEntities.template getEntityIndex< 0, -1, 0 >() ] )
+           * hySquareDiv;
+   }
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index,
-   0, 0, 2,
-   0, 0 ,1 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 0, 0, 2, 0, 0, 1 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< 0, 0, 2 >() ] -
-                  2.0 * u_c +
-                  u[ neighborEntities.template getEntityIndex< 0, 0, 1 >() ] ) * hxSquareDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 0, 0, 2 >() ] - 2.0 * u_c
+               + u[ neighborEntities.template getEntityIndex< 0, 0, 1 >() ] )
+           * hxSquareDiv;
+   }
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index,
-   0, 0,  2,
-   0, 0, -1 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 0, 0, 2, 0, 0, -1 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< 0, 0, -2 >() ] -
-                  2.0 * u_c +
-                  u[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] ) * hxSquareDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 0, 0, -2 >() ] - 2.0 * u_c
+               + u[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] )
+           * hxSquareDiv;
+   }
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class FiniteDifferences<
-   Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index,
-   0, 0, 2,
-   0, 0, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class FiniteDifferences< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 0, 0, 2, 0, 0, 0 >
 {
-   public:
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      static Real getValue( const MeshFunction& u,
-                            const MeshEntity& entity )
-      {
-         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[ neighborEntities.template getEntityIndex< 0, 0,  1 >() ] -
-                  2.0 * u_c +
-                  u[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] ) * hzSquareDiv;
-      }
+public:
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   static Real
+   getValue( const MeshFunction& u, const MeshEntity& entity )
+   {
+      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[ neighborEntities.template getEntityIndex< 0, 0, 1 >() ] - 2.0 * u_c
+               + u[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] )
+           * hzSquareDiv;
+   }
 };
 
-} // namespace Operators
-} // namespace TNL
-
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/fdm/ForwardFiniteDifference.h b/src/TNL/Operators/fdm/ForwardFiniteDifference.h
index 4683ccd6603e889610b4285855903d34073eed7d..c93103d10dfefe8b19e8fccae767f7079ad38e6c 100644
--- a/src/TNL/Operators/fdm/ForwardFiniteDifference.h
+++ b/src/TNL/Operators/fdm/ForwardFiniteDifference.h
@@ -12,7 +12,7 @@
 #include <TNL/Operators/Operator.h>
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
 template< typename Mesh,
           int Xdifference = 0,
@@ -21,8 +21,7 @@ template< typename Mesh,
           typename RealType = typename Mesh::RealType,
           typename IndexType = typename Mesh::GlobalIndexType >
 class ForwardFiniteDifference
-{
-};
+{};
 
 template< int Dimension,
           typename MeshReal,
@@ -33,46 +32,54 @@ template< int Dimension,
           int ZDifference,
           typename Real,
           typename 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 >
+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< Dimension, MeshReal, MeshDevice, MeshIndex > MeshType;
-      typedef Real RealType;
-      typedef MeshDevice DeviceType;
-      typedef Index IndexType;
-      typedef ExactDifference< Dimension, XDifference, YDifference, ZDifference > ExactOperatorType;
- 
-      static constexpr int getMeshDimension() { return Dimension; }
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      inline Real operator()( const MeshFunction& u,
-                              const MeshEntity& entity,
-                              const RealType& time = 0.0 ) const
-      {
-         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 );
-         const int ZDirection = 1 * ( ZDifference != 0 );
+public:
+   typedef Meshes::Grid< Dimension, MeshReal, MeshDevice, MeshIndex > MeshType;
+   typedef Real RealType;
+   typedef MeshDevice DeviceType;
+   typedef Index IndexType;
+   typedef ExactDifference< Dimension, XDifference, YDifference, ZDifference > ExactOperatorType;
 
-         return FiniteDifferences<
-            MeshType,
-            Real,
-            Index,
-            XDifference,
-            YDifference,
-            ZDifference,
-            XDirection,
-            YDirection,
-            ZDirection >::getValue( u, entity );
+   static constexpr int
+   getMeshDimension()
+   {
+      return Dimension;
+   }
 
-      }
-};
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   inline Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const RealType& time = 0.0 ) const
+   {
+      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 );
+      const int ZDirection = 1 * ( ZDifference != 0 );
 
-} // namespace Operators
-} // namespace TNL
+      return FiniteDifferences< MeshType,
+                                Real,
+                                Index,
+                                XDifference,
+                                YDifference,
+                                ZDifference,
+                                XDirection,
+                                YDirection,
+                                ZDirection >::getValue( u, entity );
+   }
+};
 
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/geometric/CoFVMGradientNorm.h b/src/TNL/Operators/geometric/CoFVMGradientNorm.h
index 5eaab60ba1df6cbab35b52d639379b35173bb967..9ba3f9f76b4ca1de99bedbb9867ae176b3193721 100644
--- a/src/TNL/Operators/geometric/CoFVMGradientNorm.h
+++ b/src/TNL/Operators/geometric/CoFVMGradientNorm.h
@@ -13,456 +13,455 @@
 #include <TNL/Operators/OperatorComposition.h>
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
 template< typename Mesh,
           int MeshEntityDimension = Mesh::getMeshDimension(),
           typename Real = typename Mesh::RealType,
           typename Index = typename Mesh::GlobalIndexType >
 class CoFVMGradientNorm
-{
-};
+{};
 
-template< int MeshDimension,
-          typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+template< int MeshDimension, typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 class CoFVMGradientNorm< Meshes::Grid< MeshDimension, MeshReal, Device, MeshIndex >, MeshDimension, Real, Index >
 : public OperatorComposition<
-   MeshEntitiesInterpolants< Meshes::Grid< MeshDimension, MeshReal, Device, MeshIndex >,
-                                MeshDimension - 1,
-                                MeshDimension >,
-   CoFVMGradientNorm< Meshes::Grid< MeshDimension, MeshReal, Device, MeshIndex >, MeshDimension - 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< MeshDimension, MeshReal, Device, MeshIndex > MeshType;
-      typedef typename MeshType::CoordinatesType CoordinatesType;
-      typedef Real RealType;
-      typedef Device DeviceType;
-      typedef Index IndexType;
-      typedef CoFVMGradientNorm< MeshType, MeshDimension - 1, Real, Index > InnerOperator;
-      typedef MeshEntitiesInterpolants< MeshType, MeshDimension - 1, MeshDimension > OuterOperator;
-      typedef OperatorComposition< OuterOperator, InnerOperator > BaseType;
-      typedef ExactGradientNorm< MeshDimension, RealType > ExactOperatorType;
-      typedef Pointers::SharedPointer<  MeshType > MeshPointer;
-         
-      CoFVMGradientNorm( const OuterOperator& outerOperator,
-                            InnerOperator& innerOperator,
-                            const MeshPointer& mesh )
-      : BaseType( outerOperator, innerOperator, mesh )
-      {}
- 
-      void setEps( const RealType& eps )
-      {
-         this->getInnerOperator().setEps( eps );
-      }
- 
-      static constexpr int getPreimageEntitiesDimension() { return MeshDimension; };
-      static constexpr int getImageEntitiesDimension() { return MeshDimension; };
+public:
+   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, MeshDimension - 1, Real, Index > InnerOperator;
+   typedef MeshEntitiesInterpolants< MeshType, MeshDimension - 1, MeshDimension > OuterOperator;
+   typedef OperatorComposition< OuterOperator, InnerOperator > BaseType;
+   typedef ExactGradientNorm< MeshDimension, RealType > ExactOperatorType;
+   typedef Pointers::SharedPointer< MeshType > MeshPointer;
 
+   CoFVMGradientNorm( const OuterOperator& outerOperator, InnerOperator& innerOperator, const MeshPointer& mesh )
+   : BaseType( outerOperator, innerOperator, mesh )
+   {}
+
+   void
+   setEps( const RealType& eps )
+   {
+      this->getInnerOperator().setEps( eps );
+   }
+
+   static constexpr int
+   getPreimageEntitiesDimension()
+   {
+      return MeshDimension;
+   };
+   static constexpr int
+   getImageEntitiesDimension()
+   {
+      return MeshDimension;
+   };
 };
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class CoFVMGradientNorm< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, 0, Real, Index >
-   : public Operator< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Functions::MeshInteriorDomain, 1, 0, Real, Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class CoFVMGradientNorm< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, 0, Real, Index >
+: public Operator< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Functions::MeshInteriorDomain, 1, 0, Real, Index >
 {
-   public:
- 
+public:
    typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
    typedef Device DeviceType;
    typedef Index IndexType;
    typedef ExactGradientNorm< 1, RealType > ExactOperatorType;
- 
-   constexpr static int getPreimageEntitiesDimension() { return MeshType::getMeshDimension(); };
-   constexpr static int getImageEntitiesDimension() { return MeshType::getMeshDimension() - 1; };
- 
-   CoFVMGradientNorm()
-   : epsSquare( 0.0 ){}
+
+   constexpr static int
+   getPreimageEntitiesDimension()
+   {
+      return MeshType::getMeshDimension();
+   };
+   constexpr static int
+   getImageEntitiesDimension()
+   {
+      return MeshType::getMeshDimension() - 1;
+   };
+
+   CoFVMGradientNorm() : epsSquare( 0.0 ) {}
 
    template< typename MeshFunction, typename MeshEntity >
    __cuda_callable__
-   Real operator()( const MeshFunction& u,
-                    const MeshEntity& entity,
-                    const Real& time = 0.0 ) const
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time = 0.0 ) const
    {
-      static_assert( MeshFunction::getMeshDimension() == 1,
-         "The mesh function u must be stored on mesh cells.." );
+      static_assert( MeshFunction::getMeshDimension() == 1, "The mesh function u must be stored on mesh cells.." );
       static_assert( MeshEntity::getMeshDimension() == 0,
-         "The complementary finite volume gradient norm may be evaluated only on faces." );
+                     "The complementary finite volume gradient norm may be evaluated only on faces." );
       const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.template getNeighborEntities< 1 >();
- 
+
       const RealType& hxDiv = entity.getMesh().template getSpaceStepsProducts< -1 >();
-      const RealType& u_x = ( u[ neighborEntities.template getEntityIndex<  1 >() ] -
-                              u[ neighborEntities.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 ) );
    }
- 
-   void setEps( const Real& eps )
+
+   void
+   setEps( const Real& eps )
    {
-      this->epsSquare = eps*eps;
+      this->epsSquare = eps * eps;
    }
- 
-   private:
- 
+
+private:
    RealType epsSquare;
 };
 
-
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 class CoFVMGradientNorm< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, 1, Real, Index >
-   : public Operator< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Functions::MeshInteriorDomain, 2, 1, Real, Index >
+: public Operator< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Functions::MeshInteriorDomain, 2, 1, Real, Index >
 {
-   public:
- 
+public:
    typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
    typedef Device DeviceType;
    typedef Index IndexType;
    typedef ExactGradientNorm< 2, RealType > ExactOperatorType;
- 
-   constexpr static int getPreimageEntitiesDimension() { return MeshType::getMeshDimension(); };
-   constexpr static int getImageEntitiesDimension() { return MeshType::getMeshDimension() - 1; };
- 
-   CoFVMGradientNorm()
-   : epsSquare( 0.0 ){}
+
+   constexpr static int
+   getPreimageEntitiesDimension()
+   {
+      return MeshType::getMeshDimension();
+   };
+   constexpr static int
+   getImageEntitiesDimension()
+   {
+      return MeshType::getMeshDimension() - 1;
+   };
+
+   CoFVMGradientNorm() : epsSquare( 0.0 ) {}
 
    template< typename MeshFunction, typename MeshEntity >
    __cuda_callable__
-   Real operator()( const MeshFunction& u,
-                    const MeshEntity& entity,
-                    const Real& time = 0.0 ) const
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time = 0.0 ) const
    {
-      static_assert( MeshFunction::getMeshDimension() == 2,
-         "The mesh function u must be stored on mesh cells.." );
+      static_assert( MeshFunction::getMeshDimension() == 2, "The mesh function u must be stored on mesh cells.." );
       static_assert( MeshEntity::getMeshDimension() == 1,
-         "The complementary finite volume gradient norm may be evaluated only on faces." );
+                     "The complementary finite volume gradient norm may be evaluated only on faces." );
       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[ neighborEntities.template getEntityIndex<  1, 0 >()] -
-              u[ neighborEntities.template getEntityIndex< -1, 0 >()] ) * hxDiv;
+      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[ neighborEntities.template getEntityIndex< 1, 0 >() ]
+                                - u[ neighborEntities.template getEntityIndex< -1, 0 >() ] )
+                            * hxDiv;
          RealType u_y;
-         if( entity.getCoordinates().y() > 0 )
-         {
+         if( entity.getCoordinates().y() > 0 ) {
             if( entity.getCoordinates().y() < entity.getMesh().getDimensions().y() - 1 )
-               u_y = 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 >() ] ) * hyDiv;
-            else // if( entity.getCoordinates().y() < entity.getMesh().getDimensions().y() - 1 )
-               u_y = 0.5 *
-                  ( 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;
+               u_y = 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 >() ] )
+                   * hyDiv;
+            else  // if( entity.getCoordinates().y() < entity.getMesh().getDimensions().y() - 1 )
+               u_y = 0.5
+                   * ( 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 )
+         else  // if( entity.getCoordinates().y() > 0 )
          {
-            u_y = 0.5 *
-               ( 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;
+            u_y = 0.5
+                * ( 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 );
       }
       RealType u_x;
-      if( entity.getCoordinates().x() > 0 )
-      {
+      if( entity.getCoordinates().x() > 0 ) {
          if( entity.getCoordinates().x() < entity.getMesh().getDimensions().x() - 1 )
-            u_x = 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 >() ] ) * hxDiv;
-         else // if( entity.getCoordinates().x() < entity.getMesh().getDimensions().x() - 1 )
-            u_x = 0.5 *
-            ( 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;
+            u_x = 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 >() ] )
+                * hxDiv;
+         else  // if( entity.getCoordinates().x() < entity.getMesh().getDimensions().x() - 1 )
+            u_x = 0.5
+                * ( 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 )
+      else  // if( entity.getCoordinates().x() > 0 )
       {
-         u_x = 0.5 *
-            ( 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;
+         u_x = 0.5
+             * ( 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[ neighborEntities.template getEntityIndex< 0,  1 >()] -
-           u[ neighborEntities.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 );
    }
- 
-   void setEps( const Real& eps )
+
+   void
+   setEps( const Real& eps )
    {
-      this->epsSquare = eps*eps;
+      this->epsSquare = eps * eps;
    }
- 
-   private:
- 
+
+private:
    RealType epsSquare;
 };
 
-
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 class CoFVMGradientNorm< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, 2, Real, Index >
-   : public Operator< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Functions::MeshInteriorDomain, 3, 2, Real, Index >
+: public Operator< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Functions::MeshInteriorDomain, 3, 2, Real, Index >
 {
-   public:
- 
+public:
    typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
    typedef Device DeviceType;
    typedef Index IndexType;
    typedef ExactGradientNorm< 3, RealType > ExactOperatorType;
- 
-   constexpr static int getPreimageEntitiesDimension() { return MeshType::getMeshDimension(); };
-   constexpr static int getImageEntitiesDimension() { return MeshType::getMeshDimension() - 1; };
- 
-   CoFVMGradientNorm()
-   : epsSquare( 0.0 ){}
+
+   constexpr static int
+   getPreimageEntitiesDimension()
+   {
+      return MeshType::getMeshDimension();
+   };
+   constexpr static int
+   getImageEntitiesDimension()
+   {
+      return MeshType::getMeshDimension() - 1;
+   };
+
+   CoFVMGradientNorm() : epsSquare( 0.0 ) {}
 
    template< typename MeshFunction, typename MeshEntity >
    __cuda_callable__
-   Real operator()( const MeshFunction& u,
-                    const MeshEntity& entity,
-                    const Real& time = 0.0 ) const
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time = 0.0 ) const
    {
-      static_assert( MeshFunction::getMeshDimension() == 3,
-         "The mesh function u must be stored on mesh cells.." );
+      static_assert( MeshFunction::getMeshDimension() == 3, "The mesh function u must be stored on mesh cells.." );
       static_assert( MeshEntity::getMeshDimension() == 2,
-         "The complementary finite volume gradient norm may be evaluated only on faces." );
+                     "The complementary finite volume gradient norm may be evaluated only on faces." );
       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[ neighborEntities.template getEntityIndex<  1,  0,  0 >()] -
-              u[ neighborEntities.template getEntityIndex< -1,  0,  0 >()] ) * hxDiv;
+      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[ 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[ 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;
+         if( entity.getCoordinates().y() > 0 ) {
+            if( entity.getCoordinates().y() < entity.getMesh().getDimensions().y() - 1 ) {
+               u_y = 0.25
+                   * ( 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 )
+            else  // if( entity.getCoordinates().y() < entity.getMesh().getDimensions().y() - 1 )
             {
-               u_y = 0.5 *
-               ( 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;
-
+               u_y = 0.5
+                   * ( 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 )
+         else  // if( entity.getCoordinates().y() > 0 )
          {
-            u_y = 0.5 *
-            ( 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;
-
+            u_y = 0.5
+                * ( 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;
-         if( entity.getCoordinates().z() > 0 )
-         {
-            if( entity.getCoordinates().z() < entity.getMesh().getDimensions().z() - 1 )
-            {
-               u_z = 0.25 *
-               ( 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;
+         if( entity.getCoordinates().z() > 0 ) {
+            if( entity.getCoordinates().z() < entity.getMesh().getDimensions().z() - 1 ) {
+               u_z = 0.25
+                   * ( 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 )
+            else  // if( entity.getCoordinates().z() < entity.getMesh().getDimensions().z() - 1 )
             {
-               u_z = 0.5 *
-               ( 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;
+               u_z = 0.5
+                   * ( 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 )
+         else  // if( entity.getCoordinates().z() > 0 )
          {
-            u_z = 0.5 *
-            ( 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;
+            u_z = 0.5
+                * ( 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 );
       }
-      if( entity.getOrientation().y() != 0.0 )
-      {
+      if( entity.getOrientation().y() != 0.0 ) {
          RealType u_x;
-         if( entity.getCoordinates().x() > 0 )
-         {
-            if( entity.getCoordinates().x() < entity.getMesh().getDimensions().x() - 1 )
-            {
-               u_x = 0.25 *
-               ( 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;
+         if( entity.getCoordinates().x() > 0 ) {
+            if( entity.getCoordinates().x() < entity.getMesh().getDimensions().x() - 1 ) {
+               u_x = 0.25
+                   * ( 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 )
+            else  // if( entity.getCoordinates().x() < entity.getMesh().getDimensions().x() - 1 )
             {
-               u_x = 0.5 *
-               ( 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;
+               u_x = 0.5
+                   * ( 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 )
+         else  // if( entity.getCoordinates().x() > 0 )
          {
-            u_x = 0.5 *
-            ( 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;
+            u_x = 0.5
+                * ( 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[ neighborEntities.template getEntityIndex<  0,  1,  0 >()] -
-              u[ neighborEntities.template getEntityIndex<  0, -1,  0 >()] ) * hyDiv;
+         const RealType u_y = ( 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[ 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;
+         if( entity.getCoordinates().z() > 0 ) {
+            if( entity.getCoordinates().z() < entity.getMesh().getDimensions().z() - 1 ) {
+               u_z = 0.25
+                   * ( 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 )
+            else  // if( entity.getCoordinates().z() < entity.getMesh().getDimensions().z() - 1 )
             {
-               u_z = 0.5 *
-               ( 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;
+               u_z = 0.5
+                   * ( 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 )
+         else  // if( entity.getCoordinates().z() > 0 )
          {
-            u_z = 0.5 *
-            ( 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;
+            u_z = 0.5
+                * ( 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 );
       }
       RealType u_x;
-      if( entity.getCoordinates().x() > 0 )
-      {
-         if( entity.getCoordinates().x() < entity.getMesh().getDimensions().x() - 1 )
-         {
-            u_x = 0.25 *
-            ( 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;
+      if( entity.getCoordinates().x() > 0 ) {
+         if( entity.getCoordinates().x() < entity.getMesh().getDimensions().x() - 1 ) {
+            u_x = 0.25
+                * ( 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 )
+         else  // if( entity.getCoordinates().x() < entity.getMesh().getDimensions().x() - 1 )
          {
-            u_x = 0.5 *
-            ( 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;
-
+            u_x = 0.5
+                * ( 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 )
+      else  // if( entity.getCoordinates().x() > 0 )
       {
-         u_x = 0.5 *
-         ( 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;
+         u_x = 0.5
+             * ( 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 )
-      {
-         if( entity.getCoordinates().y() < entity.getMesh().getDimensions().y() - 1 )
-         {
-            u_y = 0.25 *
-            ( 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;
+      if( entity.getCoordinates().y() > 0 ) {
+         if( entity.getCoordinates().y() < entity.getMesh().getDimensions().y() - 1 ) {
+            u_y = 0.25
+                * ( 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 )
+         else  // if( entity.getCoordinates().y() < entity.getMesh().getDimensions().y() - 1 )
          {
-            u_y = 0.5 *
-            ( 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;
+            u_y = 0.5
+                * ( 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 )
+      else  // if( entity.getCoordinates().y() > 0 )
       {
-         u_y = 0.5 *
-         ( 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;
+         u_y = 0.5
+             * ( 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[ neighborEntities.template getEntityIndex<  0,  0,  1 >()] -
-           u[ neighborEntities.template getEntityIndex<  0,  0, -1 >()] ) * hzDiv;
+      const RealType u_z = ( 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 );
    }
- 
- 
-   void setEps(const Real& eps)
+
+   void
+   setEps( const Real& eps )
    {
-      this->epsSquare = eps*eps;
+      this->epsSquare = eps * eps;
    }
- 
-   private:
- 
+
+private:
    RealType epsSquare;
 };
 
-} // namespace Operators
-} // namespace TNL
-
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/geometric/ExactGradientNorm.h b/src/TNL/Operators/geometric/ExactGradientNorm.h
index 127f00e0b58c68458a7b83f70ad92679bacd03f9..5f1d3761fb48e43cc0f464c4a4debf4e47bc89f7 100644
--- a/src/TNL/Operators/geometric/ExactGradientNorm.h
+++ b/src/TNL/Operators/geometric/ExactGradientNorm.h
@@ -10,10 +10,9 @@
 #include <TNL/Functions/Domain.h>
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
-template< int Dimension,
-          typename Real = double >
+template< int Dimension, typename Real = double >
 class ExactGradientNorm
 {};
 
@@ -21,222 +20,194 @@ class ExactGradientNorm
  * 1D
  */
 template< typename Real >
-class ExactGradientNorm< 1, Real >
-   : public Functions::Domain< 1, Functions::SpaceDomain >
+class ExactGradientNorm< 1, Real > : public Functions::Domain< 1, Functions::SpaceDomain >
 {
-   public:
-
-      ExactGradientNorm()
-      : epsilonSquare( 0.0 ){};
-
-      void setRegularizationEpsilon( const Real& epsilon )
-      {
-         this->epsilonSquare = epsilon*epsilon;
-      }
- 
-      template< typename Function >
-      __cuda_callable__
-      typename Function::RealType
-         operator()( const Function& function,
-                     const typename Function::PointType& v,
-                     const typename Function::RealType& time = 0.0 ) const
-      {
-         typedef typename Function::RealType RealType;
+public:
+   ExactGradientNorm() : epsilonSquare( 0.0 ){};
+
+   void
+   setRegularizationEpsilon( const Real& epsilon )
+   {
+      this->epsilonSquare = epsilon * epsilon;
+   }
+
+   template< typename Function >
+   __cuda_callable__
+   typename Function::RealType
+   operator()( const Function& function,
+               const typename Function::PointType& v,
+               const typename Function::RealType& time = 0.0 ) const
+   {
+      typedef typename Function::RealType RealType;
+      const RealType f_x = function.template getPartialDerivative< 1, 0, 0 >( v, time );
+      return ::sqrt( this->epsilonSquare + f_x * f_x );
+   }
+
+   template< typename Function, int XDerivative = 0, int YDerivative = 0, int ZDerivative = 0 >
+   __cuda_callable__
+   typename Function::RealType
+   getPartialDerivative( const Function& function,
+                         const typename Function::PointType& v,
+                         const typename Function::RealType& time = 0.0 ) const
+   {
+      static_assert( XDerivative >= 0 && YDerivative >= 0 && ZDerivative >= 0,
+                     "Partial derivative must be non-negative integer." );
+      static_assert( XDerivative < 2, "Partial derivative of higher order then 1 are not implemented yet." );
+      typedef typename Function::RealType RealType;
+
+      if( XDerivative == 1 ) {
          const RealType f_x = function.template getPartialDerivative< 1, 0, 0 >( v, time );
-         return ::sqrt( this->epsilonSquare + f_x * f_x );
+         const RealType f_xx = function.template getPartialDerivative< 2, 0, 0 >( v, time );
+         const RealType Q = ::sqrt( this->epsilonSquare + f_x * f_x );
+         return ( f_x * f_xx ) / Q;
       }
- 
-      template< typename Function,
-                int XDerivative = 0,
-                int YDerivative = 0,
-                int ZDerivative = 0 >
-      __cuda_callable__
-      typename Function::RealType
-         getPartialDerivative( const Function& function,
-                               const typename Function::PointType& v,
-                               const typename Function::RealType& time = 0.0 ) const
-      {
-         static_assert( XDerivative >= 0 && YDerivative >= 0 && ZDerivative >= 0,
-            "Partial derivative must be non-negative integer." );
-         static_assert( XDerivative < 2, "Partial derivative of higher order then 1 are not implemented yet." );
-         typedef typename Function::RealType RealType;
- 
-         if( XDerivative == 1 )
-         {
-            const RealType f_x = function.template getPartialDerivative< 1, 0, 0 >( v, time );
-            const RealType f_xx = function.template getPartialDerivative< 2, 0, 0 >( v, time );
-            const RealType Q = ::sqrt( this->epsilonSquare + f_x * f_x );
-            return ( f_x * f_xx ) / Q;
-         }
-         if( XDerivative == 0 )
-            return this->operator()( function, v, time );
-         if( YDerivative != 0 || ZDerivative != 0 )
-            return 0.0;
-      }
- 
-      protected:
- 
-         Real epsilonSquare;
+      if( XDerivative == 0 )
+         return this->operator()( function, v, time );
+      if( YDerivative != 0 || ZDerivative != 0 )
+         return 0.0;
+   }
+
+protected:
+   Real epsilonSquare;
 };
 
-
 /****
  * 2D
  */
 template< typename Real >
-class ExactGradientNorm< 2, Real >
-   : public Functions::Domain< 2, Functions::SpaceDomain >
+class ExactGradientNorm< 2, Real > : public Functions::Domain< 2, Functions::SpaceDomain >
 {
-   public:
-
-      ExactGradientNorm()
-      : epsilonSquare( 0.0 ){};
-
-      void setRegularizationEpsilon( const Real& epsilon )
-      {
-         this->epsilonSquare = epsilon*epsilon;
-      }
- 
-      template< typename Function >
-      __cuda_callable__
-      typename Function::RealType
-         operator()( const Function& function,
-                     const typename Function::PointType& v,
-                     const typename Function::RealType& time = 0.0 ) const
-      {
-         typedef typename Function::RealType RealType;
+public:
+   ExactGradientNorm() : epsilonSquare( 0.0 ){};
+
+   void
+   setRegularizationEpsilon( const Real& epsilon )
+   {
+      this->epsilonSquare = epsilon * epsilon;
+   }
+
+   template< typename Function >
+   __cuda_callable__
+   typename Function::RealType
+   operator()( const Function& function,
+               const typename Function::PointType& v,
+               const typename Function::RealType& time = 0.0 ) const
+   {
+      typedef typename Function::RealType RealType;
+      const RealType f_x = function.template getPartialDerivative< 1, 0, 0 >( v, time );
+      const RealType f_y = function.template getPartialDerivative< 0, 1, 0 >( v, time );
+      return ::sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y );
+   }
+
+   template< typename Function, int XDerivative = 0, int YDerivative = 0, int ZDerivative = 0 >
+   __cuda_callable__
+   typename Function::RealType
+   getPartialDerivative( const Function& function,
+                         const typename Function::PointType& v,
+                         const typename Function::RealType& time = 0.0 ) const
+   {
+      static_assert( XDerivative >= 0 && YDerivative >= 0 && ZDerivative >= 0,
+                     "Partial derivative must be non-negative integer." );
+      static_assert( XDerivative < 2 && YDerivative < 2, "Partial derivative of higher order then 1 are not implemented yet." );
+      typedef typename Function::RealType RealType;
+
+      if( XDerivative == 1 && YDerivative == 0 ) {
          const RealType f_x = function.template getPartialDerivative< 1, 0, 0 >( v, time );
          const RealType f_y = function.template getPartialDerivative< 0, 1, 0 >( v, time );
-         return ::sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y );
+         const RealType f_xx = function.template getPartialDerivative< 2, 0, 0 >( v, time );
+         const RealType f_xy = function.template getPartialDerivative< 1, 1, 0 >( v, time );
+         return ( f_x * f_xx + f_y * f_xy ) / ::sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y );
       }
- 
-      template< typename Function,
-                int XDerivative = 0,
-                int YDerivative = 0,
-                int ZDerivative = 0 >
-      __cuda_callable__
-      typename Function::RealType
-         getPartialDerivative( const Function& function,
-                               const typename Function::PointType& v,
-                               const typename Function::RealType& time = 0.0 ) const
-      {
-         static_assert( XDerivative >= 0 && YDerivative >= 0 && ZDerivative >= 0,
-            "Partial derivative must be non-negative integer." );
-         static_assert( XDerivative < 2 && YDerivative < 2, "Partial derivative of higher order then 1 are not implemented yet." );
-         typedef typename Function::RealType RealType;
- 
-         if( XDerivative == 1 && YDerivative == 0 )
-         {
-            const RealType f_x  = function.template getPartialDerivative< 1, 0, 0 >( v, time );
-            const RealType f_y  = function.template getPartialDerivative< 0, 1, 0 >( v, time );
-            const RealType f_xx = function.template getPartialDerivative< 2, 0, 0 >( v, time );
-            const RealType f_xy = function.template getPartialDerivative< 1, 1, 0 >( v, time );
-            return ( f_x *  f_xx + f_y * f_xy ) / ::sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y );
-         }
-         if( XDerivative == 0 && YDerivative == 1 )
-         {
-            const RealType f_x  = function.template getPartialDerivative< 1, 0, 0 >( v, time );
-            const RealType f_y  = function.template getPartialDerivative< 0, 1, 0 >( v, time );
-            const RealType f_xy = function.template getPartialDerivative< 1, 1, 0 >( v, time );
-            const RealType f_yy = function.template getPartialDerivative< 0, 2, 0 >( v, time );
-            return ( f_x *  f_xy + f_y * f_yy ) / ::sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y );
-         }
-         if( XDerivative == 0 && YDerivative == 0 )
-            return this->operator()( function, v, time );
-         if( ZDerivative > 0 )
-            return 0.0;
+      if( XDerivative == 0 && YDerivative == 1 ) {
+         const RealType f_x = function.template getPartialDerivative< 1, 0, 0 >( v, time );
+         const RealType f_y = function.template getPartialDerivative< 0, 1, 0 >( v, time );
+         const RealType f_xy = function.template getPartialDerivative< 1, 1, 0 >( v, time );
+         const RealType f_yy = function.template getPartialDerivative< 0, 2, 0 >( v, time );
+         return ( f_x * f_xy + f_y * f_yy ) / ::sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y );
       }
- 
-      protected:
- 
-         Real epsilonSquare;
+      if( XDerivative == 0 && YDerivative == 0 )
+         return this->operator()( function, v, time );
+      if( ZDerivative > 0 )
+         return 0.0;
+   }
+
+protected:
+   Real epsilonSquare;
 };
 
 template< typename Real >
-class ExactGradientNorm< 3, Real >
-   : public Functions::Domain< 3, Functions::SpaceDomain >
+class ExactGradientNorm< 3, Real > : public Functions::Domain< 3, Functions::SpaceDomain >
 {
-   public:
-
-      ExactGradientNorm()
-      : epsilonSquare( 0.0 ){};
-
-      void setRegularizationEpsilon( const Real& epsilon )
-      {
-         this->epsilonSquare = epsilon*epsilon;
+public:
+   ExactGradientNorm() : epsilonSquare( 0.0 ){};
+
+   void
+   setRegularizationEpsilon( const Real& epsilon )
+   {
+      this->epsilonSquare = epsilon * epsilon;
+   }
+
+   template< typename Function >
+   __cuda_callable__
+   typename Function::RealType
+   operator()( const Function& function,
+               const typename Function::PointType& v,
+               const typename Function::RealType& time = 0.0 ) const
+   {
+      typedef typename Function::RealType RealType;
+      const RealType f_x = function.template getPartialDerivative< 1, 0, 0 >( v, time );
+      const RealType f_y = function.template getPartialDerivative< 0, 1, 0 >( v, time );
+      const RealType f_z = function.template getPartialDerivative< 0, 0, 1 >( v, time );
+      return std::sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y + f_z * f_z );
+   }
+
+   template< typename Function, int XDerivative = 0, int YDerivative = 0, int ZDerivative = 0 >
+   __cuda_callable__
+   typename Function::RealType
+   getPartialDerivative( const Function& function,
+                         const typename Function::PointType& v,
+                         const typename Function::RealType& time = 0.0 ) const
+   {
+      static_assert( XDerivative >= 0 && YDerivative >= 0 && ZDerivative >= 0,
+                     "Partial derivative must be non-negative integer." );
+      static_assert( XDerivative < 2 && YDerivative < 2 && ZDerivative < 2,
+                     "Partial derivative of higher order then 1 are not implemented yet." );
+
+      typedef typename Function::RealType RealType;
+      if( XDerivative == 1 && YDerivative == 0 && ZDerivative == 0 ) {
+         const RealType f_x = function.template getPartialDerivative< 1, 0, 0 >( v, time );
+         const RealType f_y = function.template getPartialDerivative< 0, 1, 0 >( v, time );
+         const RealType f_z = function.template getPartialDerivative< 0, 0, 1 >( v, time );
+         const RealType f_xx = function.template getPartialDerivative< 2, 0, 0 >( v, time );
+         const RealType f_xy = function.template getPartialDerivative< 1, 1, 0 >( v, time );
+         const RealType f_xz = function.template getPartialDerivative< 1, 0, 1 >( v, time );
+         return ( f_x * f_xx + f_y * f_xy + f_z * f_xz ) / std::sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y + f_z * f_z );
       }
- 
-      template< typename Function >
-      __cuda_callable__
-      typename Function::RealType
-         operator()( const Function& function,
-                     const typename Function::PointType& v,
-                     const typename Function::RealType& time = 0.0 ) const
-      {
-         typedef typename Function::RealType RealType;
+      if( XDerivative == 0 && YDerivative == 1 && ZDerivative == 0 ) {
          const RealType f_x = function.template getPartialDerivative< 1, 0, 0 >( v, time );
          const RealType f_y = function.template getPartialDerivative< 0, 1, 0 >( v, time );
          const RealType f_z = function.template getPartialDerivative< 0, 0, 1 >( v, time );
-         return std::sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y + f_z * f_z );
+         const RealType f_xy = function.template getPartialDerivative< 1, 1, 0 >( v, time );
+         const RealType f_yy = function.template getPartialDerivative< 0, 2, 0 >( v, time );
+         const RealType f_yz = function.template getPartialDerivative< 0, 1, 1 >( v, time );
+         return ( f_x * f_xy + f_y * f_yy + f_z * f_yz ) / std::sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y + f_z * f_z );
       }
- 
-      template< typename Function,
-                int XDerivative = 0,
-                int YDerivative = 0,
-                int ZDerivative = 0 >
-      __cuda_callable__
-      typename Function::RealType
-         getPartialDerivative( const Function& function,
-                               const typename Function::PointType& v,
-                               const typename Function::RealType& time = 0.0 ) const
-      {
-         static_assert( XDerivative >= 0 && YDerivative >= 0 && ZDerivative >= 0,
-            "Partial derivative must be non-negative integer." );
-         static_assert( XDerivative < 2 && YDerivative < 2 && ZDerivative < 2,
-            "Partial derivative of higher order then 1 are not implemented yet." );
-
-         typedef typename Function::RealType RealType;
-         if( XDerivative == 1 && YDerivative == 0 && ZDerivative == 0 )
-         {
-            const RealType f_x  = function.template getPartialDerivative< 1, 0, 0 >( v, time );
-            const RealType f_y  = function.template getPartialDerivative< 0, 1, 0 >( v, time );
-            const RealType f_z  = function.template getPartialDerivative< 0, 0, 1 >( v, time );
-            const RealType f_xx = function.template getPartialDerivative< 2, 0, 0 >( v, time );
-            const RealType f_xy = function.template getPartialDerivative< 1, 1, 0 >( v, time );
-            const RealType f_xz = function.template getPartialDerivative< 1, 0, 1 >( v, time );
-            return ( f_x *  f_xx + f_y * f_xy + f_z * f_xz ) /
-               std::sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y + f_z * f_z );
-         }
-         if( XDerivative == 0 && YDerivative == 1 && ZDerivative == 0 )
-         {
-            const RealType f_x  = function.template getPartialDerivative< 1, 0, 0 >( v, time );
-            const RealType f_y  = function.template getPartialDerivative< 0, 1, 0 >( v, time );
-            const RealType f_z  = function.template getPartialDerivative< 0, 0, 1 >( v, time );
-            const RealType f_xy = function.template getPartialDerivative< 1, 1, 0 >( v, time );
-            const RealType f_yy = function.template getPartialDerivative< 0, 2, 0 >( v, time );
-            const RealType f_yz = function.template getPartialDerivative< 0, 1, 1 >( v, time );
-            return ( f_x *  f_xy + f_y * f_yy + f_z * f_yz ) /
-               std::sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y + f_z * f_z );
-         }
-         if( XDerivative == 0 && YDerivative == 0 && ZDerivative == 1 )
-         {
-            const RealType f_x  = function.template getPartialDerivative< 1, 0, 0 >( v, time );
-            const RealType f_y  = function.template getPartialDerivative< 0, 1, 0 >( v, time );
-            const RealType f_z  = function.template getPartialDerivative< 0, 0, 1 >( v, time );
-            const RealType f_xz = function.template getPartialDerivative< 1, 0, 1 >( v, time );
-            const RealType f_yz = function.template getPartialDerivative< 0, 1, 1 >( v, time );
-            const RealType f_zz = function.template getPartialDerivative< 0, 0, 2 >( v, time );
-            return ( f_x *  f_xz + f_y * f_yz + f_z * f_zz ) /
-               std::sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y + f_z * f_z );
-         }
-         if( XDerivative == 0 && YDerivative == 0 && ZDerivative == 0 )
-            return this->operator()( function, v, time );
+      if( XDerivative == 0 && YDerivative == 0 && ZDerivative == 1 ) {
+         const RealType f_x = function.template getPartialDerivative< 1, 0, 0 >( v, time );
+         const RealType f_y = function.template getPartialDerivative< 0, 1, 0 >( v, time );
+         const RealType f_z = function.template getPartialDerivative< 0, 0, 1 >( v, time );
+         const RealType f_xz = function.template getPartialDerivative< 1, 0, 1 >( v, time );
+         const RealType f_yz = function.template getPartialDerivative< 0, 1, 1 >( v, time );
+         const RealType f_zz = function.template getPartialDerivative< 0, 0, 2 >( v, time );
+         return ( f_x * f_xz + f_y * f_yz + f_z * f_zz ) / std::sqrt( this->epsilonSquare + f_x * f_x + f_y * f_y + f_z * f_z );
       }
- 
-      protected:
- 
-         Real epsilonSquare;
+      if( XDerivative == 0 && YDerivative == 0 && ZDerivative == 0 )
+         return this->operator()( function, v, time );
+   }
+
+protected:
+   Real epsilonSquare;
 };
 
-} // namespace Operators
-} // namespace TNL
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/geometric/FDMGradientNorm.h b/src/TNL/Operators/geometric/FDMGradientNorm.h
index 2a6027fcb501a28bbacf4432ec1d22b1bae4990a..222ba91659b00a15eda1bece980615f69afb2396 100644
--- a/src/TNL/Operators/geometric/FDMGradientNorm.h
+++ b/src/TNL/Operators/geometric/FDMGradientNorm.h
@@ -11,173 +11,156 @@
 #include <TNL/Operators/Operator.h>
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
 template< typename Mesh,
           template< typename, int, int, int, typename, typename > class DifferenceOperatorTemplate = ForwardFiniteDifference,
           typename Real = typename Mesh::RealType,
           typename Index = typename Mesh::GlobalIndexType >
 class FDMGradientNorm
-{
-};
+{};
 
 template< typename MeshReal,
           typename Device,
           typename MeshIndex,
-          template< typename, int, int, int, typename, typename > class DifferenceOperatorTemplate,
+          template< typename, int, int, int, typename, typename >
+          class DifferenceOperatorTemplate,
           typename Real,
           typename Index >
-class FDMGradientNorm< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, DifferenceOperatorTemplate, Real, Index >
-   : public Operator< Meshes::Grid< 1, MeshReal, Device, MeshIndex >,
-                         Functions::MeshInteriorDomain, 1, 1, Real, Index >
+class FDMGradientNorm< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, DifferenceOperatorTemplate, Real, Index >
+: public Operator< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Functions::MeshInteriorDomain, 1, 1, Real, Index >
 {
-   public:
- 
+public:
    typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
    typedef Device DeviceType;
    typedef Index IndexType;
    typedef ExactGradientNorm< 1, RealType > ExactOperatorType;
- 
+
    template< typename MeshEntity = typename MeshType::Cell >
    using XDifferenceOperatorType = DifferenceOperatorTemplate< typename MeshEntity::MeshType, 1, 0, 0, Real, Index >;
- 
-   FDMGradientNorm()
-   : epsSquare( 0.0 ){}
+
+   FDMGradientNorm() : epsSquare( 0.0 ) {}
 
    template< typename MeshFunction, typename MeshEntity >
    __cuda_callable__
-   Real operator()( const MeshFunction& u,
-                    const MeshEntity& entity,
-                    const Real& time = 0.0 ) const
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time = 0.0 ) const
    {
       XDifferenceOperatorType< MeshEntity > XDifference;
       const RealType u_x = XDifference( u, entity );
       return ::sqrt( this->epsSquare + u_x * u_x );
    }
- 
-   void setEps( const Real& eps )
+
+   void
+   setEps( const Real& eps )
    {
-      this->epsSquare = eps*eps;
+      this->epsSquare = eps * eps;
    }
- 
-   private:
- 
+
+private:
    RealType epsSquare;
 };
 
-
 template< typename MeshReal,
           typename Device,
           typename MeshIndex,
-          template< typename, int, int, int, typename, typename > class DifferenceOperatorTemplate,
+          template< typename, int, int, int, typename, typename >
+          class DifferenceOperatorTemplate,
           typename Real,
           typename Index >
-class FDMGradientNorm< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, DifferenceOperatorTemplate, Real, Index >
-   : public Operator< Meshes::Grid< 2, MeshReal, Device, MeshIndex >,
-                         Functions::MeshInteriorDomain, 2, 2, Real, Index >
+class FDMGradientNorm< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, DifferenceOperatorTemplate, Real, Index >
+: public Operator< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Functions::MeshInteriorDomain, 2, 2, Real, Index >
 {
-   public:
- 
-      typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
-      typedef typename MeshType::CoordinatesType CoordinatesType;
-      typedef Real RealType;
-      typedef Device DeviceType;
-      typedef Index IndexType;
-      typedef ExactGradientNorm< 2, RealType > ExactOperatorType;
- 
-      template< typename MeshEntity >
-      using XDifferenceOperatorType = DifferenceOperatorTemplate< typename MeshEntity::MeshType, 1, 0, 0, Real, Index >;
-      template< typename MeshEntity >
-      using YDifferenceOperatorType = DifferenceOperatorTemplate< typename MeshEntity::MeshType, 0, 1, 0, Real, Index >;
-
-      FDMGradientNorm()
-      : epsSquare( 0.0 ){}
-
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      Real operator()( const MeshFunction& u,
-                       const MeshEntity& entity,
-                       const Real& time = 0.0 ) const
-      {
-         XDifferenceOperatorType< MeshEntity > XDifference;
-         YDifferenceOperatorType< MeshEntity > YDifference;
-         const RealType u_x = XDifference( u, entity );
-         const RealType u_y = YDifference( u, entity );
-         return ::sqrt( this->epsSquare + u_x * u_x + u_y * u_y );
-      }
-
-
-
-      void setEps( const Real& eps )
-      {
-         this->epsSquare = eps*eps;
-      }
- 
-   private:
- 
-      RealType epsSquare;
-};
+public:
+   typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
+   typedef typename MeshType::CoordinatesType CoordinatesType;
+   typedef Real RealType;
+   typedef Device DeviceType;
+   typedef Index IndexType;
+   typedef ExactGradientNorm< 2, RealType > ExactOperatorType;
+
+   template< typename MeshEntity >
+   using XDifferenceOperatorType = DifferenceOperatorTemplate< typename MeshEntity::MeshType, 1, 0, 0, Real, Index >;
+   template< typename MeshEntity >
+   using YDifferenceOperatorType = DifferenceOperatorTemplate< typename MeshEntity::MeshType, 0, 1, 0, Real, Index >;
+
+   FDMGradientNorm() : epsSquare( 0.0 ) {}
+
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time = 0.0 ) const
+   {
+      XDifferenceOperatorType< MeshEntity > XDifference;
+      YDifferenceOperatorType< MeshEntity > YDifference;
+      const RealType u_x = XDifference( u, entity );
+      const RealType u_y = YDifference( u, entity );
+      return ::sqrt( this->epsSquare + u_x * u_x + u_y * u_y );
+   }
+
+   void
+   setEps( const Real& eps )
+   {
+      this->epsSquare = eps * eps;
+   }
 
+private:
+   RealType epsSquare;
+};
 
 template< typename MeshReal,
           typename Device,
           typename MeshIndex,
-          template< typename, int, int, int, typename, typename > class DifferenceOperatorTemplate,
+          template< typename, int, int, int, typename, typename >
+          class DifferenceOperatorTemplate,
           typename Real,
           typename Index >
 class FDMGradientNorm< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, DifferenceOperatorTemplate, Real, Index >
-   : public Operator< Meshes::Grid< 3, MeshReal, Device, MeshIndex >,
-                         Functions::MeshInteriorDomain, 3, 3, Real, Index >
+: public Operator< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Functions::MeshInteriorDomain, 3, 3, Real, Index >
 {
-   public:
- 
-      typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
-      typedef typename MeshType::CoordinatesType CoordinatesType;
-      typedef Real RealType;
-      typedef Device DeviceType;
-      typedef Index IndexType;
-      typedef ExactGradientNorm< 3, RealType > ExactOperatorType;
- 
-      template< typename MeshEntity >
-      using XDifferenceOperatorType = DifferenceOperatorTemplate< typename MeshEntity::MeshType, 1, 0, 0, Real, Index >;
-      template< typename MeshEntity >
-      using YDifferenceOperatorType = DifferenceOperatorTemplate< typename MeshEntity::MeshType, 0, 1, 0, Real, Index >;
-      template< typename MeshEntity >
-      using ZDifferenceOperatorType = DifferenceOperatorTemplate< typename MeshEntity::MeshType, 0, 0, 1, Real, Index >;
-
- 
-      FDMGradientNorm()
-      : epsSquare( 0.0 ){}
-
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      Real operator()( const MeshFunction& u,
-                       const MeshEntity& entity,
-                       const Real& time = 0.0 ) const
-      {
-         XDifferenceOperatorType< MeshEntity > XDifference;
-         YDifferenceOperatorType< MeshEntity > YDifference;
-         ZDifferenceOperatorType< MeshEntity > ZDifference;
-
-         const RealType u_x = XDifference( u, entity );
-         const RealType u_y = YDifference( u, entity );
-         const RealType u_z = ZDifference( u, entity );
-         return ::sqrt( this->epsSquare + u_x * u_x + u_y * u_y + u_z * u_z );
-      }
-
-
-      void setEps(const Real& eps)
-      {
-         this->epsSquare = eps*eps;
-      }
- 
-   private:
- 
-      RealType epsSquare;
-};
+public:
+   typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
+   typedef typename MeshType::CoordinatesType CoordinatesType;
+   typedef Real RealType;
+   typedef Device DeviceType;
+   typedef Index IndexType;
+   typedef ExactGradientNorm< 3, RealType > ExactOperatorType;
+
+   template< typename MeshEntity >
+   using XDifferenceOperatorType = DifferenceOperatorTemplate< typename MeshEntity::MeshType, 1, 0, 0, Real, Index >;
+   template< typename MeshEntity >
+   using YDifferenceOperatorType = DifferenceOperatorTemplate< typename MeshEntity::MeshType, 0, 1, 0, Real, Index >;
+   template< typename MeshEntity >
+   using ZDifferenceOperatorType = DifferenceOperatorTemplate< typename MeshEntity::MeshType, 0, 0, 1, Real, Index >;
+
+   FDMGradientNorm() : epsSquare( 0.0 ) {}
+
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time = 0.0 ) const
+   {
+      XDifferenceOperatorType< MeshEntity > XDifference;
+      YDifferenceOperatorType< MeshEntity > YDifference;
+      ZDifferenceOperatorType< MeshEntity > ZDifference;
+
+      const RealType u_x = XDifference( u, entity );
+      const RealType u_y = YDifference( u, entity );
+      const RealType u_z = ZDifference( u, entity );
+      return ::sqrt( this->epsSquare + u_x * u_x + u_y * u_y + u_z * u_z );
+   }
+
+   void
+   setEps( const Real& eps )
+   {
+      this->epsSquare = eps * eps;
+   }
 
-} // namespace Operators
-} // namespace TNL
+private:
+   RealType epsSquare;
+};
 
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/geometric/TwoSidedGradientNorm.h b/src/TNL/Operators/geometric/TwoSidedGradientNorm.h
index 8960e9ab8887fd1e4cdfd8e4dc0ecb10bedaf9d9..56c118ae2f4e50efc3b8cd4e73fbf08c464b2445 100644
--- a/src/TNL/Operators/geometric/TwoSidedGradientNorm.h
+++ b/src/TNL/Operators/geometric/TwoSidedGradientNorm.h
@@ -12,41 +12,30 @@
 #include <TNL/Operators/Operator.h>
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
-template< typename Mesh,
-          typename Real = typename Mesh::RealType,
-          typename Index = typename Mesh::GlobalIndexType >
+template< typename Mesh, typename Real = typename Mesh::RealType, typename Index = typename Mesh::GlobalIndexType >
 class TwoSidedGradientNorm
-{
-};
+{};
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class TwoSidedGradientNorm< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real, Index >
-   : public Operator< Meshes::Grid< 1, MeshReal, Device, MeshIndex >,
-                         Functions::MeshInteriorDomain, 1, 1, Real, Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class TwoSidedGradientNorm< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
+: public Operator< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Functions::MeshInteriorDomain, 1, 1, Real, Index >
 {
-   public:
- 
+public:
    typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
    typedef Device DeviceType;
    typedef Index IndexType;
    typedef ExactGradientNorm< 1, RealType > ExactOperatorType;
- 
-   TwoSidedGradientNorm()
-   : epsSquare( 0.0 ){}
+
+   TwoSidedGradientNorm() : epsSquare( 0.0 ) {}
 
    template< typename MeshFunction, typename MeshEntity >
    __cuda_callable__
-   Real operator()( const MeshFunction& u,
-                    const MeshEntity& entity,
-                    const Real& time = 0.0 ) const
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time = 0.0 ) const
    {
       ForwardFiniteDifference< typename MeshEntity::MeshType, 1, 0, 0, Real, Index > XForwardDifference;
       BackwardFiniteDifference< typename MeshEntity::MeshType, 1, 0, 0, Real, Index > XBackwardDifference;
@@ -54,44 +43,35 @@ class TwoSidedGradientNorm< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real,
       const RealType u_x_b = XBackwardDifference( u, entity );
       return ::sqrt( this->epsSquare + 0.5 * ( u_x_f * u_x_f + u_x_b * u_x_b ) );
    }
- 
-   void setEps( const Real& eps )
+
+   void
+   setEps( const Real& eps )
    {
-      this->epsSquare = eps*eps;
+      this->epsSquare = eps * eps;
    }
- 
-   private:
- 
+
+private:
    RealType epsSquare;
 };
 
-
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class TwoSidedGradientNorm< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real, Index >
-   : public Operator< Meshes::Grid< 2, MeshReal, Device, MeshIndex >,
-                         Functions::MeshInteriorDomain, 2, 2, Real, Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class TwoSidedGradientNorm< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
+: public Operator< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Functions::MeshInteriorDomain, 2, 2, Real, Index >
 {
-   public:
- 
+public:
    typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
    typedef Device DeviceType;
    typedef Index IndexType;
    typedef ExactGradientNorm< 2, RealType > ExactOperatorType;
- 
-   TwoSidedGradientNorm()
-   : epsSquare( 0.0 ){}
+
+   TwoSidedGradientNorm() : epsSquare( 0.0 ) {}
 
    template< typename MeshFunction, typename MeshEntity >
    __cuda_callable__
-   Real operator()( const MeshFunction& u,
-                    const MeshEntity& entity,
-                    const Real& time = 0.0 ) const
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time = 0.0 ) const
    {
       ForwardFiniteDifference< typename MeshEntity::MeshType, 1, 0, 0, Real, Index > XForwardDifference;
       ForwardFiniteDifference< typename MeshEntity::MeshType, 0, 1, 0, Real, Index > YForwardDifference;
@@ -101,50 +81,38 @@ class TwoSidedGradientNorm< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real,
       const RealType u_x_b = XBackwardDifference( u, entity );
       const RealType u_y_f = YForwardDifference( u, entity );
       const RealType u_y_b = YBackwardDifference( u, entity );
- 
-      return ::sqrt( this->epsSquare +
-         0.5 * ( u_x_f * u_x_f + u_x_b * u_x_b +
-                 u_y_f * u_y_f + u_y_b * u_y_b ) );
+
+      return ::sqrt( this->epsSquare + 0.5 * ( u_x_f * u_x_f + u_x_b * u_x_b + u_y_f * u_y_f + u_y_b * u_y_b ) );
    }
- 
-   void setEps( const Real& eps )
+
+   void
+   setEps( const Real& eps )
    {
-      this->epsSquare = eps*eps;
+      this->epsSquare = eps * eps;
    }
- 
- 
-   private:
- 
+
+private:
    RealType epsSquare;
 };
 
-
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 class TwoSidedGradientNorm< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >
-   : public Operator< Meshes::Grid< 3, MeshReal, Device, MeshIndex >,
-                         Functions::MeshInteriorDomain, 3, 3, Real, Index >
+: public Operator< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Functions::MeshInteriorDomain, 3, 3, Real, Index >
 {
-   public:
- 
+public:
    typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
    typedef Device DeviceType;
    typedef Index IndexType;
    typedef ExactGradientNorm< 3, RealType > ExactOperatorType;
- 
-   TwoSidedGradientNorm()
-   : epsSquare( 0.0 ){}
+
+   TwoSidedGradientNorm() : epsSquare( 0.0 ) {}
 
    template< typename MeshFunction, typename MeshEntity >
    __cuda_callable__
-   Real operator()( const MeshFunction& u,
-                    const MeshEntity& entity,
-                    const Real& time = 0.0 ) const
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time = 0.0 ) const
    {
       ForwardFiniteDifference< typename MeshEntity::MeshType, 1, 0, 0, Real, Index > XForwardDifference;
       ForwardFiniteDifference< typename MeshEntity::MeshType, 0, 1, 0, Real, Index > YForwardDifference;
@@ -158,25 +126,21 @@ class TwoSidedGradientNorm< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real
       const RealType u_y_b = YBackwardDifference( u, entity );
       const RealType u_z_f = ZForwardDifference( u, entity );
       const RealType u_z_b = ZBackwardDifference( u, entity );
- 
-      return ::sqrt( this->epsSquare +
-         0.5 * ( u_x_f * u_x_f + u_x_b * u_x_b +
-                 u_y_f * u_y_f + u_y_b * u_y_b +
-                 u_z_f * u_z_f + u_z_b * u_z_b ) );
- 
+
+      return ::sqrt( this->epsSquare
+                     + 0.5
+                          * ( u_x_f * u_x_f + u_x_b * u_x_b + u_y_f * u_y_f + u_y_b * u_y_b + u_z_f * u_z_f + u_z_b * u_z_b ) );
    }
- 
- 
-   void setEps(const Real& eps)
+
+   void
+   setEps( const Real& eps )
    {
-      this->epsSquare = eps*eps;
+      this->epsSquare = eps * eps;
    }
- 
-   private:
- 
+
+private:
    RealType epsSquare;
 };
 
-} // namespace Operators
-} // namespace TNL
-
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/interpolants/MeshEntitiesInterpolants.h b/src/TNL/Operators/interpolants/MeshEntitiesInterpolants.h
index 439057ee642ac2d53d27950d84bf4b55951f50b3..80e3a49756371c0d752316b12a76d4121da04c72 100644
--- a/src/TNL/Operators/interpolants/MeshEntitiesInterpolants.h
+++ b/src/TNL/Operators/interpolants/MeshEntitiesInterpolants.h
@@ -10,292 +10,258 @@
 #include <TNL/Functions/Domain.h>
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
-template< typename Mesh,
-          int InEntityDimension,
-          int OutEntityDimenions >
+template< typename Mesh, int InEntityDimension, int OutEntityDimenions >
 class MeshEntitiesInterpolants
-{
-};
+{};
 
 /***
  * 1D grid mesh entity interpolation: 1 -> 0
  */
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 class MeshEntitiesInterpolants< Meshes::Grid< 1, Real, Device, Index >, 1, 0 >
-   : public Functions::Domain< 1, Functions::MeshInteriorDomain >
+: public Functions::Domain< 1, Functions::MeshInteriorDomain >
 {
-   public:
- 
-      typedef Meshes::Grid< 1, Real, Device, Index > MeshType;
-
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      Real operator()( const MeshFunction& u,
-                       const MeshEntity& entity,
-                       const Real& time = 0.0 ) const
-      {
-         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 NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities();
- 
-         return 0.5 * ( u[ neighborEntities.template getEntityIndex< -1 >() ] +
-                        u[ neighborEntities.template getEntityIndex<  1 >() ] );
-      }
+public:
+   typedef Meshes::Grid< 1, Real, Device, Index > MeshType;
+
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time = 0.0 ) const
+   {
+      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 NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities();
+
+      return 0.5
+           * ( u[ neighborEntities.template getEntityIndex< -1 >() ] + u[ neighborEntities.template getEntityIndex< 1 >() ] );
+   }
 };
 
 /***
  * 1D grid mesh entity interpolation: 0 -> 1
  */
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 class MeshEntitiesInterpolants< Meshes::Grid< 1, Real, Device, Index >, 0, 1 >
-   : public Functions::Domain< 1, Functions::MeshInteriorDomain >
+: public Functions::Domain< 1, Functions::MeshInteriorDomain >
 {
-   public:
- 
-      typedef Meshes::Grid< 1, Real, Device, Index > MeshType;
-
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      Real operator()( const MeshFunction& u,
-                       const MeshEntity& entity,
-                       const Real& time = 0.0 ) const
-      {
-         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 NeighborEntities< 0 >& neighborEntities = entity.template getNeighborEntities< 0 >();
- 
-         return 0.5 * ( u[ neighborEntities.template getEntityIndex< -1 >() ] +
-                        u[ neighborEntities.template getEntityIndex<  1 >() ] );
-      }
+public:
+   typedef Meshes::Grid< 1, Real, Device, Index > MeshType;
+
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time = 0.0 ) const
+   {
+      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 NeighborEntities< 0 >& neighborEntities = entity.template getNeighborEntities< 0 >();
+
+      return 0.5
+           * ( u[ neighborEntities.template getEntityIndex< -1 >() ] + u[ neighborEntities.template getEntityIndex< 1 >() ] );
+   }
 };
 
 /***
  * 2D grid mesh entity interpolation: 2 -> 1
  */
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 class MeshEntitiesInterpolants< Meshes::Grid< 2, Real, Device, Index >, 2, 1 >
-   : public Functions::Domain< 2, Functions::MeshInteriorDomain >
+: public Functions::Domain< 2, Functions::MeshInteriorDomain >
 {
-   public:
- 
-      typedef Meshes::Grid< 2, Real, Device, Index > MeshType;
- 
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      Real operator()( const MeshFunction& u,
-                       const MeshEntity& entity,
-                       const Real& time = 0.0 ) const
-      {
-         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 NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities();
- 
-         if( entity.getOrientation().x() == 1.0 )
-            return 0.5 * ( u[ neighborEntities.template getEntityIndex< -1, 0 >() ] +
-                           u[ neighborEntities.template getEntityIndex<  1, 0 >() ] );
-         else
-            return 0.5 * ( u[ neighborEntities.template getEntityIndex< 0, -1 >() ] +
-                           u[ neighborEntities.template getEntityIndex< 0,  1 >() ] );
-      }
+public:
+   typedef Meshes::Grid< 2, Real, Device, Index > MeshType;
+
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time = 0.0 ) const
+   {
+      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 NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities();
+
+      if( entity.getOrientation().x() == 1.0 )
+         return 0.5
+              * ( u[ neighborEntities.template getEntityIndex< -1, 0 >() ]
+                  + u[ neighborEntities.template getEntityIndex< 1, 0 >() ] );
+      else
+         return 0.5
+              * ( u[ neighborEntities.template getEntityIndex< 0, -1 >() ]
+                  + u[ neighborEntities.template getEntityIndex< 0, 1 >() ] );
+   }
 };
 
 /***
  * 2D grid mesh entity interpolation: 2 -> 0
  */
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 class MeshEntitiesInterpolants< Meshes::Grid< 2, Real, Device, Index >, 2, 0 >
-   : public Functions::Domain< 2, Functions::MeshInteriorDomain >
+: public Functions::Domain< 2, Functions::MeshInteriorDomain >
 {
-   public:
- 
-      typedef Meshes::Grid< 2, Real, Device, Index > MeshType;
-
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      Real operator()( const MeshFunction& u,
-                       const MeshEntity& entity,
-                       const Real& time = 0.0 ) const
-      {
-         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 NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities();
- 
-         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 >() ] );
-      }
+public:
+   typedef Meshes::Grid< 2, Real, Device, Index > MeshType;
+
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time = 0.0 ) const
+   {
+      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 NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities();
+
+      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 >() ] );
+   }
 };
 
 /***
  * 2D grid mesh entity interpolation: 1 -> 2
  */
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 class MeshEntitiesInterpolants< Meshes::Grid< 2, Real, Device, Index >, 1, 2 >
-   : public Functions::Domain< 2, Functions::MeshInteriorDomain >
+: public Functions::Domain< 2, Functions::MeshInteriorDomain >
 {
-   public:
- 
-      typedef Meshes::Grid< 2, Real, Device, Index > MeshType;
-
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      Real operator()( const MeshFunction& u,
-                       const MeshEntity& entity,
-                       const Real& time = 0.0 ) const
-      {
-         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 NeighborEntities< 1 >& neighborEntities = entity.template getNeighborEntities< 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 >() ] );
-      }
+public:
+   typedef Meshes::Grid< 2, Real, Device, Index > MeshType;
+
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time = 0.0 ) const
+   {
+      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 NeighborEntities< 1 >& neighborEntities = entity.template getNeighborEntities< 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 >() ] );
+   }
 };
 
 /***
  * 2D grid mesh entity interpolation: 0 -> 2
  */
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 class MeshEntitiesInterpolants< Meshes::Grid< 2, Real, Device, Index >, 0, 2 >
-   : public Functions::Domain< 2, Functions::MeshInteriorDomain >
+: public Functions::Domain< 2, Functions::MeshInteriorDomain >
 {
-   public:
- 
-      typedef Meshes::Grid< 2, Real, Device, Index > MeshType;
-
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      Real operator()( const MeshFunction& u,
-                       const MeshEntity& entity,
-                       const Real& time = 0.0 ) const
-      {
-         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 NeighborEntities< 0 >& neighborEntities = entity.getNeighborEntities();
- 
-         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 >() ] );
-      }
+public:
+   typedef Meshes::Grid< 2, Real, Device, Index > MeshType;
+
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time = 0.0 ) const
+   {
+      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 NeighborEntities< 0 >& neighborEntities = entity.getNeighborEntities();
+
+      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 >() ] );
+   }
 };
 
 /***
  * 3D grid mesh entity interpolation: 3 -> 2
  */
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 class MeshEntitiesInterpolants< Meshes::Grid< 3, Real, Device, Index >, 3, 2 >
-   : public Functions::Domain< 3, Functions::MeshInteriorDomain >
+: public Functions::Domain< 3, Functions::MeshInteriorDomain >
 {
-   public:
- 
-      typedef Meshes::Grid< 3, Real, Device, Index > MeshType;
-
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      Real operator()( const MeshFunction& u,
-                       const MeshEntity& entity,
-                       const Real& time = 0.0 ) const
-      {
-         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 NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities();
- 
-         if( entity.getOrientation().x() == 1.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[ neighborEntities.template getEntityIndex<  0, -1,  0 >() ] +
-                           u[ neighborEntities.template getEntityIndex<  0,  1,  0 >() ] );
-         else
-            return 0.5 * ( u[ neighborEntities.template getEntityIndex<  0,  0, -1 >() ] +
-                           u[ neighborEntities.template getEntityIndex<  0,  0,  1 >() ] );
-      }
+public:
+   typedef Meshes::Grid< 3, Real, Device, Index > MeshType;
+
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time = 0.0 ) const
+   {
+      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 NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities();
+
+      if( entity.getOrientation().x() == 1.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[ neighborEntities.template getEntityIndex< 0, -1, 0 >() ]
+                  + u[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ] );
+      else
+         return 0.5
+              * ( u[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ]
+                  + u[ neighborEntities.template getEntityIndex< 0, 0, 1 >() ] );
+   }
 };
 
 /***
  * 3D grid mesh entity interpolation: 2 -> 3
  */
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 class MeshEntitiesInterpolants< Meshes::Grid< 3, Real, Device, Index >, 2, 3 >
-   : public Functions::Domain< 3, Functions::MeshInteriorDomain >
+: public Functions::Domain< 3, Functions::MeshInteriorDomain >
 {
-   public:
- 
-      typedef Meshes::Grid< 3, Real, Device, Index > MeshType;
-
-      template< typename MeshFunction, typename MeshEntity >
-      __cuda_callable__
-      Real operator()( const MeshFunction& u,
-                       const MeshEntity& entity,
-                       const Real& time = 0.0 ) const
-      {
-         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 NeighborEntities< 2 >& neighborEntities = entity.template getNeighborEntities< 2 >();
- 
-         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 >() ] );
-      }
-};
+public:
+   typedef Meshes::Grid< 3, Real, Device, Index > MeshType;
 
-} // namespace Operators
-} // namespace TNL
+   template< typename MeshFunction, typename MeshEntity >
+   __cuda_callable__
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time = 0.0 ) const
+   {
+      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 NeighborEntities< 2 >& neighborEntities = entity.template getNeighborEntities< 2 >();
+
+      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 >() ] );
+   }
+};
 
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/operator-Q/tnlFiniteVolumeOperatorQ.h b/src/TNL/Operators/operator-Q/tnlFiniteVolumeOperatorQ.h
index 2484e652ef5645cf6aa844e8ce4ac5bce50c16d3..3b4eef196b0e05ec7056042e61b1f0627f5bdacc 100644
--- a/src/TNL/Operators/operator-Q/tnlFiniteVolumeOperatorQ.h
+++ b/src/TNL/Operators/operator-Q/tnlFiniteVolumeOperatorQ.h
@@ -16,22 +16,14 @@ namespace Operators {
 template< typename Mesh,
           typename Real = typename Mesh::RealType,
           typename Index = typename Mesh::GlobalIndexType,
-          int Precomputation = 0 > 
+          int Precomputation = 0 >
 class tnlFiniteVolumeOperatorQ
-{
-
-};
+{};
 
-
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class tnlFiniteVolumeOperatorQ< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real, Index, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class tnlFiniteVolumeOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 0 >
 {
-   public: 
-   
+public:
    typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
@@ -39,51 +31,49 @@ class tnlFiniteVolumeOperatorQ< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, R
    typedef Index IndexType;
 
    template< typename Vector >
-   IndexType bind( Vector& u) 
-   { return 0; }
+   IndexType
+   bind( Vector& u )
+   {
+      return 0;
+   }
 
    __cuda_callable__
-   void update( const MeshType& mesh, const RealType& time ) 
+   void
+   update( const MeshType& mesh, const RealType& time )
    {}
-   
+
    template< typename MeshEntity, typename Vector >
    __cuda_callable__
-   Real operator()( const MeshType& mesh,
-          const MeshEntity& entity,
-          const Vector& u,
-          const Real& time,
-          const IndexType& dx = 0, 
-          const IndexType& dy = 0,
-          const IndexType& dz = 0 ) const;
-          
-   bool setEps(const Real& eps);
-      
-   private:
-   
-      template< typename MeshEntity, typename Vector, int AxeX = 0, int AxeY = 0, int AxeZ = 0 >
-      __cuda_callable__
-      Real 
-      boundaryDerivative( 
-         const MeshEntity& entity,
-         const Vector& u,
-         const Real& time,
-         const IndexType& dx = 0, 
-         const IndexType& dy = 0,
-         const IndexType& dz = 0 ) const;
-
-      RealType eps;
-};
+   Real
+   operator()( const MeshType& mesh,
+               const MeshEntity& entity,
+               const Vector& u,
+               const Real& time,
+               const IndexType& dx = 0,
+               const IndexType& dy = 0,
+               const IndexType& dz = 0 ) const;
+
+   bool
+   setEps( const Real& eps );
+
+private:
+   template< typename MeshEntity, typename Vector, int AxeX = 0, int AxeY = 0, int AxeZ = 0 >
+   __cuda_callable__
+   Real
+   boundaryDerivative( const MeshEntity& entity,
+                       const Vector& u,
+                       const Real& time,
+                       const IndexType& dx = 0,
+                       const IndexType& dy = 0,
+                       const IndexType& dz = 0 ) const;
 
+   RealType eps;
+};
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class tnlFiniteVolumeOperatorQ< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real, Index, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class tnlFiniteVolumeOperatorQ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 0 >
 {
-   public: 
-   
+public:
    typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
@@ -91,50 +81,49 @@ class tnlFiniteVolumeOperatorQ< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, R
    typedef Index IndexType;
 
    template< typename Vector >
-   IndexType bind( Vector& u)
-   { return 0; }
+   IndexType
+   bind( Vector& u )
+   {
+      return 0;
+   }
 
    __cuda_callable__
-   void update( const MeshType& mesh, const RealType& time )
-   {}   
-   
+   void
+   update( const MeshType& mesh, const RealType& time )
+   {}
+
    template< typename MeshEntity, typename Vector >
    __cuda_callable__
-   Real operator()( 
-      const MeshEntity& entity,
-      const Vector& u,
-      const Real& time,
-      const IndexType& dx = 0, 
-      const IndexType& dy = 0,
-      const IndexType& dz = 0 ) const;
-        
-   bool setEps(const Real& eps);
-   
-   private:
-
+   Real
+   operator()( const MeshEntity& entity,
+               const Vector& u,
+               const Real& time,
+               const IndexType& dx = 0,
+               const IndexType& dy = 0,
+               const IndexType& dz = 0 ) const;
+
+   bool
+   setEps( const Real& eps );
+
+private:
    template< typename MeshEntity, typename Vector, int AxeX = 0, int AxeY = 0, int AxeZ = 0 >
    __cuda_callable__
-   Real boundaryDerivative( const MeshType& mesh,
-          const MeshEntity& entity,
-          const Vector& u,
-          const Real& time,
-          const IndexType& dx = 0, 
-          const IndexType& dy = 0,
-          const IndexType& dz = 0 ) const;
-   
+   Real
+   boundaryDerivative( const MeshType& mesh,
+                       const MeshEntity& entity,
+                       const Vector& u,
+                       const Real& time,
+                       const IndexType& dx = 0,
+                       const IndexType& dy = 0,
+                       const IndexType& dz = 0 ) const;
+
    RealType eps;
 };
 
-
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class tnlFiniteVolumeOperatorQ< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, Index, 0 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class tnlFiniteVolumeOperatorQ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 0 >
 {
-   public: 
-   
+public:
    typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
@@ -142,50 +131,49 @@ class tnlFiniteVolumeOperatorQ< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, R
    typedef Index IndexType;
 
    template< typename Vector >
-   IndexType bind( Vector& u)
-   { return 0; }
+   IndexType
+   bind( Vector& u )
+   {
+      return 0;
+   }
 
    __cuda_callable__
-   void update( const MeshType& mesh, const RealType& time )
+   void
+   update( const MeshType& mesh, const RealType& time )
    {}
-   
+
    template< typename MeshEntity, typename Vector >
    __cuda_callable__
-   Real operator()(
-          const MeshEntity& entity,
-          const Vector& u,
-          const Real& time,
-          const IndexType& dx = 0, 
-          const IndexType& dy = 0,
-          const IndexType& dz = 0 ) const;
-        
-   bool setEps(const Real& eps);
-   
-   private:
-
+   Real
+   operator()( const MeshEntity& entity,
+               const Vector& u,
+               const Real& time,
+               const IndexType& dx = 0,
+               const IndexType& dy = 0,
+               const IndexType& dz = 0 ) const;
+
+   bool
+   setEps( const Real& eps );
+
+private:
    template< typename MeshEntity, typename Vector, int AxeX = 0, int AxeY = 0, int AxeZ = 0 >
    __cuda_callable__
-   Real boundaryDerivative( const MeshType& mesh,
-          const MeshEntity& entity,
-          const Vector& u,
-          const Real& time,
-          const IndexType& dx = 0, 
-          const IndexType& dy = 0,
-          const IndexType& dz = 0 ) const;
-   
+   Real
+   boundaryDerivative( const MeshType& mesh,
+                       const MeshEntity& entity,
+                       const Vector& u,
+                       const Real& time,
+                       const IndexType& dx = 0,
+                       const IndexType& dy = 0,
+                       const IndexType& dz = 0 ) const;
+
    RealType eps;
 };
 
-
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class tnlFiniteVolumeOperatorQ< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real, Index, 1 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class tnlFiniteVolumeOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 1 >
 {
-   public: 
-   
+public:
    typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
@@ -193,50 +181,48 @@ class tnlFiniteVolumeOperatorQ< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, R
    typedef Index IndexType;
 
    template< typename Vector >
-   Index bind( Vector& u);
+   Index
+   bind( Vector& u );
 
    __cuda_callable__
-   void update( const MeshType& mesh, const RealType& time );
-   
+   void
+   update( const MeshType& mesh, const RealType& time );
+
    template< typename MeshEntity, typename Vector >
    __cuda_callable__
-   Real operator()( const MeshType& mesh,
-          const MeshEntity& entity,
-          const Vector& u,
-          const Real& time,
-          const IndexType& dx = 0, 
-          const IndexType& dy = 0,
-          const IndexType& dz = 0 ) const;
-   
-   bool setEps(const Real& eps);
-   
-   private:
-   
-      template< typename MeshEntity, typename Vector, int AxeX = 0, int AxeY = 0, int AxeZ = 0 >
-      __cuda_callable__
-      Real boundaryDerivative( const MeshType& mesh,
-             const MeshEntity& entity,
-             const Vector& u,
-             const Real& time,
-             const IndexType& dx = 0, 
-             const IndexType& dy = 0,
-             const IndexType& dz = 0 ) const;    
-
-      SharedVector< RealType, DeviceType, IndexType > u;
-      Vector< RealType, DeviceType, IndexType> q;
-      RealType eps;
-};
+   Real
+   operator()( const MeshType& mesh,
+               const MeshEntity& entity,
+               const Vector& u,
+               const Real& time,
+               const IndexType& dx = 0,
+               const IndexType& dy = 0,
+               const IndexType& dz = 0 ) const;
+
+   bool
+   setEps( const Real& eps );
+
+private:
+   template< typename MeshEntity, typename Vector, int AxeX = 0, int AxeY = 0, int AxeZ = 0 >
+   __cuda_callable__
+   Real
+   boundaryDerivative( const MeshType& mesh,
+                       const MeshEntity& entity,
+                       const Vector& u,
+                       const Real& time,
+                       const IndexType& dx = 0,
+                       const IndexType& dy = 0,
+                       const IndexType& dz = 0 ) const;
 
+   SharedVector< RealType, DeviceType, IndexType > u;
+   Vector< RealType, DeviceType, IndexType > q;
+   RealType eps;
+};
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class tnlFiniteVolumeOperatorQ< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real, Index, 1 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class tnlFiniteVolumeOperatorQ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 1 >
 {
-   public: 
-   
+public:
    typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
@@ -245,51 +231,49 @@ class tnlFiniteVolumeOperatorQ< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, R
    typedef SharedVector< RealType, DeviceType, IndexType > DofVectorType;
 
    template< typename Vector >
-   Index bind( Vector& u);
+   Index
+   bind( Vector& u );
 
    __cuda_callable__
-   void update( const MeshType& mesh, const RealType& time ); 
-   
+   void
+   update( const MeshType& mesh, const RealType& time );
+
    template< typename MeshEntity, typename Vector >
    __cuda_callable__
-   Real operator()( const MeshType& mesh,
-          const MeshEntity& entity,
-          const Vector& u,
-          const Real& time,
-          const IndexType& dx = 0, 
-          const IndexType& dy = 0,
-          const IndexType& dz = 0 ) const;
-          
-   bool setEps(const Real& eps);
-   
-   private:
-   
+   Real
+   operator()( const MeshType& mesh,
+               const MeshEntity& entity,
+               const Vector& u,
+               const Real& time,
+               const IndexType& dx = 0,
+               const IndexType& dy = 0,
+               const IndexType& dz = 0 ) const;
+
+   bool
+   setEps( const Real& eps );
+
+private:
    template< typename MeshEntity, typename Vector, int AxeX = 0, int AxeY = 0, int AxeZ = 0 >
    __cuda_callable__
-   Real boundaryDerivative( const MeshType& mesh,
-          const IndexType cellIndex,
-          const MeshEntity& entity,
-          const Vector& u,
-          const Real& time,
-          const IndexType& dx = 0, 
-          const IndexType& dy = 0,
-          const IndexType& dz = 0 ) const;
-       
+   Real
+   boundaryDerivative( const MeshType& mesh,
+                       const IndexType cellIndex,
+                       const MeshEntity& entity,
+                       const Vector& u,
+                       const Real& time,
+                       const IndexType& dx = 0,
+                       const IndexType& dy = 0,
+                       const IndexType& dz = 0 ) const;
+
    SharedVector< RealType, DeviceType, IndexType > u;
-   Vector< RealType, DeviceType, IndexType> q;
+   Vector< RealType, DeviceType, IndexType > q;
    RealType eps;
 };
 
-
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class tnlFiniteVolumeOperatorQ< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, Real, Index, 1 >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class tnlFiniteVolumeOperatorQ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 1 >
 {
-   public: 
-   
+public:
    typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
@@ -297,43 +281,47 @@ class tnlFiniteVolumeOperatorQ< Meshes::Grid< 3,MeshReal, Device, MeshIndex >, R
    typedef Index IndexType;
 
    template< typename Vector >
-   Index bind( Vector& u);
+   Index
+   bind( Vector& u );
 
    __cuda_callable__
-   void update( const MeshType& mesh, const RealType& time );
-   
+   void
+   update( const MeshType& mesh, const RealType& time );
+
    template< typename MeshEntity, typename Vector >
    __cuda_callable__
-   Real operator()( const MeshType& mesh,
-          const IndexType cellIndex,
-          const MeshEntity& entity,
-          const Vector& u,
-          const Real& time,
-          const IndexType& dx = 0, 
-          const IndexType& dy = 0,
-          const IndexType& dz = 0 ) const;
-          
-   bool setEps(const Real& eps);
-   
-   private:
-   
-      template< typename MeshEntity, typename Vector, int AxeX = 0, int AxeY = 0, int AxeZ = 0 >
-      __cuda_callable__
-      Real boundaryDerivative( const MeshType& mesh,
-             const IndexType cellIndex,
-             const MeshEntity& entity,
-             const Vector& u,
-             const Real& time,
-             const IndexType& dx = 0, 
-             const IndexType& dy = 0,
-             const IndexType& dz = 0 ) const;
-
-      SharedVector< RealType, DeviceType, IndexType > u;
-      Vector< RealType, DeviceType, IndexType> q;
-      RealType eps;
+   Real
+   operator()( const MeshType& mesh,
+               const IndexType cellIndex,
+               const MeshEntity& entity,
+               const Vector& u,
+               const Real& time,
+               const IndexType& dx = 0,
+               const IndexType& dy = 0,
+               const IndexType& dz = 0 ) const;
+
+   bool
+   setEps( const Real& eps );
+
+private:
+   template< typename MeshEntity, typename Vector, int AxeX = 0, int AxeY = 0, int AxeZ = 0 >
+   __cuda_callable__
+   Real
+   boundaryDerivative( const MeshType& mesh,
+                       const IndexType cellIndex,
+                       const MeshEntity& entity,
+                       const Vector& u,
+                       const Real& time,
+                       const IndexType& dx = 0,
+                       const IndexType& dy = 0,
+                       const IndexType& dz = 0 ) const;
+
+   SharedVector< RealType, DeviceType, IndexType > u;
+   Vector< RealType, DeviceType, IndexType > q;
+   RealType eps;
 };
 
-} // namespace Operators
-} // namespace TNL
+}  // namespace Operators
+}  // namespace TNL
 
 #include <TNL/Operators/operator-Q/tnlFiniteVolumeOperatorQ_impl.h>
diff --git a/src/TNL/Operators/operator-Q/tnlFiniteVolumeOperatorQ_impl.h b/src/TNL/Operators/operator-Q/tnlFiniteVolumeOperatorQ_impl.h
index 36ea601d52a13baaa8ff833ddfb1db01c80ce2b4..831d7bfa751995bd6b05dedb376448b97bbdd2ec 100644
--- a/src/TNL/Operators/operator-Q/tnlFiniteVolumeOperatorQ_impl.h
+++ b/src/TNL/Operators/operator-Q/tnlFiniteVolumeOperatorQ_impl.h
@@ -10,526 +10,504 @@
 #include <TNL/Meshes/Grid.h>
 
 namespace TNL {
-namespace Operators {   
-
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-bool tnlFiniteVolumeOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 0 >::setEps( const Real& eps )
+namespace Operators {
+
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+bool
+tnlFiniteVolumeOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 0 >::setEps( const Real& eps )
 {
-  this->eps = eps;
-  
-  return true;
+   this->eps = eps;
+
+   return true;
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-bool tnlFiniteVolumeOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 1 >::setEps( const Real& eps )
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+bool
+tnlFiniteVolumeOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 1 >::setEps( const Real& eps )
 {
-  this->eps = eps;
-  
-  return true;
+   this->eps = eps;
+
+   return true;
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >   
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 __cuda_callable__
-void  
-tnlFiniteVolumeOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 1 >::
-update( const MeshType& mesh, const RealType& time )
-{
-}
+void
+tnlFiniteVolumeOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 1 >::update( const MeshType& mesh,
+                                                                                                    const RealType& time )
+{}
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 template< typename MeshEntity, typename Vector, int AxeX, int AxeY, int AxeZ >
 __cuda_callable__
 Real
-tnlFiniteVolumeOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 0 >::
-boundaryDerivative( const MeshEntity& entity,
-                    const Vector& u,
-                    const Real& time,
-                    const IndexType& dx, 
-                    const IndexType& dy,
-                    const IndexType& dz ) const
+tnlFiniteVolumeOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 0 >::boundaryDerivative(
+   const MeshEntity& entity,
+   const Vector& u,
+   const Real& time,
+   const IndexType& dx,
+   const IndexType& dy,
+   const IndexType& dz ) const
 {
-    return 0.0;
+   return 0.0;
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-template< typename MeshEntity,
-          typename Vector >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+template< typename MeshEntity, typename Vector >
 __cuda_callable__
 Real
-tnlFiniteVolumeOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 0 >::
-operator()( 
+tnlFiniteVolumeOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 0 >::operator()(
    const MeshType& mesh,
    const MeshEntity& entity,
    const Vector& u,
    const Real& time,
-   const IndexType& dx, 
+   const IndexType& dx,
    const IndexType& dy,
    const IndexType& dz ) const
 {
-    return 0.0;
+   return 0.0;
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 template< typename MeshEntity, typename Vector, int AxeX, int AxeY, int AxeZ >
 __cuda_callable__
 Real
-tnlFiniteVolumeOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 1 >::
-boundaryDerivative( 
+tnlFiniteVolumeOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 1 >::boundaryDerivative(
    const MeshType& mesh,
    const MeshEntity& entity,
    const Vector& u,
    const Real& time,
-   const IndexType& dx, 
+   const IndexType& dx,
    const IndexType& dy,
    const IndexType& dz ) const
 {
-    return 0.0;
+   return 0.0;
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 template< typename MeshEntity, typename Vector >
 __cuda_callable__
 Real
-tnlFiniteVolumeOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 1 >::
-operator()( 
+tnlFiniteVolumeOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 1 >::operator()(
    const MeshType& mesh,
    const MeshEntity& entity,
    const Vector& u,
    const Real& time,
-   const IndexType& dx, 
+   const IndexType& dx,
    const IndexType& dy,
    const IndexType& dz ) const
 {
-    return 0.0;
+   return 0.0;
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-bool tnlFiniteVolumeOperatorQ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 1 >::setEps( const Real& eps )
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+bool
+tnlFiniteVolumeOperatorQ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 1 >::setEps( const Real& eps )
 {
-  this->eps = eps;
-  
-  return true;
+   this->eps = eps;
+
+   return true;
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-bool tnlFiniteVolumeOperatorQ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 0 >::setEps( const Real& eps )
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+bool
+tnlFiniteVolumeOperatorQ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 0 >::setEps( const Real& eps )
 {
-  this->eps = eps;
-  
-  return true;
+   this->eps = eps;
+
+   return true;
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 template< typename Vector >
-Index 
-tnlFiniteVolumeOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 1 >::
-bind( Vector& u) 
+Index
+tnlFiniteVolumeOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index, 1 >::bind( Vector& u )
 {
-    return 0;
+   return 0;
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 __cuda_callable__
-void 
-tnlFiniteVolumeOperatorQ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 1 >::
-update( const MeshType& mesh, const RealType& time )
+void
+tnlFiniteVolumeOperatorQ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 1 >::update( const MeshType& mesh,
+                                                                                                    const RealType& time )
 {
-    CoordinatesType dimensions = mesh.getMeshDimension();
-    CoordinatesType coordinates;
-    
-    for( coordinates.x()=1; coordinates.x() < dimensions.x()-1; coordinates.x()++ )
-        for( coordinates.y()=1; coordinates.y() < dimensions.y()-1; coordinates.y()++  )
-        {
-            q.setElement( mesh.getCellIndex(coordinates), operator()( mesh, mesh.getCellIndex(coordinates), coordinates, u, time ) ); 
-        }
+   CoordinatesType dimensions = mesh.getMeshDimension();
+   CoordinatesType coordinates;
+
+   for( coordinates.x() = 1; coordinates.x() < dimensions.x() - 1; coordinates.x()++ )
+      for( coordinates.y() = 1; coordinates.y() < dimensions.y() - 1; coordinates.y()++ ) {
+         q.setElement(
+            mesh.getCellIndex( coordinates ), operator()( mesh, mesh.getCellIndex( coordinates ), coordinates, u, time ) );
+      }
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 template< typename MeshEntity, typename Vector, int AxeX, int AxeY, int AxeZ >
 __cuda_callable__
 Real
-tnlFiniteVolumeOperatorQ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 0 >::
-boundaryDerivative( 
+tnlFiniteVolumeOperatorQ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 0 >::boundaryDerivative(
    const MeshType& mesh,
    const MeshEntity& entity,
    const Vector& u,
    const Real& time,
-   const IndexType& dx, 
+   const IndexType& dx,
    const IndexType& dy,
    const IndexType& dz ) const
 {
-   const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities();      
+   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[ neighborEntities.template getEntityIndex< 1,0 >() ] - u[ cellIndex ] );
-        if ( ( dx == -1 ) && ( dy == 0 ) && ( dz == 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[ 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[ 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[ neighborEntities.template getEntityIndex< 0,1 >() ] - u[ cellIndex ] );
-        if ( ( dx == 0 ) && ( dy == -1 ) && ( dz == 0 ) )
-            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[ 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[ 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;
+   if( ( AxeX == 1 ) && ( AxeY == 0 ) && ( AxeZ == 0 ) ) {
+      if( ( dx == 1 ) && ( dy == 0 ) && ( dz == 0 ) )
+         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[ neighborEntities.template getEntityIndex< -1, 0 >() ] );
+      if( ( dx == 0 ) && ( dy == 1 ) && ( dz == 0 ) )
+         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[ 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[ neighborEntities.template getEntityIndex< 0, 1 >() ] - u[ cellIndex ] );
+      if( ( dx == 0 ) && ( dy == -1 ) && ( dz == 0 ) )
+         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[ 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[ 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;
 }
-   
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 template< typename MeshEntity, typename Vector >
 __cuda_callable__
 Real
-tnlFiniteVolumeOperatorQ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 0 >::
-operator()( const MeshEntity& entity,
-          const Vector& u,
-          const Real& time,
-          const IndexType& dx, 
-          const IndexType& dy,
-          const IndexType& dz ) const
+tnlFiniteVolumeOperatorQ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 0 >::operator()(
+   const MeshEntity& entity,
+   const Vector& u,
+   const Real& time,
+   const IndexType& dx,
+   const IndexType& dy,
+   const IndexType& dz ) const
 {
    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[ 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 ) + 
-               this->template boundaryDerivative< MeshEntity, Vector,0,1 >( mesh, entity, u, time, 1, 0 ) * 
-               this->template boundaryDerivative< MeshEntity, Vector,0,1 >( mesh, entity, u, time, 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 ) + 
-               this->template boundaryDerivative< MeshEntity, Vector,0,1 >( mesh, entity, u, time, -1, 0 ) * 
-               this->template boundaryDerivative< MeshEntity, Vector,0,1 >( mesh, entity, u, time, -1, 0 ) );
-    if ( ( dx == 0 ) && ( dy == 1 ) && ( dz == 0 ) )
-        return ::sqrt( this->eps + this->template boundaryDerivative< MeshEntity, Vector,1,0 >( mesh, entity, u, time, 0, 1 ) * 
-               this->template boundaryDerivative< MeshEntity, Vector,1,0 >( mesh, entity, u, time, 0, 1 ) + 
-               this->template boundaryDerivative< MeshEntity, Vector,0,1 >( mesh, entity, u, time, 0, 1 ) * 
-               this->template boundaryDerivative< MeshEntity, Vector,0,1 >( mesh, entity, u, time, 0, 1 ) );
-    if ( ( dx == 0 ) && ( dy == -1 ) && ( dz == 0 ) )
-        return ::sqrt( this->eps + this->template boundaryDerivative< MeshEntity, Vector,1,0 >( mesh, entity, u, time, 0, -1 ) * 
-               this->template boundaryDerivative< MeshEntity, Vector,1,0 >( mesh, entity, u, time, 0, -1 ) + 
-               this->template boundaryDerivative< MeshEntity, Vector,0,1 >( mesh, entity, u, time, 0, -1 ) * 
-               this->template boundaryDerivative< MeshEntity, Vector,0,1 >( mesh, entity, u, time, 0, -1 ) );
-    return 0.0;
+   if( ( dx == 0 ) && ( dy == 0 ) && ( dz == 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 )
+                     + this->template boundaryDerivative< MeshEntity, Vector, 0, 1 >( mesh, entity, u, time, 1, 0 )
+                          * this->template boundaryDerivative< MeshEntity, Vector, 0, 1 >( mesh, entity, u, time, 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 )
+                     + this->template boundaryDerivative< MeshEntity, Vector, 0, 1 >( mesh, entity, u, time, -1, 0 )
+                          * this->template boundaryDerivative< MeshEntity, Vector, 0, 1 >( mesh, entity, u, time, -1, 0 ) );
+   if( ( dx == 0 ) && ( dy == 1 ) && ( dz == 0 ) )
+      return ::sqrt( this->eps
+                     + this->template boundaryDerivative< MeshEntity, Vector, 1, 0 >( mesh, entity, u, time, 0, 1 )
+                          * this->template boundaryDerivative< MeshEntity, Vector, 1, 0 >( mesh, entity, u, time, 0, 1 )
+                     + this->template boundaryDerivative< MeshEntity, Vector, 0, 1 >( mesh, entity, u, time, 0, 1 )
+                          * this->template boundaryDerivative< MeshEntity, Vector, 0, 1 >( mesh, entity, u, time, 0, 1 ) );
+   if( ( dx == 0 ) && ( dy == -1 ) && ( dz == 0 ) )
+      return ::sqrt( this->eps
+                     + this->template boundaryDerivative< MeshEntity, Vector, 1, 0 >( mesh, entity, u, time, 0, -1 )
+                          * this->template boundaryDerivative< MeshEntity, Vector, 1, 0 >( mesh, entity, u, time, 0, -1 )
+                     + this->template boundaryDerivative< MeshEntity, Vector, 0, 1 >( mesh, entity, u, time, 0, -1 )
+                          * this->template boundaryDerivative< MeshEntity, Vector, 0, 1 >( mesh, entity, u, time, 0, -1 ) );
+   return 0.0;
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 template< typename MeshEntity, typename Vector >
 __cuda_callable__
 Real
-tnlFiniteVolumeOperatorQ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 1 >::
-operator()( const MeshType& mesh,
-          const MeshEntity& entity,
-          const Vector& u,
-          const Real& time,
-          const IndexType& dx, 
-          const IndexType& dy,
-          const IndexType& dz ) const
+tnlFiniteVolumeOperatorQ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index, 1 >::operator()(
+   const MeshType& mesh,
+   const MeshEntity& entity,
+   const Vector& u,
+   const Real& time,
+   const IndexType& dx,
+   const IndexType& dy,
+   const IndexType& dz ) const
 {
    return q.getElement( entity.getIndex() );
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-bool tnlFiniteVolumeOperatorQ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 1 >::setEps( const Real& eps )
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+bool
+tnlFiniteVolumeOperatorQ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 1 >::setEps( const Real& eps )
 {
-  this->eps = eps;
-  
-  return true;
+   this->eps = eps;
+
+   return true;
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-bool tnlFiniteVolumeOperatorQ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 0 >::setEps( const Real& eps )
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+bool
+tnlFiniteVolumeOperatorQ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 0 >::setEps( const Real& eps )
 {
-  this->eps = eps;
-  
-  return true;
+   this->eps = eps;
+
+   return true;
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 template< typename Vector >
-Index 
-tnlFiniteVolumeOperatorQ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 1 >::
-bind( Vector& u) 
+Index
+tnlFiniteVolumeOperatorQ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 1 >::bind( Vector& u )
 {
-    this->u.bind(u);
-    q.setSize(u.getSize());
-    q.setValue(0);
-    return 0;
+   this->u.bind( u );
+   q.setSize( u.getSize() );
+   q.setValue( 0 );
+   return 0;
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 __cuda_callable__
-void 
-tnlFiniteVolumeOperatorQ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 1 >::
-update( const MeshType& mesh, const RealType& time )
+void
+tnlFiniteVolumeOperatorQ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 1 >::update( const MeshType& mesh,
+                                                                                                    const RealType& time )
 {
-    CoordinatesType dimensions = mesh.getMeshDimension();
-    CoordinatesType coordinates;
-    
-    for( coordinates.x()=1; coordinates.x() < dimensions.x()-1; coordinates.x()++ )
-        for( coordinates.y()=1; coordinates.y() < dimensions.y()-1; coordinates.y()++ )
-            for( coordinates.z()=1; coordinates.z() < dimensions.z()-1; coordinates.z()++ )
-                q.setElement( mesh.getCellIndex(coordinates), operator()( mesh, mesh.getCellIndex(coordinates), coordinates, u, time ) ); 
+   CoordinatesType dimensions = mesh.getMeshDimension();
+   CoordinatesType coordinates;
+
+   for( coordinates.x() = 1; coordinates.x() < dimensions.x() - 1; coordinates.x()++ )
+      for( coordinates.y() = 1; coordinates.y() < dimensions.y() - 1; coordinates.y()++ )
+         for( coordinates.z() = 1; coordinates.z() < dimensions.z() - 1; coordinates.z()++ )
+            q.setElement(
+               mesh.getCellIndex( coordinates ), operator()( mesh, mesh.getCellIndex( coordinates ), coordinates, u, time ) );
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 template< typename MeshEntity, typename Vector, int AxeX, int AxeY, int AxeZ >
 __cuda_callable__
 Real
-tnlFiniteVolumeOperatorQ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 0 >::
-boundaryDerivative( 
+tnlFiniteVolumeOperatorQ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 0 >::boundaryDerivative(
    const MeshType& mesh,
    const MeshEntity& entity,
    const Vector& u,
    const Real& time,
-   const IndexType& dx, 
+   const IndexType& dx,
    const IndexType& dy,
    const IndexType& dz ) const
 {
    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[ 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[ neighborEntities.template getEntityIndex< -1,0,0 >() ] );
-        if ( ( dx == 0 ) && ( dy == 1 ) && ( dz == 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[ 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[ 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[ 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[ 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[ neighborEntities.template getEntityIndex< 0,-1,0 >() ] );
-        if ( ( dx == 1 ) && ( dy == 0 ) && ( dz == 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[ 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[ 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[ 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[ 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[ neighborEntities.template getEntityIndex< 0,0,-1 >() ] );
-        if ( ( dx == 1 ) && ( dy == 0 ) && ( dz == 0 ) )
-            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[ 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[ 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[ 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;
+   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[ 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[ neighborEntities.template getEntityIndex< -1, 0, 0 >() ] );
+      if( ( dx == 0 ) && ( dy == 1 ) && ( dz == 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[ 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[ 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[ 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[ 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[ neighborEntities.template getEntityIndex< 0, -1, 0 >() ] );
+      if( ( dx == 1 ) && ( dy == 0 ) && ( dz == 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[ 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[ 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[ 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[ 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[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] );
+      if( ( dx == 1 ) && ( dy == 0 ) && ( dz == 0 ) )
+         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[ 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[ 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[ 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;
 }
-   
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 template< typename MeshEntity, typename Vector >
 __cuda_callable__
 Real
-tnlFiniteVolumeOperatorQ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 0 >::
-operator()( 
+tnlFiniteVolumeOperatorQ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index, 0 >::operator()(
    const MeshEntity& entity,
    const Vector& u,
    const Real& time,
-   const IndexType& dx, 
+   const IndexType& dx,
    const IndexType& dy,
    const IndexType& dz ) const
 {
-   const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities(); 
+   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[ 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 ) + 
-               this->template boundaryDerivative< MeshEntity, Vector,0,1,0 >( mesh, entity, u, time, 1, 0, 0 ) * 
-               this->template boundaryDerivative< MeshEntity, Vector,0,1,0 >( mesh, entity, u, time, 1, 0, 0 ) + 
-               this->template boundaryDerivative< MeshEntity, Vector,0,0,1 >( mesh, entity, u, time, 1, 0, 0 ) * 
-               this->template boundaryDerivative< MeshEntity, Vector,0,0,1 >( mesh, entity, u, time, 1, 0, 0 ) );
-    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 ) + 
-               this->template boundaryDerivative< MeshEntity, Vector,0,1,0 >( mesh, entity, u, time, -1, 0, 0 ) * 
-               this->template boundaryDerivative< MeshEntity, Vector,0,1,0 >( mesh, entity, u, time, -1, 0, 0 ) +
-               this->template boundaryDerivative< MeshEntity, Vector,0,0,1 >( mesh, entity, u, time, -1, 0, 0 ) * 
-               this->template boundaryDerivative< MeshEntity, Vector,0,0,1 >( mesh, entity, u, time, -1, 0, 0 ) );
-    if ( ( dx == 0 ) && ( dy == 1 ) && ( dz == 0 ) )
-        return ::sqrt( this->eps + this->template boundaryDerivative< MeshEntity, Vector,1,0,0 >( mesh, entity, u, time, 0, 1, 0 ) * 
-               this->template boundaryDerivative< MeshEntity, Vector,1,0,0 >( mesh, entity, u, time, 0, 1, 0 ) + 
-               this->template boundaryDerivative< MeshEntity, Vector,0,1,0 >( mesh, entity, u, time, 0, 1, 0 ) * 
-               this->template boundaryDerivative< MeshEntity, Vector,0,1,0 >( mesh, entity, u, time, 0, 1, 0 ) +
-               this->template boundaryDerivative< MeshEntity, Vector,0,0,1 >( mesh, entity, u, time, 0, 1, 0 ) * 
-               this->template boundaryDerivative< MeshEntity, Vector,0,0,1 >( mesh, entity, u, time, 0, 1, 0 ));
-    if ( ( dx == 0 ) && ( dy == -1 ) && ( dz == 0 ) )
-        return ::sqrt( this->eps + this->template boundaryDerivative< MeshEntity, Vector,1,0,0 >( mesh, entity, u, time, 0, -1, 0 ) * 
-               this->template boundaryDerivative< MeshEntity, Vector,1,0,0 >( mesh, entity, u, time, 0, -1, 0 ) + 
-               this->template boundaryDerivative< MeshEntity, Vector,0,1,0 >( mesh, entity, u, time, 0, -1, 0 ) * 
-               this->template boundaryDerivative< MeshEntity, Vector,0,1,0 >( mesh, entity, u, time, 0, -1, 0 ) +
-               this->template boundaryDerivative< MeshEntity, Vector,0,0,1 >( mesh, entity, u, time, 0, -1, 0 ) * 
-               this->template boundaryDerivative< MeshEntity, Vector,0,0,1 >( mesh, entity, u, time, 0, -1, 0 ) );
-    if ( ( dx == 0 ) && ( dy == 0 ) && ( dz == 1 ) )
-        return ::sqrt( this->eps + this->template boundaryDerivative< MeshEntity, Vector,1,0,0 >( mesh, entity, u, time, 0, 0, 1 ) * 
-               this->template boundaryDerivative< MeshEntity, Vector,1,0,0 >( mesh, entity, u, time, 0, 0, 1 ) + 
-               this->template boundaryDerivative< MeshEntity, Vector,0,1,0 >( mesh, entity, u, time, 0, 0, 1 ) * 
-               this->template boundaryDerivative< MeshEntity, Vector,0,1,0 >( mesh, entity, u, time, 0, 0, 1 ) +
-               this->template boundaryDerivative< MeshEntity, Vector,0,0,1 >( mesh, entity, u, time, 0, 0, 1 ) * 
-               this->template boundaryDerivative< MeshEntity, Vector,0,0,1 >( mesh, entity, u, time, 0, 0, 1 ));
-    if ( ( dx == 0 ) && ( dy == 0 ) && ( dz == -1 ) )
-        return ::sqrt( this->eps + this->template boundaryDerivative< MeshEntity, Vector,1,0,0 >( mesh, entity, u, time, 0, 0, -1 ) * 
-               this->template boundaryDerivative< MeshEntity, Vector,1,0,0 >( mesh, entity, u, time, 0, 0, -1 ) + 
-               this->template boundaryDerivative< MeshEntity, Vector,0,1,0 >( mesh, entity, u, time, 0, 0, -1 ) * 
-               this->template boundaryDerivative< MeshEntity, Vector,0,1,0 >( mesh, entity, u, time, 0, 0, -1 ) +
-               this->template boundaryDerivative< MeshEntity, Vector,0,0,1 >( mesh, entity, u, time, 0, 0, -1 ) * 
-               this->template boundaryDerivative< MeshEntity, Vector,0,0,1 >( mesh, entity, u, time, 0, 0, -1 ) );
-    return 0.0;
+   const IndexType& cellIndex = entity.getIndex();
+   if( ( dx == 0 ) && ( dy == 0 ) && ( dz == 0 ) )
+      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 )
+         + this->template boundaryDerivative< MeshEntity, Vector, 0, 1, 0 >( mesh, entity, u, time, 1, 0, 0 )
+              * this->template boundaryDerivative< MeshEntity, Vector, 0, 1, 0 >( mesh, entity, u, time, 1, 0, 0 )
+         + this->template boundaryDerivative< MeshEntity, Vector, 0, 0, 1 >( mesh, entity, u, time, 1, 0, 0 )
+              * this->template boundaryDerivative< MeshEntity, Vector, 0, 0, 1 >( mesh, entity, u, time, 1, 0, 0 ) );
+   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 )
+         + this->template boundaryDerivative< MeshEntity, Vector, 0, 1, 0 >( mesh, entity, u, time, -1, 0, 0 )
+              * this->template boundaryDerivative< MeshEntity, Vector, 0, 1, 0 >( mesh, entity, u, time, -1, 0, 0 )
+         + this->template boundaryDerivative< MeshEntity, Vector, 0, 0, 1 >( mesh, entity, u, time, -1, 0, 0 )
+              * this->template boundaryDerivative< MeshEntity, Vector, 0, 0, 1 >( mesh, entity, u, time, -1, 0, 0 ) );
+   if( ( dx == 0 ) && ( dy == 1 ) && ( dz == 0 ) )
+      return ::sqrt(
+         this->eps
+         + this->template boundaryDerivative< MeshEntity, Vector, 1, 0, 0 >( mesh, entity, u, time, 0, 1, 0 )
+              * this->template boundaryDerivative< MeshEntity, Vector, 1, 0, 0 >( mesh, entity, u, time, 0, 1, 0 )
+         + this->template boundaryDerivative< MeshEntity, Vector, 0, 1, 0 >( mesh, entity, u, time, 0, 1, 0 )
+              * this->template boundaryDerivative< MeshEntity, Vector, 0, 1, 0 >( mesh, entity, u, time, 0, 1, 0 )
+         + this->template boundaryDerivative< MeshEntity, Vector, 0, 0, 1 >( mesh, entity, u, time, 0, 1, 0 )
+              * this->template boundaryDerivative< MeshEntity, Vector, 0, 0, 1 >( mesh, entity, u, time, 0, 1, 0 ) );
+   if( ( dx == 0 ) && ( dy == -1 ) && ( dz == 0 ) )
+      return ::sqrt(
+         this->eps
+         + this->template boundaryDerivative< MeshEntity, Vector, 1, 0, 0 >( mesh, entity, u, time, 0, -1, 0 )
+              * this->template boundaryDerivative< MeshEntity, Vector, 1, 0, 0 >( mesh, entity, u, time, 0, -1, 0 )
+         + this->template boundaryDerivative< MeshEntity, Vector, 0, 1, 0 >( mesh, entity, u, time, 0, -1, 0 )
+              * this->template boundaryDerivative< MeshEntity, Vector, 0, 1, 0 >( mesh, entity, u, time, 0, -1, 0 )
+         + this->template boundaryDerivative< MeshEntity, Vector, 0, 0, 1 >( mesh, entity, u, time, 0, -1, 0 )
+              * this->template boundaryDerivative< MeshEntity, Vector, 0, 0, 1 >( mesh, entity, u, time, 0, -1, 0 ) );
+   if( ( dx == 0 ) && ( dy == 0 ) && ( dz == 1 ) )
+      return ::sqrt(
+         this->eps
+         + this->template boundaryDerivative< MeshEntity, Vector, 1, 0, 0 >( mesh, entity, u, time, 0, 0, 1 )
+              * this->template boundaryDerivative< MeshEntity, Vector, 1, 0, 0 >( mesh, entity, u, time, 0, 0, 1 )
+         + this->template boundaryDerivative< MeshEntity, Vector, 0, 1, 0 >( mesh, entity, u, time, 0, 0, 1 )
+              * this->template boundaryDerivative< MeshEntity, Vector, 0, 1, 0 >( mesh, entity, u, time, 0, 0, 1 )
+         + this->template boundaryDerivative< MeshEntity, Vector, 0, 0, 1 >( mesh, entity, u, time, 0, 0, 1 )
+              * this->template boundaryDerivative< MeshEntity, Vector, 0, 0, 1 >( mesh, entity, u, time, 0, 0, 1 ) );
+   if( ( dx == 0 ) && ( dy == 0 ) && ( dz == -1 ) )
+      return ::sqrt(
+         this->eps
+         + this->template boundaryDerivative< MeshEntity, Vector, 1, 0, 0 >( mesh, entity, u, time, 0, 0, -1 )
+              * this->template boundaryDerivative< MeshEntity, Vector, 1, 0, 0 >( mesh, entity, u, time, 0, 0, -1 )
+         + this->template boundaryDerivative< MeshEntity, Vector, 0, 1, 0 >( mesh, entity, u, time, 0, 0, -1 )
+              * this->template boundaryDerivative< MeshEntity, Vector, 0, 1, 0 >( mesh, entity, u, time, 0, 0, -1 )
+         + this->template boundaryDerivative< MeshEntity, Vector, 0, 0, 1 >( mesh, entity, u, time, 0, 0, -1 )
+              * this->template boundaryDerivative< MeshEntity, Vector, 0, 0, 1 >( mesh, entity, u, time, 0, 0, -1 ) );
+   return 0.0;
 }
 
-} // namespace Operators
-} // namespace TNL
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/operator-Q/tnlOneSideDiffOperatorQ.h b/src/TNL/Operators/operator-Q/tnlOneSideDiffOperatorQ.h
index 7b333968d791c28b2e7b233a7940218e3063c904..7d5fc89e0059aa19f25bf7ad87b542c0f5670bd8 100644
--- a/src/TNL/Operators/operator-Q/tnlOneSideDiffOperatorQ.h
+++ b/src/TNL/Operators/operator-Q/tnlOneSideDiffOperatorQ.h
@@ -11,22 +11,14 @@
 namespace TNL {
 namespace Operators {
 
-template< typename Mesh,
-          typename Real = typename Mesh::RealType,
-          typename Index = typename Mesh::GlobalIndexType > 
+template< typename Mesh, typename Real = typename Mesh::RealType, typename Index = typename Mesh::GlobalIndexType >
 class tnlOneSideDiffOperatorQ
-{
-};
+{};
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class tnlOneSideDiffOperatorQ< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Real, Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class tnlOneSideDiffOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >
 {
-   public: 
-   
+public:
    typedef Meshes::Grid< 1, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
@@ -35,33 +27,25 @@ class tnlOneSideDiffOperatorQ< Meshes::Grid< 1,MeshReal, Device, MeshIndex >, Re
 
    template< typename MeshFunction, typename MeshEntity >
    __cuda_callable__
-   Real operator()( const MeshFunction& u,
-                    const MeshEntity& entity,
-                    const Real& time = 0.0 ) const;
-      
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time = 0.0 ) const;
+
    template< typename MeshFunction, typename MeshEntity >
    __cuda_callable__
-   Real getValueStriped( const MeshFunction& u,
-                         const MeshEntity& entity,   
-                         const Real& time = 0.0 ) const;
-          
-   void setEps(const Real& eps);
-      
-   private:
-   
+   Real
+   getValueStriped( const MeshFunction& u, const MeshEntity& entity, const Real& time = 0.0 ) const;
+
+   void
+   setEps( const Real& eps );
+
+private:
    RealType eps, epsSquare;
 };
 
-
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-class tnlOneSideDiffOperatorQ< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Real, Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+class tnlOneSideDiffOperatorQ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >
 {
-   public: 
-   
+public:
    typedef Meshes::Grid< 2, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
@@ -70,34 +54,25 @@ class tnlOneSideDiffOperatorQ< Meshes::Grid< 2,MeshReal, Device, MeshIndex >, Re
 
    template< typename MeshFunction, typename MeshEntity >
    __cuda_callable__
-   Real operator()( const MeshFunction& u,
-                    const MeshEntity& entity,
-                    const Real& time = 0.0 ) const;
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time = 0.0 ) const;
 
-   
    template< typename MeshFunction, typename MeshEntity >
    __cuda_callable__
-   Real getValueStriped( const MeshFunction& u,
-                         const MeshEntity& entity,          
-                         const Real& time = 0.0 ) const;
-        
-   void setEps( const Real& eps );
-   
-   private:
-   
+   Real
+   getValueStriped( const MeshFunction& u, const MeshEntity& entity, const Real& time = 0.0 ) const;
+
+   void
+   setEps( const Real& eps );
+
+private:
    RealType eps, epsSquare;
 };
 
-
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 class tnlOneSideDiffOperatorQ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >
 {
-   public: 
-   
+public:
    typedef Meshes::Grid< 3, MeshReal, Device, MeshIndex > MeshType;
    typedef typename MeshType::CoordinatesType CoordinatesType;
    typedef Real RealType;
@@ -106,24 +81,22 @@ class tnlOneSideDiffOperatorQ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, R
 
    template< typename MeshFunction, typename MeshEntity >
    __cuda_callable__
-   Real operator()( const MeshFunction& u,
-                    const MeshEntity& entity,
-                    const Real& time = 0.0 ) const;
-   
+   Real
+   operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time = 0.0 ) const;
+
    template< typename MeshFunction, typename MeshEntity >
    __cuda_callable__
-   Real getValueStriped( const MeshFunction& u,
-                         const MeshEntity& entity,          
-                         const Real& time ) const;
-        
-   void setEps(const Real& eps);
-   
-   private:
-   
+   Real
+   getValueStriped( const MeshFunction& u, const MeshEntity& entity, const Real& time ) const;
+
+   void
+   setEps( const Real& eps );
+
+private:
    RealType eps, epsSquare;
 };
 
-} // namespace Operators
-} // namespace TNL
+}  // namespace Operators
+}  // namespace TNL
 
 #include <TNL/Operators/operator-Q/tnlOneSideDiffOperatorQ_impl.h>
diff --git a/src/TNL/Operators/operator-Q/tnlOneSideDiffOperatorQ_impl.h b/src/TNL/Operators/operator-Q/tnlOneSideDiffOperatorQ_impl.h
index d866f36e14595aca50dd2c911be2d4fdc36ec9d1..bb0bede991e7be4f25bac3c2fde9dc3738f344d5 100644
--- a/src/TNL/Operators/operator-Q/tnlOneSideDiffOperatorQ_impl.h
+++ b/src/TNL/Operators/operator-Q/tnlOneSideDiffOperatorQ_impl.h
@@ -12,213 +12,167 @@
 namespace TNL {
 namespace Operators {
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 void
-tnlOneSideDiffOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
-setEps( const Real& eps )
+tnlOneSideDiffOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::setEps( const Real& eps )
 {
-  this->eps = eps;
-  this->epsSquare = eps*eps;
+   this->eps = eps;
+   this->epsSquare = eps * eps;
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 template< typename MeshFunction, typename MeshEntity >
 __cuda_callable__
 Real
-tnlOneSideDiffOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
-operator()( const MeshFunction& u,
-            const MeshEntity& entity,          
-            const Real& time ) const
+tnlOneSideDiffOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::operator()( const MeshFunction& u,
+                                                                                                    const MeshEntity& entity,
+                                                                                                    const Real& time ) const
 {
    const IndexType& cellIndex = entity.getIndex();
-   const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities();      
+   const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities();
    const typename MeshEntity::MeshType& mesh = entity.getMesh();
-   const RealType& u_x = ( u[ neighborEntities.template getEntityIndex< 1 >() ] - u[ cellIndex ] ) *
-                         mesh.template getSpaceStepsProducts< -1 >();
-   return ::sqrt( this->epsSquare + u_x * u_x );          
+   const RealType& u_x =
+      ( u[ neighborEntities.template getEntityIndex< 1 >() ] - u[ cellIndex ] ) * mesh.template getSpaceStepsProducts< -1 >();
+   return ::sqrt( this->epsSquare + u_x * u_x );
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 template< typename MeshFunction, typename MeshEntity >
 __cuda_callable__
 Real
-tnlOneSideDiffOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::
-getValueStriped( const MeshFunction& u,
-                 const MeshEntity& entity,                 
-                 const Real& time ) const
+tnlOneSideDiffOperatorQ< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, Real, Index >::getValueStriped(
+   const MeshFunction& u,
+   const MeshEntity& entity,
+   const Real& time ) const
 {
    const IndexType& cellIndex = entity.getIndex();
-   const typename MeshEntity::template NeighborEntities< 1 >& neighborEntities = entity.getNeighborEntities();      
+   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[ neighborEntities.template getEntityIndex< 1 >() ] - u_c ) * 
-                           mesh.template getSpaceStepsProducts< -1 >();
-   const RealType& u_x_b = ( u_c - u[ neighborEntities.template getEntityIndex< -1 >() ] ) * 
-                           mesh.template getSpaceStepsProducts< -1 >();   
+   const RealType& u_x_f =
+      ( u[ neighborEntities.template getEntityIndex< 1 >() ] - u_c ) * mesh.template getSpaceStepsProducts< -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 ) );
 }
 
 /***
  * 2D
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 void
-tnlOneSideDiffOperatorQ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
-setEps( const Real& eps )
+tnlOneSideDiffOperatorQ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::setEps( const Real& eps )
 {
-  this->eps = eps;
-  this->epsSquare = eps*eps;
+   this->eps = eps;
+   this->epsSquare = eps * eps;
 }
-   
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 template< typename MeshFunction, typename MeshEntity >
 __cuda_callable__
 Real
-tnlOneSideDiffOperatorQ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
-operator()( const MeshFunction& u,
-            const MeshEntity& entity,          
-            const Real& time ) const
+tnlOneSideDiffOperatorQ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::operator()( const MeshFunction& u,
+                                                                                                    const MeshEntity& entity,
+                                                                                                    const Real& time ) const
 {
    const IndexType& cellIndex = entity.getIndex();
-   const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities();      
+   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[ neighborEntities.template getEntityIndex< 1, 0 >() ] - u_c ) *
-                         mesh.template getSpaceStepsProducts< -1, 0 >();
-   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 ); 
+   const RealType u_x =
+      ( u[ neighborEntities.template getEntityIndex< 1, 0 >() ] - u_c ) * mesh.template getSpaceStepsProducts< -1, 0 >();
+   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 );
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 template< typename MeshFunction, typename MeshEntity >
 __cuda_callable__
 Real
-tnlOneSideDiffOperatorQ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::
-getValueStriped( const MeshFunction& u,
-                 const MeshEntity& entity,                 
-                 const Real& time ) const
+tnlOneSideDiffOperatorQ< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, Real, Index >::getValueStriped(
+   const MeshFunction& u,
+   const MeshEntity& entity,
+   const Real& time ) const
 {
    const IndexType& cellIndex = entity.getIndex();
-   const typename MeshEntity::template NeighborEntities< 2 >& neighborEntities = entity.getNeighborEntities();      
+   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[ neighborEntities.template getEntityIndex< 1, 0 >() ] - u_c ) *
-                          mesh.template getSpaceStepsProducts< -1, 0 >();
-   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[ neighborEntities.template getEntityIndex< -1, 0 >() ] ) *
-                          mesh.template getSpaceStepsProducts< -1, 0 >();
-   const RealType u_y_b = ( u_c - u[ neighborEntities.template getEntityIndex< 0, -1 >() ] ) *
-                          mesh.template getSpaceStepsProducts< 0, -1 >();
-   
-   return ::sqrt( this->epsSquare + 
-                0.5 * ( u_x_f * u_x_f + u_x_b * u_x_b +
-                        u_y_f * u_y_f + u_y_b * u_y_b ) );
+   const RealType u_x_f =
+      ( u[ neighborEntities.template getEntityIndex< 1, 0 >() ] - u_c ) * mesh.template getSpaceStepsProducts< -1, 0 >();
+   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[ neighborEntities.template getEntityIndex< -1, 0 >() ] ) * mesh.template getSpaceStepsProducts< -1, 0 >();
+   const RealType u_y_b =
+      ( u_c - u[ neighborEntities.template getEntityIndex< 0, -1 >() ] ) * mesh.template getSpaceStepsProducts< 0, -1 >();
+
+   return ::sqrt( this->epsSquare + 0.5 * ( u_x_f * u_x_f + u_x_b * u_x_b + u_y_f * u_y_f + u_y_b * u_y_b ) );
 }
 /***
  * 3D
  */
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
-void 
-tnlOneSideDiffOperatorQ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
-setEps( const Real& eps )
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
+void
+tnlOneSideDiffOperatorQ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::setEps( const Real& eps )
 {
-  this->eps = eps;
-  this->epsSquare = eps * eps;
+   this->eps = eps;
+   this->epsSquare = eps * eps;
 }
 
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 template< typename MeshFunction, typename MeshEntity >
 __cuda_callable__
 Real
-tnlOneSideDiffOperatorQ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
-operator()( const MeshFunction& u,
-            const MeshEntity& entity,            
-            const Real& time ) const
+tnlOneSideDiffOperatorQ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::operator()( const MeshFunction& u,
+                                                                                                    const MeshEntity& entity,
+                                                                                                    const Real& time ) const
 {
    const IndexType& cellIndex = entity.getIndex();
-   const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities();      
+   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[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ] - u_c ) *
-                         mesh.template getSpaceStepsProducts< -1, 0, 0 >();
-   const RealType u_y = ( u[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ] - u_c ) *
-                         mesh.template getSpaceStepsProducts< 0, -1, 0 >();
-   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 ); 
+   const RealType& u_c = u[ cellIndex ];
+
+   const RealType u_x =
+      ( u[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ] - u_c ) * mesh.template getSpaceStepsProducts< -1, 0, 0 >();
+   const RealType u_y =
+      ( u[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ] - u_c ) * mesh.template getSpaceStepsProducts< 0, -1, 0 >();
+   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 );
 }
-   
-template< typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real,
-          typename Index >
+
+template< typename MeshReal, typename Device, typename MeshIndex, typename Real, typename Index >
 template< typename MeshFunction, typename MeshEntity >
 __cuda_callable__
 Real
-tnlOneSideDiffOperatorQ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::
-getValueStriped( const MeshFunction& u,
-                 const MeshEntity& entity,                 
-                 const Real& time ) const
+tnlOneSideDiffOperatorQ< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, Real, Index >::getValueStriped(
+   const MeshFunction& u,
+   const MeshEntity& entity,
+   const Real& time ) const
 {
    const IndexType& cellIndex = entity.getIndex();
-   const typename MeshEntity::template NeighborEntities< 3 >& neighborEntities = entity.getNeighborEntities();      
+   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[ neighborEntities.template getEntityIndex< 1, 0, 0 >() ] - u_c ) *
-                          mesh.template getSpaceStepsProducts< -1, 0, 0 >();
-   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[ neighborEntities.template getEntityIndex< 0, 0, 1 >() ] - u_c ) *
-                          mesh.template getSpaceStepsProducts< 0, 0, -1 >();   
-   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[ neighborEntities.template getEntityIndex< 0, -1, 0 >() ] ) *
-                          mesh.template getSpaceStepsProducts< 0, -1, 0 >();
-   const RealType u_z_b = ( u_c - u[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] ) *
-                          mesh.template getSpaceStepsProducts< 0, 0, -1 >();
-   
-   return ::sqrt( this->epsSquare + 
-                0.5 * ( u_x_f * u_x_f + u_x_b * u_x_b +
-                        u_y_f * u_y_f + u_y_b * u_y_b + 
-                        u_z_f * u_z_f + u_z_b * u_z_b ) );
-}   
-
-} // namespace Operators
-} // namespace TNL
+
+   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[ neighborEntities.template getEntityIndex< 0, 1, 0 >() ] - u_c ) * mesh.template getSpaceStepsProducts< 0, -1, 0 >();
+   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[ neighborEntities.template getEntityIndex< -1, 0, 0 >() ] ) * mesh.template getSpaceStepsProducts< -1, 0, 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[ neighborEntities.template getEntityIndex< 0, 0, -1 >() ] ) * mesh.template getSpaceStepsProducts< 0, 0, -1 >();
+
+   return ::sqrt( this->epsSquare
+                  + 0.5 * ( u_x_f * u_x_f + u_x_b * u_x_b + u_y_f * u_y_f + u_y_b * u_y_b + u_z_f * u_z_f + u_z_b * u_z_b ) );
+}
+
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Operators/operator-curvature/ExactOperatorCurvature.h b/src/TNL/Operators/operator-curvature/ExactOperatorCurvature.h
index 9b138cf079e3baa69ff9bd0ab049aa0a5152e0b4..2418a6a442fe0ed4c0309ef540f423a1684c5aac 100644
--- a/src/TNL/Operators/operator-curvature/ExactOperatorCurvature.h
+++ b/src/TNL/Operators/operator-curvature/ExactOperatorCurvature.h
@@ -12,7 +12,7 @@
 #include <TNL/Functions/tnlFunction.h>
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
 template< typename ExactOperatorQ, int Dimension >
 class ExactOperatorCurvature
@@ -21,57 +21,77 @@ class ExactOperatorCurvature
 template< typename ExactOperatorQ >
 class ExactOperatorCurvature< OperatorQ, 1 >
 {
-   public:
-
-      enum { Dimension = 1 };
-
-      template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Function, typename Point, typename Real = typename Point::RealType >
-      __cuda_callable__
-      static Real getValue( const Function& function,
-                            const Point& v,
-                            const Real& time = 0.0, const Real& eps = 1.0 );
-      
+public:
+   enum
+   {
+      Dimension = 1
+   };
+
+   template< int XDiffOrder = 0,
+             int YDiffOrder = 0,
+             int ZDiffOrder = 0,
+             typename Function,
+             typename Point,
+             typename Real = typename Point::RealType >
+   __cuda_callable__
+   static Real
+   getValue( const Function& function, const Point& v, const Real& time = 0.0, const Real& eps = 1.0 );
 };
 
 template< typename ExactOperatorQ >
 class ExactOperatorCurvature< ExactOperatorQ, 2 >
 {
-   public:
-
-      enum { Dimension = 2 };
-
-      template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Function, typename Point, typename Real = typename Point::RealType >
-      __cuda_callable__
-      static Real getValue( const Function& function,
-                            const Point& v,
-                            const Real& time = 0.0, const Real& eps = 1.0 );
+public:
+   enum
+   {
+      Dimension = 2
+   };
+
+   template< int XDiffOrder = 0,
+             int YDiffOrder = 0,
+             int ZDiffOrder = 0,
+             typename Function,
+             typename Point,
+             typename Real = typename Point::RealType >
+   __cuda_callable__
+   static Real
+   getValue( const Function& function, const Point& v, const Real& time = 0.0, const Real& eps = 1.0 );
 };
 
 template< typename ExactOperatorQ >
 class ExactOperatorCurvature< ExactOperatorQ, 3 >
 {
-   public:
-
-      enum { Dimension = 3 };
-
-      template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Function, typename Point, typename Real = typename Point::RealType >
-      __cuda_callable__
-      static Real getValue( const Function& function,
-                            const Point& v,
-                            const Real& time = 0.0, const Real& eps = 1.0 )
-      {
-         return 0;
-      }
+public:
+   enum
+   {
+      Dimension = 3
+   };
+
+   template< int XDiffOrder = 0,
+             int YDiffOrder = 0,
+             int ZDiffOrder = 0,
+             typename Function,
+             typename Point,
+             typename Real = typename Point::RealType >
+   __cuda_callable__
+   static Real
+   getValue( const Function& function, const Point& v, const Real& time = 0.0, const Real& eps = 1.0 )
+   {
+      return 0;
+   }
 };
 
 template< typename ExactOperatorQ, int Dimension >
 class tnlFunctionType< ExactOperatorCurvature< ExactOperatorQ, Dimension > >
 {
-   public:
-      enum { Type = tnlSpaceDomain };
+public:
+   enum
+   {
+      Type = tnlSpaceDomain
+   };
 };
 
-} // namespace Operators
-} // namespace TNL
+}  // namespace Operators
+}  // namespace TNL
 
 #include <TNL/Operators/operator-curvature/ExactOperatorCurvature_impl.h>
diff --git a/src/TNL/Operators/operator-curvature/ExactOperatorCurvature_impl.h b/src/TNL/Operators/operator-curvature/ExactOperatorCurvature_impl.h
index 27e591a95acfb93cb46d935f904bbf8657d394a3..f401f7310cb3c6bff9e38448f58e3e60d6b6674f 100644
--- a/src/TNL/Operators/operator-curvature/ExactOperatorCurvature_impl.h
+++ b/src/TNL/Operators/operator-curvature/ExactOperatorCurvature_impl.h
@@ -9,44 +9,45 @@
 #include <TNL/Operators/operator-curvature/ExactOperatorCurvature.h>
 
 namespace TNL {
-namespace Operators {   
+namespace Operators {
 
 template< typename OperatorQ >
 template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, typename Function, typename Point, typename Real >
 __cuda_callable__
 Real
-tnlExactOperatorQ< 1 >::
-getValue( const Function& function,
-          const Point& v,
-          const Real& time, const Real& eps )
+tnlExactOperatorQ< 1 >::getValue( const Function& function, 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, 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.0;
+   if( XDiffOrder == 0 )
+      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;
 }
 
 template< int XDiffOrder, int YDiffOrder, int ZDiffOrder, typename Function, typename Point, typename Real >
 __cuda_callable__
 Real
-tnlExactOperatorQ< 2 >::
-getValue( const Function& function,
-          const Point& v,
-          const Real& time, const Real& eps )
+tnlExactOperatorQ< 2 >::getValue( const Function& function, 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, 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.0;
+   if( XDiffOrder == 0 && YDiffOrder == 0 )
+      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;
 }
 
-} // namespace Operators
-} // namespace TNL
+}  // namespace Operators
+}  // namespace TNL
diff --git a/src/TNL/Pointers/DevicePointer.h b/src/TNL/Pointers/DevicePointer.h
index b1e62fe1ff3a34495f004cf6fc96bc22cf385bf0..84b963c6dbb6a45ee2a5d000baec09c19a806201 100644
--- a/src/TNL/Pointers/DevicePointer.h
+++ b/src/TNL/Pointers/DevicePointer.h
@@ -41,11 +41,11 @@ namespace Pointers {
  * \par Output
  * \include DevicePointerExample.out
  */
-template< typename Object,
-          typename Device = typename Object::DeviceType >
+template< typename Object, typename Device = typename Object::DeviceType >
 class DevicePointer
 {
-   static_assert( ! std::is_same< Device, void >::value, "The device cannot be void. You need to specify the device explicitly in your code." );
+   static_assert( ! std::is_same< Device, void >::value,
+                  "The device cannot be void. You need to specify the device explicitly in your code." );
 };
 
 /**
@@ -56,302 +56,301 @@ class DevicePointer
 template< typename Object >
 class DevicePointer< Object, Devices::Host > : public SmartPointer
 {
-   private:
-      /**
-       * \typedef Enabler
-       * Convenient template alias for controlling the selection of copy- and
-       * move-constructors and assignment operators using SFINAE.
-       * The type Object_ is "enabled" iff Object_ and Object are not the same,
-       * but after removing const and volatile qualifiers they are the same.
-       */
-      template< typename Object_ >
-      using Enabler = std::enable_if< ! std::is_same< Object_, Object >::value &&
-                                      std::is_same< typename std::remove_cv< Object >::type, Object_ >::value >;
-
-      // friend class will be needed for templated assignment operators
-      template< typename Object_, typename Device_ >
-      friend class DevicePointer;
-
-   public:
-
-      /**
-       * \typedef ObjectType is the type of object owned by the pointer.
-       */
-      using ObjectType = Object;
-
-      /**
-       * \typedef DeviceType is the type of device where the object is to be
-       * mirrored.
-       */
-      using DeviceType = Devices::Host;
-
-      /**
-       * \brief Constructor of an empty pointer.
-       */
-      DevicePointer( std::nullptr_t )
-      : pointer( nullptr )
-      {}
-
-      /**
-       * \brief Constructor with an object reference.
-       *
-       * \param obj reference to an object to be managed by the pointer.
-       */
-      explicit  DevicePointer( ObjectType& obj )
-      : pointer( nullptr )
-      {
-         this->pointer = &obj;
-      }
-
-      /**
-       * \brief Copy constructor.
-       *
-       * \param pointer is the source device pointer.
-       */
-      DevicePointer( const DevicePointer& pointer ) // this is needed only to avoid the default compiler-generated constructor
-      : pointer( pointer.pointer )
-      {
-      }
-
-      /**
-       * \brief Copy constructor.
-       *
-       * This is specialization for compatible object types.
-       *
-       * See \ref Enabler.
-       *
-       * \param pointer is the source device pointer.
-       */
-      template< typename Object_,
-                typename = typename Enabler< Object_ >::type >
-      DevicePointer( const DevicePointer< Object_, DeviceType >& pointer ) // conditional constructor for non-const -> const data
-      : pointer( pointer.pointer )
-      {
-      }
-
-      /**
-       * \brief Move constructor.
-       *
-       * \param pointer is the source device pointer.
-       */
-      DevicePointer( DevicePointer&& pointer ) // this is needed only to avoid the default compiler-generated constructor
-      : pointer( pointer.pointer )
-      {
-         pointer.pointer = nullptr;
-      }
-
-      /**
-       * \brief Move constructor.
-       *
-       * This is specialization for compatible object types.
-       *
-       * See \ref Enabler.
-       *
-       * \param pointer is the source device pointer.
-       */
-      template< typename Object_,
-                typename = typename Enabler< Object_ >::type >
-      DevicePointer( DevicePointer< Object_, DeviceType >&& pointer ) // conditional constructor for non-const -> const data
-      : pointer( pointer.pointer )
-      {
-         pointer.pointer = nullptr;
-      }
+private:
+   /**
+    * \typedef Enabler
+    * Convenient template alias for controlling the selection of copy- and
+    * move-constructors and assignment operators using SFINAE.
+    * The type Object_ is "enabled" iff Object_ and Object are not the same,
+    * but after removing const and volatile qualifiers they are the same.
+    */
+   template< typename Object_ >
+   using Enabler = std::enable_if< ! std::is_same< Object_, Object >::value
+                                   && std::is_same< typename std::remove_cv< Object >::type, Object_ >::value >;
+
+   // friend class will be needed for templated assignment operators
+   template< typename Object_, typename Device_ >
+   friend class DevicePointer;
+
+public:
+   /**
+    * \typedef ObjectType is the type of object owned by the pointer.
+    */
+   using ObjectType = Object;
+
+   /**
+    * \typedef DeviceType is the type of device where the object is to be
+    * mirrored.
+    */
+   using DeviceType = Devices::Host;
+
+   /**
+    * \brief Constructor of an empty pointer.
+    */
+   DevicePointer( std::nullptr_t ) : pointer( nullptr ) {}
+
+   /**
+    * \brief Constructor with an object reference.
+    *
+    * \param obj reference to an object to be managed by the pointer.
+    */
+   explicit DevicePointer( ObjectType& obj ) : pointer( nullptr )
+   {
+      this->pointer = &obj;
+   }
 
-      /**
-       * \brief Arrow operator for accessing the object owned by constant smart pointer.
-       *
-       * \return constant pointer to the object owned by this smart pointer.
-       */
-      const Object* operator->() const
-      {
-         return this->pointer;
-      }
+   /**
+    * \brief Copy constructor.
+    *
+    * \param pointer is the source device pointer.
+    */
+   DevicePointer( const DevicePointer& pointer )  // this is needed only to avoid the default compiler-generated constructor
+   : pointer( pointer.pointer )
+   {}
+
+   /**
+    * \brief Copy constructor.
+    *
+    * This is specialization for compatible object types.
+    *
+    * See \ref Enabler.
+    *
+    * \param pointer is the source device pointer.
+    */
+   template< typename Object_, typename = typename Enabler< Object_ >::type >
+   DevicePointer( const DevicePointer< Object_, DeviceType >& pointer )  // conditional constructor for non-const -> const data
+   : pointer( pointer.pointer )
+   {}
+
+   /**
+    * \brief Move constructor.
+    *
+    * \param pointer is the source device pointer.
+    */
+   DevicePointer( DevicePointer&& pointer ) noexcept  // this is needed only to avoid the default compiler-generated constructor
+   : pointer( pointer.pointer )
+   {
+      pointer.pointer = nullptr;
+   }
 
-      /**
-       * \brief Arrow operator for accessing the object owned by non-constant smart pointer.
-       *
-       * \return pointer to the object owned by this smart pointer.
-       */
-      Object* operator->()
-      {
-         return this->pointer;
-      }
+   /**
+    * \brief Move constructor.
+    *
+    * This is specialization for compatible object types.
+    *
+    * See \ref Enabler.
+    *
+    * \param pointer is the source device pointer.
+    */
+   template< typename Object_, typename = typename Enabler< Object_ >::type >
+   DevicePointer( DevicePointer< Object_, DeviceType >&& pointer )  // conditional constructor for non-const -> const data
+   : pointer( pointer.pointer )
+   {
+      pointer.pointer = nullptr;
+   }
 
-      /**
-       * \brief Dereferencing operator for accessing the object owned by constant smart pointer.
-       *
-       * \return constant reference to the object owned by this smart pointer.
-       */
-      const Object& operator *() const
-      {
-         return *( this->pointer );
-      }
+   /**
+    * \brief Arrow operator for accessing the object owned by constant smart pointer.
+    *
+    * \return constant pointer to the object owned by this smart pointer.
+    */
+   const Object*
+   operator->() const
+   {
+      return this->pointer;
+   }
 
-      /**
-       * \brief Dereferencing operator for accessing the object owned by non-constant smart pointer.
-       *
-       * \return reference to the object owned by this smart pointer.
-       */
-      Object& operator *()
-      {
-         return *( this->pointer );
-      }
+   /**
+    * \brief Arrow operator for accessing the object owned by non-constant smart pointer.
+    *
+    * \return pointer to the object owned by this smart pointer.
+    */
+   Object*
+   operator->()
+   {
+      return this->pointer;
+   }
 
-      /**
-       * \brief Conversion to boolean type.
-       *
-       * \return Returns true if the pointer is not empty, false otherwise.
-       */
-      __cuda_callable__
-      operator bool() const
-      {
-         return this->pointer;
-      }
+   /**
+    * \brief Dereferencing operator for accessing the object owned by constant smart pointer.
+    *
+    * \return constant reference to the object owned by this smart pointer.
+    */
+   const Object&
+   operator*() const
+   {
+      return *( this->pointer );
+   }
 
-      /**
-       * \brief Negation operator.
-       *
-       * \return Returns false if the pointer is not empty, true otherwise.
-       */
-      __cuda_callable__
-      bool operator!() const
-      {
-         return ! this->pointer;
-      }
+   /**
+    * \brief Dereferencing operator for accessing the object owned by non-constant smart pointer.
+    *
+    * \return reference to the object owned by this smart pointer.
+    */
+   Object&
+   operator*()
+   {
+      return *( this->pointer );
+   }
 
-      /**
-       * \brief Constant object reference getter.
-       *
-       * No synchronization of this pointer will be performed due to calling
-       * this method.
-       *
-       * \tparam Device says what image of the object one want to dereference. It
-       * can be either \ref DeviceType or Devices::Host.
-       * \return constant reference to the object image on given device.
-       */
-      template< typename Device = Devices::Host >
-      __cuda_callable__
-      const Object& getData() const
-      {
-         return *( this->pointer );
-      }
+   /**
+    * \brief Conversion to boolean type.
+    *
+    * \return Returns true if the pointer is not empty, false otherwise.
+    */
+   __cuda_callable__
+   operator bool() const
+   {
+      return this->pointer;
+   }
 
-      /**
-       * \brief Non-constant object reference getter.
-       *
-       * No synchronization of this pointer will be performed due to calling
-       * this method.
-       *
-       * \tparam Device says what image of the object one want to dereference. It
-       * can be either \ref DeviceType or Devices::Host.
-       * \return constant reference to the object image on given device.
-       */
-      template< typename Device = Devices::Host >
-      __cuda_callable__
-      Object& modifyData()
-      {
-         return *( this->pointer );
-      }
+   /**
+    * \brief Negation operator.
+    *
+    * \return Returns false if the pointer is not empty, true otherwise.
+    */
+   __cuda_callable__
+   bool
+   operator!() const
+   {
+      return ! this->pointer;
+   }
 
-      /**
-       * \brief Assignment operator.
-       *
-       * It assigns object owned by the pointer \ref ptr to \ref this pointer.
-       *
-       * \param ptr input pointer
-       * \return constant reference to \ref this
-       */
-      const DevicePointer& operator=( const DevicePointer& ptr ) // this is needed only to avoid the default compiler-generated operator
-      {
-         this->pointer = ptr.pointer;
-         return *this;
-      }
+   /**
+    * \brief Constant object reference getter.
+    *
+    * No synchronization of this pointer will be performed due to calling
+    * this method.
+    *
+    * \tparam Device says what image of the object one want to dereference. It
+    * can be either \ref DeviceType or Devices::Host.
+    * \return constant reference to the object image on given device.
+    */
+   template< typename Device = Devices::Host >
+   __cuda_callable__
+   const Object&
+   getData() const
+   {
+      return *( this->pointer );
+   }
 
-      /**
-       * \brief Assignment operator for compatible object types.
-       *
-       * It assigns object owned by the pointer \ref ptr to \ref this pointer.
-       *
-       * See \ref Enabler.
-       *
-       * \param ptr input pointer
-       * \return constant reference to \ref this
-       */
-      template< typename Object_,
-                typename = typename Enabler< Object_ >::type >
-      const DevicePointer& operator=( const DevicePointer< Object_, DeviceType >& ptr ) // conditional operator for non-const -> const data
-      {
-         this->pointer = ptr.pointer;
-         return *this;
-      }
+   /**
+    * \brief Non-constant object reference getter.
+    *
+    * No synchronization of this pointer will be performed due to calling
+    * this method.
+    *
+    * \tparam Device says what image of the object one want to dereference. It
+    * can be either \ref DeviceType or Devices::Host.
+    * \return constant reference to the object image on given device.
+    */
+   template< typename Device = Devices::Host >
+   __cuda_callable__
+   Object&
+   modifyData()
+   {
+      return *( this->pointer );
+   }
 
-      /**
-       * \brief Move operator.
-       *
-       * It assigns object owned by the pointer \ref ptr to \ref this pointer.
-       *
-       * \param ptr input pointer
-       * \return constant reference to \ref this
-       */
-      const DevicePointer& operator=( DevicePointer&& ptr ) // this is needed only to avoid the default compiler-generated operator
-      {
-         this->pointer = ptr.pointer;
-         ptr.pointer = nullptr;
-         return *this;
-      }
+   /**
+    * \brief Assignment operator.
+    *
+    * It assigns object owned by the pointer \ref ptr to \ref this pointer.
+    *
+    * \param ptr input pointer
+    * \return constant reference to \ref this
+    */
+   const DevicePointer&
+   operator=( const DevicePointer& ptr )  // this is needed only to avoid the default compiler-generated operator
+   {
+      this->pointer = ptr.pointer;
+      return *this;
+   }
 
-      /**
-       * \brief Move operator.
-       *
-       * It assigns object owned by the pointer \ref ptr to \ref this pointer.
-       *
-       * See \ref Enabler.
-       *
-       * \param ptr input pointer
-       * \return constant reference to \ref this
-       */
-      template< typename Object_,
-                typename = typename Enabler< Object_ >::type >
-      const DevicePointer& operator=( DevicePointer< Object_, DeviceType >&& ptr ) // conditional operator for non-const -> const data
-      {
-         this->pointer = ptr.pointer;
-         ptr.pointer = nullptr;
-         return *this;
-      }
+   /**
+    * \brief Assignment operator for compatible object types.
+    *
+    * It assigns object owned by the pointer \ref ptr to \ref this pointer.
+    *
+    * See \ref Enabler.
+    *
+    * \param ptr input pointer
+    * \return constant reference to \ref this
+    */
+   template< typename Object_, typename = typename Enabler< Object_ >::type >
+   const DevicePointer&
+   operator=( const DevicePointer< Object_, DeviceType >& ptr )  // conditional operator for non-const -> const data
+   {
+      this->pointer = ptr.pointer;
+      return *this;
+   }
 
-      /**
-       * \brief Cross-device pointer synchronization.
-       *
-       * For the smart pointers on the host, this method does nothing.
-       *
-       * \return true.
-       */
-      bool synchronize()
-      {
-         return true;
-      }
+   /**
+    * \brief Move operator.
+    *
+    * It assigns object owned by the pointer \ref ptr to \ref this pointer.
+    *
+    * \param ptr input pointer
+    * \return constant reference to \ref this
+    */
+   const DevicePointer&
+   operator=( DevicePointer&& ptr ) noexcept  // this is needed only to avoid the default compiler-generated operator
+   {
+      this->pointer = ptr.pointer;
+      ptr.pointer = nullptr;
+      return *this;
+   }
 
-      /**
-       * \brief Swap the owned object with another pointer.
-       *
-       * \param ptr2 the other device pointer for swapping.
-       */
-      void swap( DevicePointer& ptr2 )
-      {
-         std::swap( this->pointer, ptr2.pointer );
-      }
+   /**
+    * \brief Move operator.
+    *
+    * It assigns object owned by the pointer \ref ptr to \ref this pointer.
+    *
+    * See \ref Enabler.
+    *
+    * \param ptr input pointer
+    * \return constant reference to \ref this
+    */
+   template< typename Object_, typename = typename Enabler< Object_ >::type >
+   const DevicePointer&
+   operator=( DevicePointer< Object_, DeviceType >&& ptr )  // conditional operator for non-const -> const data
+   {
+      this->pointer = ptr.pointer;
+      ptr.pointer = nullptr;
+      return *this;
+   }
 
-      /**
-       * \brief Destructor.
-       */
-      ~DevicePointer()
-      {
-      }
+   /**
+    * \brief Cross-device pointer synchronization.
+    *
+    * For the smart pointers on the host, this method does nothing.
+    *
+    * \return true.
+    */
+   bool
+   synchronize() override
+   {
+      return true;
+   }
 
+   /**
+    * \brief Swap the owned object with another pointer.
+    *
+    * \param ptr2 the other device pointer for swapping.
+    */
+   void
+   swap( DevicePointer& ptr2 )
+   {
+      std::swap( this->pointer, ptr2.pointer );
+   }
 
-   protected:
+   /**
+    * \brief Destructor.
+    */
+   ~DevicePointer() override = default;
 
-      Object* pointer;
+protected:
+   Object* pointer;
 };
 
 /**
@@ -362,473 +361,468 @@ class DevicePointer< Object, Devices::Host > : public SmartPointer
 template< typename Object >
 class DevicePointer< Object, Devices::Cuda > : public SmartPointer
 {
-   private:
-      /**
-       * \typedef Enabler
-       *
-       * Convenient template alias for controlling the selection of copy- and
-       * move-constructors and assignment operators using SFINAE.
-       * The type Object_ is "enabled" iff Object_ and Object are not the same,
-       * but after removing const and volatile qualifiers they are the same.
-       */
-      template< typename Object_ >
-      using Enabler = std::enable_if< ! std::is_same< Object_, Object >::value &&
-                                      std::is_same< typename std::remove_cv< Object >::type, Object_ >::value >;
-
-      // friend class will be needed for templated assignment operators
-      template< typename Object_, typename Device_ >
-      friend class DevicePointer;
-
-   public:
-
-      /**
-       * \typedef ObjectType is the type of object owned by the pointer.
-       */
-      using ObjectType = Object;
-
-      /**
-       * \typedef DeviceType is the type of device where the object is to be
-       * mirrored.
-       */
-      using DeviceType = Devices::Cuda;
-
-      /**
-       * \typedef AllocatorType is the type of the allocator for \e DeviceType.
-       */
-      using AllocatorType = typename Allocators::Default< DeviceType >::Allocator< ObjectType >;
-
-      /**
-       * \brief Constructor of empty pointer.
-       */
-      DevicePointer( std::nullptr_t )
-      : pointer( nullptr ),
-        pd( nullptr ),
-        cuda_pointer( nullptr ) {}
-
-      /**
-       * \brief Constructor with an object reference.
-       *
-       * \param obj is a reference on an object to be managed by the pointer.
-       */
-      explicit  DevicePointer( ObjectType& obj )
-      : pointer( nullptr ),
-        pd( nullptr ),
-        cuda_pointer( nullptr )
-      {
-         this->allocate( obj );
-      }
+private:
+   /**
+    * \typedef Enabler
+    *
+    * Convenient template alias for controlling the selection of copy- and
+    * move-constructors and assignment operators using SFINAE.
+    * The type Object_ is "enabled" iff Object_ and Object are not the same,
+    * but after removing const and volatile qualifiers they are the same.
+    */
+   template< typename Object_ >
+   using Enabler = std::enable_if< ! std::is_same< Object_, Object >::value
+                                   && std::is_same< typename std::remove_cv< Object >::type, Object_ >::value >;
+
+   // friend class will be needed for templated assignment operators
+   template< typename Object_, typename Device_ >
+   friend class DevicePointer;
+
+public:
+   /**
+    * \typedef ObjectType is the type of object owned by the pointer.
+    */
+   using ObjectType = Object;
+
+   /**
+    * \typedef DeviceType is the type of device where the object is to be
+    * mirrored.
+    */
+   using DeviceType = Devices::Cuda;
+
+   /**
+    * \typedef AllocatorType is the type of the allocator for \e DeviceType.
+    */
+   using AllocatorType = typename Allocators::Default< DeviceType >::Allocator< ObjectType >;
+
+   /**
+    * \brief Constructor of empty pointer.
+    */
+   DevicePointer( std::nullptr_t ) : pointer( nullptr ), pd( nullptr ), cuda_pointer( nullptr ) {}
+
+   /**
+    * \brief Constructor with an object reference.
+    *
+    * \param obj is a reference on an object to be managed by the pointer.
+    */
+   explicit DevicePointer( ObjectType& obj ) : pointer( nullptr ), pd( nullptr ), cuda_pointer( nullptr )
+   {
+      this->allocate( obj );
+   }
 
-      /**
-       * \brief Copy constructor.
-       *
-       * \param pointer is the source device pointer.
-       */
-      DevicePointer( const DevicePointer& pointer ) // this is needed only to avoid the default compiler-generated constructor
-      : pointer( pointer.pointer ),
-        pd( (PointerData*) pointer.pd ),
-        cuda_pointer( pointer.cuda_pointer )
-      {
-         this->pd->counter += 1;
-      }
+   /**
+    * \brief Copy constructor.
+    *
+    * \param pointer is the source device pointer.
+    */
+   DevicePointer( const DevicePointer& pointer )  // this is needed only to avoid the default compiler-generated constructor
+   : pointer( pointer.pointer ), pd( (PointerData*) pointer.pd ), cuda_pointer( pointer.cuda_pointer )
+   {
+      this->pd->counter += 1;
+   }
 
-      /**
-       * \brief Copy constructor.
-       *
-       * This is specialization for compatible object types.
-       *
-       * See \ref Enabler.
-       *
-       * \param pointer is the source device pointer.
-       */
-      template< typename Object_,
-                typename = typename Enabler< Object_ >::type >
-      DevicePointer( const DevicePointer< Object_, DeviceType >& pointer ) // conditional constructor for non-const -> const data
-      : pointer( pointer.pointer ),
-        pd( (PointerData*) pointer.pd ),
-        cuda_pointer( pointer.cuda_pointer )
-      {
-         this->pd->counter += 1;
-      }
+   /**
+    * \brief Copy constructor.
+    *
+    * This is specialization for compatible object types.
+    *
+    * See \ref Enabler.
+    *
+    * \param pointer is the source device pointer.
+    */
+   template< typename Object_, typename = typename Enabler< Object_ >::type >
+   DevicePointer( const DevicePointer< Object_, DeviceType >& pointer )  // conditional constructor for non-const -> const data
+   : pointer( pointer.pointer ), pd( (PointerData*) pointer.pd ), cuda_pointer( pointer.cuda_pointer )
+   {
+      this->pd->counter += 1;
+   }
 
-      /**
-       * \brief Move constructor.
-       *
-       * \param pointer is the source device pointer.
-       */
-      DevicePointer( DevicePointer&& pointer ) // this is needed only to avoid the default compiler-generated constructor
-      : pointer( pointer.pointer ),
-        pd( (PointerData*) pointer.pd ),
-        cuda_pointer( pointer.cuda_pointer )
-      {
-         pointer.pointer = nullptr;
-         pointer.pd = nullptr;
-         pointer.cuda_pointer = nullptr;
-      }
+   /**
+    * \brief Move constructor.
+    *
+    * \param pointer is the source device pointer.
+    */
+   DevicePointer( DevicePointer&& pointer ) noexcept  // this is needed only to avoid the default compiler-generated constructor
+   : pointer( pointer.pointer ), pd( (PointerData*) pointer.pd ), cuda_pointer( pointer.cuda_pointer )
+   {
+      pointer.pointer = nullptr;
+      pointer.pd = nullptr;
+      pointer.cuda_pointer = nullptr;
+   }
 
-      /**
-       * \brief Move constructor.
-       *
-       * This is specialization for compatible object types.
-       *
-       * See \ref Enabler.
-       *
-       * \param pointer is the source device pointer.
-       */
-      template< typename Object_,
-                typename = typename Enabler< Object_ >::type >
-      DevicePointer( DevicePointer< Object_, DeviceType >&& pointer ) // conditional constructor for non-const -> const data
-      : pointer( pointer.pointer ),
-        pd( (PointerData*) pointer.pd ),
-        cuda_pointer( pointer.cuda_pointer )
-      {
-         pointer.pointer = nullptr;
-         pointer.pd = nullptr;
-         pointer.cuda_pointer = nullptr;
-      }
+   /**
+    * \brief Move constructor.
+    *
+    * This is specialization for compatible object types.
+    *
+    * See \ref Enabler.
+    *
+    * \param pointer is the source device pointer.
+    */
+   template< typename Object_, typename = typename Enabler< Object_ >::type >
+   DevicePointer( DevicePointer< Object_, DeviceType >&& pointer )  // conditional constructor for non-const -> const data
+   : pointer( pointer.pointer ), pd( (PointerData*) pointer.pd ), cuda_pointer( pointer.cuda_pointer )
+   {
+      pointer.pointer = nullptr;
+      pointer.pd = nullptr;
+      pointer.cuda_pointer = nullptr;
+   }
 
-      /**
-       * \brief Arrow operator for accessing the object owned by constant smart pointer.
-       *
-       * \return constant pointer to the object owned by this smart pointer. It
-       * returns pointer to object image on the CUDA device if it is called from CUDA
-       * kernel and pointer to host image otherwise.
-       */
-      __cuda_callable__
-      const Object* operator->() const
-      {
+   /**
+    * \brief Arrow operator for accessing the object owned by constant smart pointer.
+    *
+    * \return constant pointer to the object owned by this smart pointer. It
+    * returns pointer to object image on the CUDA device if it is called from CUDA
+    * kernel and pointer to host image otherwise.
+    */
+   __cuda_callable__
+   const Object*
+   operator->() const
+   {
 #ifdef __CUDA_ARCH__
-         return this->cuda_pointer;
+      return this->cuda_pointer;
 #else
-         return this->pointer;
+      return this->pointer;
 #endif
-      }
+   }
 
-      /**
-       * \brief Arrow operator for accessing the object owned by non-constant smart pointer.
-       *
-       * \return pointer to the object owned by this smart pointer. It
-       * returns pointer to object image on the CUDA device if it is called from CUDA
-       * kernel and pointer to host image otherwise.
-       */
-      __cuda_callable__
-      Object* operator->()
-      {
+   /**
+    * \brief Arrow operator for accessing the object owned by non-constant smart pointer.
+    *
+    * \return pointer to the object owned by this smart pointer. It
+    * returns pointer to object image on the CUDA device if it is called from CUDA
+    * kernel and pointer to host image otherwise.
+    */
+   __cuda_callable__
+   Object*
+   operator->()
+   {
 #ifdef __CUDA_ARCH__
-         return this->cuda_pointer;
+      return this->cuda_pointer;
 #else
-         this->pd->maybe_modified = true;
-         return this->pointer;
+      this->pd->maybe_modified = true;
+      return this->pointer;
 #endif
-      }
+   }
 
-      /**
-       * \brief Dereferencing operator for accessing the object owned by constant smart pointer.
-       *
-       * \return constant reference to the object owned by this smart pointer. It
-       * returns reference to object image on the CUDA device if it is called from CUDA
-       * kernel and reference to host image otherwise.
-       */
-      __cuda_callable__
-      const Object& operator *() const
-      {
+   /**
+    * \brief Dereferencing operator for accessing the object owned by constant smart pointer.
+    *
+    * \return constant reference to the object owned by this smart pointer. It
+    * returns reference to object image on the CUDA device if it is called from CUDA
+    * kernel and reference to host image otherwise.
+    */
+   __cuda_callable__
+   const Object&
+   operator*() const
+   {
 #ifdef __CUDA_ARCH__
-         return *( this->cuda_pointer );
+      return *( this->cuda_pointer );
 #else
-         return *( this->pointer );
+      return *( this->pointer );
 #endif
-      }
+   }
 
-      /**
-       * \brief Dereferencing operator for accessing the object owned by non-constant smart pointer.
-       *
-       * \return reference to the object owned by this smart pointer.  It
-       * returns reference to object image on the CUDA device if it is called from CUDA
-       * kernel and reference to host image otherwise.
-       */
-      __cuda_callable__
-      Object& operator *()
-      {
+   /**
+    * \brief Dereferencing operator for accessing the object owned by non-constant smart pointer.
+    *
+    * \return reference to the object owned by this smart pointer.  It
+    * returns reference to object image on the CUDA device if it is called from CUDA
+    * kernel and reference to host image otherwise.
+    */
+   __cuda_callable__
+   Object&
+   operator*()
+   {
 #ifdef __CUDA_ARCH__
-         return *( this->cuda_pointer );
+      return *( this->cuda_pointer );
 #else
-         this->pd->maybe_modified = true;
-         return *( this->pointer );
+      this->pd->maybe_modified = true;
+      return *( this->pointer );
 #endif
-      }
+   }
 
-      /**
-       * \brief Conversion to boolean type.
-       *
-       * \return Returns true if the pointer is not empty, false otherwise.
-       */
-      __cuda_callable__
-      operator bool() const
-      {
-         return this->pd;
-      }
+   /**
+    * \brief Conversion to boolean type.
+    *
+    * \return Returns true if the pointer is not empty, false otherwise.
+    */
+   __cuda_callable__
+   operator bool() const
+   {
+      return this->pd;
+   }
 
-      /**
-       * \brief Negation operator.
-       *
-       * \return Returns false if the pointer is not empty, true otherwise.
-       */
-      __cuda_callable__
-      bool operator!() const
-      {
-         return ! this->pd;
-      }
+   /**
+    * \brief Negation operator.
+    *
+    * \return Returns false if the pointer is not empty, true otherwise.
+    */
+   __cuda_callable__
+   bool
+   operator!() const
+   {
+      return ! this->pd;
+   }
 
-      /**
-       * \brief Constant object reference getter.
-       *
-       * No synchronization of this pointer will be performed due to calling
-       * this method.
-       *
-       * \tparam Device says what image of the object one want to dereference. It
-       * can be either \ref DeviceType or Devices::Host.
-       * \return constant reference to the object image on given device.
-       */
-      template< typename Device = Devices::Host >
-      __cuda_callable__
-      const Object& getData() const
-      {
-         static_assert( std::is_same< Device, Devices::Host >::value || std::is_same< Device, Devices::Cuda >::value, "Only Devices::Host or Devices::Cuda devices are accepted here." );
-         TNL_ASSERT( this->pointer, );
-         TNL_ASSERT( this->pd, );
-         TNL_ASSERT( this->cuda_pointer, );
-         if( std::is_same< Device, Devices::Host >::value )
-            return *( this->pointer );
-         if( std::is_same< Device, Devices::Cuda >::value )
-            return *( this->cuda_pointer );
-      }
+   /**
+    * \brief Constant object reference getter.
+    *
+    * No synchronization of this pointer will be performed due to calling
+    * this method.
+    *
+    * \tparam Device says what image of the object one want to dereference. It
+    * can be either \ref DeviceType or Devices::Host.
+    * \return constant reference to the object image on given device.
+    */
+   template< typename Device = Devices::Host >
+   __cuda_callable__
+   const Object&
+   getData() const
+   {
+      static_assert( std::is_same< Device, Devices::Host >::value || std::is_same< Device, Devices::Cuda >::value,
+                     "Only Devices::Host or Devices::Cuda devices are accepted here." );
+      TNL_ASSERT( this->pointer, );
+      TNL_ASSERT( this->pd, );
+      TNL_ASSERT( this->cuda_pointer, );
+      if( std::is_same< Device, Devices::Host >::value )
+         return *( this->pointer );
+      if( std::is_same< Device, Devices::Cuda >::value )
+         return *( this->cuda_pointer );
+   }
 
-      /**
-       * \brief Non-constant object reference getter.
-       *
-       * After calling this method, the object owned by the pointer might need
-       * to be synchronized. One should not forget to call
-       * \ref Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >()
-       * before calling CUDA kernel using object from this smart pointer.
-       *
-       * \tparam Device says what image of the object one want to dereference. It
-       * can be either \ref DeviceType or Devices::Host.
-       * \return constant reference to the object image on given device.
-       */
-      template< typename Device = Devices::Host >
-      __cuda_callable__
-      Object& modifyData()
-      {
-         static_assert( std::is_same< Device, Devices::Host >::value || std::is_same< Device, Devices::Cuda >::value, "Only Devices::Host or Devices::Cuda devices are accepted here." );
-         TNL_ASSERT( this->pointer, );
-         TNL_ASSERT( this->pd, );
-         TNL_ASSERT( this->cuda_pointer, );
-         if( std::is_same< Device, Devices::Host >::value )
-         {
-            this->pd->maybe_modified = true;
-            return *( this->pointer );
-         }
-         if( std::is_same< Device, Devices::Cuda >::value )
-            return *( this->cuda_pointer );
+   /**
+    * \brief Non-constant object reference getter.
+    *
+    * After calling this method, the object owned by the pointer might need
+    * to be synchronized. One should not forget to call
+    * \ref Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >()
+    * before calling CUDA kernel using object from this smart pointer.
+    *
+    * \tparam Device says what image of the object one want to dereference. It
+    * can be either \ref DeviceType or Devices::Host.
+    * \return constant reference to the object image on given device.
+    */
+   template< typename Device = Devices::Host >
+   __cuda_callable__
+   Object&
+   modifyData()
+   {
+      static_assert( std::is_same< Device, Devices::Host >::value || std::is_same< Device, Devices::Cuda >::value,
+                     "Only Devices::Host or Devices::Cuda devices are accepted here." );
+      TNL_ASSERT( this->pointer, );
+      TNL_ASSERT( this->pd, );
+      TNL_ASSERT( this->cuda_pointer, );
+      if( std::is_same< Device, Devices::Host >::value ) {
+         this->pd->maybe_modified = true;
+         return *( this->pointer );
       }
+      if( std::is_same< Device, Devices::Cuda >::value )
+         return *( this->cuda_pointer );
+   }
 
-      /**
-       * \brief Assignment operator.
-       *
-       * It assigns object owned by the pointer \ref ptr to \ref this pointer.
-       *
-       * \param ptr input pointer
-       * \return constant reference to \ref this
-       */
-      const DevicePointer& operator=( const DevicePointer& ptr ) // this is needed only to avoid the default compiler-generated operator
-      {
-         this->free();
-         this->pointer = ptr.pointer;
-         this->pd = (PointerData*) ptr.pd;
-         this->cuda_pointer = ptr.cuda_pointer;
-         if( this->pd )
-            this->pd->counter += 1;
-         return *this;
-      }
+   /**
+    * \brief Assignment operator.
+    *
+    * It assigns object owned by the pointer \ref ptr to \ref this pointer.
+    *
+    * \param ptr input pointer
+    * \return constant reference to \ref this
+    */
+   const DevicePointer&
+   operator=( const DevicePointer& ptr )  // this is needed only to avoid the default compiler-generated operator
+   {
+      this->free();
+      this->pointer = ptr.pointer;
+      this->pd = (PointerData*) ptr.pd;
+      this->cuda_pointer = ptr.cuda_pointer;
+      if( this->pd )
+         this->pd->counter += 1;
+      return *this;
+   }
 
-      /**
-       * \brief Assignment operator for compatible object types.
-       *
-       * It assigns object owned by the pointer \ref ptr to \ref this pointer.
-       *
-       * See \ref Enabler.
-       *
-       * \param ptr input pointer
-       * \return constant reference to \ref this
-       */
-      template< typename Object_,
-                typename = typename Enabler< Object_ >::type >
-      const DevicePointer& operator=( const DevicePointer< Object_, DeviceType >& ptr ) // conditional operator for non-const -> const data
-      {
-         this->free();
-         this->pointer = ptr.pointer;
-         this->pd = (PointerData*) ptr.pd;
-         this->cuda_pointer = ptr.cuda_pointer;
-         if( this->pd )
-            this->pd->counter += 1;
-         return *this;
-      }
+   /**
+    * \brief Assignment operator for compatible object types.
+    *
+    * It assigns object owned by the pointer \ref ptr to \ref this pointer.
+    *
+    * See \ref Enabler.
+    *
+    * \param ptr input pointer
+    * \return constant reference to \ref this
+    */
+   template< typename Object_, typename = typename Enabler< Object_ >::type >
+   const DevicePointer&
+   operator=( const DevicePointer< Object_, DeviceType >& ptr )  // conditional operator for non-const -> const data
+   {
+      this->free();
+      this->pointer = ptr.pointer;
+      this->pd = (PointerData*) ptr.pd;
+      this->cuda_pointer = ptr.cuda_pointer;
+      if( this->pd )
+         this->pd->counter += 1;
+      return *this;
+   }
 
-      /**
-       * \brief Move operator.
-       *
-       * It assigns object owned by the pointer \ref ptr to \ref this pointer.
-       *
-       * \param ptr input pointer
-       * \return constant reference to \ref this
-       */
-      const DevicePointer& operator=( DevicePointer&& ptr ) // this is needed only to avoid the default compiler-generated operator
-      {
-         this->free();
-         this->pointer = ptr.pointer;
-         this->pd = (PointerData*) ptr.pd;
-         this->cuda_pointer = ptr.cuda_pointer;
-         ptr.pointer = nullptr;
-         ptr.pd = nullptr;
-         ptr.cuda_pointer = nullptr;
-         return *this;
-      }
+   /**
+    * \brief Move operator.
+    *
+    * It assigns object owned by the pointer \ref ptr to \ref this pointer.
+    *
+    * \param ptr input pointer
+    * \return constant reference to \ref this
+    */
+   const DevicePointer&
+   operator=( DevicePointer&& ptr ) noexcept  // this is needed only to avoid the default compiler-generated operator
+   {
+      this->free();
+      this->pointer = ptr.pointer;
+      this->pd = (PointerData*) ptr.pd;
+      this->cuda_pointer = ptr.cuda_pointer;
+      ptr.pointer = nullptr;
+      ptr.pd = nullptr;
+      ptr.cuda_pointer = nullptr;
+      return *this;
+   }
 
-      /**
-       * \brief Move operator.
-       *
-       * It assigns object owned by the pointer \ref ptr to \ref this pointer.
-       *
-       * See \ref Enabler.
-       *
-       * \param ptr input pointer
-       * \return constant reference to \ref this
-       */
-      template< typename Object_,
-                typename = typename Enabler< Object_ >::type >
-      const DevicePointer& operator=( DevicePointer< Object_, DeviceType >&& ptr ) // conditional operator for non-const -> const data
-      {
-         this->free();
-         this->pointer = ptr.pointer;
-         this->pd = (PointerData*) ptr.pd;
-         this->cuda_pointer = ptr.cuda_pointer;
-         ptr.pointer = nullptr;
-         ptr.pd = nullptr;
-         ptr.cuda_pointer = nullptr;
-         return *this;
-      }
+   /**
+    * \brief Move operator.
+    *
+    * It assigns object owned by the pointer \ref ptr to \ref this pointer.
+    *
+    * See \ref Enabler.
+    *
+    * \param ptr input pointer
+    * \return constant reference to \ref this
+    */
+   template< typename Object_, typename = typename Enabler< Object_ >::type >
+   const DevicePointer&
+   operator=( DevicePointer< Object_, DeviceType >&& ptr )  // conditional operator for non-const -> const data
+   {
+      this->free();
+      this->pointer = ptr.pointer;
+      this->pd = (PointerData*) ptr.pd;
+      this->cuda_pointer = ptr.cuda_pointer;
+      ptr.pointer = nullptr;
+      ptr.pd = nullptr;
+      ptr.cuda_pointer = nullptr;
+      return *this;
+   }
 
-      /**
-       * \brief Cross-device pointer synchronization.
-       *
-       * This method is usually called by the smart pointers register when calling
-       * \ref Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >()
-       *
-       * \return true if the synchronization was successful, false otherwise.
-       */
-      bool synchronize()
-      {
-         if( ! this->pd )
-            return true;
+   /**
+    * \brief Cross-device pointer synchronization.
+    *
+    * This method is usually called by the smart pointers register when calling
+    * \ref Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >()
+    *
+    * \return true if the synchronization was successful, false otherwise.
+    */
+   bool
+   synchronize() override
+   {
+      if( ! this->pd )
+         return true;
 #ifdef HAVE_CUDA
-         if( this->modified() )
-         {
-            TNL_ASSERT( this->pointer, );
-            TNL_ASSERT( this->cuda_pointer, );
-            cudaMemcpy( (void*) this->cuda_pointer, (void*) this->pointer, sizeof( ObjectType ), cudaMemcpyHostToDevice );
-            TNL_CHECK_CUDA_DEVICE;
-            this->set_last_sync_state();
-            return true;
-         }
+      if( this->modified() ) {
+         TNL_ASSERT( this->pointer, );
+         TNL_ASSERT( this->cuda_pointer, );
+         cudaMemcpy( (void*) this->cuda_pointer, (void*) this->pointer, sizeof( ObjectType ), cudaMemcpyHostToDevice );
+         TNL_CHECK_CUDA_DEVICE;
+         this->set_last_sync_state();
          return true;
+      }
+      return true;
 #else
-         return false;
+      return false;
 #endif
-      }
+   }
 
-      /**
-       * \brief Swap the owned object with another pointer.
-       *
-       * \param ptr2 the other device pointer for swapping.
-       */
-      void swap( DevicePointer& ptr2 )
-      {
-         std::swap( this->pointer, ptr2.pointer );
-         std::swap( this->pd, ptr2.pd );
-         std::swap( this->cuda_pointer, ptr2.cuda_pointer );
-      }
+   /**
+    * \brief Swap the owned object with another pointer.
+    *
+    * \param ptr2 the other device pointer for swapping.
+    */
+   void
+   swap( DevicePointer& ptr2 )
+   {
+      std::swap( this->pointer, ptr2.pointer );
+      std::swap( this->pd, ptr2.pd );
+      std::swap( this->cuda_pointer, ptr2.cuda_pointer );
+   }
 
-      /**
-       * \brief Destructor.
-       */
-      ~DevicePointer()
-      {
-         this->free();
-         getSmartPointersRegister< DeviceType >().remove( this );
-      }
+   /**
+    * \brief Destructor.
+    */
+   ~DevicePointer() override
+   {
+      this->free();
+      getSmartPointersRegister< DeviceType >().remove( this );
+   }
 
-   protected:
-
-      struct PointerData
-      {
-         char data_image[ sizeof(Object) ];
-         int counter = 1;
-         bool maybe_modified = true;
-      };
-
-      bool allocate( ObjectType& obj )
-      {
-         this->pointer = &obj;
-         this->pd = new PointerData();
-         // allocate on device
-         this->cuda_pointer = AllocatorType{}.allocate(1);
-         // synchronize
-         this->synchronize();
-         getSmartPointersRegister< DeviceType >().insert( this );
-         return true;
-      }
+protected:
+   struct PointerData
+   {
+      char data_image[ sizeof( Object ) ];
+      int counter = 1;
+      bool maybe_modified = true;
+   };
 
-      void set_last_sync_state()
-      {
-         TNL_ASSERT( this->pointer, );
-         TNL_ASSERT( this->pd, );
-         std::memcpy( (void*) &this->pd->data_image, (void*) this->pointer, sizeof( Object ) );
-         this->pd->maybe_modified = false;
-      }
+   bool
+   allocate( ObjectType& obj )
+   {
+      this->pointer = &obj;
+      this->pd = new PointerData();
+      // allocate on device
+      this->cuda_pointer = AllocatorType{}.allocate( 1 );
+      // synchronize
+      this->synchronize();
+      getSmartPointersRegister< DeviceType >().insert( this );
+      return true;
+   }
 
-      bool modified()
-      {
-         TNL_ASSERT( this->pointer, );
-         TNL_ASSERT( this->pd, );
-         // optimization: skip bitwise comparison if we're sure that the data is the same
-         if( ! this->pd->maybe_modified )
-            return false;
-         return std::memcmp( (void*) &this->pd->data_image, (void*) this->pointer, sizeof( Object ) ) != 0;
-      }
+   void
+   set_last_sync_state()
+   {
+      TNL_ASSERT( this->pointer, );
+      TNL_ASSERT( this->pd, );
+      std::memcpy( (void*) &this->pd->data_image, (void*) this->pointer, sizeof( Object ) );
+      this->pd->maybe_modified = false;
+   }
+
+   bool
+   modified()
+   {
+      TNL_ASSERT( this->pointer, );
+      TNL_ASSERT( this->pd, );
+      // optimization: skip bitwise comparison if we're sure that the data is the same
+      if( ! this->pd->maybe_modified )
+         return false;
+      return std::memcmp( (void*) &this->pd->data_image, (void*) this->pointer, sizeof( Object ) ) != 0;
+   }
 
-      void free()
-      {
-         if( this->pd )
-         {
-            if( ! --this->pd->counter )
-            {
-               delete this->pd;
-               this->pd = nullptr;
-               if( this->cuda_pointer )
-                  AllocatorType{}.deallocate( this->cuda_pointer, 1 );
-            }
+   void
+   free()
+   {
+      if( this->pd ) {
+         if( ! --this->pd->counter ) {
+            delete this->pd;
+            this->pd = nullptr;
+            if( this->cuda_pointer )
+               AllocatorType{}.deallocate( this->cuda_pointer, 1 );
          }
       }
+   }
 
-      Object* pointer;
+   Object* pointer;
 
-      PointerData* pd;
+   PointerData* pd;
 
-      // cuda_pointer can't be part of PointerData structure, since we would be
-      // unable to dereference this-pd on the device
-      Object* cuda_pointer;
+   // cuda_pointer can't be part of PointerData structure, since we would be
+   // unable to dereference this-pd on the device
+   Object* cuda_pointer;
 };
 
-} // namespace Pointers
+}  // namespace Pointers
 
 #ifndef NDEBUG
 namespace Assert {
@@ -840,13 +834,12 @@ struct Formatter< Pointers::DevicePointer< Object, Device > >
    printToString( const Pointers::DevicePointer< Object, Device >& value )
    {
       ::std::stringstream ss;
-      ss << "(" + getType< Pointers::DevicePointer< Object, Device > >()
-         << " object at " << &value << ")";
+      ss << "(" + getType< Pointers::DevicePointer< Object, Device > >() << " object at " << &value << ")";
       return ss.str();
    }
 };
 
-} // namespace Assert
+}  // namespace Assert
 #endif
 
-} // namespace TNL
+}  // namespace TNL
diff --git a/src/TNL/Pointers/SharedPointer.h b/src/TNL/Pointers/SharedPointer.h
index 05148a0facf33b021f4a96488ab8e30ebc6a89fc..3d340b6ca35485fe90e94139180a8f57e7025d93 100644
--- a/src/TNL/Pointers/SharedPointer.h
+++ b/src/TNL/Pointers/SharedPointer.h
@@ -20,23 +20,23 @@ namespace Pointers {
 
 /**
  * \brief Cross-device shared smart pointer.
- * 
+ *
  * This smart pointer is inspired by std::shared_ptr from STL library. It means
  * that the object owned by the smart pointer can be shared with other
  * smart pointers. One can make a copy of this smart pointer. In addition,
  * the smart pointer is able to work across different devices which means that the
  * object owned by the smart pointer is mirrored on both host and device.
- * 
- * **NOTE: When using smart pointers to pass objects on GPU, one must call 
- * \ref Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >() 
+ *
+ * **NOTE: When using smart pointers to pass objects on GPU, one must call
+ * \ref Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >()
  * before calling a CUDA kernel working with smart pointers.**
- * 
+ *
  * \tparam Object is a type of object to be owned by the pointer.
  * \tparam Device is device where the object is to be allocated. The object is
  * always allocated on the host system as well for easier object manipulation.
- * 
+ *
  * See also \ref UniquePointer and \ref DevicePointer.
- * 
+ *
  * See also \ref SharedPointer< Object, Devices::Host > and \ref SharedPointer< Object, Devices::Cuda >.
  *
  * \par Example
@@ -44,14 +44,14 @@ namespace Pointers {
  * \par Output
  * \include SharedPointerExample.out
  */
-template< typename Object,
-          typename Device = typename Object::DeviceType >
+template< typename Object, typename Device = typename Object::DeviceType >
 class SharedPointer
 {
-   static_assert( ! std::is_same< Device, void >::value, "The device cannot be void. You need to specify the device explicitly in your code." );
+   static_assert( ! std::is_same< Device, void >::value,
+                  "The device cannot be void. You need to specify the device explicitly in your code." );
 };
 
-} // namespace Pointers
+}  // namespace Pointers
 
 #ifndef NDEBUG
 namespace Assert {
@@ -63,16 +63,15 @@ struct Formatter< Pointers::SharedPointer< Object, Device > >
    printToString( const Pointers::SharedPointer< Object, Device >& value )
    {
       ::std::stringstream ss;
-      ss << "(" + getType< Pointers::SharedPointer< Object, Device > >()
-         << " > object at " << &value << ")";
+      ss << "(" + getType< Pointers::SharedPointer< Object, Device > >() << " > object at " << &value << ")";
       return ss.str();
    }
 };
 
-} // namespace Assert
+}  // namespace Assert
 #endif
 
-} // namespace TNL
+}  // namespace TNL
 
 #include <TNL/Pointers/SharedPointerHost.h>
 #include <TNL/Pointers/SharedPointerCuda.h>
diff --git a/src/TNL/Pointers/SharedPointerCuda.h b/src/TNL/Pointers/SharedPointerCuda.h
index 8d8a18fc998fde490ab768a8163f0c986755c10b..fa4ef6fc851cc38b4e108af52008ef573cb3268c 100644
--- a/src/TNL/Pointers/SharedPointerCuda.h
+++ b/src/TNL/Pointers/SharedPointerCuda.h
@@ -15,9 +15,9 @@
 #include <TNL/Pointers/SmartPointer.h>
 #include <TNL/Pointers/SmartPointersRegister.h>
 
-#include <cstring>   // std::memcpy, std::memcmp
-#include <cstddef>   // std::nullptr_t
-#include <algorithm> // swap
+#include <cstring>    // std::memcpy, std::memcmp
+#include <cstddef>    // std::nullptr_t
+#include <algorithm>  // swap
 
 namespace TNL {
 namespace Pointers {
@@ -34,561 +34,563 @@ namespace Pointers {
 template< typename Object >
 class SharedPointer< Object, Devices::Cuda > : public SmartPointer
 {
-   private:
-      /**
-       * \typedef Enabler
-       *
-       * Convenient template alias for controlling the selection of copy- and
-       * move-constructors and assignment operators using SFINAE.
-       * The type Object_ is "enabled" iff Object_ and Object are not the same,
-       * but after removing const and volatile qualifiers they are the same.
-       */
-      template< typename Object_ >
-      using Enabler = std::enable_if< ! std::is_same< Object_, Object >::value &&
-                                      std::is_same< typename std::remove_cv< Object >::type, Object_ >::value >;
-
-      // friend class will be needed for templated assignment operators
-      template< typename Object_, typename Device_ >
-      friend class SharedPointer;
-
-   public:
-
-      /**
-       * \typedef ObjectType is the type of object owned by the pointer.
-       */
-      using ObjectType = Object;
-
-      /**
-       * \typedef DeviceType is the type of device where the object is to be
-       * mirrored.
-       */
-      using DeviceType = Devices::Cuda;
-
-      /**
-       * \typedef AllocatorType is the type of the allocator for \e DeviceType.
-       */
-      using AllocatorType = typename Allocators::Default< DeviceType >::Allocator< ObjectType >;
-
-      /**
-       * \brief Constructor of empty pointer.
-       */
-      SharedPointer( std::nullptr_t )
-      : pd( nullptr ),
-        cuda_pointer( nullptr )
-      {}
-
-      /**
-       * \brief Constructor with parameters of the Object constructor.
-       *
-       * \tparam Args is variadic template type of arguments of the Object constructor.
-       * \tparam args are arguments passed to the Object constructor.
-       */
-      template< typename... Args >
-      explicit  SharedPointer( Args... args )
-      : pd( nullptr ),
-        cuda_pointer( nullptr )
-      {
-         this->allocate( args... );
-      }
-
-      /**
-       * \brief Constructor with initializer list.
-       *
-       * \tparam Value is type of the initializer list elements.
-       * \param list is the instance of the initializer list..
-       */
-      template< typename Value >
-      explicit  SharedPointer( std::initializer_list< Value > list )
-      : pd( nullptr ),
-        cuda_pointer( nullptr )
-      {
-         this->allocate( list );
-      }
-
-      /**
-       * \brief Constructor with nested initializer lists.
-       *
-       * \tparam Value is type of the nested initializer list elements.
-       * \param list is the instance of the nested initializer list..
-       */
-      template< typename Value >
-      explicit  SharedPointer( std::initializer_list< std::initializer_list< Value > > list )
-      : pd( nullptr ),
-        cuda_pointer( nullptr )
-      {
-         this->allocate( list );
-      }
-
-      /**
-       * \brief Copy constructor.
-       *
-       * \param pointer is the source shared pointer.
-       */
-      SharedPointer( const SharedPointer& pointer ) // this is needed only to avoid the default compiler-generated constructor
-      : pd( (PointerData*) pointer.pd ),
-        cuda_pointer( pointer.cuda_pointer )
-      {
-         this->pd->counter += 1;
-      }
-
-      /**
-       * \brief Copy constructor.
-       *
-       * This is specialization for compatible object types.
-       *
-       * See \ref Enabler.
-       *
-       * \param pointer is the source shared pointer.
-       */
-      template< typename Object_,
-                typename = typename Enabler< Object_ >::type >
-      SharedPointer( const SharedPointer<  Object_, DeviceType >& pointer ) // conditional constructor for non-const -> const data
-      : pd( (PointerData*) pointer.pd ),
-        cuda_pointer( pointer.cuda_pointer )
-      {
-         this->pd->counter += 1;
-      }
-
-      /**
-       * \brief Move constructor.
-       *
-       * \param pointer is the source shared pointer.
-       */
-      SharedPointer( SharedPointer&& pointer ) // this is needed only to avoid the default compiler-generated constructor
-      : pd( (PointerData*) pointer.pd ),
-        cuda_pointer( pointer.cuda_pointer )
-      {
-         pointer.pd = nullptr;
-         pointer.cuda_pointer = nullptr;
-      }
-
-      /**
-       * \brief Move constructor.
-       *
-       * This is specialization for compatible object types.
-       *
-       * See \ref Enabler.
-       *
-       * \param pointer is the source shared pointer.
-       */
-      template< typename Object_,
-                typename = typename Enabler< Object_ >::type >
-      SharedPointer( SharedPointer<  Object_, DeviceType >&& pointer ) // conditional constructor for non-const -> const data
-      : pd( (PointerData*) pointer.pd ),
-        cuda_pointer( pointer.cuda_pointer )
-      {
-         pointer.pd = nullptr;
-         pointer.cuda_pointer = nullptr;
-      }
-
-      /**
-       * \brief Create new object based in given constructor parameters.
-       *
-       * \tparam Args is variadic template type of arguments to be passed to the
-       *    object constructor.
-       * \param args are arguments to be passed to the object constructor.
-       * \return true if recreation was successful, false otherwise.
-       */
-      template< typename... Args >
-      bool recreate( Args... args )
-      {
-#ifdef TNL_DEBUG_SHARED_POINTERS
-         std::cerr << "Recreating shared pointer to " << getType< ObjectType >() << std::endl;
-#endif
-         if( ! this->pd )
-            return this->allocate( args... );
-
-         if( this->pd->counter == 1 )
-         {
-            /****
-             * The object is not shared -> recreate it in-place, without reallocation
-             */
-            this->pd->data.~Object();
-            new ( &this->pd->data ) Object( args... );
-#ifdef HAVE_CUDA
-            cudaMemcpy( (void*) this->cuda_pointer, (void*) &this->pd->data, sizeof( Object ), cudaMemcpyHostToDevice );
-#endif
-            this->set_last_sync_state();
-            return true;
-         }
-
-         // free will just decrement the counter
-         this->free();
-
+private:
+   /**
+    * \typedef Enabler
+    *
+    * Convenient template alias for controlling the selection of copy- and
+    * move-constructors and assignment operators using SFINAE.
+    * The type Object_ is "enabled" iff Object_ and Object are not the same,
+    * but after removing const and volatile qualifiers they are the same.
+    */
+   template< typename Object_ >
+   using Enabler = std::enable_if< ! std::is_same< Object_, Object >::value
+                                   && std::is_same< typename std::remove_cv< Object >::type, Object_ >::value >;
+
+   // friend class will be needed for templated assignment operators
+   template< typename Object_, typename Device_ >
+   friend class SharedPointer;
+
+public:
+   /**
+    * \typedef ObjectType is the type of object owned by the pointer.
+    */
+   using ObjectType = Object;
+
+   /**
+    * \typedef DeviceType is the type of device where the object is to be
+    * mirrored.
+    */
+   using DeviceType = Devices::Cuda;
+
+   /**
+    * \typedef AllocatorType is the type of the allocator for \e DeviceType.
+    */
+   using AllocatorType = typename Allocators::Default< DeviceType >::Allocator< ObjectType >;
+
+   /**
+    * \brief Constructor of empty pointer.
+    */
+   SharedPointer( std::nullptr_t ) : pd( nullptr ), cuda_pointer( nullptr ) {}
+
+   /**
+    * \brief Constructor with parameters of the Object constructor.
+    *
+    * \tparam Args is variadic template type of arguments of the Object constructor.
+    * \tparam args are arguments passed to the Object constructor.
+    */
+   template< typename... Args >
+   explicit SharedPointer( Args... args ) : pd( nullptr ), cuda_pointer( nullptr )
+   {
+      this->allocate( args... );
+   }
+
+   /**
+    * \brief Constructor with initializer list.
+    *
+    * \tparam Value is type of the initializer list elements.
+    * \param list is the instance of the initializer list..
+    */
+   template< typename Value >
+   explicit SharedPointer( std::initializer_list< Value > list ) : pd( nullptr ), cuda_pointer( nullptr )
+   {
+      this->allocate( list );
+   }
+
+   /**
+    * \brief Constructor with nested initializer lists.
+    *
+    * \tparam Value is type of the nested initializer list elements.
+    * \param list is the instance of the nested initializer list..
+    */
+   template< typename Value >
+   explicit SharedPointer( std::initializer_list< std::initializer_list< Value > > list )
+   : pd( nullptr ), cuda_pointer( nullptr )
+   {
+      this->allocate( list );
+   }
+
+   /**
+    * \brief Copy constructor.
+    *
+    * \param pointer is the source shared pointer.
+    */
+   SharedPointer( const SharedPointer& pointer )  // this is needed only to avoid the default compiler-generated constructor
+   : pd( (PointerData*) pointer.pd ), cuda_pointer( pointer.cuda_pointer )
+   {
+      this->pd->counter += 1;
+   }
+
+   /**
+    * \brief Copy constructor.
+    *
+    * This is specialization for compatible object types.
+    *
+    * See \ref Enabler.
+    *
+    * \param pointer is the source shared pointer.
+    */
+   template< typename Object_, typename = typename Enabler< Object_ >::type >
+   SharedPointer( const SharedPointer< Object_, DeviceType >& pointer )  // conditional constructor for non-const -> const data
+   : pd( (PointerData*) pointer.pd ), cuda_pointer( pointer.cuda_pointer )
+   {
+      this->pd->counter += 1;
+   }
+
+   /**
+    * \brief Move constructor.
+    *
+    * \param pointer is the source shared pointer.
+    */
+   SharedPointer( SharedPointer&& pointer ) noexcept  // this is needed only to avoid the default compiler-generated constructor
+   : pd( (PointerData*) pointer.pd ), cuda_pointer( pointer.cuda_pointer )
+   {
+      pointer.pd = nullptr;
+      pointer.cuda_pointer = nullptr;
+   }
+
+   /**
+    * \brief Move constructor.
+    *
+    * This is specialization for compatible object types.
+    *
+    * See \ref Enabler.
+    *
+    * \param pointer is the source shared pointer.
+    */
+   template< typename Object_, typename = typename Enabler< Object_ >::type >
+   SharedPointer( SharedPointer< Object_, DeviceType >&& pointer )  // conditional constructor for non-const -> const data
+   : pd( (PointerData*) pointer.pd ), cuda_pointer( pointer.cuda_pointer )
+   {
+      pointer.pd = nullptr;
+      pointer.cuda_pointer = nullptr;
+   }
+
+   /**
+    * \brief Create new object based in given constructor parameters.
+    *
+    * \tparam Args is variadic template type of arguments to be passed to the
+    *    object constructor.
+    * \param args are arguments to be passed to the object constructor.
+    * \return true if recreation was successful, false otherwise.
+    */
+   template< typename... Args >
+   bool
+   recreate( Args... args )
+   {
+   #ifdef TNL_DEBUG_SHARED_POINTERS
+      std::cerr << "Recreating shared pointer to " << getType< ObjectType >() << std::endl;
+   #endif
+      if( ! this->pd )
          return this->allocate( args... );
-      }
-
-      /**
-       * \brief Arrow operator for accessing the object owned by constant smart pointer.
-       *
-       * \return constant pointer to the object owned by this smart pointer. It
-       * returns pointer to object image on the CUDA device if it is called from CUDA
-       * kernel and pointer to host image otherwise.
-       */
-      __cuda_callable__
-      const Object* operator->() const
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-#ifdef __CUDA_ARCH__
-         return this->cuda_pointer;
-#else
-         return &this->pd->data;
-#endif
-      }
 
-      /**
-       * \brief Arrow operator for accessing the object owned by non-constant smart pointer.
-       *
-       * \return pointer to the object owned by this smart pointer. It
-       * returns pointer to object image on the CUDA device if it is called from CUDA
-       * kernel and pointer to host image otherwise.
-       */
-      __cuda_callable__
-      Object* operator->()
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-#ifdef __CUDA_ARCH__
-         return this->cuda_pointer;
-#else
-         this->pd->maybe_modified = true;
-         return &this->pd->data;
-#endif
+      if( this->pd->counter == 1 ) {
+         /****
+          * The object is not shared -> recreate it in-place, without reallocation
+          */
+         this->pd->data.~Object();
+         new( &this->pd->data ) Object( args... );
+   #ifdef HAVE_CUDA
+         cudaMemcpy( (void*) this->cuda_pointer, (void*) &this->pd->data, sizeof( Object ), cudaMemcpyHostToDevice );
+   #endif
+         this->set_last_sync_state();
+         return true;
       }
 
-      /**
-       * \brief Dereferencing operator for accessing the object owned by constant smart pointer.
-       *
-       * \return constant reference to the object owned by this smart pointer. It
-       * returns reference to object image on the CUDA device if it is called from CUDA
-       * kernel and reference to host image otherwise.
-       */
-      __cuda_callable__
-      const Object& operator *() const
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-#ifdef __CUDA_ARCH__
-         return *( this->cuda_pointer );
-#else
+      // free will just decrement the counter
+      this->free();
+
+      return this->allocate( args... );
+   }
+
+   /**
+    * \brief Arrow operator for accessing the object owned by constant smart pointer.
+    *
+    * \return constant pointer to the object owned by this smart pointer. It
+    * returns pointer to object image on the CUDA device if it is called from CUDA
+    * kernel and pointer to host image otherwise.
+    */
+   __cuda_callable__
+   const Object*
+   operator->() const
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+   #ifdef __CUDA_ARCH__
+      return this->cuda_pointer;
+   #else
+      return &this->pd->data;
+   #endif
+   }
+
+   /**
+    * \brief Arrow operator for accessing the object owned by non-constant smart pointer.
+    *
+    * \return pointer to the object owned by this smart pointer. It
+    * returns pointer to object image on the CUDA device if it is called from CUDA
+    * kernel and pointer to host image otherwise.
+    */
+   __cuda_callable__
+   Object*
+   operator->()
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+   #ifdef __CUDA_ARCH__
+      return this->cuda_pointer;
+   #else
+      this->pd->maybe_modified = true;
+      return &this->pd->data;
+   #endif
+   }
+
+   /**
+    * \brief Dereferencing operator for accessing the object owned by constant smart pointer.
+    *
+    * \return constant reference to the object owned by this smart pointer. It
+    * returns reference to object image on the CUDA device if it is called from CUDA
+    * kernel and reference to host image otherwise.
+    */
+   __cuda_callable__
+   const Object&
+   operator*() const
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+   #ifdef __CUDA_ARCH__
+      return *( this->cuda_pointer );
+   #else
+      return this->pd->data;
+   #endif
+   }
+
+   /**
+    * \brief Dereferencing operator for accessing the object owned by non-constant smart pointer.
+    *
+    * \return reference to the object owned by this smart pointer.  It
+    * returns reference to object image on the CUDA device if it is called from CUDA
+    * kernel and reference to host image otherwise.
+    */
+   __cuda_callable__
+   Object&
+   operator*()
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+   #ifdef __CUDA_ARCH__
+      return *( this->cuda_pointer );
+   #else
+      this->pd->maybe_modified = true;
+      return this->pd->data;
+   #endif
+   }
+
+   /**
+    * \brief Conversion to boolean type.
+    *
+    * \return Returns true if the pointer is not empty, false otherwise.
+    */
+   __cuda_callable__
+   operator bool() const
+   {
+      return this->pd;
+   }
+
+   /**
+    * \brief Negation operator.
+    *
+    * \return Returns false if the pointer is not empty, true otherwise.
+    */
+   __cuda_callable__
+   bool
+   operator!() const
+   {
+      return ! this->pd;
+   }
+
+   /**
+    * \brief Constant object reference getter.
+    *
+    * No synchronization of this pointer will be performed due to calling
+    * this method.
+    *
+    * \tparam Device says what image of the object one want to dereference. It
+    * can be either \ref DeviceType or Devices::Host.
+    * \return constant reference to the object image on given device.
+    */
+   template< typename Device = Devices::Host >
+   __cuda_callable__
+   const Object&
+   getData() const
+   {
+      static_assert( std::is_same< Device, Devices::Host >::value || std::is_same< Device, Devices::Cuda >::value,
+                     "Only Devices::Host or Devices::Cuda devices are accepted here." );
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      TNL_ASSERT_TRUE( this->cuda_pointer, "Attempt to dereference a null pointer" );
+      if( std::is_same< Device, Devices::Host >::value )
          return this->pd->data;
-#endif
-      }
-
-      /**
-       * \brief Dereferencing operator for accessing the object owned by non-constant smart pointer.
-       *
-       * \return reference to the object owned by this smart pointer.  It
-       * returns reference to object image on the CUDA device if it is called from CUDA
-       * kernel and reference to host image otherwise.
-       */
-      __cuda_callable__
-      Object& operator *()
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-#ifdef __CUDA_ARCH__
+      if( std::is_same< Device, Devices::Cuda >::value )
          return *( this->cuda_pointer );
-#else
+   }
+
+   /**
+    * \brief Non-constant object reference getter.
+    *
+    * After calling this method, the object owned by the pointer might need
+    * to be synchronized. One should not forget to call
+    * \ref Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >()
+    * before calling CUDA kernel using object from this smart pointer.
+    *
+    * \tparam Device says what image of the object one want to dereference. It
+    * can be either \ref DeviceType or Devices::Host.
+    * \return constant reference to the object image on given device.
+    */
+   template< typename Device = Devices::Host >
+   __cuda_callable__
+   Object&
+   modifyData()
+   {
+      static_assert( std::is_same< Device, Devices::Host >::value || std::is_same< Device, Devices::Cuda >::value,
+                     "Only Devices::Host or Devices::Cuda devices are accepted here." );
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      TNL_ASSERT_TRUE( this->cuda_pointer, "Attempt to dereference a null pointer" );
+      if( std::is_same< Device, Devices::Host >::value ) {
          this->pd->maybe_modified = true;
          return this->pd->data;
-#endif
       }
-
-      /**
-       * \brief Conversion to boolean type.
-       *
-       * \return Returns true if the pointer is not empty, false otherwise.
-       */
-      __cuda_callable__
-      operator bool() const
-      {
-         return this->pd;
-      }
-
-      /**
-       * \brief Negation operator.
-       *
-       * \return Returns false if the pointer is not empty, true otherwise.
-       */
-      __cuda_callable__
-      bool operator!() const
-      {
-         return ! this->pd;
-      }
-
-      /**
-       * \brief Constant object reference getter.
-       *
-       * No synchronization of this pointer will be performed due to calling
-       * this method.
-       *
-       * \tparam Device says what image of the object one want to dereference. It
-       * can be either \ref DeviceType or Devices::Host.
-       * \return constant reference to the object image on given device.
-       */
-      template< typename Device = Devices::Host >
-      __cuda_callable__
-      const Object& getData() const
-      {
-         static_assert( std::is_same< Device, Devices::Host >::value || std::is_same< Device, Devices::Cuda >::value, "Only Devices::Host or Devices::Cuda devices are accepted here." );
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         TNL_ASSERT_TRUE( this->cuda_pointer, "Attempt to dereference a null pointer" );
-         if( std::is_same< Device, Devices::Host >::value )
-            return this->pd->data;
-         if( std::is_same< Device, Devices::Cuda >::value )
-            return *( this->cuda_pointer );
-      }
-
-      /**
-       * \brief Non-constant object reference getter.
-       *
-       * After calling this method, the object owned by the pointer might need
-       * to be synchronized. One should not forget to call
-       * \ref Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >()
-       * before calling CUDA kernel using object from this smart pointer.
-       *
-       * \tparam Device says what image of the object one want to dereference. It
-       * can be either \ref DeviceType or Devices::Host.
-       * \return constant reference to the object image on given device.
-       */
-      template< typename Device = Devices::Host >
-      __cuda_callable__
-      Object& modifyData()
-      {
-         static_assert( std::is_same< Device, Devices::Host >::value || std::is_same< Device, Devices::Cuda >::value, "Only Devices::Host or Devices::Cuda devices are accepted here." );
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         TNL_ASSERT_TRUE( this->cuda_pointer, "Attempt to dereference a null pointer" );
-         if( std::is_same< Device, Devices::Host >::value )
-         {
-            this->pd->maybe_modified = true;
-            return this->pd->data;
-         }
-         if( std::is_same< Device, Devices::Cuda >::value )
-            return *( this->cuda_pointer );
-      }
-
-      /**
-       * \brief Assignment operator.
-       *
-       * It assigns object owned by the pointer \ref ptr to \ref this pointer.
-       *
-       * \param ptr input pointer
-       * \return constant reference to \ref this
-       */
-      const SharedPointer& operator=( const SharedPointer& ptr ) // this is needed only to avoid the default compiler-generated operator
-      {
-         this->free();
-         this->pd = (PointerData*) ptr.pd;
-         this->cuda_pointer = ptr.cuda_pointer;
-         if( this->pd != nullptr )
-            this->pd->counter += 1;
-#ifdef TNL_DEBUG_SHARED_POINTERS
-         std::cerr << "Copy-assigned shared pointer: counter = " << this->pd->counter << ", type: " << getType< ObjectType >() << std::endl;
-#endif
-         return *this;
-      }
-
-      /**
-       * \brief Assignment operator for compatible object types.
-       *
-       * It assigns object owned by the pointer \ref ptr to \ref this pointer.
-       *
-       * See \ref Enabler.
-       *
-       * \param ptr input pointer
-       * \return constant reference to \ref this
-       */
-      template< typename Object_,
-                typename = typename Enabler< Object_ >::type >
-      const SharedPointer& operator=( const SharedPointer<  Object_, DeviceType >& ptr ) // conditional operator for non-const -> const data
-      {
-         this->free();
-         this->pd = (PointerData*) ptr.pd;
-         this->cuda_pointer = ptr.cuda_pointer;
-         if( this->pd != nullptr )
-            this->pd->counter += 1;
-#ifdef TNL_DEBUG_SHARED_POINTERS
-         std::cerr << "Copy-assigned shared pointer: counter = " << this->pd->counter << ", type: " << getType< ObjectType >() << std::endl;
-#endif
-         return *this;
-      }
-
-      /**
-       * \brief Move operator.
-       *
-       * It assigns object owned by the pointer \ref ptr to \ref this pointer.
-       *
-       * \param ptr input pointer
-       * \return constant reference to \ref this
-       */
-      const SharedPointer& operator=( SharedPointer&& ptr ) // this is needed only to avoid the default compiler-generated operator
-      {
-         this->free();
-         this->pd = (PointerData*) ptr.pd;
-         this->cuda_pointer = ptr.cuda_pointer;
-         ptr.pd = nullptr;
-         ptr.cuda_pointer = nullptr;
-#ifdef TNL_DEBUG_SHARED_POINTERS
-         std::cerr << "Move-assigned shared pointer: counter = " << this->pd->counter << ", type: " << getType< ObjectType >() << std::endl;
-#endif
-         return *this;
-      }
-
-      /**
-       * \brief Move operator.
-       *
-       * It assigns object owned by the pointer \ref ptr to \ref this pointer.
-       *
-       * See \ref Enabler.
-       *
-       * \param ptr input pointer
-       * \return constant reference to \ref this
-       */
-      template< typename Object_,
-                typename = typename Enabler< Object_ >::type >
-      const SharedPointer& operator=( SharedPointer<  Object_, DeviceType >&& ptr ) // conditional operator for non-const -> const data
-      {
-         this->free();
-         this->pd = (PointerData*) ptr.pd;
-         this->cuda_pointer = ptr.cuda_pointer;
-         ptr.pd = nullptr;
-         ptr.cuda_pointer = nullptr;
-#ifdef TNL_DEBUG_SHARED_POINTERS
-         std::cerr << "Move-assigned shared pointer: counter = " << this->pd->counter << ", type: " << getType< ObjectType >() << std::endl;
-#endif
-         return *this;
-      }
-
-      /**
-       * \brief Cross-device pointer synchronization.
-       *
-       * This method is usually called by the smart pointers register when calling
-       * \ref Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >()
-       *
-       * \return true if the synchronization was successful, false otherwise.
-       */
-      bool synchronize()
-      {
-         if( ! this->pd )
-            return true;
-#ifdef HAVE_CUDA
-         if( this->modified() )
-         {
-#ifdef TNL_DEBUG_SHARED_POINTERS
-            std::cerr << "Synchronizing shared pointer: counter = " << this->pd->counter << ", type: " << getType< ObjectType >() << std::endl;
-            std::cerr << "   ( " << sizeof( Object ) << " bytes, CUDA adress " << this->cuda_pointer << " )" << std::endl;
-#endif
-            TNL_ASSERT( this->cuda_pointer, );
-            cudaMemcpy( (void*) this->cuda_pointer, (void*) &this->pd->data, sizeof( Object ), cudaMemcpyHostToDevice );
-            TNL_CHECK_CUDA_DEVICE;
-            this->set_last_sync_state();
-            return true;
-         }
+      if( std::is_same< Device, Devices::Cuda >::value )
+         return *( this->cuda_pointer );
+   }
+
+   /**
+    * \brief Assignment operator.
+    *
+    * It assigns object owned by the pointer \ref ptr to \ref this pointer.
+    *
+    * \param ptr input pointer
+    * \return constant reference to \ref this
+    */
+   const SharedPointer&
+   operator=( const SharedPointer& ptr )  // this is needed only to avoid the default compiler-generated operator
+   {
+      this->free();
+      this->pd = (PointerData*) ptr.pd;
+      this->cuda_pointer = ptr.cuda_pointer;
+      if( this->pd != nullptr )
+         this->pd->counter += 1;
+   #ifdef TNL_DEBUG_SHARED_POINTERS
+      std::cerr << "Copy-assigned shared pointer: counter = " << this->pd->counter << ", type: " << getType< ObjectType >()
+                << std::endl;
+   #endif
+      return *this;
+   }
+
+   /**
+    * \brief Assignment operator for compatible object types.
+    *
+    * It assigns object owned by the pointer \ref ptr to \ref this pointer.
+    *
+    * See \ref Enabler.
+    *
+    * \param ptr input pointer
+    * \return constant reference to \ref this
+    */
+   template< typename Object_, typename = typename Enabler< Object_ >::type >
+   const SharedPointer&
+   operator=( const SharedPointer< Object_, DeviceType >& ptr )  // conditional operator for non-const -> const data
+   {
+      this->free();
+      this->pd = (PointerData*) ptr.pd;
+      this->cuda_pointer = ptr.cuda_pointer;
+      if( this->pd != nullptr )
+         this->pd->counter += 1;
+   #ifdef TNL_DEBUG_SHARED_POINTERS
+      std::cerr << "Copy-assigned shared pointer: counter = " << this->pd->counter << ", type: " << getType< ObjectType >()
+                << std::endl;
+   #endif
+      return *this;
+   }
+
+   /**
+    * \brief Move operator.
+    *
+    * It assigns object owned by the pointer \ref ptr to \ref this pointer.
+    *
+    * \param ptr input pointer
+    * \return constant reference to \ref this
+    */
+   const SharedPointer&
+   operator=( SharedPointer&& ptr ) noexcept  // this is needed only to avoid the default compiler-generated operator
+   {
+      this->free();
+      this->pd = (PointerData*) ptr.pd;
+      this->cuda_pointer = ptr.cuda_pointer;
+      ptr.pd = nullptr;
+      ptr.cuda_pointer = nullptr;
+   #ifdef TNL_DEBUG_SHARED_POINTERS
+      std::cerr << "Move-assigned shared pointer: counter = " << this->pd->counter << ", type: " << getType< ObjectType >()
+                << std::endl;
+   #endif
+      return *this;
+   }
+
+   /**
+    * \brief Move operator.
+    *
+    * It assigns object owned by the pointer \ref ptr to \ref this pointer.
+    *
+    * See \ref Enabler.
+    *
+    * \param ptr input pointer
+    * \return constant reference to \ref this
+    */
+   template< typename Object_, typename = typename Enabler< Object_ >::type >
+   const SharedPointer&
+   operator=( SharedPointer< Object_, DeviceType >&& ptr )  // conditional operator for non-const -> const data
+   {
+      this->free();
+      this->pd = (PointerData*) ptr.pd;
+      this->cuda_pointer = ptr.cuda_pointer;
+      ptr.pd = nullptr;
+      ptr.cuda_pointer = nullptr;
+   #ifdef TNL_DEBUG_SHARED_POINTERS
+      std::cerr << "Move-assigned shared pointer: counter = " << this->pd->counter << ", type: " << getType< ObjectType >()
+                << std::endl;
+   #endif
+      return *this;
+   }
+
+   /**
+    * \brief Cross-device pointer synchronization.
+    *
+    * This method is usually called by the smart pointers register when calling
+    * \ref Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >()
+    *
+    * \return true if the synchronization was successful, false otherwise.
+    */
+   bool
+   synchronize() override
+   {
+      if( ! this->pd )
          return true;
-#else
-         return false;
-#endif
-      }
-
-      /**
-       * \brief Reset the pointer to empty state.
-       */
-      void clear()
-      {
-         this->free();
-      }
-
-      /**
-       * \brief Swap the owned object with another pointer.
-       *
-       * \param ptr2 the other shared pointer for swapping.
-       */
-      void swap( SharedPointer& ptr2 )
-      {
-         std::swap( this->pd, ptr2.pd );
-         std::swap( this->cuda_pointer, ptr2.cuda_pointer );
-      }
-
-      /**
-       * \brief Destructor.
-       */
-      ~SharedPointer()
-      {
-         this->free();
-         getSmartPointersRegister< DeviceType >().remove( this );
-      }
-
-   protected:
-
-      struct PointerData
-      {
-         Object data;
-         char data_image[ sizeof(Object) ];
-         int counter;
-         bool maybe_modified;
-
-         template< typename... Args >
-         explicit PointerData( Args... args )
-         : data( args... ),
-           counter( 1 ),
-           maybe_modified( true )
-         {}
-      };
-
-      template< typename... Args >
-      bool allocate( Args... args )
-      {
-         this->pd = new PointerData( args... );
-         // allocate on device
-         this->cuda_pointer = AllocatorType{}.allocate(1);
-         // synchronize
-         this->synchronize();
-#ifdef TNL_DEBUG_SHARED_POINTERS
-         std::cerr << "Created shared pointer to " << getType< ObjectType >() << " (cuda_pointer = " << this->cuda_pointer << ")" << std::endl;
-#endif
-         getSmartPointersRegister< DeviceType >().insert( this );
+   #ifdef HAVE_CUDA
+      if( this->modified() ) {
+      #ifdef TNL_DEBUG_SHARED_POINTERS
+         std::cerr << "Synchronizing shared pointer: counter = " << this->pd->counter << ", type: " << getType< ObjectType >()
+                   << std::endl;
+         std::cerr << "   ( " << sizeof( Object ) << " bytes, CUDA adress " << this->cuda_pointer << " )" << std::endl;
+      #endif
+         TNL_ASSERT( this->cuda_pointer, );
+         cudaMemcpy( (void*) this->cuda_pointer, (void*) &this->pd->data, sizeof( Object ), cudaMemcpyHostToDevice );
+         TNL_CHECK_CUDA_DEVICE;
+         this->set_last_sync_state();
          return true;
       }
+      return true;
+   #else
+      return false;
+   #endif
+   }
+
+   /**
+    * \brief Reset the pointer to empty state.
+    */
+   void
+   clear()
+   {
+      this->free();
+   }
+
+   /**
+    * \brief Swap the owned object with another pointer.
+    *
+    * \param ptr2 the other shared pointer for swapping.
+    */
+   void
+   swap( SharedPointer& ptr2 )
+   {
+      std::swap( this->pd, ptr2.pd );
+      std::swap( this->cuda_pointer, ptr2.cuda_pointer );
+   }
+
+   /**
+    * \brief Destructor.
+    */
+   ~SharedPointer() override
+   {
+      this->free();
+      getSmartPointersRegister< DeviceType >().remove( this );
+   }
+
+protected:
+   struct PointerData
+   {
+      Object data;
+      char data_image[ sizeof( Object ) ];
+      int counter = 1;
+      bool maybe_modified = true;
 
-      void set_last_sync_state()
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         std::memcpy( (void*) &this->pd->data_image, (void*) &this->pd->data, sizeof( Object ) );
-         this->pd->maybe_modified = false;
-      }
-
-      bool modified()
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         // optimization: skip bitwise comparison if we're sure that the data is the same
-         if( ! this->pd->maybe_modified )
-            return false;
-         return std::memcmp( (void*) &this->pd->data_image, (void*) &this->pd->data, sizeof( Object ) ) != 0;
-      }
-
-      void free()
-      {
-         if( this->pd )
-         {
-#ifdef TNL_DEBUG_SHARED_POINTERS
-            std::cerr << "Freeing shared pointer: counter = " << this->pd->counter << ", cuda_pointer = " << this->cuda_pointer << ", type: " << getType< ObjectType >() << std::endl;
-#endif
-            if( ! --this->pd->counter )
-            {
-               delete this->pd;
-               this->pd = nullptr;
-               if( this->cuda_pointer )
-                  AllocatorType{}.deallocate( this->cuda_pointer, 1 );
-#ifdef TNL_DEBUG_SHARED_POINTERS
-               std::cerr << "...deleted data." << std::endl;
-#endif
-            }
+      template< typename... Args >
+      explicit PointerData( Args... args ) : data( args... )
+      {}
+   };
+
+   template< typename... Args >
+   bool
+   allocate( Args... args )
+   {
+      this->pd = new PointerData( args... );
+      // allocate on device
+      this->cuda_pointer = AllocatorType{}.allocate( 1 );
+      // synchronize
+      this->synchronize();
+   #ifdef TNL_DEBUG_SHARED_POINTERS
+      std::cerr << "Created shared pointer to " << getType< ObjectType >() << " (cuda_pointer = " << this->cuda_pointer << ")"
+                << std::endl;
+   #endif
+      getSmartPointersRegister< DeviceType >().insert( this );
+      return true;
+   }
+
+   void
+   set_last_sync_state()
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      std::memcpy( (void*) &this->pd->data_image, (void*) &this->pd->data, sizeof( Object ) );
+      this->pd->maybe_modified = false;
+   }
+
+   bool
+   modified()
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      // optimization: skip bitwise comparison if we're sure that the data is the same
+      if( ! this->pd->maybe_modified )
+         return false;
+      return std::memcmp( (void*) &this->pd->data_image, (void*) &this->pd->data, sizeof( Object ) ) != 0;
+   }
+
+   void
+   free()
+   {
+      if( this->pd ) {
+   #ifdef TNL_DEBUG_SHARED_POINTERS
+         std::cerr << "Freeing shared pointer: counter = " << this->pd->counter << ", cuda_pointer = " << this->cuda_pointer
+                   << ", type: " << getType< ObjectType >() << std::endl;
+   #endif
+         if( ! --this->pd->counter ) {
+            delete this->pd;
+            this->pd = nullptr;
+            if( this->cuda_pointer )
+               AllocatorType{}.deallocate( this->cuda_pointer, 1 );
+   #ifdef TNL_DEBUG_SHARED_POINTERS
+            std::cerr << "...deleted data." << std::endl;
+   #endif
          }
       }
+   }
 
-      PointerData* pd;
+   PointerData* pd;
 
-      // cuda_pointer can't be part of PointerData structure, since we would be
-      // unable to dereference this-pd on the device
-      Object* cuda_pointer;
+   // cuda_pointer can't be part of PointerData structure, since we would be
+   // unable to dereference this-pd on the device
+   Object* cuda_pointer;
 };
 
 #else
@@ -596,255 +598,253 @@ class SharedPointer< Object, Devices::Cuda > : public SmartPointer
 template< typename Object >
 class SharedPointer< Object, Devices::Cuda > : public SmartPointer
 {
-   private:
-      // Convenient template alias for controlling the selection of copy- and
-      // move-constructors and assignment operators using SFINAE.
-      // The type Object_ is "enabled" iff Object_ and Object are not the same,
-      // but after removing const and volatile qualifiers they are the same.
-      template< typename Object_ >
-      using Enabler = std::enable_if< ! std::is_same< Object_, Object >::value &&
-                                      std::is_same< typename std::remove_cv< Object >::type, Object_ >::value >;
-
-      // friend class will be needed for templated assignment operators
-      template< typename Object_, typename Device_ >
-      friend class SharedPointer;
-
-   public:
-
-      using ObjectType = Object;
-      using DeviceType = Devices::Cuda;
-
-      SharedPointer( std::nullptr_t )
-      : pd( nullptr )
-      {}
-
-      template< typename... Args >
-      explicit  SharedPointer( Args... args )
-      : pd( nullptr )
-      {
-#ifdef TNL_DEBUG_SHARED_POINTERS
-         std::cerr << "Creating shared pointer to " << getType< ObjectType >() << std::endl;
-#endif
-         this->allocate( args... );
-      }
-
-      // this is needed only to avoid the default compiler-generated constructor
-      SharedPointer( const SharedPointer& pointer )
-      : pd( (PointerData*) pointer.pd )
-      {
-         this->pd->counter += 1;
-      }
-
-      // conditional constructor for non-const -> const data
-      template< typename Object_,
-                typename = typename Enabler< Object_ >::type >
-      SharedPointer( const SharedPointer<  Object_, DeviceType >& pointer )
-      : pd( (PointerData*) pointer.pd )
-      {
-         this->pd->counter += 1;
-      }
-
-      // this is needed only to avoid the default compiler-generated constructor
-      SharedPointer( SharedPointer&& pointer )
-      : pd( (PointerData*) pointer.pd )
-      {
-         pointer.pd = nullptr;
-      }
-
-      // conditional constructor for non-const -> const data
-      template< typename Object_,
-                typename = typename Enabler< Object_ >::type >
-      SharedPointer( SharedPointer<  Object_, DeviceType >&& pointer )
-      : pd( (PointerData*) pointer.pd )
-      {
-         pointer.pd = nullptr;
-      }
-
-      template< typename... Args >
-      bool recreate( Args... args )
-      {
-#ifdef TNL_DEBUG_SHARED_POINTERS
-         std::cerr << "Recreating shared pointer to " << getType< ObjectType >() << std::endl;
-#endif
-         if( ! this->counter )
-            return this->allocate( args... );
-
-         if( *this->pd->counter == 1 )
-         {
-            /****
-             * The object is not shared -> recreate it in-place, without reallocation
-             */
-            this->pd->data.~ObjectType();
-            new ( this->pd->data ) ObjectType( args... );
-            return true;
-         }
-
-         // free will just decrement the counter
-         this->free();
-
+private:
+   // Convenient template alias for controlling the selection of copy- and
+   // move-constructors and assignment operators using SFINAE.
+   // The type Object_ is "enabled" iff Object_ and Object are not the same,
+   // but after removing const and volatile qualifiers they are the same.
+   template< typename Object_ >
+   using Enabler = std::enable_if< ! std::is_same< Object_, Object >::value
+                                   && std::is_same< typename std::remove_cv< Object >::type, Object_ >::value >;
+
+   // friend class will be needed for templated assignment operators
+   template< typename Object_, typename Device_ >
+   friend class SharedPointer;
+
+public:
+   using ObjectType = Object;
+   using DeviceType = Devices::Cuda;
+
+   SharedPointer( std::nullptr_t ) : pd( nullptr ) {}
+
+   template< typename... Args >
+   explicit SharedPointer( Args... args ) : pd( nullptr )
+   {
+   #ifdef TNL_DEBUG_SHARED_POINTERS
+      std::cerr << "Creating shared pointer to " << getType< ObjectType >() << std::endl;
+   #endif
+      this->allocate( args... );
+   }
+
+   // this is needed only to avoid the default compiler-generated constructor
+   SharedPointer( const SharedPointer& pointer ) : pd( (PointerData*) pointer.pd )
+   {
+      this->pd->counter += 1;
+   }
+
+   // conditional constructor for non-const -> const data
+   template< typename Object_, typename = typename Enabler< Object_ >::type >
+   SharedPointer( const SharedPointer< Object_, DeviceType >& pointer ) : pd( (PointerData*) pointer.pd )
+   {
+      this->pd->counter += 1;
+   }
+
+   // this is needed only to avoid the default compiler-generated constructor
+   SharedPointer( SharedPointer&& pointer ) : pd( (PointerData*) pointer.pd )
+   {
+      pointer.pd = nullptr;
+   }
+
+   // conditional constructor for non-const -> const data
+   template< typename Object_, typename = typename Enabler< Object_ >::type >
+   SharedPointer( SharedPointer< Object_, DeviceType >&& pointer ) : pd( (PointerData*) pointer.pd )
+   {
+      pointer.pd = nullptr;
+   }
+
+   template< typename... Args >
+   bool
+   recreate( Args... args )
+   {
+   #ifdef TNL_DEBUG_SHARED_POINTERS
+      std::cerr << "Recreating shared pointer to " << getType< ObjectType >() << std::endl;
+   #endif
+      if( ! this->counter )
          return this->allocate( args... );
-      }
 
-      const Object* operator->() const
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         return &this->pd->data;
-      }
-
-      Object* operator->()
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         return &this->pd->data;
-      }
-
-      const Object& operator *() const
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         return this->pd->data;
-      }
-
-      Object& operator *()
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         return this->pd->data;
-      }
-
-      __cuda_callable__
-      operator bool() const
-      {
-         return this->pd;
-      }
-
-      __cuda_callable__
-      bool operator!() const
-      {
-         return ! this->pd;
-      }
-
-      template< typename Device = Devices::Host >
-      __cuda_callable__
-      const Object& getData() const
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         return this->pd->data;
-      }
-
-      template< typename Device = Devices::Host >
-      __cuda_callable__
-      Object& modifyData()
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         return this->pd->data;
-      }
-
-      // this is needed only to avoid the default compiler-generated operator
-      const SharedPointer& operator=( const SharedPointer& ptr )
-      {
-         this->free();
-         this->pd = (PointerData*) ptr.pd;
-         if( this->pd != nullptr )
-            this->pd->counter += 1;
-         return *this;
-      }
-
-      // conditional operator for non-const -> const data
-      template< typename Object_,
-                typename = typename Enabler< Object_ >::type >
-      const SharedPointer& operator=( const SharedPointer<  Object_, DeviceType >& ptr )
-      {
-         this->free();
-         this->pd = (PointerData*) ptr.pd;
-         if( this->pd != nullptr )
-            this->pd->counter += 1;
-         return *this;
-      }
-
-      // this is needed only to avoid the default compiler-generated operator
-      const SharedPointer& operator=( SharedPointer&& ptr )
-      {
-         this->free();
-         this->pd = (PointerData*) ptr.pd;
-         ptr.pd = nullptr;
-         return *this;
-      }
-
-      // conditional operator for non-const -> const data
-      template< typename Object_,
-                typename = typename Enabler< Object_ >::type >
-      const SharedPointer& operator=( SharedPointer<  Object_, DeviceType >&& ptr )
-      {
-         this->free();
-         this->pd = (PointerData*) ptr.pd;
-         ptr.pd = nullptr;
-         return *this;
-      }
-
-      bool synchronize()
-      {
+      if( *this->pd->counter == 1 ) {
+         /****
+          * The object is not shared -> recreate it in-place, without reallocation
+          */
+         this->pd->data.~ObjectType();
+         new( this->pd->data ) ObjectType( args... );
          return true;
       }
 
-      void clear()
-      {
-         this->free();
-      }
-
-      void swap( SharedPointer& ptr2 )
-      {
-         std::swap( this->pd, ptr2.pd );
-      }
-
-      ~SharedPointer()
-      {
-         this->free();
-      }
-
-
-   protected:
-
-      struct PointerData
-      {
-         Object data;
-         int counter;
-
-         template< typename... Args >
-         explicit PointerData( Args... args )
-         : data( args... ),
-           counter( 1 )
-         {}
-      };
+      // free will just decrement the counter
+      this->free();
+
+      return this->allocate( args... );
+   }
+
+   const Object*
+   operator->() const
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      return &this->pd->data;
+   }
+
+   Object*
+   operator->()
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      return &this->pd->data;
+   }
+
+   const Object&
+   operator*() const
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      return this->pd->data;
+   }
+
+   Object&
+   operator*()
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      return this->pd->data;
+   }
+
+   __cuda_callable__
+   operator bool() const
+   {
+      return this->pd;
+   }
+
+   __cuda_callable__
+   bool
+   operator!() const
+   {
+      return ! this->pd;
+   }
+
+   template< typename Device = Devices::Host >
+   __cuda_callable__
+   const Object&
+   getData() const
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      return this->pd->data;
+   }
+
+   template< typename Device = Devices::Host >
+   __cuda_callable__
+   Object&
+   modifyData()
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      return this->pd->data;
+   }
+
+   // this is needed only to avoid the default compiler-generated operator
+   const SharedPointer&
+   operator=( const SharedPointer& ptr )
+   {
+      this->free();
+      this->pd = (PointerData*) ptr.pd;
+      if( this->pd != nullptr )
+         this->pd->counter += 1;
+      return *this;
+   }
+
+   // conditional operator for non-const -> const data
+   template< typename Object_, typename = typename Enabler< Object_ >::type >
+   const SharedPointer&
+   operator=( const SharedPointer< Object_, DeviceType >& ptr )
+   {
+      this->free();
+      this->pd = (PointerData*) ptr.pd;
+      if( this->pd != nullptr )
+         this->pd->counter += 1;
+      return *this;
+   }
+
+   // this is needed only to avoid the default compiler-generated operator
+   const SharedPointer&
+   operator=( SharedPointer&& ptr )
+   {
+      this->free();
+      this->pd = (PointerData*) ptr.pd;
+      ptr.pd = nullptr;
+      return *this;
+   }
+
+   // conditional operator for non-const -> const data
+   template< typename Object_, typename = typename Enabler< Object_ >::type >
+   const SharedPointer&
+   operator=( SharedPointer< Object_, DeviceType >&& ptr )
+   {
+      this->free();
+      this->pd = (PointerData*) ptr.pd;
+      ptr.pd = nullptr;
+      return *this;
+   }
+
+   bool
+   synchronize()
+   {
+      return true;
+   }
+
+   void
+   clear()
+   {
+      this->free();
+   }
+
+   void
+   swap( SharedPointer& ptr2 )
+   {
+      std::swap( this->pd, ptr2.pd );
+   }
+
+   ~SharedPointer()
+   {
+      this->free();
+   }
+
+protected:
+   struct PointerData
+   {
+      Object data;
+      int counter;
 
       template< typename... Args >
-      bool allocate( Args... args )
-      {
-#ifdef HAVE_CUDA
-         if( cudaMallocManaged( ( void** ) &this->pd, sizeof( PointerData ) != cudaSuccess ) )
-            return false;
-         new ( this->pd ) PointerData( args... );
-         return true;
-#else
+      explicit PointerData( Args... args ) : data( args... ), counter( 1 )
+      {}
+   };
+
+   template< typename... Args >
+   bool
+   allocate( Args... args )
+   {
+   #ifdef HAVE_CUDA
+      if( cudaMallocManaged( (void**) &this->pd, sizeof( PointerData ) != cudaSuccess ) )
          return false;
-#endif
-      }
-
-      void free()
-      {
-         if( this->pd )
-         {
-            if( ! --this->pd->counter )
-            {
-#ifdef HAVE_CUDA
-               cudaFree( this->pd );
-#endif
-               this->pd = nullptr;
-            }
+      new( this->pd ) PointerData( args... );
+      return true;
+   #else
+      return false;
+   #endif
+   }
+
+   void
+   free()
+   {
+      if( this->pd ) {
+         if( ! --this->pd->counter ) {
+   #ifdef HAVE_CUDA
+            cudaFree( this->pd );
+   #endif
+            this->pd = nullptr;
          }
       }
+   }
 
-      PointerData* pd;
+   PointerData* pd;
 };
 
-#endif // ! HAVE_CUDA_UNIFIED_MEMORY
+#endif  // ! HAVE_CUDA_UNIFIED_MEMORY
 
-} // namespace Pointers
-} // namespace TNL
+}  // namespace Pointers
+}  // namespace TNL
diff --git a/src/TNL/Pointers/SharedPointerHost.h b/src/TNL/Pointers/SharedPointerHost.h
index 1c2c3729d079eb83e7da8e33cf5262fcf4949ba6..27945b0587fea0b18bba31e75c030326ab755944 100644
--- a/src/TNL/Pointers/SharedPointerHost.h
+++ b/src/TNL/Pointers/SharedPointerHost.h
@@ -14,8 +14,8 @@
 #include <TNL/Cuda/CudaCallable.h>
 #include <TNL/Pointers/SmartPointer.h>
 
-#include <cstddef>   // std::nullptr_t
-#include <algorithm> // swap
+#include <cstddef>    // std::nullptr_t
+#include <algorithm>  // swap
 
 namespace TNL {
 namespace Pointers {
@@ -28,429 +28,427 @@ namespace Pointers {
 template< typename Object >
 class SharedPointer< Object, Devices::Host > : public SmartPointer
 {
-   private:
-
-      /**
-       * \typedef Enabler
-       * Convenient template alias for controlling the selection of copy- and
-       * move-constructors and assignment operators using SFINAE.
-       * The type Object_ is "enabled" iff Object_ and Object are not the same,
-       * but after removing const and volatile qualifiers they are the same.
-       */
-      template< typename Object_ >
-      using Enabler = std::enable_if< ! std::is_same< Object_, Object >::value &&
-                                      std::is_same< typename std::remove_cv< Object >::type, Object_ >::value >;
-
-      // friend class will be needed for templated assignment operators
-      template< typename Object_, typename Device_ >
-      friend class SharedPointer;
-
-   public:
-
-      /**
-       * \typedef ObjectType is the type of object owned by the pointer.
-       */
-      using ObjectType = Object;
-
-      /**
-       * \typedef DeviceType is the type of device where the object is to be
-       * mirrored.
-       */
-      using DeviceType = Devices::Host;
-
-      /**
-       * \brief Constructor of an empty pointer.
-       */
-      SharedPointer( std::nullptr_t )
-      : pd( nullptr )
-      {}
-
-      /**
-       * \brief Constructor with parameters of the Object constructor.
-       *
-       * \tparam Args is variadic template type of arguments of the Object constructor.
-       * \param args are arguments passed to the Object constructor.
-       */
-      template< typename... Args >
-      explicit  SharedPointer( Args... args )
-      : pd( nullptr )
-      {
+private:
+   /**
+    * \typedef Enabler
+    * Convenient template alias for controlling the selection of copy- and
+    * move-constructors and assignment operators using SFINAE.
+    * The type Object_ is "enabled" iff Object_ and Object are not the same,
+    * but after removing const and volatile qualifiers they are the same.
+    */
+   template< typename Object_ >
+   using Enabler = std::enable_if< ! std::is_same< Object_, Object >::value
+                                   && std::is_same< typename std::remove_cv< Object >::type, Object_ >::value >;
+
+   // friend class will be needed for templated assignment operators
+   template< typename Object_, typename Device_ >
+   friend class SharedPointer;
+
+public:
+   /**
+    * \typedef ObjectType is the type of object owned by the pointer.
+    */
+   using ObjectType = Object;
+
+   /**
+    * \typedef DeviceType is the type of device where the object is to be
+    * mirrored.
+    */
+   using DeviceType = Devices::Host;
+
+   /**
+    * \brief Constructor of an empty pointer.
+    */
+   SharedPointer( std::nullptr_t ) : pd( nullptr ) {}
+
+   /**
+    * \brief Constructor with parameters of the Object constructor.
+    *
+    * \tparam Args is variadic template type of arguments of the Object constructor.
+    * \param args are arguments passed to the Object constructor.
+    */
+   template< typename... Args >
+   explicit SharedPointer( Args... args ) : pd( nullptr )
+   {
 #ifdef TNL_DEBUG_SHARED_POINTERS
-         std::cerr << "Creating shared pointer to " << getType< ObjectType >() << std::endl;
+      std::cerr << "Creating shared pointer to " << getType< ObjectType >() << std::endl;
 #endif
-         this->allocate( args... );
-      }
-
-      /**
-       * \brief Constructor with initializer list.
-       *
-       * \tparam Value is type of the initializer list elements.
-       * \param list is the instance of the initializer list..
-       */
-      template< typename Value >
-      explicit  SharedPointer( std::initializer_list< Value > list )
-      : pd( nullptr )
-      {
+      this->allocate( args... );
+   }
+
+   /**
+    * \brief Constructor with initializer list.
+    *
+    * \tparam Value is type of the initializer list elements.
+    * \param list is the instance of the initializer list..
+    */
+   template< typename Value >
+   explicit SharedPointer( std::initializer_list< Value > list ) : pd( nullptr )
+   {
 #ifdef TNL_DEBUG_SHARED_POINTERS
-         std::cerr << "Creating shared pointer to " << getType< ObjectType >() << std::endl;
+      std::cerr << "Creating shared pointer to " << getType< ObjectType >() << std::endl;
 #endif
-         this->allocate( list );
-      }
-
-      /**
-       * \brief Constructor with nested initializer lists.
-       *
-       * \tparam Value is type of the nested initializer list elements.
-       * \param list is the instance of the nested initializer list..
-       */
-      template< typename Value >
-      explicit  SharedPointer( std::initializer_list< std::initializer_list< Value > > list )
-      : pd( nullptr )
-      {
+      this->allocate( list );
+   }
+
+   /**
+    * \brief Constructor with nested initializer lists.
+    *
+    * \tparam Value is type of the nested initializer list elements.
+    * \param list is the instance of the nested initializer list..
+    */
+   template< typename Value >
+   explicit SharedPointer( std::initializer_list< std::initializer_list< Value > > list ) : pd( nullptr )
+   {
 #ifdef TNL_DEBUG_SHARED_POINTERS
-         std::cerr << "Creating shared pointer to " << getType< ObjectType >() << std::endl;
+      std::cerr << "Creating shared pointer to " << getType< ObjectType >() << std::endl;
 #endif
-         this->allocate( list );
-      }
-
-      /**
-       * \brief Copy constructor.
-       *
-       * \param pointer is the source shared pointer.
-       */
-      SharedPointer( const SharedPointer& pointer ) // this is needed only to avoid the default compiler-generated constructor
-      : pd( (PointerData*) pointer.pd )
-      {
-         this->pd->counter += 1;
-      }
-
-      /**
-       * \brief Copy constructor.
-       *
-       * This is specialization for compatible object types.
-       *
-       * See \ref Enabler.
-       *
-       * \param pointer is the source shared pointer.
-       */
-      template< typename Object_,
-                typename = typename Enabler< Object_ >::type >
-      SharedPointer( const SharedPointer<  Object_, DeviceType >& pointer ) // conditional constructor for non-const -> const data
-      : pd( (PointerData*) pointer.pd )
-      {
-         this->pd->counter += 1;
-      }
-
-      /**
-       * \brief Move constructor.
-       *
-       * \param pointer is the source shared pointer.
-       */
-      SharedPointer( SharedPointer&& pointer ) // this is needed only to avoid the default compiler-generated constructor
-      : pd( (PointerData*) pointer.pd )
-      {
-         pointer.pd = nullptr;
-      }
-
-      /**
-       * \brief Move constructor.
-       *
-       * This is specialization for compatible object types.
-       *
-       * See \ref Enabler.
-       *
-       * \param pointer is the source shared pointer.
-       */
-      template< typename Object_,
-                typename = typename Enabler< Object_ >::type >
-      SharedPointer( SharedPointer<  Object_, DeviceType >&& pointer ) // conditional constructor for non-const -> const data
-      : pd( (PointerData*) pointer.pd )
-      {
-         pointer.pd = nullptr;
-      }
-
-      /**
-       * \brief Create new object based in given constructor parameters.
-       *
-       * \tparam Args is variadic template type of arguments to be passed to the
-       *    object constructor.
-       * \param args are arguments to be passed to the object constructor.
-       * \return true if recreation was successful, false otherwise.
-       */
-      template< typename... Args >
-      bool recreate( Args... args )
-      {
+      this->allocate( list );
+   }
+
+   /**
+    * \brief Copy constructor.
+    *
+    * \param pointer is the source shared pointer.
+    */
+   SharedPointer( const SharedPointer& pointer )  // this is needed only to avoid the default compiler-generated constructor
+   : pd( (PointerData*) pointer.pd )
+   {
+      this->pd->counter += 1;
+   }
+
+   /**
+    * \brief Copy constructor.
+    *
+    * This is specialization for compatible object types.
+    *
+    * See \ref Enabler.
+    *
+    * \param pointer is the source shared pointer.
+    */
+   template< typename Object_, typename = typename Enabler< Object_ >::type >
+   SharedPointer( const SharedPointer< Object_, DeviceType >& pointer )  // conditional constructor for non-const -> const data
+   : pd( (PointerData*) pointer.pd )
+   {
+      this->pd->counter += 1;
+   }
+
+   /**
+    * \brief Move constructor.
+    *
+    * \param pointer is the source shared pointer.
+    */
+   SharedPointer( SharedPointer&& pointer ) noexcept  // this is needed only to avoid the default compiler-generated constructor
+   : pd( (PointerData*) pointer.pd )
+   {
+      pointer.pd = nullptr;
+   }
+
+   /**
+    * \brief Move constructor.
+    *
+    * This is specialization for compatible object types.
+    *
+    * See \ref Enabler.
+    *
+    * \param pointer is the source shared pointer.
+    */
+   template< typename Object_, typename = typename Enabler< Object_ >::type >
+   SharedPointer( SharedPointer< Object_, DeviceType >&& pointer )  // conditional constructor for non-const -> const data
+   : pd( (PointerData*) pointer.pd )
+   {
+      pointer.pd = nullptr;
+   }
+
+   /**
+    * \brief Create new object based in given constructor parameters.
+    *
+    * \tparam Args is variadic template type of arguments to be passed to the
+    *    object constructor.
+    * \param args are arguments to be passed to the object constructor.
+    * \return true if recreation was successful, false otherwise.
+    */
+   template< typename... Args >
+   bool
+   recreate( Args... args )
+   {
 #ifdef TNL_DEBUG_SHARED_POINTERS
-         std::cerr << "Recreating shared pointer to " << getType< ObjectType >() << std::endl;
+      std::cerr << "Recreating shared pointer to " << getType< ObjectType >() << std::endl;
 #endif
-         if( ! this->counter )
-            return this->allocate( args... );
-
-         if( *this->pd->counter == 1 )
-         {
-            /****
-             * The object is not shared -> recreate it in-place, without reallocation
-             */
-            this->pd->data.~ObjectType();
-            new ( this->pd->data ) ObjectType( args... );
-            return true;
-         }
-
-         // free will just decrement the counter
-         this->free();
-
+      if( ! this->counter )
          return this->allocate( args... );
-      }
-
-      /**
-       * \brief Arrow operator for accessing the object owned by constant smart pointer.
-       *
-       * \return constant pointer to the object owned by this smart pointer.
-       */
-      const Object* operator->() const
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         return &this->pd->data;
-      }
-
-      /**
-       * \brief Arrow operator for accessing the object owned by non-constant smart pointer.
-       *
-       * \return pointer to the object owned by this smart pointer.
-       */
-      Object* operator->()
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         return &this->pd->data;
-      }
-
-      /**
-       * \brief Dereferencing operator for accessing the object owned by constant smart pointer.
-       *
-       * \return constant reference to the object owned by this smart pointer.
-       */
-      const Object& operator *() const
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         return this->pd->data;
-      }
-
-      /**
-       * \brief Dereferencing operator for accessing the object owned by non-constant smart pointer.
-       *
-       * \return reference to the object owned by this smart pointer.
-       */
-      Object& operator *()
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         return this->pd->data;
-      }
 
-      /**
-       * \brief Conversion to boolean type.
-       *
-       * \return Returns true if the pointer is not empty, false otherwise.
-       */
-      operator bool() const
-      {
-         return this->pd;
-      }
-
-      /**
-       * \brief Negation operator.
-       *
-       * \return Returns false if the pointer is not empty, true otherwise.
-       */
-      bool operator!() const
-      {
-         return ! this->pd;
-      }
-
-      /**
-       * \brief Constant object reference getter.
-       *
-       * No synchronization of this pointer will be performed due to calling
-       * this method.
-       *
-       * \tparam Device says what image of the object one want to dereference. It
-       * can be either \ref DeviceType or Devices::Host.
-       * \return constant reference to the object image on given device.
-       */
-      template< typename Device = Devices::Host >
-      __cuda_callable__
-      const Object& getData() const
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         return this->pd->data;
-      }
-
-      /**
-       * \brief Non-constant object reference getter.
-       *
-       * No synchronization of this pointer will be performed due to calling
-       * this method.
-       *
-       * \tparam Device says what image of the object one want to dereference. It
-       * can be either \ref DeviceType or Devices::Host.
-       * \return constant reference to the object image on given device.
-       */
-      template< typename Device = Devices::Host >
-      __cuda_callable__
-      Object& modifyData()
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         return this->pd->data;
-      }
-
-      /**
-       * \brief Assignment operator.
-       *
-       * It assigns object owned by the pointer \ref ptr to \ref this pointer.
-       *
-       * \param ptr input pointer
-       * \return constant reference to \ref this
-       */
-      const SharedPointer& operator=( const SharedPointer& ptr ) // this is needed only to avoid the default compiler-generated operator
-      {
-         this->free();
-         this->pd = (PointerData*) ptr.pd;
-         if( this->pd != nullptr )
-            this->pd->counter += 1;
-         return *this;
-      }
-
-      /**
-       * \brief Assignment operator for compatible object types.
-       *
-       * It assigns object owned by the pointer \ref ptr to \ref this pointer.
-       *
-       * See \ref Enabler.
-       *
-       * \param ptr input pointer
-       * \return constant reference to \ref this
-       */
-      template< typename Object_,
-                typename = typename Enabler< Object_ >::type >
-      const SharedPointer& operator=( const SharedPointer<  Object_, DeviceType >& ptr ) // conditional operator for non-const -> const data
-      {
-         this->free();
-         this->pd = (PointerData*) ptr.pd;
-         if( this->pd != nullptr )
-            this->pd->counter += 1;
-         return *this;
-      }
-
-      /**
-       * \brief Move operator.
-       *
-       * It assigns object owned by the pointer \ref ptr to \ref this pointer.
-       *
-       * \param ptr input pointer
-       * \return constant reference to \ref this
-       */
-      const SharedPointer& operator=( SharedPointer&& ptr ) // this is needed only to avoid the default compiler-generated operator
-      {
-         this->free();
-         this->pd = (PointerData*) ptr.pd;
-         ptr.pd = nullptr;
-         return *this;
-      }
-
-      /**
-       * \brief Move operator.
-       *
-       * It assigns object owned by the pointer \ref ptr to \ref this pointer.
-       *
-       * See \ref Enabler.
-       *
-       * \param ptr input pointer
-       * \return constant reference to \ref this
-       */
-      template< typename Object_,
-                typename = typename Enabler< Object_ >::type >
-      const SharedPointer& operator=( SharedPointer<  Object_, DeviceType >&& ptr ) // conditional operator for non-const -> const data
-      {
-         this->free();
-         this->pd = (PointerData*) ptr.pd;
-         ptr.pd = nullptr;
-         return *this;
-      }
-
-      /**
-       * \brief Cross-device pointer synchronization.
-       *
-       * For the smart pointers on the host, this method does nothing.
-       *
-       * \return true.
-       */
-      bool synchronize()
-      {
+      if( *this->pd->counter == 1 ) {
+         /****
+          * The object is not shared -> recreate it in-place, without reallocation
+          */
+         this->pd->data.~ObjectType();
+         new( this->pd->data ) ObjectType( args... );
          return true;
       }
 
-      /**
-       * \brief Reset the pointer to empty state.
-       */
-      void clear()
-      {
-         this->free();
-      }
-
-      /**
-       * \brief Swap the owned object with another pointer.
-       *
-       * \param ptr2 the other shared pointer for swapping.
-       */
-      void swap( SharedPointer& ptr2 )
-      {
-         std::swap( this->pd, ptr2.pd );
-      }
-
-      /**
-       * \brief Destructor.
-       */
-      ~SharedPointer()
-      {
-         this->free();
-      }
-
-
-   protected:
-
-      struct PointerData
-      {
-         Object data;
-         int counter;
-
-         template< typename... Args >
-         explicit PointerData( Args... args )
-         : data( args... ),
-           counter( 1 )
-         {}
-      };
+      // free will just decrement the counter
+      this->free();
+
+      return this->allocate( args... );
+   }
+
+   /**
+    * \brief Arrow operator for accessing the object owned by constant smart pointer.
+    *
+    * \return constant pointer to the object owned by this smart pointer.
+    */
+   const Object*
+   operator->() const
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      return &this->pd->data;
+   }
+
+   /**
+    * \brief Arrow operator for accessing the object owned by non-constant smart pointer.
+    *
+    * \return pointer to the object owned by this smart pointer.
+    */
+   Object*
+   operator->()
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      return &this->pd->data;
+   }
+
+   /**
+    * \brief Dereferencing operator for accessing the object owned by constant smart pointer.
+    *
+    * \return constant reference to the object owned by this smart pointer.
+    */
+   const Object&
+   operator*() const
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      return this->pd->data;
+   }
+
+   /**
+    * \brief Dereferencing operator for accessing the object owned by non-constant smart pointer.
+    *
+    * \return reference to the object owned by this smart pointer.
+    */
+   Object&
+   operator*()
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      return this->pd->data;
+   }
+
+   /**
+    * \brief Conversion to boolean type.
+    *
+    * \return Returns true if the pointer is not empty, false otherwise.
+    */
+   operator bool() const
+   {
+      return this->pd;
+   }
+
+   /**
+    * \brief Negation operator.
+    *
+    * \return Returns false if the pointer is not empty, true otherwise.
+    */
+   bool
+   operator!() const
+   {
+      return ! this->pd;
+   }
+
+   /**
+    * \brief Constant object reference getter.
+    *
+    * No synchronization of this pointer will be performed due to calling
+    * this method.
+    *
+    * \tparam Device says what image of the object one want to dereference. It
+    * can be either \ref DeviceType or Devices::Host.
+    * \return constant reference to the object image on given device.
+    */
+   template< typename Device = Devices::Host >
+   __cuda_callable__
+   const Object&
+   getData() const
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      return this->pd->data;
+   }
+
+   /**
+    * \brief Non-constant object reference getter.
+    *
+    * No synchronization of this pointer will be performed due to calling
+    * this method.
+    *
+    * \tparam Device says what image of the object one want to dereference. It
+    * can be either \ref DeviceType or Devices::Host.
+    * \return constant reference to the object image on given device.
+    */
+   template< typename Device = Devices::Host >
+   __cuda_callable__
+   Object&
+   modifyData()
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      return this->pd->data;
+   }
+
+   /**
+    * \brief Assignment operator.
+    *
+    * It assigns object owned by the pointer \ref ptr to \ref this pointer.
+    *
+    * \param ptr input pointer
+    * \return constant reference to \ref this
+    */
+   const SharedPointer&
+   operator=( const SharedPointer& ptr )  // this is needed only to avoid the default compiler-generated operator
+   {
+      this->free();
+      this->pd = (PointerData*) ptr.pd;
+      if( this->pd != nullptr )
+         this->pd->counter += 1;
+      return *this;
+   }
+
+   /**
+    * \brief Assignment operator for compatible object types.
+    *
+    * It assigns object owned by the pointer \ref ptr to \ref this pointer.
+    *
+    * See \ref Enabler.
+    *
+    * \param ptr input pointer
+    * \return constant reference to \ref this
+    */
+   template< typename Object_, typename = typename Enabler< Object_ >::type >
+   const SharedPointer&
+   operator=( const SharedPointer< Object_, DeviceType >& ptr )  // conditional operator for non-const -> const data
+   {
+      this->free();
+      this->pd = (PointerData*) ptr.pd;
+      if( this->pd != nullptr )
+         this->pd->counter += 1;
+      return *this;
+   }
+
+   /**
+    * \brief Move operator.
+    *
+    * It assigns object owned by the pointer \ref ptr to \ref this pointer.
+    *
+    * \param ptr input pointer
+    * \return constant reference to \ref this
+    */
+   const SharedPointer&
+   operator=( SharedPointer&& ptr ) noexcept  // this is needed only to avoid the default compiler-generated operator
+   {
+      this->free();
+      this->pd = (PointerData*) ptr.pd;
+      ptr.pd = nullptr;
+      return *this;
+   }
+
+   /**
+    * \brief Move operator.
+    *
+    * It assigns object owned by the pointer \ref ptr to \ref this pointer.
+    *
+    * See \ref Enabler.
+    *
+    * \param ptr input pointer
+    * \return constant reference to \ref this
+    */
+   template< typename Object_, typename = typename Enabler< Object_ >::type >
+   const SharedPointer&
+   operator=( SharedPointer< Object_, DeviceType >&& ptr )  // conditional operator for non-const -> const data
+   {
+      this->free();
+      this->pd = (PointerData*) ptr.pd;
+      ptr.pd = nullptr;
+      return *this;
+   }
+
+   /**
+    * \brief Cross-device pointer synchronization.
+    *
+    * For the smart pointers on the host, this method does nothing.
+    *
+    * \return true.
+    */
+   bool
+   synchronize() override
+   {
+      return true;
+   }
+
+   /**
+    * \brief Reset the pointer to empty state.
+    */
+   void
+   clear()
+   {
+      this->free();
+   }
+
+   /**
+    * \brief Swap the owned object with another pointer.
+    *
+    * \param ptr2 the other shared pointer for swapping.
+    */
+   void
+   swap( SharedPointer& ptr2 )
+   {
+      std::swap( this->pd, ptr2.pd );
+   }
+
+   /**
+    * \brief Destructor.
+    */
+   ~SharedPointer() override
+   {
+      this->free();
+   }
+
+protected:
+   struct PointerData
+   {
+      Object data;
+      int counter = 1;
 
       template< typename... Args >
-      bool allocate( Args... args )
-      {
-         this->pd = new PointerData( args... );
-         return this->pd;
-      }
-
-      void free()
-      {
-         if( this->pd )
-         {
-            if( ! --this->pd->counter )
-            {
-               delete this->pd;
-               this->pd = nullptr;
-            }
+      explicit PointerData( Args... args ) : data( args... )
+      {}
+   };
+
+   template< typename... Args >
+   bool
+   allocate( Args... args )
+   {
+      this->pd = new PointerData( args... );
+      return this->pd;
+   }
+
+   void
+   free()
+   {
+      if( this->pd ) {
+         if( ! --this->pd->counter ) {
+            delete this->pd;
+            this->pd = nullptr;
          }
-
       }
+   }
 
-      PointerData* pd;
+   PointerData* pd;
 };
 
-} // namespace Pointers
-} // namespace TNL
+}  // namespace Pointers
+}  // namespace TNL
diff --git a/src/TNL/Pointers/SmartPointer.h b/src/TNL/Pointers/SmartPointer.h
index f3cceb1fb6ebbfaf7776fab6422d49bef4ccbaa2..4ec83d9d104c535e98b189489241dad82962fe74 100644
--- a/src/TNL/Pointers/SmartPointer.h
+++ b/src/TNL/Pointers/SmartPointer.h
@@ -17,12 +17,12 @@ namespace Pointers {
 
 class SmartPointer
 {
-   public:
+public:
+   virtual bool
+   synchronize() = 0;
 
-      virtual bool synchronize() = 0;
-
-      virtual ~SmartPointer() = default;
+   virtual ~SmartPointer() = default;
 };
 
-} // namespace Pointers
-} // namespace TNL
+}  // namespace Pointers
+}  // namespace TNL
diff --git a/src/TNL/Pointers/SmartPointersRegister.h b/src/TNL/Pointers/SmartPointersRegister.h
index b9714430dc0f4889b7232c9cd85b581e3831bd22..3dfe5ff9663f77d4396fb3f1754aeb6cc7baefaf 100644
--- a/src/TNL/Pointers/SmartPointersRegister.h
+++ b/src/TNL/Pointers/SmartPointersRegister.h
@@ -25,76 +25,77 @@ namespace Pointers {
 // should beome a class template specialization.
 class SmartPointersRegister
 {
-
-   public:
-
-      /**
-       * Negative deviceId means that \ref Cuda::DeviceInfo::getActiveDevice will be
-       * called to get the device ID.
-       */
-      void insert( SmartPointer* pointer, int deviceId = -1 )
-      {
-         if( deviceId < 0 )
-            deviceId = Cuda::DeviceInfo::getActiveDevice();
-         pointersOnDevices[ deviceId ].insert( pointer );
+public:
+   /**
+    * Negative deviceId means that \ref Cuda::DeviceInfo::getActiveDevice will be
+    * called to get the device ID.
+    */
+   void
+   insert( SmartPointer* pointer, int deviceId = -1 )
+   {
+      if( deviceId < 0 )
+         deviceId = Cuda::DeviceInfo::getActiveDevice();
+      pointersOnDevices[ deviceId ].insert( pointer );
+   }
+
+   /**
+    * Negative deviceId means that \ref Cuda::DeviceInfo::getActiveDevice will be
+    * called to get the device ID.
+    */
+   void
+   remove( SmartPointer* pointer, int deviceId = -1 )
+   {
+      if( deviceId < 0 )
+         deviceId = Cuda::DeviceInfo::getActiveDevice();
+      try {
+         pointersOnDevices.at( deviceId ).erase( pointer );
       }
-
-      /**
-       * Negative deviceId means that \ref Cuda::DeviceInfo::getActiveDevice will be
-       * called to get the device ID.
-       */
-      void remove( SmartPointer* pointer, int deviceId = -1 )
-      {
-         if( deviceId < 0 )
-            deviceId = Cuda::DeviceInfo::getActiveDevice();
-         try {
-            pointersOnDevices.at( deviceId ).erase( pointer );
-         }
-         catch( const std::out_of_range& ) {
-            std::cerr << "Given deviceId " << deviceId << " does not have any pointers yet. "
-                      << "Requested to remove pointer " << pointer << ". "
-                      << "This is most likely a bug in the smart pointer." << std::endl;
-            throw;
-         }
+      catch( const std::out_of_range& ) {
+         std::cerr << "Given deviceId " << deviceId << " does not have any pointers yet. "
+                   << "Requested to remove pointer " << pointer << ". "
+                   << "This is most likely a bug in the smart pointer." << std::endl;
+         throw;
       }
-
-      /**
-       * Negative deviceId means that \ref Cuda::DeviceInfo::getActiveDevice will be
-       * called to get the device ID.
-       */
-      bool synchronizeDevice( int deviceId = -1 )
-      {
-         if( deviceId < 0 )
-            deviceId = Cuda::DeviceInfo::getActiveDevice();
-         try {
-            const auto & set = pointersOnDevices.at( deviceId );
-            for( auto&& it : set )
-               ( *it ).synchronize();
-            return true;
-         }
-         catch( const std::out_of_range& ) {
-            return false;
-         }
+   }
+
+   /**
+    * Negative deviceId means that \ref Cuda::DeviceInfo::getActiveDevice will be
+    * called to get the device ID.
+    */
+   bool
+   synchronizeDevice( int deviceId = -1 )
+   {
+      if( deviceId < 0 )
+         deviceId = Cuda::DeviceInfo::getActiveDevice();
+      try {
+         const auto& set = pointersOnDevices.at( deviceId );
+         for( auto&& it : set )
+            ( *it ).synchronize();
+         return true;
       }
+      catch( const std::out_of_range& ) {
+         return false;
+      }
+   }
 
-   protected:
-
-      typedef std::unordered_set< SmartPointer* > SetType;
+protected:
+   using SetType = std::unordered_set< SmartPointer* >;
 
-      std::unordered_map< int, SetType > pointersOnDevices;
+   std::unordered_map< int, SetType > pointersOnDevices;
 };
 
-
 // TODO: Device -> Allocator (in all smart pointers)
 template< typename Device >
-SmartPointersRegister& getSmartPointersRegister()
+SmartPointersRegister&
+getSmartPointersRegister()
 {
    static SmartPointersRegister reg;
    return reg;
 }
 
 template< typename Device >
-Timer& getSmartPointersSynchronizationTimer()
+Timer&
+getSmartPointersSynchronizationTimer()
 {
    static Timer timer;
    return timer;
@@ -105,7 +106,8 @@ Timer& getSmartPointersSynchronizationTimer()
  * determined automatically.
  */
 template< typename Device >
-bool synchronizeSmartPointersOnDevice( int deviceId = -1 )
+bool
+synchronizeSmartPointersOnDevice( int deviceId = -1 )
 {
    // TODO: better way to skip synchronization of host-only smart pointers
    if( std::is_same< Device, Devices::Sequential >::value || std::is_same< Device, Devices::Host >::value )
@@ -117,5 +119,5 @@ bool synchronizeSmartPointersOnDevice( int deviceId = -1 )
    return b;
 }
 
-} // namespace Pointers
-} // namespace TNL
+}  // namespace Pointers
+}  // namespace TNL
diff --git a/src/TNL/Pointers/UniquePointer.h b/src/TNL/Pointers/UniquePointer.h
index db367422e09e63eedc064650a0d520620e66439e..81513cf6864dde58737508cf954d643422b779d4 100644
--- a/src/TNL/Pointers/UniquePointer.h
+++ b/src/TNL/Pointers/UniquePointer.h
@@ -48,8 +48,7 @@ namespace Pointers {
  */
 template< typename Object, typename Device = typename Object::DeviceType >
 class UniquePointer
-{
-};
+{};
 
 /**
  * \brief Specialization of the \ref UniquePointer for the host system.
@@ -59,221 +58,226 @@ class UniquePointer
 template< typename Object >
 class UniquePointer< Object, Devices::Host > : public SmartPointer
 {
-   public:
-
-      /**
-       * \typedef ObjectType is the type of object owned by the pointer.
-       */
-      using ObjectType = Object;
-
-      /**
-       * \typedef DeviceType is the type of device where the object is to be
-       * mirrored.
-       */
-      using DeviceType = Devices::Host;
-
-      /**
-       * \brief Constructor of empty pointer.
-       */
-      UniquePointer( std::nullptr_t )
-      : pointer( nullptr )
-      {}
-
-      /**
-       * \brief Constructor with parameters of the Object constructor.
-       *
-       * \tparam Args is variadic template type of arguments of the Object constructor.
-       * \tparam args are arguments passed to the Object constructor.
-       */
-      template< typename... Args >
-      explicit  UniquePointer( const Args... args )
-      {
-         this->pointer = new Object( args... );
-      }
-
-      /**
-       * \brief Constructor with initializer list.
-       *
-       * \tparam Value is type of the initializer list elements.
-       * \param list is the instance of the initializer list..
-       */
-      template< typename Value >
-      explicit  UniquePointer( std::initializer_list< Value > list )
-      {
-         this->pointer = new Object( list );
-      }
-
-      /**
-       * \brief Constructor with nested initializer lists.
-       *
-       * \tparam Value is type of the nested initializer list elements.
-       * \param list is the instance of the nested initializer list..
-       */
-      template< typename Value >
-      explicit  UniquePointer( std::initializer_list< std::initializer_list< Value > > list )
-      {
-         this->pointer = new Object( list );
-      }
+public:
+   /**
+    * \typedef ObjectType is the type of object owned by the pointer.
+    */
+   using ObjectType = Object;
+
+   /**
+    * \typedef DeviceType is the type of device where the object is to be
+    * mirrored.
+    */
+   using DeviceType = Devices::Host;
+
+   /**
+    * \brief Constructor of empty pointer.
+    */
+   UniquePointer( std::nullptr_t ) : pointer( nullptr ) {}
+
+   /**
+    * \brief Constructor with parameters of the Object constructor.
+    *
+    * \tparam Args is variadic template type of arguments of the Object constructor.
+    * \tparam args are arguments passed to the Object constructor.
+    */
+   template< typename... Args >
+   explicit UniquePointer( const Args... args )
+   {
+      this->pointer = new Object( args... );
+   }
 
-      /**
-       * \brief Arrow operator for accessing the object owned by constant smart pointer.
-       *
-       * \return constant pointer to the object owned by this smart pointer.
-       */
-      const Object* operator->() const
-      {
-         TNL_ASSERT_TRUE( this->pointer, "Attempt to dereference a null pointer" );
-         return this->pointer;
-      }
+   /**
+    * \brief Constructor with initializer list.
+    *
+    * \tparam Value is type of the initializer list elements.
+    * \param list is the instance of the initializer list..
+    */
+   template< typename Value >
+   explicit UniquePointer( std::initializer_list< Value > list )
+   {
+      this->pointer = new Object( list );
+   }
 
-      /**
-       * \brief Arrow operator for accessing the object owned by non-constant smart pointer.
-       *
-       * \return pointer to the object owned by this smart pointer.
-       */
-      Object* operator->()
-      {
-         TNL_ASSERT_TRUE( this->pointer, "Attempt to dereference a null pointer" );
-         return this->pointer;
-      }
+   /**
+    * \brief Constructor with nested initializer lists.
+    *
+    * \tparam Value is type of the nested initializer list elements.
+    * \param list is the instance of the nested initializer list..
+    */
+   template< typename Value >
+   explicit UniquePointer( std::initializer_list< std::initializer_list< Value > > list )
+   {
+      this->pointer = new Object( list );
+   }
 
-      /**
-       * \brief Dereferencing operator for accessing the object owned by constant smart pointer.
-       *
-       * \return constant reference to the object owned by this smart pointer.
-       */
-      const Object& operator *() const
-      {
-         TNL_ASSERT_TRUE( this->pointer, "Attempt to dereference a null pointer" );
-         return *( this->pointer );
-      }
+   /**
+    * \brief Arrow operator for accessing the object owned by constant smart pointer.
+    *
+    * \return constant pointer to the object owned by this smart pointer.
+    */
+   const Object*
+   operator->() const
+   {
+      TNL_ASSERT_TRUE( this->pointer, "Attempt to dereference a null pointer" );
+      return this->pointer;
+   }
 
-      /**
-       * \brief Dereferencing operator for accessing the object owned by non-constant smart pointer.
-       *
-       * \return reference to the object owned by this smart pointer.
-       */
-      Object& operator *()
-      {
-         TNL_ASSERT_TRUE( this->pointer, "Attempt to dereference a null pointer" );
-         return *( this->pointer );
-      }
+   /**
+    * \brief Arrow operator for accessing the object owned by non-constant smart pointer.
+    *
+    * \return pointer to the object owned by this smart pointer.
+    */
+   Object*
+   operator->()
+   {
+      TNL_ASSERT_TRUE( this->pointer, "Attempt to dereference a null pointer" );
+      return this->pointer;
+   }
 
-      /**
-       * \brief Conversion to boolean type.
-       *
-       * \return Returns true if the pointer is not empty, false otherwise.
-       */
-      __cuda_callable__
-      operator bool() const
-      {
-         return this->pointer;
-      }
+   /**
+    * \brief Dereferencing operator for accessing the object owned by constant smart pointer.
+    *
+    * \return constant reference to the object owned by this smart pointer.
+    */
+   const Object&
+   operator*() const
+   {
+      TNL_ASSERT_TRUE( this->pointer, "Attempt to dereference a null pointer" );
+      return *( this->pointer );
+   }
 
-      /**
-       * \brief Negation operator.
-       *
-       * \return Returns false if the pointer is not empty, true otherwise.
-       */
-      __cuda_callable__
-      bool operator!() const
-      {
-         return ! this->pointer;
-      }
+   /**
+    * \brief Dereferencing operator for accessing the object owned by non-constant smart pointer.
+    *
+    * \return reference to the object owned by this smart pointer.
+    */
+   Object&
+   operator*()
+   {
+      TNL_ASSERT_TRUE( this->pointer, "Attempt to dereference a null pointer" );
+      return *( this->pointer );
+   }
 
-      /**
-       * \brief Constant object reference getter.
-       *
-       * No synchronization of this pointer will be performed due to calling
-       * this method.
-       *
-       * \tparam Device says what image of the object one want to dereference. It
-       * can be either \ref DeviceType or Devices::Host.
-       * \return constant reference to the object image on given device.
-       */
-      template< typename Device = Devices::Host >
-      const Object& getData() const
-      {
-         TNL_ASSERT_TRUE( this->pointer, "Attempt to dereference a null pointer" );
-         return *( this->pointer );
-      }
+   /**
+    * \brief Conversion to boolean type.
+    *
+    * \return Returns true if the pointer is not empty, false otherwise.
+    */
+   __cuda_callable__
+   operator bool() const
+   {
+      return this->pointer;
+   }
 
-      /**
-       * \brief Non-constant object reference getter.
-       *
-       * After calling this method, the object owned by the pointer might need
-       * to be synchronized. One should not forget to call
-       * \ref Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >()
-       * before calling CUDA kernel using object from this smart pointer.
-       *
-       * \tparam Device says what image of the object one want to dereference. It
-       * can be either \ref DeviceType or Devices::Host.
-       * \return constant reference to the object image on given device.
-       */
-      template< typename Device = Devices::Host >
-      Object& modifyData()
-      {
-         TNL_ASSERT_TRUE( this->pointer, "Attempt to dereference a null pointer" );
-         return *( this->pointer );
-      }
+   /**
+    * \brief Negation operator.
+    *
+    * \return Returns false if the pointer is not empty, true otherwise.
+    */
+   __cuda_callable__
+   bool
+   operator!() const
+   {
+      return ! this->pointer;
+   }
 
-      /**
-       * \brief Assignment operator.
-       *
-       * It assigns object owned by the pointer \ref ptr to \ref this pointer.
-       * The original pointer \ref ptr is reset to empty state.
-       *
-       * \param ptr input pointer
-       * \return constant reference to \ref this
-       */
-      const UniquePointer& operator=( UniquePointer& ptr )
-      {
-         if( this->pointer )
-            delete this->pointer;
-         this->pointer = ptr.pointer;
-         ptr.pointer = nullptr;
-         return *this;
-      }
+   /**
+    * \brief Constant object reference getter.
+    *
+    * No synchronization of this pointer will be performed due to calling
+    * this method.
+    *
+    * \tparam Device says what image of the object one want to dereference. It
+    * can be either \ref DeviceType or Devices::Host.
+    * \return constant reference to the object image on given device.
+    */
+   template< typename Device = Devices::Host >
+   const Object&
+   getData() const
+   {
+      TNL_ASSERT_TRUE( this->pointer, "Attempt to dereference a null pointer" );
+      return *( this->pointer );
+   }
 
-      /**
-       * \brief Move operator.
-       *
-       * It assigns object owned by the pointer \ref ptr to \ref this pointer.
-       * The original pointer \ref ptr is reset to empty state.
-       *
-       * \param ptr input pointer
-       * \return constant reference to \ref this
-       */
-      const UniquePointer& operator=( UniquePointer&& ptr )
-      {
-         return this->operator=( ptr );
-      }
+   /**
+    * \brief Non-constant object reference getter.
+    *
+    * After calling this method, the object owned by the pointer might need
+    * to be synchronized. One should not forget to call
+    * \ref Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >()
+    * before calling CUDA kernel using object from this smart pointer.
+    *
+    * \tparam Device says what image of the object one want to dereference. It
+    * can be either \ref DeviceType or Devices::Host.
+    * \return constant reference to the object image on given device.
+    */
+   template< typename Device = Devices::Host >
+   Object&
+   modifyData()
+   {
+      TNL_ASSERT_TRUE( this->pointer, "Attempt to dereference a null pointer" );
+      return *( this->pointer );
+   }
 
-      /**
-       * \brief Cross-device pointer synchronization.
-       *
-       * For the smart pointers in the host, this method does nothing.
-       *
-       * \return true.
-       */
-      bool synchronize()
-      {
-         return true;
-      }
+   /**
+    * \brief Assignment operator.
+    *
+    * It assigns object owned by the pointer \ref ptr to \ref this pointer.
+    * The original pointer \ref ptr is reset to empty state.
+    *
+    * \param ptr input pointer
+    * \return constant reference to \ref this
+    */
+   const UniquePointer&
+   operator=( UniquePointer& ptr )
+   {
+      if( this->pointer )
+         delete this->pointer;
+      this->pointer = ptr.pointer;
+      ptr.pointer = nullptr;
+      return *this;
+   }
 
-      /**
-       * \brief Destructor.
-       */
-      ~UniquePointer()
-      {
-         if( this->pointer )
-            delete this->pointer;
-      }
+   /**
+    * \brief Move operator.
+    *
+    * It assigns object owned by the pointer \ref ptr to \ref this pointer.
+    * The original pointer \ref ptr is reset to empty state.
+    *
+    * \param ptr input pointer
+    * \return constant reference to \ref this
+    */
+   const UniquePointer&
+   operator=( UniquePointer&& ptr ) noexcept
+   {
+      return this->operator=( ptr );
+   }
 
+   /**
+    * \brief Cross-device pointer synchronization.
+    *
+    * For the smart pointers in the host, this method does nothing.
+    *
+    * \return true.
+    */
+   bool
+   synchronize() override
+   {
+      return true;
+   }
 
-   protected:
+   /**
+    * \brief Destructor.
+    */
+   ~UniquePointer() override
+   {
+      if( this->pointer )
+         delete this->pointer;
+   }
 
-      Object* pointer;
+protected:
+   Object* pointer;
 };
 
 /**
@@ -284,318 +288,320 @@ class UniquePointer< Object, Devices::Host > : public SmartPointer
 template< typename Object >
 class UniquePointer< Object, Devices::Cuda > : public SmartPointer
 {
-   public:
-
-      /**
-       * \typedef ObjectType is the type of object owned by the pointer.
-       */
-      using ObjectType = Object;
-
-      /**
-       * \typedef DeviceType is the type of device where the object is to be
-       * mirrored.
-       */
-      using DeviceType = Devices::Cuda;
-
-      /**
-       * \typedef AllocatorType is the type of the allocator for \e DeviceType.
-       */
-      using AllocatorType = typename Allocators::Default< DeviceType >::Allocator< ObjectType >;
-
-      /**
-       * \brief Constructor of empty pointer.
-       */
-      UniquePointer( std::nullptr_t )
-      : pd( nullptr ),
-        cuda_pointer( nullptr )
-      {}
-
-      /**
-       * \brief Constructor with parameters of the Object constructor.
-       *
-       * \tparam Args is variadic template type of arguments of the Object constructor.
-       * \tparam args are arguments passed to the Object constructor.
-       */
-      template< typename... Args >
-      explicit  UniquePointer( const Args... args )
-      : pd( nullptr ),
-        cuda_pointer( nullptr )
-      {
-         this->allocate( args... );
-      }
+public:
+   /**
+    * \typedef ObjectType is the type of object owned by the pointer.
+    */
+   using ObjectType = Object;
+
+   /**
+    * \typedef DeviceType is the type of device where the object is to be
+    * mirrored.
+    */
+   using DeviceType = Devices::Cuda;
+
+   /**
+    * \typedef AllocatorType is the type of the allocator for \e DeviceType.
+    */
+   using AllocatorType = typename Allocators::Default< DeviceType >::Allocator< ObjectType >;
+
+   /**
+    * \brief Constructor of empty pointer.
+    */
+   UniquePointer( std::nullptr_t ) : pd( nullptr ), cuda_pointer( nullptr ) {}
+
+   /**
+    * \brief Constructor with parameters of the Object constructor.
+    *
+    * \tparam Args is variadic template type of arguments of the Object constructor.
+    * \tparam args are arguments passed to the Object constructor.
+    */
+   template< typename... Args >
+   explicit UniquePointer( const Args... args ) : pd( nullptr ), cuda_pointer( nullptr )
+   {
+      this->allocate( args... );
+   }
 
-      /**
-       * \brief Constructor with initializer list.
-       *
-       * \tparam Value is type of the initializer list elements.
-       * \param list is the instance of the initializer list..
-       */
-      template< typename Value >
-      explicit  UniquePointer( std::initializer_list< Value > list )
-      : pd( nullptr ),
-        cuda_pointer( nullptr )
-      {
-         this->allocate( list );
-      }
+   /**
+    * \brief Constructor with initializer list.
+    *
+    * \tparam Value is type of the initializer list elements.
+    * \param list is the instance of the initializer list..
+    */
+   template< typename Value >
+   explicit UniquePointer( std::initializer_list< Value > list ) : pd( nullptr ), cuda_pointer( nullptr )
+   {
+      this->allocate( list );
+   }
 
-      /**
-       * \brief Constructor with nested initializer lists.
-       *
-       * \tparam Value is type of the nested initializer list elements.
-       * \param list is the instance of the nested initializer list..
-       */
-      template< typename Value >
-      explicit  UniquePointer( std::initializer_list< std::initializer_list< Value > > list )
-      : pd( nullptr ),
-        cuda_pointer( nullptr )
-      {
-         this->allocate( list );
-      }
+   /**
+    * \brief Constructor with nested initializer lists.
+    *
+    * \tparam Value is type of the nested initializer list elements.
+    * \param list is the instance of the nested initializer list..
+    */
+   template< typename Value >
+   explicit UniquePointer( std::initializer_list< std::initializer_list< Value > > list )
+   : pd( nullptr ), cuda_pointer( nullptr )
+   {
+      this->allocate( list );
+   }
 
-      /**
-       * \brief Arrow operator for accessing the object owned by constant smart pointer.
-       *
-       * \return constant pointer to the object owned by this smart pointer.
-       */
-      const Object* operator->() const
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         return &this->pd->data;
-      }
+   /**
+    * \brief Arrow operator for accessing the object owned by constant smart pointer.
+    *
+    * \return constant pointer to the object owned by this smart pointer.
+    */
+   const Object*
+   operator->() const
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      return &this->pd->data;
+   }
 
-      /**
-       * \brief Arrow operator for accessing the object owned by non-constant smart pointer.
-       *
-       * \return pointer to the object owned by this smart pointer.
-       */
-      Object* operator->()
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         this->pd->maybe_modified = true;
-         return &this->pd->data;
-      }
+   /**
+    * \brief Arrow operator for accessing the object owned by non-constant smart pointer.
+    *
+    * \return pointer to the object owned by this smart pointer.
+    */
+   Object*
+   operator->()
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      this->pd->maybe_modified = true;
+      return &this->pd->data;
+   }
 
-      /**
-       * \brief Dereferencing operator for accessing the object owned by constant smart pointer.
-       *
-       * \return constant reference to the object owned by this smart pointer.
-       */
-      const Object& operator *() const
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         return this->pd->data;
-      }
+   /**
+    * \brief Dereferencing operator for accessing the object owned by constant smart pointer.
+    *
+    * \return constant reference to the object owned by this smart pointer.
+    */
+   const Object&
+   operator*() const
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      return this->pd->data;
+   }
 
-      /**
-       * \brief Dereferencing operator for accessing the object owned by non-constant smart pointer.
-       *
-       * \return reference to the object owned by this smart pointer.
-       */
-      Object& operator *()
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         this->pd->maybe_modified = true;
-         return this->pd->data;
-      }
+   /**
+    * \brief Dereferencing operator for accessing the object owned by non-constant smart pointer.
+    *
+    * \return reference to the object owned by this smart pointer.
+    */
+   Object&
+   operator*()
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      this->pd->maybe_modified = true;
+      return this->pd->data;
+   }
 
-      /**
-       * \brief Conversion to boolean type.
-       *
-       * \return Returns true if the pointer is not empty, false otherwise.
-       */
-      __cuda_callable__
-      operator bool() const
-      {
-         return this->pd;
-      }
+   /**
+    * \brief Conversion to boolean type.
+    *
+    * \return Returns true if the pointer is not empty, false otherwise.
+    */
+   __cuda_callable__
+   operator bool() const
+   {
+      return this->pd;
+   }
 
-      /**
-       * \brief Negation operator.
-       *
-       * \return Returns false if the pointer is not empty, true otherwise.
-       */
-      __cuda_callable__
-      bool operator!() const
-      {
-         return ! this->pd;
-      }
+   /**
+    * \brief Negation operator.
+    *
+    * \return Returns false if the pointer is not empty, true otherwise.
+    */
+   __cuda_callable__
+   bool
+   operator!() const
+   {
+      return ! this->pd;
+   }
 
-      /**
-       * \brief Constant object reference getter.
-       *
-       * No synchronization of this pointer will be performed due to calling
-       * this method.
-       *
-       * \tparam Device says what image of the object one want to dereference. It
-       * can be either \ref DeviceType or Devices::Host.
-       * \return constant reference to the object image on given device.
-       */
-      template< typename Device = Devices::Host >
-      const Object& getData() const
-      {
-         static_assert( std::is_same< Device, Devices::Host >::value || std::is_same< Device, Devices::Cuda >::value, "Only Devices::Host or Devices::Cuda devices are accepted here." );
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         TNL_ASSERT_TRUE( this->cuda_pointer, "Attempt to dereference a null pointer" );
-         if( std::is_same< Device, Devices::Host >::value )
-            return this->pd->data;
-         if( std::is_same< Device, Devices::Cuda >::value )
-            return *( this->cuda_pointer );
-      }
+   /**
+    * \brief Constant object reference getter.
+    *
+    * No synchronization of this pointer will be performed due to calling
+    * this method.
+    *
+    * \tparam Device says what image of the object one want to dereference. It
+    * can be either \ref DeviceType or Devices::Host.
+    * \return constant reference to the object image on given device.
+    */
+   template< typename Device = Devices::Host >
+   const Object&
+   getData() const
+   {
+      static_assert( std::is_same< Device, Devices::Host >::value || std::is_same< Device, Devices::Cuda >::value,
+                     "Only Devices::Host or Devices::Cuda devices are accepted here." );
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      TNL_ASSERT_TRUE( this->cuda_pointer, "Attempt to dereference a null pointer" );
+      if( std::is_same< Device, Devices::Host >::value )
+         return this->pd->data;
+      if( std::is_same< Device, Devices::Cuda >::value )
+         return *( this->cuda_pointer );
+   }
 
-      /**
-       * \brief Non-constant object reference getter.
-       *
-       * After calling this method, the object owned by the pointer might need
-       * to be synchronized. One should not forget to call
-       * \ref Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >()
-       * before calling CUDA kernel using object from this smart pointer.
-       *
-       * \tparam Device says what image of the object one want to dereference. It
-       * can be either \ref DeviceType or Devices::Host.
-       * \return constant reference to the object image on given device.
-       */
-      template< typename Device = Devices::Host >
-      Object& modifyData()
-      {
-         static_assert( std::is_same< Device, Devices::Host >::value || std::is_same< Device, Devices::Cuda >::value, "Only Devices::Host or Devices::Cuda devices are accepted here." );
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         TNL_ASSERT_TRUE( this->cuda_pointer, "Attempt to dereference a null pointer" );
-         if( std::is_same< Device, Devices::Host >::value )
-         {
-            this->pd->maybe_modified = true;
-            return this->pd->data;
-         }
-         if( std::is_same< Device, Devices::Cuda >::value )
-            return *( this->cuda_pointer );
+   /**
+    * \brief Non-constant object reference getter.
+    *
+    * After calling this method, the object owned by the pointer might need
+    * to be synchronized. One should not forget to call
+    * \ref Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >()
+    * before calling CUDA kernel using object from this smart pointer.
+    *
+    * \tparam Device says what image of the object one want to dereference. It
+    * can be either \ref DeviceType or Devices::Host.
+    * \return constant reference to the object image on given device.
+    */
+   template< typename Device = Devices::Host >
+   Object&
+   modifyData()
+   {
+      static_assert( std::is_same< Device, Devices::Host >::value || std::is_same< Device, Devices::Cuda >::value,
+                     "Only Devices::Host or Devices::Cuda devices are accepted here." );
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      TNL_ASSERT_TRUE( this->cuda_pointer, "Attempt to dereference a null pointer" );
+      if( std::is_same< Device, Devices::Host >::value ) {
+         this->pd->maybe_modified = true;
+         return this->pd->data;
       }
+      if( std::is_same< Device, Devices::Cuda >::value )
+         return *( this->cuda_pointer );
+   }
 
-      /**
-       * \brief Assignment operator.
-       *
-       * It assigns object owned by the pointer \ref ptr to \ref this pointer.
-       * The original pointer \ref ptr is reset to empty state.
-       *
-       * \param ptr input pointer
-       * \return constant reference to \ref this
-       */
-      const UniquePointer& operator=( UniquePointer& ptr )
-      {
-         this->free();
-         this->pd = ptr.pd;
-         this->cuda_pointer = ptr.cuda_pointer;
-         ptr.pd = nullptr;
-         ptr.cuda_pointer = nullptr;
-         return *this;
-      }
+   /**
+    * \brief Assignment operator.
+    *
+    * It assigns object owned by the pointer \ref ptr to \ref this pointer.
+    * The original pointer \ref ptr is reset to empty state.
+    *
+    * \param ptr input pointer
+    * \return constant reference to \ref this
+    */
+   const UniquePointer&
+   operator=( UniquePointer& ptr )
+   {
+      this->free();
+      this->pd = ptr.pd;
+      this->cuda_pointer = ptr.cuda_pointer;
+      ptr.pd = nullptr;
+      ptr.cuda_pointer = nullptr;
+      return *this;
+   }
 
-      /**
-       * \brief Move operator.
-       *
-       * It assigns object owned by the pointer \ref ptr to \ref this pointer.
-       * The original pointer \ref ptr is reset to empty state.
-       *
-       * \param ptr input pointer
-       * \return constant reference to \ref this
-       */
-      const UniquePointer& operator=( UniquePointer&& ptr )
-      {
-         return this->operator=( ptr );
-      }
+   /**
+    * \brief Move operator.
+    *
+    * It assigns object owned by the pointer \ref ptr to \ref this pointer.
+    * The original pointer \ref ptr is reset to empty state.
+    *
+    * \param ptr input pointer
+    * \return constant reference to \ref this
+    */
+   const UniquePointer&
+   operator=( UniquePointer&& ptr ) noexcept
+   {
+      return this->operator=( ptr );
+   }
 
-      /**
-       * \brief Cross-device pointer synchronization.
-       *
-       * This method is usually called by the smart pointers register when calling
-       * \ref Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >()
-       *
-       * \return true if the synchronization was successful, false otherwise.
-       */
-      bool synchronize()
-      {
-         if( ! this->pd )
-            return true;
+   /**
+    * \brief Cross-device pointer synchronization.
+    *
+    * This method is usually called by the smart pointers register when calling
+    * \ref Pointers::synchronizeSmartPointersOnDevice< Devices::Cuda >()
+    *
+    * \return true if the synchronization was successful, false otherwise.
+    */
+   bool
+   synchronize() override
+   {
+      if( ! this->pd )
+         return true;
 #ifdef HAVE_CUDA
-         if( this->modified() )
-         {
-            cudaMemcpy( (void*) this->cuda_pointer, (void*) &this->pd->data, sizeof( Object ), cudaMemcpyHostToDevice );
-            TNL_CHECK_CUDA_DEVICE;
-            this->set_last_sync_state();
-            return true;
-         }
+      if( this->modified() ) {
+         cudaMemcpy( (void*) this->cuda_pointer, (void*) &this->pd->data, sizeof( Object ), cudaMemcpyHostToDevice );
+         TNL_CHECK_CUDA_DEVICE;
+         this->set_last_sync_state();
          return true;
+      }
+      return true;
 #else
-         return false;
+      return false;
 #endif
-      }
-
-      /**
-       * \brief Destructor.
-       */
-      ~UniquePointer()
-      {
-         this->free();
-         getSmartPointersRegister< DeviceType >().remove( this );
-      }
-
-   protected:
+   }
 
-      struct PointerData
-      {
-         Object data;
-         char data_image[ sizeof(Object) ];
-         bool maybe_modified;
+   /**
+    * \brief Destructor.
+    */
+   ~UniquePointer() override
+   {
+      this->free();
+      getSmartPointersRegister< DeviceType >().remove( this );
+   }
 
-         template< typename... Args >
-         explicit PointerData( Args... args )
-         : data( args... ),
-           maybe_modified( true )
-         {}
-      };
+protected:
+   struct PointerData
+   {
+      Object data;
+      char data_image[ sizeof( Object ) ];
+      bool maybe_modified = true;
 
       template< typename... Args >
-      bool allocate( Args... args )
-      {
-         this->pd = new PointerData( args... );
-         // allocate on device
-         this->cuda_pointer = AllocatorType{}.allocate(1);
-         // synchronize
-         this->synchronize();
-         getSmartPointersRegister< DeviceType >().insert( this );
-         return true;
-      }
+      explicit PointerData( Args... args ) : data( args... )
+      {}
+   };
 
-      void set_last_sync_state()
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         std::memcpy( (void*) &this->pd->data_image, (void*) &this->pd->data, sizeof( ObjectType ) );
-         this->pd->maybe_modified = false;
-      }
+   template< typename... Args >
+   bool
+   allocate( Args... args )
+   {
+      this->pd = new PointerData( args... );
+      // allocate on device
+      this->cuda_pointer = AllocatorType{}.allocate( 1 );
+      // synchronize
+      this->synchronize();
+      getSmartPointersRegister< DeviceType >().insert( this );
+      return true;
+   }
 
-      bool modified()
-      {
-         TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
-         // optimization: skip bitwise comparison if we're sure that the data is the same
-         if( ! this->pd->maybe_modified )
-            return false;
-         return std::memcmp( (void*) &this->pd->data_image, (void*) &this->pd->data, sizeof( ObjectType ) ) != 0;
-      }
+   void
+   set_last_sync_state()
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      std::memcpy( (void*) &this->pd->data_image, (void*) &this->pd->data, sizeof( ObjectType ) );
+      this->pd->maybe_modified = false;
+   }
 
-      void free()
-      {
-         if( this->pd )
-            delete this->pd;
-         if( this->cuda_pointer )
-            AllocatorType{}.deallocate( this->cuda_pointer, 1 );
-      }
+   bool
+   modified()
+   {
+      TNL_ASSERT_TRUE( this->pd, "Attempt to dereference a null pointer" );
+      // optimization: skip bitwise comparison if we're sure that the data is the same
+      if( ! this->pd->maybe_modified )
+         return false;
+      return std::memcmp( (void*) &this->pd->data_image, (void*) &this->pd->data, sizeof( ObjectType ) ) != 0;
+   }
+
+   void
+   free()
+   {
+      if( this->pd )
+         delete this->pd;
+      if( this->cuda_pointer )
+         AllocatorType{}.deallocate( this->cuda_pointer, 1 );
+   }
 
-      PointerData* pd;
+   PointerData* pd;
 
-      // cuda_pointer can't be part of PointerData structure, since we would be
-      // unable to dereference this-pd on the device
-      Object* cuda_pointer;
+   // cuda_pointer can't be part of PointerData structure, since we would be
+   // unable to dereference this-pd on the device
+   Object* cuda_pointer;
 };
 
-} // namespace Pointers
+}  // namespace Pointers
 
 #ifndef NDEBUG
 namespace Assert {
@@ -607,13 +613,12 @@ struct Formatter< Pointers::UniquePointer< Object, Device > >
    printToString( const Pointers::UniquePointer< Object, Device >& value )
    {
       ::std::stringstream ss;
-      ss << "(" + getType< Pointers::UniquePointer< Object, Device > >()
-         << " > object at " << &value << ")";
+      ss << "(" + getType< Pointers::UniquePointer< Object, Device > >() << " > object at " << &value << ")";
       return ss.str();
    }
 };
 
-} // namespace Assert
+}  // namespace Assert
 #endif
 
-} // namespace TNL
+}  // namespace TNL
diff --git a/src/TNL/Problems/CommonData.h b/src/TNL/Problems/CommonData.h
index b0bf9d970998e05e035d32c2ee1c6d27c6f594bf..765c5ff4e2bf11fca5588488efc56a7a88feecb8 100644
--- a/src/TNL/Problems/CommonData.h
+++ b/src/TNL/Problems/CommonData.h
@@ -15,13 +15,13 @@ namespace Problems {
 
 class CommonData
 {
-   public:
-   
-      bool setup( const Config::ParameterContainer& parameters )
-      {
-         return true;
-      }
+public:
+   bool
+   setup( const Config::ParameterContainer& parameters )
+   {
+      return true;
+   }
 };
 
-} // namespace Problems
-} // namespace TNL
+}  // namespace Problems
+}  // namespace TNL
diff --git a/src/TNL/Problems/HeatEquationEocProblem.h b/src/TNL/Problems/HeatEquationEocProblem.h
index 6d739bc214e00674ea92fbbd5b1faaaad86b93aa..94e0481b24c6393ca0fc96558dec6eed1bb72f7f 100644
--- a/src/TNL/Problems/HeatEquationEocProblem.h
+++ b/src/TNL/Problems/HeatEquationEocProblem.h
@@ -10,7 +10,6 @@
  * Szekely Ondrej, ondra.szekely@gmail.com
  */
 
-
 #pragma once
 
 #include <TNL/Problems/HeatEquationProblem.h>
@@ -21,21 +20,19 @@ namespace Problems {
 template< typename Mesh,
           typename BoundaryCondition,
           typename RightHandSide,
-          typename DifferentialOperator = Operators::LinearDiffusion< Mesh,
-                                                              typename BoundaryCondition::RealType > >
+          typename DifferentialOperator = Operators::LinearDiffusion< Mesh, typename BoundaryCondition::RealType > >
 class HeatEquationEocProblem : public HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >
 {
-   public:
-
-      typedef HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator > BaseType;
+public:
+   typedef HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator > BaseType;
 
-      using typename BaseType::MeshPointer;
+   using typename BaseType::MeshPointer;
 
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix );
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix );
 };
 
-} // namespace Problems
-} // namespace TNL
+}  // namespace Problems
+}  // namespace TNL
 
 #include <TNL/Problems/HeatEquationEocProblem_impl.h>
diff --git a/src/TNL/Problems/HeatEquationEocProblem_impl.h b/src/TNL/Problems/HeatEquationEocProblem_impl.h
index fc2e2ea3aa9b6ed88e523ca00aa6c29046a2eb9f..54f190cdf56a89a45de0e9ad217c83af52f9f424 100644
--- a/src/TNL/Problems/HeatEquationEocProblem_impl.h
+++ b/src/TNL/Problems/HeatEquationEocProblem_impl.h
@@ -10,7 +10,6 @@
  * Szekely Ondrej, ondra.szekely@gmail.com
  */
 
-
 #pragma once
 
 #include "HeatEquationEocProblem.h"
@@ -18,17 +17,14 @@
 namespace TNL {
 namespace Problems {
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
 bool
-HeatEquationEocProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator  >::
-setup( const Config::ParameterContainer& parameters,
-       const String& prefix )
+HeatEquationEocProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::setup(
+   const Config::ParameterContainer& parameters,
+   const String& prefix )
 {
-   if( ! this->boundaryConditionPointer->setup( this->getMesh(), parameters, prefix ) ||
-       ! this->rightHandSidePointer->setup( parameters ) )
+   if( ! this->boundaryConditionPointer->setup( this->getMesh(), parameters, prefix )
+       || ! this->rightHandSidePointer->setup( parameters ) )
       return false;
    this->explicitUpdater.setDifferentialOperator( this->differentialOperatorPointer );
    this->explicitUpdater.setBoundaryConditions( this->boundaryConditionPointer );
@@ -39,5 +35,5 @@ setup( const Config::ParameterContainer& parameters,
    return true;
 }
 
-} // namespace Problems
-} // namespace TNL
+}  // namespace Problems
+}  // namespace TNL
diff --git a/src/TNL/Problems/HeatEquationEocRhs.h b/src/TNL/Problems/HeatEquationEocRhs.h
index d05d0081d746ec5b25276bb6fc00d75b776aae8d..6dc23e1d78f778fa4a981223389e971034e6af5a 100644
--- a/src/TNL/Problems/HeatEquationEocRhs.h
+++ b/src/TNL/Problems/HeatEquationEocRhs.h
@@ -17,39 +17,35 @@
 namespace TNL {
 namespace Problems {
 
-template< typename ExactOperator,
-          typename TestFunction >
-class HeatEquationEocRhs
- : public Functions::Domain< TestFunction::Dimension, Functions::SpaceDomain >
+template< typename ExactOperator, typename TestFunction >
+class HeatEquationEocRhs : public Functions::Domain< TestFunction::Dimension, Functions::SpaceDomain >
 {
-   public:
-
-      typedef ExactOperator ExactOperatorType;
-      typedef TestFunction TestFunctionType;
-      typedef typename TestFunction::RealType RealType;
-      typedef typename TestFunction::PointType PointType;
-
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" )
-      {
-         if( ! testFunction.setup( parameters, prefix ) )
-            return false;
-         return true;
-      }
-
-      __cuda_callable__
-      RealType operator()( const PointType& vertex,
-                         const RealType& time = 0.0 ) const
-      {
-         return testFunction.getTimeDerivative( vertex, time )
-                - exactOperator( testFunction, vertex, time );
-      }
-
-   protected:
-      ExactOperator exactOperator;
-
-      TestFunction testFunction;
+public:
+   typedef ExactOperator ExactOperatorType;
+   typedef TestFunction TestFunctionType;
+   typedef typename TestFunction::RealType RealType;
+   typedef typename TestFunction::PointType PointType;
+
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" )
+   {
+      if( ! testFunction.setup( parameters, prefix ) )
+         return false;
+      return true;
+   }
+
+   __cuda_callable__
+   RealType
+   operator()( const PointType& vertex, const RealType& time = 0.0 ) const
+   {
+      return testFunction.getTimeDerivative( vertex, time ) - exactOperator( testFunction, vertex, time );
+   }
+
+protected:
+   ExactOperator exactOperator;
+
+   TestFunction testFunction;
 };
 
-} // namespace Problems
-} // namespace TNL
+}  // namespace Problems
+}  // namespace TNL
diff --git a/src/TNL/Problems/HeatEquationProblem.h b/src/TNL/Problems/HeatEquationProblem.h
index 80ac19a745c0f07caafa6508e49f7cda6b7c58ef..237c47907537cde0e59e6b15aa744897b2679484 100644
--- a/src/TNL/Problems/HeatEquationProblem.h
+++ b/src/TNL/Problems/HeatEquationProblem.h
@@ -28,101 +28,101 @@ namespace Problems {
 template< typename Mesh,
           typename BoundaryCondition,
           typename RightHandSide,
-          typename DifferentialOperator = Operators::LinearDiffusion< Mesh,
-                                                              typename BoundaryCondition::RealType > >
-class HeatEquationProblem : public PDEProblem< Mesh,
-                                               typename Mesh::RealType,
-                                               typename Mesh::DeviceType,
-                                               typename Mesh::IndexType  >
+          typename DifferentialOperator = Operators::LinearDiffusion< Mesh, typename BoundaryCondition::RealType > >
+class HeatEquationProblem
+: public PDEProblem< Mesh, typename Mesh::RealType, typename Mesh::DeviceType, typename Mesh::IndexType >
 {
-   public:
+public:
+   typedef typename Mesh::RealType RealType;
+   typedef typename Mesh::DeviceType DeviceType;
+   typedef typename Mesh::IndexType IndexType;
+   typedef Functions::MeshFunctionView< Mesh > MeshFunctionType;
+   typedef Pointers::SharedPointer< MeshFunctionType, DeviceType > MeshFunctionPointer;
+   typedef PDEProblem< Mesh, RealType, DeviceType, IndexType > BaseType;
+   typedef Pointers::SharedPointer< DifferentialOperator > DifferentialOperatorPointer;
+   typedef Pointers::SharedPointer< BoundaryCondition > BoundaryConditionPointer;
+   typedef Pointers::SharedPointer< RightHandSide, DeviceType > RightHandSidePointer;
 
-      typedef typename Mesh::RealType RealType;
-      typedef typename Mesh::DeviceType DeviceType;
-      typedef typename Mesh::IndexType IndexType;
-      typedef Functions::MeshFunctionView< Mesh > MeshFunctionType;
-      typedef Pointers::SharedPointer< MeshFunctionType, DeviceType > MeshFunctionPointer;
-      typedef PDEProblem< Mesh, RealType, DeviceType, IndexType > BaseType;
-      typedef Pointers::SharedPointer<  DifferentialOperator > DifferentialOperatorPointer;
-      typedef Pointers::SharedPointer<  BoundaryCondition > BoundaryConditionPointer;
-      typedef Pointers::SharedPointer<  RightHandSide, DeviceType > RightHandSidePointer;
+   using typename BaseType::DofVectorPointer;
+   using typename BaseType::DofVectorType;
+   using typename BaseType::MatrixType;
+   using typename BaseType::MeshPointer;
+   using typename BaseType::MeshType;
 
-      using typename BaseType::MeshType;
-      using typename BaseType::MeshPointer;
-      using typename BaseType::DofVectorType;
-      using typename BaseType::DofVectorPointer;
-      using typename BaseType::MatrixType;
+   String
+   getPrologHeader() const;
 
-      String getPrologHeader() const;
+   void
+   writeProlog( Logger& logger, const Config::ParameterContainer& parameters ) const;
 
-      void writeProlog( Logger& logger,
-                        const Config::ParameterContainer& parameters ) const;
+   bool
+   writeEpilog( Logger& logger );
 
-      bool writeEpilog( Logger& logger );
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix );
 
+   bool
+   setInitialCondition( const Config::ParameterContainer& parameters, DofVectorPointer& dofs );
 
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix );
+   template< typename MatrixPointer >
+   bool
+   setupLinearSystem( MatrixPointer& matrixPointer );
 
-      bool setInitialCondition( const Config::ParameterContainer& parameters,
-                                DofVectorPointer& dofs );
+   bool
+   makeSnapshot( const RealType& time, const IndexType& step, DofVectorPointer& dofs );
 
-      template< typename MatrixPointer >
-      bool setupLinearSystem( MatrixPointer& matrixPointer );
+   IndexType
+   getDofs() const;
 
-      bool makeSnapshot( const RealType& time,
-                         const IndexType& step,
-                         DofVectorPointer& dofs );
+   void
+   bindDofs( DofVectorPointer& dofs );
 
-      IndexType getDofs() const;
+   void
+   getExplicitUpdate( const RealType& time, const RealType& tau, DofVectorPointer& _u, DofVectorPointer& _fu );
 
-      void bindDofs( DofVectorPointer& dofs );
+   void
+   applyBoundaryConditions( const RealType& time, DofVectorPointer& dofs );
 
-      void getExplicitUpdate( const RealType& time,
-                              const RealType& tau,
-                              DofVectorPointer& _u,
-                              DofVectorPointer& _fu );
+   template< typename MatrixPointer >
+   void
+   assemblyLinearSystem( const RealType& time,
+                         const RealType& tau,
+                         DofVectorPointer& dofsPointer,
+                         MatrixPointer& matrixPointer,
+                         DofVectorPointer& rightHandSidePointer );
 
-      void applyBoundaryConditions( const RealType& time,
-                                    DofVectorPointer& dofs );
+protected:
+   using DistributedMeshSynchronizerType = Meshes::DistributedMeshes::DistributedMeshSynchronizer<
+      Meshes::DistributedMeshes::DistributedMesh< typename MeshFunctionType::MeshType > >;
+   DistributedMeshSynchronizerType synchronizer;
 
-      template< typename MatrixPointer >
-      void assemblyLinearSystem( const RealType& time,
-                                 const RealType& tau,
-                                 DofVectorPointer& dofsPointer,
-                                 MatrixPointer& matrixPointer,
-                                 DofVectorPointer& rightHandSidePointer );
+   MeshFunctionPointer uPointer;
+   MeshFunctionPointer fuPointer;
 
-   protected:
+   DifferentialOperatorPointer differentialOperatorPointer;
 
-      using DistributedMeshSynchronizerType = Meshes::DistributedMeshes::DistributedMeshSynchronizer< Meshes::DistributedMeshes::DistributedMesh< typename MeshFunctionType::MeshType > >;
-      DistributedMeshSynchronizerType synchronizer;
+   BoundaryConditionPointer boundaryConditionPointer;
 
-      MeshFunctionPointer uPointer;
-      MeshFunctionPointer fuPointer;
+   RightHandSidePointer rightHandSidePointer;
 
-      DifferentialOperatorPointer differentialOperatorPointer;
+   Timer gpuTransferTimer;
 
-      BoundaryConditionPointer boundaryConditionPointer;
+   Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, DifferentialOperator, BoundaryCondition, RightHandSide >
+      explicitUpdater;
 
-      RightHandSidePointer rightHandSidePointer;
+   Solvers::PDE::LinearSystemAssembler< Mesh,
+                                        MeshFunctionType,
+                                        DifferentialOperator,
+                                        BoundaryCondition,
+                                        RightHandSide,
+                                        Solvers::PDE::BackwardTimeDiscretisation,
+                                        DofVectorType >
+      systemAssembler;
 
-      Timer gpuTransferTimer;
-
-      Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, DifferentialOperator, BoundaryCondition, RightHandSide > explicitUpdater;
-
-      Solvers::PDE::LinearSystemAssembler< Mesh,
-                                           MeshFunctionType,
-                                           DifferentialOperator,
-                                           BoundaryCondition,
-                                           RightHandSide,
-                                           Solvers::PDE::BackwardTimeDiscretisation,
-                                           DofVectorType > systemAssembler;
-
-     bool catchExceptions = true;
+   bool catchExceptions = true;
 };
 
-} // namespace Problems
-} // namespace TNL
+}  // namespace Problems
+}  // namespace TNL
 
 #include <TNL/Problems/HeatEquationProblem_impl.h>
diff --git a/src/TNL/Problems/HeatEquationProblem_impl.h b/src/TNL/Problems/HeatEquationProblem_impl.h
index 7c0c234e5a68b43e2597add7058bb8e4d85d91f5..b91131c8e64ecfd13eb552c3a7272b2ad80f6cdc 100644
--- a/src/TNL/Problems/HeatEquationProblem_impl.h
+++ b/src/TNL/Problems/HeatEquationProblem_impl.h
@@ -23,54 +23,38 @@
 namespace TNL {
 namespace Problems {
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
 String
-HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
-getPrologHeader() const
+HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::getPrologHeader() const
 {
    return String( "Heat equation" );
 }
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
 void
-HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
-writeProlog( Logger& logger, const Config::ParameterContainer& parameters ) const
-{
-}
+HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::writeProlog(
+   Logger& logger,
+   const Config::ParameterContainer& parameters ) const
+{}
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
 bool
-HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
-writeEpilog( Logger& logger )
+HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::writeEpilog( Logger& logger )
 {
    return true;
 }
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
 bool
-HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
-setup( const Config::ParameterContainer& parameters,
-       const String& prefix )
+HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::setup(
+   const Config::ParameterContainer& parameters,
+   const String& prefix )
 {
-   if( ! this->boundaryConditionPointer->setup( this->getMesh(), parameters, "boundary-conditions-" ) )
-   {
+   if( ! this->boundaryConditionPointer->setup( this->getMesh(), parameters, "boundary-conditions-" ) ) {
       std::cerr << "I was not able to initialize the boundary conditions." << std::endl;
       return false;
    }
-   if( ! this->rightHandSidePointer->setup( parameters, "right-hand-side-" ) )
-   {
+   if( ! this->rightHandSidePointer->setup( parameters, "right-hand-side-" ) ) {
       std::cerr << "I was not able to initialize the right-hand side function." << std::endl;
       return false;
    }
@@ -86,13 +70,9 @@ setup( const Config::ParameterContainer& parameters,
    return true;
 }
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
 typename HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::IndexType
-HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
-getDofs() const
+HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::getDofs() const
 {
    /****
     * Set-up DOFs and supporting grid functions
@@ -100,43 +80,33 @@ getDofs() const
    return this->getMesh()->template getEntitiesCount< typename MeshType::Cell >();
 }
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
 void
-HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
-bindDofs( DofVectorPointer& dofVector )
+HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::bindDofs( DofVectorPointer& dofVector )
 {
    this->uPointer->bind( this->getMesh(), *dofVector );
 }
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
 bool
-HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
-setInitialCondition( const Config::ParameterContainer& parameters,
-                     DofVectorPointer& dofs )
+HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::setInitialCondition(
+   const Config::ParameterContainer& parameters,
+   DofVectorPointer& dofs )
 {
    this->bindDofs( dofs );
    const String& initialConditionFile = parameters.getParameter< String >( "initial-condition" );
-   if( MPI::GetSize() > 1 )
-   {
-      std::cout<<"Nodes Distribution: " << this->distributedMeshPointer->printProcessDistr() << std::endl;
-      if( ! Functions::readDistributedMeshFunction( *this->distributedMeshPointer, *this->uPointer, "u", initialConditionFile ) )
-      {
+   if( MPI::GetSize() > 1 ) {
+      std::cout << "Nodes Distribution: " << this->distributedMeshPointer->printProcessDistr() << std::endl;
+      if( ! Functions::readDistributedMeshFunction(
+             *this->distributedMeshPointer, *this->uPointer, "u", initialConditionFile ) ) {
          std::cerr << "I am not able to load the initial condition from the file " << initialConditionFile << "." << std::endl;
          return false;
       }
       synchronizer.setDistributedGrid( &this->distributedMeshPointer.getData() );
       synchronizer.synchronize( *uPointer );
    }
-   else
-   {
-      if( ! Functions::readMeshFunction( *this->uPointer, "u", initialConditionFile ) )
-      {
+   else {
+      if( ! Functions::readMeshFunction( *this->uPointer, "u", initialConditionFile ) ) {
          std::cerr << "I am not able to load the initial condition from the file " << initialConditionFile << "." << std::endl;
          return false;
       }
@@ -144,39 +114,29 @@ setInitialCondition( const Config::ParameterContainer& parameters,
    return true;
 }
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
-   template< typename MatrixPointer >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
+template< typename MatrixPointer >
 bool
-HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
-setupLinearSystem( MatrixPointer& matrixPointer )
+HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::setupLinearSystem(
+   MatrixPointer& matrixPointer )
 {
    const IndexType dofs = this->getDofs();
    typedef typename MatrixPointer::element_type::RowsCapacitiesType RowsCapacitiesTypeType;
-   Pointers::SharedPointer<  RowsCapacitiesTypeType > rowLengthsPointer;
+   Pointers::SharedPointer< RowsCapacitiesTypeType > rowLengthsPointer;
    rowLengthsPointer->setSize( dofs );
    Matrices::MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, RowsCapacitiesTypeType > matrixSetter;
    matrixSetter.template getCompressedRowLengths< typename Mesh::Cell >(
-      this->getMesh(),
-      differentialOperatorPointer,
-      boundaryConditionPointer,
-      rowLengthsPointer );
+      this->getMesh(), differentialOperatorPointer, boundaryConditionPointer, rowLengthsPointer );
    matrixPointer->setDimensions( dofs, dofs );
    matrixPointer->setRowCapacities( *rowLengthsPointer );
    return true;
 }
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
 bool
-HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
-makeSnapshot( const RealType& time,
-              const IndexType& step,
-              DofVectorPointer& dofs )
+HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::makeSnapshot( const RealType& time,
+                                                                                                   const IndexType& step,
+                                                                                                   DofVectorPointer& dofs )
 {
    std::cout << std::endl << "Writing output at time " << time << " step " << step << "." << std::endl;
 
@@ -186,29 +146,24 @@ makeSnapshot( const RealType& time,
    fileName.setFileNameBase( "u-" );
    fileName.setIndex( step );
 
-   if( MPI::GetSize() > 1 )
-   {
+   if( MPI::GetSize() > 1 ) {
       fileName.setExtension( "pvti" );
       Functions::writeDistributedMeshFunction( *this->distributedMeshPointer, *this->uPointer, "u", fileName.getFileName() );
    }
-   else
-   {
+   else {
       fileName.setExtension( "vti" );
       this->uPointer->write( "u", fileName.getFileName() );
    }
    return true;
 }
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
 void
-HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
-getExplicitUpdate( const RealType& time,
-                   const RealType& tau,
-                   DofVectorPointer& uDofs,
-                   DofVectorPointer& fuDofs )
+HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::getExplicitUpdate(
+   const RealType& time,
+   const RealType& tau,
+   DofVectorPointer& uDofs,
+   DofVectorPointer& fuDofs )
 {
    /****
     * If you use an explicit solver like Euler or Merson, you
@@ -224,41 +179,30 @@ getExplicitUpdate( const RealType& time,
    this->explicitUpdater.template update< typename Mesh::Cell >( time, tau, this->getMesh(), this->uPointer, this->fuPointer );
 }
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
 void
-HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
-applyBoundaryConditions( const RealType& time,
-                         DofVectorPointer& uDofs )
+HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::applyBoundaryConditions(
+   const RealType& time,
+   DofVectorPointer& uDofs )
 {
    this->bindDofs( uDofs );
    this->explicitUpdater.template applyBoundaryConditions< typename Mesh::Cell >( this->getMesh(), time, this->uPointer );
 }
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
-    template< typename MatrixPointer >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
+template< typename MatrixPointer >
 void
-HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
-assemblyLinearSystem( const RealType& time,
-                      const RealType& tau,
-                      DofVectorPointer& dofsPointer,
-                      MatrixPointer& matrixPointer,
-                      DofVectorPointer& bPointer )
+HeatEquationProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::assemblyLinearSystem(
+   const RealType& time,
+   const RealType& tau,
+   DofVectorPointer& dofsPointer,
+   MatrixPointer& matrixPointer,
+   DofVectorPointer& bPointer )
 {
    this->bindDofs( dofsPointer );
    this->systemAssembler.template assembly< typename Mesh::Cell, typename MatrixPointer::element_type >(
-      time,
-      tau,
-      this->getMesh(),
-      this->uPointer,
-      matrixPointer,
-      bPointer );
+      time, tau, this->getMesh(), this->uPointer, matrixPointer, bPointer );
 }
 
-} // namespace Problems
-} // namespace TNL
+}  // namespace Problems
+}  // namespace TNL
diff --git a/src/TNL/Problems/MeanCurvatureFlowEocProblem.h b/src/TNL/Problems/MeanCurvatureFlowEocProblem.h
index 10f42a9d7fce3f345368e9cacf289f4dfdc00668..1c5ae0437856a62c3c6150b0e817e3f828bf58b8 100644
--- a/src/TNL/Problems/MeanCurvatureFlowEocProblem.h
+++ b/src/TNL/Problems/MeanCurvatureFlowEocProblem.h
@@ -21,18 +21,24 @@ namespace Problems {
 template< typename Mesh,
           typename BoundaryCondition,
           typename RightHandSide,
-          typename DifferentialOperator = NonlinearDiffusion< Mesh,
-                                                          tnlOneSideDiffNonlinearOperator< Mesh, tnlOneSideDiffOperatorQ<Mesh, typename BoundaryCondition::RealType,
-                                                          typename BoundaryCondition::IndexType >, typename BoundaryCondition::RealType, typename BoundaryCondition::IndexType >,
-                                                          typename BoundaryCondition::RealType, typename BoundaryCondition::IndexType > >
-class MeanCurvatureFlowEocProblem : public MeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >
+          typename DifferentialOperator = NonlinearDiffusion<
+             Mesh,
+             tnlOneSideDiffNonlinearOperator<
+                Mesh,
+                tnlOneSideDiffOperatorQ< Mesh, typename BoundaryCondition::RealType, typename BoundaryCondition::IndexType >,
+                typename BoundaryCondition::RealType,
+                typename BoundaryCondition::IndexType >,
+             typename BoundaryCondition::RealType,
+             typename BoundaryCondition::IndexType > >
+class MeanCurvatureFlowEocProblem
+: public MeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >
 {
-   public:
-
-      bool setup( const Config::ParameterContainer& parameters );
+public:
+   bool
+   setup( const Config::ParameterContainer& parameters );
 };
 
-} // namespace Problems
-} // namespace TNL
+}  // namespace Problems
+}  // namespace TNL
 
 #include <TNL/Problems/MeanCurvatureFlowEocProblem_impl.h>
diff --git a/src/TNL/Problems/MeanCurvatureFlowEocProblem_impl.h b/src/TNL/Problems/MeanCurvatureFlowEocProblem_impl.h
index bc74e1609340d74d236a11f965522ab30a0063c5..2c89379dd544f62917b476435bb48ddc3d586fbb 100644
--- a/src/TNL/Problems/MeanCurvatureFlowEocProblem_impl.h
+++ b/src/TNL/Problems/MeanCurvatureFlowEocProblem_impl.h
@@ -15,21 +15,18 @@
 namespace TNL {
 namespace Problems {
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
 bool
-MeanCurvatureFlowEocProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator  >::
-setup( const Config::ParameterContainer& parameters )
+MeanCurvatureFlowEocProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::setup(
+   const Config::ParameterContainer& parameters )
 {
-   if( ! this->boundaryCondition.setup( parameters ) ||
-       ! this->rightHandSide.setup( parameters ) ||
-       ! this->differentialOperator.nonlinearDiffusionOperator.operatorQ.setEps(parameters.getParameter< double >("eps")) )
+   if( ! this->boundaryCondition.setup( parameters ) || ! this->rightHandSide.setup( parameters )
+       || ! this->differentialOperator.nonlinearDiffusionOperator.operatorQ.setEps(
+          parameters.getParameter< double >( "eps" ) ) )
       return false;
- 
+
    return true;
 }
 
-} // namespace Problems
-} // namespace TNL
+}  // namespace Problems
+}  // namespace TNL
diff --git a/src/TNL/Problems/MeanCurvatureFlowEocRhs.h b/src/TNL/Problems/MeanCurvatureFlowEocRhs.h
index cb63b6671d8d5600e63c8f60e546ecc07cf1eee2..496f5ffc798735590134e81b99ba74829b07f395 100644
--- a/src/TNL/Problems/MeanCurvatureFlowEocRhs.h
+++ b/src/TNL/Problems/MeanCurvatureFlowEocRhs.h
@@ -17,42 +17,36 @@
 namespace TNL {
 namespace Problems {
 
-template< typename ExactOperator,
-          typename TestFunction,
-          int Dimension >
+template< typename ExactOperator, typename TestFunction, int Dimension >
 class MeanCurvatureFlowEocRhs : public Domain< Dimension, SpaceDomain >
 {
-   public:
-
-      typedef ExactOperator ExactOperatorType;
-      typedef TestFunction TestFunctionType;
-      typedef typename TestFunctionType::RealType RealType;
-      typedef StaticVector< Dimension, RealType > PointType;
-
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" )
-      {
-         if( ! testFunction.setup( parameters, prefix ) )
-            return false;
-         return true;
-      };
-
-      template< typename Point,
-                typename Real >
-      __cuda_callable__
-      Real operator()( const Point& vertex,
-                       const Real& time ) const
-      {
-         return testFunction.getTimeDerivative( vertex, time )
-                - exactOperator( testFunction, vertex, time );
-      };
-
-   protected:
- 
-      ExactOperator exactOperator;
-
-      TestFunction testFunction;
+public:
+   typedef ExactOperator ExactOperatorType;
+   typedef TestFunction TestFunctionType;
+   typedef typename TestFunctionType::RealType RealType;
+   typedef StaticVector< Dimension, RealType > PointType;
+
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" )
+   {
+      if( ! testFunction.setup( parameters, prefix ) )
+         return false;
+      return true;
+   };
+
+   template< typename Point, typename Real >
+   __cuda_callable__
+   Real
+   operator()( const Point& vertex, const Real& time ) const
+   {
+      return testFunction.getTimeDerivative( vertex, time ) - exactOperator( testFunction, vertex, time );
+   };
+
+protected:
+   ExactOperator exactOperator;
+
+   TestFunction testFunction;
 };
 
-} // namespace Problems
-} // namespace TNL
+}  // namespace Problems
+}  // namespace TNL
diff --git a/src/TNL/Problems/MeanCurvatureFlowProblem.h b/src/TNL/Problems/MeanCurvatureFlowProblem.h
index b72a0132fb1fa3d555afb4f6b425eb9cd65904ed..b0922ef221348f95a4573e765ba1223999bcbe09 100644
--- a/src/TNL/Problems/MeanCurvatureFlowProblem.h
+++ b/src/TNL/Problems/MeanCurvatureFlowProblem.h
@@ -25,84 +25,86 @@ template< typename Mesh,
           typename BoundaryCondition,
           typename RightHandSide,
           typename DifferentialOperator =
-            OneSidedMeanCurvature< Mesh,
-                                      typename Mesh::RealType,
-                                      typename Mesh::GlobalIndexType,
-                                      false > >
+             OneSidedMeanCurvature< Mesh, typename Mesh::RealType, typename Mesh::GlobalIndexType, false > >
 class MeanCurvatureFlowProblem : public PDEProblem< Mesh,
                                                     typename DifferentialOperator::RealType,
                                                     typename Mesh::DeviceType,
                                                     typename DifferentialOperator::IndexType >
 {
-   public:
-
-      typedef typename DifferentialOperator::RealType RealType;
-      typedef typename Mesh::DeviceType DeviceType;
-      typedef typename DifferentialOperator::IndexType IndexType;
-      typedef Functions::MeshFunction< Mesh > MeshFunctionType;
-      typedef PDEProblem< Mesh, RealType, DeviceType, IndexType > BaseType;
-      typedef CSR< RealType, DeviceType, IndexType> MatrixType;
-
-      using typename BaseType::MeshType;
-      using typename BaseType::DofVectorType;
-      using typename BaseType::MeshDependentDataType;
-      using typename BaseType::MeshDependentDataPointer;
-
-      String getPrologHeader() const;
-
-      void writeProlog( Logger& logger,
-                        const Config::ParameterContainer& parameters ) const;
-
-      bool setup( const Config::ParameterContainer& parameters );
-
-      bool setInitialCondition( const Config::ParameterContainer& parameters,
-                                const MeshType& mesh,
-                                DofVectorType& dofs,
-                                MeshDependentDataPointer& meshDependentData );
-
-      template< typename Matrix >
-      bool setupLinearSystem( const MeshType& mesh,
-                              Matrix& matrix );
-
-      bool makeSnapshot( const RealType& time,
-                         const IndexType& step,
+public:
+   typedef typename DifferentialOperator::RealType RealType;
+   typedef typename Mesh::DeviceType DeviceType;
+   typedef typename DifferentialOperator::IndexType IndexType;
+   typedef Functions::MeshFunction< Mesh > MeshFunctionType;
+   typedef PDEProblem< Mesh, RealType, DeviceType, IndexType > BaseType;
+   typedef CSR< RealType, DeviceType, IndexType > MatrixType;
+
+   using typename BaseType::DofVectorType;
+   using typename BaseType::MeshDependentDataPointer;
+   using typename BaseType::MeshDependentDataType;
+   using typename BaseType::MeshType;
+
+   String
+   getPrologHeader() const;
+
+   void
+   writeProlog( Logger& logger, const Config::ParameterContainer& parameters ) const;
+
+   bool
+   setup( const Config::ParameterContainer& parameters );
+
+   bool
+   setInitialCondition( const Config::ParameterContainer& parameters,
+                        const MeshType& mesh,
+                        DofVectorType& dofs,
+                        MeshDependentDataPointer& meshDependentData );
+
+   template< typename Matrix >
+   bool
+   setupLinearSystem( const MeshType& mesh, Matrix& matrix );
+
+   bool
+   makeSnapshot( const RealType& time,
+                 const IndexType& step,
+                 const MeshType& mesh,
+                 DofVectorType& dofs,
+                 MeshDependentDataPointer& meshDependentData );
+
+   IndexType
+   getDofs( const MeshType& mesh ) const;
+
+   void
+   bindDofs( const MeshType& mesh, DofVectorType& dofs );
+
+   void
+   getExplicitUpdate( const RealType& time,
+                      const RealType& tau,
+                      const MeshType& mesh,
+                      DofVectorType& _u,
+                      DofVectorType& _fu,
+                      MeshDependentDataPointer& meshDependentData );
+
+   template< typename Matrix >
+   void
+   assemblyLinearSystem( const RealType& time,
+                         const RealType& tau,
                          const MeshType& mesh,
                          DofVectorType& dofs,
+                         Matrix& matrix,
+                         DofVectorType& rightHandSide,
                          MeshDependentDataPointer& meshDependentData );
 
-      IndexType getDofs( const MeshType& mesh ) const;
-
-      void bindDofs( const MeshType& mesh,
-                     DofVectorType& dofs );
-
-      void getExplicitUpdate( const RealType& time,
-                           const RealType& tau,
-                           const MeshType& mesh,
-                           DofVectorType& _u,
-                           DofVectorType& _fu,
-                           MeshDependentDataPointer& meshDependentData );
-
-      template< typename Matrix >
-      void assemblyLinearSystem( const RealType& time,
-                                 const RealType& tau,
-                                 const MeshType& mesh,
-                                 DofVectorType& dofs,
-                                 Matrix& matrix,
-                                 DofVectorType& rightHandSide,
-                                 MeshDependentDataPointer& meshDependentData );
-
-      protected:
-
-      SharedVector< RealType, DeviceType, IndexType > solution;
+protected:
+   SharedVector< RealType, DeviceType, IndexType > solution;
 
-      DifferentialOperator differentialOperator;
+   DifferentialOperator differentialOperator;
 
-      BoundaryCondition boundaryCondition;
+   BoundaryCondition boundaryCondition;
 
-      RightHandSide rightHandSide;
+   RightHandSide rightHandSide;
 };
 
-} // namespace Problems
-} // namespace TNL
+}  // namespace Problems
+}  // namespace TNL
 
 #include "MeanCurvatureFlowProblem_impl.h"
diff --git a/src/TNL/Problems/MeanCurvatureFlowProblem_impl.h b/src/TNL/Problems/MeanCurvatureFlowProblem_impl.h
index 8acb252646d8827e7ea787fe4ac90a37ccd6c044..300687989c704bd4f72fefe00038751990857415 100644
--- a/src/TNL/Problems/MeanCurvatureFlowProblem_impl.h
+++ b/src/TNL/Problems/MeanCurvatureFlowProblem_impl.h
@@ -26,49 +26,35 @@
 namespace TNL {
 namespace Problems {
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
 String
-MeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
-getPrologHeader() const
+MeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::getPrologHeader() const
 {
    return String( "Mean Curvative Flow" );
 }
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
 void
-MeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
-writeProlog( Logger& logger, const Config::ParameterContainer& parameters ) const
-{
-}
+MeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::writeProlog(
+   Logger& logger,
+   const Config::ParameterContainer& parameters ) const
+{}
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
 bool
-MeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
-setup( const Config::ParameterContainer& parameters )
+MeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::setup(
+   const Config::ParameterContainer& parameters )
 {
-   if( ! this->boundaryCondition.setup( parameters, "boundary-conditions-" ) ||
-       ! this->rightHandSide.setup( parameters, "right-hand-side-" ) )
+   if( ! this->boundaryCondition.setup( parameters, "boundary-conditions-" )
+       || ! this->rightHandSide.setup( parameters, "right-hand-side-" ) )
       return false;
    this->differentialOperator.nonlinearDiffusionOperator.operatorQ.setEps( parameters.getParameter< double >( "eps" ) );
    return true;
 }
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
 typename MeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::IndexType
-MeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
-getDofs( const MeshType& mesh ) const
+MeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::getDofs( const MeshType& mesh ) const
 {
    /****
     * Set-up DOFs and supporting grid functions
@@ -76,51 +62,40 @@ getDofs( const MeshType& mesh ) const
    return mesh.template getEntitiesCount< typename Mesh::Cell >();
 }
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
 void
-MeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
-bindDofs( const MeshType& mesh,
-          DofVectorType& dofVector )
+MeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::bindDofs( const MeshType& mesh,
+                                                                                                    DofVectorType& dofVector )
 {
    const IndexType dofs = mesh.template getEntitiesCount< typename Mesh::Cell >();
    this->solution.bind( dofVector.getData(), dofs );
-   //differentialOperator.nonlinearDiffusionOperator.operatorQ.bind(solution);
-//   this->differentialOperator.setupDofs(mesh);
+   // differentialOperator.nonlinearDiffusionOperator.operatorQ.bind(solution);
+   //   this->differentialOperator.setupDofs(mesh);
 }
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
 bool
-MeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
-setInitialCondition( const Config::ParameterContainer& parameters,
-                     const MeshType& mesh,
-                     DofVectorType& dofs,
-                     MeshDependentDataPointer& meshDependentData )
+MeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::setInitialCondition(
+   const Config::ParameterContainer& parameters,
+   const MeshType& mesh,
+   DofVectorType& dofs,
+   MeshDependentDataPointer& meshDependentData )
 {
    this->bindDofs( mesh, dofs );
    const String& initialConditionFile = parameters.getParameter< String >( "initial-condition" );
-   if( ! this->solution.load( initialConditionFile ) )
-   {
+   if( ! this->solution.load( initialConditionFile ) ) {
       std::cerr << "I am not able to load the initial condition from the file " << initialConditionFile << "." << std::endl;
       return false;
    }
    return true;
 }
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
 template< typename Matrix >
 bool
-MeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
-setupLinearSystem( const MeshType& mesh,
-                   Matrix& matrix )
+MeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::setupLinearSystem(
+   const MeshType& mesh,
+   Matrix& matrix )
 {
    const IndexType dofs = this->getDofs( mesh );
    typedef typename MatrixType::RowsCapacitiesType RowsCapacitiesTypeType;
@@ -128,32 +103,25 @@ setupLinearSystem( const MeshType& mesh,
    rowLengths.setSize( dofs );
    MatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, RowsCapacitiesTypeType > matrixSetter;
    matrixSetter.template getCompressedRowLengths< typename Mesh::Cell >(
-      mesh,
-      differentialOperator,
-      boundaryCondition,
-      rowLengths
-   );
+      mesh, differentialOperator, boundaryCondition, rowLengths );
    matrix.setDimensions( dofs, dofs );
    matrix.setRowCapacities( rowLengths );
    return true;
 }
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
 bool
-MeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
-makeSnapshot( const RealType& time,
-              const IndexType& step,
-              const MeshType& mesh,
-              DofVectorType& dofs,
-              MeshDependentDataPointer& meshDependentData )
+MeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::makeSnapshot(
+   const RealType& time,
+   const IndexType& step,
+   const MeshType& mesh,
+   DofVectorType& dofs,
+   MeshDependentDataPointer& meshDependentData )
 {
-  std::cout << std::endl << "Writing output at time " << time << " step " << step << "." << std::endl;
+   std::cout << std::endl << "Writing output at time " << time << " step " << step << "." << std::endl;
 
    this->bindDofs( mesh, dofs );
-   //cout << "dofs = " << dofs << std::endl;
+   // cout << "dofs = " << dofs << std::endl;
    String fileName;
    FileNameBaseNumberEnding( "u-", step, 5, ".vti", fileName );
    if( ! this->solution.write( "u", fileName ) )
@@ -161,18 +129,15 @@ makeSnapshot( const RealType& time,
    return true;
 }
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
 void
-MeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
-getExplicitUpdate( const RealType& time,
-                const RealType& tau,
-                const MeshType& mesh,
-                DofVectorType& inDofs,
-                DofVectorType& outDofs,
-                MeshDependentDataPointer& meshDependentData )
+MeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::getExplicitUpdate(
+   const RealType& time,
+   const RealType& tau,
+   const MeshType& mesh,
+   DofVectorType& inDofs,
+   DofVectorType& outDofs,
+   MeshDependentDataPointer& meshDependentData )
 {
    /****
     * If you use an explicit solver like Euler or Merson, you
@@ -183,13 +148,13 @@ getExplicitUpdate( const RealType& time,
     * You may use supporting vectors again if you need.
     */
 
-//   this->differentialOperator.computeFirstGradient(mesh,time,u);
+   //   this->differentialOperator.computeFirstGradient(mesh,time,u);
 
-   //cout << "u = " << u << std::endl;
-   //this->bindDofs( mesh, u );
+   // cout << "u = " << u << std::endl;
+   // this->bindDofs( mesh, u );
    MeshFunctionType u( mesh, inDofs );
    MeshFunctionType fu( mesh, outDofs );
-   //differentialOperator.nonlinearDiffusionOperator.operatorQ.update( mesh, time );
+   // differentialOperator.nonlinearDiffusionOperator.operatorQ.update( mesh, time );
    ExplicitUpdater< Mesh, MeshFunctionType, DifferentialOperator, BoundaryCondition, RightHandSide > explicitUpdater;
    explicitUpdater.setDifferentialOperator( this->differentialOperatorPointer );
    explicitUpdater.setBoundaryConditions( this->boundaryConditionPointer );
@@ -204,20 +169,17 @@ getExplicitUpdate( const RealType& time,
    getchar();*/
 }
 
-template< typename Mesh,
-          typename BoundaryCondition,
-          typename RightHandSide,
-          typename DifferentialOperator >
+template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator >
 template< typename Matrix >
 void
-MeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::
-assemblyLinearSystem( const RealType& time,
-                      const RealType& tau,
-                      const MeshType& mesh,
-                      DofVectorType& dofsU,
-                      Matrix& matrix,
-                      DofVectorType& b,
-                      MeshDependentDataPointer& meshDependentData )
+MeanCurvatureFlowProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >::assemblyLinearSystem(
+   const RealType& time,
+   const RealType& tau,
+   const MeshType& mesh,
+   DofVectorType& dofsU,
+   Matrix& matrix,
+   DofVectorType& b,
+   MeshDependentDataPointer& meshDependentData )
 {
    MeshFunctionType u( mesh, dofsU );
    LinearSystemAssembler< Mesh,
@@ -227,17 +189,10 @@ assemblyLinearSystem( const RealType& time,
                           RightHandSide,
                           BackwardTimeDiscretisation,
                           MatrixType,
-                          DofVectorType > systemAssembler;
+                          DofVectorType >
+      systemAssembler;
    systemAssembler.template assembly< typename Mesh::Cell >(
-      time,
-      tau,
-      mesh,
-      this->differentialOperator,
-      this->boundaryCondition,
-      this->rightHandSide,
-      u,
-      matrix,
-      b );
+      time, tau, mesh, this->differentialOperator, this->boundaryCondition, this->rightHandSide, u, matrix, b );
    /*matrix.print(std::cout );
   std::cout << std::endl << b << std::endl;
   std::cout << std::endl << u << std::endl;
@@ -245,5 +200,5 @@ assemblyLinearSystem( const RealType& time,
    //abort();*/
 }
 
-} // namespace Problems
-} // namespace TNL
+}  // namespace Problems
+}  // namespace TNL
diff --git a/src/TNL/Problems/PDEProblem.h b/src/TNL/Problems/PDEProblem.h
index a688997b4536e7c2735ff18c509a4a4a9d36f89d..1b7bfba7f734c0de17f747130ef7408c7ea7b472 100644
--- a/src/TNL/Problems/PDEProblem.h
+++ b/src/TNL/Problems/PDEProblem.h
@@ -22,100 +22,109 @@ template< typename Mesh,
           typename Index = typename Mesh::GlobalIndexType >
 class PDEProblem : public Problem< Real, Device, Index >
 {
-   public:
+public:
+   using BaseType = Problem< Real, Device, Index >;
+   using typename BaseType::DeviceType;
+   using typename BaseType::IndexType;
+   using typename BaseType::RealType;
 
-      using BaseType = Problem< Real, Device, Index >;
-      using typename BaseType::RealType;
-      using typename BaseType::DeviceType;
-      using typename BaseType::IndexType;
+   using MeshType = Mesh;
+   using MeshPointer = Pointers::SharedPointer< MeshType, DeviceType >;
+   using DistributedMeshType = Meshes::DistributedMeshes::DistributedMesh< MeshType >;
+   using DistributedMeshPointer = Pointers::SharedPointer< DistributedMeshType, DeviceType >;
+   using SubdomainOverlapsType = typename DistributedMeshType::SubdomainOverlapsType;
+   using DofVectorType = Containers::Vector< RealType, DeviceType, IndexType >;
+   using DofVectorPointer = Pointers::SharedPointer< DofVectorType, DeviceType >;
+   template< typename _Device, typename _Index, typename _IndexAlocator >
+   using SegmentsType = Algorithms::Segments::SlicedEllpack< _Device, _Index, _IndexAlocator >;
+   using MatrixType = TNL::Matrices::SparseMatrix< Real, Device, Index, TNL::Matrices::GeneralMatrix, SegmentsType >;
+   using CommonDataType = CommonData;
+   using CommonDataPointer = Pointers::SharedPointer< CommonDataType, DeviceType >;
 
-      using MeshType = Mesh;
-      using MeshPointer = Pointers::SharedPointer< MeshType, DeviceType >;
-      using DistributedMeshType = Meshes::DistributedMeshes::DistributedMesh< MeshType >;
-      using DistributedMeshPointer = Pointers::SharedPointer< DistributedMeshType, DeviceType >;
-      using SubdomainOverlapsType = typename DistributedMeshType::SubdomainOverlapsType;
-      using DofVectorType = Containers::Vector< RealType, DeviceType, IndexType>;
-      using DofVectorPointer = Pointers::SharedPointer< DofVectorType, DeviceType >;
-      template< typename _Device, typename _Index, typename _IndexAlocator >
-      using SegmentsType = Algorithms::Segments::SlicedEllpack< _Device, _Index, _IndexAlocator >;
-      using MatrixType = TNL::Matrices::SparseMatrix< Real,
-                                                      Device,
-                                                      Index,
-                                                      TNL::Matrices::GeneralMatrix,
-                                                      SegmentsType
-                                                    >;
-      using CommonDataType = CommonData;
-      using CommonDataPointer = Pointers::SharedPointer< CommonDataType, DeviceType >;
+   static constexpr bool
+   isTimeDependent()
+   {
+      return true;
+   };
 
-      static constexpr bool isTimeDependent() { return true; };
+   /****
+    * This means that the time stepper will be set from the command line arguments.
+    */
+   using TimeStepper = void;
 
-      /****
-       * This means that the time stepper will be set from the command line arguments.
-       */
-      typedef void TimeStepper;
+   String
+   getPrologHeader() const;
 
-      String getPrologHeader() const;
+   void
+   writeProlog( Logger& logger, const Config::ParameterContainer& parameters ) const;
 
-      void writeProlog( Logger& logger,
-                        const Config::ParameterContainer& parameters ) const;
+   bool
+   writeEpilog( Logger& logger ) const;
 
-      bool writeEpilog( Logger& logger ) const;
+   void
+   setMesh( MeshPointer& meshPointer );
 
-      void setMesh( MeshPointer& meshPointer );
+   void
+   setMesh( DistributedMeshPointer& distributedMeshPointer );
 
-      void setMesh( DistributedMeshPointer& distributedMeshPointer );
+   const MeshPointer&
+   getMesh() const;
 
-      const MeshPointer& getMesh() const;
+   MeshPointer&
+   getMesh();
 
-      MeshPointer& getMesh();
+   const DistributedMeshPointer&
+   getDistributedMesh() const;
 
-      const DistributedMeshPointer& getDistributedMesh() const;
+   DistributedMeshPointer&
+   getDistributedMesh();
 
-      DistributedMeshPointer& getDistributedMesh();
+   void
+   setCommonData( CommonDataPointer& commonData );
 
-      void setCommonData( CommonDataPointer& commonData );
+   const CommonDataPointer&
+   getCommonData() const;
 
-      const CommonDataPointer& getCommonData() const;
+   CommonDataPointer&
+   getCommonData();
 
-      CommonDataPointer& getCommonData();
+   // Width of the subdomain overlaps in case when all of them are the same
+   virtual IndexType
+   subdomainOverlapSize();
 
-      // Width of the subdomain overlaps in case when all of them are the same
-      virtual IndexType subdomainOverlapSize();
+   // Returns default subdomain overlaps i.e. no overlaps on the boundaries, only
+   // in the domain interior.
+   void
+   getSubdomainOverlaps( const Config::ParameterContainer& parameters,
+                         const String& prefix,
+                         const MeshType& mesh,
+                         SubdomainOverlapsType& lower,
+                         SubdomainOverlapsType& upper );
 
-      // Returns default subdomain overlaps i.e. no overlaps on the boundaries, only
-      // in the domain interior.
-      void getSubdomainOverlaps( const Config::ParameterContainer& parameters,
-                                 const String& prefix,
-                                 const MeshType& mesh,
-                                 SubdomainOverlapsType& lower,
-                                 SubdomainOverlapsType& upper );
+   bool
+   preIterate( const RealType& time, const RealType& tau, DofVectorPointer& dofs );
 
-      bool preIterate( const RealType& time,
-                       const RealType& tau,
-                       DofVectorPointer& dofs );
+   void
+   applyBoundaryConditions( const RealType& time, DofVectorPointer& dofs );
 
-      void applyBoundaryConditions( const RealType& time,
-                                       DofVectorPointer& dofs );
+   template< typename Matrix >
+   void
+   saveFailedLinearSystem( const Matrix& matrix, const DofVectorType& dofs, const DofVectorType& rightHandSide ) const;
 
-      template< typename Matrix >
-      void saveFailedLinearSystem( const Matrix& matrix,
-                                   const DofVectorType& dofs,
-                                   const DofVectorType& rightHandSide ) const;
+   bool
+   postIterate( const RealType& time, const RealType& tau, DofVectorPointer& dofs );
 
-      bool postIterate( const RealType& time,
-                        const RealType& tau,
-                        DofVectorPointer& dofs );
+   Solvers::SolverMonitor*
+   getSolverMonitor();
 
-      Solvers::SolverMonitor* getSolverMonitor();
+   MeshPointer meshPointer;
 
-      MeshPointer meshPointer;
+   DistributedMeshPointer distributedMeshPointer;
 
-      DistributedMeshPointer distributedMeshPointer;
-
-      CommonDataPointer commonDataPointer;
+   CommonDataPointer commonDataPointer;
 };
 
-} // namespace Problems
-} // namespace TNL
+}  // namespace Problems
+}  // namespace TNL
 
 #include <TNL/Problems/PDEProblem_impl.h>
diff --git a/src/TNL/Problems/PDEProblem_impl.h b/src/TNL/Problems/PDEProblem_impl.h
index 3e14bd4465353412a94bd4d7becbc579b3cc21cf..7ff2c5b7cc1e9b3367f2c2b9f364f200764e2864 100644
--- a/src/TNL/Problems/PDEProblem_impl.h
+++ b/src/TNL/Problems/PDEProblem_impl.h
@@ -12,83 +12,54 @@
 namespace TNL {
 namespace Problems {
 
-template< typename Mesh,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename Mesh, typename Real, typename Device, typename Index >
 String
-PDEProblem< Mesh, Real, Device, Index >::
-getPrologHeader() const
+PDEProblem< Mesh, Real, Device, Index >::getPrologHeader() const
 {
    return String( "General PDE Problem" );
 }
 
-template< typename Mesh,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename Mesh, typename Real, typename Device, typename Index >
 void
-PDEProblem< Mesh, Real, Device, Index >::
-writeProlog( Logger& logger, const Config::ParameterContainer& parameters ) const
-{
-}
+PDEProblem< Mesh, Real, Device, Index >::writeProlog( Logger& logger, const Config::ParameterContainer& parameters ) const
+{}
 
-template< typename Mesh,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename Mesh, typename Real, typename Device, typename Index >
 bool
-PDEProblem< Mesh, Real, Device, Index >::
-writeEpilog( Logger& logger ) const
+PDEProblem< Mesh, Real, Device, Index >::writeEpilog( Logger& logger ) const
 {
    return true;
 }
 
-template< typename Mesh,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename Mesh, typename Real, typename Device, typename Index >
 typename PDEProblem< Mesh, Real, Device, Index >::IndexType
-PDEProblem< Mesh, Real, Device, Index >::
-subdomainOverlapSize()
+PDEProblem< Mesh, Real, Device, Index >::subdomainOverlapSize()
 {
    return 1;
 }
 
-template< typename Mesh,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename Mesh, typename Real, typename Device, typename Index >
 void
-PDEProblem< Mesh, Real, Device, Index >::
-getSubdomainOverlaps( const Config::ParameterContainer& parameters,
-                      const String& prefix,
-                      const MeshType& mesh,
-                      SubdomainOverlapsType& lower,
-                      SubdomainOverlapsType& upper )
+PDEProblem< Mesh, Real, Device, Index >::getSubdomainOverlaps( const Config::ParameterContainer& parameters,
+                                                               const String& prefix,
+                                                               const MeshType& mesh,
+                                                               SubdomainOverlapsType& lower,
+                                                               SubdomainOverlapsType& upper )
 {
    using namespace Meshes::DistributedMeshes;
    SubdomainOverlapsGetter< MeshType >::getOverlaps( mesh.getDistributedMesh(), lower, upper, this->subdomainOverlapSize() );
 }
 
-template< typename Mesh,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename Mesh, typename Real, typename Device, typename Index >
 void
-PDEProblem< Mesh, Real, Device, Index >::
-setMesh( MeshPointer& meshPointer)
+PDEProblem< Mesh, Real, Device, Index >::setMesh( MeshPointer& meshPointer )
 {
    this->meshPointer = meshPointer;
 }
 
-template< typename Mesh,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename Mesh, typename Real, typename Device, typename Index >
 void
-PDEProblem< Mesh, Real, Device, Index >::
-setMesh( DistributedMeshPointer& distributedMeshPointer)
+PDEProblem< Mesh, Real, Device, Index >::setMesh( DistributedMeshPointer& distributedMeshPointer )
 {
    this->distributedMeshPointer = distributedMeshPointer;
    // FIXME: DistributedGrid does not have a SharedPointer of the local grid,
@@ -96,132 +67,88 @@ setMesh( DistributedMeshPointer& distributedMeshPointer)
    *meshPointer = distributedMeshPointer->getLocalMesh();
 }
 
-template< typename Mesh,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename Mesh, typename Real, typename Device, typename Index >
 const typename PDEProblem< Mesh, Real, Device, Index >::MeshPointer&
 PDEProblem< Mesh, Real, Device, Index >::getMesh() const
 {
    return this->meshPointer;
 }
 
-template< typename Mesh,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename Mesh, typename Real, typename Device, typename Index >
 typename PDEProblem< Mesh, Real, Device, Index >::MeshPointer&
 PDEProblem< Mesh, Real, Device, Index >::getMesh()
 {
    return this->meshPointer;
 }
 
-template< typename Mesh,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename Mesh, typename Real, typename Device, typename Index >
 const typename PDEProblem< Mesh, Real, Device, Index >::DistributedMeshPointer&
 PDEProblem< Mesh, Real, Device, Index >::getDistributedMesh() const
 {
    return this->distributedMeshPointer;
 }
 
-template< typename Mesh,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename Mesh, typename Real, typename Device, typename Index >
 typename PDEProblem< Mesh, Real, Device, Index >::DistributedMeshPointer&
 PDEProblem< Mesh, Real, Device, Index >::getDistributedMesh()
 {
    return this->distributedMeshPointer;
 }
 
-template< typename Mesh,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename Mesh, typename Real, typename Device, typename Index >
 void
-PDEProblem< Mesh, Real, Device, Index >::
-setCommonData( CommonDataPointer& commonData )
+PDEProblem< Mesh, Real, Device, Index >::setCommonData( CommonDataPointer& commonData )
 {
    this->commonDataPointer = commonData;
 }
 
-template< typename Mesh,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename Mesh, typename Real, typename Device, typename Index >
 const typename PDEProblem< Mesh, Real, Device, Index >::CommonDataPointer&
-PDEProblem< Mesh, Real, Device, Index >::
-getCommonData() const
+PDEProblem< Mesh, Real, Device, Index >::getCommonData() const
 {
    return this->commonDataPointer;
 }
 
-template< typename Mesh,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename Mesh, typename Real, typename Device, typename Index >
 typename PDEProblem< Mesh, Real, Device, Index >::CommonDataPointer&
-PDEProblem< Mesh, Real, Device, Index >::
-getCommonData()
+PDEProblem< Mesh, Real, Device, Index >::getCommonData()
 {
    return this->commonDataPointer;
 }
 
-template< typename Mesh,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename Mesh, typename Real, typename Device, typename Index >
 bool
-PDEProblem< Mesh, Real, Device, Index >::
-preIterate( const RealType& time,
-            const RealType& tau,
-            DofVectorPointer& dofs )
+PDEProblem< Mesh, Real, Device, Index >::preIterate( const RealType& time, const RealType& tau, DofVectorPointer& dofs )
 {
    return true;
 }
 
-template< typename Mesh,
-          typename Real,
-          typename Device,
-          typename Index >
-    template< typename Matrix >
+template< typename Mesh, typename Real, typename Device, typename Index >
+template< typename Matrix >
 void
-PDEProblem< Mesh, Real, Device, Index >::
-saveFailedLinearSystem( const Matrix& matrix,
-                        const DofVectorType& dofs,
-                        const DofVectorType& rhs ) const
+PDEProblem< Mesh, Real, Device, Index >::saveFailedLinearSystem( const Matrix& matrix,
+                                                                 const DofVectorType& dofs,
+                                                                 const DofVectorType& rhs ) const
 {
-    matrix.save( "failed-matrix.tnl" );
-    File( "failed-dof.vec.tnl", std::ios_base::out ) << dofs;
-    File( "failed-rhs.vec.tnl", std::ios_base::out ) << rhs;
-    std::cerr << "The linear system has been saved to failed-{matrix,dof.vec,rhs.vec}.tnl" << std::endl;
+   matrix.save( "failed-matrix.tnl" );
+   File( "failed-dof.vec.tnl", std::ios_base::out ) << dofs;
+   File( "failed-rhs.vec.tnl", std::ios_base::out ) << rhs;
+   std::cerr << "The linear system has been saved to failed-{matrix,dof.vec,rhs.vec}.tnl" << std::endl;
 }
 
-template< typename Mesh,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename Mesh, typename Real, typename Device, typename Index >
 bool
-PDEProblem< Mesh, Real, Device, Index >::
-postIterate( const RealType& time,
-             const RealType& tau,
-             DofVectorPointer& dofs )
+PDEProblem< Mesh, Real, Device, Index >::postIterate( const RealType& time, const RealType& tau, DofVectorPointer& dofs )
 {
    return true;
 }
 
-template< typename Mesh,
-          typename Real,
-          typename Device,
-          typename Index >
+template< typename Mesh, typename Real, typename Device, typename Index >
 Solvers::SolverMonitor*
-PDEProblem< Mesh, Real, Device, Index >::
-getSolverMonitor()
+PDEProblem< Mesh, Real, Device, Index >::getSolverMonitor()
 {
    return 0;
 }
 
-} // namespace Problems
-} // namespace TNL
+}  // namespace Problems
+}  // namespace TNL
diff --git a/src/TNL/Problems/Problem.h b/src/TNL/Problems/Problem.h
index 93a7739008fc3f7666cc5a3f059b039c7d365448..5696bc97a8e562e06a7c7e918353e040fed62ddb 100644
--- a/src/TNL/Problems/Problem.h
+++ b/src/TNL/Problems/Problem.h
@@ -9,17 +9,14 @@
 namespace TNL {
 namespace Problems {
 
-template< typename Real,
-          typename Device,
-          typename Index >
+template< typename Real, typename Device, typename Index >
 class Problem
 {
-   public:
-
-      typedef Real RealType;
-      typedef Device DeviceType;
-      typedef Index IndexType;
+public:
+   using RealType = Real;
+   using DeviceType = Device;
+   using IndexType = Index;
 };
 
-} // namespace Problems
-} // namespace TNL
+}  // namespace Problems
+}  // namespace TNL
diff --git a/src/TNL/Problems/cfd/navier-stokes/NavierStokesSolver.h b/src/TNL/Problems/cfd/navier-stokes/NavierStokesSolver.h
index 1517e0095ddd4480e42903d081722120ef50c45b..ae56eade8430bfa06fa2c1b284e8a3bcc6a94d8a 100644
--- a/src/TNL/Problems/cfd/navier-stokes/NavierStokesSolver.h
+++ b/src/TNL/Problems/cfd/navier-stokes/NavierStokesSolver.h
@@ -11,13 +11,10 @@
 
 namespace TNL {
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
 class NavierStokesSolver
 {
-   public:
-
+public:
    typedef AdvectionScheme AdvectionSchemeType;
    typedef DiffusionScheme DiffusionSchemeType;
    typedef BoundaryConditions BoundaryConditionsType;
@@ -30,101 +27,124 @@ class NavierStokesSolver
 
    NavierStokesSolver();
 
-   void setAdvectionScheme( AdvectionSchemeType& advection );
-
-   void setDiffusionScheme( DiffusionSchemeType& u1Viscosity,
-                            DiffusionSchemeType& u2Viscosity,
-                            DiffusionSchemeType& temperatureViscosity);
+   void
+   setAdvectionScheme( AdvectionSchemeType& advection );
 
-   void setBoundaryConditions( BoundaryConditionsType& boundaryConditions );
+   void
+   setDiffusionScheme( DiffusionSchemeType& u1Viscosity,
+                       DiffusionSchemeType& u2Viscosity,
+                       DiffusionSchemeType& temperatureViscosity );
 
-   void setMesh( MeshType& mesh );
+   void
+   setBoundaryConditions( BoundaryConditionsType& boundaryConditions );
 
-   void setMu( const RealType& mu );
+   void
+   setMesh( MeshType& mesh );
 
-   const RealType& getMu() const;
+   void
+   setMu( const RealType& mu );
 
-   void setR( const RealType& R );
+   const RealType&
+   getMu() const;
 
-   const RealType& getR() const;
+   void
+   setR( const RealType& R );
 
-   void setT( const RealType& T );
+   const RealType&
+   getR() const;
 
-   const RealType& getT() const;
+   void
+   setT( const RealType& T );
 
-   void setHeatCapacityRatio( const RealType& gamma );
+   const RealType&
+   getT() const;
 
-   const RealType& getHeatCapacityRatio() const;
+   void
+   setHeatCapacityRatio( const RealType& gamma );
 
-   void setGravity( const RealType& gravity );
+   const RealType&
+   getHeatCapacityRatio() const;
 
-   const RealType& getGravity() const;
+   void
+   setGravity( const RealType& gravity );
 
-   VectorType& getRho();
+   const RealType&
+   getGravity() const;
 
-   const VectorType& getRho() const;
+   VectorType&
+   getRho();
 
-   VectorType& getU1();
+   const VectorType&
+   getRho() const;
 
-   const VectorType& getU1() const;
+   VectorType&
+   getU1();
 
-   VectorType& getU2();
+   const VectorType&
+   getU1() const;
 
-   const VectorType& getU2() const;
+   VectorType&
+   getU2();
 
-   VectorType& getU();
+   const VectorType&
+   getU2() const;
 
-   const VectorType& getU() const;
+   VectorType&
+   getU();
 
-   VectorType& getPressure();
+   const VectorType&
+   getU() const;
 
-   const VectorType& getPressure() const;
+   VectorType&
+   getPressure();
 
-   VectorType& getEnergy();
+   const VectorType&
+   getPressure() const;
 
-   const VectorType& getEnergy() const;
+   VectorType&
+   getEnergy();
 
+   const VectorType&
+   getEnergy() const;
 
-   IndexType getDofs() const;
+   IndexType
+   getDofs() const;
 
-   void bindDofVector( RealType* );
+   void
+   bindDofVector( RealType* );
 
-   DofVectorType& getDofVector();
+   DofVectorType&
+   getDofVector();
 
    template< typename Vector >
-   void updatePhysicalQuantities( const Vector& rho,
-                                  const Vector& rho_u1,
-                                  const Vector& rho_u2,
-                                  const Vector& e );
+   void
+   updatePhysicalQuantities( const Vector& rho, const Vector& rho_u1, const Vector& rho_u2, const Vector& e );
 
    template< typename SolverVectorType >
-   void getExplicitUpdate( const RealType& time,
-                        const RealType& tau,
-                        SolverVectorType& u,
-                        SolverVectorType& fu );
+   void
+   getExplicitUpdate( const RealType& time, const RealType& tau, SolverVectorType& u, SolverVectorType& fu );
 
-   bool writePhysicalVariables( const RealType& t,
-                                const IndexType step );
+   bool
+   writePhysicalVariables( const RealType& t, const IndexType step );
 
-   bool writeConservativeVariables( const RealType& t,
-                                    const IndexType step );
+   bool
+   writeConservativeVariables( const RealType& t, const IndexType step );
 
    template< typename DofVector >
-   bool writeExplicitRhs( const RealType& t,
-                          const IndexType step,
-                          DofVector& rhs );
+   bool
+   writeExplicitRhs( const RealType& t, const IndexType step, DofVector& rhs );
 
-   protected:
-
-   RealType computeEnergy( const RealType& rho,
-                           const RealType& temperature,
-                           const RealType& gamma,
-                           const RealType& u1,
-                           const RealType& u2 ) const;
+protected:
+   RealType
+   computeEnergy( const RealType& rho,
+                  const RealType& temperature,
+                  const RealType& gamma,
+                  const RealType& u1,
+                  const RealType& u2 ) const;
 
    AdvectionSchemeType* advection;
 
-   DiffusionSchemeType  *u1Viscosity, *u2Viscosity, *energyViscosity;
+   DiffusionSchemeType *u1Viscosity, *u2Viscosity, *energyViscosity;
 
    BoundaryConditionsType* boundaryConditions;
 
@@ -137,9 +157,8 @@ class NavierStokesSolver
    DofVectorType dofVector;
 
    VectorType rhsDofVector;
-
 };
 
-} // namespace TNL
+}  // namespace TNL
 
 #include <TNL/Solvers/cfd/navier-stokes/NavierStokesSolver_impl.h>
diff --git a/src/TNL/Problems/cfd/navier-stokes/NavierStokesSolver_impl.h b/src/TNL/Problems/cfd/navier-stokes/NavierStokesSolver_impl.h
index d2d66034049612030e6033a5edf3abf3a402e8b6..9e450e1f400d6d525d4cb45add71a94b774e234a 100644
--- a/src/TNL/Problems/cfd/navier-stokes/NavierStokesSolver_impl.h
+++ b/src/TNL/Problems/cfd/navier-stokes/NavierStokesSolver_impl.h
@@ -10,340 +10,276 @@
 
 namespace TNL {
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
 NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::NavierStokesSolver()
-: advection( 0 ),
-  u1Viscosity( 0 ),
-  u2Viscosity( 0 ),
-  energyViscosity( 0 ),
-  mu( 0.0 ),
-  gravity( 0.0 ),
-  R( 0.0 ),
-  T( 0.0 )
-{
-}
+: advection( 0 ), u1Viscosity( 0 ), u2Viscosity( 0 ), energyViscosity( 0 ), mu( 0.0 ), gravity( 0.0 ), R( 0.0 ), T( 0.0 )
+{}
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
-void NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::setAdvectionScheme( AdvectionSchemeType& advection )
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
+void
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::setAdvectionScheme( AdvectionSchemeType& advection )
 {
    this->advection = &advection;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
-void NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::setDiffusionScheme( DiffusionSchemeType& u1Viscosity,
-                                                                                                        DiffusionSchemeType& u2Viscosity,
-                                                                                                        DiffusionSchemeType& energyViscosity )
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
+void
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::setDiffusionScheme(
+   DiffusionSchemeType& u1Viscosity,
+   DiffusionSchemeType& u2Viscosity,
+   DiffusionSchemeType& energyViscosity )
 {
    this->u1Viscosity = &u1Viscosity;
    this->u2Viscosity = &u2Viscosity;
    this->energyViscosity = &energyViscosity;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
-void NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::setBoundaryConditions( BoundaryConditionsType& boundaryConditions )
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
+void
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::setBoundaryConditions(
+   BoundaryConditionsType& boundaryConditions )
 {
    this->boundaryConditions = &boundaryConditions;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
-void NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::setMesh( MeshType& mesh )
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
+void
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::setMesh( MeshType& mesh )
 {
    this->mesh = &mesh;
    this->rho.setSize( this->mesh->getDofs() );
-   this->u1.setSize(  this->mesh->getDofs() );
-   this->u2.setSize(  this->mesh->getDofs() );
-   this->u.setSize(  this->mesh->getDofs() );
-   this->p.setSize(   this->mesh->getDofs() );
-   this->energy.setSize(   this->mesh->getDofs() );
-   this->rhsDofVector.setSize(  this->getDofs() );
+   this->u1.setSize( this->mesh->getDofs() );
+   this->u2.setSize( this->mesh->getDofs() );
+   this->u.setSize( this->mesh->getDofs() );
+   this->p.setSize( this->mesh->getDofs() );
+   this->energy.setSize( this->mesh->getDofs() );
+   this->rhsDofVector.setSize( this->getDofs() );
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
-void NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::setMu( const RealType& mu )
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
+void
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::setMu( const RealType& mu )
 {
    this->mu = mu;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
 const typename NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::RealType&
-   NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getMu() const
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getMu() const
 {
    return this->mu;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
-void NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::setR( const RealType& R )
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
+void
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::setR( const RealType& R )
 {
    this->R = R;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
 const typename NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::RealType&
-   NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getR() const
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getR() const
 {
    return this->R;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
-void NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::setT( const RealType& T )
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
+void
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::setT( const RealType& T )
 {
    this->T = T;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
 const typename NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::RealType&
-   NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getT() const
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getT() const
 {
    return this->T;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
-void NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::setHeatCapacityRatio( const RealType& gamma )
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
+void
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::setHeatCapacityRatio( const RealType& gamma )
 {
    this->gamma = gamma;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
 const typename NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::RealType&
-   NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getHeatCapacityRatio() const
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getHeatCapacityRatio() const
 {
    return this->gamma;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
-void NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::setGravity( const RealType& gravity )
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
+void
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::setGravity( const RealType& gravity )
 {
    this->gravity = gravity;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
 const typename NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::RealType&
-   NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getGravity() const
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getGravity() const
 {
    return this->gravity;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
 typename NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::VectorType&
-   NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getRho()
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getRho()
 {
    return this->rho;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
 const typename NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::VectorType&
-   NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getRho() const
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getRho() const
 {
    return this->rho;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
 typename NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::VectorType&
-   NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getU1()
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getU1()
 {
    return this->u1;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
 const typename NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::VectorType&
-   NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getU1() const
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getU1() const
 {
    return this->u1;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
 typename NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::VectorType&
-   NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getU2()
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getU2()
 {
    return this->u2;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
 const typename NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::VectorType&
-   NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getU2() const
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getU2() const
 {
    return this->u2;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
 typename NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::VectorType&
-   NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getU()
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getU()
 {
    return this->u;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
 const typename NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::VectorType&
-   NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getU() const
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getU() const
 {
    return this->u;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
 typename NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::VectorType&
-   NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getPressure()
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getPressure()
 {
    return this->p;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
 const typename NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::VectorType&
-   NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getPressure() const
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getPressure() const
 {
    return this->p;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
 typename NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::VectorType&
-   NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getEnergy()
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getEnergy()
 {
    return this->energy;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
 const typename NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::VectorType&
-   NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getEnergy() const
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getEnergy() const
 {
    return this->energy;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
 typename NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::IndexType
-   NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getDofs() const
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getDofs() const
 {
-   return 4*this->mesh->getDofs();
+   return 4 * this->mesh->getDofs();
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
-void NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::bindDofVector( RealType* data )
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
+void
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::bindDofVector( RealType* data )
 {
    this->dofVector.bind( data, this->getDofs() );
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
 typename NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::DofVectorType&
-   NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getDofVector()
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getDofVector()
 {
    return this->dofVector;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
-   template< typename Vector >
-void NavierStokesSolver< AdvectionScheme,
-                      DiffusionScheme,
-                      BoundaryConditions > :: updatePhysicalQuantities( const Vector& dofs_rho,
-                                                                        const Vector& dofs_rho_u1,
-                                                                        const Vector& dofs_rho_u2,
-                                                                        const Vector& dofs_e )
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
+template< typename Vector >
+void
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::updatePhysicalQuantities( const Vector& dofs_rho,
+                                                                                                      const Vector& dofs_rho_u1,
+                                                                                                      const Vector& dofs_rho_u2,
+                                                                                                      const Vector& dofs_e )
 {
-   if( DeviceType :: getDevice() == Devices::HostDevice )
-   {
+   if( DeviceType ::getDevice() == Devices::HostDevice ) {
       const IndexType size = dofs_rho.getSize();
 
-      #ifdef HAVE_OPENMP
-      #pragma omp parallel for, if( Devices::Host::isOMPEnabled() )
-      #endif
-      for( IndexType c = 0; c < size; c++ )
-         {
-            this->rho[ c ] = dofs_rho[ c ];
-            const RealType u1 = this->u1[ c ] = dofs_rho_u1[ c ] / dofs_rho[ c ];
-            const RealType u2 = this->u2[ c ] = dofs_rho_u2[ c ] / dofs_rho[ c ];
-            this->u[ c ] = ::sqrt( u1*u1 + u2*u2 );
-            //this->p[ c ] = dofs_rho[ c ] * this->R * this->T;
-            this->p[ c ] = ( this->gamma - 1.0 ) *
-                           ( dofs_e[ c ] - 0.5 * this->rho[ c ] * ( this->u1[ c ] * this->u1[ c ] + this->u2[ c ] * this->u2[ c ] ) );
-            this->energy[ c ] = dofs_e[ c ];
-            //this->temperature[ c ] = this->p[ c ] / ( this->rho[ c ] * this->R );
-         }
+#ifdef HAVE_OPENMP
+#pragma omp parallel for, if( Devices::Host::isOMPEnabled() )
+#endif
+      for( IndexType c = 0; c < size; c++ ) {
+         this->rho[ c ] = dofs_rho[ c ];
+         const RealType u1 = this->u1[ c ] = dofs_rho_u1[ c ] / dofs_rho[ c ];
+         const RealType u2 = this->u2[ c ] = dofs_rho_u2[ c ] / dofs_rho[ c ];
+         this->u[ c ] = ::sqrt( u1 * u1 + u2 * u2 );
+         // this->p[ c ] = dofs_rho[ c ] * this->R * this->T;
+         this->p[ c ] =
+            ( this->gamma - 1.0 )
+            * ( dofs_e[ c ] - 0.5 * this->rho[ c ] * ( this->u1[ c ] * this->u1[ c ] + this->u2[ c ] * this->u2[ c ] ) );
+         this->energy[ c ] = dofs_e[ c ];
+         // this->temperature[ c ] = this->p[ c ] / ( this->rho[ c ] * this->R );
+      }
    }
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
-   template< typename SolverVectorType >
-void NavierStokesSolver< AdvectionScheme,
-                      DiffusionScheme,
-                      BoundaryConditions >::getExplicitUpdate( const RealType& time,
-                                                            const RealType& tau,
-                                                            SolverVectorType& u,
-                                                            SolverVectorType& fu )
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
+template< typename SolverVectorType >
+void
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getExplicitUpdate( const RealType& time,
+                                                                                               const RealType& tau,
+                                                                                               SolverVectorType& u,
+                                                                                               SolverVectorType& fu )
 {
    TNL_ASSERT_TRUE( this->advection, "advection scheme was not set" );
    TNL_ASSERT_TRUE( this->u1Viscosity, "diffusion scheme was not set" );
    TNL_ASSERT_TRUE( this->u2Viscosity, "diffusion scheme was not set" );
    TNL_ASSERT_TRUE( this->boundaryConditions, "boundary conditions were not set" );
 
-   SharedVector< RealType, DeviceType, IndexType > dofs_rho, dofs_rho_u1, dofs_rho_u2, dofs_e,
-                                                      rho_t, rho_u1_t, rho_u2_t, e_t;
+   SharedVector< RealType, DeviceType, IndexType > dofs_rho, dofs_rho_u1, dofs_rho_u2, dofs_e, rho_t, rho_u1_t, rho_u2_t, e_t;
 
    const IndexType& dofs = this->mesh->getDofs();
-   dofs_rho. bind( & u. getData()[ 0 ], dofs );
-   dofs_rho_u1. bind( & u. getData()[ dofs ], dofs );
-   dofs_rho_u2. bind( & u. getData()[ 2 * dofs ], dofs );
-   dofs_e. bind( & u. getData()[ 3 * dofs ], dofs );
+   dofs_rho.bind( &u.getData()[ 0 ], dofs );
+   dofs_rho_u1.bind( &u.getData()[ dofs ], dofs );
+   dofs_rho_u2.bind( &u.getData()[ 2 * dofs ], dofs );
+   dofs_e.bind( &u.getData()[ 3 * dofs ], dofs );
 
    this->advection->setRho( dofs_rho );
    this->advection->setRhoU1( dofs_rho_u1 );
@@ -352,29 +288,26 @@ void NavierStokesSolver< AdvectionScheme,
    this->advection->setP( this->p );
    this->energyViscosity->setFunction( this->energy );
 
-   rho_t.bind( & fu. getData()[ 0 ], dofs );
-   rho_u1_t.bind( & fu. getData()[ dofs ], dofs );
-   rho_u2_t.bind( & fu. getData()[ 2 * dofs ], dofs );
-   e_t.bind( & fu. getData()[ 3 * dofs ], dofs );
+   rho_t.bind( &fu.getData()[ 0 ], dofs );
+   rho_u1_t.bind( &fu.getData()[ dofs ], dofs );
+   rho_u2_t.bind( &fu.getData()[ 2 * dofs ], dofs );
+   e_t.bind( &fu.getData()[ 3 * dofs ], dofs );
 
    updatePhysicalQuantities( dofs_rho, dofs_rho_u1, dofs_rho_u2, dofs_e );
 
-
    this->boundaryConditions->apply( time, tau, this->rho, this->u1, this->u2, this->energy );
 
    const IndexType& xSize = this->mesh->getDimensions().x();
    const IndexType& ySize = this->mesh->getDimensions().y();
 
-   if( DeviceType::getDevice() == Devices::HostDevice )
-   {
-      for( IndexType i = 0; i < xSize; i ++ )
-      {
+   if( DeviceType::getDevice() == Devices::HostDevice ) {
+      for( IndexType i = 0; i < xSize; i++ ) {
          const IndexType c1 = mesh->getElementIndex( i, 0 );
          const IndexType c2 = mesh->getElementIndex( i, 1 );
          const IndexType c3 = mesh->getElementIndex( i, ySize - 1 );
          const IndexType c4 = mesh->getElementIndex( i, ySize - 2 );
 
-         dofs_rho[ c1 ]    = this->rho[ c1 ];
+         dofs_rho[ c1 ] = this->rho[ c1 ];
          dofs_rho_u1[ c1 ] = this->rho[ c1 ] * this->u1[ c1 ];
          dofs_rho_u2[ c1 ] = this->rho[ c1 ] * this->u2[ c1 ];
          dofs_e[ c1 ] = this->energy[ c1 ];
@@ -384,7 +317,7 @@ void NavierStokesSolver< AdvectionScheme,
                                                   this->u1[ c1 ],
                                                   this->u2[ c1 ] );*/
 
-         dofs_rho[ c3 ]    = this->rho[ c3 ];
+         dofs_rho[ c3 ] = this->rho[ c3 ];
          dofs_rho_u1[ c3 ] = this->rho[ c3 ] * this->u1[ c3 ];
          dofs_rho_u2[ c3 ] = this->rho[ c3 ] * this->u2[ c3 ];
          dofs_e[ c3 ] = this->energy[ c3 ];
@@ -394,14 +327,13 @@ void NavierStokesSolver< AdvectionScheme,
                                                   this->u1[ c3 ],
                                                   this->u2[ c3 ] );*/
       }
-      for( IndexType j = 0; j < ySize; j ++ )
-      {
+      for( IndexType j = 0; j < ySize; j++ ) {
          const IndexType c1 = mesh->getElementIndex( 0, j );
          const IndexType c2 = mesh->getElementIndex( 1, j );
          const IndexType c3 = mesh->getElementIndex( xSize - 1, j );
          const IndexType c4 = mesh->getElementIndex( xSize - 2, j );
 
-         dofs_rho[ c1 ]    = this->rho[ c1 ];
+         dofs_rho[ c1 ] = this->rho[ c1 ];
          dofs_rho_u1[ c1 ] = this->rho[ c1 ] * this->u1[ c1 ];
          dofs_rho_u2[ c1 ] = this->rho[ c1 ] * this->u2[ c1 ];
          dofs_e[ c1 ] = this->energy[ c1 ];
@@ -411,8 +343,7 @@ void NavierStokesSolver< AdvectionScheme,
                                                   this->u1[ c1 ],
                                                   this->u2[ c1 ] );*/
 
-
-         dofs_rho[ c3 ]    = this->rho[ c3 ];
+         dofs_rho[ c3 ] = this->rho[ c3 ];
          dofs_rho_u1[ c3 ] = this->rho[ c3 ] * this->u1[ c3 ];
          dofs_rho_u2[ c3 ] = this->rho[ c3 ] * this->u2[ c3 ];
          dofs_e[ c3 ] = this->energy[ c3 ];
@@ -421,100 +352,85 @@ void NavierStokesSolver< AdvectionScheme,
                                                   this->gamma,
                                                   this->u1[ c3 ],
                                                   this->u2[ c3 ] );*/
-
       }
    }
    writePhysicalVariables( time, -4 );
 
 #ifdef HAVE_OPENMP
-  #pragma omp parallel for, if( Devices::Host::isOMPEnabled() )
-  #endif
-  for( IndexType j = 0; j < ySize; j ++ )
-     for( IndexType i = 0; i < xSize; i ++ )
-     {
-        IndexType c = this->mesh->getElementIndex( i, j );
-        if( i == 0 || j == 0 ||
-            i == xSize - 1 || j == ySize - 1 )
-        {
-           rho_t[ c ] = rho_u1_t[ c ] = rho_u2_t[ c ] = e_t[ c ] = 0.0;
-           continue;
-        }
-
-        this->advection->getExplicitUpdate( c,
-                                         rho_t[ c ],
-                                         rho_u1_t[ c ],
-                                         rho_u2_t[ c ],
-                                         e_t[ c ],
-                                         tau );
-
-        //rho_u1_t[ c ] += ;
-        //rho_u2_t[ c ] -= startUpCoefficient * this->gravity * this->rho[ c ];
-
-        /***
-         * Add the viscosity term
+#pragma omp parallel for, if( Devices::Host::isOMPEnabled() )
+#endif
+   for( IndexType j = 0; j < ySize; j++ )
+      for( IndexType i = 0; i < xSize; i++ ) {
+         IndexType c = this->mesh->getElementIndex( i, j );
+         if( i == 0 || j == 0 || i == xSize - 1 || j == ySize - 1 ) {
+            rho_t[ c ] = rho_u1_t[ c ] = rho_u2_t[ c ] = e_t[ c ] = 0.0;
+            continue;
+         }
+
+         this->advection->getExplicitUpdate( c, rho_t[ c ], rho_u1_t[ c ], rho_u2_t[ c ], e_t[ c ], tau );
+
+         // rho_u1_t[ c ] += ;
+         // rho_u2_t[ c ] -= startUpCoefficient * this->gravity * this->rho[ c ];
+
+         /***
+          * Add the viscosity term
+          */
+         /*rho_u1_t[ c ] += this->mu*( u1Viscosity->getDiffusion( c, 4.0/3.0, 1.0, 0.0 ) +
+                                     u2Viscosity->getDiffusion( c, 0.0, 0.0, 1.0/3.0 ) );
+         rho_u2_t[ c ] += this->mu*( u2Viscosity->getDiffusion( c, 1.0, 4.0/3.0, 0.0 ) +
+                                     u1Viscosity->getDiffusion( c, 0.0, 0.0, 1.0/3.0 ) );
+
+
+         RealType k = 2.495*pow( 400.0, 1.5 ) / ( 400.0 + 194.0 );
+         e_t[ c ] += this->mu*( u1Viscosity->getDiffusion( c,
+                                                           this->u1, this->u1, this->u2,
+                                                           4.0/3.0, 1.0, -2.0/3.0 ) +
+                                u1Viscosity->getDiffusion( c,
+                                                           this->u1, this->u1, this->u2,
+                                                           0.0, 0.0, 1.0 ) +
+                                u2Viscosity->getDiffusion( c,
+                                                           this->u2, this->u2, this->u1,
+                                                           1.0, 4.0/3.0, -2.0/3.0 ) +
+                                u2Viscosity->getDiffusion( c,
+                                                           this->u2, this->u2, this->u1,
+                                                           0.0, 0.0, 1.0 ) +
+                                k * energyViscosity->getDiffusion( c, 1.0, 1.0, 0.0 ) );
          */
-        /*rho_u1_t[ c ] += this->mu*( u1Viscosity->getDiffusion( c, 4.0/3.0, 1.0, 0.0 ) +
-                                    u2Viscosity->getDiffusion( c, 0.0, 0.0, 1.0/3.0 ) );
-        rho_u2_t[ c ] += this->mu*( u2Viscosity->getDiffusion( c, 1.0, 4.0/3.0, 0.0 ) +
-                                    u1Viscosity->getDiffusion( c, 0.0, 0.0, 1.0/3.0 ) );
-
-
-        RealType k = 2.495*pow( 400.0, 1.5 ) / ( 400.0 + 194.0 );
-        e_t[ c ] += this->mu*( u1Viscosity->getDiffusion( c,
-                                                          this->u1, this->u1, this->u2,
-                                                          4.0/3.0, 1.0, -2.0/3.0 ) +
-                               u1Viscosity->getDiffusion( c,
-                                                          this->u1, this->u1, this->u2,
-                                                          0.0, 0.0, 1.0 ) +
-                               u2Viscosity->getDiffusion( c,
-                                                          this->u2, this->u2, this->u1,
-                                                          1.0, 4.0/3.0, -2.0/3.0 ) +
-                               u2Viscosity->getDiffusion( c,
-                                                          this->u2, this->u2, this->u1,
-                                                          0.0, 0.0, 1.0 ) +
-                               k * energyViscosity->getDiffusion( c, 1.0, 1.0, 0.0 ) );
-        */
-        rho_u1_t[ c ] += this->mu*( u1Viscosity->getDiffusion( c, 1.0, 1.0, 0.0 ) );
-        rho_u2_t[ c ] += this->mu*( u2Viscosity->getDiffusion( c, 1.0, 1.0, 0.0 ) );
-
-
-        RealType k = 2.495*pow( 400.0, 1.5 ) / ( 400.0 + 194.0 );
-        //cout << k << std::endl;
-        /*e_t[ c ] += this->mu*( u1Viscosity->getDiffusion( c,
-                                                          this->u1, this->u1, this->u2,
-                                                          1.0, 1.0, 0.0 ) +
-                               u2Viscosity->getDiffusion( c,
-                                                          this->u2, this->u2, this->u1,
-                                                          1.0, 1.0, -0.0 ) );*/
-                               //energyViscosity->getDiffusion( c, 1.0, 1.0, 0.0 ) );
-
-
-        //e_t[ c ] = 0.0;
-     }
-
-}
-
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
-bool NavierStokesSolver< AdvectionScheme,
-                      DiffusionScheme,
-                      BoundaryConditions >::writePhysicalVariables( const RealType& t,
-                                                                    const IndexType step )
+         rho_u1_t[ c ] += this->mu * ( u1Viscosity->getDiffusion( c, 1.0, 1.0, 0.0 ) );
+         rho_u2_t[ c ] += this->mu * ( u2Viscosity->getDiffusion( c, 1.0, 1.0, 0.0 ) );
+
+         RealType k = 2.495 * pow( 400.0, 1.5 ) / ( 400.0 + 194.0 );
+         // cout << k << std::endl;
+         /*e_t[ c ] += this->mu*( u1Viscosity->getDiffusion( c,
+                                                           this->u1, this->u1, this->u2,
+                                                           1.0, 1.0, 0.0 ) +
+                                u2Viscosity->getDiffusion( c,
+                                                           this->u2, this->u2, this->u1,
+                                                           1.0, 1.0, -0.0 ) );*/
+         // energyViscosity->getDiffusion( c, 1.0, 1.0, 0.0 ) );
+
+         // e_t[ c ] = 0.0;
+      }
+}
+
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
+bool
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::writePhysicalVariables( const RealType& t,
+                                                                                                    const IndexType step )
 {
    SharedVector< RealType, DeviceType, IndexType > dofs_rho, dofs_rho_u1, dofs_rho_u2, dofs_e;
    const IndexType& dofs = mesh->getDofs();
-   dofs_rho.    bind( & dofVector.getData()[ 0        ], dofs );
-   dofs_rho_u1. bind( & dofVector.getData()[     dofs ], dofs );
-   dofs_rho_u2. bind( & dofVector.getData()[ 2 * dofs ], dofs );
-   dofs_e.      bind( & dofVector.getData()[ 3 * dofs ], dofs );
+   dofs_rho.bind( &dofVector.getData()[ 0 ], dofs );
+   dofs_rho_u1.bind( &dofVector.getData()[ dofs ], dofs );
+   dofs_rho_u2.bind( &dofVector.getData()[ 2 * dofs ], dofs );
+   dofs_e.bind( &dofVector.getData()[ 3 * dofs ], dofs );
 
    this->updatePhysicalQuantities( dofs_rho, dofs_rho_u1, dofs_rho_u2, dofs_e );
    Vector< StaticVector< 2, RealType >, DeviceType, IndexType > u;
-   u. setLike( u1 );
+   u.setLike( u1 );
    String fileName;
 
-   for( IndexType i = 0; i < this->u1. getSize(); i ++ )
+   for( IndexType i = 0; i < this->u1.getSize(); i++ )
       u[ i ] = StaticVector< 2, RealType >( this->u1[ i ], this->u2[ i ] );
    FileNameBaseNumberEnding( "u-", step, 5, ".tnl", fileName );
    if( ! u.save( fileName ) )
@@ -531,97 +447,83 @@ bool NavierStokesSolver< AdvectionScheme,
    return true;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
-bool NavierStokesSolver< AdvectionScheme,
-                      DiffusionScheme,
-                      BoundaryConditions >::writeConservativeVariables( const RealType& t,
-                                                                        const IndexType step )
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
+bool
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::writeConservativeVariables( const RealType& t,
+                                                                                                        const IndexType step )
 {
    SharedVector< RealType, DeviceType, IndexType > dofs_rho, dofs_rho_u1, dofs_rho_u2, dofs_e;
 
    const IndexType& dofs = mesh->getDofs();
-   dofs_rho.    bind( & dofVector.getData()[ 0        ], dofs );
-   dofs_rho_u1. bind( & dofVector.getData()[     dofs ], dofs );
-   dofs_rho_u2. bind( & dofVector.getData()[ 2 * dofs ], dofs );
-   dofs_e.      bind( & dofVector.getData()[ 3 * dofs ], dofs );
+   dofs_rho.bind( &dofVector.getData()[ 0 ], dofs );
+   dofs_rho_u1.bind( &dofVector.getData()[ dofs ], dofs );
+   dofs_rho_u2.bind( &dofVector.getData()[ 2 * dofs ], dofs );
+   dofs_e.bind( &dofVector.getData()[ 3 * dofs ], dofs );
 
    String fileName;
    FileNameBaseNumberEnding( "rho-", step, 5, ".tnl", fileName );
-   if( ! dofs_rho. save( fileName ) )
+   if( ! dofs_rho.save( fileName ) )
       return false;
 
    FileNameBaseNumberEnding( "rho-u1-", step, 5, ".tnl", fileName );
-   if( ! dofs_rho_u1. save( fileName ) )
+   if( ! dofs_rho_u1.save( fileName ) )
       return false;
 
    FileNameBaseNumberEnding( "rho-u2-", step, 5, ".tnl", fileName );
-   if( ! dofs_rho_u2. save( fileName ) )
+   if( ! dofs_rho_u2.save( fileName ) )
       return false;
 
    FileNameBaseNumberEnding( "e-", step, 5, ".tnl", fileName );
-   if( ! dofs_e. save( fileName ) )
+   if( ! dofs_e.save( fileName ) )
       return false;
    return true;
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
-typename NavierStokesSolver< AdvectionScheme,
-                                DiffusionScheme,
-                                BoundaryConditions >::RealType
-   NavierStokesSolver< AdvectionScheme,
-                          DiffusionScheme,
-                          BoundaryConditions >::computeEnergy( const RealType& rho,
-                                                               const RealType& pressure,
-                                                               const RealType& gamma,
-                                                               const RealType& u1,
-                                                               const RealType& u2 ) const
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
+typename NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::RealType
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::computeEnergy( const RealType& rho,
+                                                                                           const RealType& pressure,
+                                                                                           const RealType& gamma,
+                                                                                           const RealType& u1,
+                                                                                           const RealType& u2 ) const
 {
    /*return rho * this->R * temperature / ( gamma - 1.0 ) +
                   0.5 * rho * ( u1*u1 + u2*u2 );*/
-   return pressure / ( gamma - 1.0 ) +
-                  0.5 * rho * ( u1*u1 + u2*u2 );
-
+   return pressure / ( gamma - 1.0 ) + 0.5 * rho * ( u1 * u1 + u2 * u2 );
 }
 
-template< typename AdvectionScheme,
-          typename DiffusionScheme,
-          typename BoundaryConditions >
-   template< typename DofVector >
-bool NavierStokesSolver< AdvectionScheme,
-                      DiffusionScheme,
-                      BoundaryConditions >::writeExplicitRhs( const RealType& t,
-                                                              const IndexType step,
-                                                              DofVector& rhs )
+template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions >
+template< typename DofVector >
+bool
+NavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::writeExplicitRhs( const RealType& t,
+                                                                                              const IndexType step,
+                                                                                              DofVector& rhs )
 {
    SharedVector< RealType, DeviceType, IndexType > dofs_rho, dofs_rho_u1, dofs_rho_u2, dofs_e;
 
    const IndexType& dofs = mesh->getDofs();
-   dofs_rho.    bind( & rhs.getData()[ 0        ], dofs );
-   dofs_rho_u1. bind( & rhs.getData()[     dofs ], dofs );
-   dofs_rho_u2. bind( & rhs.getData()[ 2 * dofs ], dofs );
-   dofs_e.      bind( & rhs.getData()[ 3 * dofs ], dofs );
+   dofs_rho.bind( &rhs.getData()[ 0 ], dofs );
+   dofs_rho_u1.bind( &rhs.getData()[ dofs ], dofs );
+   dofs_rho_u2.bind( &rhs.getData()[ 2 * dofs ], dofs );
+   dofs_e.bind( &rhs.getData()[ 3 * dofs ], dofs );
 
    String fileName;
    FileNameBaseNumberEnding( "rho-t-", step, 5, ".tnl", fileName );
-   if( ! dofs_rho. save( fileName ) )
+   if( ! dofs_rho.save( fileName ) )
       return false;
 
    FileNameBaseNumberEnding( "rho-u1-t-", step, 5, ".tnl", fileName );
-   if( ! dofs_rho_u1. save( fileName ) )
+   if( ! dofs_rho_u1.save( fileName ) )
       return false;
 
    FileNameBaseNumberEnding( "rho-u2-t-", step, 5, ".tnl", fileName );
-   if( ! dofs_rho_u2. save( fileName ) )
+   if( ! dofs_rho_u2.save( fileName ) )
       return false;
 
    FileNameBaseNumberEnding( "e-t-", step, 5, ".tnl", fileName );
-   if( ! dofs_e. save( fileName ) )
+   if( ! dofs_e.save( fileName ) )
       return false;
    return true;
 }
 
-} // namespace TNL
+}  // namespace TNL
diff --git a/src/TNL/Solvers/BuildConfigTags.h b/src/TNL/Solvers/BuildConfigTags.h
index 7f285592fabe0b17d8cad142c80c20ed69223057..f65bf8d15ee4c4e085855e5237126f7534c396fb 100644
--- a/src/TNL/Solvers/BuildConfigTags.h
+++ b/src/TNL/Solvers/BuildConfigTags.h
@@ -12,42 +12,70 @@
 namespace TNL {
 namespace Solvers {
 
-class DefaultBuildConfigTag {};
+class DefaultBuildConfigTag
+{};
 
 /****
  * All devices are enabled by default. Those which are not available
  * are disabled.
  */
-template< typename ConfigTag, typename Device > struct ConfigTagDevice{ static constexpr bool enabled = true; };
+template< typename ConfigTag, typename Device >
+struct ConfigTagDevice
+{
+   static constexpr bool enabled = true;
+};
 #ifndef HAVE_CUDA
-template< typename ConfigTag > struct ConfigTagDevice< ConfigTag, Devices::Cuda >{ static constexpr bool enabled = false; };
+template< typename ConfigTag >
+struct ConfigTagDevice< ConfigTag, Devices::Cuda >
+{
+   static constexpr bool enabled = false;
+};
 #endif
 
 /****
  * All real types are enabled by default.
  */
-template< typename ConfigTag, typename Real > struct ConfigTagReal{ static constexpr bool enabled = true; };
+template< typename ConfigTag, typename Real >
+struct ConfigTagReal
+{
+   static constexpr bool enabled = true;
+};
 
 /****
  * All index types are enabled by default.
  */
-template< typename ConfigTag, typename Index > struct ConfigTagIndex{ static constexpr bool enabled = true; };
+template< typename ConfigTag, typename Index >
+struct ConfigTagIndex
+{
+   static constexpr bool enabled = true;
+};
 
 /****
  * The mesh type will be resolved by the Solver by default.
  * (The detailed mesh configuration is in TNL/Meshes/TypeResolver/BuildConfigTags.h)
  */
-template< typename ConfigTag > struct ConfigTagMeshResolve{ static constexpr bool enabled = true; };
+template< typename ConfigTag >
+struct ConfigTagMeshResolve
+{
+   static constexpr bool enabled = true;
+};
 
 /****
  * All time discretisations (explicit, semi-impicit and implicit ) are
  * enabled by default.
  */
-class ExplicitTimeDiscretisationTag{};
-class SemiImplicitTimeDiscretisationTag{};
-class ImplicitTimeDiscretisationTag{};
+class ExplicitTimeDiscretisationTag
+{};
+class SemiImplicitTimeDiscretisationTag
+{};
+class ImplicitTimeDiscretisationTag
+{};
 
-template< typename ConfigTag, typename TimeDiscretisation > struct ConfigTagTimeDiscretisation{ static constexpr bool enabled = true; };
+template< typename ConfigTag, typename TimeDiscretisation >
+struct ConfigTagTimeDiscretisation
+{
+   static constexpr bool enabled = true;
+};
 
 /****
  * All explicit solvers are enabled by default
@@ -55,18 +83,22 @@ template< typename ConfigTag, typename TimeDiscretisation > struct ConfigTagTime
 class ExplicitEulerSolverTag
 {
 public:
-    template< typename Problem, typename SolverMonitor >
-    using Template = ODE::Euler< Problem, SolverMonitor >;
+   template< typename Problem, typename SolverMonitor >
+   using Template = ODE::Euler< Problem, SolverMonitor >;
 };
 
 class ExplicitMersonSolverTag
 {
 public:
-    template< typename Problem, typename SolverMonitor >
-    using Template = ODE::Merson< Problem, SolverMonitor >;
+   template< typename Problem, typename SolverMonitor >
+   using Template = ODE::Merson< Problem, SolverMonitor >;
 };
 
-template< typename ConfigTag, typename ExplicitSolver > struct ConfigTagExplicitSolver{ static constexpr bool enabled = true; };
+template< typename ConfigTag, typename ExplicitSolver >
+struct ConfigTagExplicitSolver
+{
+   static constexpr bool enabled = true;
+};
 
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/FastBuildConfigTag.h b/src/TNL/Solvers/FastBuildConfigTag.h
index adddc77dcac24e2bea05e25c66cfe02f2e0b07ea..a7c2230648621a7399b1eaa7a89ee65e2fa14f8a 100644
--- a/src/TNL/Solvers/FastBuildConfigTag.h
+++ b/src/TNL/Solvers/FastBuildConfigTag.h
@@ -12,33 +12,63 @@
 namespace TNL {
 namespace Solvers {
 
-class FastBuildConfigTag {};
+class FastBuildConfigTag
+{};
 
 /****
  * Turn off support for float and long double.
  */
-template<> struct ConfigTagReal< FastBuildConfigTag, float > { static constexpr bool enabled = false; };
-template<> struct ConfigTagReal< FastBuildConfigTag, long double > { static constexpr bool enabled = false; };
+template<>
+struct ConfigTagReal< FastBuildConfigTag, float >
+{
+   static constexpr bool enabled = false;
+};
+template<>
+struct ConfigTagReal< FastBuildConfigTag, long double >
+{
+   static constexpr bool enabled = false;
+};
 
 /****
  * Turn off support for short int and long int indexing.
  */
-template<> struct ConfigTagIndex< FastBuildConfigTag, short int >{ static constexpr bool enabled = false; };
-template<> struct ConfigTagIndex< FastBuildConfigTag, long int >{ static constexpr bool enabled = false; };
+template<>
+struct ConfigTagIndex< FastBuildConfigTag, short int >
+{
+   static constexpr bool enabled = false;
+};
+template<>
+struct ConfigTagIndex< FastBuildConfigTag, long int >
+{
+   static constexpr bool enabled = false;
+};
 
 /****
  * Please, chose your preferred time discretisation  here.
  */
-template<> struct ConfigTagTimeDiscretisation< FastBuildConfigTag, ExplicitTimeDiscretisationTag >{ static constexpr bool enabled = true; };
-template<> struct ConfigTagTimeDiscretisation< FastBuildConfigTag, SemiImplicitTimeDiscretisationTag >{ static constexpr bool enabled = true; };
-template<> struct ConfigTagTimeDiscretisation< FastBuildConfigTag, ImplicitTimeDiscretisationTag >{ static constexpr bool enabled = false; };
+template<>
+struct ConfigTagTimeDiscretisation< FastBuildConfigTag, ExplicitTimeDiscretisationTag >
+{
+   static constexpr bool enabled = true;
+};
+template<>
+struct ConfigTagTimeDiscretisation< FastBuildConfigTag, SemiImplicitTimeDiscretisationTag >
+{
+   static constexpr bool enabled = true;
+};
+template<>
+struct ConfigTagTimeDiscretisation< FastBuildConfigTag, ImplicitTimeDiscretisationTag >
+{
+   static constexpr bool enabled = false;
+};
 
 /****
  * Only the Runge-Kutta-Merson solver is enabled by default.
  */
-//template<> struct ConfigTagExplicitSolver< FastBuildConfigTag, ExplicitEulerSolverTag >{ static constexpr bool enabled = false; };
+// template<> struct ConfigTagExplicitSolver< FastBuildConfigTag, ExplicitEulerSolverTag >{ static constexpr bool enabled =
+// false; };
 
-} // namespace Solvers
+}  // namespace Solvers
 
 namespace Meshes {
 namespace BuildConfigTags {
@@ -46,15 +76,31 @@ namespace BuildConfigTags {
 /****
  * Turn off support for float and long double.
  */
-template<> struct GridRealTag< Solvers::FastBuildConfigTag, float > { static constexpr bool enabled = false; };
-template<> struct GridRealTag< Solvers::FastBuildConfigTag, long double > { static constexpr bool enabled = false; };
+template<>
+struct GridRealTag< Solvers::FastBuildConfigTag, float >
+{
+   static constexpr bool enabled = false;
+};
+template<>
+struct GridRealTag< Solvers::FastBuildConfigTag, long double >
+{
+   static constexpr bool enabled = false;
+};
 
 /****
  * Turn off support for short int and long int indexing.
  */
-template<> struct GridIndexTag< Solvers::FastBuildConfigTag, short int >{ static constexpr bool enabled = false; };
-template<> struct GridIndexTag< Solvers::FastBuildConfigTag, long int >{ static constexpr bool enabled = false; };
+template<>
+struct GridIndexTag< Solvers::FastBuildConfigTag, short int >
+{
+   static constexpr bool enabled = false;
+};
+template<>
+struct GridIndexTag< Solvers::FastBuildConfigTag, long int >
+{
+   static constexpr bool enabled = false;
+};
 
-} // namespace BuildConfigTags
-} // namespace Meshes
-} // namespace TNL
+}  // namespace BuildConfigTags
+}  // namespace Meshes
+}  // namespace TNL
diff --git a/src/TNL/Solvers/IterativeSolver.h b/src/TNL/Solvers/IterativeSolver.h
index 2a29cd0f1dfd220a7c6353845245b3954367c68d..0b761360dd8d0e3c455c64d2c1f1f980c1293187 100644
--- a/src/TNL/Solvers/IterativeSolver.h
+++ b/src/TNL/Solvers/IterativeSolver.h
@@ -13,7 +13,7 @@
 #include <TNL/Solvers/IterativeSolverMonitor.h>
 
 namespace TNL {
-   namespace Solvers {
+namespace Solvers {
 
 /**
  * \brief Base class for iterative solvers.
@@ -22,216 +22,230 @@ namespace TNL {
  * \tparam Index is an indexing type.
  * \tparam IterativeSolverMonitor< Real, Index > is type of an object used for monitoring of the convergence.
  */
-template< typename Real,
-          typename Index,
-          typename SolverMonitor = IterativeSolverMonitor< Real, Index > >
+template< typename Real, typename Index, typename SolverMonitor = IterativeSolverMonitor< Real, Index > >
 class IterativeSolver
 {
-   public:
-
-      /**
-       * \brief Type of an object used for monitoring of the convergence.
-       */
-      using SolverMonitorType = SolverMonitor;
-
-      /**
-       * \brief Default constructor.
-       */
-      IterativeSolver() = default;
-
-      /**
-       * \brief This method defines configuration entries for setup of the iterative solver.
-       *
-       * The following entries are defined:
-       *
-       * \e max-iterations - maximal number of iterations the solver \b may perform.
-       *
-       * \e min-iterations - minimal number of iterations the solver \b must perform.
-       *
-       * \e convergence-residue - convergence occurs when the residue drops \b bellow this limit.
-       *
-       * \e divergence-residue - divergence occurs when the residue \b exceeds given limit.
-       *
-       * \e refresh-rate - number of milliseconds between solver monitor refreshes.
-       *
-       * \e residual-history-file - path to the file where the residual history will be saved.
-       *
-       * \param config contains description of configuration parameters.
-       * \param prefix is a prefix of particular configuration entries.
-       */
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" );
-
-      /**
-       * \brief Method for setup of the iterative solver based on configuration parameters.
-       *
-       * \param parameters contains values of the define configuration entries.
-       * \param prefix is a prefix of particular configuration entries.
-       */
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" );
-
-      /**
-       * \brief Sets the maximal number of iterations the solver is \b allowed to perform.
-       *
-       * If the number of iterations performed by the solver exceeds given limit, the divergence occurs.
-       *
-       * \param maxIterations maximal number of allowed iterations.
-       */
-      void setMaxIterations( const Index& maxIterations );
-
-      /**
-       * \brief Gets the maximal number of iterations the solver is \b allowed to perform.
-       *
-       * See \ref IterativeSolver::setMaxIterations.
-       *
-       * \return maximal number of allowed iterations.
-       */
-      const Index& getMaxIterations() const;
-
-      /**
-       * \brief Sets the minimal number of iterations the solver is \b supposed to do.
-       *
-       * \param minIterations minimal number of iterations the solver is supposed to do.
-       */
-      void setMinIterations( const Index& minIterations );
-
-      /**
-       * \brief Gets the minimal number of iterations the solver is \b supposed to do.
-       *
-       * \return minimal number of iterations the solver is supposed to do.
-       */
-      const Index& getMinIterations() const;
-
-      /**
-       * \brief Gets the number of iterations performed by the solver so far.
-       *
-       * \return number of iterations performed so far.
-       */
-      const Index& getIterations() const;
-
-      /**
-       * \brief Sets the threshold for the convergence.
-       *
-       * The convergence occurs when the residue drops \b bellow this limit.
-       *
-       * \param convergenceResidue is threshold for the convergence.
-       */
-      void setConvergenceResidue( const Real& convergenceResidue );
-
-      /**
-       * \brief Gets the the convergence threshold.
-       *
-       * See \ref IterativeSolver::setConvergenceResidue.
-       *
-       * \return the convergence threshold.
-       */
-      const Real& getConvergenceResidue() const;
-
-      /**
-       * \brief Sets the residue limit for the divergence criterion.
-       *
-       * The divergence occurs when the residue \b exceeds the limit.
-       *
-       * \param divergenceResidue the residue limit of the divergence.
-       */
-      void setDivergenceResidue( const Real& divergenceResidue );
-
-      /**
-       * \brief Gets the limit for the divergence criterion.
-       *
-       * See \ref IterativeSolver::setDivergenceResidue.
-       *
-       * \return the residue limit fo the divergence.
-       */
-      const Real& getDivergenceResidue() const;
-
-      /**
-       * \brief Sets the residue reached at the current iteration.
-       *
-       * \param residue reached at the current iteration.
-       */
-      void setResidue( const Real& residue );
-
-      /**
-       * \brief Gets the residue reached at the current iteration.
-       *
-       * \return residue reached at the current iteration.
-       */
-      const Real& getResidue() const;
-
-      /**
-       * \brief Sets the refresh rate (in milliseconds) for the solver monitor.
-       *
-       * \param refreshRate of the solver monitor in milliseconds.
-       */
-      void setRefreshRate( const Index& refreshRate );
-
-      /**
-       * \brief Sets the solver monitor object.
-       *
-       * The solver monitor is an object for monitoring the status of the iterative solver.
-       * Usually it prints the number of iterations, current residue or elapsed time.
-       *
-       * \param solverMonitor is an object for monitoring the iterative solver.
-       */
-      void setSolverMonitor( SolverMonitorType& solverMonitor );
-
-      /**
-       * \brief Sets the the number of the current iterations to zero.
-       */
-      void resetIterations();
-
-      /**
-       * \brief Proceeds to the next iteration.
-       *
-       * \return \e true if the solver is allowed to do the next iteration.
-       * \return \e false if the solver is \b not allowed to do the next iteration. This may
-       *    happen because the divergence occurred.
-       */
-      bool nextIteration();
-
-      /**
-       * \brief Checks if the solver is allowed to the next iteration.
-       *
-       * \return true \e true if the solver is allowed to do the next iteration.
-       * \return \e false if the solver is \b not allowed to do the next iteration. This may
-       *    happen because the divergence occurred.
-       */
-      bool checkNextIteration();
-
-      /**
-       * \brief Checks whether the convergence occurred already.
-       *
-       * \return \e true if the convergence already occured.
-       * \return \e false if the convergence did not occur yet.
-       */
-      bool checkConvergence();
-
-   protected:
-      Index maxIterations = 1000000000;
-
-      Index minIterations = 0;
-
-      Index currentIteration = 0;
-
-      Real convergenceResidue = 1e-6;
-
-      // If the current residue is greater than divergenceResidue, the solver is stopped.
-      Real divergenceResidue = std::numeric_limits< Real >::max();
-
-      Real currentResidue = 0;
-
-      SolverMonitor* solverMonitor = nullptr;
-
-      Index refreshRate = 1;
-
-      String residualHistoryFileName = "";
-
-      std::ofstream residualHistoryFile;
+public:
+   /**
+    * \brief Type of an object used for monitoring of the convergence.
+    */
+   using SolverMonitorType = SolverMonitor;
+
+   /**
+    * \brief Default constructor.
+    */
+   IterativeSolver() = default;
+
+   /**
+    * \brief This method defines configuration entries for setup of the iterative solver.
+    *
+    * The following entries are defined:
+    *
+    * \e max-iterations - maximal number of iterations the solver \b may perform.
+    *
+    * \e min-iterations - minimal number of iterations the solver \b must perform.
+    *
+    * \e convergence-residue - convergence occurs when the residue drops \b bellow this limit.
+    *
+    * \e divergence-residue - divergence occurs when the residue \b exceeds given limit.
+    *
+    * \e refresh-rate - number of milliseconds between solver monitor refreshes.
+    *
+    * \e residual-history-file - path to the file where the residual history will be saved.
+    *
+    * \param config contains description of configuration parameters.
+    * \param prefix is a prefix of particular configuration entries.
+    */
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" );
+
+   /**
+    * \brief Method for setup of the iterative solver based on configuration parameters.
+    *
+    * \param parameters contains values of the define configuration entries.
+    * \param prefix is a prefix of particular configuration entries.
+    */
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
+
+   /**
+    * \brief Sets the maximal number of iterations the solver is \b allowed to perform.
+    *
+    * If the number of iterations performed by the solver exceeds given limit, the divergence occurs.
+    *
+    * \param maxIterations maximal number of allowed iterations.
+    */
+   void
+   setMaxIterations( const Index& maxIterations );
+
+   /**
+    * \brief Gets the maximal number of iterations the solver is \b allowed to perform.
+    *
+    * See \ref IterativeSolver::setMaxIterations.
+    *
+    * \return maximal number of allowed iterations.
+    */
+   const Index&
+   getMaxIterations() const;
+
+   /**
+    * \brief Sets the minimal number of iterations the solver is \b supposed to do.
+    *
+    * \param minIterations minimal number of iterations the solver is supposed to do.
+    */
+   void
+   setMinIterations( const Index& minIterations );
+
+   /**
+    * \brief Gets the minimal number of iterations the solver is \b supposed to do.
+    *
+    * \return minimal number of iterations the solver is supposed to do.
+    */
+   const Index&
+   getMinIterations() const;
+
+   /**
+    * \brief Gets the number of iterations performed by the solver so far.
+    *
+    * \return number of iterations performed so far.
+    */
+   const Index&
+   getIterations() const;
+
+   /**
+    * \brief Sets the threshold for the convergence.
+    *
+    * The convergence occurs when the residue drops \b bellow this limit.
+    *
+    * \param convergenceResidue is threshold for the convergence.
+    */
+   void
+   setConvergenceResidue( const Real& convergenceResidue );
+
+   /**
+    * \brief Gets the the convergence threshold.
+    *
+    * See \ref IterativeSolver::setConvergenceResidue.
+    *
+    * \return the convergence threshold.
+    */
+   const Real&
+   getConvergenceResidue() const;
+
+   /**
+    * \brief Sets the residue limit for the divergence criterion.
+    *
+    * The divergence occurs when the residue \b exceeds the limit.
+    *
+    * \param divergenceResidue the residue limit of the divergence.
+    */
+   void
+   setDivergenceResidue( const Real& divergenceResidue );
+
+   /**
+    * \brief Gets the limit for the divergence criterion.
+    *
+    * See \ref IterativeSolver::setDivergenceResidue.
+    *
+    * \return the residue limit fo the divergence.
+    */
+   const Real&
+   getDivergenceResidue() const;
+
+   /**
+    * \brief Sets the residue reached at the current iteration.
+    *
+    * \param residue reached at the current iteration.
+    */
+   void
+   setResidue( const Real& residue );
+
+   /**
+    * \brief Gets the residue reached at the current iteration.
+    *
+    * \return residue reached at the current iteration.
+    */
+   const Real&
+   getResidue() const;
+
+   /**
+    * \brief Sets the refresh rate (in milliseconds) for the solver monitor.
+    *
+    * \param refreshRate of the solver monitor in milliseconds.
+    */
+   void
+   setRefreshRate( const Index& refreshRate );
+
+   /**
+    * \brief Sets the solver monitor object.
+    *
+    * The solver monitor is an object for monitoring the status of the iterative solver.
+    * Usually it prints the number of iterations, current residue or elapsed time.
+    *
+    * \param solverMonitor is an object for monitoring the iterative solver.
+    */
+   void
+   setSolverMonitor( SolverMonitorType& solverMonitor );
+
+   /**
+    * \brief Sets the the number of the current iterations to zero.
+    */
+   void
+   resetIterations();
+
+   /**
+    * \brief Proceeds to the next iteration.
+    *
+    * \return \e true if the solver is allowed to do the next iteration.
+    * \return \e false if the solver is \b not allowed to do the next iteration. This may
+    *    happen because the divergence occurred.
+    */
+   bool
+   nextIteration();
+
+   /**
+    * \brief Checks if the solver is allowed to the next iteration.
+    *
+    * \return true \e true if the solver is allowed to do the next iteration.
+    * \return \e false if the solver is \b not allowed to do the next iteration. This may
+    *    happen because the divergence occurred.
+    */
+   bool
+   checkNextIteration();
+
+   /**
+    * \brief Checks whether the convergence occurred already.
+    *
+    * \return \e true if the convergence already occured.
+    * \return \e false if the convergence did not occur yet.
+    */
+   bool
+   checkConvergence();
+
+protected:
+   Index maxIterations = 1000000000;
+
+   Index minIterations = 0;
+
+   Index currentIteration = 0;
+
+   Real convergenceResidue = 1e-6;
+
+   // If the current residue is greater than divergenceResidue, the solver is stopped.
+   Real divergenceResidue = std::numeric_limits< Real >::max();
+
+   Real currentResidue = 0;
+
+   SolverMonitor* solverMonitor = nullptr;
+
+   Index refreshRate = 1;
+
+   String residualHistoryFileName = "";
+
+   std::ofstream residualHistoryFile;
 };
 
-   } // namespace Solvers
-} // namespace TNL
+}  // namespace Solvers
+}  // namespace TNL
 
 #include <TNL/Solvers/IterativeSolver.hpp>
diff --git a/src/TNL/Solvers/IterativeSolver.hpp b/src/TNL/Solvers/IterativeSolver.hpp
index 0c9960f1474cb0e3dfc0966b93b985b33fa369fd..9bcf6dec36bd3c59f5e05645d86c32643313bcfc 100644
--- a/src/TNL/Solvers/IterativeSolver.hpp
+++ b/src/TNL/Solvers/IterativeSolver.hpp
@@ -15,32 +15,32 @@ namespace Solvers {
 
 template< typename Real, typename Index, typename SolverMonitor >
 void
-IterativeSolver< Real, Index, SolverMonitor >::
-configSetup( Config::ConfigDescription& config,
-             const String& prefix )
+IterativeSolver< Real, Index, SolverMonitor >::configSetup( Config::ConfigDescription& config, const String& prefix )
 {
    if( config.getEntry( prefix + "max-iterations" ) == nullptr )
-      config.addEntry< int >   ( prefix + "max-iterations", "Maximal number of iterations the solver may perform.", 1000000000 );
+      config.addEntry< int >( prefix + "max-iterations", "Maximal number of iterations the solver may perform.", 1000000000 );
    if( config.getEntry( prefix + "min-iterations" ) == nullptr )
-      config.addEntry< int >   ( prefix + "min-iterations", "Minimal number of iterations the solver must perform.", 0 );
+      config.addEntry< int >( prefix + "min-iterations", "Minimal number of iterations the solver must perform.", 0 );
 
    if( config.getEntry( prefix + "convergence-residue" ) == nullptr )
-      config.addEntry< double >( prefix + "convergence-residue", "Convergence occurs when the residue drops bellow this limit.", 1e-6 );
+      config.addEntry< double >(
+         prefix + "convergence-residue", "Convergence occurs when the residue drops bellow this limit.", 1e-6 );
    if( config.getEntry( prefix + "divergence-residue" ) == nullptr )
-      config.addEntry< double >( prefix + "divergence-residue", "Divergence occurs when the residue exceeds given limit.", std::numeric_limits< float >::max() );
+      config.addEntry< double >( prefix + "divergence-residue",
+                                 "Divergence occurs when the residue exceeds given limit.",
+                                 std::numeric_limits< float >::max() );
    // TODO: setting refresh rate should be done in SolverStarter::setup (it's not a parameter of the IterativeSolver)
    if( config.getEntry( prefix + "refresh-rate" ) == nullptr )
-      config.addEntry< int >   ( prefix + "refresh-rate", "Number of milliseconds between solver monitor refreshes.", 500 );
+      config.addEntry< int >( prefix + "refresh-rate", "Number of milliseconds between solver monitor refreshes.", 500 );
 
    if( config.getEntry( prefix + "residual-history-file" ) == nullptr )
-      config.addEntry< String >( prefix + "residual-history-file", "Path to the file where the residual history will be saved.", "" );
+      config.addEntry< String >(
+         prefix + "residual-history-file", "Path to the file where the residual history will be saved.", "" );
 }
 
 template< typename Real, typename Index, typename SolverMonitor >
 bool
-IterativeSolver< Real, Index, SolverMonitor >::
-setup( const Config::ParameterContainer& parameters,
-       const String& prefix )
+IterativeSolver< Real, Index, SolverMonitor >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    if( parameters.checkParameter( prefix + "max-iterations" ) )
       this->setMaxIterations( parameters.getParameter< int >( prefix + "max-iterations" ) );
@@ -63,40 +63,35 @@ setup( const Config::ParameterContainer& parameters,
 
 template< typename Real, typename Index, typename SolverMonitor >
 void
-IterativeSolver< Real, Index, SolverMonitor >::
-setMaxIterations( const Index& maxIterations )
+IterativeSolver< Real, Index, SolverMonitor >::setMaxIterations( const Index& maxIterations )
 {
    this->maxIterations = maxIterations;
 }
 
 template< typename Real, typename Index, typename SolverMonitor >
 const Index&
-IterativeSolver< Real, Index, SolverMonitor >::
-getMaxIterations() const
+IterativeSolver< Real, Index, SolverMonitor >::getMaxIterations() const
 {
    return this->maxIterations;
 }
 
 template< typename Real, typename Index, typename SolverMonitor >
 void
-IterativeSolver< Real, Index, SolverMonitor >::
-setMinIterations( const Index& minIterations )
+IterativeSolver< Real, Index, SolverMonitor >::setMinIterations( const Index& minIterations )
 {
    this->minIterations = minIterations;
 }
 
 template< typename Real, typename Index, typename SolverMonitor >
 const Index&
-IterativeSolver< Real, Index, SolverMonitor >::
-getMinIterations() const
+IterativeSolver< Real, Index, SolverMonitor >::getMinIterations() const
 {
    return this->minIterations;
 }
 
 template< typename Real, typename Index, typename SolverMonitor >
 void
-IterativeSolver< Real, Index, SolverMonitor >::
-resetIterations()
+IterativeSolver< Real, Index, SolverMonitor >::resetIterations()
 {
    this->currentIteration = 0;
    if( this->solverMonitor )
@@ -105,14 +100,12 @@ resetIterations()
 
 template< typename Real, typename Index, typename SolverMonitor >
 bool
-IterativeSolver< Real, Index, SolverMonitor >::
-nextIteration()
+IterativeSolver< Real, Index, SolverMonitor >::nextIteration()
 {
    // this->checkNextIteration() must be called before the iteration counter is incremented
    bool result = this->checkNextIteration();
    this->currentIteration++;
-   if( this->solverMonitor )
-   {
+   if( this->solverMonitor ) {
       this->solverMonitor->setIterations( this->getIterations() );
    }
    return result;
@@ -120,41 +113,38 @@ nextIteration()
 
 template< typename Real, typename Index, typename SolverMonitor >
 bool
-IterativeSolver< Real, Index, SolverMonitor >::
-checkNextIteration()
+IterativeSolver< Real, Index, SolverMonitor >::checkNextIteration()
 {
-   if( std::isnan( this->getResidue() ) ||
-       this->getIterations() > this->getMaxIterations()  ||
-       ( this->getResidue() > this->getDivergenceResidue() && this->getIterations() >= this->getMinIterations() ) ||
-       ( this->getResidue() < this->getConvergenceResidue() && this->getIterations() >= this->getMinIterations() ) )
+   if( std::isnan( this->getResidue() ) || this->getIterations() > this->getMaxIterations()
+       || ( this->getResidue() > this->getDivergenceResidue() && this->getIterations() >= this->getMinIterations() )
+       || ( this->getResidue() < this->getConvergenceResidue() && this->getIterations() >= this->getMinIterations() ) )
       return false;
    return true;
 }
 
 template< typename Real, typename Index, typename SolverMonitor >
 bool
-IterativeSolver< Real, Index, SolverMonitor >::
-checkConvergence()
+IterativeSolver< Real, Index, SolverMonitor >::checkConvergence()
 {
-   if( std::isnan( this->getResidue() ) )
-   {
+   if( std::isnan( this->getResidue() ) ) {
       std::cerr << std::endl << "The residue is NaN." << std::endl;
       return false;
    }
-   if(( this->getResidue() > this->getDivergenceResidue() &&
-         this->getIterations() > this->minIterations ) )
-   {
-      std::cerr << std::endl  << "The residue has exceeded allowed tolerance " << this->getDivergenceResidue() << "." << std::endl;
+   if( ( this->getResidue() > this->getDivergenceResidue() && this->getIterations() > this->minIterations ) ) {
+      std::cerr << std::endl
+                << "The residue has exceeded allowed tolerance " << this->getDivergenceResidue() << "." << std::endl;
       return false;
    }
-   if( this->getIterations() >= this->getMaxIterations() )
-   {
-      std::cerr << std::endl  << "The solver has exceeded maximal allowed number of iterations " << this->getMaxIterations() << "." << std::endl;
+   if( this->getIterations() >= this->getMaxIterations() ) {
+      std::cerr << std::endl
+                << "The solver has exceeded maximal allowed number of iterations " << this->getMaxIterations() << "."
+                << std::endl;
       return false;
    }
-   if( this->getResidue() > this->getConvergenceResidue() )
-   {
-      std::cerr << std::endl  << "The residue ( = " << this->getResidue() << " ) is too large( > " << this->getConvergenceResidue() << " )." << std::endl;
+   if( this->getResidue() > this->getConvergenceResidue() ) {
+      std::cerr << std::endl
+                << "The residue ( = " << this->getResidue() << " ) is too large( > " << this->getConvergenceResidue() << " )."
+                << std::endl;
       return false;
    }
    return true;
@@ -162,48 +152,42 @@ checkConvergence()
 
 template< typename Real, typename Index, typename SolverMonitor >
 const Index&
-IterativeSolver< Real, Index, SolverMonitor >::
-getIterations() const
+IterativeSolver< Real, Index, SolverMonitor >::getIterations() const
 {
    return this->currentIteration;
 }
 
 template< typename Real, typename Index, typename SolverMonitor >
 void
-IterativeSolver< Real, Index, SolverMonitor >::
-setConvergenceResidue( const Real& convergenceResidue )
+IterativeSolver< Real, Index, SolverMonitor >::setConvergenceResidue( const Real& convergenceResidue )
 {
    this->convergenceResidue = convergenceResidue;
 }
 
 template< typename Real, typename Index, typename SolverMonitor >
 const Real&
-IterativeSolver< Real, Index, SolverMonitor >::
-getConvergenceResidue() const
+IterativeSolver< Real, Index, SolverMonitor >::getConvergenceResidue() const
 {
    return this->convergenceResidue;
 }
 
 template< typename Real, typename Index, typename SolverMonitor >
 void
-IterativeSolver< Real, Index, SolverMonitor >::
-setDivergenceResidue( const Real& divergenceResidue )
+IterativeSolver< Real, Index, SolverMonitor >::setDivergenceResidue( const Real& divergenceResidue )
 {
    this->divergenceResidue = divergenceResidue;
 }
 
 template< typename Real, typename Index, typename SolverMonitor >
 const Real&
-IterativeSolver< Real, Index, SolverMonitor >::
-getDivergenceResidue() const
+IterativeSolver< Real, Index, SolverMonitor >::getDivergenceResidue() const
 {
    return this->divergenceResidue;
 }
 
 template< typename Real, typename Index, typename SolverMonitor >
 void
-IterativeSolver< Real, Index, SolverMonitor >::
-setResidue( const Real& residue )
+IterativeSolver< Real, Index, SolverMonitor >::setResidue( const Real& residue )
 {
    this->currentResidue = residue;
    if( this->solverMonitor )
@@ -217,8 +201,7 @@ setResidue( const Real& residue )
 
 template< typename Real, typename Index, typename SolverMonitor >
 const Real&
-IterativeSolver< Real, Index, SolverMonitor >::
-getResidue() const
+IterativeSolver< Real, Index, SolverMonitor >::getResidue() const
 {
    return this->currentResidue;
 }
@@ -226,8 +209,7 @@ getResidue() const
 // TODO: setting refresh rate should be done in SolverStarter::setup (it's not a parameter of the IterativeSolver)
 template< typename Real, typename Index, typename SolverMonitor >
 void
-IterativeSolver< Real, Index, SolverMonitor >::
-setRefreshRate( const Index& refreshRate )
+IterativeSolver< Real, Index, SolverMonitor >::setRefreshRate( const Index& refreshRate )
 {
    this->refreshRate = refreshRate;
    if( this->solverMonitor )
@@ -236,12 +218,11 @@ setRefreshRate( const Index& refreshRate )
 
 template< typename Real, typename Index, typename SolverMonitor >
 void
-IterativeSolver< Real, Index, SolverMonitor >::
-setSolverMonitor( SolverMonitorType& solverMonitor )
+IterativeSolver< Real, Index, SolverMonitor >::setSolverMonitor( SolverMonitorType& solverMonitor )
 {
    this->solverMonitor = &solverMonitor;
    this->solverMonitor->setRefreshRate( this->refreshRate );
 }
 
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/IterativeSolverMonitor.h b/src/TNL/Solvers/IterativeSolverMonitor.h
index 0c6749505223bec7ea6242d05e3b03e9b3fbb388..2df9a0667cc2b70ae2e35a82d2f040cf0536e635 100644
--- a/src/TNL/Solvers/IterativeSolverMonitor.h
+++ b/src/TNL/Solvers/IterativeSolverMonitor.h
@@ -9,7 +9,7 @@
 #include <TNL/Solvers/SolverMonitor.h>
 
 namespace TNL {
-   namespace Solvers {
+namespace Solvers {
 
 /**
  * \brief Object for monitoring convergence of iterative solvers.
@@ -35,107 +35,121 @@ namespace TNL {
  *
  * \include IterativeLinearSolverWithTimerExample.out
  */
-template< typename Real = double,
-          typename Index = int >
+template< typename Real = double, typename Index = int >
 class IterativeSolverMonitor : public SolverMonitor
 {
-   public:
-
-      /**
-       * \brief A type of the floating-point arithmetics.
-       */
-      using RealType = Real;
-
-      /**
-       * \brief A type for indexing.
-       */
-      using IndexType = Index;
-
-      /**
-       * \brief Construct with no parameters.
-       */
-      IterativeSolverMonitor();
-
-      /**
-       * \brief This method can be used for naming a stage of the monitored solver.
-       *
-       * The stage name can be used to differ between various stages of iterative solvers.
-       *
-       * \param stage is name of the solver stage.
-       */
-      void setStage( const std::string& stage );
-
-      /**
-       * \brief Set the time of the simulated evolution if it is time dependent.
-       *
-       * This can be used for example when solving parabolic or hyperbolic PDEs.
-       *
-       * \param time time of the simulated evolution.
-       */
-      void setTime( const RealType& time );
-
-      /**
-       * \brief Set the time step for time dependent iterative solvers.
-       *
-       * \param timeStep time step of the time dependent iterative solver.
-       */
-      void setTimeStep( const RealType& timeStep );
-
-      /**
-       * \brief Set number of the current iteration.
-       *
-       * \param iterations is number of the current iteration.
-       */
-      void setIterations( const IndexType& iterations );
-
-      /**
-       * \brief Set residue of the current approximation of the solution.
-       *
-       * \param residue is a residue of the current approximation of the solution.
-       */
-      void setResidue( const RealType& residue );
-
-      /**
-       * \brief Set up the verbosity of the monitor.
-       *
-       * \param verbose is the new value of the verbosity of the monitor.
-       */
-      void setVerbose( const IndexType& verbose );
-
-      /**
-       * \brief Set the number of nodes of the numerical mesh or lattice.
-       *
-       * This can be used to compute the number of nodes processed per one second.
-       *
-       * \param nodes is number of nodes of the numerical mesh or lattice.
-       */
-      void setNodesPerIteration( const IndexType& nodes );
-
-      /**
-       * \brief Causes that the monitor prints out the status of the solver.
-       */
-      virtual void refresh();
-
-   protected:
-
-      int getLineWidth();
-
-      std::string stage, saved_stage;
-
-      std::atomic_bool saved, attributes_changed;
-
-      RealType time, saved_time, timeStep, saved_timeStep, residue, saved_residue, elapsed_time_before_refresh, last_mlups;
-      //TODO: Move MLUPS to LBM solver only i.e create solver monitor for LBM
-
-      IndexType iterations, saved_iterations, iterations_before_refresh;
-
-      // TODO: move verbose to SolverMonitor
-      IndexType verbose;
-
-      IndexType nodesPerIteration;
+public:
+   /**
+    * \brief A type of the floating-point arithmetics.
+    */
+   using RealType = Real;
+
+   /**
+    * \brief A type for indexing.
+    */
+   using IndexType = Index;
+
+   /**
+    * \brief Construct with no parameters.
+    */
+   IterativeSolverMonitor() = default;
+
+   /**
+    * \brief This method can be used for naming a stage of the monitored solver.
+    *
+    * The stage name can be used to differ between various stages of iterative solvers.
+    *
+    * \param stage is name of the solver stage.
+    */
+   void
+   setStage( const std::string& stage );
+
+   /**
+    * \brief Set the time of the simulated evolution if it is time dependent.
+    *
+    * This can be used for example when solving parabolic or hyperbolic PDEs.
+    *
+    * \param time time of the simulated evolution.
+    */
+   void
+   setTime( const RealType& time );
+
+   /**
+    * \brief Set the time step for time dependent iterative solvers.
+    *
+    * \param timeStep time step of the time dependent iterative solver.
+    */
+   void
+   setTimeStep( const RealType& timeStep );
+
+   /**
+    * \brief Set number of the current iteration.
+    *
+    * \param iterations is number of the current iteration.
+    */
+   void
+   setIterations( const IndexType& iterations );
+
+   /**
+    * \brief Set residue of the current approximation of the solution.
+    *
+    * \param residue is a residue of the current approximation of the solution.
+    */
+   void
+   setResidue( const RealType& residue );
+
+   /**
+    * \brief Set up the verbosity of the monitor.
+    *
+    * \param verbose is the new value of the verbosity of the monitor.
+    */
+   void
+   setVerbose( const IndexType& verbose );
+
+   /**
+    * \brief Set the number of nodes of the numerical mesh or lattice.
+    *
+    * This can be used to compute the number of nodes processed per one second.
+    *
+    * \param nodes is number of nodes of the numerical mesh or lattice.
+    */
+   void
+   setNodesPerIteration( const IndexType& nodes );
+
+   /**
+    * \brief Causes that the monitor prints out the status of the solver.
+    */
+   void
+   refresh() override;
+
+protected:
+   int
+   getLineWidth();
+
+   std::string stage, saved_stage;
+
+   std::atomic_bool saved{ false };
+   std::atomic_bool attributes_changed{ false };
+
+   RealType time = 0;
+   RealType saved_time = 0;
+   RealType timeStep = 0;
+   RealType saved_timeStep = 0;
+   RealType residue = 0;
+   RealType saved_residue = 0;
+   RealType elapsed_time_before_refresh = 0;
+   RealType last_mlups = 0;
+   // TODO: Move MLUPS to LBM solver only i.e create solver monitor for LBM
+
+   IndexType iterations = 0;
+   IndexType saved_iterations = 0;
+   IndexType iterations_before_refresh = 0;
+   // TODO: move verbose to SolverMonitor
+   IndexType verbose = 2;
+   IndexType nodesPerIteration = 0;
 };
 
-   } // namespace Solvers
-} // namespace TNL
+}  // namespace Solvers
+}  // namespace TNL
 
 #include <TNL/Solvers/IterativeSolverMonitor.hpp>
diff --git a/src/TNL/Solvers/IterativeSolverMonitor.hpp b/src/TNL/Solvers/IterativeSolverMonitor.hpp
index 9d74bf4926cb41113fb0f2527164f9cd558f9bd1..b179ab0da0a23e55de5945fc681c263715aa3588 100644
--- a/src/TNL/Solvers/IterativeSolverMonitor.hpp
+++ b/src/TNL/Solvers/IterativeSolverMonitor.hpp
@@ -11,7 +11,7 @@
 
 // check if we are on a POSIX system or Windows,
 // see https://stackoverflow.com/a/4575466
-#if !defined(_WIN32) && !defined(_WIN64)
+#if ! defined( _WIN32 ) && ! defined( _WIN64 )
    #include <sys/ioctl.h>
    #include <unistd.h>
 #endif
@@ -21,30 +21,9 @@
 namespace TNL {
 namespace Solvers {
 
-template< typename Real, typename Index>
-IterativeSolverMonitor< Real, Index > :: IterativeSolverMonitor()
-: SolverMonitor(),
-  stage( "" ),
-  saved_stage( "" ),
-  saved( false ),
-  attributes_changed( false ),
-  time( 0.0 ),
-  saved_time( 0.0 ),
-  timeStep( 0.0 ),
-  saved_timeStep( 0.0 ),
-  residue( 0.0 ),
-  saved_residue( 0.0 ),
-  elapsed_time_before_refresh( 0.0 ),
-  iterations( 0 ),
-  saved_iterations( 0 ),
-  iterations_before_refresh( 0 ),
-  verbose( 2 ),
-  nodesPerIteration( 0 )
-{
-}
-
-template< typename Real, typename Index>
-void IterativeSolverMonitor< Real, Index > :: setStage( const std::string& stage )
+template< typename Real, typename Index >
+void
+IterativeSolverMonitor< Real, Index >::setStage( const std::string& stage )
 {
    // save the items after a complete stage
    if( iterations > 0 ) {
@@ -64,50 +43,57 @@ void IterativeSolverMonitor< Real, Index > :: setStage( const std::string& stage
    attributes_changed = true;
 }
 
-template< typename Real, typename Index>
-void IterativeSolverMonitor< Real, Index > :: setTime( const RealType& time )
+template< typename Real, typename Index >
+void
+IterativeSolverMonitor< Real, Index >::setTime( const RealType& time )
 {
    this->time = time;
    attributes_changed = true;
 }
 
-template< typename Real, typename Index>
-void IterativeSolverMonitor< Real, Index > :: setTimeStep( const RealType& timeStep )
+template< typename Real, typename Index >
+void
+IterativeSolverMonitor< Real, Index >::setTimeStep( const RealType& timeStep )
 {
    this->timeStep = timeStep;
    attributes_changed = true;
 }
 
-template< typename Real, typename Index>
-void IterativeSolverMonitor< Real, Index > :: setIterations( const Index& iterations )
+template< typename Real, typename Index >
+void
+IterativeSolverMonitor< Real, Index >::setIterations( const Index& iterations )
 {
    this->iterations = iterations;
    attributes_changed = true;
 }
 
-template< typename Real, typename Index>
-void IterativeSolverMonitor< Real, Index > :: setResidue( const Real& residue )
+template< typename Real, typename Index >
+void
+IterativeSolverMonitor< Real, Index >::setResidue( const Real& residue )
 {
    this->residue = residue;
    attributes_changed = true;
 }
 
-template< typename Real, typename Index>
-void IterativeSolverMonitor< Real, Index > :: setVerbose( const Index& verbose )
+template< typename Real, typename Index >
+void
+IterativeSolverMonitor< Real, Index >::setVerbose( const Index& verbose )
 {
    this->verbose = verbose;
    attributes_changed = true;
 }
 
-template< typename Real, typename Index>
-void IterativeSolverMonitor< Real, Index > :: setNodesPerIteration( const IndexType& nodes )
+template< typename Real, typename Index >
+void
+IterativeSolverMonitor< Real, Index >::setNodesPerIteration( const IndexType& nodes )
 {
    this->nodesPerIteration = nodes;
    attributes_changed = true;
 }
 
-template< typename Real, typename Index>
-void IterativeSolverMonitor< Real, Index > :: refresh()
+template< typename Real, typename Index >
+void
+IterativeSolverMonitor< Real, Index >::refresh()
 {
    // NOTE: We can't check if stdout is attached to a terminal or not, because
    // isatty(STDOUT_FILENO) *always* reports 1 under mpirun, regardless if it
@@ -117,8 +103,7 @@ void IterativeSolverMonitor< Real, Index > :: refresh()
    // stdout redirected to a file, or with a terminal) and verbose=0 disables
    // the output completely.
 
-   if( this->verbose > 0 )
-   {
+   if( this->verbose > 0 ) {
       // Check if we should display the current values or the values saved after
       // the previous stage. If the iterations cycle much faster than the solver
       // monitor refreshes, we display only the values saved after the whole
@@ -127,16 +112,18 @@ void IterativeSolverMonitor< Real, Index > :: refresh()
       this->saved = false;
 
       const int line_width = getLineWidth();
-      int free = line_width ? line_width : std::numeric_limits<int>::max();
+      int free = line_width > 0 ? line_width : std::numeric_limits< int >::max();
 
-      auto real_to_string = []( Real value, int precision = 6 ) {
+      auto real_to_string = []( Real value, int precision = 6 )
+      {
          std::stringstream stream;
          stream << std::setprecision( precision ) << value;
          return stream.str();
       };
 
-      auto print_item = [&free]( const std::string& item, int width = 0 ) {
-         width = min( free, (width) ? width : item.length() );
+      auto print_item = [ &free ]( const std::string& item, int width = 0 )
+      {
+         width = min( free, width > 0 ? width : item.length() );
          std::cout << std::setw( width ) << item.substr( 0, width );
          free -= width;
       };
@@ -154,15 +141,15 @@ void IterativeSolverMonitor< Real, Index > :: refresh()
       }
       if( time > 0 ) {
          print_item( " T:" );
-         print_item( real_to_string( (saved) ? saved_time : time, 5 ), 8 );
-         if( (saved) ? saved_timeStep : timeStep > 0 ) {
+         print_item( real_to_string( ( saved ) ? saved_time : time, 5 ), 8 );
+         if( ( saved ) ? saved_timeStep : timeStep > 0 ) {
             print_item( " TAU:" );
-            print_item( real_to_string( (saved) ? saved_timeStep : timeStep, 5 ), 10 );
+            print_item( real_to_string( ( saved ) ? saved_timeStep : timeStep, 5 ), 10 );
          }
       }
 
-      const std::string displayed_stage = (saved) ? saved_stage : stage;
-      if( displayed_stage.length() && free > 5 ) {
+      const std::string displayed_stage = ( saved ) ? saved_stage : stage;
+      if( ! displayed_stage.empty() && free > 5 ) {
          if( (int) displayed_stage.length() <= free - 2 ) {
             std::cout << "  " << displayed_stage;
             free -= ( 2 + displayed_stage.length() );
@@ -173,25 +160,26 @@ void IterativeSolverMonitor< Real, Index > :: refresh()
          }
       }
 
-      if( (saved) ? saved_iterations : iterations > 0 && free >= 14 ) {
+      if( ( saved ) ? saved_iterations : iterations > 0 && free >= 14 ) {
          print_item( " ITER:" );
-         print_item( std::to_string( (saved) ? saved_iterations : iterations ), 8 );
+         print_item( std::to_string( ( saved ) ? saved_iterations : iterations ), 8 );
       }
-      if( (saved) ? saved_residue : residue && free >= 17 ) {
+      if( ( saved ) ? saved_residue : residue && free >= 17 ) {
          print_item( " RES:" );
-         print_item( real_to_string( (saved) ? saved_residue : residue, 5 ), 12 );
+         print_item( real_to_string( ( saved ) ? saved_residue : residue, 5 ), 12 );
       }
 
-      if( nodesPerIteration ) // otherwise MLUPS: 0 is printed
+      if( nodesPerIteration )  // otherwise MLUPS: 0 is printed
       {
-         const RealType mlups = nodesPerIteration * (iterations - iterations_before_refresh) / (getElapsedTime() - elapsed_time_before_refresh) * 1e-6;
+         const RealType mlups = nodesPerIteration * ( iterations - iterations_before_refresh )
+                              / ( getElapsedTime() - elapsed_time_before_refresh ) * 1e-6;
          print_item( " MLUPS:", 0 );
-         if( mlups > 0 )
-         {
+         if( mlups > 0 ) {
             print_item( real_to_string( mlups, 5 ), 7 );
             last_mlups = mlups;
          }
-         else print_item( real_to_string( last_mlups, 5 ), 7 );
+         else
+            print_item( real_to_string( last_mlups, 5 ), 7 );
       }
       iterations_before_refresh = iterations;
       elapsed_time_before_refresh = getElapsedTime();
@@ -208,17 +196,18 @@ void IterativeSolverMonitor< Real, Index > :: refresh()
    }
 }
 
-template< typename Real, typename Index>
-int IterativeSolverMonitor< Real, Index > :: getLineWidth()
+template< typename Real, typename Index >
+int
+IterativeSolverMonitor< Real, Index >::getLineWidth()
 {
-#if !defined(_WIN32) && !defined(_WIN64)
+#if ! defined( _WIN32 ) && ! defined( _WIN64 )
    struct winsize w;
-   ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
+   ioctl( STDOUT_FILENO, TIOCGWINSZ, &w );
    return w.ws_col;
 #else
    return 0;
 #endif
 }
 
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/Linear/BICGStab.h b/src/TNL/Solvers/Linear/BICGStab.h
index 2da2e68d302b958e3dcfabd7890a38221e81f03f..9bb72889bcd668e07d42987a23fcf098178dc2b0 100644
--- a/src/TNL/Solvers/Linear/BICGStab.h
+++ b/src/TNL/Solvers/Linear/BICGStab.h
@@ -9,8 +9,8 @@
 #include <TNL/Solvers/Linear/LinearSolver.h>
 
 namespace TNL {
-   namespace Solvers {
-      namespace Linear {
+namespace Solvers {
+namespace Linear {
 
 /**
  * \brief Iterative solver of linear systems based on the biconjugate gradient stabilized (BICGStab) method.
@@ -24,91 +24,93 @@ namespace TNL {
  * \tparam Matrix is type of matrix describing the linear system.
  */
 template< typename Matrix >
-class BICGStab
-: public LinearSolver< Matrix >
+class BICGStab : public LinearSolver< Matrix >
 {
    using Base = LinearSolver< Matrix >;
    using VectorType = typename Traits< Matrix >::VectorType;
 
-   public:
-
-      /**
-       * \brief Floating point type used for computations.
-       */
-      using RealType = typename Base::RealType;
-
-      /**
-       * \brief Device where the solver will run on and auxillary data will alloacted on.
-       *
-       * See \ref Devices::Host or \ref Devices::Cuda.
-       */
-      using DeviceType = typename Base::DeviceType;
-
-      /**
-       * \brief Type for indexing.
-       */
-      using IndexType = typename Base::IndexType;
-
-      /**
-       * \brief Type for vector view.
-       */
-      using VectorViewType = typename Base::VectorViewType;
-
-      /**
-       * \brief Type for constant vector view.
-       */
-      using ConstVectorViewType = typename Base::ConstVectorViewType;
-
-      /**
-       * \brief This is method defines configuration entries for setup of the linear iterative solver.
-       *
-       * In addition to config entries defined by \ref IterativeSolver::configSetup, this method
-       * defines the following:
-       *
-       * \e bicgstab-exact-residue - says whether the BiCGstab should compute the exact residue in
-       *                             each step (true) or to use a cheap approximation (false).
-       *
-       * \param config contains description of configuration parameters.
-       * \param prefix is a prefix of particular configuration entries.
-       */
-      static void configSetup( Config::ConfigDescription& config,
-                              const String& prefix = "" );
-
-      /**
-       * \brief Method for setup of the linear iterative solver based on configuration parameters.
-       *
-       * \param parameters contains values of the define configuration entries.
-       * \param prefix is a prefix of particular configuration entries.
-       */
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" ) override;
-
-      /**
-       * \brief Method for solving of a linear system.
-       *
-       * See \ref LinearSolver::solve for more details.
-       *
-       * \param b vector with the right-hand side of the linear system.
-       * \param x vector for the solution of the linear system.
-       * \return true if the solver converged.
-       * \return false if the solver did not converge.
-       */
-      bool solve( ConstVectorViewType b, VectorViewType x ) override;
-
-   protected:
-      void compute_residue( VectorViewType r, ConstVectorViewType x, ConstVectorViewType b );
-
-      void preconditioned_matvec( ConstVectorViewType src, VectorViewType dst );
-
-      void setSize( const VectorViewType& x );
-
-      bool exact_residue = false;
-
-      VectorType r, r_ast, p, s, Ap, As, M_tmp;
+public:
+   /**
+    * \brief Floating point type used for computations.
+    */
+   using RealType = typename Base::RealType;
+
+   /**
+    * \brief Device where the solver will run on and auxillary data will alloacted on.
+    *
+    * See \ref Devices::Host or \ref Devices::Cuda.
+    */
+   using DeviceType = typename Base::DeviceType;
+
+   /**
+    * \brief Type for indexing.
+    */
+   using IndexType = typename Base::IndexType;
+
+   /**
+    * \brief Type for vector view.
+    */
+   using VectorViewType = typename Base::VectorViewType;
+
+   /**
+    * \brief Type for constant vector view.
+    */
+   using ConstVectorViewType = typename Base::ConstVectorViewType;
+
+   /**
+    * \brief This is method defines configuration entries for setup of the linear iterative solver.
+    *
+    * In addition to config entries defined by \ref IterativeSolver::configSetup, this method
+    * defines the following:
+    *
+    * \e bicgstab-exact-residue - says whether the BiCGstab should compute the exact residue in
+    *                             each step (true) or to use a cheap approximation (false).
+    *
+    * \param config contains description of configuration parameters.
+    * \param prefix is a prefix of particular configuration entries.
+    */
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" );
+
+   /**
+    * \brief Method for setup of the linear iterative solver based on configuration parameters.
+    *
+    * \param parameters contains values of the define configuration entries.
+    * \param prefix is a prefix of particular configuration entries.
+    */
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" ) override;
+
+   /**
+    * \brief Method for solving of a linear system.
+    *
+    * See \ref LinearSolver::solve for more details.
+    *
+    * \param b vector with the right-hand side of the linear system.
+    * \param x vector for the solution of the linear system.
+    * \return true if the solver converged.
+    * \return false if the solver did not converge.
+    */
+   bool
+   solve( ConstVectorViewType b, VectorViewType x ) override;
+
+protected:
+   void
+   compute_residue( VectorViewType r, ConstVectorViewType x, ConstVectorViewType b );
+
+   void
+   preconditioned_matvec( ConstVectorViewType src, VectorViewType dst );
+
+   void
+   setSize( const VectorViewType& x );
+
+   bool exact_residue = false;
+
+   VectorType r, r_ast, p, s, Ap, As, M_tmp;
 };
 
-      } // namespace Linear
-   } // namespace Solvers
-} // namespace TNL
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
 
 #include <TNL/Solvers/Linear/BICGStab.hpp>
diff --git a/src/TNL/Solvers/Linear/BICGStab.hpp b/src/TNL/Solvers/Linear/BICGStab.hpp
index c12f96b58aa0577af4b64e93c27f9b20c8acbeab..fc8beff0c25bb8b6f020fe042f39c57d207f2c94 100644
--- a/src/TNL/Solvers/Linear/BICGStab.hpp
+++ b/src/TNL/Solvers/Linear/BICGStab.hpp
@@ -16,19 +16,18 @@ namespace Linear {
 
 template< typename Matrix >
 void
-BICGStab< Matrix >::
-configSetup( Config::ConfigDescription& config,
-             const String& prefix )
+BICGStab< Matrix >::configSetup( Config::ConfigDescription& config, const String& prefix )
 {
    LinearSolver< Matrix >::configSetup( config, prefix );
-   config.addEntry< bool >( prefix + "bicgstab-exact-residue", "Whether the BiCGstab should compute the exact residue in each step (true) or to use a cheap approximation (false).", false );
+   config.addEntry< bool >(
+      prefix + "bicgstab-exact-residue",
+      "Whether the BiCGstab should compute the exact residue in each step (true) or to use a cheap approximation (false).",
+      false );
 }
 
 template< typename Matrix >
 bool
-BICGStab< Matrix >::
-setup( const Config::ParameterContainer& parameters,
-       const String& prefix )
+BICGStab< Matrix >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    if( parameters.checkParameter( prefix + "bicgstab-exact-residue" ) )
       exact_residue = parameters.getParameter< bool >( "bicgstab-exact-residue" );
@@ -37,8 +36,7 @@ setup( const Config::ParameterContainer& parameters,
 
 template< typename Matrix >
 bool
-BICGStab< Matrix >::
-solve( ConstVectorViewType b, VectorViewType x )
+BICGStab< Matrix >::solve( ConstVectorViewType b, VectorViewType x )
 {
    this->setSize( x );
 
@@ -59,25 +57,24 @@ solve( ConstVectorViewType b, VectorViewType x )
 
    p = r_ast = r;
    s.setValue( 0.0 );
-   r_ast_sqnorm = rho = (r, r_ast);
+   r_ast_sqnorm = rho = ( r, r_ast );
 
-   const RealType eps2 = std::numeric_limits<RealType>::epsilon() * std::numeric_limits<RealType>::epsilon();
+   const RealType eps2 = std::numeric_limits< RealType >::epsilon() * std::numeric_limits< RealType >::epsilon();
 
    this->resetIterations();
    this->setResidue( std::sqrt( rho ) / b_norm );
 
-   while( this->nextIteration() )
-   {
+   while( this->nextIteration() ) {
       // alpha_j = ( r_j, r^ast_0 ) / ( A * p_j, r^ast_0 )
       preconditioned_matvec( p, Ap );
-      alpha = rho / (Ap, r_ast);
+      alpha = rho / ( Ap, r_ast );
 
       // s_j = r_j - alpha_j * A p_j
       s = r - alpha * Ap;
 
       // omega_j = ( A s_j, s_j ) / ( A s_j, A s_j )
       preconditioned_matvec( s, As );
-      omega = (As, s) / (As, As);
+      omega = ( As, s ) / ( As, As );
 
       // x_{j+1} = x_j + alpha_j * p_j + omega_j * s_j
       x += alpha * p + omega * s;
@@ -87,20 +84,20 @@ solve( ConstVectorViewType b, VectorViewType x )
 
       // compute scalar product of the residual vectors
       rho_old = rho;
-      rho = (r, r_ast);
-      if( abs(rho) < eps2 * r_ast_sqnorm ) {
+      rho = ( r, r_ast );
+      if( abs( rho ) < eps2 * r_ast_sqnorm ) {
          // The new residual vector has become too orthogonal to the arbitrarily chosen direction r_ast.
          // Let's restart with a new r0:
          compute_residue( r, x, b );
          r_ast = r;
-         r_ast_sqnorm = rho = (r, r_ast);
+         r_ast_sqnorm = rho = ( r, r_ast );
       }
 
       // beta = alpha_j / omega_j * ( r_{j+1}, r^ast_0 ) / ( r_j, r^ast_0 )
-      beta = (rho / rho_old) * (alpha / omega);
+      beta = ( rho / rho_old ) * ( alpha / omega );
 
       // p_{j+1} = r_{j+1} + beta_j * ( p_j - omega_j * A p_j )
-      p = r + beta * p - (beta * omega) * Ap;
+      p = r + beta * p - ( beta * omega ) * Ap;
 
       if( exact_residue ) {
          // Compute the exact preconditioned residue into the 's' vector.
@@ -120,8 +117,7 @@ solve( ConstVectorViewType b, VectorViewType x )
 
 template< typename Matrix >
 void
-BICGStab< Matrix >::
-compute_residue( VectorViewType r, ConstVectorViewType x, ConstVectorViewType b )
+BICGStab< Matrix >::compute_residue( VectorViewType r, ConstVectorViewType x, ConstVectorViewType b )
 {
    // r = M.solve(b - A * x);
    if( this->preconditioner ) {
@@ -137,8 +133,7 @@ compute_residue( VectorViewType r, ConstVectorViewType x, ConstVectorViewType b
 
 template< typename Matrix >
 void
-BICGStab< Matrix >::
-preconditioned_matvec( ConstVectorViewType src, VectorViewType dst )
+BICGStab< Matrix >::preconditioned_matvec( ConstVectorViewType src, VectorViewType dst )
 {
    if( this->preconditioner ) {
       this->matrix->vectorProduct( src, M_tmp );
@@ -151,8 +146,7 @@ preconditioned_matvec( ConstVectorViewType src, VectorViewType dst )
 
 template< typename Matrix >
 void
-BICGStab< Matrix >::
-setSize( const VectorViewType& x )
+BICGStab< Matrix >::setSize( const VectorViewType& x )
 {
    r.setLike( x );
    r_ast.setLike( x );
@@ -163,6 +157,6 @@ setSize( const VectorViewType& x )
    M_tmp.setLike( x );
 }
 
-} // namespace Linear
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/Linear/BICGStabL.h b/src/TNL/Solvers/Linear/BICGStabL.h
index 0a3d3a90858d4cd250f5014c8f1ba00fa6e290cf..54ace90e6a5a45622a5afb9a59420d87dbfdd62a 100644
--- a/src/TNL/Solvers/Linear/BICGStabL.h
+++ b/src/TNL/Solvers/Linear/BICGStabL.h
@@ -19,8 +19,8 @@
 #include <TNL/Solvers/Linear/LinearSolver.h>
 
 namespace TNL {
-   namespace Solvers {
-      namespace Linear {
+namespace Solvers {
+namespace Linear {
 
 /**
  * \brief Iterative solver of linear systems based on the BICGStab(l) method.
@@ -52,107 +52,109 @@ namespace TNL {
  * \tparam Matrix is type of matrix describing the linear system.
  */
 template< typename Matrix >
-class BICGStabL
-: public LinearSolver< Matrix >
+class BICGStabL : public LinearSolver< Matrix >
 {
    using Base = LinearSolver< Matrix >;
 
    // compatibility shortcut
    using Traits = Linear::Traits< Matrix >;
 
-   public:
-
-      /**
-       * \brief Floating point type used for computations.
-       */
-      using RealType = typename Base::RealType;
-
-      /**
-       * \brief Device where the solver will run on and auxillary data will alloacted on.
-       */
-      using DeviceType = typename Base::DeviceType;
-
-      /**
-       * \brief Type for indexing.
-       */
-      using IndexType = typename Base::IndexType;
-
-      /**
-       * \brief Type for vector view.
-       */
-      using VectorViewType = typename Base::VectorViewType;
-
-      /**
-       * \brief Type for constant vector view.
-       */
-      using ConstVectorViewType = typename Base::ConstVectorViewType;
-
-      /**
-       * \brief This is method defines configuration entries for setup of the linear iterative solver.
-       *
-       * In addition to config entries defined by \ref IterativeSolver::configSetup, this method
-       * defines the following:
-       *
-       * \e bicgstab-ell - number of Bi-CG iterations before the MR part starts.
-       *
-       * \e bicgstab-exact-residue - says whether the BiCGstab should compute the exact residue in
-       *                             each step (true) or to use a cheap approximation (false).
-       *
-       * \param config contains description of configuration parameters.
-       * \param prefix is a prefix of particular configuration entries.
-       */
-      static void configSetup( Config::ConfigDescription& config,
-                              const String& prefix = "" );
-
-      /**
-       * \brief Method for setup of the linear iterative solver based on configuration parameters.
-       *
-       * \param parameters contains values of the define configuration entries.
-       * \param prefix is a prefix of particular configuration entries.
-       */
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" ) override;
-
-      /**
-       * \brief Method for solving of a linear system.
-       *
-       * See \ref LinearSolver::solve for more details.
-       *
-       * \param b vector with the right-hand side of the linear system.
-       * \param x vector for the solution of the linear system.
-       * \return true if the solver converged.
-       * \return false if the solver did not converge.
-       */
-      bool solve( ConstVectorViewType b, VectorViewType x ) override;
-
-   protected:
-      using VectorType = typename Traits::VectorType;
-      using DeviceVector = Containers::Vector< RealType, DeviceType, IndexType >;
-      using HostVector = Containers::Vector< RealType, Devices::Host, IndexType >;
-
-      void compute_residue( VectorViewType r, ConstVectorViewType x, ConstVectorViewType b );
-
-      void preconditioned_matvec( ConstVectorViewType src, VectorViewType dst );
-
-      void setSize( const VectorViewType& x );
-
-      int ell = 1;
-
-      bool exact_residue = false;
-
-      // matrices (in column-major format)
-      DeviceVector R, U;
-      // single vectors (distributed)
-      VectorType r_ast, M_tmp, res_tmp;
-      // host-only storage
-      HostVector T, sigma, g_0, g_1, g_2;
-
-      IndexType size = 0;
-      IndexType ldSize = 0;
+public:
+   /**
+    * \brief Floating point type used for computations.
+    */
+   using RealType = typename Base::RealType;
+
+   /**
+    * \brief Device where the solver will run on and auxillary data will alloacted on.
+    */
+   using DeviceType = typename Base::DeviceType;
+
+   /**
+    * \brief Type for indexing.
+    */
+   using IndexType = typename Base::IndexType;
+
+   /**
+    * \brief Type for vector view.
+    */
+   using VectorViewType = typename Base::VectorViewType;
+
+   /**
+    * \brief Type for constant vector view.
+    */
+   using ConstVectorViewType = typename Base::ConstVectorViewType;
+
+   /**
+    * \brief This is method defines configuration entries for setup of the linear iterative solver.
+    *
+    * In addition to config entries defined by \ref IterativeSolver::configSetup, this method
+    * defines the following:
+    *
+    * \e bicgstab-ell - number of Bi-CG iterations before the MR part starts.
+    *
+    * \e bicgstab-exact-residue - says whether the BiCGstab should compute the exact residue in
+    *                             each step (true) or to use a cheap approximation (false).
+    *
+    * \param config contains description of configuration parameters.
+    * \param prefix is a prefix of particular configuration entries.
+    */
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" );
+
+   /**
+    * \brief Method for setup of the linear iterative solver based on configuration parameters.
+    *
+    * \param parameters contains values of the define configuration entries.
+    * \param prefix is a prefix of particular configuration entries.
+    */
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" ) override;
+
+   /**
+    * \brief Method for solving of a linear system.
+    *
+    * See \ref LinearSolver::solve for more details.
+    *
+    * \param b vector with the right-hand side of the linear system.
+    * \param x vector for the solution of the linear system.
+    * \return true if the solver converged.
+    * \return false if the solver did not converge.
+    */
+   bool
+   solve( ConstVectorViewType b, VectorViewType x ) override;
+
+protected:
+   using VectorType = typename Traits::VectorType;
+   using DeviceVector = Containers::Vector< RealType, DeviceType, IndexType >;
+   using HostVector = Containers::Vector< RealType, Devices::Host, IndexType >;
+
+   void
+   compute_residue( VectorViewType r, ConstVectorViewType x, ConstVectorViewType b );
+
+   void
+   preconditioned_matvec( ConstVectorViewType src, VectorViewType dst );
+
+   void
+   setSize( const VectorViewType& x );
+
+   int ell = 1;
+
+   bool exact_residue = false;
+
+   // matrices (in column-major format)
+   DeviceVector R, U;
+   // single vectors (distributed)
+   VectorType r_ast, M_tmp, res_tmp;
+   // host-only storage
+   HostVector T, sigma, g_0, g_1, g_2;
+
+   IndexType size = 0;
+   IndexType ldSize = 0;
 };
 
-      } // namespace Linear
-   } // namespace Solvers
-} // namespace TNL
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
 
 #include <TNL/Solvers/Linear/BICGStabL.hpp>
diff --git a/src/TNL/Solvers/Linear/BICGStabL.hpp b/src/TNL/Solvers/Linear/BICGStabL.hpp
index 7c2612b9e4fe754b963b4a63f8c8fbd493f0fd9a..4116a02b45119c8dffe3c40b033f468964ddd9d1 100644
--- a/src/TNL/Solvers/Linear/BICGStabL.hpp
+++ b/src/TNL/Solvers/Linear/BICGStabL.hpp
@@ -18,20 +18,19 @@ namespace Linear {
 
 template< typename Matrix >
 void
-BICGStabL< Matrix >::
-configSetup( Config::ConfigDescription& config,
-             const String& prefix )
+BICGStabL< Matrix >::configSetup( Config::ConfigDescription& config, const String& prefix )
 {
    LinearSolver< Matrix >::configSetup( config, prefix );
    config.addEntry< int >( prefix + "bicgstab-ell", "Number of Bi-CG iterations before the MR part starts.", 1 );
-   config.addEntry< bool >( prefix + "bicgstab-exact-residue", "Whether the BiCGstab should compute the exact residue in each step (true) or to use a cheap approximation (false).", false );
+   config.addEntry< bool >(
+      prefix + "bicgstab-exact-residue",
+      "Whether the BiCGstab should compute the exact residue in each step (true) or to use a cheap approximation (false).",
+      false );
 }
 
 template< typename Matrix >
 bool
-BICGStabL< Matrix >::
-setup( const Config::ParameterContainer& parameters,
-       const String& prefix )
+BICGStabL< Matrix >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    if( parameters.checkParameter( prefix + "bicgstab-ell" ) )
       ell = parameters.getParameter< int >( "bicgstab-ell" );
@@ -42,8 +41,7 @@ setup( const Config::ParameterContainer& parameters,
 
 template< typename Matrix >
 bool
-BICGStabL< Matrix >::
-solve( ConstVectorViewType b, VectorViewType x )
+BICGStabL< Matrix >::solve( ConstVectorViewType b, VectorViewType x )
 {
    this->setSize( x );
 
@@ -81,9 +79,8 @@ solve( ConstVectorViewType b, VectorViewType x )
    this->resetIterations();
    this->setResidue( sigma[ 0 ] / b_norm );
 
-   while( this->checkNextIteration() )
-   {
-      rho_0 = - omega * rho_0;
+   while( this->checkNextIteration() ) {
+      rho_0 = -omega * rho_0;
 
       /****
        * Bi-CG part
@@ -92,43 +89,45 @@ solve( ConstVectorViewType b, VectorViewType x )
          this->nextIteration();
          r_j.bind( &R.getData()[ j * ldSize ], size );
 
-         rho_1 = (r_ast, r_j);
+         rho_1 = ( r_ast, r_j );
          beta = alpha * rho_1 / rho_0;
          rho_0 = rho_1;
 
          /****
           * U_[0:j] := R_[0:j] - beta * U_[0:j]
           */
-         Matrices::MatrixOperations< DeviceType >::
-            geam( size, (IndexType) j + 1,
-                  (RealType) 1.0, R.getData(), ldSize,
-                  -beta, U.getData(), ldSize,
-                  U.getData(), ldSize );
+         Matrices::MatrixOperations< DeviceType >::geam(
+            size, (IndexType) j + 1, (RealType) 1.0, R.getData(), ldSize, -beta, U.getData(), ldSize, U.getData(), ldSize );
 
          /****
           * u_{j+1} = A u_j
           */
          u.bind( &U.getData()[ j * ldSize ], size );
-         Au.bind( &U.getData()[ (j + 1) * ldSize ], size );
+         Au.bind( &U.getData()[ ( j + 1 ) * ldSize ], size );
          preconditioned_matvec( u, Au );
 
-         gamma = (r_ast, Au);
+         gamma = ( r_ast, Au );
          alpha = rho_0 / gamma;
 
          /****
           * R_[0:j] := R_[0:j] - alpha * U_[1:j+1]
           */
-         Matrices::MatrixOperations< DeviceType >::
-            geam( size, (IndexType) j + 1,
-                  (RealType) 1.0, R.getData(), ldSize,
-                  -alpha, U.getData() + ldSize, ldSize,
-                  R.getData(), ldSize );
+         Matrices::MatrixOperations< DeviceType >::geam( size,
+                                                         (IndexType) j + 1,
+                                                         (RealType) 1.0,
+                                                         R.getData(),
+                                                         ldSize,
+                                                         -alpha,
+                                                         U.getData() + ldSize,
+                                                         ldSize,
+                                                         R.getData(),
+                                                         ldSize );
 
          /****
           * r_{j+1} = A r_j
           */
          r_j.bind( &R.getData()[ j * ldSize ], size );
-         r_i.bind( &R.getData()[ (j + 1) * ldSize ], size );
+         r_i.bind( &R.getData()[ ( j + 1 ) * ldSize ], size );
          preconditioned_matvec( r_j, r_i );
 
          /****
@@ -150,31 +149,31 @@ solve( ConstVectorViewType b, VectorViewType x )
              * T_{i,j} = (r_i, r_j) / sigma_i
              * r_j := r_j - T_{i,j} * r_i
              */
-            const int ij = (i-1) + (j-1) * ell;
-            T[ ij ] = (r_i, r_j) / sigma[ i ];
+            const int ij = ( i - 1 ) + ( j - 1 ) * ell;
+            T[ ij ] = ( r_i, r_j ) / sigma[ i ];
             r_j -= T[ ij ] * r_i;
          }
 
          // MGS with reorthogonalization
-//         for( int i = 1; i < j; i++ ) {
-//            const int ij = (i-1) + (j-1) * ell;
-//            T[ ij ] = 0.0;
-//         }
-//         for( int l = 0; l < 2; l++ )
-//            for( int i = 1; i < j; i++ ) {
-//               r_i.bind( &R.getData()[ i * ldSize ], size );
-//               /****
-//                * T_{i,j} = (r_i, r_j) / sigma_i
-//                * r_j := r_j - T_{i,j} * r_i
-//                */
-//               const int ij = (i-1) + (j-1) * ell;
-//               const RealType T_ij = (r_i, r_j) / sigma[ i ];
-//               T[ ij ] += T_ij;
-//               r_j -= T_ij * r_i );
-//            }
-
-         sigma[ j ] = (r_j, r_j);
-         g_1[ j ] = (r_0, r_j) / sigma[ j ];
+         //         for( int i = 1; i < j; i++ ) {
+         //            const int ij = (i-1) + (j-1) * ell;
+         //            T[ ij ] = 0.0;
+         //         }
+         //         for( int l = 0; l < 2; l++ )
+         //            for( int i = 1; i < j; i++ ) {
+         //               r_i.bind( &R.getData()[ i * ldSize ], size );
+         //               /****
+         //                * T_{i,j} = (r_i, r_j) / sigma_i
+         //                * r_j := r_j - T_{i,j} * r_i
+         //                */
+         //               const int ij = (i-1) + (j-1) * ell;
+         //               const RealType T_ij = (r_i, r_j) / sigma[ i ];
+         //               T[ ij ] += T_ij;
+         //               r_j -= T_ij * r_i );
+         //            }
+
+         sigma[ j ] = ( r_j, r_j );
+         g_1[ j ] = ( r_0, r_j ) / sigma[ j ];
       }
 
       omega = g_1[ ell ];
@@ -185,7 +184,7 @@ solve( ConstVectorViewType b, VectorViewType x )
       for( int j = ell; j >= 1; j-- ) {
          g_0[ j ] = g_1[ j ];
          for( int i = j + 1; i <= ell; i++ )
-            g_0[ j ] -= T[ (j-1) + (i-1) * ell ] * g_0[ i ];
+            g_0[ j ] -= T[ ( j - 1 ) + ( i - 1 ) * ell ] * g_0[ i ];
       }
 
       /****
@@ -195,7 +194,7 @@ solve( ConstVectorViewType b, VectorViewType x )
       for( int j = 1; j < ell; j++ ) {
          g_2[ j ] = g_0[ j + 1 ];
          for( int i = j + 1; i < ell; i++ )
-            g_2[ j ] += T[ (j-1) + (i-1) * ell ] * g_0[ i + 1 ];
+            g_2[ j ] += T[ ( j - 1 ) + ( i - 1 ) * ell ] * g_0[ i + 1 ];
       }
 
       /****
@@ -203,20 +202,32 @@ solve( ConstVectorViewType b, VectorViewType x )
        */
       // x := x + R_[0:ell-1] * g_2
       g_2[ 0 ] = g_0[ 1 ];
-      Matrices::MatrixOperations< DeviceType >::
-         gemv( size, (IndexType) ell,
-               (RealType) 1.0, R.getData(), ldSize, g_2.getData(),
-               (RealType) 1.0, Traits::getLocalView( x ).getData() );
+      Matrices::MatrixOperations< DeviceType >::gemv( size,
+                                                      (IndexType) ell,
+                                                      (RealType) 1.0,
+                                                      R.getData(),
+                                                      ldSize,
+                                                      g_2.getData(),
+                                                      (RealType) 1.0,
+                                                      Traits::getLocalView( x ).getData() );
       // r_0 := r_0 - R_[1:ell] * g_1_[1:ell]
-      Matrices::MatrixOperations< DeviceType >::
-         gemv( size, (IndexType) ell,
-               (RealType) -1.0, R.getData() + ldSize, ldSize, &g_1[ 1 ],
-               (RealType) 1.0, Traits::getLocalView( r_0 ).getData() );
+      Matrices::MatrixOperations< DeviceType >::gemv( size,
+                                                      (IndexType) ell,
+                                                      (RealType) -1.0,
+                                                      R.getData() + ldSize,
+                                                      ldSize,
+                                                      &g_1[ 1 ],
+                                                      (RealType) 1.0,
+                                                      Traits::getLocalView( r_0 ).getData() );
       // u_0 := u_0 - U_[1:ell] * g_0_[1:ell]
-      Matrices::MatrixOperations< DeviceType >::
-         gemv( size, (IndexType) ell,
-               (RealType) -1.0, U.getData() + ldSize, ldSize, &g_0[ 1 ],
-               (RealType) 1.0, Traits::getLocalView( u_0 ).getData() );
+      Matrices::MatrixOperations< DeviceType >::gemv( size,
+                                                      (IndexType) ell,
+                                                      (RealType) -1.0,
+                                                      U.getData() + ldSize,
+                                                      ldSize,
+                                                      &g_0[ 1 ],
+                                                      (RealType) 1.0,
+                                                      Traits::getLocalView( u_0 ).getData() );
 
       if( exact_residue ) {
          /****
@@ -239,8 +250,7 @@ solve( ConstVectorViewType b, VectorViewType x )
 
 template< typename Matrix >
 void
-BICGStabL< Matrix >::
-compute_residue( VectorViewType r, ConstVectorViewType x, ConstVectorViewType b )
+BICGStabL< Matrix >::compute_residue( VectorViewType r, ConstVectorViewType x, ConstVectorViewType b )
 {
    /****
     * r = M.solve(b - A * x);
@@ -258,8 +268,7 @@ compute_residue( VectorViewType r, ConstVectorViewType x, ConstVectorViewType b
 
 template< typename Matrix >
 void
-BICGStabL< Matrix >::
-preconditioned_matvec( ConstVectorViewType src, VectorViewType dst )
+BICGStabL< Matrix >::preconditioned_matvec( ConstVectorViewType src, VectorViewType dst )
 {
    if( this->preconditioner ) {
       this->matrix->vectorProduct( src, M_tmp );
@@ -272,12 +281,11 @@ preconditioned_matvec( ConstVectorViewType src, VectorViewType dst )
 
 template< typename Matrix >
 void
-BICGStabL< Matrix >::
-setSize( const VectorViewType& x )
+BICGStabL< Matrix >::setSize( const VectorViewType& x )
 {
    this->size = ldSize = Traits::getConstLocalView( x ).getSize();
-   R.setSize( (ell + 1) * ldSize );
-   U.setSize( (ell + 1) * ldSize );
+   R.setSize( ( ell + 1 ) * ldSize );
+   U.setSize( ( ell + 1 ) * ldSize );
    r_ast.setLike( x );
    M_tmp.setLike( x );
    if( exact_residue )
@@ -289,6 +297,6 @@ setSize( const VectorViewType& x )
    g_2.setSize( ell + 1 );
 }
 
-} // namespace Linear
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/Linear/CG.h b/src/TNL/Solvers/Linear/CG.h
index a2c5f9c882a5cbfec12fc686a2748e53d72b5ec3..1429d0c9e1d1bc9caf9621490dfa498e03eaa3f6 100644
--- a/src/TNL/Solvers/Linear/CG.h
+++ b/src/TNL/Solvers/Linear/CG.h
@@ -9,8 +9,8 @@
 #include <TNL/Solvers/Linear/LinearSolver.h>
 
 namespace TNL {
-   namespace Solvers {
-      namespace Linear {
+namespace Solvers {
+namespace Linear {
 
 /**
  * \brief Iterative solver of linear systems based on the conjugate gradient method.
@@ -24,60 +24,61 @@ namespace TNL {
  * See \ref TNL::Solvers::Linear::IterativeSolver for example of showing how to use the linear solvers.
  */
 template< typename Matrix >
-class CG
-: public LinearSolver< Matrix >
+class CG : public LinearSolver< Matrix >
 {
    using Base = LinearSolver< Matrix >;
    using VectorType = typename Traits< Matrix >::VectorType;
 
-   public:
-      /**
-       * \brief Floating point type used for computations.
-       */
-      using RealType = typename Base::RealType;
+public:
+   /**
+    * \brief Floating point type used for computations.
+    */
+   using RealType = typename Base::RealType;
 
-      /**
-       * \brief Device where the solver will run on and auxillary data will alloacted on.
-       *
-       * See \ref Devices::Host or \ref Devices::Cuda.
-       */
-      using DeviceType = typename Base::DeviceType;
+   /**
+    * \brief Device where the solver will run on and auxillary data will alloacted on.
+    *
+    * See \ref Devices::Host or \ref Devices::Cuda.
+    */
+   using DeviceType = typename Base::DeviceType;
 
-      /**
-       * \brief Type for indexing.
-       */
-      using IndexType = typename Base::IndexType;
+   /**
+    * \brief Type for indexing.
+    */
+   using IndexType = typename Base::IndexType;
 
-      /**
-       * \brief Type for vector view.
-       */
-      using VectorViewType = typename Base::VectorViewType;
+   /**
+    * \brief Type for vector view.
+    */
+   using VectorViewType = typename Base::VectorViewType;
 
-      /**
-       * \brief Type for constant vector view.
-       */
-      using ConstVectorViewType = typename Base::ConstVectorViewType;
+   /**
+    * \brief Type for constant vector view.
+    */
+   using ConstVectorViewType = typename Base::ConstVectorViewType;
 
-      /**
-       * \brief Method for solving of a linear system.
-       *
-       * See \ref LinearSolver::solve for more details.
-       *
-       * \param b vector with the right-hand side of the linear system.
-       * \param x vector for the solution of the linear system.
-       * \return true if the solver converged.
-       * \return false if the solver did not converge.
-       */
-      bool solve( ConstVectorViewType b, VectorViewType x ) override;
+   /**
+    * \brief Method for solving of a linear system.
+    *
+    * See \ref LinearSolver::solve for more details.
+    *
+    * \param b vector with the right-hand side of the linear system.
+    * \param x vector for the solution of the linear system.
+    * \return true if the solver converged.
+    * \return false if the solver did not converge.
+    */
+   bool
+   solve( ConstVectorViewType b, VectorViewType x ) override;
 
-   protected:
-      void setSize( const VectorViewType& x );
+protected:
+   void
+   setSize( const VectorViewType& x );
 
-      VectorType r, p, Ap, z;
+   VectorType r, p, Ap, z;
 };
 
-      } // namespace Linear
-   } // namespace Solvers
-} // namespace TNL
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
 
 #include <TNL/Solvers/Linear/CG.hpp>
diff --git a/src/TNL/Solvers/Linear/CG.hpp b/src/TNL/Solvers/Linear/CG.hpp
index 234d181f393507465b6c0e0f536f8ecbb04e0e8d..af07ad60eb7a799be3fd76e3fefba60e80c4c4a8 100644
--- a/src/TNL/Solvers/Linear/CG.hpp
+++ b/src/TNL/Solvers/Linear/CG.hpp
@@ -14,8 +14,7 @@ namespace Linear {
 
 template< typename Matrix >
 bool
-CG< Matrix >::
-solve( ConstVectorViewType b, VectorViewType x )
+CG< Matrix >::solve( ConstVectorViewType b, VectorViewType x )
 {
    this->setSize( x );
    this->resetIterations();
@@ -45,22 +44,21 @@ solve( ConstVectorViewType b, VectorViewType x )
       // p_0 = z_0
       p = z;
       // s1 = (r_0, z_0)
-      s1 = (r, z);
+      s1 = ( r, z );
    }
    else {
       // p_0 = r_0
       p = r;
       // s1 = (r_0, r_0)
-      s1 = (r, r);
+      s1 = ( r, r );
    }
 
-   this->setResidue( std::sqrt(s1) / normb );
+   this->setResidue( std::sqrt( s1 ) / normb );
 
-   while( this->nextIteration() )
-   {
+   while( this->nextIteration() ) {
       // s2 = (A * p_j, p_j)
       this->matrix->vectorProduct( p, Ap );
-      s2 = (Ap, p);
+      s2 = ( Ap, p );
 
       // if s2 = 0 => p = 0 => r = 0 => we have the solution (provided A != 0)
       if( s2 == 0.0 ) {
@@ -82,17 +80,19 @@ solve( ConstVectorViewType b, VectorViewType x )
          this->preconditioner->solve( r, z );
          // beta_j = (r_{j+1}, z_{j+1}) / (r_j, z_j)
          s2 = s1;
-         s1 = (r, z);
+         s1 = ( r, z );
       }
       else {
          // beta_j = (r_{j+1}, r_{j+1}) / (r_j, r_j)
          s2 = s1;
-         s1 = (r, r);
+         s1 = ( r, r );
       }
 
       // if s2 = 0 => r = 0 => we have the solution
-      if( s2 == 0.0 ) beta = 0.0;
-      else beta = s1 / s2;
+      if( s2 == 0.0 )
+         beta = 0.0;
+      else
+         beta = s1 / s2;
 
       if( this->preconditioner )
          // p_{j+1} = z_{j+1} + beta_j * p_j
@@ -101,14 +101,14 @@ solve( ConstVectorViewType b, VectorViewType x )
          // p_{j+1} = r_{j+1} + beta_j * p_j
          p = r + beta * p;
 
-      this->setResidue( std::sqrt(s1) / normb );
+      this->setResidue( std::sqrt( s1 ) / normb );
    }
    return this->checkConvergence();
 }
 
 template< typename Matrix >
-void CG< Matrix >::
-setSize( const VectorViewType& x )
+void
+CG< Matrix >::setSize( const VectorViewType& x )
 {
    r.setLike( x );
    p.setLike( x );
@@ -116,6 +116,6 @@ setSize( const VectorViewType& x )
    z.setLike( x );
 }
 
-} // namespace Linear
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/Linear/GMRES.h b/src/TNL/Solvers/Linear/GMRES.h
index 1ac69eb1dc018b975386d2c78bceccdd89e7c21c..74dd5694deb2ad903a740ad2c4708a7c69165ccc 100644
--- a/src/TNL/Solvers/Linear/GMRES.h
+++ b/src/TNL/Solvers/Linear/GMRES.h
@@ -11,8 +11,8 @@
 #include <TNL/Solvers/Linear/LinearSolver.h>
 
 namespace TNL {
-   namespace Solvers {
-      namespace Linear {
+namespace Solvers {
+namespace Linear {
 
 /**
  * \brief Iterative solver of linear systems based on the Generalized minimal residual (GMRES) method.
@@ -40,201 +40,205 @@ namespace TNL {
  * \tparam Matrix is type of matrix describing the linear system.
  */
 template< typename Matrix >
-class GMRES
-: public LinearSolver< Matrix >
+class GMRES : public LinearSolver< Matrix >
 {
    using Base = LinearSolver< Matrix >;
    using Traits = Linear::Traits< Matrix >;
 
-   public:
-
-      /**
-       * \brief Floating point type used for computations.
-       */
-      using RealType = typename Base::RealType;
-
-      /**
-       * \brief Device where the solver will run on and auxillary data will alloacted on.
-       */
-      using DeviceType = typename Base::DeviceType;
-
-      /**
-       * \brief Type for indexing.
-       */
-      using IndexType = typename Base::IndexType;
-
-      /**
-       * \brief Type for vector view.
-       */
-      using VectorViewType = typename Base::VectorViewType;
-
-      /**
-       * \brief Type for constant vector view.
-       */
-      using ConstVectorViewType = typename Base::ConstVectorViewType;
-
-      /**
-       * \brief This is method defines configuration entries for setup of the linear iterative solver.
-       *
-       * In addition to config entries defined by \ref IterativeSolver::configSetup, this method
-       * defines the following:
-       *
-       * \e gmres-variant - Algorithm used for the orthogonalization - CGS (Classical Gramm-Schmidt),
-       *     CGSR(Classical Gramm-Schmidt with reorthogonalization), MGS(Modified Gramm-Schmidt),
-       *     MGSR(Modified Gramm-Schmidt with reorthogonalization), CWY(Compact WY form of the Householder reflections).
-       *
-       * \e gmres-restarting-min - minimal number of iterations after which the GMRES restarts.
-       *
-       * \e gmres-restarting-max - maximal number of iterations after which the GMRES restarts.
-       *
-       * \e gmres-restarting-step-min - minimal adjusting step for the adaptivity of the GMRES restarting parameter.
-       *
-       * \e gmres-restarting-step-max - maximal adjusting step for the adaptivity of the GMRES restarting parameter.
-       *
-       * \param config contains description of configuration parameters.
-       * \param prefix is a prefix of particular configuration entries.
-       */
-      static void configSetup( Config::ConfigDescription& config,
-                              const String& prefix = "" );
-
-      /**
-       * \brief Method for setup of the linear iterative solver based on configuration parameters.
-       *
-       * \param parameters contains values of the define configuration entries.
-       * \param prefix is a prefix of particular configuration entries.
-       */
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" ) override;
-
-      /**
-       * \brief Method for solving of a linear system.
-       *
-       * See \ref LinearSolver::solve for more details.
-       *
-       * \param b vector with the right-hand side of the linear system.
-       * \param x vector for the solution of the linear system.
-       * \return true if the solver converged.
-       * \return false if the solver did not converge.
-       */
-      bool solve( ConstVectorViewType b, VectorViewType x ) override;
-
-   protected:
-      using VectorType = typename Traits::VectorType;
-      // local vectors/views
-      using ConstDeviceView = typename Traits::ConstLocalViewType;
-      using DeviceView = typename Traits::LocalViewType;
-      using DeviceVector = typename Traits::LocalVectorType;
-      using HostView = typename DeviceView::template Self< RealType, Devices::Host >;
-      using HostVector = typename DeviceVector::template Self< RealType, Devices::Host >;;
-
-      enum class Variant { CGS, CGSR, MGS, MGSR, CWY };
-
-   // nvcc allows __cuda_callable__ lambdas only in public methods
-   #ifdef __NVCC__
-   public:
-   #endif
-      int orthogonalize_CGS( const int m, const RealType normb, const RealType beta );
-   #ifdef __NVCC__
-   protected:
-   #endif
-
-      int orthogonalize_MGS( const int m, const RealType normb, const RealType beta );
-
-      int orthogonalize_CWY( const int m, const RealType normb, const RealType beta );
-
-      void compute_residue( VectorViewType r, ConstVectorViewType x, ConstVectorViewType b );
-
-      void preconditioned_matvec( VectorViewType w, ConstVectorViewType v );
-
-   // nvcc allows __cuda_callable__ lambdas only in public methods
-   #ifdef __NVCC__
-   public:
-   #endif
-      void hauseholder_generate( const int i,
-                                 VectorViewType y_i,
-                                 ConstVectorViewType z );
-   #ifdef __NVCC__
-   protected:
-   #endif
-
-      void hauseholder_apply_trunc( HostView out,
-                                    const int i,
-                                    VectorViewType y_i,
-                                    ConstVectorViewType z );
-
-      void hauseholder_cwy( VectorViewType v,
-                           const int i );
-
-   // nvcc allows __cuda_callable__ lambdas only in public methods
-   #ifdef __NVCC__
-   public:
-   #endif
-      void hauseholder_cwy_transposed( VectorViewType z,
-                                       const int i,
-                                       ConstVectorViewType w );
-   #ifdef __NVCC__
-   protected:
-   #endif
-
-      template< typename Vector >
-      void update( const int k,
-                  const int m,
-                  const HostVector& H,
-                  const HostVector& s,
-                  DeviceVector& V,
-                  Vector& x );
-
-      void generatePlaneRotation( RealType& dx,
-                                 RealType& dy,
-                                 RealType& cs,
-                                 RealType& sn );
-
-      void applyPlaneRotation( RealType& dx,
-                              RealType& dy,
-                              RealType& cs,
-                              RealType& sn );
-
-      void apply_givens_rotations( const int i, const int m );
-
-      void setSize( const VectorViewType& x );
-
-      // Specialized methods to distinguish between normal and distributed matrices
-      // in the implementation.
-      template< typename M >
-      static IndexType getLocalOffset( const M& m )
-      {
-         return 0;
-      }
-
-      template< typename M >
-      static IndexType getLocalOffset( const Matrices::DistributedMatrix< M >& m )
-      {
-         return m.getLocalRowRange().getBegin();
-      }
-
-      // selected GMRES variant
-      Variant variant = Variant::CWY;
-
-      // single vectors (distributed)
-      VectorType r, w, z, _M_tmp;
-      // matrices (in column-major format) (local)
-      DeviceVector V, Y;
-      // (CWY only) duplicate of the upper (m+1)x(m+1) submatrix of Y (it is lower triangular) for fast access
-      HostVector YL, T;
-      // host-only storage for Givens rotations and the least squares problem
-      HostVector cs, sn, H, s;
-
-      IndexType size = 0;
-      IndexType ldSize = 0;
-      IndexType localOffset = 0;
-      int restarting_min = 10;
-      int restarting_max = 10;
-      int restarting_step_min = 3;
-      int restarting_step_max = 3;
+public:
+   /**
+    * \brief Floating point type used for computations.
+    */
+   using RealType = typename Base::RealType;
+
+   /**
+    * \brief Device where the solver will run on and auxillary data will alloacted on.
+    */
+   using DeviceType = typename Base::DeviceType;
+
+   /**
+    * \brief Type for indexing.
+    */
+   using IndexType = typename Base::IndexType;
+
+   /**
+    * \brief Type for vector view.
+    */
+   using VectorViewType = typename Base::VectorViewType;
+
+   /**
+    * \brief Type for constant vector view.
+    */
+   using ConstVectorViewType = typename Base::ConstVectorViewType;
+
+   /**
+    * \brief This is method defines configuration entries for setup of the linear iterative solver.
+    *
+    * In addition to config entries defined by \ref IterativeSolver::configSetup, this method
+    * defines the following:
+    *
+    * \e gmres-variant - Algorithm used for the orthogonalization - CGS (Classical Gramm-Schmidt),
+    *     CGSR(Classical Gramm-Schmidt with reorthogonalization), MGS(Modified Gramm-Schmidt),
+    *     MGSR(Modified Gramm-Schmidt with reorthogonalization), CWY(Compact WY form of the Householder reflections).
+    *
+    * \e gmres-restarting-min - minimal number of iterations after which the GMRES restarts.
+    *
+    * \e gmres-restarting-max - maximal number of iterations after which the GMRES restarts.
+    *
+    * \e gmres-restarting-step-min - minimal adjusting step for the adaptivity of the GMRES restarting parameter.
+    *
+    * \e gmres-restarting-step-max - maximal adjusting step for the adaptivity of the GMRES restarting parameter.
+    *
+    * \param config contains description of configuration parameters.
+    * \param prefix is a prefix of particular configuration entries.
+    */
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" );
+
+   /**
+    * \brief Method for setup of the linear iterative solver based on configuration parameters.
+    *
+    * \param parameters contains values of the define configuration entries.
+    * \param prefix is a prefix of particular configuration entries.
+    */
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" ) override;
+
+   /**
+    * \brief Method for solving of a linear system.
+    *
+    * See \ref LinearSolver::solve for more details.
+    *
+    * \param b vector with the right-hand side of the linear system.
+    * \param x vector for the solution of the linear system.
+    * \return true if the solver converged.
+    * \return false if the solver did not converge.
+    */
+   bool
+   solve( ConstVectorViewType b, VectorViewType x ) override;
+
+protected:
+   using VectorType = typename Traits::VectorType;
+   // local vectors/views
+   using ConstDeviceView = typename Traits::ConstLocalViewType;
+   using DeviceView = typename Traits::LocalViewType;
+   using DeviceVector = typename Traits::LocalVectorType;
+   using HostView = typename DeviceView::template Self< RealType, Devices::Host >;
+   using HostVector = typename DeviceVector::template Self< RealType, Devices::Host >;
+   ;
+
+   enum class Variant
+   {
+      CGS,
+      CGSR,
+      MGS,
+      MGSR,
+      CWY
+   };
+
+// nvcc allows __cuda_callable__ lambdas only in public methods
+#ifdef __NVCC__
+public:
+#endif
+   int
+   orthogonalize_CGS( int m, RealType normb, RealType beta );
+#ifdef __NVCC__
+protected:
+#endif
+
+   int
+   orthogonalize_MGS( int m, RealType normb, RealType beta );
+
+   int
+   orthogonalize_CWY( int m, RealType normb, RealType beta );
+
+   void
+   compute_residue( VectorViewType r, ConstVectorViewType x, ConstVectorViewType b );
+
+   void
+   preconditioned_matvec( VectorViewType w, ConstVectorViewType v );
+
+// nvcc allows __cuda_callable__ lambdas only in public methods
+#ifdef __NVCC__
+public:
+#endif
+   void
+   hauseholder_generate( int i, VectorViewType y_i, ConstVectorViewType z );
+#ifdef __NVCC__
+protected:
+#endif
+
+   void
+   hauseholder_apply_trunc( HostView out, int i, VectorViewType y_i, ConstVectorViewType z );
+
+   void
+   hauseholder_cwy( VectorViewType v, int i );
+
+// nvcc allows __cuda_callable__ lambdas only in public methods
+#ifdef __NVCC__
+public:
+#endif
+   void
+   hauseholder_cwy_transposed( VectorViewType z, int i, ConstVectorViewType w );
+#ifdef __NVCC__
+protected:
+#endif
+
+   template< typename Vector >
+   void
+   update( int k, int m, const HostVector& H, const HostVector& s, DeviceVector& V, Vector& x );
+
+   void
+   generatePlaneRotation( RealType& dx, RealType& dy, RealType& cs, RealType& sn );
+
+   void
+   applyPlaneRotation( RealType& dx, RealType& dy, RealType& cs, RealType& sn );
+
+   void
+   apply_givens_rotations( int i, int m );
+
+   void
+   setSize( const VectorViewType& x );
+
+   // Specialized methods to distinguish between normal and distributed matrices
+   // in the implementation.
+   template< typename M >
+   static IndexType
+   getLocalOffset( const M& m )
+   {
+      return 0;
+   }
+
+   template< typename M >
+   static IndexType
+   getLocalOffset( const Matrices::DistributedMatrix< M >& m )
+   {
+      return m.getLocalRowRange().getBegin();
+   }
+
+   // selected GMRES variant
+   Variant variant = Variant::CWY;
+
+   // single vectors (distributed)
+   VectorType r, w, z, _M_tmp;
+   // matrices (in column-major format) (local)
+   DeviceVector V, Y;
+   // (CWY only) duplicate of the upper (m+1)x(m+1) submatrix of Y (it is lower triangular) for fast access
+   HostVector YL, T;
+   // host-only storage for Givens rotations and the least squares problem
+   HostVector cs, sn, H, s;
+
+   IndexType size = 0;
+   IndexType ldSize = 0;
+   IndexType localOffset = 0;
+   int restarting_min = 10;
+   int restarting_max = 10;
+   int restarting_step_min = 3;
+   int restarting_step_max = 3;
 };
 
-      } // namespace Linear
-   } // namespace Solvers
-} // namespace TNL
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
 
 #include <TNL/Solvers/Linear/GMRES.hpp>
diff --git a/src/TNL/Solvers/Linear/GMRES.hpp b/src/TNL/Solvers/Linear/GMRES.hpp
index 7832f26c6d610b800042c48471c4dc5125f66452..5a73187cf0f85755e2ec92cc5611ff4e57ca759d 100644
--- a/src/TNL/Solvers/Linear/GMRES.hpp
+++ b/src/TNL/Solvers/Linear/GMRES.hpp
@@ -22,28 +22,28 @@ namespace Linear {
 
 template< typename Matrix >
 void
-GMRES< Matrix >::
-configSetup( Config::ConfigDescription& config,
-             const String& prefix )
+GMRES< Matrix >::configSetup( Config::ConfigDescription& config, const String& prefix )
 {
    LinearSolver< Matrix >::configSetup( config, prefix );
    config.addEntry< String >( prefix + "gmres-variant", "Algorithm used for the orthogonalization.", "MGSR" );
-      config.addEntryEnum( "CGS" );
-      config.addEntryEnum( "CGSR" );
-      config.addEntryEnum( "MGS" );
-      config.addEntryEnum( "MGSR" );
-      config.addEntryEnum( "CWY" );
-   config.addEntry< int >( prefix + "gmres-restarting-min", "Minimal number of iterations after which the GMRES restarts.", 10 );
-   config.addEntry< int >( prefix + "gmres-restarting-max", "Maximal number of iterations after which the GMRES restarts.", 10 );
-   config.addEntry< int >( prefix + "gmres-restarting-step-min", "Minimal adjusting step for the adaptivity of the GMRES restarting parameter.", 3 );
-   config.addEntry< int >( prefix + "gmres-restarting-step-max", "Maximal adjusting step for the adaptivity of the GMRES restarting parameter.", 3 );
+   config.addEntryEnum( "CGS" );
+   config.addEntryEnum( "CGSR" );
+   config.addEntryEnum( "MGS" );
+   config.addEntryEnum( "MGSR" );
+   config.addEntryEnum( "CWY" );
+   config.addEntry< int >(
+      prefix + "gmres-restarting-min", "Minimal number of iterations after which the GMRES restarts.", 10 );
+   config.addEntry< int >(
+      prefix + "gmres-restarting-max", "Maximal number of iterations after which the GMRES restarts.", 10 );
+   config.addEntry< int >(
+      prefix + "gmres-restarting-step-min", "Minimal adjusting step for the adaptivity of the GMRES restarting parameter.", 3 );
+   config.addEntry< int >(
+      prefix + "gmres-restarting-step-max", "Maximal adjusting step for the adaptivity of the GMRES restarting parameter.", 3 );
 }
 
 template< typename Matrix >
 bool
-GMRES< Matrix >::
-setup( const Config::ParameterContainer& parameters,
-       const String& prefix )
+GMRES< Matrix >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    if( parameters.checkParameter( prefix + "gmres-variant" ) ) {
       const String var = parameters.getParameter< String >( prefix + "gmres-variant" );
@@ -75,8 +75,7 @@ setup( const Config::ParameterContainer& parameters,
 
 template< typename Matrix >
 bool
-GMRES< Matrix >::
-solve( ConstVectorViewType b, VectorViewType x )
+GMRES< Matrix >::solve( ConstVectorViewType b, VectorViewType x )
 {
    TNL_ASSERT_TRUE( this->matrix, "No matrix was set in GMRES. Call setMatrix() before solve()." );
    if( restarting_min <= 0 || restarting_max <= 0 || restarting_min > restarting_max ) {
@@ -111,11 +110,11 @@ solve( ConstVectorViewType b, VectorViewType x )
    this->setResidue( beta / normb );
 
    // parameters for the adaptivity of the restarting parameter
-         RealType beta_ratio = 1;           // = beta / beta_ratio (small value indicates good convergence rate)
-   const RealType max_beta_ratio = 0.99;    // = cos(8°) \approx 0.99
-   const RealType min_beta_ratio = 0.175;   // = cos(80°) \approx 0.175
-         int restart_cycles = 0;    // counter of restart cycles
-         int m = restarting_max;    // current restarting parameter
+   RealType beta_ratio = 1;                // = beta / beta_ratio (small value indicates good convergence rate)
+   const RealType max_beta_ratio = 0.99;   // = cos(8°) \approx 0.99
+   const RealType min_beta_ratio = 0.175;  // = cos(80°) \approx 0.175
+   int restart_cycles = 0;                 // counter of restart cycles
+   int m = restarting_max;                 // current restarting parameter
 
    while( this->checkNextIteration() ) {
       // adaptivity of the restarting parameter
@@ -128,9 +127,9 @@ solve( ConstVectorViewType b, VectorViewType x )
          else if( beta_ratio >= min_beta_ratio ) {
             // the step size is determined based on current m using linear interpolation
             // between restarting_step_min and restarting_step_max
-            const int step = restarting_step_min + (float) ( restarting_step_max - restarting_step_min ) /
-                                                           ( restarting_max - restarting_min ) *
-                                                           ( m - restarting_min );
+            const int step = restarting_step_min
+                           + (float) ( restarting_step_max - restarting_step_min ) / ( restarting_max - restarting_min )
+                                * ( m - restarting_min );
             if( m - step >= restarting_min )
                m -= step;
             else
@@ -179,19 +178,18 @@ solve( ConstVectorViewType b, VectorViewType x )
 
 template< typename Matrix >
 int
-GMRES< Matrix >::
-orthogonalize_CGS( const int m, const RealType normb, const RealType beta )
+GMRES< Matrix >::orthogonalize_CGS( const int m, const RealType normb, const RealType beta )
 {
    // initial binding to _M_tmp sets the correct local range, global size and
    // communicator for distributed views
    VectorViewType v_i( _M_tmp.getView() );
-//   VectorViewType v_k( _M_tmp.getView() );
+   //   VectorViewType v_k( _M_tmp.getView() );
 
    /***
     * v_0 = r / | r | =  1.0 / beta * r
     */
    v_i.bind( V.getData(), size );
-   v_i = (1.0 / beta) * r;
+   v_i = ( 1.0 / beta ) * r;
 
    H.setValue( 0.0 );
    s.setValue( 0.0 );
@@ -208,55 +206,56 @@ orthogonalize_CGS( const int m, const RealType normb, const RealType beta )
       preconditioned_matvec( w, v_i );
 
       for( int k = 0; k <= i; k++ )
-         H[ k + i * (m + 1) ] = 0.0;
-      const int reorthogonalize = (variant == Variant::CGSR) ? 2 : 1;
+         H[ k + i * ( m + 1 ) ] = 0.0;
+      const int reorthogonalize = ( variant == Variant::CGSR ) ? 2 : 1;
       for( int l = 0; l < reorthogonalize; l++ ) {
          // auxiliary array for the H coefficients of the current l-loop
-         RealType H_l[i + 1];
+         RealType H_l[ i + 1 ];
 
          // CGS part 1: compute projection coefficients
-//         for( int k = 0; k <= i; k++ ) {
-//            v_k.bind( &V.getData()[ k * ldSize ], size );
-//            H_l[k] = (w, v_k);
-//            H[ k + i * (m + 1) ] += H_l[k];
-//         }
+         //         for( int k = 0; k <= i; k++ ) {
+         //            v_k.bind( &V.getData()[ k * ldSize ], size );
+         //            H_l[k] = (w, v_k);
+         //            H[ k + i * (m + 1) ] += H_l[k];
+         //         }
          // H_l = V_i^T * w
          const RealType* _V = V.getData();
          const RealType* _w = Traits::getConstLocalView( w ).getData();
          const IndexType ldSize = this->ldSize;
-         auto fetch = [_V, _w, ldSize] __cuda_callable__ ( IndexType idx, int k ) { return _V[ idx + k * ldSize ] * _w[ idx ]; };
-         Algorithms::Multireduction< DeviceType >::reduce
-                  ( (RealType) 0,
-                    fetch,
-                    std::plus<>{},
-                    size,
-                    i + 1,
-                    H_l );
+         auto fetch = [ _V, _w, ldSize ] __cuda_callable__( IndexType idx, int k )
+         {
+            return _V[ idx + k * ldSize ] * _w[ idx ];
+         };
+         Algorithms::Multireduction< DeviceType >::reduce( (RealType) 0, fetch, std::plus<>{}, size, i + 1, H_l );
          for( int k = 0; k <= i; k++ )
-            H[ k + i * (m + 1) ] += H_l[k];
+            H[ k + i * ( m + 1 ) ] += H_l[ k ];
 
          // CGS part 2: subtract the projections
-//         for( int k = 0; k <= i; k++ ) {
-//            v_k.bind( &V.getData()[ k * ldSize ], size );
-//            w = w - H_l[k] * v_k;
-//         }
+         //         for( int k = 0; k <= i; k++ ) {
+         //            v_k.bind( &V.getData()[ k * ldSize ], size );
+         //            w = w - H_l[k] * v_k;
+         //         }
          // w := w - V_i * H_l
-         Matrices::MatrixOperations< DeviceType >::
-            gemv( size, (IndexType) i + 1,
-                  (RealType) -1.0, V.getData(), ldSize, H_l,
-                  (RealType) 1.0, Traits::getLocalView( w ).getData() );
+         Matrices::MatrixOperations< DeviceType >::gemv( size,
+                                                         (IndexType) i + 1,
+                                                         (RealType) -1.0,
+                                                         V.getData(),
+                                                         ldSize,
+                                                         H_l,
+                                                         (RealType) 1.0,
+                                                         Traits::getLocalView( w ).getData() );
       }
       /***
        * H_{i+1,i} = |w|
        */
       RealType normw = lpNorm( w, 2.0 );
-      H[ i + 1 + i * (m + 1) ] = normw;
+      H[ i + 1 + i * ( m + 1 ) ] = normw;
 
       /***
        * v_{i+1} = w / |w|
        */
       v_i.bind( &V.getData()[ ( i + 1 ) * ldSize ], size );
-      v_i = (1.0 / normw) * w;
+      v_i = ( 1.0 / normw ) * w;
 
       /****
        * Applying the Givens rotations G_0, ..., G_i
@@ -273,8 +272,7 @@ orthogonalize_CGS( const int m, const RealType normb, const RealType beta )
 
 template< typename Matrix >
 int
-GMRES< Matrix >::
-orthogonalize_MGS( const int m, const RealType normb, const RealType beta )
+GMRES< Matrix >::orthogonalize_MGS( const int m, const RealType normb, const RealType beta )
 {
    // initial binding to _M_tmp sets the correct local range, global size and
    // communicator for distributed views
@@ -285,7 +283,7 @@ orthogonalize_MGS( const int m, const RealType normb, const RealType beta )
     * v_0 = r / | r | =  1.0 / beta * r
     */
    v_i.bind( V.getData(), size );
-   v_i = (1.0 / beta) * r;
+   v_i = ( 1.0 / beta ) * r;
 
    H.setValue( 0.0 );
    s.setValue( 0.0 );
@@ -302,16 +300,16 @@ orthogonalize_MGS( const int m, const RealType normb, const RealType beta )
       preconditioned_matvec( w, v_i );
 
       for( int k = 0; k <= i; k++ )
-         H[ k + i * (m + 1) ] = 0.0;
-      const int reorthogonalize = (variant == Variant::MGSR) ? 2 : 1;
+         H[ k + i * ( m + 1 ) ] = 0.0;
+      const int reorthogonalize = ( variant == Variant::MGSR ) ? 2 : 1;
       for( int l = 0; l < reorthogonalize; l++ )
          for( int k = 0; k <= i; k++ ) {
             v_k.bind( &V.getData()[ k * ldSize ], size );
             /***
              * H_{k,i} = (w, v_k)
              */
-            RealType H_k_i = (w, v_k);
-            H[ k + i * (m + 1) ] += H_k_i;
+            RealType H_k_i = ( w, v_k );
+            H[ k + i * ( m + 1 ) ] += H_k_i;
 
             /****
              * w = w - H_{k,i} v_k
@@ -322,13 +320,13 @@ orthogonalize_MGS( const int m, const RealType normb, const RealType beta )
        * H_{i+1,i} = |w|
        */
       RealType normw = lpNorm( w, 2.0 );
-      H[ i + 1 + i * (m + 1) ] = normw;
+      H[ i + 1 + i * ( m + 1 ) ] = normw;
 
       /***
        * v_{i+1} = w / |w|
        */
       v_i.bind( &V.getData()[ ( i + 1 ) * ldSize ], size );
-      v_i = (1.0 / normw) * w;
+      v_i = ( 1.0 / normw ) * w;
 
       /****
        * Applying the Givens rotations G_0, ..., G_i
@@ -345,8 +343,7 @@ orthogonalize_MGS( const int m, const RealType normb, const RealType beta )
 
 template< typename Matrix >
 int
-GMRES< Matrix >::
-orthogonalize_CWY( const int m, const RealType normb, const RealType beta )
+GMRES< Matrix >::orthogonalize_CWY( const int m, const RealType normb, const RealType beta )
 {
    // initial binding to _M_tmp sets the correct local range, global size and
    // communicator for distributed views
@@ -357,8 +354,8 @@ orthogonalize_CWY( const int m, const RealType normb, const RealType beta )
     * z = r / | r | =  1.0 / beta * r
     */
    // TODO: investigate normalization by beta and normb
-//   z = (1.0 / beta) * r;
-//   z = (1.0 / normb) * r;
+   //   z = (1.0 / beta) * r;
+   //   z = (1.0 / normb) * r;
    z = r;
 
    H.setValue( 0.0 );
@@ -366,7 +363,7 @@ orthogonalize_CWY( const int m, const RealType normb, const RealType beta )
    T.setValue( 0.0 );
 
    // NOTE: this is unstable, s[0] is set later in hauseholder_apply_trunc
-//   s[ 0 ] = beta;
+   //   s[ 0 ] = beta;
 
    /****
     * Starting m-loop
@@ -388,7 +385,7 @@ orthogonalize_CWY( const int m, const RealType normb, const RealType beta )
          /***
           * H_{i-1} = P_i * z
           */
-         HostView h( &H.getData()[ (i - 1) * (m + 1) ], m + 1 );
+         HostView h( &H.getData()[ ( i - 1 ) * ( m + 1 ) ], m + 1 );
          hauseholder_apply_trunc( h, i, y_i, z );
       }
 
@@ -397,7 +394,7 @@ orthogonalize_CWY( const int m, const RealType normb, const RealType beta )
        *     v_i = (I - Y_i * T_i Y_i^T) * e_i
        */
       // vectors v_i are not stored, they can be reconstructed in the update() method
-//      v_i.bind( &V.getData()[ i * ldSize ], size );
+      //      v_i.bind( &V.getData()[ i * ldSize ], size );
       v_i.bind( V.getData(), size );
       hauseholder_cwy( v_i, i );
 
@@ -423,15 +420,14 @@ orthogonalize_CWY( const int m, const RealType normb, const RealType beta )
       this->setResidue( std::fabs( s[ i ] ) / normb );
       if( i > 0 && ! this->checkNextIteration() )
          return i - 1;
-  }
+   }
 
    return m;
 }
 
 template< typename Matrix >
 void
-GMRES< Matrix >::
-compute_residue( VectorViewType r, ConstVectorViewType x, ConstVectorViewType b )
+GMRES< Matrix >::compute_residue( VectorViewType r, ConstVectorViewType x, ConstVectorViewType b )
 {
    /****
     * r = M.solve(b - A * x);
@@ -449,8 +445,7 @@ compute_residue( VectorViewType r, ConstVectorViewType x, ConstVectorViewType b
 
 template< typename Matrix >
 void
-GMRES< Matrix >::
-preconditioned_matvec( VectorViewType w, ConstVectorViewType v )
+GMRES< Matrix >::preconditioned_matvec( VectorViewType w, ConstVectorViewType v )
 {
    /****
     * w = M.solve(A * v_i);
@@ -465,17 +460,14 @@ preconditioned_matvec( VectorViewType w, ConstVectorViewType v )
 
 template< typename Matrix >
 void
-GMRES< Matrix >::
-hauseholder_generate( const int i,
-                      VectorViewType y_i,
-                      ConstVectorViewType z )
+GMRES< Matrix >::hauseholder_generate( const int i, VectorViewType y_i, ConstVectorViewType z )
 {
    // XXX: the upper-right triangle of Y will be full of zeros, which can be exploited for optimization
    ConstDeviceView z_local = Traits::getConstLocalView( z );
    DeviceView y_i_local = Traits::getLocalView( y_i );
    if( localOffset == 0 ) {
       TNL_ASSERT_LT( i, size, "upper-right triangle of Y is not on rank 0" );
-      auto kernel_truncation = [=] __cuda_callable__ ( IndexType j ) mutable
+      auto kernel_truncation = [ = ] __cuda_callable__( IndexType j ) mutable
       {
          if( j < i )
             y_i_local[ j ] = 0.0;
@@ -501,63 +493,57 @@ hauseholder_generate( const int i,
       // compute the norm of the y_i vector; equivalent to this calculation by definition:
       //       norm_yi_squared = y_i.lpNorm( 2.0 );
       //       norm_yi_squared = norm_yi_squared * norm_yi_squared
-      norm_yi_squared = 2 * (normz * normz + std::fabs( y_ii ) * normz);
+      norm_yi_squared = 2 * ( normz * normz + std::fabs( y_ii ) * normz );
    }
    // no-op if the problem is not distributed
    MPI::Bcast( &norm_yi_squared, 1, 0, Traits::getCommunicator( *this->matrix ) );
 
    // XXX: normalization is slower, but more stable
-//   y_i *= 1.0 / std::sqrt( norm_yi_squared );
-//   const RealType t_i = 2.0;
+   //   y_i *= 1.0 / std::sqrt( norm_yi_squared );
+   //   const RealType t_i = 2.0;
    // assuming it's stable enough...
    const RealType t_i = 2.0 / norm_yi_squared;
 
-   T[ i + i * (restarting_max + 1) ] = t_i;
+   T[ i + i * ( restarting_max + 1 ) ] = t_i;
    if( i > 0 ) {
       // aux = Y_{i-1}^T * y_i
       RealType aux[ i ];
       const RealType* _Y = Y.getData();
       const RealType* _y_i = Traits::getConstLocalView( y_i ).getData();
       const IndexType ldSize = this->ldSize;
-      auto fetch = [_Y, _y_i, ldSize] __cuda_callable__ ( IndexType idx, int k ) { return _Y[ idx + k * ldSize ] * _y_i[ idx ]; };
-      Algorithms::Multireduction< DeviceType >::reduce
-               ( (RealType) 0,
-                 fetch,
-                 std::plus<>{},
-                 size,
-                 i,
-                 aux );
+      auto fetch = [ _Y, _y_i, ldSize ] __cuda_callable__( IndexType idx, int k )
+      {
+         return _Y[ idx + k * ldSize ] * _y_i[ idx ];
+      };
+      Algorithms::Multireduction< DeviceType >::reduce( (RealType) 0, fetch, std::plus<>{}, size, i, aux );
       // no-op if the problem is not distributed
       MPI::Allreduce( aux, i, MPI_SUM, Traits::getCommunicator( *this->matrix ) );
 
       // [T_i]_{0..i-1} = - T_{i-1} * t_i * aux
       for( int k = 0; k < i; k++ ) {
-         T[ k + i * (restarting_max + 1) ] = 0.0;
+         T[ k + i * ( restarting_max + 1 ) ] = 0.0;
          for( int j = k; j < i; j++ )
-            T[ k + i * (restarting_max + 1) ] -= T[ k + j * (restarting_max + 1) ] * (t_i * aux[ j ]);
+            T[ k + i * ( restarting_max + 1 ) ] -= T[ k + j * ( restarting_max + 1 ) ] * ( t_i * aux[ j ] );
       }
    }
 }
 
 template< typename Matrix >
 void
-GMRES< Matrix >::
-hauseholder_apply_trunc( HostView out,
-                         const int i,
-                         VectorViewType y_i,
-                         ConstVectorViewType z )
+GMRES< Matrix >::hauseholder_apply_trunc( HostView out, const int i, VectorViewType y_i, ConstVectorViewType z )
 {
    // copy part of y_i to the YL buffer
    // The upper (m+1)x(m+1) submatrix of Y is duplicated in the YL buffer,
    // which resides on host and is broadcasted from rank 0 to all processes.
-   HostView YL_i( &YL[ i * (restarting_max + 1) ], restarting_max + 1 );
-   Algorithms::MultiDeviceMemoryOperations< Devices::Host, DeviceType >::copy( YL_i.getData(), Traits::getLocalView( y_i ).getData(), YL_i.getSize() );
+   HostView YL_i( &YL[ i * ( restarting_max + 1 ) ], restarting_max + 1 );
+   Algorithms::MultiDeviceMemoryOperations< Devices::Host, DeviceType >::copy(
+      YL_i.getData(), Traits::getLocalView( y_i ).getData(), YL_i.getSize() );
    // no-op if the problem is not distributed
    MPI::Bcast( YL_i.getData(), YL_i.getSize(), 0, Traits::getCommunicator( *this->matrix ) );
 
    // NOTE: aux = t_i * (y_i, z) = 1  since  t_i = 2 / ||y_i||^2  and
    //       (y_i, z) = ||z_trunc||^2 + |z_i| ||z_trunc|| = ||y_i||^2 / 2
-//   const RealType aux = T[ i + i * (restarting_max + 1) ] * (y_i, z);
+   //   const RealType aux = T[ i + i * (restarting_max + 1) ] * (y_i, z);
    constexpr RealType aux = 1.0;
    if( localOffset == 0 ) {
       if( std::is_same< DeviceType, Devices::Host >::value ) {
@@ -566,7 +552,8 @@ hauseholder_apply_trunc( HostView out,
       }
       if( std::is_same< DeviceType, Devices::Cuda >::value ) {
          RealType host_z[ i + 1 ];
-         Algorithms::MultiDeviceMemoryOperations< Devices::Host, Devices::Cuda >::copy( host_z, Traits::getConstLocalView( z ).getData(), i + 1 );
+         Algorithms::MultiDeviceMemoryOperations< Devices::Host, Devices::Cuda >::copy(
+            host_z, Traits::getConstLocalView( z ).getData(), i + 1 );
          for( int k = 0; k <= i; k++ )
             out[ k ] = host_z[ k ] - YL_i[ k ] * aux;
       }
@@ -578,55 +565,45 @@ hauseholder_apply_trunc( HostView out,
 
 template< typename Matrix >
 void
-GMRES< Matrix >::
-hauseholder_cwy( VectorViewType v,
-                 const int i )
+GMRES< Matrix >::hauseholder_cwy( VectorViewType v, const int i )
 {
    // aux = Y_i^T * e_i
    RealType aux[ i + 1 ];
    // the upper (m+1)x(m+1) submatrix of Y is duplicated on host
    // (faster access than from the device and it is broadcasted to all processes)
    for( int k = 0; k <= i; k++ )
-      aux[ k ] = YL[ i + k * (restarting_max + 1) ];
+      aux[ k ] = YL[ i + k * ( restarting_max + 1 ) ];
 
    // aux = T_i * aux
    // Note that T_i is upper triangular, so we can overwrite the aux vector with the result in place
    for( int k = 0; k <= i; k++ ) {
       RealType aux2 = 0.0;
       for( int j = k; j <= i; j++ )
-         aux2 += T[ k + j * (restarting_max + 1) ] * aux[ j ];
+         aux2 += T[ k + j * ( restarting_max + 1 ) ] * aux[ j ];
       aux[ k ] = aux2;
    }
 
    // v = e_i - Y_i * aux
-   Matrices::MatrixOperations< DeviceType >::
-      gemv( size, (IndexType) i + 1,
-            (RealType) -1.0, Y.getData(), ldSize, aux,
-            (RealType) 0.0, Traits::getLocalView( v ).getData() );
+   Matrices::MatrixOperations< DeviceType >::gemv(
+      size, (IndexType) i + 1, (RealType) -1.0, Y.getData(), ldSize, aux, (RealType) 0.0, Traits::getLocalView( v ).getData() );
    if( localOffset == 0 )
       v.setElement( i, 1.0 + v.getElement( i ) );
 }
 
 template< typename Matrix >
 void
-GMRES< Matrix >::
-hauseholder_cwy_transposed( VectorViewType z,
-                            const int i,
-                            ConstVectorViewType w )
+GMRES< Matrix >::hauseholder_cwy_transposed( VectorViewType z, const int i, ConstVectorViewType w )
 {
    // aux = Y_i^T * w
    RealType aux[ i + 1 ];
    const RealType* _Y = Y.getData();
    const RealType* _w = Traits::getConstLocalView( w ).getData();
    const IndexType ldSize = this->ldSize;
-   auto fetch = [_Y, _w, ldSize] __cuda_callable__ ( IndexType idx, int k ) { return _Y[ idx + k * ldSize ] * _w[ idx ]; };
-   Algorithms::Multireduction< DeviceType >::reduce
-            ( (RealType) 0,
-              fetch,
-              std::plus<>{},
-              size,
-              i + 1,
-              aux );
+   auto fetch = [ _Y, _w, ldSize ] __cuda_callable__( IndexType idx, int k )
+   {
+      return _Y[ idx + k * ldSize ] * _w[ idx ];
+   };
+   Algorithms::Multireduction< DeviceType >::reduce( (RealType) 0, fetch, std::plus<>{}, size, i + 1, aux );
    // no-op if the problem is not distributed
    MPI::Allreduce( aux, i + 1, MPI_SUM, Traits::getCommunicator( *this->matrix ) );
 
@@ -635,58 +612,48 @@ hauseholder_cwy_transposed( VectorViewType z,
    for( int k = i; k >= 0; k-- ) {
       RealType aux2 = 0.0;
       for( int j = 0; j <= k; j++ )
-         aux2 += T[ j + k * (restarting_max + 1) ] * aux[ j ];
+         aux2 += T[ j + k * ( restarting_max + 1 ) ] * aux[ j ];
       aux[ k ] = aux2;
    }
 
    // z = w - Y_i * aux
    z = w;
-   Matrices::MatrixOperations< DeviceType >::
-      gemv( size, (IndexType) i + 1,
-            (RealType) -1.0, Y.getData(), ldSize, aux,
-            (RealType) 1.0, Traits::getLocalView( z ).getData() );
+   Matrices::MatrixOperations< DeviceType >::gemv(
+      size, (IndexType) i + 1, (RealType) -1.0, Y.getData(), ldSize, aux, (RealType) 1.0, Traits::getLocalView( z ).getData() );
 }
 
 template< typename Matrix >
-   template< typename Vector >
+template< typename Vector >
 void
-GMRES< Matrix >::
-update( const int k,
-        const int m,
-        const HostVector& H,
-        const HostVector& s,
-        DeviceVector& V,
-        Vector& x )
+GMRES< Matrix >::update( const int k, const int m, const HostVector& H, const HostVector& s, DeviceVector& V, Vector& x )
 {
    RealType y[ m + 1 ];
 
-   for( int i = 0; i <= m ; i ++ )
+   for( int i = 0; i <= m; i++ )
       y[ i ] = s[ i ];
 
    // Backsolve:
-   for( int i = k; i >= 0; i--) {
+   for( int i = k; i >= 0; i-- ) {
       if( H[ i + i * ( m + 1 ) ] == 0 ) {
-//         for( int _i = 0; _i <= i; _i++ ) {
-//             for( int _j = 0; _j < i; _j++ )
-//                std::cout << H[ _i + _j * (m+1) ] << "  ";
-//            std::cout << std::endl;
-//         }
+         //         for( int _i = 0; _i <= i; _i++ ) {
+         //             for( int _j = 0; _j < i; _j++ )
+         //                std::cout << H[ _i + _j * (m+1) ] << "  ";
+         //            std::cout << std::endl;
+         //         }
          std::cerr << "H.norm = " << lpNorm( H, 2.0 ) << std::endl;
          std::cerr << "s = " << s << std::endl;
          std::cerr << "k = " << k << ", m = " << m << std::endl;
          throw 1;
       }
       y[ i ] /= H[ i + i * ( m + 1 ) ];
-      for( int j = i - 1; j >= 0; j--)
+      for( int j = i - 1; j >= 0; j-- )
          y[ j ] -= H[ j + i * ( m + 1 ) ] * y[ i ];
    }
 
    if( variant != Variant::CWY ) {
       // x = V * y + x
-      Matrices::MatrixOperations< DeviceType >::
-         gemv( size, (IndexType) k + 1,
-               (RealType) 1.0, V.getData(), ldSize, y,
-               (RealType) 1.0, Traits::getLocalView( x ).getData() );
+      Matrices::MatrixOperations< DeviceType >::gemv(
+         size, (IndexType) k + 1, (RealType) 1.0, V.getData(), ldSize, y, (RealType) 1.0, Traits::getLocalView( x ).getData() );
    }
    else {
       // The vectors v_i are not stored, they can be reconstructed as P_0...P_j * e_j.
@@ -702,7 +669,7 @@ update( const int k,
          // the upper (m+1)x(m+1) submatrix of Y is duplicated on host
          // (faster access than from the device and it is broadcasted to all processes)
          for( int i = 0; i <= j; i++ )
-            aux[ i ] += y[ j ] * YL[ j + i * (restarting_max + 1) ];
+            aux[ i ] += y[ j ] * YL[ j + i * ( restarting_max + 1 ) ];
       }
 
       // aux = T_{k+1} * aux
@@ -710,15 +677,19 @@ update( const int k,
       for( int i = 0; i <= k; i++ ) {
          RealType aux2 = 0.0;
          for( int j = i; j <= k; j++ )
-            aux2 += T[ i + j * (restarting_max + 1) ] * aux[ j ];
+            aux2 += T[ i + j * ( restarting_max + 1 ) ] * aux[ j ];
          aux[ i ] = aux2;
       }
 
       // x -= Y_{k+1} * aux
-      Matrices::MatrixOperations< DeviceType >::
-         gemv( size, (IndexType) k + 1,
-               (RealType) -1.0, Y.getData(), ldSize, aux,
-               (RealType) 1.0, Traits::getLocalView( x ).getData() );
+      Matrices::MatrixOperations< DeviceType >::gemv( size,
+                                                      (IndexType) k + 1,
+                                                      (RealType) -1.0,
+                                                      Y.getData(),
+                                                      ldSize,
+                                                      aux,
+                                                      (RealType) 1.0,
+                                                      Traits::getLocalView( x ).getData() );
 
       // x += y
       if( localOffset == 0 )
@@ -729,11 +700,7 @@ update( const int k,
 
 template< typename Matrix >
 void
-GMRES< Matrix >::
-generatePlaneRotation( RealType& dx,
-                       RealType& dy,
-                       RealType& cs,
-                       RealType& sn )
+GMRES< Matrix >::generatePlaneRotation( RealType& dx, RealType& dy, RealType& cs, RealType& sn )
 {
    if( dy == 0.0 ) {
       cs = 1.0;
@@ -753,11 +720,7 @@ generatePlaneRotation( RealType& dx,
 
 template< typename Matrix >
 void
-GMRES< Matrix >::
-applyPlaneRotation( RealType& dx,
-                    RealType& dy,
-                    RealType& cs,
-                    RealType& sn )
+GMRES< Matrix >::applyPlaneRotation( RealType& dx, RealType& dy, RealType& cs, RealType& sn )
 {
    const RealType temp = cs * dx + sn * dy;
    dy = cs * dy - sn * dx;
@@ -766,35 +729,21 @@ applyPlaneRotation( RealType& dx,
 
 template< typename Matrix >
 void
-GMRES< Matrix >::
-apply_givens_rotations( int i, int m )
+GMRES< Matrix >::apply_givens_rotations( int i, int m )
 {
    for( int k = 0; k < i; k++ )
-      applyPlaneRotation( H[ k     + i * (m + 1) ],
-                          H[ k + 1 + i * (m + 1) ],
-                          cs[ k ],
-                          sn[ k ] );
-
-   if( H[ i + 1 + i * (m + 1) ] != 0.0 ) {
-      generatePlaneRotation( H[ i     + i * (m + 1) ],
-                             H[ i + 1 + i * (m + 1) ],
-                             cs[ i ],
-                             sn[ i ]);
-      applyPlaneRotation( H[ i     + i * (m + 1) ],
-                          H[ i + 1 + i * (m + 1) ],
-                          cs[ i ],
-                          sn[ i ]);
-      applyPlaneRotation( s[ i     ],
-                          s[ i + 1 ],
-                          cs[ i ],
-                          sn[ i ] );
+      applyPlaneRotation( H[ k + i * ( m + 1 ) ], H[ k + 1 + i * ( m + 1 ) ], cs[ k ], sn[ k ] );
+
+   if( H[ i + 1 + i * ( m + 1 ) ] != 0.0 ) {
+      generatePlaneRotation( H[ i + i * ( m + 1 ) ], H[ i + 1 + i * ( m + 1 ) ], cs[ i ], sn[ i ] );
+      applyPlaneRotation( H[ i + i * ( m + 1 ) ], H[ i + 1 + i * ( m + 1 ) ], cs[ i ], sn[ i ] );
+      applyPlaneRotation( s[ i ], s[ i + 1 ], cs[ i ], sn[ i ] );
    }
 }
 
 template< typename Matrix >
 void
-GMRES< Matrix >::
-setSize( const VectorViewType& x )
+GMRES< Matrix >::setSize( const VectorViewType& x )
 {
    this->size = Traits::getLocalView( x ).getSize();
    if( std::is_same< DeviceType, Devices::Cuda >::value )
@@ -818,8 +767,8 @@ setSize( const VectorViewType& x )
    if( variant == Variant::CWY ) {
       z.setLike( x );
       Y.setSize( ldSize * ( m + 1 ) );
-      T.setSize( (m + 1) * (m + 1) );
-      YL.setSize( (m + 1) * (m + 1) );
+      T.setSize( ( m + 1 ) * ( m + 1 ) );
+      YL.setSize( ( m + 1 ) * ( m + 1 ) );
       // vectors v_i are not stored, they can be reconstructed in the update() method
       V.setLike( x );
    }
@@ -828,6 +777,6 @@ setSize( const VectorViewType& x )
    }
 }
 
-} // namespace Linear
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/Linear/Jacobi.h b/src/TNL/Solvers/Linear/Jacobi.h
index 433ae4a1c90a95f3860f31b2223cfe3294bb83aa..63eb4319c6c63207a28cd8e2d6a67c2be3c418e2 100644
--- a/src/TNL/Solvers/Linear/Jacobi.h
+++ b/src/TNL/Solvers/Linear/Jacobi.h
@@ -9,8 +9,8 @@
 #include <TNL/Solvers/Linear/LinearSolver.h>
 
 namespace TNL {
-   namespace Solvers {
-      namespace Linear {
+namespace Solvers {
+namespace Linear {
 
 /**
  * \brief Iterative solver of linear systems based on the Jacobi method.
@@ -22,117 +22,123 @@ namespace TNL {
  * \tparam Matrix is type of matrix describing the linear system.
  */
 template< typename Matrix >
-class Jacobi
-: public LinearSolver< Matrix >
+class Jacobi : public LinearSolver< Matrix >
 {
    using Base = LinearSolver< Matrix >;
    using VectorType = typename Traits< Matrix >::VectorType;
 
-   public:
-
-      /**
-       * \brief Floating point type used for computations.
-       */
-      using RealType = typename Base::RealType;
-
-      /**
-       * \brief Device where the solver will run on and auxillary data will alloacted on.
-       */
-      using DeviceType = typename Base::DeviceType;
-
-      /**
-       * \brief Type for indexing.
-       */
-      using IndexType = typename Base::IndexType;
-
-      /**
-       * \brief Type for vector view.
-       */
-      using VectorViewType = typename Base::VectorViewType;
-
-      /**
-       * \brief Type for constant vector view.
-       */
-      using ConstVectorViewType = typename Base::ConstVectorViewType;
-
-      /**
-       * \brief This is method defines configuration entries for setup of the linear iterative solver.
-       *
-       * In addition to config entries defined by \ref IterativeSolver::configSetup, this method
-       * defines the following:
-       *
-       * \e jacobi-omega - relaxation parameter of the weighted/damped Jacobi method - 1.0 by default.
-       * \e residue-period - number of iterations between subsequent recomputations of the residue - 4 by default.
-       *
-       * \param config contains description of configuration parameters.
-       * \param prefix is a prefix of particular configuration entries.
-       */
-      static void configSetup( Config::ConfigDescription& config, const String& prefix = "" );
-
-      /**
-       * \brief Method for setup of the linear iterative solver based on configuration parameters.
-       *
-       * \param parameters contains values of the define configuration entries.
-       * \param prefix is a prefix of particular configuration entries.
-       */
-      bool setup( const Config::ParameterContainer& parameters, const String& prefix = "" ) override;
-
-      /**
-       * \brief Setter of the relaxation parameter.
-       *
-       * \param omega the relaxation parameter. It is 1 by default.
-       */
-      void setOmega( RealType omega );
-
-      /**
-       * \brief Getter of the relaxation parameter.
-       *
-       * \return value of the relaxation parameter.
-       */
-      RealType getOmega() const;
-
-      /**
-       * \brief Set the period for a recomputation of the residue.
-       *
-       * \param period number of iterations between subsequent recomputations of the residue.
-       */
-      void setResiduePeriod( IndexType period );
-
-      /**
-       * \brief Get the period for a recomputation of the residue.
-       *
-       * \return number of iterations between subsequent recomputations of the residue.
-       */
-      IndexType getResiduePerid() const;
-
-      /**
-       * \brief Method for solving of a linear system.
-       *
-       * See \ref LinearSolver::solve for more details.
-       *
-       * \param b vector with the right-hand side of the linear system.
-       * \param x vector for the solution of the linear system.
-       * \return true if the solver converged.
-       * \return false if the solver did not converge.
-       */
-      bool solve( ConstVectorViewType b, VectorViewType x ) override;
-
-   protected:
-      RealType omega = 1.0;
-
-      IndexType residuePeriod = 4;
-
-      VectorType diagonal;
-
-   public: // because nvcc does not accept lambda functions within private or protected methods
-      void performIteration( const ConstVectorViewType& b,
-                           const ConstVectorViewType& diagonalView,
-                           const ConstVectorViewType& in,
-                           VectorViewType& out ) const;
+public:
+   /**
+    * \brief Floating point type used for computations.
+    */
+   using RealType = typename Base::RealType;
+
+   /**
+    * \brief Device where the solver will run on and auxillary data will alloacted on.
+    */
+   using DeviceType = typename Base::DeviceType;
+
+   /**
+    * \brief Type for indexing.
+    */
+   using IndexType = typename Base::IndexType;
+
+   /**
+    * \brief Type for vector view.
+    */
+   using VectorViewType = typename Base::VectorViewType;
+
+   /**
+    * \brief Type for constant vector view.
+    */
+   using ConstVectorViewType = typename Base::ConstVectorViewType;
+
+   /**
+    * \brief This is method defines configuration entries for setup of the linear iterative solver.
+    *
+    * In addition to config entries defined by \ref IterativeSolver::configSetup, this method
+    * defines the following:
+    *
+    * \e jacobi-omega - relaxation parameter of the weighted/damped Jacobi method - 1.0 by default.
+    * \e residue-period - number of iterations between subsequent recomputations of the residue - 4 by default.
+    *
+    * \param config contains description of configuration parameters.
+    * \param prefix is a prefix of particular configuration entries.
+    */
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" );
+
+   /**
+    * \brief Method for setup of the linear iterative solver based on configuration parameters.
+    *
+    * \param parameters contains values of the define configuration entries.
+    * \param prefix is a prefix of particular configuration entries.
+    */
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" ) override;
+
+   /**
+    * \brief Setter of the relaxation parameter.
+    *
+    * \param omega the relaxation parameter. It is 1 by default.
+    */
+   void
+   setOmega( RealType omega );
+
+   /**
+    * \brief Getter of the relaxation parameter.
+    *
+    * \return value of the relaxation parameter.
+    */
+   RealType
+   getOmega() const;
+
+   /**
+    * \brief Set the period for a recomputation of the residue.
+    *
+    * \param period number of iterations between subsequent recomputations of the residue.
+    */
+   void
+   setResiduePeriod( IndexType period );
+
+   /**
+    * \brief Get the period for a recomputation of the residue.
+    *
+    * \return number of iterations between subsequent recomputations of the residue.
+    */
+   IndexType
+   getResiduePerid() const;
+
+   /**
+    * \brief Method for solving of a linear system.
+    *
+    * See \ref LinearSolver::solve for more details.
+    *
+    * \param b vector with the right-hand side of the linear system.
+    * \param x vector for the solution of the linear system.
+    * \return true if the solver converged.
+    * \return false if the solver did not converge.
+    */
+   bool
+   solve( ConstVectorViewType b, VectorViewType x ) override;
+
+protected:
+   RealType omega = 1.0;
+
+   IndexType residuePeriod = 4;
+
+   VectorType diagonal;
+
+public:  // because nvcc does not accept lambda functions within private or protected methods
+   void
+   performIteration( const ConstVectorViewType& b,
+                     const ConstVectorViewType& diagonalView,
+                     const ConstVectorViewType& in,
+                     VectorViewType& out ) const;
 };
 
-      } // namespace Linear
-   } // namespace Solvers
-} // namespace TNL
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
 
 #include <TNL/Solvers/Linear/Jacobi.hpp>
diff --git a/src/TNL/Solvers/Linear/Jacobi.hpp b/src/TNL/Solvers/Linear/Jacobi.hpp
index f9578f9675d1b0d8dbc01d281b29d353fa832576..ceda118d54084a1286b7a2f317c762f625eda7d5 100644
--- a/src/TNL/Solvers/Linear/Jacobi.hpp
+++ b/src/TNL/Solvers/Linear/Jacobi.hpp
@@ -11,29 +11,28 @@
 #include <TNL/Solvers/Linear/Utils/LinearResidueGetter.h>
 
 namespace TNL {
-   namespace Solvers {
-      namespace Linear {
+namespace Solvers {
+namespace Linear {
 
 template< typename Matrix >
 void
-Jacobi< Matrix >::
-configSetup( Config::ConfigDescription& config, const String& prefix )
+Jacobi< Matrix >::configSetup( Config::ConfigDescription& config, const String& prefix )
 {
    LinearSolver< Matrix >::configSetup( config, prefix );
    config.addEntry< double >( prefix + "jacobi-omega", "Relaxation parameter of the weighted/damped Jacobi method.", 1.0 );
-   config.addEntry< int >( prefix + "residue-period", "Number of iterations between subsequent recomputations of the residue.", 4 );
+   config.addEntry< int >(
+      prefix + "residue-period", "Number of iterations between subsequent recomputations of the residue.", 4 );
 }
 
 template< typename Matrix >
 bool
-Jacobi< Matrix >::
-setup( const Config::ParameterContainer& parameters, const String& prefix )
+Jacobi< Matrix >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    if( parameters.checkParameter( prefix + "jacobi-omega" ) )
       this->setOmega( parameters.getParameter< double >( prefix + "jacobi-omega" ) );
-   if( this->omega <= 0.0 || this->omega > 2.0 )
-   {
-      std::cerr << "Warning: The Jacobi method parameter omega is out of interval (0,2). The value is " << this->omega << " the method will not converge." << std::endl;
+   if( this->omega <= 0.0 || this->omega > 2.0 ) {
+      std::cerr << "Warning: The Jacobi method parameter omega is out of interval (0,2). The value is " << this->omega
+                << " the method will not converge." << std::endl;
    }
    if( parameters.checkParameter( prefix + "residue-period" ) )
       this->setResiduePeriod( parameters.getParameter< int >( prefix + "residue-period" ) );
@@ -42,40 +41,35 @@ setup( const Config::ParameterContainer& parameters, const String& prefix )
 
 template< typename Matrix >
 void
-Jacobi< Matrix >::
-setOmega( RealType omega )
+Jacobi< Matrix >::setOmega( RealType omega )
 {
    this->omega = omega;
 }
 
 template< typename Matrix >
 auto
-Jacobi< Matrix >::
-getOmega() const -> RealType
+Jacobi< Matrix >::getOmega() const -> RealType
 {
    return omega;
 }
 
 template< typename Matrix >
 void
-Jacobi< Matrix >::
-setResiduePeriod( IndexType period )
+Jacobi< Matrix >::setResiduePeriod( IndexType period )
 {
    this->residuePeriod = period;
 }
 
 template< typename Matrix >
 auto
-Jacobi< Matrix >::
-getResiduePerid() const -> IndexType
+Jacobi< Matrix >::getResiduePerid() const -> IndexType
 {
    return this->residuePeriod;
 }
 
 template< typename Matrix >
 bool
-Jacobi< Matrix >::
-solve( ConstVectorViewType b, VectorViewType x )
+Jacobi< Matrix >::solve( ConstVectorViewType b, VectorViewType x )
 {
    VectorType aux;
    aux.setLike( x );
@@ -84,8 +78,11 @@ solve( ConstVectorViewType b, VectorViewType x )
    // Fetch diagonal elements
    this->diagonal.setLike( x );
    auto diagonalView = this->diagonal.getView();
-   auto fetch_diagonal = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, const IndexType& columnIdx, const RealType& value ) mutable {
-      if( columnIdx == rowIdx ) diagonalView[ rowIdx ] = value;
+   auto fetch_diagonal =
+      [ = ] __cuda_callable__( IndexType rowIdx, IndexType localIdx, const IndexType& columnIdx, const RealType& value ) mutable
+   {
+      if( columnIdx == rowIdx )
+         diagonalView[ rowIdx ] = value;
    };
    this->matrix->forAllElements( fetch_diagonal );
 
@@ -95,10 +92,9 @@ solve( ConstVectorViewType b, VectorViewType x )
    auto bView = b.getView();
    auto xView = x.getView();
    auto auxView = aux.getView();
-   RealType bNorm = lpNorm( b, ( RealType ) 2.0 );
+   RealType bNorm = lpNorm( b, (RealType) 2.0 );
    aux = x;
-   while( this->nextIteration() )
-   {
+   while( this->nextIteration() ) {
       this->performIteration( bView, diagonalView, xView, auxView );
       if( this->getIterations() % this->residuePeriod == 0 )
          this->setResidue( LinearResidueGetter::getResidue( *this->matrix, x, b, bNorm ) );
@@ -106,7 +102,6 @@ solve( ConstVectorViewType b, VectorViewType x )
       this->performIteration( bView, diagonalView, auxView, xView );
       if( ( this->getIterations() ) % this->residuePeriod == 0 )
          this->setResidue( LinearResidueGetter::getResidue( *this->matrix, x, b, bNorm ) );
-
    }
    this->setResidue( LinearResidueGetter::getResidue( *this->matrix, x, b, bNorm ) );
    return this->checkConvergence();
@@ -114,22 +109,23 @@ solve( ConstVectorViewType b, VectorViewType x )
 
 template< typename Matrix >
 void
-Jacobi< Matrix >::
-performIteration( const ConstVectorViewType& b,
-                  const ConstVectorViewType& diagonalView,
-                  const ConstVectorViewType& in,
-                  VectorViewType& out ) const
+Jacobi< Matrix >::performIteration( const ConstVectorViewType& b,
+                                    const ConstVectorViewType& diagonalView,
+                                    const ConstVectorViewType& in,
+                                    VectorViewType& out ) const
 {
    const RealType omega_ = this->omega;
-   auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, const RealType& value ) {
-         return value * in[ columnIdx ];
+   auto fetch = [ = ] __cuda_callable__( IndexType rowIdx, IndexType columnIdx, const RealType& value )
+   {
+      return value * in[ columnIdx ];
    };
-   auto keep = [=] __cuda_callable__ ( IndexType rowIdx, const RealType& value ) mutable {
+   auto keep = [ = ] __cuda_callable__( IndexType rowIdx, const RealType& value ) mutable
+   {
       out[ rowIdx ] = in[ rowIdx ] + omega_ / diagonalView[ rowIdx ] * ( b[ rowIdx ] - value );
    };
    this->matrix->reduceAllRows( fetch, TNL::Plus{}, keep, 0.0 );
 }
 
-      } // namespace Linear
-   } // namespace Solvers
-} // namespace TNL
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/Linear/LinearSolver.h b/src/TNL/Solvers/Linear/LinearSolver.h
index 33b7fcb2602f09459898e8002241f1f25325dbe4..c1af67cb0904766e0f110994f66b2431dd317e08 100644
--- a/src/TNL/Solvers/Linear/LinearSolver.h
+++ b/src/TNL/Solvers/Linear/LinearSolver.h
@@ -9,15 +9,15 @@
 #pragma once
 
 #include <type_traits>  // std::add_const_t
-#include <memory>  // std::shared_ptr
+#include <memory>       // std::shared_ptr
 
 #include <TNL/Solvers/IterativeSolver.h>
 #include <TNL/Solvers/Linear/Preconditioners/Preconditioner.h>
 #include <TNL/Solvers/Linear/Utils/Traits.h>
 
 namespace TNL {
-   namespace Solvers {
-      namespace Linear {
+namespace Solvers {
+namespace Linear {
 
 /**
  * \brief Base class for iterative solvers of systems of linear equations.
@@ -42,133 +42,134 @@ namespace TNL {
  * See also \ref TNL::Solvers::IterativeSolverMonitor for monitoring of iterative solvers.
  */
 template< typename Matrix >
-class LinearSolver
-: public IterativeSolver< typename Matrix::RealType, typename Matrix::IndexType >
+class LinearSolver : public IterativeSolver< typename Matrix::RealType, typename Matrix::IndexType >
 {
-   public:
-
-      /**
-       * \brief Floating point type used for computations.
-       */
-      using RealType = typename Matrix::RealType;
-
-      /**
-       * \brief Device where the solver will run on and auxillary data will alloacted on.
-       *
-       * See \ref Devices::Host or \ref Devices::Cuda.
-       */
-      using DeviceType = typename Matrix::DeviceType;
-
-      /**
-       * \brief Type for indexing.
-       */
-      using IndexType = typename Matrix::IndexType;
-
-      /**
-       * \brief Type for vector view.
-       */
-      using VectorViewType = typename Traits< Matrix >::VectorViewType;
-
-      /**
-       * \brief Type for constant vector view.
-       */
-      using ConstVectorViewType = typename Traits< Matrix >::ConstVectorViewType;
-
-      /**
-       * \brief Type of the matrix representing the linear system.
-       */
-      using MatrixType = Matrix;
-
-      /**
-       * \brief Type of shared pointer to the matrix.
-       */
-      using MatrixPointer = std::shared_ptr< std::add_const_t< MatrixType > >;
-
-      /**
-       * \brief Type of preconditioner.
-       */
-      using PreconditionerType = Preconditioners::Preconditioner< MatrixType >;
-
-      /**
-       * \brief Type of shared pointer to the preconditioner.
-       */
-      using PreconditionerPointer = std::shared_ptr< std::add_const_t< PreconditionerType > >;
-
-      /**
-       * \brief This method defines configuration entries for setup of the linear iterative solver.
-       *
-       * See \ref IterativeSolver::configSetup.
-       *
-       * \param config contains description of configuration parameters.
-       * \param prefix is a prefix of particular configuration entries.
-       */
-      static void configSetup( Config::ConfigDescription& config,
-                              const String& prefix = "" )
-      {
-         IterativeSolver< RealType, IndexType >::configSetup( config, prefix );
-      }
-
-      /**
-       * \brief Method for setup of the linear iterative solver based on configuration parameters.
-       *
-       * \param parameters contains values of the define configuration entries.
-       * \param prefix is a prefix of particular configuration entries.
-       */
-      virtual bool setup( const Config::ParameterContainer& parameters,
-                          const String& prefix = "" )
-      {
-         return IterativeSolver< RealType, IndexType >::setup( parameters, prefix );
-      }
-
-      /**
-       * \brief Set the matrix of the linear system.
-       *
-       * \param matrix is a shared pointer to the matrix of the linear system
-       */
-      void setMatrix( const MatrixPointer& matrix )
-      {
-         this->matrix = matrix;
-      }
-
-      /**
-       * \brief Set the preconditioner.
-       *
-       * \param preconditioner is a shared pointer to preconditioner.
-       */
-      void setPreconditioner( const PreconditionerPointer& preconditioner )
-      {
-         this->preconditioner = preconditioner;
-      }
-
-      /**
-       * \brief Method for solving a linear system.
-       *
-       * The linear system is defined by the matrix given by the method \ref LinearSolver::setMatrix and
-       * by the right-hand side vector represented by the vector \e b. The result is stored in the
-       * vector \e b. The solver can be accelerated with appropriate preconditioner set by the methods
-       * \ref LinearSolver::setPreconditioner.
-       *
-       * \param b vector with the right-hand side of the linear system.
-       * \param x vector for the solution of the linear system.
-       * \return true if the solver converged.
-       * \return false if the solver did not converge.
-       *
-       * \par Example
-       * \include Solvers/Linear/IterativeLinearSolverExample.cpp
-       * \par Output
-       * \include IterativeLinearSolverExample.out
-       */
-      virtual bool solve( ConstVectorViewType b, VectorViewType x ) = 0;
-
-      /**
-       * \brief Default destructor.
-       */
-      virtual ~LinearSolver() {}
-
-   protected:
-      MatrixPointer matrix = nullptr;
-      PreconditionerPointer preconditioner = nullptr;
+public:
+   /**
+    * \brief Floating point type used for computations.
+    */
+   using RealType = typename Matrix::RealType;
+
+   /**
+    * \brief Device where the solver will run on and auxillary data will alloacted on.
+    *
+    * See \ref Devices::Host or \ref Devices::Cuda.
+    */
+   using DeviceType = typename Matrix::DeviceType;
+
+   /**
+    * \brief Type for indexing.
+    */
+   using IndexType = typename Matrix::IndexType;
+
+   /**
+    * \brief Type for vector view.
+    */
+   using VectorViewType = typename Traits< Matrix >::VectorViewType;
+
+   /**
+    * \brief Type for constant vector view.
+    */
+   using ConstVectorViewType = typename Traits< Matrix >::ConstVectorViewType;
+
+   /**
+    * \brief Type of the matrix representing the linear system.
+    */
+   using MatrixType = Matrix;
+
+   /**
+    * \brief Type of shared pointer to the matrix.
+    */
+   using MatrixPointer = std::shared_ptr< std::add_const_t< MatrixType > >;
+
+   /**
+    * \brief Type of preconditioner.
+    */
+   using PreconditionerType = Preconditioners::Preconditioner< MatrixType >;
+
+   /**
+    * \brief Type of shared pointer to the preconditioner.
+    */
+   using PreconditionerPointer = std::shared_ptr< std::add_const_t< PreconditionerType > >;
+
+   /**
+    * \brief This method defines configuration entries for setup of the linear iterative solver.
+    *
+    * See \ref IterativeSolver::configSetup.
+    *
+    * \param config contains description of configuration parameters.
+    * \param prefix is a prefix of particular configuration entries.
+    */
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" )
+   {
+      IterativeSolver< RealType, IndexType >::configSetup( config, prefix );
+   }
+
+   /**
+    * \brief Method for setup of the linear iterative solver based on configuration parameters.
+    *
+    * \param parameters contains values of the define configuration entries.
+    * \param prefix is a prefix of particular configuration entries.
+    */
+   virtual bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" )
+   {
+      return IterativeSolver< RealType, IndexType >::setup( parameters, prefix );
+   }
+
+   /**
+    * \brief Set the matrix of the linear system.
+    *
+    * \param matrix is a shared pointer to the matrix of the linear system
+    */
+   void
+   setMatrix( const MatrixPointer& matrix )
+   {
+      this->matrix = matrix;
+   }
+
+   /**
+    * \brief Set the preconditioner.
+    *
+    * \param preconditioner is a shared pointer to preconditioner.
+    */
+   void
+   setPreconditioner( const PreconditionerPointer& preconditioner )
+   {
+      this->preconditioner = preconditioner;
+   }
+
+   /**
+    * \brief Method for solving a linear system.
+    *
+    * The linear system is defined by the matrix given by the method \ref LinearSolver::setMatrix and
+    * by the right-hand side vector represented by the vector \e b. The result is stored in the
+    * vector \e b. The solver can be accelerated with appropriate preconditioner set by the methods
+    * \ref LinearSolver::setPreconditioner.
+    *
+    * \param b vector with the right-hand side of the linear system.
+    * \param x vector for the solution of the linear system.
+    * \return true if the solver converged.
+    * \return false if the solver did not converge.
+    *
+    * \par Example
+    * \include Solvers/Linear/IterativeLinearSolverExample.cpp
+    * \par Output
+    * \include IterativeLinearSolverExample.out
+    */
+   virtual bool
+   solve( ConstVectorViewType b, VectorViewType x ) = 0;
+
+   /**
+    * \brief Default destructor.
+    */
+   virtual ~LinearSolver() {}
+
+protected:
+   MatrixPointer matrix = nullptr;
+   PreconditionerPointer preconditioner = nullptr;
 };
-      } // namespace Linear
-   } // namespace Solvers
-} // namespace TNL
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/Linear/Preconditioners/Diagonal.h b/src/TNL/Solvers/Linear/Preconditioners/Diagonal.h
index 6d8febfe0bd9dfa7fdea2c402387e3b6a23eefd7..555e505e5fe88214d6ed42786400c702285e4281 100644
--- a/src/TNL/Solvers/Linear/Preconditioners/Diagonal.h
+++ b/src/TNL/Solvers/Linear/Preconditioners/Diagonal.h
@@ -10,11 +10,10 @@
 
 #include "Preconditioner.h"
 
-
 namespace TNL {
-   namespace Solvers {
-      namespace Linear {
-         namespace Preconditioners {
+namespace Solvers {
+namespace Linear {
+namespace Preconditioners {
 
 /**
  * \brief Diagonal (Jacobi) preconditioner for iterative solvers of linear systems.
@@ -26,68 +25,67 @@ namespace TNL {
  * \tparam Matrix is type of the matrix describing the linear system.
  */
 template< typename Matrix >
-class Diagonal
-: public Preconditioner< Matrix >
+class Diagonal : public Preconditioner< Matrix >
 {
-   public:
-
-      /**
-       * \brief Floating point type used for computations.
-       */
-      using RealType = typename Matrix::RealType;
-
-      /**
-       * \brief Device where the preconditioner will run on and auxillary data will alloacted on.
-       *
-       * See \ref Devices::Host or \ref Devices::Cuda.
-       */
-      using DeviceType = typename Matrix::DeviceType;
-
-      /**
-       * \brief Type for indexing.
-       */
-      using IndexType = typename Matrix::IndexType;
-
-      /**
-       * \brief Type for vector view.
-       */
-      using typename Preconditioner< Matrix >::VectorViewType;
-
-      /**
-       * \brief Type for constant vector view.
-       */
-      using typename Preconditioner< Matrix >::ConstVectorViewType;
-
-      /**
-       * \brief Type of the matrix representing the linear system.
-       */
-      using MatrixType = Matrix;
-
-      /**
-       * \brief Type of shared pointer to the matrix.
-       */
-      using typename Preconditioner< Matrix >::MatrixPointer;
-
-      /**
-       * \brief This method updates the preconditioner with respect to given matrix.
-       *
-       * \param matrixPointer smart pointer (\ref std::shared_ptr) to matrix the preconditioner is related to.
-       */
-      virtual void update( const MatrixPointer& matrixPointer ) override;
-
-      /**
-       * \brief This method applies the preconditioner.
-       *
-       * \param b is the input vector the preconditioner is applied on.
-       * \param x is the result of the preconditioning.
-       */
-      virtual void solve( ConstVectorViewType b, VectorViewType x ) const override;
-
-   protected:
-
-      using VectorType = Containers::Vector< RealType, DeviceType, IndexType >;
-
-      VectorType diagonal;
+public:
+   /**
+    * \brief Floating point type used for computations.
+    */
+   using RealType = typename Matrix::RealType;
+
+   /**
+    * \brief Device where the preconditioner will run on and auxillary data will alloacted on.
+    *
+    * See \ref Devices::Host or \ref Devices::Cuda.
+    */
+   using DeviceType = typename Matrix::DeviceType;
+
+   /**
+    * \brief Type for indexing.
+    */
+   using IndexType = typename Matrix::IndexType;
+
+   /**
+    * \brief Type for vector view.
+    */
+   using typename Preconditioner< Matrix >::VectorViewType;
+
+   /**
+    * \brief Type for constant vector view.
+    */
+   using typename Preconditioner< Matrix >::ConstVectorViewType;
+
+   /**
+    * \brief Type of the matrix representing the linear system.
+    */
+   using MatrixType = Matrix;
+
+   /**
+    * \brief Type of shared pointer to the matrix.
+    */
+   using typename Preconditioner< Matrix >::MatrixPointer;
+
+   /**
+    * \brief This method updates the preconditioner with respect to given matrix.
+    *
+    * \param matrixPointer smart pointer (\ref std::shared_ptr) to matrix the preconditioner is related to.
+    */
+   virtual void
+   update( const MatrixPointer& matrixPointer ) override;
+
+   /**
+    * \brief This method applies the preconditioner.
+    *
+    * \param b is the input vector the preconditioner is applied on.
+    * \param x is the result of the preconditioning.
+    */
+   virtual void
+   solve( ConstVectorViewType b, VectorViewType x ) const override;
+
+protected:
+   using VectorType = Containers::Vector< RealType, DeviceType, IndexType >;
+
+   VectorType diagonal;
 };
 
 /**
@@ -98,74 +96,74 @@ class Diagonal
  * \tparam Matrix is a type of matrix describing the linear system.
  */
 template< typename Matrix >
-class Diagonal< Matrices::DistributedMatrix< Matrix > >
-: public Preconditioner< Matrices::DistributedMatrix< Matrix > >
+class Diagonal< Matrices::DistributedMatrix< Matrix > > : public Preconditioner< Matrices::DistributedMatrix< Matrix > >
 {
-   public:
-
-      /**
-       * \brief Type of the matrix representing the linear system.
-       */
-      using MatrixType = Matrices::DistributedMatrix< Matrix >;
-
-      /**
-       * \brief Floating point type used for computations.
-       */
-      using RealType = typename MatrixType::RealType;
-
-      /**
-       * \brief Device where the solver will run on and auxillary data will alloacted on.
-       *
-       * See \ref Devices::Host or \ref Devices::Cuda.
-       */
-      using DeviceType = typename MatrixType::DeviceType;
-
-      /**
-       * \brief Type for indexing.
-       */
-      using IndexType = typename MatrixType::IndexType;
-
-      /**
-       * \brief Type for vector view.
-       */
-      using typename Preconditioner< MatrixType >::VectorViewType;
-
-      /**
-       * \brief Type for vector constant view.
-       */
-      using typename Preconditioner< MatrixType >::ConstVectorViewType;
-
-      /**
-       * \brief Type of shared pointer to the matrix.
-       */
-      using typename Preconditioner< MatrixType >::MatrixPointer;
-
-      /**
-       * \brief This method updates the preconditioner with respect to given matrix.
-       *
-       * \param matrixPointer smart pointer (\ref std::shared_ptr) to matrix the preconditioner is related to.
-       */
-      virtual void update( const MatrixPointer& matrixPointer ) override;
-
-      /**
-       * \brief This method applies the preconditioner.
-       *
-       * \param b is the input vector the preconditioner is applied on.
-       * \param x is the result of the preconditioning.
-       */
-      virtual void solve( ConstVectorViewType b, VectorViewType x ) const override;
-
-   protected:
-      using VectorType = Containers::Vector< RealType, DeviceType, IndexType >;
-      using LocalViewType = Containers::VectorView< RealType, DeviceType, IndexType >;
-      using ConstLocalViewType = Containers::VectorView< std::add_const_t< RealType >, DeviceType, IndexType >;
-
-      VectorType diagonal;
+public:
+   /**
+    * \brief Type of the matrix representing the linear system.
+    */
+   using MatrixType = Matrices::DistributedMatrix< Matrix >;
+
+   /**
+    * \brief Floating point type used for computations.
+    */
+   using RealType = typename MatrixType::RealType;
+
+   /**
+    * \brief Device where the solver will run on and auxillary data will alloacted on.
+    *
+    * See \ref Devices::Host or \ref Devices::Cuda.
+    */
+   using DeviceType = typename MatrixType::DeviceType;
+
+   /**
+    * \brief Type for indexing.
+    */
+   using IndexType = typename MatrixType::IndexType;
+
+   /**
+    * \brief Type for vector view.
+    */
+   using typename Preconditioner< MatrixType >::VectorViewType;
+
+   /**
+    * \brief Type for vector constant view.
+    */
+   using typename Preconditioner< MatrixType >::ConstVectorViewType;
+
+   /**
+    * \brief Type of shared pointer to the matrix.
+    */
+   using typename Preconditioner< MatrixType >::MatrixPointer;
+
+   /**
+    * \brief This method updates the preconditioner with respect to given matrix.
+    *
+    * \param matrixPointer smart pointer (\ref std::shared_ptr) to matrix the preconditioner is related to.
+    */
+   virtual void
+   update( const MatrixPointer& matrixPointer ) override;
+
+   /**
+    * \brief This method applies the preconditioner.
+    *
+    * \param b is the input vector the preconditioner is applied on.
+    * \param x is the result of the preconditioning.
+    */
+   virtual void
+   solve( ConstVectorViewType b, VectorViewType x ) const override;
+
+protected:
+   using VectorType = Containers::Vector< RealType, DeviceType, IndexType >;
+   using LocalViewType = Containers::VectorView< RealType, DeviceType, IndexType >;
+   using ConstLocalViewType = Containers::VectorView< std::add_const_t< RealType >, DeviceType, IndexType >;
+
+   VectorType diagonal;
 };
 
-         } // namespace Preconditioners
-      } // namespace Linear
-   } // namespace Solvers
-} // namespace TNL
+}  // namespace Preconditioners
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
 
 #include "Diagonal.hpp"
diff --git a/src/TNL/Solvers/Linear/Preconditioners/Diagonal.hpp b/src/TNL/Solvers/Linear/Preconditioners/Diagonal.hpp
index bc84159eaac8405ad963964cf9183be2ef296ad1..e04a0d430dcb9e4e94141f0c1e19de0adbeeda08 100644
--- a/src/TNL/Solvers/Linear/Preconditioners/Diagonal.hpp
+++ b/src/TNL/Solvers/Linear/Preconditioners/Diagonal.hpp
@@ -19,8 +19,7 @@ namespace Preconditioners {
 
 template< typename Matrix >
 void
-Diagonal< Matrix >::
-update( const MatrixPointer& matrixPointer )
+Diagonal< Matrix >::update( const MatrixPointer& matrixPointer )
 {
    TNL_ASSERT_GT( matrixPointer->getRows(), 0, "empty matrix" );
    TNL_ASSERT_EQ( matrixPointer->getRows(), matrixPointer->getColumns(), "matrix must be square" );
@@ -32,7 +31,7 @@ update( const MatrixPointer& matrixPointer )
    const auto kernel_matrix = matrixPointer->getView();
 
    // TODO: Rewrite this with SparseMatrix::forAllElements
-   auto kernel = [=] __cuda_callable__ ( IndexType i ) mutable
+   auto kernel = [ = ] __cuda_callable__( IndexType i ) mutable
    {
       diag_view[ i ] = kernel_matrix.getElement( i, i );
    };
@@ -42,29 +41,26 @@ update( const MatrixPointer& matrixPointer )
 
 template< typename Matrix >
 void
-Diagonal< Matrix >::
-solve( ConstVectorViewType b, VectorViewType x ) const
+Diagonal< Matrix >::solve( ConstVectorViewType b, VectorViewType x ) const
 {
    x = b / diagonal;
 }
 
-
 template< typename Matrix >
 void
-Diagonal< Matrices::DistributedMatrix< Matrix > >::
-update( const MatrixPointer& matrixPointer )
+Diagonal< Matrices::DistributedMatrix< Matrix > >::update( const MatrixPointer& matrixPointer )
 {
    diagonal.setSize( matrixPointer->getLocalMatrix().getRows() );
 
    LocalViewType diag_view( diagonal );
    // FIXME: SparseMatrix::getConstView is broken
-//   const auto matrix_view = matrixPointer->getLocalMatrix().getConstView();
+   //   const auto matrix_view = matrixPointer->getLocalMatrix().getConstView();
    const auto matrix_view = matrixPointer->getLocalMatrix().getView();
 
    if( matrixPointer->getRows() == matrixPointer->getColumns() ) {
       // square matrix, assume global column indices
       const auto row_range = matrixPointer->getLocalRowRange();
-      auto kernel = [=] __cuda_callable__ ( IndexType i ) mutable
+      auto kernel = [ = ] __cuda_callable__( IndexType i ) mutable
       {
          const IndexType gi = row_range.getGlobalIndex( i );
          diag_view[ i ] = matrix_view.getElement( i, gi );
@@ -73,8 +69,10 @@ update( const MatrixPointer& matrixPointer )
    }
    else {
       // non-square matrix, assume ghost indexing
-      TNL_ASSERT_LE( matrixPointer->getLocalMatrix().getRows(), matrixPointer->getLocalMatrix().getColumns(), "the local matrix should have more columns than rows" );
-      auto kernel = [=] __cuda_callable__ ( IndexType i ) mutable
+      TNL_ASSERT_LE( matrixPointer->getLocalMatrix().getRows(),
+                     matrixPointer->getLocalMatrix().getColumns(),
+                     "the local matrix should have more columns than rows" );
+      auto kernel = [ = ] __cuda_callable__( IndexType i ) mutable
       {
          diag_view[ i ] = matrix_view.getElement( i, i );
       };
@@ -84,8 +82,7 @@ update( const MatrixPointer& matrixPointer )
 
 template< typename Matrix >
 void
-Diagonal< Matrices::DistributedMatrix< Matrix > >::
-solve( ConstVectorViewType b, VectorViewType x ) const
+Diagonal< Matrices::DistributedMatrix< Matrix > >::solve( ConstVectorViewType b, VectorViewType x ) const
 {
    ConstLocalViewType diag_view( diagonal );
    const auto b_view = b.getConstLocalView();
@@ -98,7 +95,7 @@ solve( ConstVectorViewType b, VectorViewType x ) const
    x.startSynchronization();
 }
 
-} // namespace Preconditioners
-} // namespace Linear
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Preconditioners
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/Linear/Preconditioners/ILU0.h b/src/TNL/Solvers/Linear/Preconditioners/ILU0.h
index 86f34ac4c0c9f4f1d6ff61c5e4599547291576ac..8267836d3f20a086ba7b6e46de38d32740e2d408 100644
--- a/src/TNL/Solvers/Linear/Preconditioners/ILU0.h
+++ b/src/TNL/Solvers/Linear/Preconditioners/ILU0.h
@@ -15,19 +15,18 @@
 #include <TNL/Pointers/UniquePointer.h>
 #include <TNL/Exceptions/NotImplementedError.h>
 
-#if defined(HAVE_CUDA) && defined(HAVE_CUSPARSE)
-#include <cusparse.h>
+#if defined( HAVE_CUDA ) && defined( HAVE_CUSPARSE )
+   #include <cusparse.h>
 #endif
 
 namespace TNL {
-   namespace Solvers {
-      namespace Linear {
-      namespace Preconditioners {
+namespace Solvers {
+namespace Linear {
+namespace Preconditioners {
 
 // implementation template
 template< typename Matrix, typename Real, typename Device, typename Index >
-class ILU0_impl
-: public Preconditioner< Matrix >
+class ILU0_impl : public Preconditioner< Matrix >
 {
 public:
    using RealType = Real;
@@ -37,14 +36,16 @@ public:
    using typename Preconditioner< Matrix >::ConstVectorViewType;
    using typename Preconditioner< Matrix >::MatrixPointer;
 
-   virtual void update( const MatrixPointer& matrixPointer ) override
+   virtual void
+   update( const MatrixPointer& matrixPointer ) override
    {
-      throw Exceptions::NotImplementedError("ILU0 is not implemented yet for the matrix type " + getType< Matrix >());
+      throw Exceptions::NotImplementedError( "ILU0 is not implemented yet for the matrix type " + getType< Matrix >() );
    }
 
-   virtual void solve( ConstVectorViewType b, VectorViewType x ) const override
+   virtual void
+   solve( ConstVectorViewType b, VectorViewType x ) const override
    {
-      throw Exceptions::NotImplementedError("ILU0 is not implemented yet for the matrix type " + getType< Matrix >());
+      throw Exceptions::NotImplementedError( "ILU0 is not implemented yet for the matrix type " + getType< Matrix >() );
    }
 };
 
@@ -56,8 +57,7 @@ public:
  * \tparam Matrix is type of the matrix describing the linear system.
  */
 template< typename Matrix >
-class ILU0
-: public ILU0_impl< Matrix, typename Matrix::RealType, typename Matrix::DeviceType, typename Matrix::IndexType >
+class ILU0 : public ILU0_impl< Matrix, typename Matrix::RealType, typename Matrix::DeviceType, typename Matrix::IndexType >
 {};
 
 /**
@@ -70,84 +70,86 @@ class ILU0
  * \tparam Matrix is type of the matrix describing the linear system.
  */
 template< typename Matrix, typename Real, typename Index >
-class ILU0_impl< Matrix, Real, Devices::Host, Index >
-: public Preconditioner< Matrix >
+class ILU0_impl< Matrix, Real, Devices::Host, Index > : public Preconditioner< Matrix >
 {
-   public:
-
-      /**
-       * \brief Floating point type used for computations.
-       */
-      using RealType = Real;
-
-      /**
-       * \brief Device where the preconditioner will run on and auxillary data will alloacted on.
-       */
-      using DeviceType = Devices::Host;
-
-      /**
-       * \brief Type for indexing.
-       */
-      using IndexType = Index;
-
-      /**
-       * \brief Type for vector view.
-       */
-      using typename Preconditioner< Matrix >::VectorViewType;
-
-      /**
-       * \brief Type for constant vector view.
-       */
-      using typename Preconditioner< Matrix >::ConstVectorViewType;
-
-      /**
-       * \brief Type of shared pointer to the matrix.
-       */
-      using typename Preconditioner< Matrix >::MatrixPointer;
-
-      /**
-       * \brief This method updates the preconditioner with respect to given matrix.
-       *
-       * \param matrixPointer smart pointer (\ref std::shared_ptr) to matrix the preconditioner is related to.
-       */
-      virtual void update( const MatrixPointer& matrixPointer ) override;
-
-      /**
-       * \brief This method applies the preconditioner.
-       *
-       * \param b is the input vector the preconditioner is applied on.
-       * \param x is the result of the preconditioning.
-       */
-      virtual void solve( ConstVectorViewType b, VectorViewType x ) const override;
-
-   protected:
-      // The factors L and U are stored separately and the rows of U are reversed.
-      using CSR = Matrices::SparseMatrix< RealType, DeviceType, IndexType, Matrices::GeneralMatrix, Algorithms::Segments::CSRScalar >;
-      CSR L, U;
-
-      // Specialized methods to distinguish between normal and distributed matrices
-      // in the implementation.
-      template< typename M >
-      static IndexType getMinColumn( const M& m )
-      {
-         return 0;
-      }
+public:
+   /**
+    * \brief Floating point type used for computations.
+    */
+   using RealType = Real;
 
-      template< typename M >
-      static IndexType getMinColumn( const Matrices::DistributedMatrix< M >& m )
-      {
-         if( m.getRows() == m.getColumns() )
-            // square matrix, assume global column indices
-            return m.getLocalRowRange().getBegin();
-         else
-            // non-square matrix, assume ghost indexing
-            return 0;
-      }
+   /**
+    * \brief Device where the preconditioner will run on and auxillary data will alloacted on.
+    */
+   using DeviceType = Devices::Host;
+
+   /**
+    * \brief Type for indexing.
+    */
+   using IndexType = Index;
+
+   /**
+    * \brief Type for vector view.
+    */
+   using typename Preconditioner< Matrix >::VectorViewType;
+
+   /**
+    * \brief Type for constant vector view.
+    */
+   using typename Preconditioner< Matrix >::ConstVectorViewType;
+
+   /**
+    * \brief Type of shared pointer to the matrix.
+    */
+   using typename Preconditioner< Matrix >::MatrixPointer;
+
+   /**
+    * \brief This method updates the preconditioner with respect to given matrix.
+    *
+    * \param matrixPointer smart pointer (\ref std::shared_ptr) to matrix the preconditioner is related to.
+    */
+   virtual void
+   update( const MatrixPointer& matrixPointer ) override;
+
+   /**
+    * \brief This method applies the preconditioner.
+    *
+    * \param b is the input vector the preconditioner is applied on.
+    * \param x is the result of the preconditioning.
+    */
+   virtual void
+   solve( ConstVectorViewType b, VectorViewType x ) const override;
+
+protected:
+   // The factors L and U are stored separately and the rows of U are reversed.
+   using CSR =
+      Matrices::SparseMatrix< RealType, DeviceType, IndexType, Matrices::GeneralMatrix, Algorithms::Segments::CSRScalar >;
+   CSR L, U;
+
+   // Specialized methods to distinguish between normal and distributed matrices
+   // in the implementation.
+   template< typename M >
+   static IndexType
+   getMinColumn( const M& m )
+   {
+      return 0;
+   }
+
+   template< typename M >
+   static IndexType
+   getMinColumn( const Matrices::DistributedMatrix< M >& m )
+   {
+      if( m.getRows() == m.getColumns() )
+         // square matrix, assume global column indices
+         return m.getLocalRowRange().getBegin();
+      else
+         // non-square matrix, assume ghost indexing
+         return 0;
+   }
 };
 
 template< typename Matrix >
-class ILU0_impl< Matrix, double, Devices::Cuda, int >
-: public Preconditioner< Matrix >
+class ILU0_impl< Matrix, double, Devices::Cuda, int > : public Preconditioner< Matrix >
 {
 public:
    using RealType = double;
@@ -159,30 +161,35 @@ public:
 
    ILU0_impl()
    {
-#if defined(HAVE_CUDA) && defined(HAVE_CUSPARSE)
+#if defined( HAVE_CUDA ) && defined( HAVE_CUSPARSE )
       cusparseCreate( &handle );
 #endif
    }
 
-   virtual void update( const MatrixPointer& matrixPointer ) override;
+   virtual void
+   update( const MatrixPointer& matrixPointer ) override;
 
-   virtual void solve( ConstVectorViewType b, VectorViewType x ) const override;
+   virtual void
+   solve( ConstVectorViewType b, VectorViewType x ) const override;
 
    ~ILU0_impl()
    {
-#if defined(HAVE_CUDA) && defined(HAVE_CUSPARSE)
+#if defined( HAVE_CUDA ) && defined( HAVE_CUSPARSE )
       resetMatrices();
       cusparseDestroy( handle );
 #endif
    }
 
    // must be public because nvcc does not allow extended lambdas in private or protected regions
-   void allocate_LU();
-   void copy_triangular_factors();
-protected:
+   void
+   allocate_LU();
+   void
+   copy_triangular_factors();
 
-#if defined(HAVE_CUDA) && defined(HAVE_CUSPARSE)
-   using CSR = Matrices::SparseMatrix< RealType, DeviceType, IndexType, Matrices::GeneralMatrix, Algorithms::Segments::CSRScalar >;
+protected:
+#if defined( HAVE_CUDA ) && defined( HAVE_CUSPARSE )
+   using CSR =
+      Matrices::SparseMatrix< RealType, DeviceType, IndexType, Matrices::GeneralMatrix, Algorithms::Segments::CSRScalar >;
    Pointers::UniquePointer< CSR > A, L, U;
    Containers::Vector< RealType, DeviceType, IndexType > y;
 
@@ -191,25 +198,26 @@ protected:
    cusparseMatDescr_t descr_A = 0;
    cusparseMatDescr_t descr_L = 0;
    cusparseMatDescr_t descr_U = 0;
-   csrilu02Info_t     info_A  = 0;
-   csrsv2Info_t       info_L  = 0;
-   csrsv2Info_t       info_U  = 0;
+   csrilu02Info_t info_A = 0;
+   csrsv2Info_t info_L = 0;
+   csrsv2Info_t info_U = 0;
 
    const cusparseSolvePolicy_t policy_A = CUSPARSE_SOLVE_POLICY_USE_LEVEL;
    const cusparseSolvePolicy_t policy_L = CUSPARSE_SOLVE_POLICY_USE_LEVEL;
    const cusparseSolvePolicy_t policy_U = CUSPARSE_SOLVE_POLICY_USE_LEVEL;
-//   const cusparseSolvePolicy_t policy_A = CUSPARSE_SOLVE_POLICY_NO_LEVEL;
-//   const cusparseSolvePolicy_t policy_L = CUSPARSE_SOLVE_POLICY_NO_LEVEL;
-//   const cusparseSolvePolicy_t policy_U = CUSPARSE_SOLVE_POLICY_NO_LEVEL;
-   const cusparseOperation_t trans_L  = CUSPARSE_OPERATION_NON_TRANSPOSE;
-   const cusparseOperation_t trans_U  = CUSPARSE_OPERATION_NON_TRANSPOSE;
+   //   const cusparseSolvePolicy_t policy_A = CUSPARSE_SOLVE_POLICY_NO_LEVEL;
+   //   const cusparseSolvePolicy_t policy_L = CUSPARSE_SOLVE_POLICY_NO_LEVEL;
+   //   const cusparseSolvePolicy_t policy_U = CUSPARSE_SOLVE_POLICY_NO_LEVEL;
+   const cusparseOperation_t trans_L = CUSPARSE_OPERATION_NON_TRANSPOSE;
+   const cusparseOperation_t trans_U = CUSPARSE_OPERATION_NON_TRANSPOSE;
 
    Containers::Array< char, DeviceType, int > pBuffer;
 
    // scaling factor for triangular solves
    const double alpha = 1.0;
 
-   void resetMatrices()
+   void
+   resetMatrices()
    {
       if( descr_A ) {
          cusparseDestroyMatDescr( descr_A );
@@ -245,6 +253,7 @@ class ILU0_impl< Matrices::DistributedMatrix< Matrix >, double, Devices::Cuda, i
 : public Preconditioner< Matrices::DistributedMatrix< Matrix > >
 {
    using MatrixType = Matrices::DistributedMatrix< Matrix >;
+
 public:
    using RealType = double;
    using DeviceType = Devices::Cuda;
@@ -253,20 +262,22 @@ public:
    using typename Preconditioner< MatrixType >::ConstVectorViewType;
    using typename Preconditioner< MatrixType >::MatrixPointer;
 
-   virtual void update( const MatrixPointer& matrixPointer ) override
+   virtual void
+   update( const MatrixPointer& matrixPointer ) override
    {
-      throw Exceptions::NotImplementedError("ILU0 is not implemented yet for CUDA and distributed matrices.");
+      throw Exceptions::NotImplementedError( "ILU0 is not implemented yet for CUDA and distributed matrices." );
    }
 
-   virtual void solve( ConstVectorViewType b, VectorViewType x ) const override
+   virtual void
+   solve( ConstVectorViewType b, VectorViewType x ) const override
    {
-      throw Exceptions::NotImplementedError("ILU0 is not implemented yet for CUDA and distributed matrices.");
+      throw Exceptions::NotImplementedError( "ILU0 is not implemented yet for CUDA and distributed matrices." );
    }
 };
 
-} // namespace Preconditioners
-} // namespace Linear
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Preconditioners
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
 
 #include "ILU0.hpp"
diff --git a/src/TNL/Solvers/Linear/Preconditioners/ILU0.hpp b/src/TNL/Solvers/Linear/Preconditioners/ILU0.hpp
index 3dee3265ee5ef43a23a84b74bda6147837cb1b04..9a6b7363773180348e205efff1efe403a5a883e9 100644
--- a/src/TNL/Solvers/Linear/Preconditioners/ILU0.hpp
+++ b/src/TNL/Solvers/Linear/Preconditioners/ILU0.hpp
@@ -20,8 +20,7 @@ namespace Preconditioners {
 
 template< typename Matrix, typename Real, typename Index >
 void
-ILU0_impl< Matrix, Real, Devices::Host, Index >::
-update( const MatrixPointer& matrixPointer )
+ILU0_impl< Matrix, Real, Devices::Host, Index >::update( const MatrixPointer& matrixPointer )
 {
    TNL_ASSERT_GT( matrixPointer->getRows(), 0, "empty matrix" );
    TNL_ASSERT_EQ( matrixPointer->getRows(), matrixPointer->getColumns(), "matrix must be square" );
@@ -34,8 +33,8 @@ update( const MatrixPointer& matrixPointer )
    U.setDimensions( N, N );
 
    // copy row lengths
-   typename decltype(L)::RowsCapacitiesType L_rowLengths( N );
-   typename decltype(U)::RowsCapacitiesType U_rowLengths( N );
+   typename decltype( L )::RowsCapacitiesType L_rowLengths( N );
+   typename decltype( U )::RowsCapacitiesType U_rowLengths( N );
    for( IndexType i = 0; i < N; i++ ) {
       const auto row = localMatrix.getRow( i );
       IndexType L_entries = 0;
@@ -73,7 +72,7 @@ update( const MatrixPointer& matrixPointer )
       // skip non-local elements
       IndexType* columns = all_columns;
       RealType* values = all_values;
-      while( columns[0] < minColumn ) {
+      while( columns[ 0 ] < minColumn ) {
          columns++;
          values++;
       }
@@ -85,8 +84,8 @@ update( const MatrixPointer& matrixPointer )
 
       const auto L_entries = L_rowLengths[ i ];
       const auto U_entries = U_rowLengths[ N - 1 - i ];
-//      L.setRow( i, columns, values, L_entries );
-//      U.setRow( N - 1 - i, &columns[ L_entries ], &values[ L_entries ], U_entries );
+      //      L.setRow( i, columns, values, L_entries );
+      //      U.setRow( N - 1 - i, &columns[ L_entries ], &values[ L_entries ], U_entries );
 
       // copy values into U
       auto U_i = U.getRow( N - 1 - i );
@@ -126,8 +125,7 @@ update( const MatrixPointer& matrixPointer )
 
 template< typename Matrix, typename Real, typename Index >
 void
-ILU0_impl< Matrix, Real, Devices::Host, Index >::
-solve( ConstVectorViewType _b, VectorViewType _x ) const
+ILU0_impl< Matrix, Real, Devices::Host, Index >::solve( ConstVectorViewType _b, VectorViewType _x ) const
 {
    const auto b = Traits< Matrix >::getConstLocalView( _b );
    auto x = Traits< Matrix >::getLocalView( _x );
@@ -145,15 +143,14 @@ solve( ConstVectorViewType _b, VectorViewType _x ) const
    Traits< Matrix >::startSynchronization( _x );
 }
 
-
 template< typename Matrix >
 void
-ILU0_impl< Matrix, double, Devices::Cuda, int >::
-update( const MatrixPointer& matrixPointer )
+ILU0_impl< Matrix, double, Devices::Cuda, int >::update( const MatrixPointer& matrixPointer )
 {
 #ifdef HAVE_CUDA
-#ifdef HAVE_CUSPARSE
-   // TODO: only numerical factorization has to be done every time, split the rest into separate "setup" method which is called less often
+   #ifdef HAVE_CUSPARSE
+   // TODO: only numerical factorization has to be done every time, split the rest into separate "setup" method which is called
+   // less often
    resetMatrices();
 
    // Note: the decomposition will be in-place, matrices L and U will have the
@@ -180,7 +177,7 @@ update( const MatrixPointer& matrixPointer )
    cusparseSetMatFillMode( descr_L, CUSPARSE_FILL_MODE_LOWER );
    cusparseSetMatDiagType( descr_L, CUSPARSE_DIAG_TYPE_UNIT );
 
-   cusparseCreateMatDescr( &descr_U);
+   cusparseCreateMatDescr( &descr_U );
    cusparseSetMatIndexBase( descr_U, CUSPARSE_INDEX_BASE_ZERO );
    cusparseSetMatType( descr_U, CUSPARSE_MATRIX_TYPE_GENERAL );
    cusparseSetMatFillMode( descr_U, CUSPARSE_FILL_MODE_UPPER );
@@ -196,34 +193,52 @@ update( const MatrixPointer& matrixPointer )
 
    // query how much memory will be needed in csrilu02 and csrsv2, and allocate the buffer
    int pBufferSize_A, pBufferSize_L, pBufferSize_U;
-   cusparseDcsrilu02_bufferSize( handle, N, nnz_A, descr_A,
+   cusparseDcsrilu02_bufferSize( handle,
+                                 N,
+                                 nnz_A,
+                                 descr_A,
                                  A->getValues().getData(),
                                  A->getSegments().getOffsets().getData(),
                                  A->getColumnIndexes().getData(),
-                                 info_A, &pBufferSize_A );
-   cusparseDcsrsv2_bufferSize( handle, trans_L, N, nnz_L, descr_L,
+                                 info_A,
+                                 &pBufferSize_A );
+   cusparseDcsrsv2_bufferSize( handle,
+                               trans_L,
+                               N,
+                               nnz_L,
+                               descr_L,
                                L->getValues().getData(),
                                L->getSegments().getOffsets().getData(),
                                L->getColumnIndexes().getData(),
-                               info_L, &pBufferSize_L );
-   cusparseDcsrsv2_bufferSize( handle, trans_U, N, nnz_U, descr_U,
+                               info_L,
+                               &pBufferSize_L );
+   cusparseDcsrsv2_bufferSize( handle,
+                               trans_U,
+                               N,
+                               nnz_U,
+                               descr_U,
                                U->getValues().getData(),
                                U->getSegments().getOffsets().getData(),
                                U->getColumnIndexes().getData(),
-                               info_U, &pBufferSize_U );
+                               info_U,
+                               &pBufferSize_U );
    TNL_CHECK_CUDA_DEVICE;
    const int pBufferSize = max( pBufferSize_A, max( pBufferSize_L, pBufferSize_U ) );
    pBuffer.setSize( pBufferSize );
 
    // Symbolic analysis of the incomplete LU decomposition
-   cusparseDcsrilu02_analysis( handle, N, nnz_A, descr_A,
+   cusparseDcsrilu02_analysis( handle,
+                               N,
+                               nnz_A,
+                               descr_A,
                                A->getValues().getData(),
                                A->getSegments().getOffsets().getData(),
                                A->getColumnIndexes().getData(),
-                               info_A, policy_A, pBuffer.getData() );
+                               info_A,
+                               policy_A,
+                               pBuffer.getData() );
    int structural_zero;
-   cusparseStatus_t
-   status = cusparseXcsrilu02_zeroPivot( handle, info_A, &structural_zero );
+   cusparseStatus_t status = cusparseXcsrilu02_zeroPivot( handle, info_A, &structural_zero );
    if( CUSPARSE_STATUS_ZERO_PIVOT == status ) {
       std::cerr << "A(" << structural_zero << ", " << structural_zero << ") is missing." << std::endl;
       throw 1;
@@ -233,23 +248,28 @@ update( const MatrixPointer& matrixPointer )
    // Analysis for the triangular solves for L and U
    // Trick: the lower (upper) triangular part of A has the same sparsity
    // pattern as L (U), so we can do the analysis for csrsv2 on the matrix A.
-//   cusparseDcsrsv2_analysis( handle, trans_L, N, nnz_A, descr_L,
-//                             A->getValues().getData(),
-//                             A->getSegments().getOffsets().getData(),
-//                             A->getColumnIndexes().getData(),
-//                             info_L, policy_L, pBuffer.getData() );
-//   cusparseDcsrsv2_analysis( handle, trans_U, N, nnz_A, descr_U,
-//                             A->getValues().getData(),
-//                             A->getSegments().getOffsets().getData(),
-//                             A->getColumnIndexes().getData(),
-//                             info_U, policy_U, pBuffer.getData() );
+   //   cusparseDcsrsv2_analysis( handle, trans_L, N, nnz_A, descr_L,
+   //                             A->getValues().getData(),
+   //                             A->getSegments().getOffsets().getData(),
+   //                             A->getColumnIndexes().getData(),
+   //                             info_L, policy_L, pBuffer.getData() );
+   //   cusparseDcsrsv2_analysis( handle, trans_U, N, nnz_A, descr_U,
+   //                             A->getValues().getData(),
+   //                             A->getSegments().getOffsets().getData(),
+   //                             A->getColumnIndexes().getData(),
+   //                             info_U, policy_U, pBuffer.getData() );
 
    // Numerical incomplete LU decomposition
-   cusparseDcsrilu02( handle, N, nnz_A, descr_A,
+   cusparseDcsrilu02( handle,
+                      N,
+                      nnz_A,
+                      descr_A,
                       A->getValues().getData(),
                       A->getSegments().getOffsets().getData(),
                       A->getColumnIndexes().getData(),
-                      info_A, policy_A, pBuffer.getData() );
+                      info_A,
+                      policy_A,
+                      pBuffer.getData() );
    int numerical_zero;
    status = cusparseXcsrilu02_zeroPivot( handle, info_A, &numerical_zero );
    if( CUSPARSE_STATUS_ZERO_PIVOT == status ) {
@@ -262,20 +282,33 @@ update( const MatrixPointer& matrixPointer )
    copy_triangular_factors();
 
    // Analysis for the triangular solves for L and U
-   cusparseDcsrsv2_analysis( handle, trans_L, N, nnz_L, descr_L,
+   cusparseDcsrsv2_analysis( handle,
+                             trans_L,
+                             N,
+                             nnz_L,
+                             descr_L,
                              L->getValues().getData(),
                              L->getSegments().getOffsets().getData(),
                              L->getColumnIndexes().getData(),
-                             info_L, policy_L, pBuffer.getData() );
-   cusparseDcsrsv2_analysis( handle, trans_U, N, nnz_U, descr_U,
+                             info_L,
+                             policy_L,
+                             pBuffer.getData() );
+   cusparseDcsrsv2_analysis( handle,
+                             trans_U,
+                             N,
+                             nnz_U,
+                             descr_U,
                              U->getValues().getData(),
                              U->getSegments().getOffsets().getData(),
                              U->getColumnIndexes().getData(),
-                             info_U, policy_U, pBuffer.getData() );
+                             info_U,
+                             policy_U,
+                             pBuffer.getData() );
    TNL_CHECK_CUDA_DEVICE;
-#else
-   throw std::runtime_error("The program was not compiled with the CUSPARSE library. Pass -DHAVE_CUSPARSE -lcusparse to the compiler.");
-#endif
+   #else
+   throw std::runtime_error(
+      "The program was not compiled with the CUSPARSE library. Pass -DHAVE_CUSPARSE -lcusparse to the compiler." );
+   #endif
 #else
    throw Exceptions::CudaSupportMissing();
 #endif
@@ -283,11 +316,10 @@ update( const MatrixPointer& matrixPointer )
 
 template< typename Matrix >
 void
-ILU0_impl< Matrix, double, Devices::Cuda, int >::
-allocate_LU()
+ILU0_impl< Matrix, double, Devices::Cuda, int >::allocate_LU()
 {
 #ifdef HAVE_CUDA
-#ifdef HAVE_CUSPARSE
+   #ifdef HAVE_CUSPARSE
    const int N = A->getRows();
    L->setDimensions( N, N );
    U->setDimensions( N, N );
@@ -299,9 +331,11 @@ allocate_LU()
    // copy row lengths
    typename CSR::RowsCapacitiesType L_rowLengths( N );
    typename CSR::RowsCapacitiesType U_rowLengths( N );
-   Containers::VectorView< typename decltype(L_rowLengths)::RealType, DeviceType, IndexType > L_rowLengths_view( L_rowLengths );
-   Containers::VectorView< typename decltype(U_rowLengths)::RealType, DeviceType, IndexType > U_rowLengths_view( U_rowLengths );
-   auto kernel_copy_row_lengths = [=] __cuda_callable__ ( IndexType i ) mutable
+   Containers::VectorView< typename decltype( L_rowLengths )::RealType, DeviceType, IndexType > L_rowLengths_view(
+      L_rowLengths );
+   Containers::VectorView< typename decltype( U_rowLengths )::RealType, DeviceType, IndexType > U_rowLengths_view(
+      U_rowLengths );
+   auto kernel_copy_row_lengths = [ = ] __cuda_callable__( IndexType i ) mutable
    {
       const auto row = kernel_A->getRow( i );
       int L_entries = 0;
@@ -321,9 +355,10 @@ allocate_LU()
    Algorithms::ParallelFor< DeviceType >::exec( (IndexType) 0, N, kernel_copy_row_lengths );
    L->setRowCapacities( L_rowLengths );
    U->setRowCapacities( U_rowLengths );
-#else
-   throw std::runtime_error("The program was not compiled with the CUSPARSE library. Pass -DHAVE_CUSPARSE -lcusparse to the compiler.");
-#endif
+   #else
+   throw std::runtime_error(
+      "The program was not compiled with the CUSPARSE library. Pass -DHAVE_CUSPARSE -lcusparse to the compiler." );
+   #endif
 #else
    throw Exceptions::CudaSupportMissing();
 #endif
@@ -331,11 +366,10 @@ allocate_LU()
 
 template< typename Matrix >
 void
-ILU0_impl< Matrix, double, Devices::Cuda, int >::
-copy_triangular_factors()
+ILU0_impl< Matrix, double, Devices::Cuda, int >::copy_triangular_factors()
 {
 #ifdef HAVE_CUDA
-#ifdef HAVE_CUSPARSE
+   #ifdef HAVE_CUSPARSE
    const int N = A->getRows();
 
    // extract raw pointers
@@ -345,7 +379,7 @@ copy_triangular_factors()
    const CSR* kernel_A = &A.template getData< DeviceType >();
 
    // copy values from A to L and U
-   auto kernel_copy_values = [=] __cuda_callable__ ( IndexType i ) mutable
+   auto kernel_copy_values = [ = ] __cuda_callable__( IndexType i ) mutable
    {
       const auto row = kernel_A->getRow( i );
       for( int c_j = 0; c_j < row.getSize(); c_j++ ) {
@@ -359,9 +393,10 @@ copy_triangular_factors()
       }
    };
    Algorithms::ParallelFor< DeviceType >::exec( (IndexType) 0, N, kernel_copy_values );
-#else
-   throw std::runtime_error("The program was not compiled with the CUSPARSE library. Pass -DHAVE_CUSPARSE -lcusparse to the compiler.");
-#endif
+   #else
+   throw std::runtime_error(
+      "The program was not compiled with the CUSPARSE library. Pass -DHAVE_CUSPARSE -lcusparse to the compiler." );
+   #endif
 #else
    throw Exceptions::CudaSupportMissing();
 #endif
@@ -369,45 +404,57 @@ copy_triangular_factors()
 
 template< typename Matrix >
 void
-ILU0_impl< Matrix, double, Devices::Cuda, int >::
-solve( ConstVectorViewType b, VectorViewType x ) const
+ILU0_impl< Matrix, double, Devices::Cuda, int >::solve( ConstVectorViewType b, VectorViewType x ) const
 {
 #ifdef HAVE_CUDA
-#ifdef HAVE_CUSPARSE
+   #ifdef HAVE_CUSPARSE
    const int N = A->getRows();
    const int nnz_L = L->getValues().getSize();
    const int nnz_U = U->getValues().getSize();
 
    // Step 1: solve y from Ly = b
-   cusparseDcsrsv2_solve( handle, trans_L, N, nnz_L, &alpha, descr_L,
+   cusparseDcsrsv2_solve( handle,
+                          trans_L,
+                          N,
+                          nnz_L,
+                          &alpha,
+                          descr_L,
                           L->getValues().getData(),
                           L->getSegments().getOffsets().getData(),
                           L->getColumnIndexes().getData(),
                           info_L,
                           b.getData(),
                           (RealType*) y.getData(),
-                          policy_L, (void*) pBuffer.getData() );
+                          policy_L,
+                          (void*) pBuffer.getData() );
 
    // Step 2: solve x from Ux = y
-   cusparseDcsrsv2_solve( handle, trans_U, N, nnz_U, &alpha, descr_U,
+   cusparseDcsrsv2_solve( handle,
+                          trans_U,
+                          N,
+                          nnz_U,
+                          &alpha,
+                          descr_U,
                           U->getValues().getData(),
                           U->getSegments().getOffsets().getData(),
                           U->getColumnIndexes().getData(),
                           info_U,
                           y.getData(),
                           x.getData(),
-                          policy_U, (void*) pBuffer.getData() );
+                          policy_U,
+                          (void*) pBuffer.getData() );
 
    TNL_CHECK_CUDA_DEVICE;
-#else
-   throw std::runtime_error("The program was not compiled with the CUSPARSE library. Pass -DHAVE_CUSPARSE -lcusparse to the compiler.");
-#endif
+   #else
+   throw std::runtime_error(
+      "The program was not compiled with the CUSPARSE library. Pass -DHAVE_CUSPARSE -lcusparse to the compiler." );
+   #endif
 #else
    throw Exceptions::CudaSupportMissing();
 #endif
 }
 
-} // namespace Preconditioners
-} // namespace Linear
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Preconditioners
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/Linear/Preconditioners/ILUT.h b/src/TNL/Solvers/Linear/Preconditioners/ILUT.h
index 59f38686b56334343d120766aa082ec9385fb5b1..fb7a9286ab198d08a743544cfcf94552fb88cf68 100644
--- a/src/TNL/Solvers/Linear/Preconditioners/ILUT.h
+++ b/src/TNL/Solvers/Linear/Preconditioners/ILUT.h
@@ -33,74 +33,73 @@ class ILUT_impl
  * \tparam Matrix is type of the matrix describing the linear system.
  */
 template< typename Matrix >
-class ILUT
-: public ILUT_impl< Matrix, typename Matrix::RealType, typename Matrix::DeviceType, typename Matrix::IndexType >
+class ILUT : public ILUT_impl< Matrix, typename Matrix::RealType, typename Matrix::DeviceType, typename Matrix::IndexType >
 {
    using Base = ILUT_impl< Matrix, typename Matrix::RealType, typename Matrix::DeviceType, typename Matrix::IndexType >;
-   public:
-
-      /**
-       * \brief Floating point type used for computations.
-       */
-      using RealType = typename Matrix::RealType;
-
-      /**
-       * \brief Device where the preconditioner will run on and auxillary data will alloacted on.
-       */
-      using DeviceType = Devices::Host;
-
-      /**
-       * \brief Type for indexing.
-       */
-      using IndexType = typename Matrix::IndexType;
-
-      /**
-       * \brief Type for vector view.
-       */
-      using typename Preconditioner< Matrix >::VectorViewType;
-
-      /**
-       * \brief Type for constant vector view.
-       */
-      using typename Preconditioner< Matrix >::ConstVectorViewType;
-
-      /**
-       * \brief Type of shared pointer to the matrix.
-       */
-      using typename Preconditioner< Matrix >::MatrixPointer;
-
-      /**
-       * \brief This method defines configuration entries for setup of the preconditioner of linear iterative solver.
-       *
-       * \param config contains description of configuration parameters.
-       * \param prefix is a prefix of particular configuration entries.
-       */
-      static void configSetup( Config::ConfigDescription& config,
-                              const String& prefix = "" )
-      {
-         config.addEntry< int >( prefix + "ilut-p", "Number of additional non-zero entries to allocate on each row of the factors L and U.", 0 );
-         config.addEntry< double >( prefix + "ilut-threshold", "Threshold for droppping small entries.", 1e-4 );
-      }
-
-      /**
-       * \brief This method updates the preconditioner with respect to given matrix.
-       *
-       * \param matrixPointer smart pointer (\ref std::shared_ptr) to matrix the preconditioner is related to.
-       */
-      using Base::update;
-
-      /**
-       * \brief This method applies the preconditioner.
-       *
-       * \param b is the input vector the preconditioner is applied on.
-       * \param x is the result of the preconditioning.
-       */
-      using Base::solve;
+
+public:
+   /**
+    * \brief Floating point type used for computations.
+    */
+   using RealType = typename Matrix::RealType;
+
+   /**
+    * \brief Device where the preconditioner will run on and auxillary data will alloacted on.
+    */
+   using DeviceType = Devices::Host;
+
+   /**
+    * \brief Type for indexing.
+    */
+   using IndexType = typename Matrix::IndexType;
+
+   /**
+    * \brief Type for vector view.
+    */
+   using typename Preconditioner< Matrix >::VectorViewType;
+
+   /**
+    * \brief Type for constant vector view.
+    */
+   using typename Preconditioner< Matrix >::ConstVectorViewType;
+
+   /**
+    * \brief Type of shared pointer to the matrix.
+    */
+   using typename Preconditioner< Matrix >::MatrixPointer;
+
+   /**
+    * \brief This method defines configuration entries for setup of the preconditioner of linear iterative solver.
+    *
+    * \param config contains description of configuration parameters.
+    * \param prefix is a prefix of particular configuration entries.
+    */
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" )
+   {
+      config.addEntry< int >(
+         prefix + "ilut-p", "Number of additional non-zero entries to allocate on each row of the factors L and U.", 0 );
+      config.addEntry< double >( prefix + "ilut-threshold", "Threshold for droppping small entries.", 1e-4 );
+   }
+
+   /**
+    * \brief This method updates the preconditioner with respect to given matrix.
+    *
+    * \param matrixPointer smart pointer (\ref std::shared_ptr) to matrix the preconditioner is related to.
+    */
+   using Base::update;
+
+   /**
+    * \brief This method applies the preconditioner.
+    *
+    * \param b is the input vector the preconditioner is applied on.
+    * \param x is the result of the preconditioning.
+    */
+   using Base::solve;
 };
 
 template< typename Matrix, typename Real, typename Index >
-class ILUT_impl< Matrix, Real, Devices::Host, Index >
-: public Preconditioner< Matrix >
+class ILUT_impl< Matrix, Real, Devices::Host, Index > : public Preconditioner< Matrix >
 {
 public:
    using RealType = Real;
@@ -111,12 +110,14 @@ public:
    using typename Preconditioner< Matrix >::MatrixPointer;
    using VectorType = Containers::Vector< RealType, DeviceType, IndexType >;
 
-   bool setup( const Config::ParameterContainer& parameters,
-               const String& prefix = "" ) override;
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" ) override;
 
-   virtual void update( const MatrixPointer& matrixPointer ) override;
+   virtual void
+   update( const MatrixPointer& matrixPointer ) override;
 
-   virtual void solve( ConstVectorViewType b, VectorViewType x ) const override;
+   virtual void
+   solve( ConstVectorViewType b, VectorViewType x ) const override;
 
 protected:
    Index p = 0;
@@ -128,13 +129,15 @@ protected:
    // Specialized methods to distinguish between normal and distributed matrices
    // in the implementation.
    template< typename M >
-   static IndexType getMinColumn( const M& m )
+   static IndexType
+   getMinColumn( const M& m )
    {
       return 0;
    }
 
    template< typename M >
-   static IndexType getMinColumn( const Matrices::DistributedMatrix< M >& m )
+   static IndexType
+   getMinColumn( const Matrices::DistributedMatrix< M >& m )
    {
       if( m.getRows() == m.getColumns() )
          // square matrix, assume global column indices
@@ -146,14 +149,11 @@ protected:
 };
 
 template< typename Matrix, typename Real, typename Index >
-class ILUT_impl< Matrix, Real, Devices::Sequential, Index >
-: public ILUT_impl< Matrix, Real, Devices::Host, Index >
+class ILUT_impl< Matrix, Real, Devices::Sequential, Index > : public ILUT_impl< Matrix, Real, Devices::Host, Index >
 {};
 
-
 template< typename Matrix, typename Real, typename Index >
-class ILUT_impl< Matrix, Real, Devices::Cuda, Index >
-: public Preconditioner< Matrix >
+class ILUT_impl< Matrix, Real, Devices::Cuda, Index > : public Preconditioner< Matrix >
 {
 public:
    using RealType = Real;
@@ -163,20 +163,22 @@ public:
    using typename Preconditioner< Matrix >::ConstVectorViewType;
    using typename Preconditioner< Matrix >::MatrixPointer;
 
-   virtual void update( const MatrixPointer& matrixPointer ) override
+   virtual void
+   update( const MatrixPointer& matrixPointer ) override
    {
-      throw std::runtime_error("Not Iplemented yet for CUDA");
+      throw std::runtime_error( "Not Iplemented yet for CUDA" );
    }
 
-   virtual void solve( ConstVectorViewType b, VectorViewType x ) const override
+   virtual void
+   solve( ConstVectorViewType b, VectorViewType x ) const override
    {
-      throw std::runtime_error("Not Iplemented yet for CUDA");
+      throw std::runtime_error( "Not Iplemented yet for CUDA" );
    }
 };
 
-} // namespace Preconditioners
-} // namespace Linear
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Preconditioners
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
 
 #include "ILUT.hpp"
diff --git a/src/TNL/Solvers/Linear/Preconditioners/ILUT.hpp b/src/TNL/Solvers/Linear/Preconditioners/ILUT.hpp
index d186398b1aaa45d47cd3de60b9e51efe0a962672..73e9b69c7520caf146ee1a862f9261ada4cf0c82 100644
--- a/src/TNL/Solvers/Linear/Preconditioners/ILUT.hpp
+++ b/src/TNL/Solvers/Linear/Preconditioners/ILUT.hpp
@@ -22,9 +22,7 @@ namespace Preconditioners {
 
 template< typename Matrix, typename Real, typename Index >
 bool
-ILUT_impl< Matrix, Real, Devices::Host, Index >::
-setup( const Config::ParameterContainer& parameters,
-       const String& prefix )
+ILUT_impl< Matrix, Real, Devices::Host, Index >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    if( parameters.checkParameter( prefix + "ilut-p" ) )
       p = parameters.getParameter< int >( prefix + "ilut-p" );
@@ -35,8 +33,7 @@ setup( const Config::ParameterContainer& parameters,
 
 template< typename Matrix, typename Real, typename Index >
 void
-ILUT_impl< Matrix, Real, Devices::Host, Index >::
-update( const MatrixPointer& matrixPointer )
+ILUT_impl< Matrix, Real, Devices::Host, Index >::update( const MatrixPointer& matrixPointer )
 {
    TNL_ASSERT_GT( matrixPointer->getRows(), 0, "empty matrix" );
    TNL_ASSERT_EQ( matrixPointer->getRows(), matrixPointer->getColumns(), "matrix must be square" );
@@ -48,14 +45,15 @@ update( const MatrixPointer& matrixPointer )
    L.setDimensions( N, N );
    U.setDimensions( N, N );
 
-//   Timer timer_total, timer_rowlengths, timer_copy_into_w, timer_k_loop, timer_heap_construct, timer_heap_extract, timer_copy_into_LU, timer_reset;
+   //   Timer timer_total, timer_rowlengths, timer_copy_into_w, timer_k_loop, timer_heap_construct, timer_heap_extract,
+   //   timer_copy_into_LU, timer_reset;
 
-//   timer_total.start();
+   //   timer_total.start();
 
    // compute row lengths
-//   timer_rowlengths.start();
-   typename decltype(L)::RowsCapacitiesType L_rowLengths( N );
-   typename decltype(U)::RowsCapacitiesType U_rowLengths( N );
+   //   timer_rowlengths.start();
+   typename decltype( L )::RowsCapacitiesType L_rowLengths( N );
+   typename decltype( U )::RowsCapacitiesType U_rowLengths( N );
    for( IndexType i = 0; i < N; i++ ) {
       const auto row = localMatrix.getRow( i );
       IndexType L_entries = 0;
@@ -77,7 +75,7 @@ update( const MatrixPointer& matrixPointer )
    }
    L.setRowCapacities( L_rowLengths );
    U.setRowCapacities( U_rowLengths );
-//   timer_rowlengths.stop();
+   //   timer_rowlengths.stop();
 
    // intermediate full vector for the i-th row of A
    VectorType w;
@@ -85,15 +83,23 @@ update( const MatrixPointer& matrixPointer )
    w.setValue( 0.0 );
 
    // intermediate vectors for sorting and keeping only the largest values
-   struct Triplet {
+   struct Triplet
+   {
       IndexType column;
       RealType value;
       RealType abs_value;
-      Triplet(IndexType column, RealType value, RealType abs_value) : column(column), value(value), abs_value(abs_value) {}
+      Triplet( IndexType column, RealType value, RealType abs_value ) : column( column ), value( value ), abs_value( abs_value )
+      {}
+   };
+   auto cmp_abs_value = []( const Triplet& a, const Triplet& b )
+   {
+      return a.abs_value < b.abs_value;
    };
-   auto cmp_abs_value = []( const Triplet& a, const Triplet& b ){ return a.abs_value < b.abs_value; };
    std::vector< Triplet > heap_L, heap_U;
-   auto cmp_column = []( const Triplet& a, const Triplet& b ){ return a.column < b.column; };
+   auto cmp_column = []( const Triplet& a, const Triplet& b )
+   {
+      return a.column < b.column;
+   };
    std::vector< Triplet > values_L, values_U;
 
    // Incomplete LU factorization with threshold
@@ -107,16 +113,18 @@ update( const MatrixPointer& matrixPointer )
       std::set< IndexType > w_k_set;
 
       // copy A_i into the full vector w
-//      timer_copy_into_w.start();
+      //      timer_copy_into_w.start();
       for( IndexType c_j = 0; c_j < A_i.getSize(); c_j++ ) {
          auto j = A_i.getColumnIndex( c_j );
          if( minColumn > 0 ) {
             // skip non-local elements
-            if( j < minColumn ) continue;
+            if( j < minColumn )
+               continue;
             j -= minColumn;
          }
          // handle ellpack dummy entries
-         if( j == localMatrix.getPaddingIndex() ) break;
+         if( j == localMatrix.getPaddingIndex() )
+            break;
          w[ j ] = A_i.getValue( c_j );
 
          // running computation of norm
@@ -124,14 +132,14 @@ update( const MatrixPointer& matrixPointer )
 
          w_k_set.insert( j );
       }
-//      timer_copy_into_w.stop();
+      //      timer_copy_into_w.stop();
 
       // compute relative tolerance
       A_i_norm = std::sqrt( A_i_norm );
       const RealType tau_i = tau * A_i_norm;
 
       // loop for k = 0, ..., i - 1; but only over the non-zero entries of w
-//      timer_k_loop.start();
+      //      timer_k_loop.start();
       for( const IndexType k : w_k_set ) {
          if( k >= i )
             break;
@@ -152,7 +160,8 @@ update( const MatrixPointer& matrixPointer )
                const auto j = U_k.getColumnIndex( c_j );
 
                // skip dropped entries
-               if( j == localMatrix.getPaddingIndex() ) break;
+               if( j == localMatrix.getPaddingIndex() )
+                  break;
                w[ j ] -= w_k * U_k.getValue( c_j );
 
                // add non-zero to the w_k_set
@@ -160,14 +169,14 @@ update( const MatrixPointer& matrixPointer )
             }
          }
       }
-//      timer_k_loop.stop();
+      //      timer_k_loop.stop();
 
       // apply dropping rule to the row w
       // (we drop all values under threshold and keep nl(i) + p largest values in L
       // and nu(i) + p largest values in U; see Saad (2003) for reference)
 
       // construct heaps with the values in the L and U parts separately
-//      timer_heap_construct.start();
+      //      timer_heap_construct.start();
       for( const IndexType j : w_k_set ) {
          const RealType w_j_abs = std::abs( w[ j ] );
          // ignore small values
@@ -181,10 +190,10 @@ update( const MatrixPointer& matrixPointer )
       }
       std::make_heap( heap_L.begin(), heap_L.end(), cmp_abs_value );
       std::make_heap( heap_U.begin(), heap_U.end(), cmp_abs_value );
-//      timer_heap_construct.stop();
+      //      timer_heap_construct.stop();
 
       // extract values for L and U
-//      timer_heap_extract.start();
+      //      timer_heap_extract.start();
       for( IndexType c_j = 0; c_j < L_rowLengths[ i ] && c_j < (IndexType) heap_L.size(); c_j++ ) {
          // move the largest to the end
          std::pop_heap( heap_L.begin(), heap_L.end(), cmp_abs_value );
@@ -201,11 +210,12 @@ update( const MatrixPointer& matrixPointer )
          heap_U.pop_back();
          values_U.push_back( largest );
       }
-//      timer_heap_extract.stop();
+      //      timer_heap_extract.stop();
 
-//      std::cout << "i = " << i << ", L_rowLengths[ i ] = " << L_rowLengths[ i ] << ", U_rowLengths[ i ] = " << U_rowLengths[ N - 1 - i ] << std::endl;
+      //      std::cout << "i = " << i << ", L_rowLengths[ i ] = " << L_rowLengths[ i ] << ", U_rowLengths[ i ] = " <<
+      //      U_rowLengths[ N - 1 - i ] << std::endl;
 
-//      timer_copy_into_LU.start();
+      //      timer_copy_into_LU.start();
 
       // sort by column index to make it insertable into the sparse matrix
       std::sort( values_L.begin(), values_L.end(), cmp_column );
@@ -228,10 +238,10 @@ update( const MatrixPointer& matrixPointer )
          U_i.setElement( c_j, j, values_U[ c_j ].value );
       }
 
-//      timer_copy_into_LU.stop();
+      //      timer_copy_into_LU.stop();
 
       // reset w
-//      timer_reset.start();
+      //      timer_reset.start();
       for( const IndexType j : w_k_set )
          w[ j ] = 0.0;
 
@@ -239,27 +249,26 @@ update( const MatrixPointer& matrixPointer )
       heap_U.clear();
       values_L.clear();
       values_U.clear();
-//      timer_reset.stop();
+      //      timer_reset.stop();
    }
 
-//   timer_total.stop();
-
-//   std::cout << "ILUT::update statistics:\n";
-//   std::cout << "\ttimer_total:           " << timer_total.getRealTime()          << " s\n";
-//   std::cout << "\ttimer_rowlengths:      " << timer_rowlengths.getRealTime()     << " s\n";
-//   std::cout << "\ttimer_copy_into_w:     " << timer_copy_into_w.getRealTime()    << " s\n";
-//   std::cout << "\ttimer_k_loop:          " << timer_k_loop.getRealTime()         << " s\n";
-//   std::cout << "\ttimer_heap_construct:  " << timer_heap_construct.getRealTime() << " s\n";
-//   std::cout << "\ttimer_heap_extract:    " << timer_heap_extract.getRealTime()   << " s\n";
-//   std::cout << "\ttimer_copy_into_LU:    " << timer_copy_into_LU.getRealTime()   << " s\n";
-//   std::cout << "\ttimer_reset:           " << timer_reset.getRealTime()          << " s\n";
-//   std::cout << std::flush;
+   //   timer_total.stop();
+
+   //   std::cout << "ILUT::update statistics:\n";
+   //   std::cout << "\ttimer_total:           " << timer_total.getRealTime()          << " s\n";
+   //   std::cout << "\ttimer_rowlengths:      " << timer_rowlengths.getRealTime()     << " s\n";
+   //   std::cout << "\ttimer_copy_into_w:     " << timer_copy_into_w.getRealTime()    << " s\n";
+   //   std::cout << "\ttimer_k_loop:          " << timer_k_loop.getRealTime()         << " s\n";
+   //   std::cout << "\ttimer_heap_construct:  " << timer_heap_construct.getRealTime() << " s\n";
+   //   std::cout << "\ttimer_heap_extract:    " << timer_heap_extract.getRealTime()   << " s\n";
+   //   std::cout << "\ttimer_copy_into_LU:    " << timer_copy_into_LU.getRealTime()   << " s\n";
+   //   std::cout << "\ttimer_reset:           " << timer_reset.getRealTime()          << " s\n";
+   //   std::cout << std::flush;
 }
 
 template< typename Matrix, typename Real, typename Index >
 void
-ILUT_impl< Matrix, Real, Devices::Host, Index >::
-solve( ConstVectorViewType _b, VectorViewType _x ) const
+ILUT_impl< Matrix, Real, Devices::Host, Index >::solve( ConstVectorViewType _b, VectorViewType _x ) const
 {
    const auto b = Traits< Matrix >::getConstLocalView( _b );
    auto x = Traits< Matrix >::getLocalView( _x );
@@ -274,7 +283,7 @@ solve( ConstVectorViewType _b, VectorViewType _x ) const
    Traits< Matrix >::startSynchronization( _x );
 }
 
-} // namespace Preconditioners
-} // namespace Linear
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Preconditioners
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/Linear/Preconditioners/Preconditioner.h b/src/TNL/Solvers/Linear/Preconditioners/Preconditioner.h
index cb1dfa5d1c1f0f9de9c590eaadc467e7e161b304..6c3c06d6d97617a8a054c0e118c744ed6ebdd96f 100644
--- a/src/TNL/Solvers/Linear/Preconditioners/Preconditioner.h
+++ b/src/TNL/Solvers/Linear/Preconditioners/Preconditioner.h
@@ -9,15 +9,15 @@
 #pragma once
 
 #include <type_traits>  // std::add_const_t
-#include <memory>  // std::shared_ptr
+#include <memory>       // std::shared_ptr
 
 #include <TNL/Config/ParameterContainer.h>
 #include <TNL/Solvers/Linear/Utils/Traits.h>
 
 namespace TNL {
-   namespace Solvers {
-      namespace Linear {
-         namespace Preconditioners {
+namespace Solvers {
+namespace Linear {
+namespace Preconditioners {
 
 /**
  * \brief Base class for preconditioners of of iterative solvers of linear systems.
@@ -36,92 +36,94 @@ namespace TNL {
 template< typename Matrix >
 class Preconditioner
 {
-   public:
-
-      /**
-       * \brief Floating point type used for computations.
-       */
-      using RealType = typename Matrix::RealType;
-
-      /**
-       * \brief Device where the solver will run on and auxillary data will alloacted on.
-       *
-       * See \ref Devices::Host or \ref Devices::Cuda.
-       */
-      using DeviceType = typename Matrix::DeviceType;
-
-      /**
-       * \brief Type for indexing.
-       */
-      using IndexType = typename Matrix::IndexType;
-
-      /**
-       * \brief Type for vector view.
-       */
-      using VectorViewType = typename Traits< Matrix >::VectorViewType;
-
-      /**
-       * \brief Type for constant vector view.
-       */
-      using ConstVectorViewType = typename Traits< Matrix >::ConstVectorViewType;
-
-      /**
-       * \brief Type of the matrix representing the linear system.
-       */
-      using MatrixType = Matrix;
-
-      /**
-       * \brief Type of shared pointer to the matrix.
-       */
-      using MatrixPointer = std::shared_ptr< std::add_const_t< MatrixType > >;
-
-      /**
-       * \brief This method defines configuration entries for setup of the preconditioner of linear iterative solver.
-       *
-       * \param config contains description of configuration parameters.
-       * \param prefix is a prefix of particular configuration entries.
-       */
-      static void configSetup( Config::ConfigDescription& config,
-                              const String& prefix = "" ) {}
-
-      /**
-       * \brief Method for setup of the preconditioner of linear iterative solver based on configuration parameters.
-       *
-       * \param parameters contains values of the define configuration entries.
-       * \param prefix is a prefix of particular configuration entries.
-       */
-      virtual bool setup( const Config::ParameterContainer& parameters,
-                        const String& prefix = "" )
-      {
-         return true;
-      }
-
-      /**
-       * \brief This method updates the preconditioner with respect to given matrix.
-       *
-       * \param matrixPointer smart pointer (\ref std::shared_ptr) to matrix the preconditioner is related to.
-       */
-      virtual void update( const MatrixPointer& matrixPointer )
-      {}
-
-      /**
-       * \brief This method applies the preconditioner.
-       *
-       * \param b is the input vector the preconditioner is applied on.
-       * \param x is the result of the preconditioning.
-       */
-      virtual void solve( ConstVectorViewType b, VectorViewType x ) const
-      {
-         throw std::logic_error("The solve() method of a dummy preconditioner should not be called.");
-      }
-
-      /**
-       * \brief Destructor of the preconditioner.
-       */
-      virtual ~Preconditioner() {}
+public:
+   /**
+    * \brief Floating point type used for computations.
+    */
+   using RealType = typename Matrix::RealType;
+
+   /**
+    * \brief Device where the solver will run on and auxillary data will alloacted on.
+    *
+    * See \ref Devices::Host or \ref Devices::Cuda.
+    */
+   using DeviceType = typename Matrix::DeviceType;
+
+   /**
+    * \brief Type for indexing.
+    */
+   using IndexType = typename Matrix::IndexType;
+
+   /**
+    * \brief Type for vector view.
+    */
+   using VectorViewType = typename Traits< Matrix >::VectorViewType;
+
+   /**
+    * \brief Type for constant vector view.
+    */
+   using ConstVectorViewType = typename Traits< Matrix >::ConstVectorViewType;
+
+   /**
+    * \brief Type of the matrix representing the linear system.
+    */
+   using MatrixType = Matrix;
+
+   /**
+    * \brief Type of shared pointer to the matrix.
+    */
+   using MatrixPointer = std::shared_ptr< std::add_const_t< MatrixType > >;
+
+   /**
+    * \brief This method defines configuration entries for setup of the preconditioner of linear iterative solver.
+    *
+    * \param config contains description of configuration parameters.
+    * \param prefix is a prefix of particular configuration entries.
+    */
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" )
+   {}
+
+   /**
+    * \brief Method for setup of the preconditioner of linear iterative solver based on configuration parameters.
+    *
+    * \param parameters contains values of the define configuration entries.
+    * \param prefix is a prefix of particular configuration entries.
+    */
+   virtual bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" )
+   {
+      return true;
+   }
+
+   /**
+    * \brief This method updates the preconditioner with respect to given matrix.
+    *
+    * \param matrixPointer smart pointer (\ref std::shared_ptr) to matrix the preconditioner is related to.
+    */
+   virtual void
+   update( const MatrixPointer& matrixPointer )
+   {}
+
+   /**
+    * \brief This method applies the preconditioner.
+    *
+    * \param b is the input vector the preconditioner is applied on.
+    * \param x is the result of the preconditioning.
+    */
+   virtual void
+   solve( ConstVectorViewType b, VectorViewType x ) const
+   {
+      throw std::logic_error( "The solve() method of a dummy preconditioner should not be called." );
+   }
+
+   /**
+    * \brief Destructor of the preconditioner.
+    */
+   virtual ~Preconditioner() {}
 };
 
-         } // namespace Preconditioners
-      } // namespace Linear
-   } // namespace Solvers
-} // namespace TNL
+}  // namespace Preconditioners
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/Linear/Preconditioners/_NamespaceDoxy.h b/src/TNL/Solvers/Linear/Preconditioners/_NamespaceDoxy.h
index 2e5505ee9cbe3afa3e3e62be6d1929dfc0110655..ad914205cf93e9157fb569b79aba6deaffc6a1ba 100644
--- a/src/TNL/Solvers/Linear/Preconditioners/_NamespaceDoxy.h
+++ b/src/TNL/Solvers/Linear/Preconditioners/_NamespaceDoxy.h
@@ -7,19 +7,20 @@
 #pragma once
 
 namespace TNL {
-   namespace Solvers {
-      namespace Linear {
-         /**
-          * \brief Namespace for preconditioners of linear system solvers.
-          *
-          * This namespace contains the following preconditioners for iterative solvers linear systems.
-          *
-          * 1. Diagonal - is diagonal or Jacobi preconditioner - see[Netlib](http://netlib.org/linalg/html_templates/node55.html)
-          * 2. ILU0 - is Incomplete LU preconditioner with the same sparsity pattern as the original matrix - see [Wikipedia](https://en.wikipedia.org/wiki/Incomplete_LU_factorization)
-          * 3. ILUT - is Incomplete LU preconiditoner with thresholding - see [paper by Y. Saad](https://www-users.cse.umn.edu/~saad/PDF/umsi-92-38.pdf)
-          */
-         namespace Preconditioners {
-         } // namespace Preconditioners
-      } // namespace Linear
-   } // namespace Solvers
-} // namespace TNL
+namespace Solvers {
+namespace Linear {
+/**
+ * \brief Namespace for preconditioners of linear system solvers.
+ *
+ * This namespace contains the following preconditioners for iterative solvers linear systems.
+ *
+ * 1. Diagonal - is diagonal or Jacobi preconditioner - see[Netlib](http://netlib.org/linalg/html_templates/node55.html)
+ * 2. ILU0 - is Incomplete LU preconditioner with the same sparsity pattern as the original matrix - see
+ * [Wikipedia](https://en.wikipedia.org/wiki/Incomplete_LU_factorization)
+ * 3. ILUT - is Incomplete LU preconiditoner with thresholding - see [paper by Y.
+ * Saad](https://www-users.cse.umn.edu/~saad/PDF/umsi-92-38.pdf)
+ */
+namespace Preconditioners {}  // namespace Preconditioners
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/Linear/SOR.h b/src/TNL/Solvers/Linear/SOR.h
index 41d8a818a29db36ee289693e3adccfdb320f67a5..ff17c93cfe3619ba5e187ec1d0a4ee22cda51952 100644
--- a/src/TNL/Solvers/Linear/SOR.h
+++ b/src/TNL/Solvers/Linear/SOR.h
@@ -9,8 +9,8 @@
 #include <TNL/Solvers/Linear/LinearSolver.h>
 
 namespace TNL {
-   namespace Solvers {
-      namespace Linear {
+namespace Solvers {
+namespace Linear {
 
 /**
  * \brief Iterative solver of linear systems based on the Successive-overrelaxation (SOR) or Gauss-Seidel method.
@@ -22,118 +22,119 @@ namespace TNL {
  * \tparam Matrix is type of matrix describing the linear system.
  */
 template< typename Matrix >
-class SOR
-: public LinearSolver< Matrix >
+class SOR : public LinearSolver< Matrix >
 {
    using Base = LinearSolver< Matrix >;
    using VectorType = typename Traits< Matrix >::VectorType;
 
-   public:
-
-      /**
-       * \brief Floating point type used for computations.
-       */
-      using RealType = typename Base::RealType;
-
-      /**
-       * \brief Device where the solver will run on and auxillary data will alloacted on.
-       */
-      using DeviceType = typename Base::DeviceType;
-
-      /**
-       * \brief Type for indexing.
-       */
-      using IndexType = typename Base::IndexType;
-
-      /**
-       * \brief Type for vector view.
-       */
-      using VectorViewType = typename Base::VectorViewType;
-
-      /**
-       * \brief Type for constant vector view.
-       */
-      using ConstVectorViewType = typename Base::ConstVectorViewType;
-
-      /**
-       * \brief This is method defines configuration entries for setup of the linear iterative solver.
-       *
-       * In addition to config entries defined by \ref IterativeSolver::configSetup, this method
-       * defines the following:
-       *
-       * \e sor-omega - relaxation parameter of the weighted/damped Jacobi method.
-       *
-       * \param config contains description of configuration parameters.
-       * \param prefix is a prefix of particular configuration entries.
-       */
-      static void configSetup( Config::ConfigDescription& config,
-                              const String& prefix = "" );
-
-      /**
-       * \brief Method for setup of the linear iterative solver based on configuration parameters.
-       *
-       * \param parameters contains values of the define configuration entries.
-       * \param prefix is a prefix of particular configuration entries.
-       */
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" ) override;
-
-      /**
-       * \brief Setter of the relaxation parameter.
-       *
-       * \param omega the relaxation parameter. It is 1 by default.
-       */
-      void setOmega( const RealType& omega );
-
-      /**
-       * \brief Getter of the relaxation parameter.
-       *
-       * \return value of the relaxation parameter.
-       */
-      const RealType& getOmega() const;
-
-      /**
-       * \brief Set the period for a recomputation of the residue.
-       *
-       * \param period number of iterations between subsequent recomputations of the residue.
-       */
-      void setResiduePeriod( IndexType period );
-
-      /**
-       * \brief Get the period for a recomputation of the residue.
-       *
-       * \return number of iterations between subsequent recomputations of the residue.
-       */
-      IndexType getResiduePerid() const;
-
-      /**
-       * \brief Method for solving of a linear system.
-       *
-       * See \ref LinearSolver::solve for more details.
-       *
-       * \param b vector with the right-hand side of the linear system.
-       * \param x vector for the solution of the linear system.
-       * \return true if the solver converged.
-       * \return false if the solver did not converge.
-       */
-      bool solve( ConstVectorViewType b, VectorViewType x ) override;
-
-   protected:
-      RealType omega = 1.0;
-
-      IndexType residuePeriod = 4;
-
-      VectorType diagonal;
-
-   public: // because nvcc does not accept lambda functions within private or protected methods
-      void performIteration( const ConstVectorViewType& b,
-                             const ConstVectorViewType& diagonalView,
-                             VectorViewType& x ) const;
-
+public:
+   /**
+    * \brief Floating point type used for computations.
+    */
+   using RealType = typename Base::RealType;
+
+   /**
+    * \brief Device where the solver will run on and auxillary data will alloacted on.
+    */
+   using DeviceType = typename Base::DeviceType;
+
+   /**
+    * \brief Type for indexing.
+    */
+   using IndexType = typename Base::IndexType;
+
+   /**
+    * \brief Type for vector view.
+    */
+   using VectorViewType = typename Base::VectorViewType;
+
+   /**
+    * \brief Type for constant vector view.
+    */
+   using ConstVectorViewType = typename Base::ConstVectorViewType;
+
+   /**
+    * \brief This is method defines configuration entries for setup of the linear iterative solver.
+    *
+    * In addition to config entries defined by \ref IterativeSolver::configSetup, this method
+    * defines the following:
+    *
+    * \e sor-omega - relaxation parameter of the weighted/damped Jacobi method.
+    *
+    * \param config contains description of configuration parameters.
+    * \param prefix is a prefix of particular configuration entries.
+    */
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" );
+
+   /**
+    * \brief Method for setup of the linear iterative solver based on configuration parameters.
+    *
+    * \param parameters contains values of the define configuration entries.
+    * \param prefix is a prefix of particular configuration entries.
+    */
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" ) override;
+
+   /**
+    * \brief Setter of the relaxation parameter.
+    *
+    * \param omega the relaxation parameter. It is 1 by default.
+    */
+   void
+   setOmega( const RealType& omega );
+
+   /**
+    * \brief Getter of the relaxation parameter.
+    *
+    * \return value of the relaxation parameter.
+    */
+   const RealType&
+   getOmega() const;
+
+   /**
+    * \brief Set the period for a recomputation of the residue.
+    *
+    * \param period number of iterations between subsequent recomputations of the residue.
+    */
+   void
+   setResiduePeriod( IndexType period );
+
+   /**
+    * \brief Get the period for a recomputation of the residue.
+    *
+    * \return number of iterations between subsequent recomputations of the residue.
+    */
+   IndexType
+   getResiduePerid() const;
+
+   /**
+    * \brief Method for solving of a linear system.
+    *
+    * See \ref LinearSolver::solve for more details.
+    *
+    * \param b vector with the right-hand side of the linear system.
+    * \param x vector for the solution of the linear system.
+    * \return true if the solver converged.
+    * \return false if the solver did not converge.
+    */
+   bool
+   solve( ConstVectorViewType b, VectorViewType x ) override;
+
+protected:
+   RealType omega = 1.0;
+
+   IndexType residuePeriod = 4;
+
+   VectorType diagonal;
+
+public:  // because nvcc does not accept lambda functions within private or protected methods
+   void
+   performIteration( const ConstVectorViewType& b, const ConstVectorViewType& diagonalView, VectorViewType& x ) const;
 };
 
-      } // namespace Linear
-   } // namespace Solvers
-} // namespace TNL
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
 
 #include <TNL/Solvers/Linear/SOR.hpp>
diff --git a/src/TNL/Solvers/Linear/SOR.hpp b/src/TNL/Solvers/Linear/SOR.hpp
index 586179dc1375a8702b5b0537be94ed7edfd7eb83..55687f95b7fca34cfc396ec0463334ba090c93e9 100644
--- a/src/TNL/Solvers/Linear/SOR.hpp
+++ b/src/TNL/Solvers/Linear/SOR.hpp
@@ -17,9 +17,7 @@ namespace Linear {
 
 template< typename Matrix >
 void
-SOR< Matrix >::
-configSetup( Config::ConfigDescription& config,
-             const String& prefix )
+SOR< Matrix >::configSetup( Config::ConfigDescription& config, const String& prefix )
 {
    LinearSolver< Matrix >::configSetup( config, prefix );
    config.addEntry< double >( prefix + "sor-omega", "Relaxation parameter of the SOR method.", 1.0 );
@@ -28,15 +26,13 @@ configSetup( Config::ConfigDescription& config,
 
 template< typename Matrix >
 bool
-SOR< Matrix >::
-setup( const Config::ParameterContainer& parameters,
-       const String& prefix )
+SOR< Matrix >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    if( parameters.checkParameter( prefix + "sor-omega" ) )
       this->setOmega( parameters.getParameter< double >( prefix + "sor-omega" ) );
-   if( this->omega <= 0.0 || this->omega > 2.0 )
-   {
-      std::cerr << "Warning: The SOR method parameter omega is out of interval (0,2). The value is " << this->omega << " the method will not converge." << std::endl;
+   if( this->omega <= 0.0 || this->omega > 2.0 ) {
+      std::cerr << "Warning: The SOR method parameter omega is out of interval (0,2). The value is " << this->omega
+                << " the method will not converge." << std::endl;
    }
    if( parameters.checkParameter( prefix + "residue-period" ) )
       this->setResiduePeriod( parameters.getParameter< int >( prefix + "residue-period" ) );
@@ -44,42 +40,46 @@ setup( const Config::ParameterContainer& parameters,
 }
 
 template< typename Matrix >
-void SOR< Matrix > :: setOmega( const RealType& omega )
+void
+SOR< Matrix >::setOmega( const RealType& omega )
 {
    this->omega = omega;
 }
 
 template< typename Matrix >
-const typename SOR< Matrix > :: RealType& SOR< Matrix > :: getOmega( ) const
+const typename SOR< Matrix >::RealType&
+SOR< Matrix >::getOmega() const
 {
    return this->omega;
 }
 
 template< typename Matrix >
 void
-SOR< Matrix >::
-setResiduePeriod( IndexType period )
+SOR< Matrix >::setResiduePeriod( IndexType period )
 {
    this->residuePeriod = period;
 }
 
 template< typename Matrix >
 auto
-SOR< Matrix >::
-getResiduePerid() const -> IndexType
+SOR< Matrix >::getResiduePerid() const -> IndexType
 {
    return this->residuePeriod;
 }
 
 template< typename Matrix >
-bool SOR< Matrix > :: solve( ConstVectorViewType b, VectorViewType x )
+bool
+SOR< Matrix >::solve( ConstVectorViewType b, VectorViewType x )
 {
    /////
    // Fetch diagonal elements
    this->diagonal.setLike( x );
    auto diagonalView = this->diagonal.getView();
-   auto fetch_diagonal = [=] __cuda_callable__ ( IndexType rowIdx, IndexType localIdx, const IndexType& columnIdx, const RealType& value ) mutable {
-      if( columnIdx == rowIdx ) diagonalView[ rowIdx ] = value;
+   auto fetch_diagonal =
+      [ = ] __cuda_callable__( IndexType rowIdx, IndexType localIdx, const IndexType& columnIdx, const RealType& value ) mutable
+   {
+      if( columnIdx == rowIdx )
+         diagonalView[ rowIdx ] = value;
    };
    this->matrix->forAllElements( fetch_diagonal );
 
@@ -88,9 +88,8 @@ bool SOR< Matrix > :: solve( ConstVectorViewType b, VectorViewType x )
 
    auto bView = b.getView();
    auto xView = x.getView();
-   RealType bNorm = lpNorm( b, ( RealType ) 2.0 );
-   while( this->nextIteration() )
-   {
+   RealType bNorm = lpNorm( b, (RealType) 2.0 );
+   while( this->nextIteration() ) {
       this->performIteration( bView, diagonalView, xView );
       if( this->getIterations() % this->residuePeriod == 0 )
          this->setResidue( LinearResidueGetter::getResidue( *this->matrix, x, b, bNorm ) );
@@ -101,21 +100,22 @@ bool SOR< Matrix > :: solve( ConstVectorViewType b, VectorViewType x )
 
 template< typename Matrix >
 void
-SOR< Matrix >::
-performIteration( const ConstVectorViewType& b,
-                  const ConstVectorViewType& diagonalView,
-                  VectorViewType& x ) const
+SOR< Matrix >::performIteration( const ConstVectorViewType& b,
+                                 const ConstVectorViewType& diagonalView,
+                                 VectorViewType& x ) const
 {
    const RealType omega_ = this->omega;
-   auto fetch = [=] __cuda_callable__ ( IndexType rowIdx, IndexType columnIdx, const RealType& value ) {
-         return value * x[ columnIdx ];
+   auto fetch = [ = ] __cuda_callable__( IndexType rowIdx, IndexType columnIdx, const RealType& value )
+   {
+      return value * x[ columnIdx ];
    };
-   auto keep = [=] __cuda_callable__ ( IndexType rowIdx, const RealType& value ) mutable {
+   auto keep = [ = ] __cuda_callable__( IndexType rowIdx, const RealType& value ) mutable
+   {
       Algorithms::AtomicOperations< DeviceType >::add( x[ rowIdx ], omega_ / diagonalView[ rowIdx ] * ( b[ rowIdx ] - value ) );
    };
    this->matrix->reduceAllRows( fetch, TNL::Plus{}, keep, 0.0 );
 }
 
-} // namespace Linear
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/Linear/TFQMR.h b/src/TNL/Solvers/Linear/TFQMR.h
index 9d4a85327d33574b624c1774e46f767d5647e8b0..926c17d6f3f8c21eeeafb01659c4bce73652ac0e 100644
--- a/src/TNL/Solvers/Linear/TFQMR.h
+++ b/src/TNL/Solvers/Linear/TFQMR.h
@@ -9,8 +9,8 @@
 #include <TNL/Solvers/Linear/LinearSolver.h>
 
 namespace TNL {
-   namespace Solvers {
-      namespace Linear {
+namespace Solvers {
+namespace Linear {
 
 /**
  * \brief Iterative solver of linear systems based on the Transpose-free quasi-minimal residual (TFQMR) method.
@@ -22,58 +22,58 @@ namespace TNL {
  * \tparam Matrix is type of matrix describing the linear system.
  */
 template< typename Matrix >
-class TFQMR
-: public LinearSolver< Matrix >
+class TFQMR : public LinearSolver< Matrix >
 {
    using Base = LinearSolver< Matrix >;
 
-   public:
+public:
+   /**
+    * \brief Floating point type used for computations.
+    */
+   using RealType = typename Base::RealType;
 
-      /**
-       * \brief Floating point type used for computations.
-       */
-      using RealType = typename Base::RealType;
+   /**
+    * \brief Device where the solver will run on and auxillary data will alloacted on.
+    */
+   using DeviceType = typename Base::DeviceType;
 
-      /**
-       * \brief Device where the solver will run on and auxillary data will alloacted on.
-       */
-      using DeviceType = typename Base::DeviceType;
+   /**
+    * \brief Type for indexing.
+    */
+   using IndexType = typename Base::IndexType;
 
-      /**
-       * \brief Type for indexing.
-       */
-      using IndexType = typename Base::IndexType;
+   /**
+    * \brief Type for vector view.
+    */
+   using VectorViewType = typename Base::VectorViewType;
 
-      /**
-       * \brief Type for vector view.
-       */
-      using VectorViewType = typename Base::VectorViewType;
+   /**
+    * \brief Type for constant vector view.
+    */
+   using ConstVectorViewType = typename Base::ConstVectorViewType;
 
-      /**
-       * \brief Type for constant vector view.
-       */
-      using ConstVectorViewType = typename Base::ConstVectorViewType;
+   /**
+    * \brief Method for solving of a linear system.
+    *
+    * See \ref LinearSolver::solve for more details.
+    *
+    * \param b vector with the right-hand side of the linear system.
+    * \param x vector for the solution of the linear system.
+    * \return true if the solver converged.
+    * \return false if the solver did not converge.
+    */
+   bool
+   solve( ConstVectorViewType b, VectorViewType x ) override;
 
-      /**
-       * \brief Method for solving of a linear system.
-       *
-       * See \ref LinearSolver::solve for more details.
-       *
-       * \param b vector with the right-hand side of the linear system.
-       * \param x vector for the solution of the linear system.
-       * \return true if the solver converged.
-       * \return false if the solver did not converge.
-       */
-      bool solve( ConstVectorViewType b, VectorViewType x ) override;
+protected:
+   void
+   setSize( const VectorViewType& x );
 
-   protected:
-      void setSize( const VectorViewType& x );
-
-      typename Traits< Matrix >::VectorType d, r, w, u, v, r_ast, Au, M_tmp;
+   typename Traits< Matrix >::VectorType d, r, w, u, v, r_ast, Au, M_tmp;
 };
 
-      } // namespace Linear
-   } // namespace Solvers
-} // namespace TNL
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
 
 #include <TNL/Solvers/Linear/TFQMR.hpp>
diff --git a/src/TNL/Solvers/Linear/TFQMR.hpp b/src/TNL/Solvers/Linear/TFQMR.hpp
index 9bf9bb632a3063ea6fa6c6d70f9757bae1d3fdab..897c7c0d1ce774c5943cff761c4928a27cd9d2e6 100644
--- a/src/TNL/Solvers/Linear/TFQMR.hpp
+++ b/src/TNL/Solvers/Linear/TFQMR.hpp
@@ -15,7 +15,8 @@ namespace Solvers {
 namespace Linear {
 
 template< typename Matrix >
-bool TFQMR< Matrix >::solve( ConstVectorViewType b, VectorViewType x )
+bool
+TFQMR< Matrix >::solve( ConstVectorViewType b, VectorViewType x )
 {
    this->setSize( x );
 
@@ -47,22 +48,21 @@ bool TFQMR< Matrix >::solve( ConstVectorViewType b, VectorViewType x )
    tau = lpNorm( r, 2.0 );
    theta = eta = 0.0;
    r_ast = r;
-   rho = (r_ast, r);
+   rho = ( r_ast, r );
    // only to avoid compiler warning; alpha is initialized inside the loop
    alpha = 0.0;
 
    if( b_norm == 0.0 )
-       b_norm = 1.0;
+      b_norm = 1.0;
 
    this->resetIterations();
    this->setResidue( tau / b_norm );
 
-   while( this->nextIteration() )
-   {
+   while( this->nextIteration() ) {
       const IndexType iter = this->getIterations();
 
       if( iter % 2 == 1 ) {
-         alpha = rho / (v, r_ast);
+         alpha = rho / ( v, r_ast );
       }
       else {
          // not necessary in odd iter since the previous iteration
@@ -76,26 +76,26 @@ bool TFQMR< Matrix >::solve( ConstVectorViewType b, VectorViewType x )
          }
       }
       w -= alpha * Au;
-      d = u + (theta * theta * eta / alpha) * d;
+      d = u + ( theta * theta * eta / alpha ) * d;
       w_norm = lpNorm( w, 2.0 );
       theta = w_norm / tau;
       const RealType c = 1.0 / std::sqrt( 1.0 + theta * theta );
       tau = tau * theta * c;
-      eta = c * c  * alpha;
+      eta = c * c * alpha;
       x += eta * d;
 
-      this->setResidue( tau * std::sqrt(iter+1) / b_norm );
+      this->setResidue( tau * std::sqrt( iter + 1 ) / b_norm );
       if( iter > this->getMinIterations() && this->getResidue() < this->getConvergenceResidue() ) {
-          break;
+         break;
       }
 
       if( iter % 2 == 0 ) {
-         const RealType rho_new = (w, r_ast);
+         const RealType rho_new = ( w, r_ast );
          const RealType beta = rho_new / rho;
          rho = rho_new;
 
          u = w + beta * u;
-         v = beta * Au + (beta * beta) * v;
+         v = beta * Au + ( beta * beta ) * v;
          if( this->preconditioner ) {
             this->matrix->vectorProduct( u, M_tmp );
             this->preconditioner->solve( M_tmp, Au );
@@ -113,7 +113,8 @@ bool TFQMR< Matrix >::solve( ConstVectorViewType b, VectorViewType x )
 }
 
 template< typename Matrix >
-void TFQMR< Matrix > :: setSize( const VectorViewType& x )
+void
+TFQMR< Matrix >::setSize( const VectorViewType& x )
 {
    d.setLike( x );
    r.setLike( x );
@@ -125,6 +126,6 @@ void TFQMR< Matrix > :: setSize( const VectorViewType& x )
    M_tmp.setLike( x );
 }
 
-} // namespace Linear
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/Linear/UmfpackWrapper.h b/src/TNL/Solvers/Linear/UmfpackWrapper.h
index eae7470519988de75528111b538a4a2586d5be3f..f8bfb7b4ebf8691d1cb97935800765966c779f01 100644
--- a/src/TNL/Solvers/Linear/UmfpackWrapper.h
+++ b/src/TNL/Solvers/Linear/UmfpackWrapper.h
@@ -10,10 +10,10 @@
 
 #ifdef HAVE_UMFPACK
 
-#include <umfpack.h>
+   #include <umfpack.h>
 
-#include "LinearSolver.h"
-#include <TNL/Matrices/CSR.h>
+   #include "LinearSolver.h"
+   #include <TNL/Matrices/CSR.h>
 
 namespace TNL {
 namespace Solvers {
@@ -22,21 +22,20 @@ namespace Linear {
 template< typename Matrix >
 struct is_csr_matrix
 {
-    static constexpr bool value = false;
+   static constexpr bool value = false;
 };
 
 template< typename Real, typename Device, typename Index >
 struct is_csr_matrix< Matrices::CSR< Real, Device, Index > >
 {
-    static constexpr bool value = true;
+   static constexpr bool value = true;
 };
 
-
 template< typename Matrix >
-class UmfpackWrapper
-: public LinearSolver< Matrix >
+class UmfpackWrapper : public LinearSolver< Matrix >
 {
    using Base = LinearSolver< Matrix >;
+
 public:
    using RealType = typename Base::RealType;
    using DeviceType = typename Base::DeviceType;
@@ -56,18 +55,19 @@ public:
          std::cerr << "The UmfpackWrapper solver is available only for 'int' index type." << std::endl;
    }
 
-   bool solve( ConstVectorViewType b, VectorViewType x ) override
+   bool
+   solve( ConstVectorViewType b, VectorViewType x ) override
    {
-       return false;
+      return false;
    }
 };
 
-
 template<>
 class UmfpackWrapper< Matrices::CSR< double, Devices::Host, int > >
 : public LinearSolver< Matrices::CSR< double, Devices::Host, int > >
 {
    using Base = LinearSolver< Matrices::CSR< double, Devices::Host, int > >;
+
 public:
    using RealType = typename Base::RealType;
    using DeviceType = typename Base::DeviceType;
@@ -75,13 +75,14 @@ public:
    using VectorViewType = typename Base::VectorViewType;
    using ConstVectorViewType = typename Base::ConstVectorViewType;
 
-   bool solve( ConstVectorViewType b, VectorViewType x ) override;
+   bool
+   solve( ConstVectorViewType b, VectorViewType x ) override;
 };
 
-} // namespace Linear
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
 
-#include "UmfpackWrapper.hpp"
+   #include "UmfpackWrapper.hpp"
 
 #endif
diff --git a/src/TNL/Solvers/Linear/UmfpackWrapper.hpp b/src/TNL/Solvers/Linear/UmfpackWrapper.hpp
index dcc6657cd30c91dbd00fe87f4d211fa9488b695c..1490637e118003927daf29f57c669f247520da48 100644
--- a/src/TNL/Solvers/Linear/UmfpackWrapper.hpp
+++ b/src/TNL/Solvers/Linear/UmfpackWrapper.hpp
@@ -10,95 +10,103 @@
 
 #ifdef HAVE_UMFPACK
 
-#include "UmfpackWrapper.h"
+   #include "UmfpackWrapper.h"
 
-#include <TNL/Solvers/Linear/Utils/LinearResidueGetter.h>
+   #include <TNL/Solvers/Linear/Utils/LinearResidueGetter.h>
 
 namespace TNL {
 namespace Solvers {
 namespace Linear {
 
-bool UmfpackWrapper< Matrices::CSR< double, Devices::Host, int > >::
-solve( ConstVectorViewType b, VectorViewType x )
+bool
+UmfpackWrapper< Matrices::CSR< double, Devices::Host, int > >::solve( ConstVectorViewType b, VectorViewType x )
 {
-    TNL_ASSERT_EQ( this->matrix->getRows(), this->matrix->getColumns(), "matrix must be square" );
-    TNL_ASSERT_EQ( this->matrix->getColumns(), x.getSize(), "wrong size of the solution vector" );
-    TNL_ASSERT_EQ( this->matrix->getColumns(), b.getSize(), "wrong size of the right hand side" );
-
-    const IndexType size = this->matrix->getRows();
-
-    this->resetIterations();
-    this->setResidue( this -> getConvergenceResidue() + 1.0 );
-
-    RealType bNorm = b. lpNorm( ( RealType ) 2.0 );
-
-    // UMFPACK objects
-    void* Symbolic = nullptr;
-    void* Numeric = nullptr;
-
-    int status = UMFPACK_OK;
-    double Control[ UMFPACK_CONTROL ];
-    double Info[ UMFPACK_INFO ];
-
-    // umfpack expects Compressed Sparse Column format, we have Compressed Sparse Row
-    // so we need to solve  A^T * x = rhs
-    int system_type = UMFPACK_Aat;
-
-    // symbolic reordering of the sparse matrix
-    status = umfpack_di_symbolic( size, size,
-                                  this->matrix->getRowPointers().getData(),
-                                  this->matrix->getColumnIndexes().getData(),
-                                  this->matrix->getValues().getData(),
-                                  &Symbolic, Control, Info );
-    if( status != UMFPACK_OK ) {
-        std::cerr << "error: symbolic reordering failed" << std::endl;
-        goto finished;
-    }
-
-    // numeric factorization
-    status = umfpack_di_numeric( this->matrix->getRowPointers().getData(),
+   TNL_ASSERT_EQ( this->matrix->getRows(), this->matrix->getColumns(), "matrix must be square" );
+   TNL_ASSERT_EQ( this->matrix->getColumns(), x.getSize(), "wrong size of the solution vector" );
+   TNL_ASSERT_EQ( this->matrix->getColumns(), b.getSize(), "wrong size of the right hand side" );
+
+   const IndexType size = this->matrix->getRows();
+
+   this->resetIterations();
+   this->setResidue( this->getConvergenceResidue() + 1.0 );
+
+   RealType bNorm = b.lpNorm( (RealType) 2.0 );
+
+   // UMFPACK objects
+   void* Symbolic = nullptr;
+   void* Numeric = nullptr;
+
+   int status = UMFPACK_OK;
+   double Control[ UMFPACK_CONTROL ];
+   double Info[ UMFPACK_INFO ];
+
+   // umfpack expects Compressed Sparse Column format, we have Compressed Sparse Row
+   // so we need to solve  A^T * x = rhs
+   int system_type = UMFPACK_Aat;
+
+   // symbolic reordering of the sparse matrix
+   status = umfpack_di_symbolic( size,
+                                 size,
+                                 this->matrix->getRowPointers().getData(),
                                  this->matrix->getColumnIndexes().getData(),
                                  this->matrix->getValues().getData(),
-                                 Symbolic, &Numeric, Control, Info );
-    if( status != UMFPACK_OK ) {
-        std::cerr << "error: numeric factorization failed" << std::endl;
-        goto finished;
-    }
-
-    // solve with specified right-hand-side
-    status = umfpack_di_solve( system_type,
-                               this->matrix->getRowPointers().getData(),
-                               this->matrix->getColumnIndexes().getData(),
-                               this->matrix->getValues().getData(),
-                               x.getData(),
-                               b.getData(),
-                               Numeric, Control, Info );
-    if( status != UMFPACK_OK ) {
-        std::cerr << "error: umfpack_di_solve failed" << std::endl;
-        goto finished;
-    }
+                                 &Symbolic,
+                                 Control,
+                                 Info );
+   if( status != UMFPACK_OK ) {
+      std::cerr << "error: symbolic reordering failed" << std::endl;
+      goto finished;
+   }
+
+   // numeric factorization
+   status = umfpack_di_numeric( this->matrix->getRowPointers().getData(),
+                                this->matrix->getColumnIndexes().getData(),
+                                this->matrix->getValues().getData(),
+                                Symbolic,
+                                &Numeric,
+                                Control,
+                                Info );
+   if( status != UMFPACK_OK ) {
+      std::cerr << "error: numeric factorization failed" << std::endl;
+      goto finished;
+   }
+
+   // solve with specified right-hand-side
+   status = umfpack_di_solve( system_type,
+                              this->matrix->getRowPointers().getData(),
+                              this->matrix->getColumnIndexes().getData(),
+                              this->matrix->getValues().getData(),
+                              x.getData(),
+                              b.getData(),
+                              Numeric,
+                              Control,
+                              Info );
+   if( status != UMFPACK_OK ) {
+      std::cerr << "error: umfpack_di_solve failed" << std::endl;
+      goto finished;
+   }
 
 finished:
-    if( status != UMFPACK_OK ) {
-        // increase print level for reports
-        Control[ UMFPACK_PRL ] = 2;
-        umfpack_di_report_status( Control, status );
-//        umfpack_di_report_control( Control );
-//        umfpack_di_report_info( Control, Info );
-    }
-
-    if( Symbolic )
-        umfpack_di_free_symbolic( &Symbolic );
-    if( Numeric )
-        umfpack_di_free_numeric( &Numeric );
-
-    this->setResidue( LinearResidueGetter::getResidue( *this->matrix, x, b, bNorm ) );
-    this->refreshSolverMonitor( true );
-    return status == UMFPACK_OK;
+   if( status != UMFPACK_OK ) {
+      // increase print level for reports
+      Control[ UMFPACK_PRL ] = 2;
+      umfpack_di_report_status( Control, status );
+      //        umfpack_di_report_control( Control );
+      //        umfpack_di_report_info( Control, Info );
+   }
+
+   if( Symbolic )
+      umfpack_di_free_symbolic( &Symbolic );
+   if( Numeric )
+      umfpack_di_free_numeric( &Numeric );
+
+   this->setResidue( LinearResidueGetter::getResidue( *this->matrix, x, b, bNorm ) );
+   this->refreshSolverMonitor( true );
+   return status == UMFPACK_OK;
 }
 
-} // namespace Linear
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
 
 #endif
diff --git a/src/TNL/Solvers/Linear/Utils/LinearResidueGetter.h b/src/TNL/Solvers/Linear/Utils/LinearResidueGetter.h
index 4d0f74418d8d28348598dbfc570fff102f6ca028..75a4ba70467a1a75583b9988c89610ac23254842 100644
--- a/src/TNL/Solvers/Linear/Utils/LinearResidueGetter.h
+++ b/src/TNL/Solvers/Linear/Utils/LinearResidueGetter.h
@@ -14,14 +14,11 @@ struct LinearResidueGetter
 {
    template< typename Matrix, typename Vector1, typename Vector2 >
    static typename Matrix::RealType
-   getResidue( const Matrix& matrix,
-               const Vector1& x,
-               const Vector2& b,
-               typename Matrix::RealType bNorm = 0 );
+   getResidue( const Matrix& matrix, const Vector1& x, const Vector2& b, typename Matrix::RealType bNorm = 0 );
 };
 
-} // namespace Linear
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
 
 #include "LinearResidueGetter.hpp"
diff --git a/src/TNL/Solvers/Linear/Utils/LinearResidueGetter.hpp b/src/TNL/Solvers/Linear/Utils/LinearResidueGetter.hpp
index 91253dd62e964546c10ec0c3c1a77141f3a2a91d..811aec5e68d712fb3467f89bcc2c9c519af1535c 100644
--- a/src/TNL/Solvers/Linear/Utils/LinearResidueGetter.hpp
+++ b/src/TNL/Solvers/Linear/Utils/LinearResidueGetter.hpp
@@ -15,11 +15,7 @@ namespace Linear {
 
 template< typename Matrix, typename Vector1, typename Vector2 >
 typename Matrix::RealType
-LinearResidueGetter::
-getResidue( const Matrix& matrix,
-            const Vector1& x,
-            const Vector2& b,
-            typename Matrix::RealType bNorm )
+LinearResidueGetter::getResidue( const Matrix& matrix, const Vector1& x, const Vector2& b, typename Matrix::RealType bNorm )
 {
    using VectorType = typename Traits< Matrix >::VectorType;
 
@@ -31,6 +27,6 @@ getResidue( const Matrix& matrix,
    return l2Norm( v - b ) / bNorm;
 }
 
-} // namespace Linear
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/Linear/Utils/Traits.h b/src/TNL/Solvers/Linear/Utils/Traits.h
index b3213cc9536f46fe789b30ebccb872423c23c68e..a94298036e980fc12c6efc95f48d3f3728bb07c5 100644
--- a/src/TNL/Solvers/Linear/Utils/Traits.h
+++ b/src/TNL/Solvers/Linear/Utils/Traits.h
@@ -22,18 +22,11 @@ namespace Linear {
 template< typename Matrix >
 struct Traits
 {
-   using VectorType = Containers::Vector
-         < typename Matrix::RealType,
-           typename Matrix::DeviceType,
-           typename Matrix::IndexType >;
-   using VectorViewType = Containers::VectorView
-         < typename Matrix::RealType,
-           typename Matrix::DeviceType,
-           typename Matrix::IndexType >;
-   using ConstVectorViewType = Containers::VectorView
-         < std::add_const_t< typename Matrix::RealType >,
-           typename Matrix::DeviceType,
-           typename Matrix::IndexType >;
+   using VectorType = Containers::Vector< typename Matrix::RealType, typename Matrix::DeviceType, typename Matrix::IndexType >;
+   using VectorViewType =
+      Containers::VectorView< typename Matrix::RealType, typename Matrix::DeviceType, typename Matrix::IndexType >;
+   using ConstVectorViewType = Containers::
+      VectorView< std::add_const_t< typename Matrix::RealType >, typename Matrix::DeviceType, typename Matrix::IndexType >;
 
    // compatibility aliases
    using LocalVectorType = VectorType;
@@ -41,54 +34,87 @@ struct Traits
    using ConstLocalViewType = ConstVectorViewType;
 
    // compatibility wrappers for some DistributedMatrix methods
-   static const Matrix& getLocalMatrix( const Matrix& m ) { return m; }
-   static ConstLocalViewType getConstLocalView( ConstVectorViewType v ) { return v; }
-   static LocalViewType getLocalView( VectorViewType v ) { return v; }
+   static const Matrix&
+   getLocalMatrix( const Matrix& m )
+   {
+      return m;
+   }
+   static ConstLocalViewType
+   getConstLocalView( ConstVectorViewType v )
+   {
+      return v;
+   }
+   static LocalViewType
+   getLocalView( VectorViewType v )
+   {
+      return v;
+   }
 
-   static MPI_Comm getCommunicator( const Matrix& m ) { return MPI_COMM_WORLD; }
-   static void startSynchronization( VectorViewType v ) {}
-   static void waitForSynchronization( VectorViewType v ) {}
+   static MPI_Comm
+   getCommunicator( const Matrix& m )
+   {
+      return MPI_COMM_WORLD;
+   }
+   static void
+   startSynchronization( VectorViewType v )
+   {}
+   static void
+   waitForSynchronization( VectorViewType v )
+   {}
 };
 
 template< typename Matrix >
 struct Traits< Matrices::DistributedMatrix< Matrix > >
 {
-   using VectorType = Containers::DistributedVector
-         < typename Matrix::RealType,
-           typename Matrix::DeviceType,
-           typename Matrix::IndexType >;
-   using VectorViewType = Containers::DistributedVectorView
-         < typename Matrix::RealType,
-           typename Matrix::DeviceType,
-           typename Matrix::IndexType >;
-   using ConstVectorViewType = Containers::DistributedVectorView
-         < std::add_const_t< typename Matrix::RealType >,
-           typename Matrix::DeviceType,
-           typename Matrix::IndexType >;
+   using VectorType =
+      Containers::DistributedVector< typename Matrix::RealType, typename Matrix::DeviceType, typename Matrix::IndexType >;
+   using VectorViewType =
+      Containers::DistributedVectorView< typename Matrix::RealType, typename Matrix::DeviceType, typename Matrix::IndexType >;
+   using ConstVectorViewType = Containers::DistributedVectorView< std::add_const_t< typename Matrix::RealType >,
+                                                                  typename Matrix::DeviceType,
+                                                                  typename Matrix::IndexType >;
 
-   using LocalVectorType = Containers::Vector
-         < typename Matrix::RealType,
-           typename Matrix::DeviceType,
-           typename Matrix::IndexType >;
-   using LocalViewType = Containers::VectorView
-         < typename Matrix::RealType,
-           typename Matrix::DeviceType,
-           typename Matrix::IndexType >;
-   using ConstLocalViewType = Containers::VectorView
-         < std::add_const_t< typename Matrix::RealType >,
-           typename Matrix::DeviceType,
-           typename Matrix::IndexType >;
+   using LocalVectorType =
+      Containers::Vector< typename Matrix::RealType, typename Matrix::DeviceType, typename Matrix::IndexType >;
+   using LocalViewType =
+      Containers::VectorView< typename Matrix::RealType, typename Matrix::DeviceType, typename Matrix::IndexType >;
+   using ConstLocalViewType = Containers::
+      VectorView< std::add_const_t< typename Matrix::RealType >, typename Matrix::DeviceType, typename Matrix::IndexType >;
 
    // compatibility wrappers for some DistributedMatrix methods
-   static const Matrix& getLocalMatrix( const Matrices::DistributedMatrix< Matrix >& m ) { return m.getLocalMatrix(); }
-   static ConstLocalViewType getConstLocalView( ConstVectorViewType v ) { return v.getConstLocalView(); }
-   static LocalViewType getLocalView( VectorViewType v ) { return v.getLocalView(); }
+   static const Matrix&
+   getLocalMatrix( const Matrices::DistributedMatrix< Matrix >& m )
+   {
+      return m.getLocalMatrix();
+   }
+   static ConstLocalViewType
+   getConstLocalView( ConstVectorViewType v )
+   {
+      return v.getConstLocalView();
+   }
+   static LocalViewType
+   getLocalView( VectorViewType v )
+   {
+      return v.getLocalView();
+   }
 
-   static MPI_Comm getCommunicator( const Matrices::DistributedMatrix< Matrix >& m ) { return m.getCommunicator(); }
-   static void startSynchronization( VectorViewType v ) { v.startSynchronization(); }
-   static void waitForSynchronization( VectorViewType v ) { v.waitForSynchronization(); }
+   static MPI_Comm
+   getCommunicator( const Matrices::DistributedMatrix< Matrix >& m )
+   {
+      return m.getCommunicator();
+   }
+   static void
+   startSynchronization( VectorViewType v )
+   {
+      v.startSynchronization();
+   }
+   static void
+   waitForSynchronization( VectorViewType v )
+   {
+      v.waitForSynchronization();
+   }
 };
 
-} // namespace Linear
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/Linear/Utils/TriangularSolve.h b/src/TNL/Solvers/Linear/Utils/TriangularSolve.h
index b2881b9b057eb2eea283c8d9534e42a919c14bec..c4fe864ccc3611d7dbdc6d00a06b634d08b67f24 100644
--- a/src/TNL/Solvers/Linear/Utils/TriangularSolve.h
+++ b/src/TNL/Solvers/Linear/Utils/TriangularSolve.h
@@ -25,7 +25,8 @@ namespace Linear {
  * necessary was explicitly allocated.
  */
 template< bool fullStorage = true, typename Matrix, typename Vector1, typename Vector2 >
-void triangularSolveLower( const Matrix& L, Vector1& x, const Vector2& b )
+void
+triangularSolveLower( const Matrix& L, Vector1& x, const Vector2& b )
 {
    TNL_ASSERT_EQ( b.getSize(), L.getRows(), "wrong size of the right hand side" );
    TNL_ASSERT_EQ( x.getSize(), L.getRows(), "wrong size of the solution vector" );
@@ -71,9 +72,9 @@ void triangularSolveLower( const Matrix& L, Vector1& x, const Vector2& b )
  * zeros. This is useful for Ellpack-based formats or if more space than
  * necessary was explicitly allocated.
  */
-template< bool reversedRows = false, bool fullStorage = true,
-          typename Matrix, typename Vector1, typename Vector2 >
-void triangularSolveUpper( const Matrix& U, Vector1& x, const Vector2& b )
+template< bool reversedRows = false, bool fullStorage = true, typename Matrix, typename Vector1, typename Vector2 >
+void
+triangularSolveUpper( const Matrix& U, Vector1& x, const Vector2& b )
 {
    TNL_ASSERT_EQ( b.getSize(), U.getRows(), "wrong size of the right hand side" );
    TNL_ASSERT_EQ( x.getSize(), U.getRows(), "wrong size of the solution vector" );
@@ -86,7 +87,7 @@ void triangularSolveUpper( const Matrix& U, Vector1& x, const Vector2& b )
    // GOTCHA: the loop with IndexType i = N - 1; i >= 0; i-- does not work for unsigned integer types
    for( IndexType k = 0; k < N; k++ ) {
       const IndexType i = N - 1 - k;
-      const IndexType U_idx = (reversedRows) ? k : i;
+      const IndexType U_idx = ( reversedRows ) ? k : i;
 
       RealType x_i = b[ i ];
 
@@ -96,7 +97,7 @@ void triangularSolveUpper( const Matrix& U, Vector1& x, const Vector2& b )
       const auto U_ii = U_i.getValue( 0 );
 
       // loop for j = i+1, ..., N-1; but only over the non-zero entries
-      for( IndexType c_j = 1; c_j < U_entries ; c_j++ ) {
+      for( IndexType c_j = 1; c_j < U_entries; c_j++ ) {
          const auto j = U_i.getColumnIndex( c_j );
          // skip padding zeros
          if( fullStorage == false && j >= N )
@@ -108,6 +109,6 @@ void triangularSolveUpper( const Matrix& U, Vector1& x, const Vector2& b )
    }
 }
 
-} // namespace Linear
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/Linear/_NamespaceDoxy.h b/src/TNL/Solvers/Linear/_NamespaceDoxy.h
index 8dc32ac2c28450b0b8200bfe944bfae7196aa501..93b8c80c9516759e489b85e7b8843441f9bbe8e8 100644
--- a/src/TNL/Solvers/Linear/_NamespaceDoxy.h
+++ b/src/TNL/Solvers/Linear/_NamespaceDoxy.h
@@ -7,35 +7,34 @@
 #pragma once
 
 namespace TNL {
-   namespace Solvers {
+namespace Solvers {
 
-      /**
-       * \brief Namespace for linear system solvers.
-       *
-       * This namespace contains the following algorithms and methods for solution of linear systems.
-       *
-       * # Direct methods
-       *
-       * # Iterative methods
-       *
-       * ## Stationary methods
-       *    1. Jacobi method - \ref TNL::Solvers::Linear::Jacobi
-       *    2. Successive-overrelaxation method, SOR - \ref TNL::Solvers::Linear::SOR
-       *
-       * ## Krylov subspace methods
-       *    1. Conjugate gradient method, CG - \ref TNL::Solvers::Linear::CG
-       *    2. Biconjugate gradient stabilized method, BICGStab  - \ref TNL::Solvers::Linear::BICGStab
-       *    3. BICGStab(l) method  - \ref TNL::Solvers::Linear::BICGStabL
-       *    4. Transpose-free quasi-minimal residual method, TFQMR - \ref TNL::Solvers::Linear::TFQMR
-       *    5. Generalized minimal residual method, GMERS - \ref TNL::Solvers::Linear::GMRES with various methods of orthogonalization
-       *        1. [Classical Gramm-Schmidt, CGS](https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process)
-       *        2. Classical Gramm-Schmidt with reorthogonalization, CGSR
-       *        3. Modified Gramm-Schmidt, MGS
-       *        4. Modified Gramm-Schmidt with reorthogonalization, MGSR
-       *        5. Compact WY form of the Householder reflections, CWY
-       *
-       */
-      namespace Linear {
-      } // namespace Linear
-   } // namespace Solvers
-} // namespace TNL
+/**
+ * \brief Namespace for linear system solvers.
+ *
+ * This namespace contains the following algorithms and methods for solution of linear systems.
+ *
+ * # Direct methods
+ *
+ * # Iterative methods
+ *
+ * ## Stationary methods
+ *    1. Jacobi method - \ref TNL::Solvers::Linear::Jacobi
+ *    2. Successive-overrelaxation method, SOR - \ref TNL::Solvers::Linear::SOR
+ *
+ * ## Krylov subspace methods
+ *    1. Conjugate gradient method, CG - \ref TNL::Solvers::Linear::CG
+ *    2. Biconjugate gradient stabilized method, BICGStab  - \ref TNL::Solvers::Linear::BICGStab
+ *    3. BICGStab(l) method  - \ref TNL::Solvers::Linear::BICGStabL
+ *    4. Transpose-free quasi-minimal residual method, TFQMR - \ref TNL::Solvers::Linear::TFQMR
+ *    5. Generalized minimal residual method, GMERS - \ref TNL::Solvers::Linear::GMRES with various methods of orthogonalization
+ *        1. [Classical Gramm-Schmidt, CGS](https://en.wikipedia.org/wiki/Gram%E2%80%93Schmidt_process)
+ *        2. Classical Gramm-Schmidt with reorthogonalization, CGSR
+ *        3. Modified Gramm-Schmidt, MGS
+ *        4. Modified Gramm-Schmidt with reorthogonalization, MGSR
+ *        5. Compact WY form of the Householder reflections, CWY
+ *
+ */
+namespace Linear {}  // namespace Linear
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/LinearSolverTypeResolver.h b/src/TNL/Solvers/LinearSolverTypeResolver.h
index 9dcbe65a27a7aa14792582b13caeb8a1906d45d8..3a70b72f5490ab502f3419f68863bfcb7a9844fe 100644
--- a/src/TNL/Solvers/LinearSolverTypeResolver.h
+++ b/src/TNL/Solvers/LinearSolverTypeResolver.h
@@ -25,26 +25,26 @@
 #include <TNL/Solvers/Linear/Preconditioners/ILUT.h>
 
 namespace TNL {
-   namespace Solvers {
+namespace Solvers {
 
 /**
  * \brief Function returning available linear solvers.
  *
  * \return container with names of available linear solvers.
  */
-inline std::vector<std::string>
+inline std::vector< std::string >
 getLinearSolverOptions()
 {
-   return {
-      "jacobi",
-      "sor",
-      "cg",
-      "bicgstab",
-      "bicgstabl",
-      "gmres",
-      "tfqmr"
+   return { "jacobi",
+            "sor",
+            "cg",
+            "bicgstab",
+            "bicgstabl",
+            "gmres",
+            "tfqmr"
 #ifdef HAVE_UMFPACK
-      , "umfpack"
+            ,
+            "umfpack"
 #endif
    };
 }
@@ -54,15 +54,10 @@ getLinearSolverOptions()
  *
  * \return container with names of available linear preconditioners.
  */
-inline std::vector<std::string>
+inline std::vector< std::string >
 getPreconditionerOptions()
 {
-   return {
-      "none",
-      "diagonal",
-      "ilu0",
-      "ilut"
-   };
+   return { "none", "diagonal", "ilu0", "ilut" };
 }
 
 /**
@@ -143,7 +138,6 @@ template< typename MatrixType >
 std::shared_ptr< Linear::Preconditioners::Preconditioner< MatrixType > >
 getPreconditioner( std::string name )
 {
-
    if( name == "none" )
       return nullptr;
    if( name == "diagonal" )
@@ -165,5 +159,5 @@ getPreconditioner( std::string name )
    return nullptr;
 }
 
-   } // namespace Solvers
-} // namespace TNL
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/ODE/Euler.h b/src/TNL/Solvers/ODE/Euler.h
index 9500ddf083830fd0fdbfb98e6a2b844d2d913ef0..23b02e74a8f6cfabf98ca57774ba586daf85ba23 100644
--- a/src/TNL/Solvers/ODE/Euler.h
+++ b/src/TNL/Solvers/ODE/Euler.h
@@ -18,38 +18,40 @@ template< typename Problem,
           typename SolverMonitor = IterativeSolverMonitor< typename Problem::RealType, typename Problem::IndexType > >
 class Euler : public ExplicitSolver< Problem, SolverMonitor >
 {
-   public:
+public:
+   using ProblemType = Problem;
+   using DofVectorType = typename ProblemType::DofVectorType;
+   using RealType = typename ProblemType::RealType;
+   using DeviceType = typename ProblemType::DeviceType;
+   using IndexType = typename ProblemType::IndexType;
+   using DofVectorPointer = Pointers::SharedPointer< DofVectorType, DeviceType >;
+   using SolverMonitorType = SolverMonitor;
 
-      using ProblemType = Problem;
-      using DofVectorType = typename ProblemType::DofVectorType;
-      using RealType = typename ProblemType::RealType;
-      using DeviceType = typename ProblemType::DeviceType;
-      using IndexType  = typename ProblemType::IndexType;
-      using DofVectorPointer = Pointers::SharedPointer<  DofVectorType, DeviceType >;
-      using SolverMonitorType = SolverMonitor;
+   Euler();
 
-      Euler();
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" );
 
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" );
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-      bool setup( const Config::ParameterContainer& parameters,
-                 const String& prefix = "" );
+   void
+   setCFLCondition( const RealType& cfl );
 
-      void setCFLCondition( const RealType& cfl );
+   const RealType&
+   getCFLCondition() const;
 
-      const RealType& getCFLCondition() const;
+   bool
+   solve( DofVectorPointer& u );
 
-      bool solve( DofVectorPointer& u );
+protected:
+   DofVectorPointer _k1;
 
-   protected:
-      DofVectorPointer _k1;
-
-      RealType cflCondition;
+   RealType cflCondition;
 };
 
-} // namespace ODE
-} // namespace Solvers
-} // namespace TNL
+}  // namespace ODE
+}  // namespace Solvers
+}  // namespace TNL
 
 #include <TNL/Solvers/ODE/Euler.hpp>
diff --git a/src/TNL/Solvers/ODE/Euler.hpp b/src/TNL/Solvers/ODE/Euler.hpp
index 706f156e6a0bb3c419f258e7b289ca30f5274af8..500bf5095ce9e026f6bf034545099ce6bf0f6b14 100644
--- a/src/TNL/Solvers/ODE/Euler.hpp
+++ b/src/TNL/Solvers/ODE/Euler.hpp
@@ -14,30 +14,25 @@ namespace ODE {
 
 #ifdef HAVE_CUDA
 template< typename RealType, typename Index >
-__global__ void updateUEuler( const Index size,
-                              const RealType tau,
-                              const RealType* k1,
-                              RealType* u,
-                              RealType* cudaBlockResidue );
+__global__
+void
+updateUEuler( const Index size, const RealType tau, const RealType* k1, RealType* u, RealType* cudaBlockResidue );
 #endif
 
 template< typename Problem, typename SolverMonitor >
-Euler< Problem, SolverMonitor > :: Euler()
-: cflCondition( 0.0 )
-{
-};
+Euler< Problem, SolverMonitor >::Euler() : cflCondition( 0.0 ){};
 
 template< typename Problem, typename SolverMonitor >
-void Euler< Problem, SolverMonitor > :: configSetup( Config::ConfigDescription& config,
-                                               const String& prefix )
+void
+Euler< Problem, SolverMonitor >::configSetup( Config::ConfigDescription& config, const String& prefix )
 {
-   //ExplicitSolver< Problem >::configSetup( config, prefix );
+   // ExplicitSolver< Problem >::configSetup( config, prefix );
    config.addEntry< double >( prefix + "euler-cfl", "Coefficient C in the Courant–Friedrichs–Lewy condition.", 0.0 );
 };
 
 template< typename Problem, typename SolverMonitor >
-bool Euler< Problem, SolverMonitor > :: setup( const Config::ParameterContainer& parameters,
-                                        const String& prefix )
+bool
+Euler< Problem, SolverMonitor >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    ExplicitSolver< Problem, SolverMonitor >::setup( parameters, prefix );
    if( parameters.checkParameter( prefix + "euler-cfl" ) )
@@ -46,19 +41,22 @@ bool Euler< Problem, SolverMonitor > :: setup( const Config::ParameterContainer&
 }
 
 template< typename Problem, typename SolverMonitor >
-void Euler< Problem, SolverMonitor > :: setCFLCondition( const RealType& cfl )
+void
+Euler< Problem, SolverMonitor >::setCFLCondition( const RealType& cfl )
 {
-   this -> cflCondition = cfl;
+   this->cflCondition = cfl;
 }
 
 template< typename Problem, typename SolverMonitor >
-const typename Problem :: RealType& Euler< Problem, SolverMonitor > :: getCFLCondition() const
+const typename Problem ::RealType&
+Euler< Problem, SolverMonitor >::getCFLCondition() const
 {
-   return this -> cflCondition;
+   return this->cflCondition;
 }
 
 template< typename Problem, typename SolverMonitor >
-bool Euler< Problem, SolverMonitor > :: solve( DofVectorPointer& _u )
+bool
+Euler< Problem, SolverMonitor >::solve( DofVectorPointer& _u )
 {
    /****
     * First setup the supporting meshes k1...k5 and k_tmp.
@@ -68,22 +66,22 @@ bool Euler< Problem, SolverMonitor > :: solve( DofVectorPointer& _u )
    auto u = _u->getView();
    k1 = 0.0;
 
-
    /****
     * Set necessary parameters
     */
    RealType& time = this->time;
    RealType currentTau = min( this->getTau(), this->getMaxTau() );
-   if( time + currentTau > this->getStopTime() ) currentTau = this->getStopTime() - time;
-   if( currentTau == 0.0 ) return true;
+   if( time + currentTau > this->getStopTime() )
+      currentTau = this->getStopTime() - time;
+   if( currentTau == 0.0 )
+      return true;
    this->resetIterations();
    this->setResidue( this->getConvergenceResidue() + 1.0 );
 
    /****
     * Start the main loop
     */
-   while( 1 )
-   {
+   while( 1 ) {
       /****
        * Compute the RHS
        */
@@ -91,22 +89,22 @@ bool Euler< Problem, SolverMonitor > :: solve( DofVectorPointer& _u )
 
       RealType lastResidue = this->getResidue();
       RealType maxResidue( 0.0 );
-      if( this -> cflCondition != 0.0 )
-      {
-         maxResidue = max( abs( k1 ) ); //k1->absMax();
-         if( currentTau * maxResidue > this->cflCondition )
-         {
+      if( this->cflCondition != 0.0 ) {
+         maxResidue = max( abs( k1 ) );  // k1->absMax();
+         if( currentTau * maxResidue > this->cflCondition ) {
             currentTau *= 0.9;
             continue;
          }
       }
-      this->setResidue( addAndReduceAbs( u, currentTau * k1, std::plus<>{}, ( RealType ) 0.0 ) / ( currentTau * ( RealType ) u.getSize() ) );
+      this->setResidue( addAndReduceAbs( u, currentTau * k1, std::plus<>{}, (RealType) 0.0 )
+                        / ( currentTau * (RealType) u.getSize() ) );
 
       /****
        * When time is close to stopTime the new residue
        * may be inaccurate significantly.
        */
-      if( currentTau + time == this -> stopTime ) this->setResidue( lastResidue );
+      if( currentTau + time == this->stopTime )
+         this->setResidue( lastResidue );
       time += currentTau;
       this->problem->applyBoundaryConditions( time, _u );
 
@@ -116,25 +114,25 @@ bool Euler< Problem, SolverMonitor > :: solve( DofVectorPointer& _u )
       /****
        * Compute the new time step.
        */
-      if( time + currentTau > this -> getStopTime() )
-         currentTau = this -> getStopTime() - time; //we don't want to keep such tau
-      else this -> tau = currentTau;
+      if( time + currentTau > this->getStopTime() )
+         currentTau = this->getStopTime() - time;  // we don't want to keep such tau
+      else
+         this->tau = currentTau;
 
       /****
        * Check stop conditions.
        */
-      if( time >= this->getStopTime() ||
-          ( this -> getConvergenceResidue() != 0.0 && this->getResidue() < this -> getConvergenceResidue() ) )
+      if( time >= this->getStopTime()
+          || ( this->getConvergenceResidue() != 0.0 && this->getResidue() < this->getConvergenceResidue() ) )
          return true;
 
-      if( this -> cflCondition != 0.0 )
-      {
+      if( this->cflCondition != 0.0 ) {
          currentTau /= 0.95;
          currentTau = min( currentTau, this->getMaxTau() );
       }
    }
 };
 
-} // namespace ODE
-} // namespace Solvers
-} // namespace TNL
+}  // namespace ODE
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/ODE/ExplicitSolver.h b/src/TNL/Solvers/ODE/ExplicitSolver.h
index 4e0eededf299eaef63903bed1f9507377469ef73..d5b60bb6cff801a1eb47df7e2ab23c867634e7ee 100644
--- a/src/TNL/Solvers/ODE/ExplicitSolver.h
+++ b/src/TNL/Solvers/ODE/ExplicitSolver.h
@@ -20,58 +20,68 @@ namespace ODE {
 
 template< class Problem,
           typename SolverMonitor = IterativeSolverMonitor< typename Problem::RealType, typename Problem::IndexType > >
-class ExplicitSolver : public IterativeSolver< typename Problem::RealType,
-                                               typename Problem::IndexType,
-                                               SolverMonitor >
+class ExplicitSolver : public IterativeSolver< typename Problem::RealType, typename Problem::IndexType, SolverMonitor >
 {
-   public:
-
+public:
    using ProblemType = Problem;
    using DofVectorType = typename Problem::DofVectorType;
    using RealType = typename Problem::RealType;
    using DeviceType = typename Problem::DeviceType;
    using IndexType = typename Problem::IndexType;
-   using DofVectorPointer = Pointers::SharedPointer<  DofVectorType, DeviceType >;
+   using DofVectorPointer = Pointers::SharedPointer< DofVectorType, DeviceType >;
    using SolverMonitorType = SolverMonitor;
 
    ExplicitSolver();
 
-   static void configSetup( Config::ConfigDescription& config,
-                            const String& prefix = "" );
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" );
 
-   bool setup( const Config::ParameterContainer& parameters,
-              const String& prefix = "" );
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-   void setProblem( Problem& problem );
+   void
+   setProblem( Problem& problem );
 
-   void setTime( const RealType& t );
+   void
+   setTime( const RealType& t );
 
-   const RealType& getTime() const;
+   const RealType&
+   getTime() const;
 
-   void setStopTime( const RealType& stopTime );
+   void
+   setStopTime( const RealType& stopTime );
 
-   RealType getStopTime() const;
+   RealType
+   getStopTime() const;
 
-   void setTau( const RealType& tau );
+   void
+   setTau( const RealType& tau );
 
-   const RealType& getTau() const;
+   const RealType&
+   getTau() const;
 
-   void setMaxTau( const RealType& maxTau );
+   void
+   setMaxTau( const RealType& maxTau );
 
-   const RealType& getMaxTau() const;
+   const RealType&
+   getMaxTau() const;
 
-   void setVerbose( IndexType v );
+   void
+   setVerbose( IndexType v );
 
-   virtual bool solve( DofVectorPointer& u ) = 0;
+   virtual bool
+   solve( DofVectorPointer& u ) = 0;
 
-   void setTestingMode( bool testingMode );
+   void
+   setTestingMode( bool testingMode );
 
-   void setRefreshRate( const IndexType& refreshRate );
+   void
+   setRefreshRate( const IndexType& refreshRate );
 
-   void refreshSolverMonitor( bool force = false );
+   void
+   refreshSolverMonitor( bool force = false );
 
 protected:
-
    /****
     * Current time of the parabolic problem.
     */
@@ -101,8 +111,8 @@ protected:
    Containers::Vector< RealType, DeviceType, IndexType > cudaBlockResidue;
 };
 
-} // namespace ODE
-} // namespace Solvers
-} // namespace TNL
+}  // namespace ODE
+}  // namespace Solvers
+}  // namespace TNL
 
 #include <TNL/Solvers/ODE/ExplicitSolver.hpp>
diff --git a/src/TNL/Solvers/ODE/ExplicitSolver.hpp b/src/TNL/Solvers/ODE/ExplicitSolver.hpp
index 7f973fc2e5101defe1b29c45b43d3e7572e7f9c0..b83804ca3057e1335addf7cb851846c0868f9542 100644
--- a/src/TNL/Solvers/ODE/ExplicitSolver.hpp
+++ b/src/TNL/Solvers/ODE/ExplicitSolver.hpp
@@ -13,127 +13,103 @@ namespace Solvers {
 namespace ODE {
 
 template< typename Problem, typename SolverMonitor >
-ExplicitSolver< Problem, SolverMonitor >::
-ExplicitSolver()
-:  time( 0.0 ),
-   stopTime( 0.0 ),
-   tau( 0.0 ),
-   maxTau( std::numeric_limits< RealType >::max() ),
-   verbosity( 0 ),
-   testingMode( false ),
-   problem( 0 )//,
-   //solverMonitor( 0 )
-{
-};
+ExplicitSolver< Problem, SolverMonitor >::ExplicitSolver()
+: time( 0.0 ), stopTime( 0.0 ), tau( 0.0 ), maxTau( std::numeric_limits< RealType >::max() ), verbosity( 0 ),
+  testingMode( false ), problem( 0 )  //,
+  // solverMonitor( 0 )
+  {};
 
 template< typename Problem, typename SolverMonitor >
 void
-ExplicitSolver< Problem, SolverMonitor >::
-configSetup( Config::ConfigDescription& config,
-             const String& prefix )
+ExplicitSolver< Problem, SolverMonitor >::configSetup( Config::ConfigDescription& config, const String& prefix )
 {
-   //IterativeSolver< typename Problem::RealType, typename Problem::IndexType >::configSetup( config, prefix );
+   // IterativeSolver< typename Problem::RealType, typename Problem::IndexType >::configSetup( config, prefix );
 }
 
 template< typename Problem, typename SolverMonitor >
 bool
-ExplicitSolver< Problem, SolverMonitor >::
-setup( const Config::ParameterContainer& parameters,
-       const String& prefix )
+ExplicitSolver< Problem, SolverMonitor >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    this->setVerbose( parameters.getParameter< int >( "verbose" ) );
-   return IterativeSolver< typename Problem::RealType, typename Problem::IndexType, SolverMonitor >::setup( parameters, prefix );
+   return IterativeSolver< typename Problem::RealType, typename Problem::IndexType, SolverMonitor >::setup( parameters,
+                                                                                                            prefix );
 }
 
 template< typename Problem, typename SolverMonitor >
 void
-ExplicitSolver< Problem, SolverMonitor >::
-setProblem( Problem& problem )
+ExplicitSolver< Problem, SolverMonitor >::setProblem( Problem& problem )
 {
    this->problem = &problem;
 };
 
 template< class Problem, typename SolverMonitor >
 void
-ExplicitSolver< Problem, SolverMonitor >::
-setTime( const RealType& time )
+ExplicitSolver< Problem, SolverMonitor >::setTime( const RealType& time )
 {
    this->time = time;
 };
 
 template< class Problem, typename SolverMonitor >
-const typename Problem :: RealType&
-ExplicitSolver< Problem, SolverMonitor >::
-getTime() const
+const typename Problem ::RealType&
+ExplicitSolver< Problem, SolverMonitor >::getTime() const
 {
    return this->time;
 };
 
 template< class Problem, typename SolverMonitor >
 void
-ExplicitSolver< Problem, SolverMonitor >::
-setTau( const RealType& tau )
+ExplicitSolver< Problem, SolverMonitor >::setTau( const RealType& tau )
 {
    this->tau = tau;
 };
 
 template< class Problem, typename SolverMonitor >
-const typename Problem :: RealType&
-ExplicitSolver< Problem, SolverMonitor >::
-getTau() const
+const typename Problem ::RealType&
+ExplicitSolver< Problem, SolverMonitor >::getTau() const
 {
    return this->tau;
 };
 
 template< class Problem, typename SolverMonitor >
 void
-ExplicitSolver< Problem, SolverMonitor >::
-setMaxTau( const RealType& maxTau )
+ExplicitSolver< Problem, SolverMonitor >::setMaxTau( const RealType& maxTau )
 {
    this->maxTau = maxTau;
 };
 
-
 template< class Problem, typename SolverMonitor >
-const typename Problem :: RealType&
-ExplicitSolver< Problem, SolverMonitor >::
-getMaxTau() const
+const typename Problem ::RealType&
+ExplicitSolver< Problem, SolverMonitor >::getMaxTau() const
 {
    return this->maxTau;
 };
 
-
 template< class Problem, typename SolverMonitor >
-typename Problem :: RealType
-ExplicitSolver< Problem, SolverMonitor >::
-getStopTime() const
+typename Problem ::RealType
+ExplicitSolver< Problem, SolverMonitor >::getStopTime() const
 {
-    return this->stopTime;
+   return this->stopTime;
 }
 
 template< class Problem, typename SolverMonitor >
 void
-ExplicitSolver< Problem, SolverMonitor >::
-setStopTime( const RealType& stopTime )
+ExplicitSolver< Problem, SolverMonitor >::setStopTime( const RealType& stopTime )
 {
-    this->stopTime = stopTime;
+   this->stopTime = stopTime;
 }
 
 template< class Problem, typename SolverMonitor >
 void
-ExplicitSolver< Problem, SolverMonitor >::
-setVerbose( IndexType v )
+ExplicitSolver< Problem, SolverMonitor >::setVerbose( IndexType v )
 {
    this->verbosity = v;
 };
 
 template< class Problem, typename SolverMonitor >
 void
-ExplicitSolver< Problem, SolverMonitor >::
-refreshSolverMonitor( bool force )
+ExplicitSolver< Problem, SolverMonitor >::refreshSolverMonitor( bool force )
 {
-   if( this->solverMonitor )
-   {
+   if( this->solverMonitor ) {
       this->solverMonitor->setIterations( this->getIterations() );
       this->solverMonitor->setResidue( this->getResidue() );
       this->solverMonitor->setTimeStep( this->getTau() );
@@ -144,13 +120,11 @@ refreshSolverMonitor( bool force )
 
 template< class Problem, typename SolverMonitor >
 void
-ExplicitSolver< Problem, SolverMonitor >::
-setTestingMode( bool testingMode )
+ExplicitSolver< Problem, SolverMonitor >::setTestingMode( bool testingMode )
 {
    this->testingMode = testingMode;
 }
 
-
-} // namespace ODE
-} // namespace Solvers
-} // namespace TNL
+}  // namespace ODE
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/ODE/Merson.h b/src/TNL/Solvers/ODE/Merson.h
index 9e3227003da4fff3ad303125846af68d8cf4a191..2c28664935b84d2c3fb4d5888409bfc8d83d2dc3 100644
--- a/src/TNL/Solvers/ODE/Merson.h
+++ b/src/TNL/Solvers/ODE/Merson.h
@@ -18,44 +18,45 @@ template< class Problem,
           typename SolverMonitor = IterativeSolverMonitor< typename Problem::RealType, typename Problem::IndexType > >
 class Merson : public ExplicitSolver< Problem, SolverMonitor >
 {
-   public:
+public:
+   using ProblemType = Problem;
+   using DofVectorType = typename Problem::DofVectorType;
+   using RealType = typename Problem::RealType;
+   using DeviceType = typename Problem::DeviceType;
+   using IndexType = typename Problem::IndexType;
+   using DofVectorPointer = Pointers::SharedPointer< DofVectorType, DeviceType >;
+   using SolverMonitorType = SolverMonitor;
 
-      using ProblemType = Problem;
-      using DofVectorType = typename Problem::DofVectorType;
-      using RealType = typename Problem::RealType;
-      using DeviceType = typename Problem::DeviceType;
-      using IndexType = typename Problem::IndexType;
-      using DofVectorPointer = Pointers::SharedPointer< DofVectorType, DeviceType >;
-      using SolverMonitorType = SolverMonitor;
+   Merson();
 
-      Merson();
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" );
 
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" );
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-      bool setup( const Config::ParameterContainer& parameters,
-                 const String& prefix = "" );
+   void
+   setAdaptivity( const RealType& a );
 
-      void setAdaptivity( const RealType& a );
+   bool
+   solve( DofVectorPointer& u );
 
-      bool solve( DofVectorPointer& u );
+protected:
+   void
+   writeGrids( const DofVectorPointer& u );
 
-   protected:
+   DofVectorPointer _k1, _k2, _k3, _k4, _k5, _kAux;
 
-      void writeGrids( const DofVectorPointer& u );
+   /****
+    * This controls the accuracy of the solver
+    */
+   RealType adaptivity;
 
-      DofVectorPointer _k1, _k2, _k3, _k4, _k5, _kAux;
-
-      /****
-       * This controls the accuracy of the solver
-       */
-      RealType adaptivity;
-
-      Containers::Vector< RealType, DeviceType, IndexType > openMPErrorEstimateBuffer;
+   Containers::Vector< RealType, DeviceType, IndexType > openMPErrorEstimateBuffer;
 };
 
-} // namespace ODE
-} // namespace Solvers
-} // namespace TNL
+}  // namespace ODE
+}  // namespace Solvers
+}  // namespace TNL
 
 #include <TNL/Solvers/ODE/Merson.hpp>
diff --git a/src/TNL/Solvers/ODE/Merson.hpp b/src/TNL/Solvers/ODE/Merson.hpp
index fa781b55b5cadc7d0c4d50d9a6c8749373fd91c1..ae86f6cbccf90067ebfb6fe79c2bb605470f6f4f 100644
--- a/src/TNL/Solvers/ODE/Merson.hpp
+++ b/src/TNL/Solvers/ODE/Merson.hpp
@@ -26,26 +26,27 @@ namespace ODE {
  */
 
 template< typename Problem, typename SolverMonitor >
-Merson< Problem, SolverMonitor >::Merson()
-: adaptivity( 0.00001 )
+Merson< Problem, SolverMonitor >::Merson() : adaptivity( 0.00001 )
 {
-   if( std::is_same< DeviceType, Devices::Host >::value )
-   {
+   if( std::is_same< DeviceType, Devices::Host >::value ) {
       this->openMPErrorEstimateBuffer.setSize( std::max( 1, Devices::Host::getMaxThreadsCount() ) );
    }
 };
 
 template< typename Problem, typename SolverMonitor >
-void Merson< Problem, SolverMonitor >::configSetup( Config::ConfigDescription& config,
-                                                const String& prefix )
+void
+Merson< Problem, SolverMonitor >::configSetup( Config::ConfigDescription& config, const String& prefix )
 {
-   //ExplicitSolver< Problem >::configSetup( config, prefix );
-   config.addEntry< double >( prefix + "merson-adaptivity", "Time step adaptivity controlling coefficient (the smaller the more precise the computation is, zero means no adaptivity).", 1.0e-4 );
+   // ExplicitSolver< Problem >::configSetup( config, prefix );
+   config.addEntry< double >( prefix + "merson-adaptivity",
+                              "Time step adaptivity controlling coefficient (the smaller the more precise the computation is, "
+                              "zero means no adaptivity).",
+                              1.0e-4 );
 };
 
 template< typename Problem, typename SolverMonitor >
-bool Merson< Problem, SolverMonitor >::setup( const Config::ParameterContainer& parameters,
-                                         const String& prefix )
+bool
+Merson< Problem, SolverMonitor >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    ExplicitSolver< Problem, SolverMonitor >::setup( parameters, prefix );
    if( parameters.checkParameter( prefix + "merson-adaptivity" ) )
@@ -54,21 +55,21 @@ bool Merson< Problem, SolverMonitor >::setup( const Config::ParameterContainer&
 }
 
 template< typename Problem, typename SolverMonitor >
-void Merson< Problem, SolverMonitor >::setAdaptivity( const RealType& a )
+void
+Merson< Problem, SolverMonitor >::setAdaptivity( const RealType& a )
 {
    this->adaptivity = a;
 };
 
 template< typename Problem, typename SolverMonitor >
-bool Merson< Problem, SolverMonitor >::solve( DofVectorPointer& _u )
+bool
+Merson< Problem, SolverMonitor >::solve( DofVectorPointer& _u )
 {
-   if( ! this->problem )
-   {
+   if( ! this->problem ) {
       std::cerr << "No problem was set for the Merson ODE solver." << std::endl;
       return false;
    }
-   if( this->getTau() == 0.0 )
-   {
+   if( this->getTau() == 0.0 ) {
       std::cerr << "The time step for the Merson ODE solver is zero." << std::endl;
       return false;
    }
@@ -100,14 +101,14 @@ bool Merson< Problem, SolverMonitor >::solve( DofVectorPointer& _u )
    RealType currentTau = min( this->getTau(), this->getMaxTau() );
    if( time + currentTau > this->getStopTime() )
       currentTau = this->getStopTime() - time;
-   if( currentTau == 0.0 ) return true;
+   if( currentTau == 0.0 )
+      return true;
    this->resetIterations();
    this->setResidue( this->getConvergenceResidue() + 1.0 );
 
    /////
    // Start the main loop
-   while( this->checkNextIteration() )
-   {
+   while( this->checkNextIteration() ) {
       /////
       // Compute Runge-Kutta coefficients
       RealType tau_3 = currentTau / 3.0;
@@ -146,25 +147,23 @@ bool Merson< Problem, SolverMonitor >::solve( DofVectorPointer& _u )
       /////
       // Compute an error of the approximation.
       RealType error( 0.0 );
-      if( adaptivity != 0.0 )
-      {
-         const RealType localError =
-            max( currentTau / 3.0 * abs( 0.2 * k1 -0.9 * k3 + 0.8 * k4 -0.1 * k5 ) );
-            MPI::Allreduce( &localError, &error, 1, MPI_MAX, MPI_COMM_WORLD );
+      if( adaptivity != 0.0 ) {
+         const RealType localError = max( currentTau / 3.0 * abs( 0.2 * k1 - 0.9 * k3 + 0.8 * k4 - 0.1 * k5 ) );
+         MPI::Allreduce( &localError, &error, 1, MPI_MAX, MPI_COMM_WORLD );
       }
 
-      if( adaptivity == 0.0 || error < adaptivity )
-      {
+      if( adaptivity == 0.0 || error < adaptivity ) {
          RealType lastResidue = this->getResidue();
          time += currentTau;
 
-         this->setResidue( addAndReduceAbs( u, currentTau / 6.0 * ( k1 + 4.0 * k4 + k5 ),
-            std::plus<>{}, ( RealType ) 0.0 ) / ( currentTau * ( RealType ) u.getSize() ) );
+         this->setResidue( addAndReduceAbs( u, currentTau / 6.0 * ( k1 + 4.0 * k4 + k5 ), std::plus<>{}, (RealType) 0.0 )
+                           / ( currentTau * (RealType) u.getSize() ) );
 
          /////
          // When time is close to stopTime the new residue
          // may be inaccurate significantly.
-         if( abs( time - this->stopTime ) < 1.0e-7 ) this->setResidue( lastResidue );
+         if( abs( time - this->stopTime ) < 1.0e-7 )
+            this->setResidue( lastResidue );
 
          if( ! this->nextIteration() )
             return false;
@@ -172,8 +171,7 @@ bool Merson< Problem, SolverMonitor >::solve( DofVectorPointer& _u )
 
       /////
       // Compute the new time step.
-      if( adaptivity != 0.0 && error != 0.0 )
-      {
+      if( adaptivity != 0.0 && error != 0.0 ) {
          currentTau *= 0.8 * ::pow( adaptivity / error, 0.2 );
          currentTau = min( currentTau, this->getMaxTau() );
 #ifdef USE_MPI
@@ -181,20 +179,22 @@ bool Merson< Problem, SolverMonitor >::solve( DofVectorPointer& _u )
 #endif
       }
       if( time + currentTau > this->getStopTime() )
-         currentTau = this->getStopTime() - time; //we don't want to keep such tau
-      else this->tau = currentTau;
+         currentTau = this->getStopTime() - time;  // we don't want to keep such tau
+      else
+         this->tau = currentTau;
 
       /////
       // Check stop conditions.
-      if( time >= this->getStopTime() ||
-          ( this->getConvergenceResidue() != 0.0 && this->getResidue() < this->getConvergenceResidue() ) )
+      if( time >= this->getStopTime()
+          || ( this->getConvergenceResidue() != 0.0 && this->getResidue() < this->getConvergenceResidue() ) )
          return true;
    }
    return this->checkConvergence();
 };
 
 template< typename Problem, typename SolverMonitor >
-void Merson< Problem, SolverMonitor >::writeGrids( const DofVectorPointer& u )
+void
+Merson< Problem, SolverMonitor >::writeGrids( const DofVectorPointer& u )
 {
    std::cout << "Writing Merson solver grids ...";
    File( "Merson-u.tnl", std::ios_base::out ) << *u;
@@ -207,6 +207,6 @@ void Merson< Problem, SolverMonitor >::writeGrids( const DofVectorPointer& u )
    getchar();
 }
 
-} // namespace ODE
-} // namespace Solvers
-} // namespace TNL
+}  // namespace ODE
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/PDE/BackwardTimeDiscretisation.h b/src/TNL/Solvers/PDE/BackwardTimeDiscretisation.h
index 61e9e89ff4c8bd6416bae84321baf47ecb96118a..f4f0be1adf499748053f89aba793e731fbdc3772 100644
--- a/src/TNL/Solvers/PDE/BackwardTimeDiscretisation.h
+++ b/src/TNL/Solvers/PDE/BackwardTimeDiscretisation.h
@@ -4,35 +4,32 @@
 //
 // SPDX-License-Identifier: MIT
 
-
 #pragma once
 
 #include <TNL/Devices/Cuda.h>
 
 namespace TNL {
 namespace Solvers {
-namespace PDE {   
+namespace PDE {
 
 class BackwardTimeDiscretisation
 {
-    public:
- 
-        template< typename RealType,
-                  typename IndexType,
-                  typename MatrixType >
-        __cuda_callable__ static void applyTimeDiscretisation( MatrixType& matrix,
-                                                               RealType& b,
-                                                               const IndexType index,
-                                                               const RealType& u,
-                                                               const RealType& tau,
-                                                               const RealType& rhs )
-        {
-            b += u + tau * rhs;
-            matrix.addElement( index, index, 1.0, 1.0 );
-        }
+public:
+   template< typename RealType, typename IndexType, typename MatrixType >
+   __cuda_callable__
+   static void
+   applyTimeDiscretisation( MatrixType& matrix,
+                            RealType& b,
+                            const IndexType index,
+                            const RealType& u,
+                            const RealType& tau,
+                            const RealType& rhs )
+   {
+      b += u + tau * rhs;
+      matrix.addElement( index, index, 1.0, 1.0 );
+   }
 };
 
-} // namespace PDE
-} // namespace Solvers
-} // namespace TNL
-
+}  // namespace PDE
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/PDE/BoundaryConditionsSetter.h b/src/TNL/Solvers/PDE/BoundaryConditionsSetter.h
index fcd7e7c978c9619982a04984d7de3ad6a5a385d2..3e80927d24012363cc839f209cec249fd5ada09a 100644
--- a/src/TNL/Solvers/PDE/BoundaryConditionsSetter.h
+++ b/src/TNL/Solvers/PDE/BoundaryConditionsSetter.h
@@ -4,7 +4,6 @@
 //
 // SPDX-License-Identifier: MIT
 
-
 #pragma once
 
 #include <TNL/Cuda/CudaCallable.h>
@@ -16,85 +15,57 @@ namespace TNL {
 namespace Solvers {
 namespace PDE {
 
-template< typename Real,
-          typename DofVector,
-          typename BoundaryConditions >
+template< typename Real, typename DofVector, typename BoundaryConditions >
 class BoundaryConditionsSetterTraverserUserData
 {
-   public:
-
-      const Real time;
+public:
+   const Real time;
 
-      const BoundaryConditions* boundaryConditions;
+   const BoundaryConditions* boundaryConditions;
 
-      DofVector *u;
+   DofVector* u;
 
-      BoundaryConditionsSetterTraverserUserData(
-         const Real& time,
-         const BoundaryConditions* boundaryConditions,
-         DofVector* u )
-      : time( time ),
-        boundaryConditions( boundaryConditions ),
-        u( u )
-      {};
+   BoundaryConditionsSetterTraverserUserData( const Real& time, const BoundaryConditions* boundaryConditions, DofVector* u )
+   : time( time ), boundaryConditions( boundaryConditions ), u( u ){};
 };
 
-
-template< typename MeshFunction,
-          typename BoundaryConditions >
+template< typename MeshFunction, typename BoundaryConditions >
 class BoundaryConditionsSetter
 {
+public:
+   typedef typename MeshFunction::MeshType MeshType;
+   typedef typename MeshFunction::RealType RealType;
+   typedef typename MeshFunction::DeviceType DeviceType;
+   typedef typename MeshFunction::IndexType IndexType;
+   typedef BoundaryConditionsSetterTraverserUserData< RealType, MeshFunction, BoundaryConditions > TraverserUserData;
+   typedef Pointers::SharedPointer< MeshType, DeviceType > MeshPointer;
+   typedef Pointers::SharedPointer< BoundaryConditions, DeviceType > BoundaryConditionsPointer;
+   typedef Pointers::SharedPointer< MeshFunction, DeviceType > MeshFunctionPointer;
+
+   template< typename EntityType = typename MeshType::Cell >
+   static void
+   apply( const BoundaryConditionsPointer& boundaryConditions, const RealType& time, MeshFunctionPointer& u )
+   {
+      Pointers::SharedPointer< TraverserUserData, DeviceType > userData(
+         time, &boundaryConditions.template getData< DeviceType >(), &u.template modifyData< DeviceType >() );
+      Meshes::Traverser< MeshType, EntityType > meshTraverser;
+      meshTraverser.template processBoundaryEntities< TraverserUserData, TraverserBoundaryEntitiesProcessor >(
+         u->getMeshPointer(), userData );
+   }
+
+   class TraverserBoundaryEntitiesProcessor
+   {
    public:
-      typedef typename MeshFunction::MeshType MeshType;
-      typedef typename MeshFunction::RealType RealType;
-      typedef typename MeshFunction::DeviceType DeviceType;
-      typedef typename MeshFunction::IndexType IndexType;
-      typedef BoundaryConditionsSetterTraverserUserData<
-         RealType,
-         MeshFunction,
-         BoundaryConditions > TraverserUserData;
-      typedef Pointers::SharedPointer<  MeshType, DeviceType > MeshPointer;
-      typedef Pointers::SharedPointer<  BoundaryConditions, DeviceType > BoundaryConditionsPointer;
-      typedef Pointers::SharedPointer<  MeshFunction, DeviceType > MeshFunctionPointer;
-
-      template< typename EntityType = typename MeshType::Cell >
-      static void apply( const BoundaryConditionsPointer& boundaryConditions,
-                         const RealType& time,
-                         MeshFunctionPointer& u )
+      template< typename GridEntity >
+      __cuda_callable__
+      static inline void
+      processEntity( const MeshType& mesh, TraverserUserData& userData, const GridEntity& entity )
       {
-         Pointers::SharedPointer<  TraverserUserData, DeviceType >
-            userData( time,
-                      &boundaryConditions.template getData< DeviceType >(),
-                      &u.template modifyData< DeviceType >() );
-         Meshes::Traverser< MeshType, EntityType > meshTraverser;
-         meshTraverser.template processBoundaryEntities< TraverserUserData,
-                                                         TraverserBoundaryEntitiesProcessor >
-                                                       ( u->getMeshPointer(),
-                                                         userData );
+         ( *userData.u )( entity ) = userData.boundaryConditions->operator()( *userData.u, entity, userData.time );
       }
-
- 
-      class TraverserBoundaryEntitiesProcessor
-      {
-         public:
- 
-            template< typename GridEntity >
-            __cuda_callable__
-            static inline void processEntity( const MeshType& mesh,
-                                              TraverserUserData& userData,
-                                              const GridEntity& entity )
-            {
-               ( *userData.u )( entity ) = userData.boundaryConditions->operator()
-               ( *userData.u,
-                 entity,
-                 userData.time );
-            }
-
-      };
+   };
 };
 
-} // namespace PDE
-} // namespace Solvers
-} // namespace TNL
-
-
+}  // namespace PDE
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/PDE/ExplicitTimeStepper.h b/src/TNL/Solvers/PDE/ExplicitTimeStepper.h
index b8ab8dd58431993b4b7545d1b437cb45ef919854..0ea7e09e1f0c2dd30a39cd85c708b4cb2cdbdbb5 100644
--- a/src/TNL/Solvers/PDE/ExplicitTimeStepper.h
+++ b/src/TNL/Solvers/PDE/ExplicitTimeStepper.h
@@ -17,78 +17,80 @@ namespace TNL {
 namespace Solvers {
 namespace PDE {
 
-template< typename Problem,
-          template < typename OdeProblem, typename SolverMonitor > class OdeSolver >
+template< typename Problem, template< typename OdeProblem, typename SolverMonitor > class OdeSolver >
 class ExplicitTimeStepper
 {
-   public:
+public:
+   using ProblemType = Problem;
+   using RealType = typename Problem::RealType;
+   using DeviceType = typename Problem::DeviceType;
+   using IndexType = typename Problem::IndexType;
+   using MeshType = typename Problem::MeshType;
+   using DofVectorType = typename ProblemType::DofVectorType;
+   using DofVectorPointer = Pointers::SharedPointer< DofVectorType, DeviceType >;
+   using SolverMonitorType = IterativeSolverMonitor< RealType, IndexType >;
+   using OdeSolverType = OdeSolver< ExplicitTimeStepper< Problem, OdeSolver >, SolverMonitorType >;
+   using OdeSolverPointer = Pointers::SharedPointer< OdeSolverType, DeviceType >;
 
-      using ProblemType = Problem;
-      using RealType = typename Problem::RealType;
-      using DeviceType = typename Problem::DeviceType;
-      using IndexType = typename Problem::IndexType;
-      using MeshType = typename Problem::MeshType;
-      using DofVectorType = typename ProblemType::DofVectorType;
-      using DofVectorPointer = Pointers::SharedPointer< DofVectorType, DeviceType >;
-      using SolverMonitorType = IterativeSolverMonitor< RealType, IndexType >;
-      using OdeSolverType = OdeSolver< ExplicitTimeStepper< Problem, OdeSolver >, SolverMonitorType >;
-      using OdeSolverPointer = Pointers::SharedPointer< OdeSolverType, DeviceType >;
+   static_assert( ProblemType::isTimeDependent(), "The problem is not time dependent." );
 
-      static_assert( ProblemType::isTimeDependent(), "The problem is not time dependent." );
+   ExplicitTimeStepper();
 
-      ExplicitTimeStepper();
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" );
 
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" );
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-      bool setup( const Config::ParameterContainer& parameters,
-                 const String& prefix = "" );
+   bool
+   init( const MeshType& mesh );
 
-      bool init( const MeshType& mesh );
+   void
+   setSolver( OdeSolverType& odeSolver );
 
-      void setSolver( OdeSolverType& odeSolver );
+   void
+   setSolverMonitor( SolverMonitorType& solverMonitor );
 
-      void setSolverMonitor( SolverMonitorType& solverMonitor );
+   void
+   setProblem( ProblemType& problem );
 
-      void setProblem( ProblemType& problem );
+   ProblemType*
+   getProblem() const;
 
-      ProblemType* getProblem() const;
+   bool
+   setTimeStep( const RealType& tau );
 
-      bool setTimeStep( const RealType& tau );
+   bool
+   solve( const RealType& time, const RealType& stopTime, DofVectorPointer& dofVector );
 
-      bool solve( const RealType& time,
-                   const RealType& stopTime,
-                   DofVectorPointer& dofVector );
+   const RealType&
+   getTimeStep() const;
 
-      const RealType& getTimeStep() const;
+   void
+   getExplicitUpdate( const RealType& time, const RealType& tau, DofVectorPointer& _u, DofVectorPointer& _fu );
 
-      void getExplicitUpdate( const RealType& time,
-                           const RealType& tau,
-                           DofVectorPointer& _u,
-                           DofVectorPointer& _fu );
+   void
+   applyBoundaryConditions( const RealType& time, DofVectorPointer& _u );
 
-      void applyBoundaryConditions( const RealType& time,
-                                 DofVectorPointer& _u );
+   bool
+   writeEpilog( Logger& logger ) const;
 
-      bool writeEpilog( Logger& logger ) const;
+protected:
+   OdeSolverPointer odeSolver;
 
-   protected:
+   SolverMonitorType* solverMonitor;
 
-      OdeSolverPointer odeSolver;
+   Problem* problem;
 
-      SolverMonitorType* solverMonitor;
+   RealType timeStep;
 
-      Problem* problem;
+   Timer preIterateTimer, explicitUpdaterTimer, mainTimer, postIterateTimer;
 
-      RealType timeStep;
-
-      Timer preIterateTimer, explicitUpdaterTimer, mainTimer, postIterateTimer;
-
-      long long int allIterations;
+   long long int allIterations;
 };
 
-} // namespace PDE
-} // namespace Solvers
-} // namespace TNL
+}  // namespace PDE
+}  // namespace Solvers
+}  // namespace TNL
 
 #include <TNL/Solvers/PDE/ExplicitTimeStepper.hpp>
diff --git a/src/TNL/Solvers/PDE/ExplicitTimeStepper.hpp b/src/TNL/Solvers/PDE/ExplicitTimeStepper.hpp
index 73acc8c3bae04b861a5fec2c24823a8e4d332926..ee5544d487cfbc528a67c4135db69a7d959cf11e 100644
--- a/src/TNL/Solvers/PDE/ExplicitTimeStepper.hpp
+++ b/src/TNL/Solvers/PDE/ExplicitTimeStepper.hpp
@@ -12,40 +12,25 @@ namespace TNL {
 namespace Solvers {
 namespace PDE {
 
-template< typename Problem,
-          template < typename OdeProblem, typename SolverMonitor > class OdeSolver >
-ExplicitTimeStepper< Problem, OdeSolver >::
-ExplicitTimeStepper()
-: problem( 0 ),
-  timeStep( 0 ),
-  allIterations( 0 )
-{
-}
+template< typename Problem, template< typename OdeProblem, typename SolverMonitor > class OdeSolver >
+ExplicitTimeStepper< Problem, OdeSolver >::ExplicitTimeStepper() : problem( 0 ), timeStep( 0 ), allIterations( 0 )
+{}
 
-template< typename Problem,
-          template < typename OdeProblem, typename SolverMonitor > class OdeSolver >
+template< typename Problem, template< typename OdeProblem, typename SolverMonitor > class OdeSolver >
 void
-ExplicitTimeStepper< Problem, OdeSolver >::
-configSetup( Config::ConfigDescription& config,
-             const String& prefix )
-{
-}
+ExplicitTimeStepper< Problem, OdeSolver >::configSetup( Config::ConfigDescription& config, const String& prefix )
+{}
 
-template< typename Problem,
-          template < typename OdeProblem, typename SolverMonitor > class OdeSolver >
+template< typename Problem, template< typename OdeProblem, typename SolverMonitor > class OdeSolver >
 bool
-ExplicitTimeStepper< Problem, OdeSolver >::
-setup( const Config::ParameterContainer& parameters,
-       const String& prefix )
+ExplicitTimeStepper< Problem, OdeSolver >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    return this->odeSolver->setup( parameters, prefix );
 }
 
-template< typename Problem,
-          template < typename OdeProblem, typename SolverMonitor > class OdeSolver >
+template< typename Problem, template< typename OdeProblem, typename SolverMonitor > class OdeSolver >
 bool
-ExplicitTimeStepper< Problem, OdeSolver >::
-init( const MeshType& mesh )
+ExplicitTimeStepper< Problem, OdeSolver >::init( const MeshType& mesh )
 {
    this->explicitUpdaterTimer.reset();
    this->mainTimer.reset();
@@ -54,52 +39,42 @@ init( const MeshType& mesh )
    return true;
 }
 
-template< typename Problem,
-          template < typename OdeProblem, typename SolverMonitor > class OdeSolver >
+template< typename Problem, template< typename OdeProblem, typename SolverMonitor > class OdeSolver >
 void
-ExplicitTimeStepper< Problem, OdeSolver >::
-setSolver( typename ExplicitTimeStepper< Problem, OdeSolver >::OdeSolverType& odeSolver )
+ExplicitTimeStepper< Problem, OdeSolver >::setSolver(
+   typename ExplicitTimeStepper< Problem, OdeSolver >::OdeSolverType& odeSolver )
 {
    this->odeSolver = &odeSolver;
 };
 
-template< typename Problem,
-          template < typename OdeProblem, typename SolverMonitor > class OdeSolver >
+template< typename Problem, template< typename OdeProblem, typename SolverMonitor > class OdeSolver >
 void
-ExplicitTimeStepper< Problem, OdeSolver >::
-setProblem( ProblemType& problem )
+ExplicitTimeStepper< Problem, OdeSolver >::setProblem( ProblemType& problem )
 {
    this->problem = &problem;
 };
 
-template< typename Problem,
-          template < typename OdeProblem, typename SolverMonitor > class OdeSolver >
+template< typename Problem, template< typename OdeProblem, typename SolverMonitor > class OdeSolver >
 void
-ExplicitTimeStepper< Problem, OdeSolver >::
-setSolverMonitor( SolverMonitorType& solverMonitor )
+ExplicitTimeStepper< Problem, OdeSolver >::setSolverMonitor( SolverMonitorType& solverMonitor )
 {
    this->solverMonitor = &solverMonitor;
    if( this->odeSolver )
       this->odeSolver->setSolverMonitor( solverMonitor );
 }
 
-template< typename Problem,
-          template < typename OdeProblem, typename SolverMonitor > class OdeSolver >
+template< typename Problem, template< typename OdeProblem, typename SolverMonitor > class OdeSolver >
 Problem*
-ExplicitTimeStepper< Problem, OdeSolver >::
-getProblem() const
+ExplicitTimeStepper< Problem, OdeSolver >::getProblem() const
 {
-    return this->problem;
+   return this->problem;
 };
 
-template< typename Problem,
-          template < typename OdeProblem, typename SolverMonitor > class OdeSolver >
+template< typename Problem, template< typename OdeProblem, typename SolverMonitor > class OdeSolver >
 bool
-ExplicitTimeStepper< Problem, OdeSolver >::
-setTimeStep( const RealType& timeStep )
+ExplicitTimeStepper< Problem, OdeSolver >::setTimeStep( const RealType& timeStep )
 {
-   if( timeStep <= 0.0 )
-   {
+   if( timeStep <= 0.0 ) {
       std::cerr << "Tau for ExplicitTimeStepper must be positive. " << std::endl;
       return false;
    }
@@ -107,38 +82,33 @@ setTimeStep( const RealType& timeStep )
    return true;
 };
 
-template< typename Problem,
-          template < typename OdeProblem, typename SolverMonitor > class OdeSolver >
+template< typename Problem, template< typename OdeProblem, typename SolverMonitor > class OdeSolver >
 bool
-ExplicitTimeStepper< Problem, OdeSolver >::
-solve( const RealType& time,
-       const RealType& stopTime,
-       DofVectorPointer& dofVector )
+ExplicitTimeStepper< Problem, OdeSolver >::solve( const RealType& time, const RealType& stopTime, DofVectorPointer& dofVector )
 {
    TNL_ASSERT_TRUE( this->odeSolver, "ODE solver was not set" );
    mainTimer.start();
    this->odeSolver->setTau( this->timeStep );
-   this->odeSolver->setProblem( * this );
+   this->odeSolver->setProblem( *this );
    this->odeSolver->setTime( time );
    this->odeSolver->setStopTime( stopTime );
    if( this->odeSolver->getMinIterations() )
-      this->odeSolver->setMaxTau( ( stopTime - time ) / ( typename OdeSolver< Problem, SolverMonitor >::RealType ) this->odeSolver->getMinIterations() );
+      this->odeSolver->setMaxTau(
+         ( stopTime - time ) / (typename OdeSolver< Problem, SolverMonitor >::RealType) this->odeSolver->getMinIterations() );
    if( ! this->odeSolver->solve( dofVector ) )
       return false;
-   //this->problem->setExplicitBoundaryConditions( stopTime, dofVector );
+   // this->problem->setExplicitBoundaryConditions( stopTime, dofVector );
    mainTimer.stop();
    this->allIterations += this->odeSolver->getIterations();
    return true;
 }
 
-template< typename Problem,
-          template < typename OdeProblem, typename SolverMonitor > class OdeSolver >
+template< typename Problem, template< typename OdeProblem, typename SolverMonitor > class OdeSolver >
 void
-ExplicitTimeStepper< Problem, OdeSolver >::
-getExplicitUpdate( const RealType& time,
-                const RealType& tau,
-                DofVectorPointer& u,
-                DofVectorPointer& fu )
+ExplicitTimeStepper< Problem, OdeSolver >::getExplicitUpdate( const RealType& time,
+                                                              const RealType& tau,
+                                                              DofVectorPointer& u,
+                                                              DofVectorPointer& fu )
 {
    if( this->solverMonitor ) {
       this->solverMonitor->setTime( time );
@@ -146,11 +116,10 @@ getExplicitUpdate( const RealType& time,
    }
 
    this->preIterateTimer.start();
-   if( ! this->problem->preIterate( time, tau, u ) )
-   {
+   if( ! this->problem->preIterate( time, tau, u ) ) {
       std::cerr << std::endl << "Preiteration failed." << std::endl;
       return;
-      //return false; // TODO: throw exception
+      // return false; // TODO: throw exception
    }
    this->preIterateTimer.stop();
 
@@ -166,31 +135,24 @@ getExplicitUpdate( const RealType& time,
       this->solverMonitor->setStage( "Postiteration" );
 
    this->postIterateTimer.start();
-   if( ! this->problem->postIterate( time, tau, u ) )
-   {
+   if( ! this->problem->postIterate( time, tau, u ) ) {
       std::cerr << std::endl << "Postiteration failed." << std::endl;
       return;
-      //return false; // TODO: throw exception
+      // return false; // TODO: throw exception
    }
    this->postIterateTimer.stop();
 }
 
-template< typename Problem,
-          template < typename OdeProblem, typename SolverMonitor > class OdeSolver >
+template< typename Problem, template< typename OdeProblem, typename SolverMonitor > class OdeSolver >
 void
-ExplicitTimeStepper< Problem, OdeSolver >::
-applyBoundaryConditions( const RealType& time,
-                            DofVectorPointer& u )
+ExplicitTimeStepper< Problem, OdeSolver >::applyBoundaryConditions( const RealType& time, DofVectorPointer& u )
 {
    this->problem->applyBoundaryConditions( time, u );
 }
 
-
-template< typename Problem,
-          template < typename OdeProblem, typename SolverMonitor > class OdeSolver >
+template< typename Problem, template< typename OdeProblem, typename SolverMonitor > class OdeSolver >
 bool
-ExplicitTimeStepper< Problem, OdeSolver >::
-writeEpilog( Logger& logger ) const
+ExplicitTimeStepper< Problem, OdeSolver >::writeEpilog( Logger& logger ) const
 {
    logger.writeParameter< long long int >( "Iterations count:", this->allIterations );
    logger.writeParameter< const char* >( "Pre-iterate time:", "" );
@@ -204,6 +166,6 @@ writeEpilog( Logger& logger ) const
    return true;
 }
 
-} // namespace PDE
-} // namespace Solvers
-} // namespace TNL
+}  // namespace PDE
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/PDE/ExplicitUpdater.h b/src/TNL/Solvers/PDE/ExplicitUpdater.h
index 98a53571fa1ddb04e9b64f8e63368690904eab85..3df67401e3e9401199c517876487d12868dc4381 100644
--- a/src/TNL/Solvers/PDE/ExplicitUpdater.h
+++ b/src/TNL/Solvers/PDE/ExplicitUpdater.h
@@ -25,45 +25,37 @@ template< typename Real,
           typename RightHandSide >
 class ExplicitUpdaterTraverserUserData
 {
-   public:
-
-      Real time;
-
-      const DifferentialOperator* differentialOperator;
-
-      const BoundaryConditions* boundaryConditions;
-
-      const RightHandSide* rightHandSide;
-
-      MeshFunction *u, *fu;
-
-      ExplicitUpdaterTraverserUserData()
-      : time( 0.0 ),
-        differentialOperator( NULL ),
-        boundaryConditions( NULL ),
-        rightHandSide( NULL ),
-        u( NULL ),
-        fu( NULL )
-      {}
-
-
-      /*void setUserData( const Real& time,
-                        const DifferentialOperator* differentialOperator,
-                        const BoundaryConditions* boundaryConditions,
-                        const RightHandSide* rightHandSide,
-                        MeshFunction* u,
-                        MeshFunction* fu )
-      {
-         this->time = time;
-         this->differentialOperator = differentialOperator;
-         this->boundaryConditions = boundaryConditions;
-         this->rightHandSide = rightHandSide;
-         this->u = u;
-         this->fu = fu;
-      }*/
+public:
+   Real time;
+
+   const DifferentialOperator* differentialOperator;
+
+   const BoundaryConditions* boundaryConditions;
+
+   const RightHandSide* rightHandSide;
+
+   MeshFunction *u, *fu;
+
+   ExplicitUpdaterTraverserUserData()
+   : time( 0.0 ), differentialOperator( NULL ), boundaryConditions( NULL ), rightHandSide( NULL ), u( NULL ), fu( NULL )
+   {}
+
+   /*void setUserData( const Real& time,
+                     const DifferentialOperator* differentialOperator,
+                     const BoundaryConditions* boundaryConditions,
+                     const RightHandSide* rightHandSide,
+                     MeshFunction* u,
+                     MeshFunction* fu )
+   {
+      this->time = time;
+      this->differentialOperator = differentialOperator;
+      this->boundaryConditions = boundaryConditions;
+      this->rightHandSide = rightHandSide;
+      this->u = u;
+      this->fu = fu;
+   }*/
 };
 
-
 template< typename Mesh,
           typename MeshFunction,
           typename DifferentialOperator,
@@ -71,138 +63,126 @@ template< typename Mesh,
           typename RightHandSide >
 class ExplicitUpdater
 {
+public:
+   using MeshType = Mesh;
+   using MeshPointer = Pointers::SharedPointer< MeshType >;
+   using RealType = typename MeshFunction::RealType;
+   using DeviceType = typename MeshFunction::DeviceType;
+   using IndexType = typename MeshFunction::IndexType;
+   using TraverserUserData =
+      ExplicitUpdaterTraverserUserData< RealType, MeshFunction, DifferentialOperator, BoundaryConditions, RightHandSide >;
+   using DifferentialOperatorPointer = Pointers::SharedPointer< DifferentialOperator, DeviceType >;
+   using BoundaryConditionsPointer = Pointers::SharedPointer< BoundaryConditions, DeviceType >;
+   using RightHandSidePointer = Pointers::SharedPointer< RightHandSide, DeviceType >;
+   using MeshFunctionPointer = Pointers::SharedPointer< MeshFunction, DeviceType >;
+   using TraverserUserDataPointer = Pointers::SharedPointer< TraverserUserData, DeviceType >;
+
+   void
+   setDifferentialOperator( const DifferentialOperatorPointer& differentialOperatorPointer )
+   {
+      this->userData.differentialOperator = &differentialOperatorPointer.template getData< DeviceType >();
+   }
+
+   void
+   setBoundaryConditions( const BoundaryConditionsPointer& boundaryConditionsPointer )
+   {
+      this->userData.boundaryConditions = &boundaryConditionsPointer.template getData< DeviceType >();
+   }
+
+   void
+   setRightHandSide( const RightHandSidePointer& rightHandSidePointer )
+   {
+      this->userData.rightHandSide = &rightHandSidePointer.template getData< DeviceType >();
+   }
+
+   template< typename EntityType >
+   void
+   update( const RealType& time,
+           const RealType& tau,
+           const MeshPointer& meshPointer,
+           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." );
+      TNL_ASSERT_GT( uPointer->getData().getSize(), 0, "The first MeshFunction in the parameters was not bound." );
+      TNL_ASSERT_GT( fuPointer->getData().getSize(), 0, "The second MeshFunction in the parameters was not bound." );
+
+      TNL_ASSERT_EQ( uPointer->getData().getSize(),
+                     meshPointer->template getEntitiesCount< EntityType >(),
+                     "The first MeshFunction in the parameters was not bound properly." );
+      TNL_ASSERT_EQ( fuPointer->getData().getSize(),
+                     meshPointer->template getEntitiesCount< EntityType >(),
+                     "The second MeshFunction in the parameters was not bound properly." );
+
+      TNL_ASSERT_TRUE( this->userData.differentialOperator,
+                       "The differential operator is not correctly set-up. Use method setDifferentialOperator() to do it." );
+      TNL_ASSERT_TRUE( this->userData.rightHandSide,
+                       "The right-hand side is not correctly set-up. Use method setRightHandSide() to do it." );
+
+      this->userData.time = time;
+      this->userData.u = &uPointer.template modifyData< DeviceType >();
+      this->userData.fu = &fuPointer.template modifyData< DeviceType >();
+      Meshes::Traverser< MeshType, EntityType > meshTraverser;
+      meshTraverser.template processInteriorEntities< TraverserInteriorEntitiesProcessor >( meshPointer, userData );
+   }
+
+   template< typename EntityType >
+   void
+   applyBoundaryConditions( const MeshPointer& meshPointer, const RealType& time, MeshFunctionPointer& uPointer )
+   {
+      TNL_ASSERT_TRUE( this->userData.boundaryConditions,
+                       "The boundary conditions are not correctly set-up. Use method setBoundaryCondtions() to do it." );
+      TNL_ASSERT_TRUE( &uPointer.template modifyData< DeviceType >(),
+                       "The function u is not correctly set-up. It was not bound probably with DOFs." );
+
+      this->userData.time = time;
+      this->userData.u = &uPointer.template modifyData< DeviceType >();
+      Meshes::Traverser< MeshType, EntityType > meshTraverser;
+      meshTraverser.template processBoundaryEntities< TraverserBoundaryEntitiesProcessor >( meshPointer, userData );
+
+      // TODO: I think that this is not necessary
+      /*if( MPI::GetSize() > 1 )
+         fuPointer->template synchronize();*/
+   }
+
+   class TraverserBoundaryEntitiesProcessor
+   {
    public:
-      typedef Mesh MeshType;
-      typedef Pointers::SharedPointer<  MeshType > MeshPointer;
-      typedef typename MeshFunction::RealType RealType;
-      typedef typename MeshFunction::DeviceType DeviceType;
-      typedef typename MeshFunction::IndexType IndexType;
-      typedef ExplicitUpdaterTraverserUserData< RealType,
-                                                MeshFunction,
-                                                DifferentialOperator,
-                                                BoundaryConditions,
-                                                RightHandSide > TraverserUserData;
-      typedef Pointers::SharedPointer<  DifferentialOperator, DeviceType > DifferentialOperatorPointer;
-      typedef Pointers::SharedPointer<  BoundaryConditions, DeviceType > BoundaryConditionsPointer;
-      typedef Pointers::SharedPointer<  RightHandSide, DeviceType > RightHandSidePointer;
-      typedef Pointers::SharedPointer<  MeshFunction, DeviceType > MeshFunctionPointer;
-      typedef Pointers::SharedPointer<  TraverserUserData, DeviceType > TraverserUserDataPointer;
-
-      void setDifferentialOperator( const DifferentialOperatorPointer& differentialOperatorPointer )
-      {
-         this->userData.differentialOperator = &differentialOperatorPointer.template getData< DeviceType >();
-      }
-
-      void setBoundaryConditions( const BoundaryConditionsPointer& boundaryConditionsPointer )
-      {
-         this->userData.boundaryConditions = &boundaryConditionsPointer.template getData< DeviceType >();
-      }
-
-      void setRightHandSide( const RightHandSidePointer& rightHandSidePointer )
+      template< typename GridEntity >
+      __cuda_callable__
+      static inline void
+      processEntity( const MeshType& mesh, TraverserUserData& userData, const GridEntity& entity )
       {
-         this->userData.rightHandSide = &rightHandSidePointer.template getData< DeviceType >();
+         ( *userData.u )( entity ) = ( *userData.boundaryConditions )( *userData.u, entity, userData.time );
       }
+   };
 
-      template< typename EntityType >
-      void update( const RealType& time,
-                   const RealType& tau,
-                   const MeshPointer& meshPointer,
-                   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."  );
-         TNL_ASSERT_GT( uPointer->getData().getSize(), 0, "The first MeshFunction in the parameters was not bound." );
-         TNL_ASSERT_GT( fuPointer->getData().getSize(), 0, "The second MeshFunction in the parameters was not bound." );
-
-         TNL_ASSERT_EQ( uPointer->getData().getSize(), meshPointer->template getEntitiesCount< EntityType >(),
-                        "The first MeshFunction in the parameters was not bound properly." );
-         TNL_ASSERT_EQ( fuPointer->getData().getSize(), meshPointer->template getEntitiesCount< EntityType >(),
-                        "The second MeshFunction in the parameters was not bound properly." );
-
-         TNL_ASSERT_TRUE( this->userData.differentialOperator,
-                          "The differential operator is not correctly set-up. Use method setDifferentialOperator() to do it." );
-         TNL_ASSERT_TRUE( this->userData.rightHandSide,
-                          "The right-hand side is not correctly set-up. Use method setRightHandSide() to do it." );
-
-         this->userData.time = time;
-         this->userData.u = &uPointer.template modifyData< DeviceType >();
-         this->userData.fu = &fuPointer.template modifyData< DeviceType >();
-         Meshes::Traverser< MeshType, EntityType > meshTraverser;
-         meshTraverser.template processInteriorEntities< TraverserInteriorEntitiesProcessor >
-                                                       ( meshPointer,
-                                                         userData );
-      }
+   class TraverserInteriorEntitiesProcessor
+   {
+   public:
+      using PointType = typename MeshType::PointType;
 
       template< typename EntityType >
-      void applyBoundaryConditions( const MeshPointer& meshPointer,
-                                    const RealType& time,
-                                    MeshFunctionPointer& uPointer )
+      __cuda_callable__
+      static inline void
+      processEntity( const MeshType& mesh, TraverserUserData& userData, const EntityType& entity )
       {
-         TNL_ASSERT_TRUE( this->userData.boundaryConditions,
-                          "The boundary conditions are not correctly set-up. Use method setBoundaryCondtions() to do it." );
-         TNL_ASSERT_TRUE( &uPointer.template modifyData< DeviceType >(),
-                          "The function u is not correctly set-up. It was not bound probably with DOFs." );
-
-         this->userData.time = time;
-         this->userData.u = &uPointer.template modifyData< DeviceType >();
-         Meshes::Traverser< MeshType, EntityType > meshTraverser;
-         meshTraverser.template processBoundaryEntities< TraverserBoundaryEntitiesProcessor >
-                                           ( meshPointer,
-                                             userData );
-
-         // TODO: I think that this is not necessary
-         /*if( MPI::GetSize() > 1 )
-            fuPointer->template synchronize();*/
-
+         using FunctionAdapter = Functions::FunctionAdapter< MeshType, RightHandSide >;
+         ( *userData.fu )( entity ) = ( *userData.differentialOperator )( *userData.u, entity, userData.time )
+                                    + FunctionAdapter::getValue( *userData.rightHandSide, entity, userData.time );
       }
+   };
 
-      class TraverserBoundaryEntitiesProcessor
-      {
-         public:
-
-            template< typename GridEntity >
-            __cuda_callable__
-            static inline void processEntity( const MeshType& mesh,
-                                              TraverserUserData& userData,
-                                              const GridEntity& entity )
-            {
-               ( *userData.u )( entity ) = ( *userData.boundaryConditions )
-                  ( *userData.u, entity, userData.time );
-            }
-
-      };
-
-      class TraverserInteriorEntitiesProcessor
-      {
-         public:
-
-            typedef typename MeshType::PointType PointType;
-
-            template< typename EntityType >
-            __cuda_callable__
-            static inline void processEntity( const MeshType& mesh,
-                                              TraverserUserData& userData,
-                                              const EntityType& entity )
-            {
-               typedef Functions::FunctionAdapter< MeshType, RightHandSide > FunctionAdapter;
-               ( *userData.fu )( entity ) =
-                  ( *userData.differentialOperator )( *userData.u, entity, userData.time )
-                  + FunctionAdapter::getValue( *userData.rightHandSide, entity, userData.time );
-
-            }
-      };
-
-   protected:
-
-      TraverserUserData userData;
-
+protected:
+   TraverserUserData userData;
 };
 
-} // namespace PDE
-} // namespace Solvers
-} // namespace TNL
-
+}  // namespace PDE
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/PDE/LinearSystemAssembler.h b/src/TNL/Solvers/PDE/LinearSystemAssembler.h
index b15f8c97290e30fd698d2543253bb5108aec8121..cd09d13b83d5afa373741facad5ad63894669d09 100644
--- a/src/TNL/Solvers/PDE/LinearSystemAssembler.h
+++ b/src/TNL/Solvers/PDE/LinearSystemAssembler.h
@@ -23,36 +23,29 @@ template< typename Real,
           typename MatrixView >
 class LinearSystemAssemblerTraverserUserData
 {
-   public:
-      Real time = 0.0;
+public:
+   Real time = 0.0;
 
-      Real tau = 0.0;
+   Real tau = 0.0;
 
-      const DifferentialOperator* differentialOperator = NULL;
+   const DifferentialOperator* differentialOperator = NULL;
 
-      const BoundaryConditions* boundaryConditions = NULL;
+   const BoundaryConditions* boundaryConditions = NULL;
 
-      const RightHandSide* rightHandSide = NULL;
+   const RightHandSide* rightHandSide = NULL;
 
-      const MeshFunction* u = NULL;
+   const MeshFunction* u = NULL;
 
-      DofVector* b = NULL;
+   DofVector* b = NULL;
 
-      MatrixView matrix;
+   MatrixView matrix;
 
-      LinearSystemAssemblerTraverserUserData( MatrixView matrix )
-      : time( 0.0 ),
-        tau( 0.0 ),
-        differentialOperator( NULL ),
-        boundaryConditions( NULL ),
-        rightHandSide( NULL ),
-        u( NULL ),
-        b( NULL ),
-        matrix( matrix )
-      {}
+   LinearSystemAssemblerTraverserUserData( MatrixView matrix )
+   : time( 0.0 ), tau( 0.0 ), differentialOperator( NULL ), boundaryConditions( NULL ), rightHandSide( NULL ), u( NULL ),
+     b( NULL ), matrix( matrix )
+   {}
 };
 
-
 template< typename Mesh,
           typename MeshFunction,
           typename DifferentialOperator,
@@ -63,11 +56,11 @@ template< typename Mesh,
 class LinearSystemAssembler
 {
 public:
-   typedef typename MeshFunction::MeshType MeshType;
-   typedef typename MeshFunction::MeshPointer MeshPointer;
-   typedef typename MeshFunction::RealType RealType;
-   typedef typename MeshFunction::DeviceType DeviceType;
-   typedef typename MeshFunction::IndexType IndexType;
+   using MeshType = typename MeshFunction::MeshType;
+   using MeshPointer = typename MeshFunction::MeshPointer;
+   using RealType = typename MeshFunction::RealType;
+   using DeviceType = typename MeshFunction::DeviceType;
+   using IndexType = typename MeshFunction::IndexType;
 
    template< typename MatrixView >
    using TraverserUserData = LinearSystemAssemblerTraverserUserData< RealType,
@@ -78,44 +71,50 @@ public:
                                                                      DofVector,
                                                                      MatrixView >;
 
-   //typedef Pointers::SharedPointer<  Matrix, DeviceType > MatrixPointer;
-   typedef Pointers::SharedPointer<  DifferentialOperator, DeviceType > DifferentialOperatorPointer;
-   typedef Pointers::SharedPointer<  BoundaryConditions, DeviceType > BoundaryConditionsPointer;
-   typedef Pointers::SharedPointer<  RightHandSide, DeviceType > RightHandSidePointer;
-   typedef Pointers::SharedPointer<  MeshFunction, DeviceType > MeshFunctionPointer;
-   typedef Pointers::SharedPointer<  DofVector, DeviceType > DofVectorPointer;
+   // typedef Pointers::SharedPointer<  Matrix, DeviceType > MatrixPointer;
+   using DifferentialOperatorPointer = Pointers::SharedPointer< DifferentialOperator, DeviceType >;
+   using BoundaryConditionsPointer = Pointers::SharedPointer< BoundaryConditions, DeviceType >;
+   using RightHandSidePointer = Pointers::SharedPointer< RightHandSide, DeviceType >;
+   using MeshFunctionPointer = Pointers::SharedPointer< MeshFunction, DeviceType >;
+   using DofVectorPointer = Pointers::SharedPointer< DofVector, DeviceType >;
 
-   void setDifferentialOperator( const DifferentialOperatorPointer& differentialOperatorPointer )
+   void
+   setDifferentialOperator( const DifferentialOperatorPointer& differentialOperatorPointer )
    {
       this->differentialOperator = &differentialOperatorPointer.template getData< DeviceType >();
    }
 
-   void setBoundaryConditions( const BoundaryConditionsPointer& boundaryConditionsPointer )
+   void
+   setBoundaryConditions( const BoundaryConditionsPointer& boundaryConditionsPointer )
    {
       this->boundaryConditions = &boundaryConditionsPointer.template getData< DeviceType >();
    }
 
-   void setRightHandSide( const RightHandSidePointer& rightHandSidePointer )
+   void
+   setRightHandSide( const RightHandSidePointer& rightHandSidePointer )
    {
       this->rightHandSide = &rightHandSidePointer.template getData< DeviceType >();
    }
 
    template< typename EntityType, typename Matrix >
-   void assembly( const RealType& time,
-                  const RealType& tau,
-                  const MeshPointer& meshPointer,
-                  const MeshFunctionPointer& uPointer,
-                  std::shared_ptr< Matrix >& matrixPointer,
-                  DofVectorPointer& bPointer )
+   void
+   assembly( const RealType& time,
+             const RealType& tau,
+             const MeshPointer& meshPointer,
+             const MeshFunctionPointer& uPointer,
+             std::shared_ptr< 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_GT( maxRowLength, 0, "maximum row length must be positive" );
+                                   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_GT( maxRowLength, 0, "maximum row length must be positive" );
       TraverserUserData< typename Matrix::ViewType > userData( matrixPointer->getView() );
       userData.time = time;
       userData.tau = tau;
@@ -126,12 +125,10 @@ public:
       userData.matrix = matrixPointer->getView();
       userData.b = &bPointer.template modifyData< DeviceType >();
       Meshes::Traverser< MeshType, EntityType > meshTraverser;
-      meshTraverser.template processBoundaryEntities< TraverserBoundaryEntitiesProcessor< typename Matrix::ViewType > >
-                                                    ( meshPointer,
-                                                      userData );
-      meshTraverser.template processInteriorEntities< TraverserInteriorEntitiesProcessor< typename Matrix::ViewType > >
-                                                    ( meshPointer,
-                                                      userData );
+      meshTraverser.template processBoundaryEntities< TraverserBoundaryEntitiesProcessor< typename Matrix::ViewType > >(
+         meshPointer, userData );
+      meshTraverser.template processInteriorEntities< TraverserInteriorEntitiesProcessor< typename Matrix::ViewType > >(
+         meshPointer, userData );
    }
 
    template< typename Matrix >
@@ -139,18 +136,12 @@ public:
    {
       template< typename EntityType >
       __cuda_callable__
-      static void processEntity( const MeshType& mesh,
-                                 TraverserUserData< Matrix >& userData,
-                                 const EntityType& entity )
+      static void
+      processEntity( const MeshType& mesh, TraverserUserData< Matrix >& userData, const EntityType& entity )
       {
          ( *userData.b )[ entity.getIndex() ] = 0.0;
          userData.boundaryConditions->setMatrixElements(
-              *userData.u,
-              entity,
-              userData.time + userData.tau,
-              userData.tau,
-              userData.matrix,
-              *userData.b );
+            *userData.u, entity, userData.time + userData.tau, userData.tau, userData.matrix, *userData.b );
       }
    };
 
@@ -159,25 +150,16 @@ public:
    {
       template< typename EntityType >
       __cuda_callable__
-      static void processEntity( const MeshType& mesh,
-                                 TraverserUserData< Matrix >& userData,
-                                 const EntityType& entity )
+      static void
+      processEntity( const MeshType& mesh, TraverserUserData< Matrix >& userData, const EntityType& entity )
       {
          ( *userData.b )[ entity.getIndex() ] = 0.0;
          userData.differentialOperator->setMatrixElements(
-              *userData.u,
-              entity,
-              userData.time + userData.tau,
-              userData.tau,
-              userData.matrix,
-              *userData.b );
-
-         typedef Functions::FunctionAdapter< MeshType, RightHandSide > RhsFunctionAdapter;
-         typedef Functions::FunctionAdapter< MeshType, MeshFunction > MeshFunctionAdapter;
-         const RealType& rhs = RhsFunctionAdapter::getValue
-            ( *userData.rightHandSide,
-              entity,
-              userData.time );
+            *userData.u, entity, userData.time + userData.tau, userData.tau, userData.matrix, *userData.b );
+
+         using RhsFunctionAdapter = Functions::FunctionAdapter< MeshType, RightHandSide >;
+         using MeshFunctionAdapter = Functions::FunctionAdapter< MeshType, MeshFunction >;
+         const RealType& rhs = RhsFunctionAdapter::getValue( *userData.rightHandSide, entity, userData.time );
          TimeDiscretisation::applyTimeDiscretisation( userData.matrix,
                                                       ( *userData.b )[ entity.getIndex() ],
                                                       entity.getIndex(),
@@ -195,6 +177,6 @@ protected:
    const RightHandSide* rightHandSide = NULL;
 };
 
-} // namespace PDE
-} // namespace Solvers
-} // namespace TNL
+}  // namespace PDE
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/PDE/MeshDependentTimeSteps.h b/src/TNL/Solvers/PDE/MeshDependentTimeSteps.h
index 0b45f100238c6f9416296107644cbed92bc7ae84..372eea36d2ce546a9782e94c6be733f0b69cedad 100644
--- a/src/TNL/Solvers/PDE/MeshDependentTimeSteps.h
+++ b/src/TNL/Solvers/PDE/MeshDependentTimeSteps.h
@@ -11,24 +11,20 @@
 
 namespace TNL {
 namespace Solvers {
-namespace PDE {   
+namespace PDE {
 
 template< typename Mesh, typename Real >
 class MeshDependentTimeSteps
-{
-};
+{};
 
-template< int Dimension,
-          typename MeshReal,
-          typename Device,
-          typename MeshIndex,
-          typename Real >
+template< int Dimension, typename MeshReal, typename Device, typename MeshIndex, typename Real >
 class MeshDependentTimeSteps< TNL::Meshes::Grid< Dimension, MeshReal, Device, MeshIndex >, Real >
 {
 public:
    using MeshType = TNL::Meshes::Grid< Dimension, MeshReal, Device, MeshIndex >;
 
-   bool setTimeStepOrder( const Real& timeStepOrder )
+   bool
+   setTimeStepOrder( const Real& timeStepOrder )
    {
       if( timeStepOrder < 0 ) {
          std::cerr << "The time step order for PDESolver must be zero or positive value." << std::endl;
@@ -38,12 +34,14 @@ public:
       return true;
    }
 
-   const Real& getTimeStepOrder() const
+   const Real&
+   getTimeStepOrder() const
    {
       return timeStepOrder;
    }
 
-   Real getRefinedTimeStep( const MeshType& mesh, const Real& timeStep )
+   Real
+   getRefinedTimeStep( const MeshType& mesh, const Real& timeStep )
    {
       return timeStep * std::pow( mesh.getSmallestSpaceStep(), this->timeStepOrder );
    }
@@ -52,30 +50,32 @@ protected:
    Real timeStepOrder = 0.0;
 };
 
-template< typename MeshConfig,
-          typename Device,
-          typename Real >
+template< typename MeshConfig, typename Device, typename Real >
 class MeshDependentTimeSteps< TNL::Meshes::Mesh< MeshConfig, Device >, Real >
 {
 public:
    using MeshType = TNL::Meshes::Mesh< MeshConfig >;
 
-   bool setTimeStepOrder( const Real& timeStepOrder )
+   bool
+   setTimeStepOrder( const Real& timeStepOrder )
    {
       if( timeStepOrder != 0.0 ) {
-         std::cerr << "Mesh-dependent time stepping is not available on unstructured meshes, so the time step order must be 0." << std::endl;
+         std::cerr << "Mesh-dependent time stepping is not available on unstructured meshes, so the time step order must be 0."
+                   << std::endl;
          return false;
       }
       this->timeStepOrder = timeStepOrder;
       return true;
    }
 
-   const Real& getTimeStepOrder() const
+   const Real&
+   getTimeStepOrder() const
    {
       return timeStepOrder;
    }
 
-   Real getRefinedTimeStep( const MeshType& mesh, const Real& timeStep )
+   Real
+   getRefinedTimeStep( const MeshType& mesh, const Real& timeStep )
    {
       return timeStep;
    }
@@ -84,6 +84,6 @@ protected:
    Real timeStepOrder = 0.0;
 };
 
-} // namespace PDE
-} // namespace Solvers
-} // namespace TNL
+}  // namespace PDE
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/PDE/NoTimeDiscretisation.h b/src/TNL/Solvers/PDE/NoTimeDiscretisation.h
index dfcebe79b49a32e22a12529d9bb054a52c5d7ed2..52cf97da82d689513ec9db1fbd9101ebf6aad849 100644
--- a/src/TNL/Solvers/PDE/NoTimeDiscretisation.h
+++ b/src/TNL/Solvers/PDE/NoTimeDiscretisation.h
@@ -10,27 +10,25 @@
 
 namespace TNL {
 namespace Solvers {
-namespace PDE {   
+namespace PDE {
 
 class NoTimeDiscretisation
 {
-    public:
- 
-        template< typename RealType,
-                  typename IndexType,
-                  typename MatrixType >
-        __cuda_callable__ static void applyTimeDiscretisation( MatrixType& matrix,
-                                                               RealType& b,
-                                                               const IndexType index,
-                                                               const RealType& u,
-                                                               const RealType& tau,
-                                                               const RealType& rhs )
-        {
-            b += rhs;
-        }
+public:
+   template< typename RealType, typename IndexType, typename MatrixType >
+   __cuda_callable__
+   static void
+   applyTimeDiscretisation( MatrixType& matrix,
+                            RealType& b,
+                            const IndexType index,
+                            const RealType& u,
+                            const RealType& tau,
+                            const RealType& rhs )
+   {
+      b += rhs;
+   }
 };
 
-} // namespace PDE
-} // namespace Solvers
-} // namespace TNL
-
+}  // namespace PDE
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/PDE/PDESolver.h b/src/TNL/Solvers/PDE/PDESolver.h
index cf0fbaa0150c66e06ef4c98bd9b8773ca081c775..ee0dfbcd2896012f6dcedafee64afe3cb5c88c13 100644
--- a/src/TNL/Solvers/PDE/PDESolver.h
+++ b/src/TNL/Solvers/PDE/PDESolver.h
@@ -16,48 +16,51 @@ namespace TNL {
 namespace Solvers {
 namespace PDE {
 
-template< typename Real,
-          typename Index >
+template< typename Real, typename Index >
 class PDESolver
 {
-   public:
-      using RealType = Real;
-      using IndexType = Index;
-      using SolverMonitorType = IterativeSolverMonitor< RealType, IndexType >;
+public:
+   using RealType = Real;
+   using IndexType = Index;
+   using SolverMonitorType = IterativeSolverMonitor< RealType, IndexType >;
 
+   PDESolver();
 
-      PDESolver();
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" );
 
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" );
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" );
+   bool
+   writeProlog( Logger& logger, const Config::ParameterContainer& parameters );
 
-      bool writeProlog( Logger& logger,
-                        const Config::ParameterContainer& parameters );
+   void
+   setIoTimer( Timer& ioTimer );
 
-      void setIoTimer( Timer& ioTimer);
+   void
+   setComputeTimer( Timer& computeTimer );
 
-      void setComputeTimer( Timer& computeTimer );
+   void
+   setTotalTimer( Timer& totalTimer );
 
-      void setTotalTimer( Timer& totalTimer );
+   void
+   setSolverMonitor( SolverMonitorType& solverMonitor );
 
-      void setSolverMonitor( SolverMonitorType& solverMonitor );
+   SolverMonitorType&
+   getSolverMonitor();
 
-      SolverMonitorType& getSolverMonitor();
+   bool
+   writeEpilog( Logger& logger ) const;
 
-      bool writeEpilog( Logger& logger ) const;
+protected:
+   Timer *ioTimer, *computeTimer, *totalTimer;
 
-   protected:
-
-      Timer *ioTimer, *computeTimer, *totalTimer;
-
-      SolverMonitorType *solverMonitorPointer;
+   SolverMonitorType* solverMonitorPointer;
 };
 
-} // namespace PDE
-} // namespace Solvers
-} // namespace TNL
+}  // namespace PDE
+}  // namespace Solvers
+}  // namespace TNL
 
 #include <TNL/Solvers/PDE/PDESolver.hpp>
diff --git a/src/TNL/Solvers/PDE/PDESolver.hpp b/src/TNL/Solvers/PDE/PDESolver.hpp
index b7ad76c8952e45884e8429af36b790be9ac7df6b..09f3ca85f1ed9fd14ec8049350e71a0ed66005fc 100644
--- a/src/TNL/Solvers/PDE/PDESolver.hpp
+++ b/src/TNL/Solvers/PDE/PDESolver.hpp
@@ -13,67 +13,45 @@ namespace TNL {
 namespace Solvers {
 namespace PDE {
 
-template< typename Real,
-          typename Index >
-PDESolver< Real, Index >::PDESolver()
-: ioTimer( 0 ),
-  computeTimer( 0 ),
-  totalTimer( 0 ),
-  solverMonitorPointer( 0 )
-{
-}
+template< typename Real, typename Index >
+PDESolver< Real, Index >::PDESolver() : ioTimer( 0 ), computeTimer( 0 ), totalTimer( 0 ), solverMonitorPointer( 0 )
+{}
 
-template< typename Real,
-          typename Index >
+template< typename Real, typename Index >
 void
-PDESolver< Real, Index >::
-configSetup( Config::ConfigDescription& config,
-             const String& prefix )
-{
-}
+PDESolver< Real, Index >::configSetup( Config::ConfigDescription& config, const String& prefix )
+{}
 
-template< typename Real,
-          typename Index >
+template< typename Real, typename Index >
 bool
-PDESolver< Real, Index >::
-setup( const Config::ParameterContainer& parameters,
-       const String& prefix )
+PDESolver< Real, Index >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    return true;
 }
 
-template< typename Real,
-          typename Index >
+template< typename Real, typename Index >
 void
-PDESolver< Real, Index >::
-setSolverMonitor( typename PDESolver< Real, Index >::SolverMonitorType& solverMonitor )
+PDESolver< Real, Index >::setSolverMonitor( typename PDESolver< Real, Index >::SolverMonitorType& solverMonitor )
 {
    this->solverMonitorPointer = &solverMonitor;
 }
 
-template< typename Real,
-          typename Index >
+template< typename Real, typename Index >
 typename PDESolver< Real, Index >::SolverMonitorType&
-PDESolver< Real, Index >::
-getSolverMonitor()
+PDESolver< Real, Index >::getSolverMonitor()
 {
    return *this->solverMonitorPointer;
 }
 
-template< typename Real,
-          typename Index >
+template< typename Real, typename Index >
 bool
-PDESolver< Real, Index >::
-writeProlog( Logger& logger,
-             const Config::ParameterContainer& parameters )
+PDESolver< Real, Index >::writeProlog( Logger& logger, const Config::ParameterContainer& parameters )
 {
    logger.writeParameter< String >( "Real type:", "real-type", parameters, 0 );
    logger.writeParameter< String >( "Index type:", "index-type", parameters, 0 );
    logger.writeParameter< String >( "Device:", "device", parameters, 0 );
-   if( parameters.getParameter< String >( "device" ) == "host" )
-   {
-      if( Devices::Host::isOMPEnabled() )
-      {
+   if( parameters.getParameter< String >( "device" ) == "host" ) {
+      if( Devices::Host::isOMPEnabled() ) {
          logger.writeParameter< String >( "OMP enabled:", "yes", 1 );
          logger.writeParameter< int >( "OMP threads:", Devices::Host::getMaxThreadsCount(), 1 );
       }
@@ -91,31 +69,27 @@ writeProlog( Logger& logger,
    return true;
 }
 
-template< typename Real,
-          typename Index >
-void PDESolver< Real, Index >::
-setIoTimer( Timer& ioTimer )
+template< typename Real, typename Index >
+void
+PDESolver< Real, Index >::setIoTimer( Timer& ioTimer )
 {
    this->ioTimer = &ioTimer;
 }
 
-template< typename Real,
-          typename Index >
-void PDESolver< Real, Index >::
-setComputeTimer( Timer& computeTimer )
+template< typename Real, typename Index >
+void
+PDESolver< Real, Index >::setComputeTimer( Timer& computeTimer )
 {
    this->computeTimer = &computeTimer;
 }
 
-template< typename Real,
-          typename Index >
-void PDESolver< Real, Index >::
-setTotalTimer( Timer& totalTimer )
+template< typename Real, typename Index >
+void
+PDESolver< Real, Index >::setTotalTimer( Timer& totalTimer )
 {
    this->totalTimer = &totalTimer;
 }
 
-} // namespace PDE
-} // namespace Solvers
-} // namespace TNL
-
+}  // namespace PDE
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/PDE/PDESolverTypeResolver.h b/src/TNL/Solvers/PDE/PDESolverTypeResolver.h
index 7f6e161ca1d16973c016e4324ddc512d1dc0afdf..aabc15cb64740c43de5dfdd54952e4f41882ff2f 100644
--- a/src/TNL/Solvers/PDE/PDESolverTypeResolver.h
+++ b/src/TNL/Solvers/PDE/PDESolverTypeResolver.h
@@ -13,31 +13,24 @@ namespace TNL {
 namespace Solvers {
 namespace PDE {
 
-template< typename Problem,
-          typename TimeStepper,
-          bool TimeDependent = Problem::isTimeDependent() >
+template< typename Problem, typename TimeStepper, bool TimeDependent = Problem::isTimeDependent() >
 class PDESolverTypeResolver
-{
-};
+{};
 
-template< typename Problem,
-          typename TimeStepper >
+template< typename Problem, typename TimeStepper >
 class PDESolverTypeResolver< Problem, TimeStepper, true >
 {
-   public:
-
-      using SolverType = TimeDependentPDESolver< Problem, TimeStepper >;
+public:
+   using SolverType = TimeDependentPDESolver< Problem, TimeStepper >;
 };
 
-template< typename Problem,
-          typename TimeStepper >
+template< typename Problem, typename TimeStepper >
 class PDESolverTypeResolver< Problem, TimeStepper, false >
 {
-   public:
-
-      using SolverType = TimeIndependentPDESolver< Problem >;
+public:
+   using SolverType = TimeIndependentPDESolver< Problem >;
 };
 
-} // namespace PDE
-} // namespace Solvers
-} // namespace TNL
+}  // namespace PDE
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/PDE/SemiImplicitTimeStepper.h b/src/TNL/Solvers/PDE/SemiImplicitTimeStepper.h
index 2f1d7fe3717b70035e770aff80f53fccaa8037a2..99d3d9de7f3fda595341a6f1ee813ce6bd6374be 100644
--- a/src/TNL/Solvers/PDE/SemiImplicitTimeStepper.h
+++ b/src/TNL/Solvers/PDE/SemiImplicitTimeStepper.h
@@ -21,16 +21,15 @@ namespace PDE {
 template< typename Problem >
 class SemiImplicitTimeStepper
 {
-   public:
-
-   typedef Problem ProblemType;
-   typedef typename Problem::RealType RealType;
-   typedef typename Problem::DeviceType DeviceType;
-   typedef typename Problem::IndexType IndexType;
-   typedef typename Problem::MeshType MeshType;
-   typedef typename ProblemType::DofVectorType DofVectorType;
-   typedef Pointers::SharedPointer< DofVectorType, DeviceType > DofVectorPointer;
-   typedef IterativeSolverMonitor< RealType, IndexType > SolverMonitorType;
+public:
+   using ProblemType = Problem;
+   using RealType = typename Problem::RealType;
+   using DeviceType = typename Problem::DeviceType;
+   using IndexType = typename Problem::IndexType;
+   using MeshType = typename Problem::MeshType;
+   using DofVectorType = typename ProblemType::DofVectorType;
+   using DofVectorPointer = Pointers::SharedPointer< DofVectorType, DeviceType >;
+   using SolverMonitorType = IterativeSolverMonitor< RealType, IndexType >;
 
    using MatrixType = typename ProblemType::MatrixType;
    using MatrixPointer = std::shared_ptr< MatrixType >;
@@ -39,32 +38,37 @@ class SemiImplicitTimeStepper
    using PreconditionerType = typename LinearSolverType::PreconditionerType;
    using PreconditionerPointer = std::shared_ptr< PreconditionerType >;
 
-   static void configSetup( Config::ConfigDescription& config,
-                            const String& prefix = "" );
-
-   bool setup( const Config::ParameterContainer& parameters,
-              const String& prefix = "" );
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" );
 
-   bool init( const MeshType& mesh );
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-   void setProblem( ProblemType& problem );
+   bool
+   init( const MeshType& mesh );
 
-   ProblemType* getProblem() const;
+   void
+   setProblem( ProblemType& problem );
 
-   void setSolverMonitor( SolverMonitorType& solverMonitor );
+   ProblemType*
+   getProblem() const;
 
-   bool setTimeStep( const RealType& timeStep );
+   void
+   setSolverMonitor( SolverMonitorType& solverMonitor );
 
-   const RealType& getTimeStep() const;
+   bool
+   setTimeStep( const RealType& timeStep );
 
-   bool solve( const RealType& time,
-               const RealType& stopTime,
-               DofVectorPointer& dofVectorPointer );
+   const RealType&
+   getTimeStep() const;
 
-   bool writeEpilog( Logger& logger ) const;
+   bool
+   solve( const RealType& time, const RealType& stopTime, DofVectorPointer& dofVectorPointer );
 
-   protected:
+   bool
+   writeEpilog( Logger& logger ) const;
 
+protected:
    // raw pointers with setters
    Problem* problem = nullptr;
    SolverMonitorType* solverMonitor = nullptr;
@@ -84,8 +88,8 @@ class SemiImplicitTimeStepper
    long long int allIterations = 0;
 };
 
-} // namespace PDE
-} // namespace Solvers
-} // namespace TNL
+}  // namespace PDE
+}  // namespace Solvers
+}  // namespace TNL
 
 #include <TNL/Solvers/PDE/SemiImplicitTimeStepper.hpp>
diff --git a/src/TNL/Solvers/PDE/SemiImplicitTimeStepper.hpp b/src/TNL/Solvers/PDE/SemiImplicitTimeStepper.hpp
index 22a99be20004745a728839ef0b4ab13607d142f9..660ff08bb0b0b1212d8810f22b7095487287610c 100644
--- a/src/TNL/Solvers/PDE/SemiImplicitTimeStepper.hpp
+++ b/src/TNL/Solvers/PDE/SemiImplicitTimeStepper.hpp
@@ -16,17 +16,12 @@ namespace PDE {
 
 template< typename Problem >
 void
-SemiImplicitTimeStepper< Problem >::
-configSetup( Config::ConfigDescription& config,
-             const String& prefix )
-{
-}
+SemiImplicitTimeStepper< Problem >::configSetup( Config::ConfigDescription& config, const String& prefix )
+{}
 
 template< typename Problem >
 bool
-SemiImplicitTimeStepper< Problem >::
-setup( const Config::ParameterContainer& parameters,
-       const String& prefix )
+SemiImplicitTimeStepper< Problem >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    // set up the linear solver
    const String& discreteSolver = parameters.getParameter< String >( prefix + "discrete-solver" );
@@ -50,16 +45,14 @@ setup( const Config::ParameterContainer& parameters,
 
 template< typename Problem >
 bool
-SemiImplicitTimeStepper< Problem >::
-init( const MeshType& mesh )
+SemiImplicitTimeStepper< Problem >::init( const MeshType& mesh )
 {
    this->matrix = std::make_shared< MatrixType >();
    if( ! this->problem->setupLinearSystem( this->matrix ) ) {
       std::cerr << "Failed to set up the linear system." << std::endl;
       return false;
    }
-   if( this->matrix->getRows() == 0 || this->matrix->getColumns() == 0 )
-   {
+   if( this->matrix->getRows() == 0 || this->matrix->getColumns() == 0 ) {
       std::cerr << "The matrix for the semi-implicit time stepping was not set correctly." << std::endl;
       if( ! this->matrix->getRows() )
          std::cerr << "The matrix dimensions are set to 0 rows." << std::endl;
@@ -82,24 +75,21 @@ init( const MeshType& mesh )
 
 template< typename Problem >
 void
-SemiImplicitTimeStepper< Problem >::
-setProblem( ProblemType& problem )
+SemiImplicitTimeStepper< Problem >::setProblem( ProblemType& problem )
 {
    this->problem = &problem;
 };
 
 template< typename Problem >
 Problem*
-SemiImplicitTimeStepper< Problem >::
-getProblem() const
+SemiImplicitTimeStepper< Problem >::getProblem() const
 {
-    return this->problem;
+   return this->problem;
 };
 
 template< typename Problem >
 void
-SemiImplicitTimeStepper< Problem >::
-setSolverMonitor( SolverMonitorType& solverMonitor )
+SemiImplicitTimeStepper< Problem >::setSolverMonitor( SolverMonitorType& solverMonitor )
 {
    this->solverMonitor = &solverMonitor;
    if( this->linearSystemSolver )
@@ -108,11 +98,9 @@ setSolverMonitor( SolverMonitorType& solverMonitor )
 
 template< typename Problem >
 bool
-SemiImplicitTimeStepper< Problem >::
-setTimeStep( const RealType& timeStep )
+SemiImplicitTimeStepper< Problem >::setTimeStep( const RealType& timeStep )
 {
-   if( timeStep <= 0.0 )
-   {
+   if( timeStep <= 0.0 ) {
       std::cerr << "Time step for SemiImplicitTimeStepper must be positive. " << std::endl;
       return false;
    }
@@ -122,10 +110,7 @@ setTimeStep( const RealType& timeStep )
 
 template< typename Problem >
 bool
-SemiImplicitTimeStepper< Problem >::
-solve( const RealType& time,
-       const RealType& stopTime,
-       DofVectorPointer& dofVector )
+SemiImplicitTimeStepper< Problem >::solve( const RealType& time, const RealType& stopTime, DofVectorPointer& dofVector )
 {
    TNL_ASSERT_TRUE( this->problem, "problem was not set" );
 
@@ -135,8 +120,7 @@ solve( const RealType& time,
    RealType t = time;
 
    // ignore very small steps at the end, most likely caused by truncation errors
-   while( stopTime - t > this->timeStep * 1e-6 )
-   {
+   while( stopTime - t > this->timeStep * 1e-6 ) {
       RealType currentTau = min( this->timeStep, stopTime - t );
 
       if( this->solverMonitor ) {
@@ -145,8 +129,7 @@ solve( const RealType& time,
       }
 
       this->preIterateTimer.start();
-      if( ! this->problem->preIterate( t, currentTau, dofVector ) )
-      {
+      if( ! this->problem->preIterate( t, currentTau, dofVector ) ) {
          std::cerr << std::endl << "Preiteration failed." << std::endl;
          return false;
       }
@@ -156,26 +139,20 @@ solve( const RealType& time,
          this->solverMonitor->setStage( "Assembling the linear system" );
 
       this->linearSystemAssemblerTimer.start();
-      this->problem->assemblyLinearSystem( t,
-                                           currentTau,
-                                           dofVector,
-                                           this->matrix,
-                                           this->rightHandSidePointer );
+      this->problem->assemblyLinearSystem( t, currentTau, dofVector, this->matrix, this->rightHandSidePointer );
       this->linearSystemAssemblerTimer.stop();
 
       if( this->solverMonitor )
          this->solverMonitor->setStage( "Solving the linear system" );
 
-      if( this->preconditioner )
-      {
+      if( this->preconditioner ) {
          this->preconditionerUpdateTimer.start();
          preconditioner->update( this->matrix );
          this->preconditionerUpdateTimer.stop();
       }
 
       this->linearSystemSolverTimer.start();
-      if( ! this->linearSystemSolver->solve( *this->rightHandSidePointer, *dofVector ) )
-      {
+      if( ! this->linearSystemSolver->solve( *this->rightHandSidePointer, *dofVector ) ) {
          std::cerr << std::endl << "The linear system solver did not converge." << std::endl;
          // save the linear system for debugging
          this->problem->saveFailedLinearSystem( *this->matrix, *dofVector, *this->rightHandSidePointer );
@@ -188,8 +165,7 @@ solve( const RealType& time,
          this->solverMonitor->setStage( "Postiteration" );
 
       this->postIterateTimer.start();
-      if( ! this->problem->postIterate( t, currentTau, dofVector ) )
-      {
+      if( ! this->problem->postIterate( t, currentTau, dofVector ) ) {
          std::cerr << std::endl << "Postiteration failed." << std::endl;
          return false;
       }
@@ -202,8 +178,7 @@ solve( const RealType& time,
 
 template< typename Problem >
 bool
-SemiImplicitTimeStepper< Problem >::
-writeEpilog( Logger& logger ) const
+SemiImplicitTimeStepper< Problem >::writeEpilog( Logger& logger ) const
 {
    logger.writeParameter< long long int >( "Iterations count:", this->allIterations );
    logger.writeParameter< const char* >( "Pre-iterate time:", "" );
@@ -219,6 +194,6 @@ writeEpilog( Logger& logger ) const
    return true;
 }
 
-} // namespace PDE
-} // namespace Solvers
-} // namespace TNL
+}  // namespace PDE
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/PDE/TimeDependentPDESolver.h b/src/TNL/Solvers/PDE/TimeDependentPDESolver.h
index 0a94c167f60cc64c29392ff1e878797f087422b2..cd9e826ea69d1d9683bdcf3b29d46649f2eb33bf 100644
--- a/src/TNL/Solvers/PDE/TimeDependentPDESolver.h
+++ b/src/TNL/Solvers/PDE/TimeDependentPDESolver.h
@@ -15,88 +15,92 @@
 
 #include <TNL/Meshes/DistributedMeshes/DistributedMesh.h>
 
-
 namespace TNL {
 namespace Solvers {
 namespace PDE {
 
-template< typename Problem,
-          typename TimeStepper >
-class TimeDependentPDESolver
-   : public PDESolver< typename Problem::RealType,
-                       typename Problem::IndexType >,
-     public MeshDependentTimeSteps< typename Problem::MeshType,
-                                    typename TimeStepper::RealType >
+template< typename Problem, typename TimeStepper >
+class TimeDependentPDESolver : public PDESolver< typename Problem::RealType, typename Problem::IndexType >,
+                               public MeshDependentTimeSteps< typename Problem::MeshType, typename TimeStepper::RealType >
 {
-   public:
-
-      using RealType = typename Problem::RealType;
-      using DeviceType = typename Problem::DeviceType;
-      using IndexType = typename Problem::IndexType;
-      using BaseType = PDESolver< RealType, IndexType >;
-      using ProblemType = Problem;
-      typedef typename ProblemType::MeshType MeshType;
-      typedef typename ProblemType::DofVectorType DofVectorType;
-      typedef typename ProblemType::CommonDataType CommonDataType;
-      typedef typename ProblemType::CommonDataPointer CommonDataPointer;
-      typedef Pointers::SharedPointer< MeshType, DeviceType > MeshPointer;
-      typedef Pointers::SharedPointer< DofVectorType, DeviceType > DofVectorPointer;
-      typedef IterativeSolverMonitor< typename Problem::RealType, typename Problem::IndexType > SolverMonitorType;
-
-      static_assert( ProblemType::isTimeDependent(), "The problem is not time dependent." );
+public:
+   using RealType = typename Problem::RealType;
+   using DeviceType = typename Problem::DeviceType;
+   using IndexType = typename Problem::IndexType;
+   using BaseType = PDESolver< RealType, IndexType >;
+   using ProblemType = Problem;
+   using MeshType = typename ProblemType::MeshType;
+   using DofVectorType = typename ProblemType::DofVectorType;
+   using CommonDataType = typename ProblemType::CommonDataType;
+   using CommonDataPointer = typename ProblemType::CommonDataPointer;
+   using MeshPointer = Pointers::SharedPointer< MeshType, DeviceType >;
+   using DofVectorPointer = Pointers::SharedPointer< DofVectorType, DeviceType >;
+   using SolverMonitorType = IterativeSolverMonitor< typename Problem::RealType, typename Problem::IndexType >;
 
-      TimeDependentPDESolver();
+   static_assert( ProblemType::isTimeDependent(), "The problem is not time dependent." );
 
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" );
+   TimeDependentPDESolver();
 
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" );
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" );
 
-      bool writeProlog( Logger& logger,
-                        const Config::ParameterContainer& parameters );
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-      void setProblem( ProblemType& problem );
+   bool
+   writeProlog( Logger& logger, const Config::ParameterContainer& parameters );
 
-      void setInitialTime( const RealType& initialT );
+   void
+   setProblem( ProblemType& problem );
 
-      const RealType& getInitialTime() const;
+   void
+   setInitialTime( const RealType& initialT );
 
-      bool setFinalTime( const RealType& finalT );
+   const RealType&
+   getInitialTime() const;
 
-      const RealType& getFinalTime() const;
+   bool
+   setFinalTime( const RealType& finalT );
 
-      bool setTimeStep( const RealType& timeStep );
+   const RealType&
+   getFinalTime() const;
 
-      const RealType& getTimeStep() const;
+   bool
+   setTimeStep( const RealType& timeStep );
 
-      bool setSnapshotPeriod( const RealType& period );
+   const RealType&
+   getTimeStep() const;
 
-      const RealType& getSnapshotPeriod() const;
+   bool
+   setSnapshotPeriod( const RealType& period );
 
-      bool solve();
+   const RealType&
+   getSnapshotPeriod() const;
 
-      bool writeEpilog( Logger& logger ) const;
+   bool
+   solve();
 
-   protected:
+   bool
+   writeEpilog( Logger& logger ) const;
 
-      MeshPointer meshPointer;
+protected:
+   MeshPointer meshPointer;
 
-      Pointers::SharedPointer< Meshes::DistributedMeshes::DistributedMesh<MeshType> > distributedMeshPointer;
+   Pointers::SharedPointer< Meshes::DistributedMeshes::DistributedMesh< MeshType > > distributedMeshPointer;
 
-      DofVectorPointer dofsPointer;
+   DofVectorPointer dofsPointer;
 
-      CommonDataPointer commonDataPointer;
+   CommonDataPointer commonDataPointer;
 
-      TimeStepper timeStepper;
+   TimeStepper timeStepper;
 
-      ProblemType* problem;
+   ProblemType* problem;
 
-      RealType initialTime, finalTime, snapshotPeriod, timeStep;
+   RealType initialTime, finalTime, snapshotPeriod, timeStep;
 };
 
-} // namespace PDE
-} // namespace Solvers
-} // namespace TNL
+}  // namespace PDE
+}  // namespace Solvers
+}  // namespace TNL
 
 #include <TNL/Solvers/PDE/TimeDependentPDESolver.hpp>
diff --git a/src/TNL/Solvers/PDE/TimeDependentPDESolver.hpp b/src/TNL/Solvers/PDE/TimeDependentPDESolver.hpp
index 6e8fbde9c11226e05e5ae052afa1f179d4ef9619..c756779d78235e2d3aa6c13740786e6094a68566 100644
--- a/src/TNL/Solvers/PDE/TimeDependentPDESolver.hpp
+++ b/src/TNL/Solvers/PDE/TimeDependentPDESolver.hpp
@@ -15,41 +15,28 @@ namespace TNL {
 namespace Solvers {
 namespace PDE {
 
-template< typename Problem,
-          typename TimeStepper >
-TimeDependentPDESolver< Problem, TimeStepper >::
-TimeDependentPDESolver()
-: problem( 0 ),
-  initialTime( 0.0 ),
-  finalTime( 0.0 ),
-  snapshotPeriod( 0.0 ),
-  timeStep( 1.0 )
-{
-}
-
+template< typename Problem, typename TimeStepper >
+TimeDependentPDESolver< Problem, TimeStepper >::TimeDependentPDESolver()
+: problem( 0 ), initialTime( 0.0 ), finalTime( 0.0 ), snapshotPeriod( 0.0 ), timeStep( 1.0 )
+{}
 
-template< typename Problem,
-          typename TimeStepper >
+template< typename Problem, typename TimeStepper >
 void
-TimeDependentPDESolver< Problem, TimeStepper >::
-configSetup( Config::ConfigDescription& config,
-             const String& prefix )
+TimeDependentPDESolver< Problem, TimeStepper >::configSetup( Config::ConfigDescription& config, const String& prefix )
 {
    BaseType::configSetup( config, prefix );
    config.addEntry< String >( prefix + "initial-condition", "File name with the initial condition.", "init.vti" );
    config.addRequiredEntry< double >( prefix + "final-time", "Stop time of the time dependent problem." );
    config.addEntry< double >( prefix + "initial-time", "Initial time of the time dependent problem.", 0 );
-   config.addRequiredEntry< double >( prefix + "snapshot-period", "Time period for writing the problem status.");
+   config.addRequiredEntry< double >( prefix + "snapshot-period", "Time period for writing the problem status." );
    config.addEntry< double >( prefix + "time-step", "The time step for the time discretisation.", 1.0 );
-   config.addEntry< double >( prefix + "time-step-order", "The time step is set to time-step*pow( space-step, time-step-order).", 0.0 );
+   config.addEntry< double >(
+      prefix + "time-step-order", "The time step is set to time-step*pow( space-step, time-step-order).", 0.0 );
 }
 
-template< typename Problem,
-          typename TimeStepper >
+template< typename Problem, typename TimeStepper >
 bool
-TimeDependentPDESolver< Problem, TimeStepper >::
-setup( const Config::ParameterContainer& parameters,
-       const String& prefix )
+TimeDependentPDESolver< Problem, TimeStepper >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    BaseType::setup( parameters, prefix );
 
@@ -72,8 +59,7 @@ setup( const Config::ParameterContainer& parameters,
    /****
     * Set-up common data
     */
-   if( ! this->commonDataPointer->setup( parameters ) )
-   {
+   if( ! this->commonDataPointer->setup( parameters ) ) {
       std::cerr << "The problem common data initiation failed!" << std::endl;
       return false;
    }
@@ -82,8 +68,7 @@ setup( const Config::ParameterContainer& parameters,
    /****
     * Setup the problem
     */
-   if( ! problem->setup( parameters, prefix ) )
-   {
+   if( ! problem->setup( parameters, prefix ) ) {
       std::cerr << "The problem initiation failed!" << std::endl;
       return false;
    }
@@ -109,9 +94,9 @@ setup( const Config::ParameterContainer& parameters,
     */
    bool status = true;
    status &= this->setFinalTime( parameters.getParameter< double >( "final-time" ) );
-             this->setInitialTime( parameters.getParameter< double >( "initial-time" ) );
+   this->setInitialTime( parameters.getParameter< double >( "initial-time" ) );
    status &= this->setSnapshotPeriod( parameters.getParameter< double >( "snapshot-period" ) );
-   status &= this->setTimeStep( parameters.getParameter< double >( "time-step") );
+   status &= this->setTimeStep( parameters.getParameter< double >( "time-step" ) );
    status &= this->setTimeStepOrder( parameters.getParameter< double >( "time-step-order" ) );
    if( ! status )
       return false;
@@ -125,12 +110,9 @@ setup( const Config::ParameterContainer& parameters,
    return true;
 }
 
-template< typename Problem,
-          typename TimeStepper >
+template< typename Problem, typename TimeStepper >
 bool
-TimeDependentPDESolver< Problem, TimeStepper >::
-writeProlog( Logger& logger,
-             const Config::ParameterContainer& parameters )
+TimeDependentPDESolver< Problem, TimeStepper >::writeProlog( Logger& logger, const Config::ParameterContainer& parameters )
 {
    logger.writeHeader( problem->getPrologHeader() );
    problem->writeProlog( logger, parameters );
@@ -142,13 +124,14 @@ writeProlog( Logger& logger,
    logger.writeSeparator();
    logger.writeParameter< String >( "Time discretisation:", "time-discretisation", parameters );
    if( MPI::GetSize() > 1 )
-      logger.writeParameter< double >( "Initial time step:", this->getRefinedTimeStep( distributedMeshPointer->getLocalMesh(), this->timeStep ) );
+      logger.writeParameter< double >( "Initial time step:",
+                                       this->getRefinedTimeStep( distributedMeshPointer->getLocalMesh(), this->timeStep ) );
    else
       logger.writeParameter< double >( "Initial time step:", this->getRefinedTimeStep( *meshPointer, this->timeStep ) );
    logger.writeParameter< double >( "Initial time:", "initial-time", parameters );
    logger.writeParameter< double >( "Final time:", "final-time", parameters );
    logger.writeParameter< double >( "Snapshot period:", "snapshot-period", parameters );
-   const String& solverName = parameters. getParameter< String >( "discrete-solver" );
+   const String& solverName = parameters.getParameter< String >( "discrete-solver" );
    logger.writeParameter< String >( "Discrete solver:", "discrete-solver", parameters );
    if( solverName == "merson" )
       logger.writeParameter< double >( "Adaptivity:", "merson-adaptivity", parameters, 1 );
@@ -168,65 +151,52 @@ writeProlog( Logger& logger,
    return BaseType::writeProlog( logger, parameters );
 }
 
-template< typename Problem,
-          typename TimeStepper >
+template< typename Problem, typename TimeStepper >
 void
-TimeDependentPDESolver< Problem, TimeStepper >::
-setProblem( ProblemType& problem )
+TimeDependentPDESolver< Problem, TimeStepper >::setProblem( ProblemType& problem )
 {
    this->problem = &problem;
 }
 
-template< typename Problem,
-          typename TimeStepper >
+template< typename Problem, typename TimeStepper >
 void
-TimeDependentPDESolver< Problem, TimeStepper >::
-setInitialTime( const RealType& initialTime )
+TimeDependentPDESolver< Problem, TimeStepper >::setInitialTime( const RealType& initialTime )
 {
    this->initialTime = initialTime;
 }
 
-template< typename Problem,
-          typename TimeStepper >
+template< typename Problem, typename TimeStepper >
 const typename Problem::RealType&
-TimeDependentPDESolver< Problem, TimeStepper >::
-getInitialTime() const
+TimeDependentPDESolver< Problem, TimeStepper >::getInitialTime() const
 {
    return this->initialTime;
 }
 
-template< typename Problem,
-          typename TimeStepper >
+template< typename Problem, typename TimeStepper >
 bool
-TimeDependentPDESolver< Problem, TimeStepper >::
-setFinalTime( const RealType& finalTime )
+TimeDependentPDESolver< Problem, TimeStepper >::setFinalTime( const RealType& finalTime )
 {
-   if( finalTime <= this->initialTime )
-   {
-      std::cerr << "Final time for TimeDependentPDESolver must larger than the initial time which is now " << this->initialTime << "." << std::endl;
+   if( finalTime <= this->initialTime ) {
+      std::cerr << "Final time for TimeDependentPDESolver must larger than the initial time which is now " << this->initialTime
+                << "." << std::endl;
       return false;
    }
    this->finalTime = finalTime;
    return true;
 }
 
-template< typename Problem,
-          typename TimeStepper >
+template< typename Problem, typename TimeStepper >
 const typename Problem::RealType&
-TimeDependentPDESolver< Problem, TimeStepper >::
-getFinalTime() const
+TimeDependentPDESolver< Problem, TimeStepper >::getFinalTime() const
 {
    return this->finalTime;
 }
 
-template< typename Problem,
-          typename TimeStepper >
+template< typename Problem, typename TimeStepper >
 bool
-TimeDependentPDESolver< Problem, TimeStepper >::
-setSnapshotPeriod( const RealType& period )
+TimeDependentPDESolver< Problem, TimeStepper >::setSnapshotPeriod( const RealType& period )
 {
-   if( period <= 0 )
-   {
+   if( period <= 0 ) {
       std::cerr << "Snapshot tau for TimeDependentPDESolver must be positive value." << std::endl;
       return false;
    }
@@ -234,23 +204,18 @@ setSnapshotPeriod( const RealType& period )
    return true;
 }
 
-template< typename Problem,
-          typename TimeStepper >
+template< typename Problem, typename TimeStepper >
 const typename Problem::RealType&
-TimeDependentPDESolver< Problem, TimeStepper >::
-getSnapshotPeriod() const
+TimeDependentPDESolver< Problem, TimeStepper >::getSnapshotPeriod() const
 {
    return this->snapshotPeriod;
 }
 
-template< typename Problem,
-          typename TimeStepper >
+template< typename Problem, typename TimeStepper >
 bool
-TimeDependentPDESolver< Problem, TimeStepper >::
-setTimeStep( const RealType& timeStep )
+TimeDependentPDESolver< Problem, TimeStepper >::setTimeStep( const RealType& timeStep )
 {
-   if( timeStep <= 0 )
-   {
+   if( timeStep <= 0 ) {
       std::cerr << "The time step for TimeDependentPDESolver must be positive value." << std::endl;
       return false;
    }
@@ -258,25 +223,20 @@ setTimeStep( const RealType& timeStep )
    return true;
 }
 
-template< typename Problem,
-          typename TimeStepper >
+template< typename Problem, typename TimeStepper >
 const typename Problem::RealType&
-TimeDependentPDESolver< Problem, TimeStepper >::
-getTimeStep() const
+TimeDependentPDESolver< Problem, TimeStepper >::getTimeStep() const
 {
    return this->timeStep;
 }
 
-template< typename Problem,
-          typename TimeStepper >
+template< typename Problem, typename TimeStepper >
 bool
-TimeDependentPDESolver< Problem, TimeStepper >::
-solve()
+TimeDependentPDESolver< Problem, TimeStepper >::solve()
 {
    TNL_ASSERT_TRUE( problem, "No problem was set in PDESolver." );
 
-   if( snapshotPeriod == 0 )
-   {
+   if( snapshotPeriod == 0 ) {
       std::cerr << "No snapshot tau was set in TimeDependentPDESolver." << std::endl;
       return false;
    }
@@ -288,8 +248,7 @@ solve()
    this->computeTimer->reset();
 
    this->ioTimer->start();
-   if( ! this->problem->makeSnapshot( t, step, this->dofsPointer ) )
-   {
+   if( ! this->problem->makeSnapshot( t, step, this->dofsPointer ) ) {
       std::cerr << "Making the snapshot failed." << std::endl;
       return false;
    }
@@ -299,7 +258,7 @@ solve()
    /****
     * Initialize the time stepper
     */
-   this->timeStepper.setProblem( * ( this->problem ) );
+   this->timeStepper.setProblem( *( this->problem ) );
    if( MPI::GetSize() > 1 ) {
       this->timeStepper.init( distributedMeshPointer->getLocalMesh() );
       this->timeStepper.setTimeStep( this->getRefinedTimeStep( distributedMeshPointer->getLocalMesh(), this->timeStep ) );
@@ -308,19 +267,16 @@ solve()
       this->timeStepper.init( *meshPointer );
       this->timeStepper.setTimeStep( this->getRefinedTimeStep( *meshPointer, this->timeStep ) );
    }
-   while( step < allSteps )
-   {
-      RealType tau = min( this->snapshotPeriod,
-                          this->finalTime - t );
+   while( step < allSteps ) {
+      RealType tau = min( this->snapshotPeriod, this->finalTime - t );
       if( ! this->timeStepper.solve( t, t + tau, this->dofsPointer ) )
          return false;
-      step ++;
+      step++;
       t += tau;
 
       this->ioTimer->start();
       this->computeTimer->stop();
-      if( ! this->problem->makeSnapshot( t, step, this->dofsPointer ) )
-      {
+      if( ! this->problem->makeSnapshot( t, step, this->dofsPointer ) ) {
          std::cerr << "Making the snapshot failed." << std::endl;
          return false;
       }
@@ -334,16 +290,13 @@ solve()
    return true;
 }
 
-template< typename Problem,
-          typename TimeStepper >
+template< typename Problem, typename TimeStepper >
 bool
-TimeDependentPDESolver< Problem, TimeStepper >::
-writeEpilog( Logger& logger ) const
+TimeDependentPDESolver< Problem, TimeStepper >::writeEpilog( Logger& logger ) const
 {
-   return ( this->timeStepper.writeEpilog( logger ) &&
-      this->problem->writeEpilog( logger ) );
+   return ( this->timeStepper.writeEpilog( logger ) && this->problem->writeEpilog( logger ) );
 }
 
-} // namespace PDE
-} // namespace Solvers
-} // namespace TNL
+}  // namespace PDE
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/PDE/TimeIndependentPDESolver.h b/src/TNL/Solvers/PDE/TimeIndependentPDESolver.h
index cf5f6025f4a3e54acd92d1b4de5fb7eadc20bf4e..986876a1245e50d59eb5cad752a0e7d887923b2e 100644
--- a/src/TNL/Solvers/PDE/TimeIndependentPDESolver.h
+++ b/src/TNL/Solvers/PDE/TimeIndependentPDESolver.h
@@ -29,57 +29,55 @@ namespace Solvers {
 namespace PDE {
 
 template< typename Problem >
-class TimeIndependentPDESolver : public PDESolver< typename Problem::RealType,
-                                                   typename Problem::IndexType >
+class TimeIndependentPDESolver : public PDESolver< typename Problem::RealType, typename Problem::IndexType >
 {
-   public:
+public:
+   using RealType = typename Problem::RealType;
+   using DeviceType = typename Problem::DeviceType;
+   using IndexType = typename Problem::IndexType;
+   using BaseType = PDESolver< RealType, IndexType >;
+   using ProblemType = Problem;
+   using MeshType = typename ProblemType::MeshType;
+   using DofVectorType = typename ProblemType::DofVectorType;
+   using MeshPointer = Pointers::SharedPointer< MeshType, DeviceType >;
+   using DofVectorPointer = Pointers::SharedPointer< DofVectorType, DeviceType >;
+   using CommonDataType = typename ProblemType::CommonDataType;
+   using CommonDataPointer = typename ProblemType::CommonDataPointer;
 
-      using RealType = typename Problem::RealType;
-      using DeviceType = typename Problem::DeviceType;
-      using IndexType = typename Problem::IndexType;
-      using BaseType = PDESolver< RealType, IndexType >;
-      using ProblemType = Problem;
-      typedef typename ProblemType::MeshType MeshType;
-      typedef typename ProblemType::DofVectorType DofVectorType;
-      typedef Pointers::SharedPointer< MeshType, DeviceType > MeshPointer;
-      typedef Pointers::SharedPointer< DofVectorType, DeviceType > DofVectorPointer;
-      typedef typename ProblemType::CommonDataType CommonDataType;
-      typedef typename ProblemType::CommonDataPointer CommonDataPointer;
+   TimeIndependentPDESolver();
 
+   static void
+   configSetup( Config::ConfigDescription& config, const String& prefix = "" );
 
-      TimeIndependentPDESolver();
+   bool
+   setup( const Config::ParameterContainer& parameters, const String& prefix = "" );
 
-      static void configSetup( Config::ConfigDescription& config,
-                               const String& prefix = "" );
+   bool
+   writeProlog( Logger& logger, const Config::ParameterContainer& parameters );
 
-      bool setup( const Config::ParameterContainer& parameters,
-                  const String& prefix = "" );
+   void
+   setProblem( ProblemType& problem );
 
-      bool writeProlog( Logger& logger,
-                        const Config::ParameterContainer& parameters );
+   bool
+   solve();
 
+   bool
+   writeEpilog( Logger& logger ) const;
 
-      void setProblem( ProblemType& problem );
+protected:
+   MeshPointer meshPointer;
 
-      bool solve();
+   Pointers::SharedPointer< Meshes::DistributedMeshes::DistributedMesh< MeshType > > distributedMeshPointer;
 
-      bool writeEpilog( Logger& logger ) const;
+   CommonDataPointer commonDataPointer;
 
-   protected:
+   DofVectorPointer dofs;
 
-      MeshPointer meshPointer;
-
-      Pointers::SharedPointer< Meshes::DistributedMeshes::DistributedMesh<MeshType> > distributedMeshPointer;
-
-      CommonDataPointer commonDataPointer;
-
-      DofVectorPointer dofs;
-
-      ProblemType* problem;
+   ProblemType* problem;
 };
 
-} // namespace PDE
-} // namespace Solvers
-} // namespace TNL
+}  // namespace PDE
+}  // namespace Solvers
+}  // namespace TNL
 
 #include <TNL/Solvers/PDE/TimeIndependentPDESolver.hpp>
diff --git a/src/TNL/Solvers/PDE/TimeIndependentPDESolver.hpp b/src/TNL/Solvers/PDE/TimeIndependentPDESolver.hpp
index 5ee6f8b751b22ef869217672d778f28cb148afb3..4ec84a13a8f8e9161a35a2724813e664c5233141 100644
--- a/src/TNL/Solvers/PDE/TimeIndependentPDESolver.hpp
+++ b/src/TNL/Solvers/PDE/TimeIndependentPDESolver.hpp
@@ -24,27 +24,18 @@ namespace TNL {
 namespace Solvers {
 namespace PDE {
 
-
 template< typename Problem >
-TimeIndependentPDESolver< Problem >::
-TimeIndependentPDESolver()
-: problem( 0 )
-{
-}
+TimeIndependentPDESolver< Problem >::TimeIndependentPDESolver() : problem( 0 )
+{}
 
 template< typename Problem >
 void
-TimeIndependentPDESolver< Problem >::
-configSetup( Config::ConfigDescription& config,
-             const String& prefix )
-{
-}
+TimeIndependentPDESolver< Problem >::configSetup( Config::ConfigDescription& config, const String& prefix )
+{}
 
 template< typename Problem >
 bool
-TimeIndependentPDESolver< Problem >::
-setup( const Config::ParameterContainer& parameters,
-       const String& prefix )
+TimeIndependentPDESolver< Problem >::setup( const Config::ParameterContainer& parameters, const String& prefix )
 {
    /////
    // Load the mesh from the mesh file
@@ -65,8 +56,7 @@ setup( const Config::ParameterContainer& parameters,
    /****
     * Set-up common data
     */
-   if( ! this->commonDataPointer->setup( parameters ) )
-   {
+   if( ! this->commonDataPointer->setup( parameters ) ) {
       std::cerr << "The problem common data initiation failed!" << std::endl;
       return false;
    }
@@ -75,8 +65,7 @@ setup( const Config::ParameterContainer& parameters,
    /****
     * Setup the problem
     */
-   if( ! problem->setup( parameters, prefix ) )
-   {
+   if( ! problem->setup( parameters, prefix ) ) {
       std::cerr << "The problem initiation failed!" << std::endl;
       return false;
    }
@@ -89,7 +78,6 @@ setup( const Config::ParameterContainer& parameters,
    this->dofs->setValue( 0.0 );
    this->problem->bindDofs( this->dofs );
 
-
    /***
     * Set-up the initial condition
     */
@@ -103,9 +91,7 @@ setup( const Config::ParameterContainer& parameters,
 
 template< typename Problem >
 bool
-TimeIndependentPDESolver< Problem >::
-writeProlog( Logger& logger,
-             const Config::ParameterContainer& parameters )
+TimeIndependentPDESolver< Problem >::writeProlog( Logger& logger, const Config::ParameterContainer& parameters )
 {
    logger.writeHeader( problem->getPrologHeader() );
    problem->writeProlog( logger, parameters );
@@ -115,7 +101,7 @@ writeProlog( Logger& logger,
    else
       meshPointer->writeProlog( logger );
    logger.writeSeparator();
-   const String& solverName = parameters. getParameter< String >( "discrete-solver" );
+   const String& solverName = parameters.getParameter< String >( "discrete-solver" );
    logger.writeParameter< String >( "Discrete solver:", "discrete-solver", parameters );
    if( solverName == "sor" )
       logger.writeParameter< double >( "Omega:", "sor-omega", parameters, 1 );
@@ -131,23 +117,20 @@ writeProlog( Logger& logger,
 
 template< typename Problem >
 void
-TimeIndependentPDESolver< Problem >::
-setProblem( ProblemType& problem )
+TimeIndependentPDESolver< Problem >::setProblem( ProblemType& problem )
 {
    this->problem = &problem;
 }
 
 template< typename Problem >
 bool
-TimeIndependentPDESolver< Problem >::
-solve()
+TimeIndependentPDESolver< Problem >::solve()
 {
    TNL_ASSERT_TRUE( problem, "No problem was set in tnlPDESolver." );
 
    this->computeTimer->reset();
    this->computeTimer->start();
-   if( ! this->problem->solve( this->dofs ) )
-   {
+   if( ! this->problem->solve( this->dofs ) ) {
       this->computeTimer->stop();
       return false;
    }
@@ -157,12 +140,11 @@ solve()
 
 template< typename Problem >
 bool
-TimeIndependentPDESolver< Problem >::
-writeEpilog( Logger& logger ) const
+TimeIndependentPDESolver< Problem >::writeEpilog( Logger& logger ) const
 {
    return this->problem->writeEpilog( logger );
 }
 
-} // namespace PDE
-} // namespace Solvers
-} // namespace TNL
+}  // namespace PDE
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/Solver.h b/src/TNL/Solvers/Solver.h
index fd7ddec950b5d368dc4d68860d57023fdaa74a0e..9e36f7a8d98ff900cc4130631858bfa628c7d727 100644
--- a/src/TNL/Solvers/Solver.h
+++ b/src/TNL/Solvers/Solver.h
@@ -18,17 +18,21 @@
 namespace TNL {
 namespace Solvers {
 
-template< template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > class ProblemSetter,
-          template< typename ConfigTag > class ProblemConfig,
-          typename ConfigTag = DefaultBuildConfigTag >
+template<
+   template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter >
+   class ProblemSetter,
+   template< typename ConfigTag >
+   class ProblemConfig,
+   typename ConfigTag = DefaultBuildConfigTag >
 struct Solver
 {
-   static bool run( int argc, char* argv[] )
+   static bool
+   run( int argc, char* argv[] )
    {
       Config::ParameterContainer parameters;
       Config::ConfigDescription configDescription;
       ProblemConfig< ConfigTag >::configSetup( configDescription );
-      SolverConfig< ConfigTag, ProblemConfig< ConfigTag> >::configSetup( configDescription );
+      SolverConfig< ConfigTag, ProblemConfig< ConfigTag > >::configSetup( configDescription );
       configDescription.addDelimiter( "Parallelization setup:" );
       Devices::Host::configSetup( configDescription );
       Devices::Cuda::configSetup( configDescription );
@@ -44,5 +48,5 @@ struct Solver
    }
 };
 
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/SolverConfig.h b/src/TNL/Solvers/SolverConfig.h
index 3b45a1566bebc50320c4d022c6cb7ff702774554..b2c19efcf7488f4b58959a3233fe0e9b7c78b05e 100644
--- a/src/TNL/Solvers/SolverConfig.h
+++ b/src/TNL/Solvers/SolverConfig.h
@@ -17,11 +17,11 @@
 namespace TNL {
 namespace Solvers {
 
-template< typename ConfigTag,
-          typename ProblemConfig >
+template< typename ConfigTag, typename ProblemConfig >
 struct SolverConfig
 {
-   static bool configSetup( Config::ConfigDescription& config )
+   static bool
+   configSetup( Config::ConfigDescription& config )
    {
       config.addDelimiter( " === General parameters ==== " );
       config.addEntry< bool >( "catch-exceptions",
@@ -31,9 +31,7 @@ struct SolverConfig
       /****
        * Setup real type
        */
-      config.addEntry< String >( "real-type",
-                                    "Precision of the floating point arithmetics.",
-                                    "double" );
+      config.addEntry< String >( "real-type", "Precision of the floating point arithmetics.", "double" );
       if( ConfigTagReal< ConfigTag, float >::enabled )
          config.addEntryEnum( "float" );
       if( ConfigTagReal< ConfigTag, double >::enabled )
@@ -44,9 +42,7 @@ struct SolverConfig
       /****
        * Setup device.
        */
-      config.addEntry< String >( "device",
-                                    "Device to use for the computations.",
-                                    "host" );
+      config.addEntry< String >( "device", "Device to use for the computations.", "host" );
       if( ConfigTagDevice< ConfigTag, Devices::Host >::enabled )
          config.addEntryEnum( "host" );
 #ifdef HAVE_CUDA
@@ -57,9 +53,7 @@ struct SolverConfig
       /****
        * Setup index type.
        */
-      config.addEntry< String >( "index-type",
-                                    "Indexing type for arrays, vectors, matrices etc.",
-                                    "int" );
+      config.addEntry< String >( "index-type", "Indexing type for arrays, vectors, matrices etc.", "int" );
       if( ConfigTagIndex< ConfigTag, short int >::enabled )
          config.addEntryEnum( "short-int" );
 
@@ -73,22 +67,25 @@ struct SolverConfig
        * Mesh file parameter
        */
       config.addDelimiter( " === Space discretisation parameters ==== " );
-      config.addEntry< String >( "mesh", "A file which contains the numerical mesh. You may create it with tools like tnl-grid-setup or tnl-mesh-convert.", "mesh.vti" );
+      config.addEntry< String >(
+         "mesh",
+         "A file which contains the numerical mesh. You may create it with tools like tnl-grid-setup or tnl-mesh-convert.",
+         "mesh.vti" );
       config.addEntry< String >( "mesh-format", "Mesh file format.", "auto" );
 
       /****
        * Time discretisation
        */
       config.addDelimiter( " === Time discretisation parameters ==== " );
-      using PDEProblem = Problems::PDEProblem< Meshes::Grid<1, double, Devices::Host, int> >;
+      using PDEProblem = Problems::PDEProblem< Meshes::Grid< 1, double, Devices::Host, int > >;
       using ExplicitTimeStepper = PDE::ExplicitTimeStepper< PDEProblem, ODE::Euler >;
       PDE::TimeDependentPDESolver< PDEProblem, ExplicitTimeStepper >::configSetup( config );
       ExplicitTimeStepper::configSetup( config );
-      if( ConfigTagTimeDiscretisation< ConfigTag, ExplicitTimeDiscretisationTag >::enabled ||
-          ConfigTagTimeDiscretisation< ConfigTag, SemiImplicitTimeDiscretisationTag >::enabled ||
-          ConfigTagTimeDiscretisation< ConfigTag, ImplicitTimeDiscretisationTag >::enabled )
+      if( ConfigTagTimeDiscretisation< ConfigTag, ExplicitTimeDiscretisationTag >::enabled
+          || ConfigTagTimeDiscretisation< ConfigTag, SemiImplicitTimeDiscretisationTag >::enabled
+          || ConfigTagTimeDiscretisation< ConfigTag, ImplicitTimeDiscretisationTag >::enabled )
       {
-         config.addRequiredEntry< String >( "time-discretisation", "Discratisation in time.");
+         config.addRequiredEntry< String >( "time-discretisation", "Discratisation in time." );
          if( ConfigTagTimeDiscretisation< ConfigTag, ExplicitTimeDiscretisationTag >::enabled )
             config.addEntryEnum( "explicit" );
          if( ConfigTagTimeDiscretisation< ConfigTag, SemiImplicitTimeDiscretisationTag >::enabled )
@@ -97,29 +94,26 @@ struct SolverConfig
             config.addEntryEnum( "implicit" );
       }
       config.addRequiredEntry< String >( "discrete-solver", "The solver of the discretised problem:" );
-      if( ConfigTagTimeDiscretisation< ConfigTag, ExplicitTimeDiscretisationTag >::enabled )
-      {
+      if( ConfigTagTimeDiscretisation< ConfigTag, ExplicitTimeDiscretisationTag >::enabled ) {
          if( ConfigTagExplicitSolver< ConfigTag, ExplicitEulerSolverTag >::enabled )
             config.addEntryEnum( "euler" );
          if( ConfigTagExplicitSolver< ConfigTag, ExplicitMersonSolverTag >::enabled )
             config.addEntryEnum( "merson" );
       }
-      if( ConfigTagTimeDiscretisation< ConfigTag, SemiImplicitTimeDiscretisationTag >::enabled )
-      {
+      if( ConfigTagTimeDiscretisation< ConfigTag, SemiImplicitTimeDiscretisationTag >::enabled ) {
          for( auto o : getLinearSolverOptions() )
             config.addEntryEnum( String( o ) );
          config.addEntry< String >( "preconditioner", "The preconditioner for the discrete solver:", "none" );
          for( auto o : getPreconditionerOptions() )
             config.addEntryEnum( String( o ) );
       }
-      if( ConfigTagTimeDiscretisation< ConfigTag, ExplicitTimeDiscretisationTag >::enabled ||
-          ConfigTagTimeDiscretisation< ConfigTag, SemiImplicitTimeDiscretisationTag >::enabled )
+      if( ConfigTagTimeDiscretisation< ConfigTag, ExplicitTimeDiscretisationTag >::enabled
+          || ConfigTagTimeDiscretisation< ConfigTag, SemiImplicitTimeDiscretisationTag >::enabled )
       {
          config.addDelimiter( " === Iterative solvers parameters === " );
          IterativeSolver< double, int >::configSetup( config );
       }
-      if( ConfigTagTimeDiscretisation< ConfigTag, ExplicitTimeDiscretisationTag >::enabled )
-      {
+      if( ConfigTagTimeDiscretisation< ConfigTag, ExplicitTimeDiscretisationTag >::enabled ) {
          config.addDelimiter( " === Explicit solvers parameters === " );
          ODE::ExplicitSolver< PDEProblem >::configSetup( config );
          if( ConfigTagExplicitSolver< ConfigTag, ExplicitEulerSolverTag >::enabled )
@@ -128,8 +122,7 @@ struct SolverConfig
          if( ConfigTagExplicitSolver< ConfigTag, ExplicitMersonSolverTag >::enabled )
             ODE::Merson< PDEProblem >::configSetup( config );
       }
-      if( ConfigTagTimeDiscretisation< ConfigTag, SemiImplicitTimeDiscretisationTag >::enabled )
-      {
+      if( ConfigTagTimeDiscretisation< ConfigTag, SemiImplicitTimeDiscretisationTag >::enabled ) {
          config.addDelimiter( " === Semi-implicit solvers parameters === " );
          using MatrixType = Matrices::SparseMatrix< double >;
          Linear::CG< MatrixType >::configSetup( config );
@@ -152,5 +145,5 @@ struct SolverConfig
    }
 };
 
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/SolverInitiator.h b/src/TNL/Solvers/SolverInitiator.h
index 0f7f48bf97726591e0a3dae935855e9e2b61ea0e..d9c9554ecad1a0d40ba7b9f2dc592c9cdfcaf1ea 100644
--- a/src/TNL/Solvers/SolverInitiator.h
+++ b/src/TNL/Solvers/SolverInitiator.h
@@ -12,17 +12,18 @@
 namespace TNL {
 namespace Solvers {
 
-template< template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > class ProblemSetter,
-          typename ConfigTag >
+template<
+   template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter >
+   class ProblemSetter,
+   typename ConfigTag >
 class SolverInitiator
 {
-   public:
-
-   static bool run( const Config::ParameterContainer& parameters );
-
+public:
+   static bool
+   run( const Config::ParameterContainer& parameters );
 };
 
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Solvers
+}  // namespace TNL
 
 #include <TNL/Solvers/SolverInitiator.hpp>
diff --git a/src/TNL/Solvers/SolverInitiator.hpp b/src/TNL/Solvers/SolverInitiator.hpp
index 4d57537f4e5fbf3b5c48342ea1a7709f31117b6b..c1a9df8e4cf782cf36223a14830542c14cbd933f 100644
--- a/src/TNL/Solvers/SolverInitiator.hpp
+++ b/src/TNL/Solvers/SolverInitiator.hpp
@@ -17,41 +17,55 @@
 namespace TNL {
 namespace Solvers {
 
-template< template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > class ProblemSetter,
-          typename Real,
-          typename ConfigTag,
-          bool enabled = ConfigTagReal< ConfigTag, Real >::enabled >
-class SolverInitiatorRealResolver {};
-
-template< template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > class ProblemSetter,
-          typename Real,
-          typename Device,
-          typename ConfigTag,
-          bool enabled = ConfigTagDevice< ConfigTag, Device >::enabled >
-class SolverInitiatorDeviceResolver {};
-
-template< template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > class ProblemSetter,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename ConfigTag,
-          bool enabled = ConfigTagIndex< ConfigTag, Index >::enabled >
-class SolverInitiatorIndexResolver {};
-
-template< template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > class ProblemSetter,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename ConfigTag,
-          bool enabled = ConfigTagMeshResolve< ConfigTag >::enabled >
-class SolverInitiatorMeshResolver {};
-
-
-template< template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > class ProblemSetter,
-          typename ConfigTag  >
-bool SolverInitiator< ProblemSetter, ConfigTag > :: run( const Config::ParameterContainer& parameters )
+template<
+   template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter >
+   class ProblemSetter,
+   typename Real,
+   typename ConfigTag,
+   bool enabled = ConfigTagReal< ConfigTag, Real >::enabled >
+class SolverInitiatorRealResolver
+{};
+
+template<
+   template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter >
+   class ProblemSetter,
+   typename Real,
+   typename Device,
+   typename ConfigTag,
+   bool enabled = ConfigTagDevice< ConfigTag, Device >::enabled >
+class SolverInitiatorDeviceResolver
+{};
+
+template<
+   template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter >
+   class ProblemSetter,
+   typename Real,
+   typename Device,
+   typename Index,
+   typename ConfigTag,
+   bool enabled = ConfigTagIndex< ConfigTag, Index >::enabled >
+class SolverInitiatorIndexResolver
+{};
+
+template<
+   template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter >
+   class ProblemSetter,
+   typename Real,
+   typename Device,
+   typename Index,
+   typename ConfigTag,
+   bool enabled = ConfigTagMeshResolve< ConfigTag >::enabled >
+class SolverInitiatorMeshResolver
+{};
+
+template<
+   template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter >
+   class ProblemSetter,
+   typename ConfigTag >
+bool
+SolverInitiator< ProblemSetter, ConfigTag >::run( const Config::ParameterContainer& parameters )
 {
-   const String& realType = parameters. getParameter< String >( "real-type" );
+   const String& realType = parameters.getParameter< String >( "real-type" );
    if( realType == "float" )
       return SolverInitiatorRealResolver< ProblemSetter, float, ConfigTag >::run( parameters );
    if( realType == "double" )
@@ -62,143 +76,168 @@ bool SolverInitiator< ProblemSetter, ConfigTag > :: run( const Config::Parameter
    return false;
 };
 
-template< template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > class ProblemSetter,
-          typename Real,
-          typename ConfigTag >
+template<
+   template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter >
+   class ProblemSetter,
+   typename Real,
+   typename ConfigTag >
 class SolverInitiatorRealResolver< ProblemSetter, Real, ConfigTag, true >
 {
-   public:
-      static bool run( const Config::ParameterContainer& parameters )
-      {
-         const String& device = parameters. getParameter< String >( "device" );
-         if( device == "host" )
-            return SolverInitiatorDeviceResolver< ProblemSetter, Real, Devices::Host, ConfigTag >::run( parameters );
-         if( device == "cuda" )
-            return SolverInitiatorDeviceResolver< ProblemSetter, Real, Devices::Cuda, ConfigTag >::run( parameters );
-         std::cerr << "The device '" << device << "' is not defined. " << std::endl;
-         return false;
-      }
+public:
+   static bool
+   run( const Config::ParameterContainer& parameters )
+   {
+      const String& device = parameters.getParameter< String >( "device" );
+      if( device == "host" )
+         return SolverInitiatorDeviceResolver< ProblemSetter, Real, Devices::Host, ConfigTag >::run( parameters );
+      if( device == "cuda" )
+         return SolverInitiatorDeviceResolver< ProblemSetter, Real, Devices::Cuda, ConfigTag >::run( parameters );
+      std::cerr << "The device '" << device << "' is not defined. " << std::endl;
+      return false;
+   }
 };
 
-template< template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > class ProblemSetter,
-          typename Real,
-          typename ConfigTag >
+template<
+   template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter >
+   class ProblemSetter,
+   typename Real,
+   typename ConfigTag >
 class SolverInitiatorRealResolver< ProblemSetter, Real, ConfigTag, false >
 {
-   public:
-      static bool run( const Config::ParameterContainer& parameters )
-      {
-         std::cerr << "The real type " << parameters.getParameter< String >( "real-type" ) << " is not supported." << std::endl;
-         return false;
-      }
+public:
+   static bool
+   run( const Config::ParameterContainer& parameters )
+   {
+      std::cerr << "The real type " << parameters.getParameter< String >( "real-type" ) << " is not supported." << std::endl;
+      return false;
+   }
 };
 
-template< template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > class ProblemSetter,
-          typename Real,
-          typename Device,
-          typename ConfigTag >
+template<
+   template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter >
+   class ProblemSetter,
+   typename Real,
+   typename Device,
+   typename ConfigTag >
 class SolverInitiatorDeviceResolver< ProblemSetter, Real, Device, ConfigTag, true >
 {
-   public:
-      static bool run( const Config::ParameterContainer& parameters )
-      {
-         const String& indexType = parameters. getParameter< String >( "index-type" );
-         if( indexType == "short-int" )
-            return SolverInitiatorIndexResolver< ProblemSetter, Real, Device, short int, ConfigTag >::run( parameters );
-         if( indexType == "int" )
-            return SolverInitiatorIndexResolver< ProblemSetter, Real, Device, int, ConfigTag >::run( parameters );
-         if( indexType == "long int" )
-            return SolverInitiatorIndexResolver< ProblemSetter, Real, Device, long int, ConfigTag >::run( parameters );
-         std::cerr << "The index type '" << indexType << "' is not defined. " << std::endl;
-         return false;
-      }
+public:
+   static bool
+   run( const Config::ParameterContainer& parameters )
+   {
+      const String& indexType = parameters.getParameter< String >( "index-type" );
+      if( indexType == "short-int" )
+         return SolverInitiatorIndexResolver< ProblemSetter, Real, Device, short int, ConfigTag >::run( parameters );
+      if( indexType == "int" )
+         return SolverInitiatorIndexResolver< ProblemSetter, Real, Device, int, ConfigTag >::run( parameters );
+      if( indexType == "long int" )
+         return SolverInitiatorIndexResolver< ProblemSetter, Real, Device, long int, ConfigTag >::run( parameters );
+      std::cerr << "The index type '" << indexType << "' is not defined. " << std::endl;
+      return false;
+   }
 };
 
-template< template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > class ProblemSetter,
-          typename Real,
-          typename Device,
-          typename ConfigTag >
+template<
+   template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter >
+   class ProblemSetter,
+   typename Real,
+   typename Device,
+   typename ConfigTag >
 class SolverInitiatorDeviceResolver< ProblemSetter, Real, Device, ConfigTag, false >
 {
-   public:
-      static bool run( const Config::ParameterContainer& parameters )
-      {
-         std::cerr << "The device " << parameters.getParameter< String >( "device" ) << " is not supported." << std::endl;
-         return false;
-      }
+public:
+   static bool
+   run( const Config::ParameterContainer& parameters )
+   {
+      std::cerr << "The device " << parameters.getParameter< String >( "device" ) << " is not supported." << std::endl;
+      return false;
+   }
 };
 
-template< template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > class ProblemSetter,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename ConfigTag >
+template<
+   template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter >
+   class ProblemSetter,
+   typename Real,
+   typename Device,
+   typename Index,
+   typename ConfigTag >
 class SolverInitiatorIndexResolver< ProblemSetter, Real, Device, Index, ConfigTag, false >
 {
-   public:
-      static bool run( const Config::ParameterContainer& parameters )
-      {
-         std::cerr << "The index " << parameters.getParameter< String >( "index-type" ) << " is not supported." << std::endl;
-         return false;
-      }
+public:
+   static bool
+   run( const Config::ParameterContainer& parameters )
+   {
+      std::cerr << "The index " << parameters.getParameter< String >( "index-type" ) << " is not supported." << std::endl;
+      return false;
+   }
 };
 
-template< template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > class ProblemSetter,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename ConfigTag >
+template<
+   template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter >
+   class ProblemSetter,
+   typename Real,
+   typename Device,
+   typename Index,
+   typename ConfigTag >
 class SolverInitiatorIndexResolver< ProblemSetter, Real, Device, Index, ConfigTag, true >
 {
-   public:
-      static bool run( const Config::ParameterContainer& parameters )
-      {
-         return SolverInitiatorMeshResolver< ProblemSetter, Real, Device, Index, ConfigTag >::run( parameters );
-      }
+public:
+   static bool
+   run( const Config::ParameterContainer& parameters )
+   {
+      return SolverInitiatorMeshResolver< ProblemSetter, Real, Device, Index, ConfigTag >::run( parameters );
+   }
 };
 
-template< template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > class ProblemSetter,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename ConfigTag >
+template<
+   template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter >
+   class ProblemSetter,
+   typename Real,
+   typename Device,
+   typename Index,
+   typename ConfigTag >
 class SolverInitiatorMeshResolver< ProblemSetter, Real, Device, Index, ConfigTag, false >
 {
-   public:
-      static bool run( const Config::ParameterContainer& parameters )
-      {
-         return ProblemSetter< Real,
-                               Device,
-                               Index,
-                               Meshes::DummyMesh< Real, Device, Index >,
-                               ConfigTag,
-                               SolverStarter< ConfigTag > >::template run< Real, Device, Index, ConfigTag >( parameters );
-      }
+public:
+   static bool
+   run( const Config::ParameterContainer& parameters )
+   {
+      return ProblemSetter< Real,
+                            Device,
+                            Index,
+                            Meshes::DummyMesh< Real, Device, Index >,
+                            ConfigTag,
+                            SolverStarter< ConfigTag > >::template run< Real, Device, Index, ConfigTag >( parameters );
+   }
 };
 
-template< template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter > class ProblemSetter,
-          typename Real,
-          typename Device,
-          typename Index,
-          typename ConfigTag >
+template<
+   template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter >
+   class ProblemSetter,
+   typename Real,
+   typename Device,
+   typename Index,
+   typename ConfigTag >
 class SolverInitiatorMeshResolver< ProblemSetter, Real, Device, Index, ConfigTag, true >
 {
    // wrapper for MeshTypeResolver
    template< typename MeshType >
    using ProblemSetterWrapper = ProblemSetter< Real, Device, Index, MeshType, ConfigTag, SolverStarter< ConfigTag > >;
 
-   public:
-      static bool run( const Config::ParameterContainer& parameters )
+public:
+   static bool
+   run( const Config::ParameterContainer& parameters )
+   {
+      const String& meshFileName = parameters.getParameter< String >( "mesh" );
+      const String& meshFileFormat = parameters.getParameter< String >( "mesh-format" );
+      auto wrapper = [ & ]( const auto& reader, auto&& mesh )
       {
-         const String& meshFileName = parameters.getParameter< String >( "mesh" );
-         const String& meshFileFormat = parameters.getParameter< String >( "mesh-format" );
-         auto wrapper = [&]( const auto& reader, auto&& mesh ) {
-            using MeshType = std::decay_t< decltype(mesh) >;
-             return ProblemSetterWrapper< MeshType >::run( parameters );
-         };
-         return Meshes::resolveMeshType< ConfigTag, Device >( wrapper, meshFileName, meshFileFormat );
-      }
+         using MeshType = std::decay_t< decltype( mesh ) >;
+         return ProblemSetterWrapper< MeshType >::run( parameters );
+      };
+      return Meshes::resolveMeshType< ConfigTag, Device >( wrapper, meshFileName, meshFileFormat );
+   }
 };
 
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/SolverMonitor.h b/src/TNL/Solvers/SolverMonitor.h
index f91188fc7abeda5841f5813a43e8ebfdcf22db02..ee70e806da1d87808697ef3921b8218d414be328 100644
--- a/src/TNL/Solvers/SolverMonitor.h
+++ b/src/TNL/Solvers/SolverMonitor.h
@@ -12,7 +12,7 @@
 #include <TNL/Timer.h>
 
 namespace TNL {
-   namespace Solvers {
+namespace Solvers {
 
 /**
  * \brief Base class for solver monitors.
@@ -22,98 +22,112 @@ namespace TNL {
  */
 class SolverMonitor
 {
-   public:
-
-      /**
-       * \brief Basic construct with no arguments
-       */
-      SolverMonitor()
-         : timeout_milliseconds( 500 ),
-         started( false ),
-         stopped( false ),
-         timer( nullptr )
-      {}
-
-      /**
-       * \brief This abstract method is responsible for printing or visualizing the status of the solver.
-       */
-      virtual void refresh() = 0;
-
-      /**
-       * \brief Set the time interval between two consecutive calls of \ref SolverMonitor::refresh.
-       *
-       * \param refreshRate refresh rate in miliseconds.
-       */
-      void setRefreshRate( const int& refreshRate ) { timeout_milliseconds = refreshRate; }
-
-      /**
-       * \brief Set a timer object for the solver monitor.
-       *
-       * If a timer is set, the monitor can measure real elapsed time since the start of the solver.
-       *
-       * \param timer is an instance of \ref TNL::Timer.
-       */
-      void setTimer( Timer& timer ) { this->timer = &timer; }
-
-      /**
-       * \brief Starts the main loop from which the method \ref SolverMonitor::refresh is called in given time periods.
-       */
-      void runMainLoop()
-      {
-         // We need to use both 'started' and 'stopped' to avoid a deadlock
-         // when the loop thread runs this method delayed after the
-         // SolverMonitorThread's destructor has already called stopMainLoop()
-         // from the main thread.
-         started = true;
-
-         const int timeout_base = 100;
-         const std::chrono::milliseconds timeout( timeout_base );
-
-         while( ! stopped ) {
-            refresh();
-
-            // make sure to detect changes to refresh rate
-            int steps = timeout_milliseconds / timeout_base;
-            if( steps <= 0 )
-               steps = 1;
-
-            int i = 0;
-            while( ! stopped && i++ < steps ) {
-               std::this_thread::sleep_for( timeout );
-            }
+public:
+   /**
+    * \brief Basic construct with no arguments
+    */
+   SolverMonitor() = default;
+
+   /**
+    * \brief This abstract method is responsible for printing or visualizing the status of the solver.
+    */
+   virtual void
+   refresh() = 0;
+
+   /**
+    * \brief Set the time interval between two consecutive calls of \ref SolverMonitor::refresh.
+    *
+    * \param refreshRate refresh rate in miliseconds.
+    */
+   void
+   setRefreshRate( const int& refreshRate )
+   {
+      timeout_milliseconds = refreshRate;
+   }
+
+   /**
+    * \brief Set a timer object for the solver monitor.
+    *
+    * If a timer is set, the monitor can measure real elapsed time since the start of the solver.
+    *
+    * \param timer is an instance of \ref TNL::Timer.
+    */
+   void
+   setTimer( Timer& timer )
+   {
+      this->timer = &timer;
+   }
+
+   /**
+    * \brief Starts the main loop from which the method \ref SolverMonitor::refresh is called in given time periods.
+    */
+   void
+   runMainLoop()
+   {
+      // We need to use both 'started' and 'stopped' to avoid a deadlock
+      // when the loop thread runs this method delayed after the
+      // SolverMonitorThread's destructor has already called stopMainLoop()
+      // from the main thread.
+      started = true;
+
+      const int timeout_base = 100;
+      const std::chrono::milliseconds timeout( timeout_base );
+
+      while( ! stopped ) {
+         refresh();
+
+         // make sure to detect changes to refresh rate
+         int steps = timeout_milliseconds / timeout_base;
+         if( steps <= 0 )
+            steps = 1;
+
+         int i = 0;
+         while( ! stopped && i++ < steps ) {
+            std::this_thread::sleep_for( timeout );
          }
-
-         // reset to initial state
-         started = false;
-         stopped = false;
-      }
-
-      /**
-       * \brief Stops the main loop of the monitor. See \ref TNL::SolverMonitor::runMainLoop.
-       */
-      void stopMainLoop() { stopped = true; }
-
-      /**
-       * \brief Checks whether the main loop was stopped.
-       *
-       * \return true if the main loop was stopped.
-       * \return false if the main loop was not stopped yet.
-       */
-      bool isStopped() const { return stopped; }
-
-   protected:
-      double getElapsedTime()
-      {
-         if( ! timer )
-            return 0.0;
-         return timer->getRealTime();
       }
 
-      std::atomic_int timeout_milliseconds;
-
-      std::atomic_bool started, stopped;
-
-      Timer* timer;
+      // reset to initial state
+      started = false;
+      stopped = false;
+   }
+
+   /**
+    * \brief Stops the main loop of the monitor. See \ref TNL::SolverMonitor::runMainLoop.
+    */
+   void
+   stopMainLoop()
+   {
+      stopped = true;
+   }
+
+   /**
+    * \brief Checks whether the main loop was stopped.
+    *
+    * \return true if the main loop was stopped.
+    * \return false if the main loop was not stopped yet.
+    */
+   bool
+   isStopped() const
+   {
+      return stopped;
+   }
+
+protected:
+   double
+   getElapsedTime()
+   {
+      if( timer == nullptr )
+         return 0.0;
+      return timer->getRealTime();
+   }
+
+   std::atomic_int timeout_milliseconds{ 500 };
+
+   std::atomic_bool started{ false };
+   std::atomic_bool stopped{ false };
+
+   Timer* timer = nullptr;
 };
 
 /**
@@ -121,34 +135,31 @@ class SolverMonitor
  */
 class SolverMonitorThread
 {
-   public:
-
-      /**
-       * \brief Constructor with instance of solver monitor.
-       *
-       * \param solverMonitor is a reference to an instance of a solver monitor.
-       */
-      SolverMonitorThread( SolverMonitor& solverMonitor )
-         : solverMonitor( solverMonitor ),
-         t( &SolverMonitor::runMainLoop, &solverMonitor )
-      {}
-
-      /**
-       * \brief Destructor.
-       */
-      ~SolverMonitorThread()
-      {
-         solverMonitor.stopMainLoop();
-         if( t.joinable() )
-            t.join();
-      }
-
-   private:
-
-      SolverMonitor& solverMonitor;
-
-      std::thread t;
+public:
+   /**
+    * \brief Constructor with instance of solver monitor.
+    *
+    * \param solverMonitor is a reference to an instance of a solver monitor.
+    */
+   SolverMonitorThread( SolverMonitor& solverMonitor )
+   : solverMonitor( solverMonitor ), t( &SolverMonitor::runMainLoop, &solverMonitor )
+   {}
+
+   /**
+    * \brief Destructor.
+    */
+   ~SolverMonitorThread()
+   {
+      solverMonitor.stopMainLoop();
+      if( t.joinable() )
+         t.join();
+   }
+
+private:
+   SolverMonitor& solverMonitor;
+
+   std::thread t;
 };
 
-   } // namespace Solvers
-} // namespace TNL
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/SolverStarter.h b/src/TNL/Solvers/SolverStarter.h
index 738b9982c2b62133dd16a4c3a457a63dabc682e4..30bf236e898f159ff2283c628ce1171fe1f6d5ba 100644
--- a/src/TNL/Solvers/SolverStarter.h
+++ b/src/TNL/Solvers/SolverStarter.h
@@ -17,28 +17,28 @@ namespace Solvers {
 template< typename ConfigTag >
 class SolverStarter
 {
-   public:
-
+public:
    SolverStarter();
 
    template< typename Problem >
-   static bool run( const Config::ParameterContainer& parameters );
+   static bool
+   run( const Config::ParameterContainer& parameters );
 
    template< typename Solver >
-   bool writeEpilog( std::ostream& str, const Solver& solver );
+   bool
+   writeEpilog( std::ostream& str, const Solver& solver );
 
    template< typename Problem, typename TimeStepper >
-   bool runPDESolver( Problem& problem,
-                      const Config::ParameterContainer& parameters );
-
-   protected:
+   bool
+   runPDESolver( Problem& problem, const Config::ParameterContainer& parameters );
 
+protected:
    int logWidth;
 
    Timer ioTimer, computeTimer, totalTimer;
 };
 
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Solvers
+}  // namespace TNL
 
 #include <TNL/Solvers/SolverStarter.hpp>
diff --git a/src/TNL/Solvers/SolverStarter.hpp b/src/TNL/Solvers/SolverStarter.hpp
index cc1259b928349e5aeef8823c8ca56c8e97f9cbdd..39a088e19eb93c7c0235592ac43a5d6abc5f24cd 100644
--- a/src/TNL/Solvers/SolverStarter.hpp
+++ b/src/TNL/Solvers/SolverStarter.hpp
@@ -22,246 +22,223 @@
 namespace TNL {
 namespace Solvers {
 
-template< typename Problem,
-          typename ConfigTag,
-          bool TimeDependent = Problem::isTimeDependent() >
+template< typename Problem, typename ConfigTag, bool TimeDependent = Problem::isTimeDependent() >
 class TimeDependencyResolver
 {};
 
-template< typename Problem,
-          typename ConfigTag,
-          typename TimeStepper = typename Problem::TimeStepper >
+template< typename Problem, typename ConfigTag, typename TimeStepper = typename Problem::TimeStepper >
 class UserDefinedTimeDiscretisationSetter;
 
 template< typename Problem,
           typename TimeDiscretisation,
           typename ConfigTag,
           bool enabled = ConfigTagTimeDiscretisation< ConfigTag, TimeDiscretisation >::enabled >
-class SolverStarterTimeDiscretisationSetter{};
+class SolverStarterTimeDiscretisationSetter
+{};
 
 template< typename Problem,
           typename ExplicitSolver,
           typename ConfigTag,
           bool enabled = ConfigTagExplicitSolver< ConfigTag, ExplicitSolver >::enabled >
-class SolverStarterExplicitSolverSetter{};
-
+class SolverStarterExplicitSolverSetter
+{};
 
 template< typename ConfigTag >
-SolverStarter< ConfigTag > :: SolverStarter()
-: logWidth( 80 )
-{
-}
+SolverStarter< ConfigTag >::SolverStarter() : logWidth( 80 )
+{}
 
 template< typename ConfigTag >
-   template< typename Problem >
-bool SolverStarter< ConfigTag > :: run( const Config::ParameterContainer& parameters )
+template< typename Problem >
+bool
+SolverStarter< ConfigTag >::run( const Config::ParameterContainer& parameters )
 {
    /****
     * Create and set-up the problem
     */
-   if( ! Devices::Host::setup( parameters ) ||
-       ! Devices::Cuda::setup( parameters ) ||
-       ! MPI::setup( parameters )
-    )
+   if( ! Devices::Host::setup( parameters ) || ! Devices::Cuda::setup( parameters ) || ! MPI::setup( parameters ) )
       return false;
    Problem problem;
    return TimeDependencyResolver< Problem, ConfigTag >::run( problem, parameters );
 }
 
-template< typename Problem,
-          typename ConfigTag>
+template< typename Problem, typename ConfigTag >
 class TimeDependencyResolver< Problem, ConfigTag, true >
 {
-   public:
-      static bool run( Problem& problem,
-                       const Config::ParameterContainer& parameters )
-      {
-         return UserDefinedTimeDiscretisationSetter< Problem, ConfigTag >::run( problem, parameters );
-      }
+public:
+   static bool
+   run( Problem& problem, const Config::ParameterContainer& parameters )
+   {
+      return UserDefinedTimeDiscretisationSetter< Problem, ConfigTag >::run( problem, parameters );
+   }
 };
 
-template< typename Problem,
-          typename ConfigTag>
+template< typename Problem, typename ConfigTag >
 class TimeDependencyResolver< Problem, ConfigTag, false >
 {
-   public:
-      static bool run( Problem& problem,
-                       const Config::ParameterContainer& parameters )
-      {
-         // TODO: This should be improved - at least rename to LinearSolverSetter
-         return SolverStarterTimeDiscretisationSetter< Problem, SemiImplicitTimeDiscretisationTag, ConfigTag, true >::run( problem, parameters );
-      }
+public:
+   static bool
+   run( Problem& problem, const Config::ParameterContainer& parameters )
+   {
+      // TODO: This should be improved - at least rename to LinearSolverSetter
+      return SolverStarterTimeDiscretisationSetter< Problem, SemiImplicitTimeDiscretisationTag, ConfigTag, true >::run(
+         problem, parameters );
+   }
 };
 
-template< typename Problem,
-          typename ConfigTag,
-          typename TimeStepper >
+template< typename Problem, typename ConfigTag, typename TimeStepper >
 class UserDefinedTimeDiscretisationSetter
 {
-   public:
-      static bool run( Problem& problem,
-                       const Config::ParameterContainer& parameters )
-      {
-         TimeStepper timeStepper;
-         if( ! timeStepper.setup( parameters ) )
-         {
-            std::cerr << "The time stepper initiation failed!" << std::endl;
-            return false;
-         }
-         SolverStarter< ConfigTag > solverStarter;
-         return solverStarter.template runPDESolver< Problem, TimeStepper >( problem, parameters );
+public:
+   static bool
+   run( Problem& problem, const Config::ParameterContainer& parameters )
+   {
+      TimeStepper timeStepper;
+      if( ! timeStepper.setup( parameters ) ) {
+         std::cerr << "The time stepper initiation failed!" << std::endl;
+         return false;
       }
+      SolverStarter< ConfigTag > solverStarter;
+      return solverStarter.template runPDESolver< Problem, TimeStepper >( problem, parameters );
+   }
 };
 
-template< typename Problem,
-          typename ConfigTag >
+template< typename Problem, typename ConfigTag >
 class UserDefinedTimeDiscretisationSetter< Problem, ConfigTag, void >
 {
-   public:
-      static bool run( Problem& problem,
-                       const Config::ParameterContainer& parameters )
-      {
-         /****
-          * Set-up the time discretisation
-          */
-         const String& timeDiscretisation = parameters.getParameter< String>( "time-discretisation" );
-         if( timeDiscretisation == "explicit" )
-            return SolverStarterTimeDiscretisationSetter< Problem, ExplicitTimeDiscretisationTag, ConfigTag >::run( problem, parameters );
-         if( timeDiscretisation == "semi-implicit" )
-         {
-            if( MPI::GetSize() > 1 )
-            {
-               std::cerr << "TNL currently does not support semi-implicit solvers with MPI." << std::endl;
-               return false;
-            }
-            return SolverStarterTimeDiscretisationSetter< Problem, SemiImplicitTimeDiscretisationTag, ConfigTag >::run( problem, parameters );
+public:
+   static bool
+   run( Problem& problem, const Config::ParameterContainer& parameters )
+   {
+      /****
+       * Set-up the time discretisation
+       */
+      const String& timeDiscretisation = parameters.getParameter< String >( "time-discretisation" );
+      if( timeDiscretisation == "explicit" )
+         return SolverStarterTimeDiscretisationSetter< Problem, ExplicitTimeDiscretisationTag, ConfigTag >::run( problem,
+                                                                                                                 parameters );
+      if( timeDiscretisation == "semi-implicit" ) {
+         if( MPI::GetSize() > 1 ) {
+            std::cerr << "TNL currently does not support semi-implicit solvers with MPI." << std::endl;
+            return false;
          }
-         if( timeDiscretisation == "implicit" )
-         {
-            if( MPI::GetSize() > 1 )
-            {
-               std::cerr << "TNL currently does not support implicit solvers with MPI." << std::endl;
-               return false;
-            }
-            return SolverStarterTimeDiscretisationSetter< Problem, ImplicitTimeDiscretisationTag, ConfigTag >::run( problem, parameters );
+         return SolverStarterTimeDiscretisationSetter< Problem, SemiImplicitTimeDiscretisationTag, ConfigTag >::run(
+            problem, parameters );
+      }
+      if( timeDiscretisation == "implicit" ) {
+         if( MPI::GetSize() > 1 ) {
+            std::cerr << "TNL currently does not support implicit solvers with MPI." << std::endl;
+            return false;
          }
-         std::cerr << "Uknown time discretisation: " << timeDiscretisation << "." << std::endl;
-         return false;
+         return SolverStarterTimeDiscretisationSetter< Problem, ImplicitTimeDiscretisationTag, ConfigTag >::run( problem,
+                                                                                                                 parameters );
       }
+      std::cerr << "Uknown time discretisation: " << timeDiscretisation << "." << std::endl;
+      return false;
+   }
 };
 
 /****
  * Setting the time discretisation
  */
 
-template< typename Problem,
-          typename TimeDiscretisationTag,
-          typename ConfigTag >
+template< typename Problem, typename TimeDiscretisationTag, typename ConfigTag >
 class SolverStarterTimeDiscretisationSetter< Problem, TimeDiscretisationTag, ConfigTag, false >
 {
-   public:
-      static bool run( Problem& problem,
-                       const Config::ParameterContainer& parameters )
-      {
-         std::cerr << "The time discretisation " << parameters.getParameter< String >( "time-discretisation" ) << " is not supported." << std::endl;
-         return false;
-      }
+public:
+   static bool
+   run( Problem& problem, const Config::ParameterContainer& parameters )
+   {
+      std::cerr << "The time discretisation " << parameters.getParameter< String >( "time-discretisation" )
+                << " is not supported." << std::endl;
+      return false;
+   }
 };
 
-template< typename Problem,
-          typename ConfigTag >
+template< typename Problem, typename ConfigTag >
 class SolverStarterTimeDiscretisationSetter< Problem, ExplicitTimeDiscretisationTag, ConfigTag, true >
 {
-   public:
-      static bool run( Problem& problem,
-                       const Config::ParameterContainer& parameters )
-      {
-         const String& discreteSolver = parameters.getParameter< String>( "discrete-solver" );
-         if( discreteSolver != "euler" &&
-             discreteSolver != "merson" )
-         {
-            std::cerr << "Unknown explicit discrete solver " << discreteSolver << ". It can be only: euler or merson." << std::endl;
-            return false;
-         }
-         if( discreteSolver == "euler" )
-            return SolverStarterExplicitSolverSetter< Problem, ExplicitEulerSolverTag, ConfigTag >::run( problem, parameters );
-         if( discreteSolver == "merson" )
-            return SolverStarterExplicitSolverSetter< Problem, ExplicitMersonSolverTag, ConfigTag >::run( problem, parameters );
+public:
+   static bool
+   run( Problem& problem, const Config::ParameterContainer& parameters )
+   {
+      const String& discreteSolver = parameters.getParameter< String >( "discrete-solver" );
+      if( discreteSolver != "euler" && discreteSolver != "merson" ) {
+         std::cerr << "Unknown explicit discrete solver " << discreteSolver << ". It can be only: euler or merson."
+                   << std::endl;
          return false;
       }
+      if( discreteSolver == "euler" )
+         return SolverStarterExplicitSolverSetter< Problem, ExplicitEulerSolverTag, ConfigTag >::run( problem, parameters );
+      if( discreteSolver == "merson" )
+         return SolverStarterExplicitSolverSetter< Problem, ExplicitMersonSolverTag, ConfigTag >::run( problem, parameters );
+      return false;
+   }
 };
 
-template< typename Problem,
-          typename ConfigTag >
+template< typename Problem, typename ConfigTag >
 class SolverStarterTimeDiscretisationSetter< Problem, SemiImplicitTimeDiscretisationTag, ConfigTag, true >
 {
-   public:
-      static bool run( Problem& problem,
-                       const Config::ParameterContainer& parameters )
-      {
-         typedef PDE::SemiImplicitTimeStepper< Problem > TimeStepper;
-         SolverStarter< ConfigTag > solverStarter;
-         return solverStarter.template runPDESolver< Problem, TimeStepper >( problem, parameters );
-      }
+public:
+   static bool
+   run( Problem& problem, const Config::ParameterContainer& parameters )
+   {
+      using TimeStepper = PDE::SemiImplicitTimeStepper< Problem >;
+      SolverStarter< ConfigTag > solverStarter;
+      return solverStarter.template runPDESolver< Problem, TimeStepper >( problem, parameters );
+   }
 };
 
-template< typename Problem,
-          typename ConfigTag >
+template< typename Problem, typename ConfigTag >
 class SolverStarterTimeDiscretisationSetter< Problem, ImplicitTimeDiscretisationTag, ConfigTag, true >
 {
-   public:
-      static bool run( Problem& problem,
-                       const Config::ParameterContainer& parameters )
-      {
-//         const String& discreteSolver = parameters.getParameter< String>( "discrete-solver" );
-         return false;
-      }
+public:
+   static bool
+   run( Problem& problem, const Config::ParameterContainer& parameters )
+   {
+      //         const String& discreteSolver = parameters.getParameter< String>( "discrete-solver" );
+      return false;
+   }
 };
 
 /****
  * Setting the explicit solver
  */
 
-template< typename Problem,
-          typename ExplicitSolverTag,
-          typename ConfigTag >
+template< typename Problem, typename ExplicitSolverTag, typename ConfigTag >
 class SolverStarterExplicitSolverSetter< Problem, ExplicitSolverTag, ConfigTag, false >
 {
-   public:
-      static bool run( Problem& problem,
-                       const Config::ParameterContainer& parameters )
-      {
-         std::cerr << "The explicit solver " << parameters.getParameter< String >( "discrete-solver" ) << " is not supported." << std::endl;
-         return false;
-      }
+public:
+   static bool
+   run( Problem& problem, const Config::ParameterContainer& parameters )
+   {
+      std::cerr << "The explicit solver " << parameters.getParameter< String >( "discrete-solver" ) << " is not supported."
+                << std::endl;
+      return false;
+   }
 };
 
-template< typename Problem,
-          typename ExplicitSolverTag,
-          typename ConfigTag >
+template< typename Problem, typename ExplicitSolverTag, typename ConfigTag >
 class SolverStarterExplicitSolverSetter< Problem, ExplicitSolverTag, ConfigTag, true >
 {
-   public:
-      static bool run( Problem& problem,
-                       const Config::ParameterContainer& parameters )
-      {
-         typedef PDE::ExplicitTimeStepper< Problem, ExplicitSolverTag::template Template > TimeStepper;
-         SolverStarter< ConfigTag > solverStarter;
-         return solverStarter.template runPDESolver< Problem, TimeStepper >( problem, parameters );
-      }
+public:
+   static bool
+   run( Problem& problem, const Config::ParameterContainer& parameters )
+   {
+      using TimeStepper = PDE::ExplicitTimeStepper< Problem, ExplicitSolverTag::template Template >;
+      SolverStarter< ConfigTag > solverStarter;
+      return solverStarter.template runPDESolver< Problem, TimeStepper >( problem, parameters );
+   }
 };
 
 template< typename ConfigTag >
-   template< typename Problem,
-             typename TimeStepper >
-bool SolverStarter< ConfigTag > :: runPDESolver( Problem& problem,
-                                                 const Config::ParameterContainer& parameters )
+template< typename Problem, typename TimeStepper >
+bool
+SolverStarter< ConfigTag >::runPDESolver( Problem& problem, const Config::ParameterContainer& parameters )
 {
    this->totalTimer.reset();
    this->totalTimer.start();
 
-   using SolverMonitorType = IterativeSolverMonitor< typename Problem::RealType,
-                                                     typename Problem::IndexType >;
+   using SolverMonitorType = IterativeSolverMonitor< typename Problem::RealType, typename Problem::IndexType >;
    SolverMonitorType solverMonitor, *solverMonitorPointer( &solverMonitor );
 
    /****
@@ -283,7 +260,7 @@ bool SolverStarter< ConfigTag > :: runPDESolver( Problem& problem,
    solver.setTotalTimer( this->totalTimer );
 
    if( problem.getSolverMonitor() )
-      solverMonitorPointer = ( SolverMonitorType* ) problem.getSolverMonitor();
+      solverMonitorPointer = (SolverMonitorType*) problem.getSolverMonitor();
    solverMonitorPointer->setVerbose( parameters.getParameter< int >( "verbose" ) );
    solverMonitorPointer->setTimer( this->totalTimer );
    solver.setSolverMonitor( *solverMonitorPointer );
@@ -297,20 +274,20 @@ bool SolverStarter< ConfigTag > :: runPDESolver( Problem& problem,
          if( ! solver.setup( parameters ) )
             return false;
       }
-      catch ( const std::exception& e ) {
+      catch( const std::exception& e ) {
          std::cerr << "Setting up the solver failed due to a C++ exception with description: " << e.what() << std::endl;
-         logFile   << "Setting up the solver failed due to a C++ exception with description: " << e.what() << std::endl;
+         logFile << "Setting up the solver failed due to a C++ exception with description: " << e.what() << std::endl;
          return false;
       }
-      catch (...) {
+      catch( ... ) {
          std::cerr << "Setting up the solver failed due to an unknown C++ exception." << std::endl;
-         logFile   << "Setting up the solver failed due to an unknown C++ exception." << std::endl;
+         logFile << "Setting up the solver failed due to an unknown C++ exception." << std::endl;
          throw;
       }
    }
    else {
       solver.setProblem( problem );
-      //solver.setTimeStepper( timeStepper );
+      // solver.setTimeStepper( timeStepper );
       if( ! solver.setup( parameters ) )
          return false;
    }
@@ -325,7 +302,7 @@ bool SolverStarter< ConfigTag > :: runPDESolver( Problem& problem,
       solver.writeProlog( logger, parameters );
    }
    Logger logger( logWidth, logFile );
-   solver.writeProlog( logger, parameters  );
+   solver.writeProlog( logger, parameters );
 
    /****
     * Set-up timers
@@ -348,14 +325,14 @@ bool SolverStarter< ConfigTag > :: runPDESolver( Problem& problem,
       try {
          returnCode = solver.solve();
       }
-      catch ( const std::exception& e ) {
+      catch( const std::exception& e ) {
          std::cerr << "The solver failed due to a C++ exception with description: " << e.what() << std::endl;
-         logFile   << "The solver failed due to a C++ exception with description: " << e.what() << std::endl;
+         logFile << "The solver failed due to a C++ exception with description: " << e.what() << std::endl;
          return false;
       }
-      catch (...) {
+      catch( ... ) {
          std::cerr << "The solver failed due to an unknown C++ exception." << std::endl;
-         logFile   << "The solver failed due to an unknown C++ exception." << std::endl;
+         logFile << "The solver failed due to an unknown C++ exception." << std::endl;
          throw;
       }
    }
@@ -387,8 +364,9 @@ bool SolverStarter< ConfigTag > :: runPDESolver( Problem& problem,
 }
 
 template< typename ConfigTag >
-   template< typename Solver >
-bool SolverStarter< ConfigTag > :: writeEpilog( std::ostream& str, const Solver& solver  )
+template< typename Solver >
+bool
+SolverStarter< ConfigTag >::writeEpilog( std::ostream& str, const Solver& solver )
 {
    Logger logger( logWidth, str );
    logger.writeSeparator();
@@ -397,8 +375,7 @@ bool SolverStarter< ConfigTag > :: writeEpilog( std::ostream& str, const Solver&
       return false;
    logger.writeParameter< const char* >( "Compute time:", "" );
    this->computeTimer.writeLog( logger, 1 );
-   if( std::is_same< typename Solver::DeviceType, TNL::Devices::Cuda >::value )
-   {
+   if( std::is_same< typename Solver::DeviceType, TNL::Devices::Cuda >::value ) {
       logger.writeParameter< const char* >( "GPU synchronization time:", "" );
       Pointers::getSmartPointersSynchronizationTimer< Devices::Cuda >().writeLog( logger, 1 );
    }
@@ -407,11 +384,11 @@ bool SolverStarter< ConfigTag > :: writeEpilog( std::ostream& str, const Solver&
    logger.writeParameter< const char* >( "Total time:", "" );
    this->totalTimer.writeLog( logger, 1 );
    char buf[ 256 ];
-   sprintf( buf, "%f %%", 100 * ( ( double ) this->totalTimer.getCPUTime() ) / this->totalTimer.getRealTime() );
+   sprintf( buf, "%f %%", 100 * ( (double) this->totalTimer.getCPUTime() ) / this->totalTimer.getRealTime() );
    logger.writeParameter< char* >( "CPU usage:", buf );
    logger.writeSeparator();
    return true;
 }
 
-} // namespace Solvers
-} // namespace TNL
+}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/Solvers/_NamespaceDoxy.h b/src/TNL/Solvers/_NamespaceDoxy.h
index 191b365fbb296ec5ff025c45fb4697af38893dd0..13ff8ac6e2f97f769467bddd25efe9d3d748a485 100644
--- a/src/TNL/Solvers/_NamespaceDoxy.h
+++ b/src/TNL/Solvers/_NamespaceDoxy.h
@@ -8,10 +8,8 @@
 
 namespace TNL {
 
-   /**
-    * \brief Namespace for solvers.
-    */
-   namespace Solvers {
-
-   } // namespace Solvers
-} // namespace TNL
+/**
+ * \brief Namespace for solvers.
+ */
+namespace Solvers {}  // namespace Solvers
+}  // namespace TNL
diff --git a/src/TNL/String.h b/src/TNL/String.h
index 074b612d4cfcbf92b664c2a41413e02afb411031..78de33256c0b43577424c8654b4576decf712b82 100644
--- a/src/TNL/String.h
+++ b/src/TNL/String.h
@@ -29,343 +29,375 @@ namespace TNL {
  *
  * \ref operator+
  */
-class String
-: public std::string
+class String : public std::string
 {
-   public:
-
-      /**
-       * \brief This enum defines how the operation split of string is to be performed.
-       */
-      enum class SplitSkip
-      {
-         NoSkip,    ///< Do not skip empty characters
-         SkipEmpty  ///< Skip empty characters.
-      };
-
-      /**
-       * \brief Default constructor.
-       *
-       * Constructs an empty string object.
-       */
-      String() = default;
-
-      /**
-       * \brief Default copy constructor.
-       */
-      String( const String& ) = default;
-
-      /**
-       * \brief Default move constructor.
-       */
-      String( String&& ) = default;
-
-      /**
-       * \brief Initialization by \e std::string.
-       */
-      String( const std::string& str ) : std::string( str ) {}
-
-      /**
-       * \brief Default copy assignment operator.
-       */
-      String& operator=( const String& ) = default;
-
-      /**
-       * \brief Default move assignment operator.
-       */
-      String& operator=( String&& ) = default;
-
-      /**
-       * \brief Inherited constructors.
-       */
-      using std::string::string;
-
-      /**
-       * \brief Inherited assignment operators.
-       */
-      using std::string::operator=;
-
-      /**
-       * \brief Returns the number of characters in given string. Equivalent to \ref getSize.
-       */
-      int getLength() const;
-
-      /**
-       * \brief Returns the number of characters in given string.
-       */
-      int getSize() const;
-
-      /**
-       *  \brief Returns size of allocated storage for given string.
-       *
-       * \par Example
-       * \include StringExampleGetAllocatedSize.cpp
-       * \par Output
-       * \include StringExampleGetAllocatedSize.out
-       */
-      int getAllocatedSize() const;
-
-      /**
-       * \brief Reserves space for given \e size.
-       *
-       * Requests to allocate storage space of given \e size to avoid memory reallocation.
-       * It allocates one more byte for the terminating 0.
-       * @param size Number of characters.
-       *
-       * \par Example
-       * \include StringExampleSetSize.cpp
-       * \par Output
-       * \include StringExampleSetSize.out
-       */
-      void setSize( int size );
-
-      /**
-       * \brief Returns pointer to data.
-       *
-       * It returns the content of the given string as a constant pointer to char.
-       */
-      const char* getString() const;
-
-      /**
-       * \brief Returns pointer to data. Alias of \ref std::string::data.
-       */
-      const char* getData() const;
-
-      /**
-       * \brief Returns pointer to data. Alias of \ref std::string::data.
-       */
-      char* getData();
-
-      /**
-       * \brief Operator for accessing particular chars of the string.
-       *
-       * This function overloads \ref operator[]. It returns a reference to
-       * the character at position \e i in given string.
-       * The character can not be changed be user.
-       */
-      const char& operator[]( int i ) const;
-
-      /**
-       *  \brief Operator for accessing particular chars of the string.
-       *
-       * It returns the character at the position \e i in given string as
-       * a modifiable reference.
-       */
-      char& operator[]( int i );
-
-      /**
-       * Operators for single characters.
-       */
-
-      /**
-       * \brief This function overloads \ref operator+=.
-       *
-       * Appends character \e str to this string.
-       */
-      String& operator+=( char str );
-
-      /**
-       * \brief This function concatenates strings and returns a newly constructed string object.
-       */
-      String operator+( char str ) const;
-
-      /**
-       * \brief This function checks whether the given string is equal to \e str.
-       *
-       * It returns \e true when the given string is equal to \e str. Otherwise it returns \e false.
-       */
-      bool operator==( char str ) const;
-
-      /**
-       * \brief This function overloads \ref operator!=.
-       *
-       * It returns \e true when the given string is NOT equal to \e str. Otherwise it returns \e true.
-       */
-      bool operator!=( char str ) const;
-
-      /**
-       * Operators for C strings.
-       */
-
-      /**
-       * \brief This function overloads \ref operator+=.
-       *
-       * It appends the C string \e str to this string.
-       */
-      String& operator+=( const char* str );
-
-      /**
-       * \brief This function concatenates C strings \e str and returns a newly constructed string object.
-       */
-      String operator+( const char* str ) const;
-
-      /**
-       * \brief This function overloads \ref operator==.
-       *
-       * It returns \e true when the given string is equal to \e str. Otherwise it returns \e false.
-       */
-      bool operator==( const char* str ) const;
-
-      /**
-       * \brief This function overloads \ref operator!=.
-       *
-       * It returns \e true when the given string is NOT equal to \e str. Otherwise it returns \e true.
-       */
-      bool operator!=( const char* str ) const;
-
-      /**
-       * Operators for std::string.
-       */
-
-      /**
-       * \brief This function overloads \ref operator+=.
-       *
-       * It appends the C string \e str to this string.
-       */
-      String& operator+=( const std::string& str );
-
-      /**
-       * \brief This function concatenates C strings \e str and returns a newly constructed string object.
-       */
-      String operator+( const std::string& str ) const;
-
-      /**
-       * \brief This function overloads \ref operator==.
-       *
-       * It returns \e true when the given string is equal to \e str. Otherwise it returns \e false.
-       */
-      bool operator==( const std::string& str ) const;
-
-      /**
-       * \brief This function overloads \ref operator!=.
-       *
-       * It returns \e true when the given string is NOT equal to \e str. Otherwise it returns \e true.
-       */
-      bool operator!=( const std::string& str ) const;
-
-      /**
-       * Operators for String.
-       */
-
-      /**
-       * \brief This function overloads \ref operator+=.
-       *
-       * It appends the C string \e str to this string.
-       */
-      String& operator+=( const String& str );
-
-      /**
-       * \brief This function concatenates C strings \e str and returns a newly constructed string object.
-       */
-      String operator+( const String& str ) const;
-
-      /**
-       * \brief This function overloads \ref operator==.
-       *
-       * It returns \e true when the given string is equal to \e str. Otherwise it returns \e false.
-       */
-      bool operator==( const String& str ) const;
-
-      /**
-       * \brief This function overloads \ref operator!=.
-       *
-       * It returns \e true when the given string is NOT equal to \e str. Otherwise it returns \e true.
-       */
-      bool operator!=( const String& str ) const;
-
-      /**
-       *  \brief Cast to bool operator.
-       *
-       * This operator converts string to boolean expression (true or false).
-       * It returns \e true if the string is NOT empty. Otherwise it returns \e false.
-       */
-      operator bool() const;
-
-      /** \brief Cast to bool with negation operator.
-       *
-       * This operator converts string to boolean expression (false or true).
-       * It returns \e true if the string is empty. Otherwise it returns \e false.
-       */
-      bool operator!() const;
-
-      /**
-       * \brief This method replaces part of the string.
-       *
-       * It replaces \e pattern in this string with a string \e replaceWith.
-       * If parameter \e count is defined, the function makes replacement only count occurrences,
-       * of the given pattern. If \e count is zero, all pattern occurrences are replaced.
-       *
-       * @param pattern to be replaced.
-       * @param replaceWith string the \e pattern will be replaced with.
-       * @param count number of occurrences to be replaced. All occurrences are replaced if \e count is zero..
-       *
-       * \par Example
-       * \include StringExampleReplace.cpp
-       * \par Output
-       * \include StringExampleReplace.out
-       */
-      String replace( const String& pattern,
-                      const String& replaceWith,
-                      int count = 0 ) const;
-
-      /**
-       * \brief Trims/strips this string.
-       *
-       * Removes all 'spaces' from given string except for single 'spaces' between words.
-       *
-       * @param strip can be used to change the character to be removed.
-       *
-       * \par Example
-       * \include StringExampleStrip.cpp
-       * \par Output
-       * \include StringExampleStrip.out
-       */
-      String strip( char strip = ' ' ) const;
-
-      /**
-       *  \brief Splits string into list of strings with respect to given \e separator.
-       *
-       * This method splits the string into sequence of substrings divided by occurrences of \e separator.
-       * It returns the list of those strings via std::vector. When \e separator does not appear
-       * anywhere in the given string, this function returns a single-element list
-       * containing given sting. If \e skipEmpty equals \e SkipEmpty no empty substrings are
-       * inserted into the resulting container.
-       *
-       * @param separator is a character separating substrings in given string.
-       * @param skipEmpty
-       *
-       * \par Example
-       * \include StringExampleSplit.cpp
-       * \par Output
-       * \include StringExampleSplit.out
-       */
-      std::vector< String > split( const char separator = ' ', SplitSkip skipEmpty = SplitSkip::NoSkip ) const;
-
-      /**
-       * \brief Checks if the string starts with given prefix.
-       */
-      bool startsWith( const String& prefix ) const;
-
-      /**
-       * \brief Checks if the string ends with given suffix.
-       */
-      bool endsWith( const String& suffix ) const;
+public:
+   /**
+    * \brief This enum defines how the operation split of string is to be performed.
+    */
+   enum class SplitSkip
+   {
+      NoSkip,    ///< Do not skip empty characters
+      SkipEmpty  ///< Skip empty characters.
+   };
+
+   /**
+    * \brief Default constructor.
+    *
+    * Constructs an empty string object.
+    */
+   String() = default;
+
+   /**
+    * \brief Default copy constructor.
+    */
+   String( const String& ) = default;
+
+   /**
+    * \brief Default move constructor.
+    */
+   String( String&& ) = default;
+
+   /**
+    * \brief Initialization by \e std::string.
+    */
+   String( const std::string& str ) : std::string( str ) {}
+
+   /**
+    * \brief Default copy assignment operator.
+    */
+   String&
+   operator=( const String& ) = default;
+
+   /**
+    * \brief Default move assignment operator.
+    */
+   String&
+   operator=( String&& ) = default;
+
+   /**
+    * \brief Inherited constructors.
+    */
+   using std::string::string;
+
+   /**
+    * \brief Inherited assignment operators.
+    */
+   using std::string::operator=;
+
+   /**
+    * \brief Returns the number of characters in given string. Equivalent to \ref getSize.
+    */
+   int
+   getLength() const;
+
+   /**
+    * \brief Returns the number of characters in given string.
+    */
+   int
+   getSize() const;
+
+   /**
+    *  \brief Returns size of allocated storage for given string.
+    *
+    * \par Example
+    * \include StringExampleGetAllocatedSize.cpp
+    * \par Output
+    * \include StringExampleGetAllocatedSize.out
+    */
+   int
+   getAllocatedSize() const;
+
+   /**
+    * \brief Reserves space for given \e size.
+    *
+    * Requests to allocate storage space of given \e size to avoid memory reallocation.
+    * It allocates one more byte for the terminating 0.
+    * @param size Number of characters.
+    *
+    * \par Example
+    * \include StringExampleSetSize.cpp
+    * \par Output
+    * \include StringExampleSetSize.out
+    */
+   void
+   setSize( int size );
+
+   /**
+    * \brief Returns pointer to data.
+    *
+    * It returns the content of the given string as a constant pointer to char.
+    */
+   const char*
+   getString() const;
+
+   /**
+    * \brief Returns pointer to data. Alias of \ref std::string::data.
+    */
+   const char*
+   getData() const;
+
+   /**
+    * \brief Returns pointer to data. Alias of \ref std::string::data.
+    */
+   char*
+   getData();
+
+   /**
+    * \brief Operator for accessing particular chars of the string.
+    *
+    * This function overloads \ref operator[]. It returns a reference to
+    * the character at position \e i in given string.
+    * The character can not be changed be user.
+    */
+   const char&
+   operator[]( int i ) const;
+
+   /**
+    *  \brief Operator for accessing particular chars of the string.
+    *
+    * It returns the character at the position \e i in given string as
+    * a modifiable reference.
+    */
+   char&
+   operator[]( int i );
+
+   /**
+    * Operators for single characters.
+    */
+
+   /**
+    * \brief This function overloads \ref operator+=.
+    *
+    * Appends character \e str to this string.
+    */
+   String&
+   operator+=( char str );
+
+   /**
+    * \brief This function concatenates strings and returns a newly constructed string object.
+    */
+   String
+   operator+( char str ) const;
+
+   /**
+    * \brief This function checks whether the given string is equal to \e str.
+    *
+    * It returns \e true when the given string is equal to \e str. Otherwise it returns \e false.
+    */
+   bool
+   operator==( char str ) const;
+
+   /**
+    * \brief This function overloads \ref operator!=.
+    *
+    * It returns \e true when the given string is NOT equal to \e str. Otherwise it returns \e true.
+    */
+   bool
+   operator!=( char str ) const;
+
+   /**
+    * Operators for C strings.
+    */
+
+   /**
+    * \brief This function overloads \ref operator+=.
+    *
+    * It appends the C string \e str to this string.
+    */
+   String&
+   operator+=( const char* str );
+
+   /**
+    * \brief This function concatenates C strings \e str and returns a newly constructed string object.
+    */
+   String
+   operator+( const char* str ) const;
+
+   /**
+    * \brief This function overloads \ref operator==.
+    *
+    * It returns \e true when the given string is equal to \e str. Otherwise it returns \e false.
+    */
+   bool
+   operator==( const char* str ) const;
+
+   /**
+    * \brief This function overloads \ref operator!=.
+    *
+    * It returns \e true when the given string is NOT equal to \e str. Otherwise it returns \e true.
+    */
+   bool
+   operator!=( const char* str ) const;
+
+   /**
+    * Operators for std::string.
+    */
+
+   /**
+    * \brief This function overloads \ref operator+=.
+    *
+    * It appends the C string \e str to this string.
+    */
+   String&
+   operator+=( const std::string& str );
+
+   /**
+    * \brief This function concatenates C strings \e str and returns a newly constructed string object.
+    */
+   String
+   operator+( const std::string& str ) const;
+
+   /**
+    * \brief This function overloads \ref operator==.
+    *
+    * It returns \e true when the given string is equal to \e str. Otherwise it returns \e false.
+    */
+   bool
+   operator==( const std::string& str ) const;
+
+   /**
+    * \brief This function overloads \ref operator!=.
+    *
+    * It returns \e true when the given string is NOT equal to \e str. Otherwise it returns \e true.
+    */
+   bool
+   operator!=( const std::string& str ) const;
+
+   /**
+    * Operators for String.
+    */
+
+   /**
+    * \brief This function overloads \ref operator+=.
+    *
+    * It appends the C string \e str to this string.
+    */
+   String&
+   operator+=( const String& str );
+
+   /**
+    * \brief This function concatenates C strings \e str and returns a newly constructed string object.
+    */
+   String
+   operator+( const String& str ) const;
+
+   /**
+    * \brief This function overloads \ref operator==.
+    *
+    * It returns \e true when the given string is equal to \e str. Otherwise it returns \e false.
+    */
+   bool
+   operator==( const String& str ) const;
+
+   /**
+    * \brief This function overloads \ref operator!=.
+    *
+    * It returns \e true when the given string is NOT equal to \e str. Otherwise it returns \e true.
+    */
+   bool
+   operator!=( const String& str ) const;
+
+   /**
+    *  \brief Cast to bool operator.
+    *
+    * This operator converts string to boolean expression (true or false).
+    * It returns \e true if the string is NOT empty. Otherwise it returns \e false.
+    */
+   operator bool() const;
+
+   /** \brief Cast to bool with negation operator.
+    *
+    * This operator converts string to boolean expression (false or true).
+    * It returns \e true if the string is empty. Otherwise it returns \e false.
+    */
+   bool
+   operator!() const;
+
+   /**
+    * \brief This method replaces part of the string.
+    *
+    * It replaces \e pattern in this string with a string \e replaceWith.
+    * If parameter \e count is defined, the function makes replacement only count occurrences,
+    * of the given pattern. If \e count is zero, all pattern occurrences are replaced.
+    *
+    * @param pattern to be replaced.
+    * @param replaceWith string the \e pattern will be replaced with.
+    * @param count number of occurrences to be replaced. All occurrences are replaced if \e count is zero..
+    *
+    * \par Example
+    * \include StringExampleReplace.cpp
+    * \par Output
+    * \include StringExampleReplace.out
+    */
+   String
+   replace( const String& pattern, const String& replaceWith, int count = 0 ) const;
+
+   /**
+    * \brief Trims/strips this string.
+    *
+    * Removes all 'spaces' from given string except for single 'spaces' between words.
+    *
+    * @param strip can be used to change the character to be removed.
+    *
+    * \par Example
+    * \include StringExampleStrip.cpp
+    * \par Output
+    * \include StringExampleStrip.out
+    */
+   String
+   strip( char strip = ' ' ) const;
+
+   /**
+    *  \brief Splits string into list of strings with respect to given \e separator.
+    *
+    * This method splits the string into sequence of substrings divided by occurrences of \e separator.
+    * It returns the list of those strings via std::vector. When \e separator does not appear
+    * anywhere in the given string, this function returns a single-element list
+    * containing given sting. If \e skipEmpty equals \e SkipEmpty no empty substrings are
+    * inserted into the resulting container.
+    *
+    * @param separator is a character separating substrings in given string.
+    * @param skipEmpty
+    *
+    * \par Example
+    * \include StringExampleSplit.cpp
+    * \par Output
+    * \include StringExampleSplit.out
+    */
+   std::vector< String >
+   split( char separator = ' ', SplitSkip skipEmpty = SplitSkip::NoSkip ) const;
+
+   /**
+    * \brief Checks if the string starts with given prefix.
+    */
+   bool
+   startsWith( const String& prefix ) const;
+
+   /**
+    * \brief Checks if the string ends with given suffix.
+    */
+   bool
+   endsWith( const String& suffix ) const;
 };
 
 /**
  * \brief Returns concatenation of \e string1 and \e string2.
  */
-String operator+( char string1, const String& string2 );
+String
+operator+( char string1, const String& string2 );
 
 /**
  * \brief Returns concatenation of \e string1 and \e string2.
  */
-String operator+( const char* string1, const String& string2 );
+String
+operator+( const char* string1, const String& string2 );
 
 /**
  * \brief Returns concatenation of \e string1 and \e string2.
  */
-String operator+( const std::string& string1, const String& string2 );
+String
+operator+( const std::string& string1, const String& string2 );
 
 /**
  * \brief Converts \e value of type \e T to a String.
@@ -373,11 +405,12 @@ String operator+( const std::string& string1, const String& string2 );
  * \tparam T can be any type fir which operator << is defined.
  */
 template< typename T >
-String convertToString( const T& value )
+String
+convertToString( const T& value )
 {
    std::stringstream str;
    str << value;
-   return String( str.str().data() );
+   return str.str();
 }
 
 /**
@@ -385,12 +418,15 @@ String convertToString( const T& value )
  *
  * The boolean type is converted to 'true' or 'false'.
  */
-template<> inline String convertToString( const bool& b )
+template<>
+inline String
+convertToString( const bool& b )
 {
-   if( b ) return "true";
+   if( b )
+      return "true";
    return "false";
 }
 
-} // namespace TNL
+}  // namespace TNL
 
 #include <TNL/String.hpp>
diff --git a/src/TNL/String.hpp b/src/TNL/String.hpp
index 432a954a99a4324167e0480bbf3da7482094ee62..5c46b55394feb561e08b5d73ec1d4cc51bdd4ba3 100644
--- a/src/TNL/String.hpp
+++ b/src/TNL/String.hpp
@@ -12,51 +12,60 @@
 
 namespace TNL {
 
-inline int String::getLength() const
+inline int
+String::getLength() const
 {
    return getSize();
 }
 
-inline int String::getSize() const
+inline int
+String::getSize() const
 {
    return this->size();
 }
 
-inline int String::getAllocatedSize() const
+inline int
+String::getAllocatedSize() const
 {
    return this->capacity();
 }
 
-inline void String::setSize( int size )
+inline void
+String::setSize( int size )
 {
    TNL_ASSERT_GE( size, 0, "string size must be non-negative" );
    this->resize( size );
 }
 
-inline const char* String::getString() const
+inline const char*
+String::getString() const
 {
    return this->c_str();
 }
 
-inline const char* String::getData() const
+inline const char*
+String::getData() const
 {
    return data();
 }
 
-inline char* String::getData()
+inline char*
+String::getData()
 {
    // NOTE: std::string::data is non-const only since C++17
    return const_cast< char* >( data() );
 }
 
-inline const char& String::operator[]( int i ) const
+inline const char&
+String::operator[]( int i ) const
 {
    TNL_ASSERT_GE( i, 0, "Element index must be non-negative." );
    TNL_ASSERT_LT( i, getSize(), "Element index is out of bounds." );
    return std::string::operator[]( i );
 }
 
-inline char& String::operator[]( int i )
+inline char&
+String::operator[]( int i )
 {
    TNL_ASSERT_GE( i, 0, "Element index must be non-negative." );
    TNL_ASSERT_LT( i, getSize(), "Element index is out of bounds." );
@@ -66,23 +75,27 @@ inline char& String::operator[]( int i )
 /****
  * Operators for single characters
  */
-inline String& String::operator+=( char str )
+inline String&
+String::operator+=( char str )
 {
    std::string::operator+=( str );
    return *this;
 }
 
-inline String String::operator+( char str ) const
+inline String
+String::operator+( char str ) const
 {
    return String( *this ) += str;
 }
 
-inline bool String::operator==( char str ) const
+inline bool
+String::operator==( char str ) const
 {
    return std::string( *this ) == std::string( 1, str );
 }
 
-inline bool String::operator!=( char str ) const
+inline bool
+String::operator!=( char str ) const
 {
    return ! operator==( str );
 }
@@ -90,23 +103,27 @@ inline bool String::operator!=( char str ) const
 /****
  * Operators for C strings
  */
-inline String& String::operator+=( const char* str )
+inline String&
+String::operator+=( const char* str )
 {
    std::string::operator+=( str );
    return *this;
 }
 
-inline String String::operator+( const char* str ) const
+inline String
+String::operator+( const char* str ) const
 {
    return String( *this ) += str;
 }
 
-inline bool String::operator==( const char* str ) const
+inline bool
+String::operator==( const char* str ) const
 {
    return std::string( *this ) == str;
 }
 
-inline bool String::operator!=( const char* str ) const
+inline bool
+String::operator!=( const char* str ) const
 {
    return ! operator==( str );
 }
@@ -114,23 +131,27 @@ inline bool String::operator!=( const char* str ) const
 /****
  * Operators for std::string
  */
-inline String& String::operator+=( const std::string& str )
+inline String&
+String::operator+=( const std::string& str )
 {
    std::string::operator+=( str );
    return *this;
 }
 
-inline String String::operator+( const std::string& str ) const
+inline String
+String::operator+( const std::string& str ) const
 {
    return String( *this ) += str;
 }
 
-inline bool String::operator==( const std::string& str ) const
+inline bool
+String::operator==( const std::string& str ) const
 {
    return std::string( *this ) == str;
 }
 
-inline bool String::operator!=( const std::string& str ) const
+inline bool
+String::operator!=( const std::string& str ) const
 {
    return ! operator==( str );
 }
@@ -138,42 +159,44 @@ inline bool String::operator!=( const std::string& str ) const
 /****
  * Operators for String
  */
-inline String& String::operator+=( const String& str )
+inline String&
+String::operator+=( const String& str )
 {
    std::string::operator+=( str );
    return *this;
 }
 
-inline String String::operator+( const String& str ) const
+inline String
+String::operator+( const String& str ) const
 {
    return String( *this ) += str;
 }
 
-inline bool String::operator==( const String& str ) const
+inline bool
+String::operator==( const String& str ) const
 {
    return std::string( *this ) == str;
 }
 
-inline bool String::operator!=( const String& str ) const
+inline bool
+String::operator!=( const String& str ) const
 {
    return ! operator==( str );
 }
 
-
-inline String::operator bool () const
+inline String::operator bool() const
 {
-   return getLength();
+   return ! empty();
 }
 
-inline bool String::operator!() const
+inline bool
+String::operator!() const
 {
    return ! operator bool();
 }
 
 inline String
-String::replace( const String& pattern,
-                 const String& replaceWith,
-                 int count ) const
+String::replace( const String& pattern, const String& replaceWith, int count ) const
 {
    std::string newString = *this;
 
@@ -198,10 +221,10 @@ String::strip( char strip ) const
    int prefix_cut_off = 0;
    int sufix_cut_off = 0;
 
-   while( prefix_cut_off < getLength() && (*this)[ prefix_cut_off ] == strip )
+   while( prefix_cut_off < getLength() && ( *this )[ prefix_cut_off ] == strip )
       prefix_cut_off++;
 
-   while( sufix_cut_off < getLength() && (*this)[ getLength() - 1 - sufix_cut_off ] == strip )
+   while( sufix_cut_off < getLength() && ( *this )[ getLength() - 1 - sufix_cut_off ] == strip )
       sufix_cut_off++;
 
    if( prefix_cut_off + sufix_cut_off < getLength() )
@@ -210,19 +233,20 @@ String::strip( char strip ) const
 }
 
 inline std::vector< String >
-String::split( const char separator, SplitSkip skip ) const
+String::split( char separator, SplitSkip skip ) const
 {
    std::vector< String > parts;
    String s;
    for( int i = 0; i < this->getLength(); i++ ) {
       if( ( *this )[ i ] == separator ) {
-         if( skip != SplitSkip::SkipEmpty || s != "" )
+         if( skip != SplitSkip::SkipEmpty || ! s.empty() )
             parts.push_back( s );
          s = "";
       }
-      else s += ( *this )[ i ];
+      else
+         s += ( *this )[ i ];
    }
-   if( skip != SplitSkip::SkipEmpty || s != "" )
+   if( skip != SplitSkip::SkipEmpty || ! s.empty() )
       parts.push_back( s );
    return parts;
 }
@@ -230,7 +254,7 @@ String::split( const char separator, SplitSkip skip ) const
 inline bool
 String::startsWith( const String& prefix ) const
 {
-   if( prefix.getSize() > getSize())
+   if( prefix.getSize() > getSize() )
       return false;
    return std::equal( prefix.begin(), prefix.end(), begin() );
 }
@@ -238,24 +262,27 @@ String::startsWith( const String& prefix ) const
 inline bool
 String::endsWith( const String& suffix ) const
 {
-   if( suffix.getSize() > getSize())
+   if( suffix.getSize() > getSize() )
       return false;
    return std::equal( suffix.rbegin(), suffix.rend(), rbegin() );
 }
 
-inline String operator+( char string1, const String& string2 )
+inline String
+operator+( char string1, const String& string2 )
 {
    return convertToString( string1 ) + string2;
 }
 
-inline String operator+( const char* string1, const String& string2 )
+inline String
+operator+( const char* string1, const String& string2 )
 {
    return String( string1 ) + string2;
 }
 
-inline String operator+( const std::string& string1, const String& string2 )
+inline String
+operator+( const std::string& string1, const String& string2 )
 {
    return String( string1 ) + string2;
 }
 
-} // namespace TNL
+}  // namespace TNL
diff --git a/src/TNL/SystemInfo.h b/src/TNL/SystemInfo.h
index 88f2d1fe1efe8561693100d7cafcac7cc8f8cc0a..a8e2daede09e8f602b9b0bfe1252a5e213d63d56 100644
--- a/src/TNL/SystemInfo.h
+++ b/src/TNL/SystemInfo.h
@@ -12,7 +12,8 @@
 
 namespace TNL {
 
-struct CacheSizes {
+struct CacheSizes
+{
    int L1instruction = 0;
    int L1data = 0;
    int L2 = 0;
@@ -22,20 +23,33 @@ struct CacheSizes {
 class SystemInfo
 {
 public:
-   static String getHostname();
-   static String getArchitecture();
-   static String getSystemName();
-   static String getSystemRelease();
-   static String getCurrentTime( const char* format = "%a %b %d %Y, %H:%M:%S" );
+   static String
+   getHostname();
+   static String
+   getArchitecture();
+   static String
+   getSystemName();
+   static String
+   getSystemRelease();
+   static String
+   getCurrentTime( const char* format = "%a %b %d %Y, %H:%M:%S" );
 
-   static int    getNumberOfProcessors();
-   static String getOnlineCPUs();
-   static int    getNumberOfCores( int cpu_id );
-   static int    getNumberOfThreads( int cpu_id );
-   static String getCPUModelName( int cpu_id );
-   static int    getCPUMaxFrequency( int cpu_id );
-   static CacheSizes getCPUCacheSizes( int cpu_id );
-   static size_t getFreeMemory();
+   static int
+   getNumberOfProcessors();
+   static String
+   getOnlineCPUs();
+   static int
+   getNumberOfCores( int cpu_id );
+   static int
+   getNumberOfThreads( int cpu_id );
+   static String
+   getCPUModelName( int cpu_id );
+   static int
+   getCPUMaxFrequency( int cpu_id );
+   static CacheSizes
+   getCPUCacheSizes( int cpu_id );
+   static size_t
+   getFreeMemory();
 
 protected:
    struct CPUInfo
@@ -46,16 +60,17 @@ protected:
       int CPUCores = 0;
    };
 
-   static CPUInfo parseCPUInfo();
+   static CPUInfo
+   parseCPUInfo();
 
    template< typename ResultType >
    static ResultType
-   readFile( const String & fileName )
+   readFile( const String& fileName )
    {
       std::ifstream file( fileName.getString() );
       if( ! file ) {
          std::cerr << "Unable to read information from " << fileName << "." << std::endl;
-         return 0;
+         return 0;  // NOLINT(modernize-use-nullptr)
       }
       ResultType result;
       file >> result;
@@ -63,6 +78,6 @@ protected:
    }
 };
 
-} // namespace TNL
+}  // namespace TNL
 
 #include <TNL/SystemInfo.hpp>
diff --git a/src/TNL/SystemInfo.hpp b/src/TNL/SystemInfo.hpp
index 2eb3829d452994ed1cdb097466f2bf2dfadb3fca..2a0121aaa737b4a139e53d253eee7f2f520361cb 100644
--- a/src/TNL/SystemInfo.hpp
+++ b/src/TNL/SystemInfo.hpp
@@ -19,35 +19,35 @@
 namespace TNL {
 
 inline String
-SystemInfo::getHostname( void )
+SystemInfo::getHostname()
 {
    char host_name[ 256 ];
    gethostname( host_name, 255 );
-   return String( host_name );
+   return host_name;
 }
 
 inline String
-SystemInfo::getArchitecture( void )
+SystemInfo::getArchitecture()
 {
    utsname uts;
    uname( &uts );
-   return String( uts.machine );
+   return uts.machine;
 }
 
 inline String
-SystemInfo::getSystemName( void )
+SystemInfo::getSystemName()
 {
    utsname uts;
    uname( &uts );
-   return String( uts.sysname );
+   return uts.sysname;
 }
 
 inline String
-SystemInfo::getSystemRelease( void )
+SystemInfo::getSystemRelease()
 {
    utsname uts;
    uname( &uts );
-   return String( uts.release );
+   return uts.release;
 }
 
 inline String
@@ -57,12 +57,11 @@ SystemInfo::getCurrentTime( const char* format )
    std::tm* localtime = std::localtime( &time_since_epoch );
    std::stringstream ss;
    ss << std::put_time( localtime, format );
-   return String( ss.str().c_str() );
+   return ss.str();
 }
 
-
 inline int
-SystemInfo::getNumberOfProcessors( void )
+SystemInfo::getNumberOfProcessors()
 {
    static int numberOfProcessors = 0;
    if( numberOfProcessors == 0 ) {
@@ -73,10 +72,10 @@ SystemInfo::getNumberOfProcessors( void )
 }
 
 inline String
-SystemInfo::getOnlineCPUs( void )
+SystemInfo::getOnlineCPUs()
 {
    std::string online = readFile< std::string >( "/sys/devices/system/cpu/online" );
-   return String( online.c_str() );
+   return online;
 }
 
 inline int
@@ -105,7 +104,7 @@ inline String
 SystemInfo::getCPUModelName( int cpu_id )
 {
    static String CPUModelName;
-   if( CPUModelName == "" ) {
+   if( CPUModelName.empty() ) {
       CPUInfo info = parseCPUInfo();
       CPUModelName = info.CPUModelName;
    }
@@ -154,14 +153,13 @@ SystemInfo::getCPUCacheSizes( int cpu_id )
 inline size_t
 SystemInfo::getFreeMemory()
 {
-   long pages = sysconf(_SC_PHYS_PAGES);
-   long page_size = sysconf(_SC_PAGE_SIZE);
+   long pages = sysconf( _SC_PHYS_PAGES );
+   long page_size = sysconf( _SC_PAGE_SIZE );
    return pages * page_size;
 }
 
-
 inline SystemInfo::CPUInfo
-SystemInfo::parseCPUInfo( void )
+SystemInfo::parseCPUInfo()
 {
    CPUInfo info;
    std::ifstream file( "/proc/cpuinfo" );
@@ -172,36 +170,35 @@ SystemInfo::parseCPUInfo( void )
 
    char line[ 1024 ];
    std::set< int > processors;
-   while( ! file.eof() )
-   {
+   while( ! file.eof() ) {
       int i;
       file.getline( line, 1024 );
-      if( strncmp( line, "physical id", strlen( "physical id" ) ) == 0 )
-      {
+      if( strncmp( line, "physical id", strlen( "physical id" ) ) == 0 ) {
          i = strlen( "physical id" );
-         while( line[ i ] != ':' && line[ i ] ) i ++;
+         while( line[ i ] != ':' && line[ i ] != '\0' )
+            i++;
          processors.insert( atoi( &line[ i + 1 ] ) );
          continue;
       }
       // FIXME: the rest does not work on heterogeneous multi-socket systems
-      if( strncmp( line, "model name", strlen( "model name" ) ) == 0 )
-      {
+      if( strncmp( line, "model name", strlen( "model name" ) ) == 0 ) {
          i = strlen( "model name" );
-         while( line[ i ] != ':' && line[ i ] ) i ++;
+         while( line[ i ] != ':' && line[ i ] != '\0' )
+            i++;
          info.CPUModelName = &line[ i + 1 ];
          continue;
       }
-      if( strncmp( line, "cpu cores", strlen( "cpu cores" ) ) == 0 )
-      {
+      if( strncmp( line, "cpu cores", strlen( "cpu cores" ) ) == 0 ) {
          i = strlen( "cpu MHz" );
-         while( line[ i ] != ':' && line[ i ] ) i ++;
+         while( line[ i ] != ':' && line[ i ] != '\0' )
+            i++;
          info.CPUCores = atoi( &line[ i + 1 ] );
          continue;
       }
-      if( strncmp( line, "siblings", strlen( "siblings" ) ) == 0 )
-      {
+      if( strncmp( line, "siblings", strlen( "siblings" ) ) == 0 ) {
          i = strlen( "siblings" );
-         while( line[ i ] != ':' && line[ i ] ) i ++;
+         while( line[ i ] != ':' && line[ i ] != '\0' )
+            i++;
          info.CPUThreads = atoi( &line[ i + 1 ] );
       }
    }
@@ -210,4 +207,4 @@ SystemInfo::parseCPUInfo( void )
    return info;
 }
 
-} // namespace TNL
+}  // namespace TNL
diff --git a/src/TNL/Timer.h b/src/TNL/Timer.h
index 9e6dc78ea0bae7eb8386c6bff04654358ca64122..827b96e516107d67a78fdf592e75e4e965fe3a06 100644
--- a/src/TNL/Timer.h
+++ b/src/TNL/Timer.h
@@ -26,123 +26,133 @@ class Logger;
  */
 class Timer
 {
-   public:
-
-      /**
-       * \brief Basic constructor.
-       *
-       * This function creates a new timer and resets it.
-       */
-      Timer();
-
-      /**
-       * \brief Resets timer.
-       *
-       * Resets all time and cycle measurements such as real time, CPU time and 
-       * CPU cycles. Sets all of them to zero.
-       */
-      void reset();
-
-      /**
-       * \brief Stops (pauses) the timer.
-       *
-       * Pauses all time and cycle measurements such as real time, CPU time and
-       * CPU cycles, but does not set them to zero.
-       */
-      void stop();
-
-      /**
-       * \brief Starts timer.
-       *
-       * Starts all time and cycle measurements such as real time, CPU time and
-       * CPU cycles. This method can be used also after using the \ref stop
-       * method. The timer then continues measuring the time without reseting.
-       */
-      void start();
-
-      /**
-       * \brief Returns the elapsed real time on this timer.
-       *
-       * This method returns the real time elapsed so far (in seconds).
-       * This method can be called while the timer is running, there is no
-       * need to use \ref stop method first.
-       */
-      double getRealTime() const;
-
-      /**
-       * \brief Returns the elapsed CPU time on this timer.
-       *
-       * This method returns the CPU time (i.e. time the CPU spent by processing
-       * this process) elapsed so far (in seconds). This method can be called
-       * while the timer is running, there is no need to use \ref stop method
-       * first.
-       */
-      double getCPUTime() const;
-
-      /**
-       * \brief Returns the number of CPU cycles (machine cycles) elapsed on this timer.
-       *
-       * CPU cycles are counted by adding the number of CPU cycles between
-       * \ref start and \ref stop methods together.
-       */
-      unsigned long long int getCPUCycles() const;
-
-      /**
-       * \brief Writes a record into the \e logger.
-       *
-       * \param logger Name of Logger object.
-       * \param logLevel A non-negative integer recording the log record indent.
-       * 
-       * \par Example
-       * \include TimerExampleLogger.cpp
-       * \par Output
-       * \include TimerExampleLogger.out
-       */
-      bool writeLog( Logger& logger, int logLevel = 0 ) const;
-
-   protected:
-
-      using TimePoint = typename std::chrono::high_resolution_clock::time_point;
-      using Duration = typename std::chrono::high_resolution_clock::duration;
-
-      /**
-       * \brief Function for measuring the real time.
-       */
-      TimePoint readRealTime() const;
-
-      /**
-       * \brief Function for measuring the CPU time.
-       */
-      double readCPUTime() const;
-
-      /**
-       * \brief Function for counting the number of CPU cycles (machine cycles).
-       */
-      unsigned long long int readCPUCycles() const;
-
-      /**
-       * \brief Converts the real time into seconds as a floating point number.
-       */
-      double durationToDouble( const Duration& duration ) const;
-
-      /**
-       * \brief Time Stamp Counter returning number of CPU cycles since reset.
-       *
-       * Only for x86 compatible CPUs.
-       */
-      inline unsigned long long rdtsc() const;
-
-      TimePoint initialRealTime;
-
-      Duration totalRealTime;
-
-      double initialCPUTime, totalCPUTime;
-
-      unsigned long long int initialCPUCycles, totalCPUCycles;
-
-      bool stopState;
+public:
+   /**
+    * \brief Basic constructor.
+    *
+    * This function creates a new timer and resets it.
+    */
+   Timer();
+
+   /**
+    * \brief Resets timer.
+    *
+    * Resets all time and cycle measurements such as real time, CPU time and
+    * CPU cycles. Sets all of them to zero.
+    */
+   void
+   reset();
+
+   /**
+    * \brief Stops (pauses) the timer.
+    *
+    * Pauses all time and cycle measurements such as real time, CPU time and
+    * CPU cycles, but does not set them to zero.
+    */
+   void
+   stop();
+
+   /**
+    * \brief Starts timer.
+    *
+    * Starts all time and cycle measurements such as real time, CPU time and
+    * CPU cycles. This method can be used also after using the \ref stop
+    * method. The timer then continues measuring the time without reseting.
+    */
+   void
+   start();
+
+   /**
+    * \brief Returns the elapsed real time on this timer.
+    *
+    * This method returns the real time elapsed so far (in seconds).
+    * This method can be called while the timer is running, there is no
+    * need to use \ref stop method first.
+    */
+   double
+   getRealTime() const;
+
+   /**
+    * \brief Returns the elapsed CPU time on this timer.
+    *
+    * This method returns the CPU time (i.e. time the CPU spent by processing
+    * this process) elapsed so far (in seconds). This method can be called
+    * while the timer is running, there is no need to use \ref stop method
+    * first.
+    */
+   double
+   getCPUTime() const;
+
+   /**
+    * \brief Returns the number of CPU cycles (machine cycles) elapsed on this timer.
+    *
+    * CPU cycles are counted by adding the number of CPU cycles between
+    * \ref start and \ref stop methods together.
+    */
+   unsigned long long int
+   getCPUCycles() const;
+
+   /**
+    * \brief Writes a record into the \e logger.
+    *
+    * \param logger Name of Logger object.
+    * \param logLevel A non-negative integer recording the log record indent.
+    *
+    * \par Example
+    * \include TimerExampleLogger.cpp
+    * \par Output
+    * \include TimerExampleLogger.out
+    */
+   bool
+   writeLog( Logger& logger, int logLevel = 0 ) const;
+
+protected:
+   using TimePoint = typename std::chrono::high_resolution_clock::time_point;
+   using Duration = typename std::chrono::high_resolution_clock::duration;
+
+   /**
+    * \brief Function for measuring the real time.
+    */
+   static TimePoint
+   readRealTime();
+
+   /**
+    * \brief Function for measuring the CPU time.
+    */
+   static double
+   readCPUTime();
+
+   /**
+    * \brief Function for counting the number of CPU cycles (machine cycles).
+    */
+   static unsigned long long int
+   readCPUCycles();
+
+   /**
+    * \brief Converts the real time into seconds as a floating point number.
+    */
+   static double
+   durationToDouble( const Duration& duration );
+
+   /**
+    * \brief Time Stamp Counter returning number of CPU cycles since reset.
+    *
+    * Only for x86 compatible CPUs.
+    */
+   static inline unsigned long long
+   rdtsc();
+
+   TimePoint initialRealTime;
+
+   Duration totalRealTime;
+
+   double initialCPUTime, totalCPUTime;
+
+   unsigned long long int initialCPUCycles, totalCPUCycles;
+
+   bool stopState;
 };
 
-} // namespace TNL
+}  // namespace TNL
 
 #include <TNL/Timer.hpp>
diff --git a/src/TNL/Timer.hpp b/src/TNL/Timer.hpp
index a3dd0126bc5e05604afa28f1050a6977b653d0f9..4fca84991835ea9e009a1fda4bbc08da9e8b3f7b 100644
--- a/src/TNL/Timer.hpp
+++ b/src/TNL/Timer.hpp
@@ -11,7 +11,7 @@
 
 // check if we are on a POSIX system or Windows,
 // see https://stackoverflow.com/a/4575466
-#if !defined(_WIN32) && !defined(_WIN64)
+#if ! defined( _WIN32 ) && ! defined( _WIN64 )
    #include <sys/resource.h>
 #endif
 
@@ -22,7 +22,8 @@ inline Timer::Timer()
    reset();
 }
 
-inline void Timer::reset()
+inline void
+Timer::reset()
 {
    this->initialCPUTime = 0;
    this->totalCPUTime = 0.0;
@@ -33,87 +34,97 @@ inline void Timer::reset()
    this->stopState = true;
 }
 
-inline void Timer::stop()
+inline void
+Timer::stop()
 {
-
-   if( ! this->stopState )
-   {
-      this->totalRealTime += this->readRealTime() - this->initialRealTime;
-      this->totalCPUTime += this->readCPUTime() - this->initialCPUTime;
-      this->totalCPUCycles += this->readCPUCycles() - this->initialCPUCycles;
+   if( ! this->stopState ) {
+      this->totalRealTime += readRealTime() - this->initialRealTime;
+      this->totalCPUTime += readCPUTime() - this->initialCPUTime;
+      this->totalCPUCycles += readCPUCycles() - this->initialCPUCycles;
       this->stopState = true;
    }
 }
 
-inline void Timer::start()
+inline void
+Timer::start()
 {
-   this->initialRealTime = this->readRealTime();
-   this->initialCPUTime = this->readCPUTime();
-   this->initialCPUCycles = this->readCPUCycles(); 
+   this->initialRealTime = readRealTime();
+   this->initialCPUTime = readCPUTime();
+   this->initialCPUCycles = readCPUCycles();
    this->stopState = false;
 }
 
-inline double Timer::getRealTime() const
+inline double
+Timer::getRealTime() const
 {
    if( ! this->stopState )
-      return durationToDouble( this->readRealTime() - this->initialRealTime );
+      return durationToDouble( readRealTime() - this->initialRealTime );
    return durationToDouble( this->totalRealTime );
 }
 
-inline double Timer::getCPUTime() const
+inline double
+Timer::getCPUTime() const
 {
    if( ! this->stopState )
-      return this->readCPUTime() - this->initialCPUTime;
+      return readCPUTime() - this->initialCPUTime;
    return this->totalCPUTime;
 }
 
-inline unsigned long long int Timer::getCPUCycles() const
+inline unsigned long long int
+Timer::getCPUCycles() const
 {
    if( ! this->stopState )
-      return this->readCPUCycles() - this->initialCPUCycles;
+      return readCPUCycles() - this->initialCPUCycles;
    return this->totalCPUCycles;
 }
 
-inline bool Timer::writeLog( Logger& logger, int logLevel ) const
+inline bool
+Timer::writeLog( Logger& logger, int logLevel ) const
 {
-   logger.writeParameter< double                 >( "Real time:",  this->getRealTime(),  logLevel );
-   logger.writeParameter< double                 >( "CPU time:",   this->getCPUTime(),   logLevel );
+   logger.writeParameter< double >( "Real time:", this->getRealTime(), logLevel );
+   logger.writeParameter< double >( "CPU time:", this->getCPUTime(), logLevel );
    logger.writeParameter< unsigned long long int >( "CPU Cycles:", this->getCPUCycles(), logLevel );
    return true;
 }
 
-inline typename Timer::TimePoint Timer::readRealTime() const
+inline typename Timer::TimePoint
+Timer::readRealTime()
 {
    return std::chrono::high_resolution_clock::now();
 }
 
-inline double Timer::readCPUTime() const
+inline double
+Timer::readCPUTime()
 {
-#if !defined(_WIN32) && !defined(_WIN64)
+#if ! defined( _WIN32 ) && ! defined( _WIN64 )
    rusage initUsage;
    getrusage( RUSAGE_SELF, &initUsage );
-   return initUsage. ru_utime. tv_sec + 1.0e-6 * ( double ) initUsage. ru_utime. tv_usec;
+   return initUsage.ru_utime.tv_sec + 1.0e-6 * (double) initUsage.ru_utime.tv_usec;
 #else
    return -1;
 #endif
 }
 
-inline unsigned long long int Timer::readCPUCycles() const
+inline unsigned long long int
+Timer::readCPUCycles()
 {
-   return this->rdtsc();
+   return rdtsc();
 }
 
-inline double Timer::durationToDouble( const Duration& duration ) const
+inline double
+Timer::durationToDouble( const Duration& duration )
 {
    std::chrono::duration< double > dur( duration );
    return dur.count();
 }
 
-inline unsigned long long Timer::rdtsc() const
+inline unsigned long long
+Timer::rdtsc()
 {
-  unsigned hi, lo;
-  __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
-  return ( ( unsigned long long ) lo ) | ( ( ( unsigned long long ) hi ) << 32 );
+   unsigned hi;
+   unsigned lo;
+   __asm__ __volatile__( "rdtsc" : "=a"( lo ), "=d"( hi ) );
+   return ( (unsigned long long) lo ) | ( ( (unsigned long long) hi ) << 32 );
 }
 
-} // namespace TNL
+}  // namespace TNL
diff --git a/src/TNL/TypeInfo.h b/src/TNL/TypeInfo.h
index d6e1ce6515179140f8101ba463606da865fd6dba..3d71fdadecec7d33776cedf04ff6779f2d31a550 100644
--- a/src/TNL/TypeInfo.h
+++ b/src/TNL/TypeInfo.h
@@ -11,7 +11,7 @@
 #include <string>
 
 #if defined( __has_include )
-   #if __has_include(<cxxabi.h>)
+   #if __has_include( <cxxabi.h>)
       #define TNL_HAS_CXXABI_H
    #endif
 #elif defined( __GLIBCXX__ ) || defined( __GLIBCPP__ )
@@ -20,12 +20,10 @@
 
 #if defined( TNL_HAS_CXXABI_H )
    #include <cxxabi.h>  // abi::__cxa_demangle
-   #include <memory>  // std::unique_ptr
-   #include <cstdlib>  // std::free
+   #include <memory>    // std::unique_ptr
+   #include <cstdlib>   // std::free
 #endif
 
-#include <TNL/String.h>
-
 namespace TNL {
 namespace detail {
 
@@ -35,11 +33,8 @@ demangle( const char* name )
 #if defined( TNL_HAS_CXXABI_H )
    int status = 0;
    std::size_t size = 0;
-   std::unique_ptr<char[], void (*)(void*)> result(
-      abi::__cxa_demangle( name, NULL, &size, &status ),
-      std::free
-   );
-   if( result.get() )
+   std::unique_ptr< char[], void ( * )( void* ) > result( abi::__cxa_demangle( name, nullptr, &size, &status ), std::free );
+   if( result != nullptr )
       return result.get();
 #endif
    return name;
@@ -53,26 +48,21 @@ class HasStaticGetSerializationType
 {
 private:
    template< typename U >
-   static constexpr auto check(U*)
-   -> typename
-      std::enable_if_t<
-         ! std::is_same<
-               decltype( U::getSerializationType() ),
-               void
-            >::value,
-         std::true_type
-      >;
+   static constexpr auto
+   check( U* ) ->
+      typename std::enable_if_t< ! std::is_same< decltype( U::getSerializationType() ), void >::value, std::true_type >;
 
    template< typename >
-   static constexpr std::false_type check(...);
+   static constexpr std::false_type
+   check( ... );
 
-   using type = decltype(check<std::decay_t<T>>(0));
+   using type = decltype( check< std::decay_t< T > >( nullptr ) );
 
 public:
-    static constexpr bool value = type::value;
+   static constexpr bool value = type::value;
 };
 
-} // namespace detail
+}  // namespace detail
 
 /**
  * \brief Returns a human-readable string representation of given type.
@@ -82,9 +72,10 @@ public:
  * for details.
  */
 template< typename T >
-String getType()
+std::string
+getType()
 {
-   return detail::demangle( typeid(T).name() );
+   return detail::demangle( typeid( T ).name() );
 }
 
 /**
@@ -95,9 +86,10 @@ String getType()
  * for details.
  */
 template< typename T >
-String getType( T&& obj )
+std::string
+getType( T&& obj )
 {
-   return detail::demangle( typeid(obj).name() );
+   return detail::demangle( typeid( obj ).name() );
 }
 
 /**
@@ -109,9 +101,9 @@ String getType( T&& obj )
  * which may be necessary e.g. for class templates which should have the same
  * serialization type for multiple devices.
  */
-template< typename T,
-          std::enable_if_t< ! detail::HasStaticGetSerializationType< T >::value, bool > = true >
-String getSerializationType()
+template< typename T, std::enable_if_t< ! detail::HasStaticGetSerializationType< T >::value, bool > = true >
+std::string
+getSerializationType()
 {
    return getType< T >();
 }
@@ -120,11 +112,11 @@ String getSerializationType()
  * \brief Specialization of \ref getSerializationType for types which provide a
  *        static \e getSerializationType method to override the default behaviour.
  */
-template< typename T,
-          std::enable_if_t< detail::HasStaticGetSerializationType< T >::value, bool > = true >
-String getSerializationType()
+template< typename T, std::enable_if_t< detail::HasStaticGetSerializationType< T >::value, bool > = true >
+std::string
+getSerializationType()
 {
    return T::getSerializationType();
 }
 
-} // namespace TNL
+}  // namespace TNL
diff --git a/src/TNL/TypeTraits.h b/src/TNL/TypeTraits.h
index d9a5b7b7f6e459f95ab33441a9c63e910599fc4d..962546fe6220aaa0d6ddf15d4e4cdf38d6257614 100644
--- a/src/TNL/TypeTraits.h
+++ b/src/TNL/TypeTraits.h
@@ -11,6 +11,8 @@
 
 namespace TNL {
 
+// clang-format off
+
 template< typename T, typename R = void >
 struct enable_if_type
 {
@@ -24,14 +26,14 @@ template< typename T >
 class HasGetArrayDataMethod
 {
 private:
-    typedef char YesType[1];
-    typedef char NoType[2];
+   using YesType = char[1];
+   using NoType = char[2];
 
-    template< typename C > static YesType& test( decltype(std::declval< C >().getArrayData()) );
-    template< typename C > static NoType& test(...);
+   template< typename C > static YesType& test( decltype(std::declval< C >().getArrayData()) );
+   template< typename C > static NoType& test(...);
 
 public:
-    static constexpr bool value = ( sizeof( test< std::decay_t<T> >(0) ) == sizeof( YesType ) );
+   static constexpr bool value = ( sizeof( test< std::decay_t< T > >( nullptr ) ) == sizeof( YesType ) );
 };
 
 /**
@@ -41,14 +43,14 @@ template< typename T >
 class HasGetSizeMethod
 {
 private:
-    typedef char YesType[1];
-    typedef char NoType[2];
+   using YesType = char[1];
+   using NoType = char[2];
 
-    template< typename C > static YesType& test( decltype(std::declval< C >().getSize() ) );
-    template< typename C > static NoType& test(...);
+   template< typename C > static YesType& test( decltype(std::declval< C >().getSize() ) );
+   template< typename C > static NoType& test(...);
 
 public:
-    static constexpr bool value = ( sizeof( test< std::decay_t<T> >(0) ) == sizeof( YesType ) );
+   static constexpr bool value = ( sizeof( test< std::decay_t<T> >(0) ) == sizeof( YesType ) );
 };
 
 /**
@@ -72,10 +74,10 @@ private:
    template< typename >
    static constexpr std::false_type check(...);
 
-   using type = decltype(check<std::decay_t<T>>(0));
+   using type = decltype( check< std::decay_t< T > >( nullptr ) );
 
 public:
-    static constexpr bool value = type::value;
+   static constexpr bool value = type::value;
 };
 
 /**
@@ -99,10 +101,10 @@ private:
    template< typename >
    static constexpr std::false_type check(...);
 
-   using type = decltype(check<std::decay_t<T>>(0));
+   using type = decltype( check< std::decay_t< T > >( nullptr ) );
 
 public:
-    static constexpr bool value = type::value;
+   static constexpr bool value = type::value;
 };
 
 /**
@@ -126,10 +128,10 @@ private:
    template< typename >
    static constexpr std::false_type check(...);
 
-   using type = decltype(check<std::decay_t<T>>(0));
+   using type = decltype( check< std::decay_t< T > >( nullptr ) );
 
 public:
-    static constexpr bool value = type::value;
+   static constexpr bool value = type::value;
 };
 
 /**
@@ -266,14 +268,14 @@ template< typename T >
 class HasGetCommunicatorMethod
 {
 private:
-    typedef char YesType[1];
-    typedef char NoType[2];
+   using YesType = char[1];
+   using NoType = char[2];
 
-    template< typename C > static YesType& test( decltype(std::declval< C >().getCommunicator()) );
-    template< typename C > static NoType& test(...);
+   template< typename C > static YesType& test( decltype(std::declval< C >().getCommunicator()) );
+   template< typename C > static NoType& test(...);
 
 public:
-    static constexpr bool value = ( sizeof( test< std::decay_t<T> >(0) ) == sizeof( YesType ) );
+   static constexpr bool value = ( sizeof( test< std::decay_t<T> >(0) ) == sizeof( YesType ) );
 };
 
 /**
@@ -286,8 +288,8 @@ struct copy_const
    struct from
    {
       using type = typename std::conditional<
-       std::is_const< Source >::value,
-       std::add_const_t< Target >, Target >::type;
+         std::is_const< Source >::value,
+         std::add_const_t< Target >, Target >::type;
    };
 };
 
@@ -298,14 +300,16 @@ template< typename T >
 class HasCountMember
 {
 private:
-    typedef char YesType[1];
-    typedef char NoType[2];
+   typedef char YesType[1];
+   typedef char NoType[2];
 
-    template< typename C > static YesType& test( decltype( &C::count ) );
-    template< typename C > static NoType& test(...);
+   template< typename C > static YesType& test( decltype( &C::count ) );
+   template< typename C > static NoType& test(...);
 
 public:
-    static constexpr bool value = ( sizeof( test< std::decay_t<T> >(0) ) == sizeof( YesType ) );
+   static constexpr bool value = ( sizeof( test< std::decay_t<T> >(0) ) == sizeof( YesType ) );
 };
 
-} //namespace TNL
+// clang-format on
+
+}  // namespace TNL
diff --git a/src/TNL/base64.h b/src/TNL/base64.h
index 0fce8bf5dd5fe8508357de854d20d0963ddeaac4..6d97f12929587e6f14858465dbd6b5cda0a9a0c3 100644
--- a/src/TNL/base64.h
+++ b/src/TNL/base64.h
@@ -11,7 +11,7 @@
 #include <memory>
 #include <utility>
 #include <stdexcept>
-#include <cmath>    // std::ceil
+#include <cmath>  // std::ceil
 
 namespace TNL {
 /**
@@ -31,17 +31,17 @@ namespace base64 {
 inline std::size_t
 get_encoded_length( std::size_t byte_length )
 {
-   std::size_t encoded = std::ceil(byte_length * (4.0 / 3.0));
+   std::size_t encoded = std::ceil( byte_length * ( 4.0 / 3.0 ) );
    // base64 uses padding to a multiple of 4
    if( encoded % 4 == 0 )
       return encoded;
-   return encoded + 4 - (encoded % 4);
+   return encoded + 4 - ( encoded % 4 );
 }
 
 /**
  * \brief Static table for base64 encoding.
  */
-static constexpr unsigned char encoding_table[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+static constexpr unsigned char encoding_table[ 65 ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 
 /**
  * \brief Static table for base64 decoding.
@@ -57,22 +57,17 @@ static constexpr unsigned char encoding_table[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZa
  * decoding_table[(int) '='] = 0;
  * \endcode
  */
-static constexpr std::uint8_t decoding_table[256] = {
-   128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
-   128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
-   128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,  62, 128, 128, 128,  63,
-    52,  53,  54,  55,  56,  57,  58,  59,  60,  61, 128, 128, 128,   0, 128, 128,
-   128,   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,
-    15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25, 128, 128, 128, 128, 128,
-   128,  26,  27,  28,  29,  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,
-    41,  42,  43,  44,  45,  46,  47,  48,  49,  50,  51, 128, 128, 128, 128, 128,
-   128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
-   128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
-   128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
-   128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
-   128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
-   128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
-   128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+static constexpr std::uint8_t decoding_table[ 256 ] = {
+   128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+   128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 62,  128, 128, 128, 63,
+   52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  128, 128, 128, 0,   128, 128, 128, 0,   1,   2,   3,   4,   5,   6,
+   7,   8,   9,   10,  11,  12,  13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  128, 128, 128, 128, 128,
+   128, 26,  27,  28,  29,  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,  48,
+   49,  50,  51,  128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+   128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+   128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+   128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
+   128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
    128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128
 };
 
@@ -83,11 +78,11 @@ static constexpr std::uint8_t decoding_table[256] = {
  * \param data_size Length of the input data (in bytes).
  * \return A \ref std::unique_ptr to the encoded data.
  */
-inline std::unique_ptr<char[]>
+inline std::unique_ptr< char[] >
 encode( const std::uint8_t* data, std::size_t data_size )
 {
    const std::size_t output_length = get_encoded_length( data_size );
-   std::unique_ptr<char[]> encoded_data{new char[output_length + 1]};
+   std::unique_ptr< char[] > encoded_data{ new char[ output_length + 1 ] };
 
    const std::uint8_t* end = data + data_size;
    const std::uint8_t* in = data;
@@ -95,22 +90,22 @@ encode( const std::uint8_t* data, std::size_t data_size )
    char* pos = out;
 
    while( end - in >= 3 ) {
-      *pos++ = encoding_table[in[0] >> 2];
-      *pos++ = encoding_table[((in[0] & 0x03) << 4) | (in[1] >> 4)];
-      *pos++ = encoding_table[((in[1] & 0x0f) << 2) | (in[2] >> 6)];
-      *pos++ = encoding_table[in[2] & 0x3f];
+      *pos++ = encoding_table[ in[ 0 ] >> 2 ];
+      *pos++ = encoding_table[ ( ( in[ 0 ] & 0x03 ) << 4 ) | ( in[ 1 ] >> 4 ) ];
+      *pos++ = encoding_table[ ( ( in[ 1 ] & 0x0f ) << 2 ) | ( in[ 2 ] >> 6 ) ];
+      *pos++ = encoding_table[ in[ 2 ] & 0x3f ];
       in += 3;
    }
 
-   if( end - in ) {
-      *pos++ = encoding_table[in[0] >> 2];
+   if( end - in != 0 ) {
+      *pos++ = encoding_table[ in[ 0 ] >> 2 ];
       if( end - in == 1 ) {
-         *pos++ = encoding_table[(in[0] & 0x03) << 4];
+         *pos++ = encoding_table[ ( in[ 0 ] & 0x03 ) << 4 ];
          *pos++ = '=';
       }
       else {
-         *pos++ = encoding_table[((in[0] & 0x03) << 4) | (in[1] >> 4)];
-         *pos++ = encoding_table[(in[1] & 0x0f) << 2];
+         *pos++ = encoding_table[ ( ( in[ 0 ] & 0x03 ) << 4 ) | ( in[ 1 ] >> 4 ) ];
+         *pos++ = encoding_table[ ( in[ 1 ] & 0x0f ) << 2 ];
       }
       *pos++ = '=';
    }
@@ -131,30 +126,30 @@ encode( const std::uint8_t* data, std::size_t data_size )
 inline std::ptrdiff_t
 decode_block( const char* input, std::size_t input_length, std::uint8_t* output, std::size_t output_length )
 {
-   const std::size_t min_buffer_size = std::ceil(input_length * (3.0 / 4.0));
+   const std::size_t min_buffer_size = std::ceil( input_length * ( 3.0 / 4.0 ) );
    if( output_length < min_buffer_size )
-      throw std::logic_error( "base64: insufficient output buffer size " + std::to_string(output_length)
-                              + " (needed at least " + std::to_string(min_buffer_size) + " bytes)" );
+      throw std::logic_error( "base64: insufficient output buffer size " + std::to_string( output_length )
+                              + " (needed at least " + std::to_string( min_buffer_size ) + " bytes)" );
 
    std::size_t count = 0;
    int pad = 0;
-   std::uint8_t block[4];
+   std::uint8_t block[ 4 ];
    std::uint8_t* pos = output;
 
-   for (std::size_t i = 0; i < input_length; i++) {
-      const std::uint8_t tmp = decoding_table[(int) input[i]];
+   for( std::size_t i = 0; i < input_length; i++ ) {
+      const std::uint8_t tmp = decoding_table[ (int) input[ i ] ];
       if( tmp == 128 )
          continue;
 
-      if( input[i] == '=' )
+      if( input[ i ] == '=' )
          pad++;
-      block[count] = tmp;
+      block[ count ] = tmp;
       count++;
 
       if( count == 4 ) {
-         *pos++ = (block[0] << 2) | (block[1] >> 4);
-         *pos++ = (block[1] << 4) | (block[2] >> 2);
-         *pos++ = (block[2] << 6) | block[3];
+         *pos++ = ( block[ 0 ] << 2 ) | ( block[ 1 ] >> 4 );
+         *pos++ = ( block[ 1 ] << 4 ) | ( block[ 2 ] >> 2 );
+         *pos++ = ( block[ 2 ] << 6 ) | block[ 3 ];
          count = 0;
          if( pad > 2 )
             // invalid padding
@@ -167,7 +162,7 @@ decode_block( const char* input, std::size_t input_length, std::uint8_t* output,
    }
 
    // check left-over chars
-   if( count )
+   if( count > 0 )
       throw std::invalid_argument( "base64: decoding error: invalid input (length not padded to a multiple of 4)" );
 
    return pos - output;
@@ -181,14 +176,14 @@ decode_block( const char* input, std::size_t input_length, std::uint8_t* output,
  * \return A pair of the decoded data length and a \ref std::unique_ptr to the
  *         decoded data.
  */
-inline std::pair< std::size_t, std::unique_ptr<std::uint8_t[]> >
+inline std::pair< std::size_t, std::unique_ptr< std::uint8_t[] > >
 decode( const char* data, const std::size_t data_size )
 {
-   const std::size_t buffer_size = std::ceil(data_size * (3.0 / 4.0));
-   std::unique_ptr<std::uint8_t[]> decoded_data{new std::uint8_t[buffer_size + 1]};
+   const std::size_t buffer_size = std::ceil( data_size * ( 3.0 / 4.0 ) );
+   std::unique_ptr< std::uint8_t[] > decoded_data{ new std::uint8_t[ buffer_size + 1 ] };
 
    const std::size_t decoded_length_data = decode_block( data, data_size, decoded_data.get(), buffer_size );
-   return {decoded_length_data, std::move(decoded_data)};
+   return { decoded_length_data, std::move( decoded_data ) };
 }
 
 /**
@@ -201,12 +196,13 @@ template< typename HeaderType = std::uint64_t, typename T >
 void
 write_encoded_block( const T* data, const std::size_t data_length, std::ostream& output_stream )
 {
-   const HeaderType size = data_length * sizeof(T);
-   std::unique_ptr<char[]> encoded_size = base64::encode( reinterpret_cast<const std::uint8_t*>(&size), sizeof(HeaderType) );
+   const HeaderType size = data_length * sizeof( T );
+   std::unique_ptr< char[] > encoded_size =
+      base64::encode( reinterpret_cast< const std::uint8_t* >( &size ), sizeof( HeaderType ) );
    output_stream << encoded_size.get();
-   std::unique_ptr<char[]> encoded_data = base64::encode( reinterpret_cast<const std::uint8_t*>(data), size );
+   std::unique_ptr< char[] > encoded_data = base64::encode( reinterpret_cast< const std::uint8_t* >( data ), size );
    output_stream << encoded_data.get();
 }
 
-} // namespace base64
-} // namespace TNL
+}  // namespace base64
+}  // namespace TNL
diff --git a/src/TNL/zlib_compression.h b/src/TNL/zlib_compression.h
index be52defc67ad2499ae632f353d734241866f0643..d1a347727b7f7658a7da4595ebfe28fb4cbf2de8 100644
--- a/src/TNL/zlib_compression.h
+++ b/src/TNL/zlib_compression.h
@@ -32,43 +32,37 @@ write_compressed_block( const T* data,
                         std::ostream& output_stream,
                         const int compression_level = Z_DEFAULT_COMPRESSION )
 {
-   if (data_size == 0)
+   if( data_size == 0 )
       return;
 
    // allocate a buffer for compressing data and do so
-   uLongf compressed_data_length = compressBound(data_size * sizeof(T));
-   std::unique_ptr<std::uint8_t[]> compressed_data{new std::uint8_t[compressed_data_length]};
+   uLongf compressed_data_length = compressBound( data_size * sizeof( T ) );
+   std::unique_ptr< std::uint8_t[] > compressed_data{ new std::uint8_t[ compressed_data_length ] };
 
    // compress the data
-   const int status = compress2(
-            reinterpret_cast<Bytef*>(compressed_data.get()),
-            &compressed_data_length,
-            reinterpret_cast<const Bytef*>(data),
-            data_size * sizeof(T),
-            compression_level
-         );
-   if (status != Z_OK)
-      throw std::runtime_error("zlib compression failed");
+   const int status = compress2( reinterpret_cast< Bytef* >( compressed_data.get() ),
+                                 &compressed_data_length,
+                                 reinterpret_cast< const Bytef* >( data ),
+                                 data_size * sizeof( T ),
+                                 compression_level );
+   if( status != Z_OK )
+      throw std::runtime_error( "zlib compression failed" );
 
    // create compression header
-   const HeaderType compression_header[4] = {
-      (HeaderType) 1,                       // number of blocks
-      (HeaderType) (data_size * sizeof(T)), // size of block
-      (HeaderType) (data_size * sizeof(T)), // size of last block
-      (HeaderType) compressed_data_length   // list of compressed sizes of blocks
+   const HeaderType compression_header[ 4 ] = {
+      (HeaderType) 1,                            // number of blocks
+      (HeaderType) ( data_size * sizeof( T ) ),  // size of block
+      (HeaderType) ( data_size * sizeof( T ) ),  // size of last block
+      (HeaderType) compressed_data_length        // list of compressed sizes of blocks
    };
 
    // base64-encode the compression header
-   std::unique_ptr<char[]> encoded_header(
-            base64::encode(reinterpret_cast<const std::uint8_t*>(&compression_header[0]),
-                           4 * sizeof(HeaderType))
-         );
+   std::unique_ptr< char[] > encoded_header(
+      base64::encode( reinterpret_cast< const std::uint8_t* >( &compression_header[ 0 ] ), 4 * sizeof( HeaderType ) ) );
    output_stream << encoded_header.get();
 
    // base64-encode the compressed data
-   std::unique_ptr<char[]> encoded_data(
-            base64::encode(compressed_data.get(), compressed_data_length)
-         );
+   std::unique_ptr< char[] > encoded_data( base64::encode( compressed_data.get(), compressed_data_length ) );
    output_stream << encoded_data.get();
 }
 
@@ -77,25 +71,22 @@ write_compressed_block( const T* data,
  * type \e T and length \e data_size.
  */
 template< typename T >
-std::unique_ptr<T[]>
+std::unique_ptr< T[] >
 decompress_data( const std::uint8_t* decoded_data, const std::size_t decoded_data_length, const std::size_t data_size )
 {
    // decompress the data
-   std::unique_ptr<T[]> data{new T[data_size]};
-   uLongf uncompressed_length_data = data_size * sizeof(T);
-   const int status = uncompress(
-            reinterpret_cast<Bytef*>(data.get()),
-            &uncompressed_length_data,
-            reinterpret_cast<const Bytef*>(decoded_data),
-            decoded_data_length
-         );
-   if (status != Z_OK)
-      throw std::runtime_error("zlib decompression failed");
-
-   if (uncompressed_length_data != data_size * sizeof(T))
-      throw std::length_error("uncompressed data length does not match the size stored in the compression header: "
-                              + std::to_string(uncompressed_length_data) + " vs "
-                              + std::to_string(data_size));
+   std::unique_ptr< T[] > data{ new T[ data_size ] };
+   uLongf uncompressed_length_data = data_size * sizeof( T );
+   const int status = uncompress( reinterpret_cast< Bytef* >( data.get() ),
+                                  &uncompressed_length_data,
+                                  reinterpret_cast< const Bytef* >( decoded_data ),
+                                  decoded_data_length );
+   if( status != Z_OK )
+      throw std::runtime_error( "zlib decompression failed" );
+
+   if( uncompressed_length_data != data_size * sizeof( T ) )
+      throw std::length_error( "uncompressed data length does not match the size stored in the compression header: "
+                               + std::to_string( uncompressed_length_data ) + " vs " + std::to_string( data_size ) );
 
    return data;
 }
@@ -108,31 +99,31 @@ decompress_data( const std::uint8_t* decoded_data, const std::size_t decoded_dat
  * to the data.
  */
 template< typename HeaderType = std::uint64_t, typename T >
-std::pair<HeaderType, std::unique_ptr<T[]>>
+std::pair< HeaderType, std::unique_ptr< T[] > >
 decompress_block( const char* data )
 {
    // decode the header
-   const int encoded_header_length = base64::get_encoded_length(4 * sizeof(HeaderType));
-   std::pair<std::size_t, std::unique_ptr<std::uint8_t[]>> decoded_header = base64::decode(data, encoded_header_length);
-   const HeaderType* compression_header = reinterpret_cast<const HeaderType*>(decoded_header.second.get());
+   const int encoded_header_length = base64::get_encoded_length( 4 * sizeof( HeaderType ) );
+   std::pair< std::size_t, std::unique_ptr< std::uint8_t[] > > decoded_header = base64::decode( data, encoded_header_length );
+   const auto* compression_header = reinterpret_cast< const HeaderType* >( decoded_header.second.get() );
 
-   if (compression_header[0] != 1)
-      throw std::length_error("unexpected number of compressed blocks: "
-                              + std::to_string(compression_header[0]));
+   if( compression_header[ 0 ] != 1 )
+      throw std::length_error( "unexpected number of compressed blocks: " + std::to_string( compression_header[ 0 ] ) );
    // Note: for short arrays, paraview 5.9 creates files with:
    //       num_blocks == 1, block_size == 32768, last_block_size == [the actual data size]
-   //if (compression_header[1] != compression_header[2])
+   // if (compression_header[1] != compression_header[2])
    //    throw std::logic_error("inconsistent block sizes in the compression header: "
    //                           + std::to_string(compression_header[1]) + " vs "
    //                           + std::to_string(compression_header[2]));
-   const HeaderType data_size = compression_header[2] / sizeof(T);
-   const HeaderType compressed_data_length = base64::get_encoded_length(compression_header[3]);
+   const HeaderType data_size = compression_header[ 2 ] / sizeof( T );
+   const HeaderType compressed_data_length = base64::get_encoded_length( compression_header[ 3 ] );
 
    // decode the data
-   std::pair<std::size_t, std::unique_ptr<std::uint8_t[]>> decoded_data = base64::decode(data + encoded_header_length, compressed_data_length);
+   std::pair< std::size_t, std::unique_ptr< std::uint8_t[] > > decoded_data =
+      base64::decode( data + encoded_header_length, compressed_data_length );
 
    // decompress the data and return
-   return {data_size, decompress_data<T>(decoded_data.second.get(), decoded_data.first, data_size)};
+   return { data_size, decompress_data< T >( decoded_data.second.get(), decoded_data.first, data_size ) };
 }
 
 /**
@@ -143,43 +134,44 @@ decompress_block( const char* data )
  * to the data.
  */
 template< typename HeaderType = std::uint64_t, typename T >
-std::pair< HeaderType, std::unique_ptr<T[]> >
+std::pair< HeaderType, std::unique_ptr< T[] > >
 decompress_block( std::istream& input_stream )
 {
    // read the header
-   const int encoded_header_length = base64::get_encoded_length(4 * sizeof(HeaderType));
-   std::unique_ptr<char[]> encoded_header{new char[encoded_header_length]};
-   input_stream.read(encoded_header.get(), encoded_header_length);
-   if (!input_stream.good())
-      throw std::length_error("input is not long enough to contain a compression header");
+   const int encoded_header_length = base64::get_encoded_length( 4 * sizeof( HeaderType ) );
+   std::unique_ptr< char[] > encoded_header{ new char[ encoded_header_length ] };
+   input_stream.read( encoded_header.get(), encoded_header_length );
+   if( ! input_stream.good() )
+      throw std::length_error( "input is not long enough to contain a compression header" );
 
    // decode the header
-   std::pair<std::size_t, std::unique_ptr<std::uint8_t[]>> decoded_header = base64::decode(encoded_header.get(), encoded_header_length);
-   const HeaderType* compression_header = reinterpret_cast<const HeaderType*>(decoded_header.second.get());
+   std::pair< std::size_t, std::unique_ptr< std::uint8_t[] > > decoded_header =
+      base64::decode( encoded_header.get(), encoded_header_length );
+   const auto* compression_header = reinterpret_cast< const HeaderType* >( decoded_header.second.get() );
 
-   if (compression_header[0] != 1)
-      throw std::length_error("unexpected number of compressed blocks: "
-                              + std::to_string(compression_header[0]));
+   if( compression_header[ 0 ] != 1 )
+      throw std::length_error( "unexpected number of compressed blocks: " + std::to_string( compression_header[ 0 ] ) );
    // Note: for short arrays, paraview 5.9 creates files with:
    //       num_blocks == 1, block_size == 32768, last_block_size == [the actual data size]
-   //if (compression_header[1] != compression_header[2])
+   // if (compression_header[1] != compression_header[2])
    //    throw std::logic_error("inconsistent block sizes in the compression header: "
    //                           + std::to_string(compression_header[1]) + " vs "
    //                           + std::to_string(compression_header[2]));
-   const HeaderType data_size = compression_header[2] / sizeof(T);
-   const HeaderType compressed_data_length = base64::get_encoded_length(compression_header[3]);
+   const HeaderType data_size = compression_header[ 2 ] / sizeof( T );
+   const HeaderType compressed_data_length = base64::get_encoded_length( compression_header[ 3 ] );
 
    // read the compressed data
-   std::unique_ptr<char[]> encoded_data{new char[compressed_data_length]};
-   input_stream.read(encoded_data.get(), compressed_data_length);
-   if (!input_stream.good())
-      throw std::length_error("failed to read the compressed data");
+   std::unique_ptr< char[] > encoded_data{ new char[ compressed_data_length ] };
+   input_stream.read( encoded_data.get(), compressed_data_length );
+   if( ! input_stream.good() )
+      throw std::length_error( "failed to read the compressed data" );
 
    // decode the data
-   std::pair<std::size_t, std::unique_ptr<std::uint8_t[]>> decoded_data = base64::decode(encoded_data.get(), compressed_data_length);
+   std::pair< std::size_t, std::unique_ptr< std::uint8_t[] > > decoded_data =
+      base64::decode( encoded_data.get(), compressed_data_length );
 
    // decompress the data and return
-   return {data_size, decompress_data<T>(decoded_data.second.get(), decoded_data.first, data_size)};
+   return { data_size, decompress_data< T >( decoded_data.second.get(), decoded_data.first, data_size ) };
 }
 
-} // namespace TNL
+}  // namespace TNL
diff --git a/src/Tools/tnl-decompose-grid.cpp b/src/Tools/tnl-decompose-grid.cpp
index 149f2b2a2d7a1afe76a631bf33ceae3c28354b10..3df9de2ca5b69a64a9c6df2e27d1733e5d5e1661 100644
--- a/src/Tools/tnl-decompose-grid.cpp
+++ b/src/Tools/tnl-decompose-grid.cpp
@@ -154,5 +154,6 @@ int main( int argc, char* argv[] )
       run( std::forward<GridType>(grid), parameters );
       return true;
    };
-   return ! Meshes::resolveAndLoadMesh< DecomposeGridConfigTag, Devices::Host >( wrapper, inputFileName, inputFileFormat );
+   const bool status = Meshes::resolveAndLoadMesh< DecomposeGridConfigTag, Devices::Host >( wrapper, inputFileName, inputFileFormat );
+   return static_cast< int >( ! status );
 }
diff --git a/src/Tools/tnl-decompose-mesh.cpp b/src/Tools/tnl-decompose-mesh.cpp
index de9fa9e47314d3e7618483a244aa10c1b9f167ad..5ceb511342b26faec5c5dd6e55bd41f253c4360f 100644
--- a/src/Tools/tnl-decompose-mesh.cpp
+++ b/src/Tools/tnl-decompose-mesh.cpp
@@ -269,8 +269,8 @@ void
 decompose_and_save( const Mesh& mesh,
                     const unsigned nparts,
                     const MetisIndexArray& part,
-                    const std::shared_ptr< idx_t > dual_xadj,
-                    const std::shared_ptr< idx_t > dual_adjncy,
+                    const std::shared_ptr< idx_t >& dual_xadj,
+                    const std::shared_ptr< idx_t >& dual_adjncy,
                     const unsigned ncommon,
                     const unsigned ghost_levels,
                     const std::string pvtuFileName )
@@ -321,7 +321,8 @@ decompose_and_save( const Mesh& mesh,
    IndexArray seed_to_cell_index( cellsCount );
    for( unsigned p = 0; p < nparts; p++ ) {
       Index assigned = 0;
-      std::set< Index > boundary, ghost_neighbors;
+      std::set< Index > boundary;
+      std::set< Index > ghost_neighbors;
       for( Index local_idx = 0; local_idx < cells_counts[ p ]; local_idx++ ) {
          const Index global_idx = cells_local_to_global[ cells_offsets[ p ] + local_idx ];
          const auto& cell = mesh.template getEntity< typename Mesh::Cell >( global_idx );
@@ -519,7 +520,8 @@ decompose_and_save( const Mesh& mesh,
       seeds_global_indices.shrink_to_fit();
 
       // create "vtkGhostType" CellData and PointData arrays - see https://blog.kitware.com/ghost-and-blanking-visibility-changes/
-      Containers::Array< std::uint8_t, Devices::Sequential, Index > cellGhosts( seeds.size() ), pointGhosts( points.getSize() );
+      Containers::Array< std::uint8_t, Devices::Sequential, Index > cellGhosts( seeds.size() );
+      Containers::Array< std::uint8_t, Devices::Sequential, Index > pointGhosts( points.getSize() );
       for( Index i = 0; i < cells_counts[ p ]; i++ )
          cellGhosts[ i ] = 0;
       for( Index i = cells_counts[ p ]; i < (Index) seeds.size(); i++ )
@@ -619,7 +621,8 @@ void run( const Mesh& mesh, const Config::ParameterContainer& parameters )
    // get the mesh connectivity information in a format suitable for METIS. Actually, the same
    // format is used by the XML-based VTK formats - the only difference is that METIS requires
    // `offsets` to start with 0.
-   std::vector< idx_t > connectivity, offsets;
+   std::vector< idx_t > connectivity;
+   std::vector< idx_t > offsets;
    offsets.push_back(0);
    const Index cellsCount = mesh.template getEntitiesCount< typename Mesh::Cell >();
    for( Index i = 0; i < cellsCount; i++ ) {
@@ -778,5 +781,6 @@ int main( int argc, char* argv[] )
       run( std::forward<MeshType>(mesh), parameters );
       return true;
    };
-   return ! Meshes::resolveAndLoadMesh< DecomposeMeshConfigTag, Devices::Host >( wrapper, inputFileName, inputFileFormat );
+   const bool status = Meshes::resolveAndLoadMesh< DecomposeMeshConfigTag, Devices::Host >( wrapper, inputFileName, inputFileFormat );
+   return static_cast< int >( ! status );
 }
diff --git a/src/Tools/tnl-dicom-reader.cpp b/src/Tools/tnl-dicom-reader.cpp
index 44c7e5d24c0ce19a72ba742a8f2495d4782e2bd8..179b1a2387bc622054356989144aaed148b8e155 100644
--- a/src/Tools/tnl-dicom-reader.cpp
+++ b/src/Tools/tnl-dicom-reader.cpp
@@ -33,7 +33,7 @@ bool processDicomSeries( const Config::ParameterContainer& parameters )
    String meshFile = parameters.getParameter< String >( "mesh-file" );
    bool verbose = parameters.getParameter< bool >( "verbose" );
 
-   typedef Meshes::Grid< 2, double, Devices::Host, int > GridType;
+   using GridType = Meshes::Grid< 2, double, Devices::Host, int >;
    GridType grid;
    Containers::Vector< double, Devices::Host, int > vector;
    Images::RegionOfInterest< int > roi;
diff --git a/src/Tools/tnl-diff.h b/src/Tools/tnl-diff.h
index 0db35061f81d1d65145281586189cc94242b5380..d2465eb8a55adce2a5981bf99f88d1882de96420 100644
--- a/src/Tools/tnl-diff.h
+++ b/src/Tools/tnl-diff.h
@@ -202,7 +202,7 @@ bool computeDifferenceOfMeshFunctions( const MeshPointer& meshPointer, const Con
    if( verbose )
       std::cout << std::endl;
 
-   typedef typename MeshPointer::ObjectType Mesh;
+   using Mesh = typename MeshPointer::ObjectType;
    using MeshFunctionType = Functions::MeshFunction< Mesh, Mesh::getMeshDimension(), Real >;
    MeshFunctionType v1( meshPointer ), v2( meshPointer ), diff( meshPointer );
    Real totalL1Diff( 0.0 ), totalL2Diff( 0.0 ), totalMaxDiff( 0.0 );
@@ -553,7 +553,7 @@ bool processFiles( const Config::ParameterContainer& parameters )
    const String meshFile = parameters.getParameter< String >( "mesh" );
    const String meshFileFormat = parameters.getParameter< String >( "mesh-format" );
 
-   typedef Pointers::SharedPointer< Mesh > MeshPointer;
+   using MeshPointer = Pointers::SharedPointer< Mesh >;
    MeshPointer meshPointer;
    if( ! Meshes::loadMesh( *meshPointer, meshFile, meshFileFormat ) )
       return false;
diff --git a/src/Tools/tnl-grid-setup.h b/src/Tools/tnl-grid-setup.h
index fcb10bd06c13ac0f97e78d493204a0ba3ae8f53e..43aaca14dd9a04b2b025ad07d50cec0974e817b9 100644
--- a/src/Tools/tnl-grid-setup.h
+++ b/src/Tools/tnl-grid-setup.h
@@ -21,9 +21,9 @@ bool setupGrid( const Config::ParameterContainer& parameters )
       }
       IndexType sizeX = parameters.getParameter< int >( "size-x" );
 
-      typedef Meshes::Grid< 1, RealType, Devices::Host, IndexType > GridType;
-      typedef typename GridType::PointType PointType;
-      typedef typename GridType::CoordinatesType CoordinatesType;
+      using GridType = Meshes::Grid< 1, RealType, Devices::Host, IndexType >;
+      using PointType = typename GridType::PointType;
+      using CoordinatesType = typename GridType::CoordinatesType;
       GridType grid;
       grid.setDomain( PointType( originX ), PointType( proportionsX ) );
       grid.setDimensions( CoordinatesType( sizeX ) );
@@ -46,9 +46,9 @@ bool setupGrid( const Config::ParameterContainer& parameters )
       }
       IndexType sizeX = parameters.getParameter< int >( "size-x" );
       IndexType sizeY = parameters.getParameter< int >( "size-y" );
-      typedef Meshes::Grid< 2, RealType, Devices::Host, IndexType > GridType;
-      typedef typename GridType::PointType PointType;
-      typedef typename GridType::CoordinatesType CoordinatesType;
+      using GridType = Meshes::Grid< 2, RealType, Devices::Host, IndexType >;
+      using PointType = typename GridType::PointType;
+      using CoordinatesType = typename GridType::CoordinatesType;
       GridType grid;
       grid.setDomain( PointType( originX, originY ), PointType( proportionsX, proportionsY ) );
       grid.setDimensions( CoordinatesType( sizeX, sizeY ) );
@@ -86,9 +86,9 @@ bool setupGrid( const Config::ParameterContainer& parameters )
       IndexType sizeY = parameters.getParameter< int >( "size-y" );
       IndexType sizeZ = parameters.getParameter< int >( "size-z" );
 
-      typedef Meshes::Grid< 3, RealType, Devices::Host, IndexType > GridType;
-      typedef typename GridType::PointType PointType;
-      typedef typename GridType::CoordinatesType CoordinatesType;
+      using GridType = Meshes::Grid< 3, RealType, Devices::Host, IndexType >;
+      using PointType = typename GridType::PointType;
+      using CoordinatesType = typename GridType::CoordinatesType;
       GridType grid;
       grid.setDomain( PointType( originX, originY, originZ ), PointType( proportionsX, proportionsY, proportionsZ ) );
       grid.setDimensions( CoordinatesType( sizeX, sizeY, sizeZ ) );
diff --git a/src/Tools/tnl-image-converter.cpp b/src/Tools/tnl-image-converter.cpp
index d5ea7a1f515ebc4f9b86f18621d6a7bd40cefb2d..59f172582d94b54d606d3bd40958c8e492d27867 100644
--- a/src/Tools/tnl-image-converter.cpp
+++ b/src/Tools/tnl-image-converter.cpp
@@ -40,8 +40,7 @@ bool processImages( const Config::ParameterContainer& parameters )
    MeshFunctionType meshFunction;
 
    Images::RegionOfInterest< int > roi;
-   for( auto fileName : inputImages )
-   {
+   for( const auto& fileName : inputImages ) {
       const String outputFileName = removeFileNameExtension( fileName ) + ".vti";
       std::cout << "Processing image file " << fileName << "... ";
       Images::PGMImage< int > pgmImage;
@@ -96,8 +95,7 @@ bool processFiles( const Config::ParameterContainer& parameters )
    const std::string imageFormat = parameters.getParameter< std::string >( "image-format" );
    const std::string meshFunctionName = parameters.getParameter< std::string >( "mesh-function-name" );
 
-   for( auto fileName : inputFiles )
-   {
+   for( const auto& fileName : inputFiles ) {
       std::cout << "Processing file " << fileName << "... ";
       using Real = double;
       using GridType = Meshes::Grid< 2, Real, Devices::Host, int >;
diff --git a/src/Tools/tnl-init.h b/src/Tools/tnl-init.h
index 9e9d6a07b62de0f58287fb28842ff5e948626500..e1d4965b7151b16603610cc6049b8e5903aa3a01 100644
--- a/src/Tools/tnl-init.h
+++ b/src/Tools/tnl-init.h
@@ -42,15 +42,15 @@ bool renderFunction( const Config::ParameterContainer& parameters )
       reader.loadMesh( *meshPointer );
    }
 
-   typedef Functions::TestFunction< MeshType::getMeshDimension(), RealType > FunctionType;
-   typedef Pointers::SharedPointer<  FunctionType, typename MeshType::DeviceType > FunctionPointer;
+   using FunctionType = Functions::TestFunction< MeshType::getMeshDimension(), RealType >;
+   using FunctionPointer = Pointers::SharedPointer< FunctionType, typename MeshType::DeviceType >;
    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::getMeshDimension() > MeshFunctionType;
-   typedef Pointers::SharedPointer<  MeshFunctionType, typename MeshType::DeviceType > MeshFunctionPointer;
+   using MeshFunctionType = Functions::MeshFunction< MeshType, MeshType::getMeshDimension() >;
+   using MeshFunctionPointer = Pointers::SharedPointer< MeshFunctionType, typename MeshType::DeviceType >;
    MeshFunctionPointer meshFunction( meshPointer );
    //if( ! discreteFunction.setSize( mesh.template getEntitiesCount< typename MeshType::Cell >() ) )
    //   return false;
diff --git a/src/UnitTests/Containers/StaticArrayTest.cpp b/src/UnitTests/Containers/StaticArrayTest.cpp
index a3f787606ad32e678ff98af17cdc6d259d36cba2..48e4e34de73700c92b17e8421cee924b795182fa 100644
--- a/src/UnitTests/Containers/StaticArrayTest.cpp
+++ b/src/UnitTests/Containers/StaticArrayTest.cpp
@@ -97,7 +97,7 @@ TYPED_TEST( StaticArrayTest, getData )
    ArrayType u1;
    EXPECT_TRUE( u1.getData() );
 
-   const ArrayType u2;
+   const ArrayType& u2 = u1;
    EXPECT_TRUE( u2.getData() );
 }
 
diff --git a/src/UnitTests/Matrices/TridiagonalMatrixTest.h b/src/UnitTests/Matrices/TridiagonalMatrixTest.h
index 4e9440a4ef6f89f095c17ff64105395eaa5ec487..f9c701d547587defa22aa4c184a6d5f236f3d918 100644
--- a/src/UnitTests/Matrices/TridiagonalMatrixTest.h
+++ b/src/UnitTests/Matrices/TridiagonalMatrixTest.h
@@ -26,14 +26,14 @@ static const char* TEST_FILE_NAME = "test_TridiagonalMatrixTest.tnl";
 void test_GetSerializationType()
 {
    using namespace TNL::Algorithms::Segments;
-   EXPECT_EQ( ( TNL::Matrices::TridiagonalMatrix< float, TNL::Devices::Host, int, RowMajorOrder >::getSerializationType() ), TNL::String( "Matrices::TridiagonalMatrix< float, [any_device], int, true, [any_allocator] >" ) );
-   EXPECT_EQ( ( TNL::Matrices::TridiagonalMatrix< int,   TNL::Devices::Host, int, RowMajorOrder >::getSerializationType() ), TNL::String( "Matrices::TridiagonalMatrix< int, [any_device], int, true, [any_allocator] >" ) );
-   EXPECT_EQ( ( TNL::Matrices::TridiagonalMatrix< float, TNL::Devices::Cuda, int, RowMajorOrder >::getSerializationType() ), TNL::String( "Matrices::TridiagonalMatrix< float, [any_device], int, true, [any_allocator] >" ) );
-   EXPECT_EQ( ( TNL::Matrices::TridiagonalMatrix< int,   TNL::Devices::Cuda, int, RowMajorOrder >::getSerializationType() ), TNL::String( "Matrices::TridiagonalMatrix< int, [any_device], int, true, [any_allocator] >" ) );
-   EXPECT_EQ( ( TNL::Matrices::TridiagonalMatrix< float, TNL::Devices::Host, int, ColumnMajorOrder >::getSerializationType() ), TNL::String( "Matrices::TridiagonalMatrix< float, [any_device], int, false, [any_allocator] >" ) );
-   EXPECT_EQ( ( TNL::Matrices::TridiagonalMatrix< int,   TNL::Devices::Host, int, ColumnMajorOrder >::getSerializationType() ), TNL::String( "Matrices::TridiagonalMatrix< int, [any_device], int, false, [any_allocator] >" ) );
-   EXPECT_EQ( ( TNL::Matrices::TridiagonalMatrix< float, TNL::Devices::Cuda, int, ColumnMajorOrder >::getSerializationType() ), TNL::String( "Matrices::TridiagonalMatrix< float, [any_device], int, false, [any_allocator] >" ) );
-   EXPECT_EQ( ( TNL::Matrices::TridiagonalMatrix< int,   TNL::Devices::Cuda, int, ColumnMajorOrder >::getSerializationType() ), TNL::String( "Matrices::TridiagonalMatrix< int, [any_device], int, false, [any_allocator] >" ) );
+   EXPECT_EQ( ( TNL::Matrices::TridiagonalMatrix< float, TNL::Devices::Host, int, RowMajorOrder >::getSerializationType() ), TNL::String( "Matrices::TridiagonalMatrix< float, [any_device], int, RowMajorOrder, [any_allocator] >" ) );
+   EXPECT_EQ( ( TNL::Matrices::TridiagonalMatrix< int,   TNL::Devices::Host, int, RowMajorOrder >::getSerializationType() ), TNL::String( "Matrices::TridiagonalMatrix< int, [any_device], int, RowMajorOrder, [any_allocator] >" ) );
+   EXPECT_EQ( ( TNL::Matrices::TridiagonalMatrix< float, TNL::Devices::Cuda, int, RowMajorOrder >::getSerializationType() ), TNL::String( "Matrices::TridiagonalMatrix< float, [any_device], int, RowMajorOrder, [any_allocator] >" ) );
+   EXPECT_EQ( ( TNL::Matrices::TridiagonalMatrix< int,   TNL::Devices::Cuda, int, RowMajorOrder >::getSerializationType() ), TNL::String( "Matrices::TridiagonalMatrix< int, [any_device], int, RowMajorOrder, [any_allocator] >" ) );
+   EXPECT_EQ( ( TNL::Matrices::TridiagonalMatrix< float, TNL::Devices::Host, int, ColumnMajorOrder >::getSerializationType() ), TNL::String( "Matrices::TridiagonalMatrix< float, [any_device], int, ColumnMajorOrder, [any_allocator] >" ) );
+   EXPECT_EQ( ( TNL::Matrices::TridiagonalMatrix< int,   TNL::Devices::Host, int, ColumnMajorOrder >::getSerializationType() ), TNL::String( "Matrices::TridiagonalMatrix< int, [any_device], int, ColumnMajorOrder, [any_allocator] >" ) );
+   EXPECT_EQ( ( TNL::Matrices::TridiagonalMatrix< float, TNL::Devices::Cuda, int, ColumnMajorOrder >::getSerializationType() ), TNL::String( "Matrices::TridiagonalMatrix< float, [any_device], int, ColumnMajorOrder, [any_allocator] >" ) );
+   EXPECT_EQ( ( TNL::Matrices::TridiagonalMatrix< int,   TNL::Devices::Cuda, int, ColumnMajorOrder >::getSerializationType() ), TNL::String( "Matrices::TridiagonalMatrix< int, [any_device], int, ColumnMajorOrder, [any_allocator] >" ) );
 }
 
 template< typename Matrix >